diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 8ccc4b063..b05567e36 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,4 +1,4 @@ [bumpversion] -current_version = 4.0.0 +current_version = 5.0.0 files = fhirclient/client.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..0b4e14ce2 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +name: CI +on: [push, pull_request] +jobs: + ci: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python: [ '2.7', '3.6', '3.7', 'pypy3' ] + steps: + - name: Checkout + uses: actions/checkout@v1 + with: + submodules: true + - name: Setup Python ${{ matrix.python }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python }} + architecture: x64 + - name: Run Python ${{ matrix.python }} tests + run: | + pip install -r fhir-parser/requirements.txt + pip install requests isodate flake8 + ./test_models.sh + diff --git a/.gitmodules b/.gitmodules index 073348c0e..12ddc23c9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "fhir-parser"] path = fhir-parser url = https://github.com/smart-on-fhir/fhir-parser.git +[submodule "fhir-parser-DSTU2"] + path = fhir-parser-DSTU2 + url = https://github.com/smart-on-fhir/fhir-parser.git diff --git a/AUTHORS.md b/AUTHORS.md index 9f8c3abc2..74788cf33 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -9,6 +9,7 @@ Contributors The following wonderful people contributed directly or indirectly to this project: +- Andrew Wason - Erik Wiffin - Josh Mandel - Nikolai Schwertner diff --git a/Doxyfile b/Doxyfile index 66c76f666..52badd33e 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 = 4.0.0 +PROJECT_NUMBER = 5.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 ff67ea4ad..02fa09b28 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 |   -----------|---------------|--------- + **5.0.0** | | (DSTU 2, STU-3, R4) **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) @@ -50,7 +51,7 @@ settings = { } smart = client.FHIRClient(settings=settings) -import fhirclient.models.patient as p +import fhirclient.R4.models.patient as p patient = p.Patient.read('hca-pat-1', smart.server) patient.birthDate.isostring # '1963-06-12' @@ -81,7 +82,7 @@ You can work with the `FHIRServer` class directly, without using `FHIRClient`, b ```python smart = server.FHIRServer(None, 'https://fhir-open-api-dstu2.smarthealthit.org') -import fhirclient.models.patient as p +import fhirclient.models.R4.patient as p patient = p.Patient.read('hca-pat-1', smart) patient.name[0].given # ['Christy'] @@ -93,7 +94,7 @@ You can also search for resources matching a particular set of criteria: ```python smart = client.FHIRClient(settings=settings) -import fhirclient.models.procedure as p +import fhirclient.models.R4.procedure as p search = p.Procedure.where(struct={'subject': 'hca-pat-1', 'status': 'completed'}) procedures = search.perform_resources(smart.server) for procedure in procedures: @@ -112,8 +113,8 @@ Starting with version 1.0.5, data model validity are enforced to a certain degre #### Initialize Data Model ```python -import fhirclient.models.patient as p -import fhirclient.models.humanname as hn +import fhirclient.models.R4.patient as p +import fhirclient.models.R4.humanname as hn patient = p.Patient({'id': 'patient-1'}) patient.id # prints `patient-1` @@ -138,7 +139,7 @@ patient.as_json() ```python import json -import fhirclient.models.patient as p +import fhirclient.models.R4.patient as p with open('path/to/patient.json', 'r') as h: pjs = json.load(h) patient = p.Patient(pjs) diff --git a/fhir-parser-DSTU2 b/fhir-parser-DSTU2 new file mode 160000 index 000000000..8f179b93d --- /dev/null +++ b/fhir-parser-DSTU2 @@ -0,0 +1 @@ +Subproject commit 8f179b93de05e85aebcb25b47b2b305d0ebe607a diff --git a/fhir-parser-resources/settings-DSTU2.py b/fhir-parser-resources/settings-DSTU2.py new file mode 100644 index 000000000..925369196 --- /dev/null +++ b/fhir-parser-resources/settings-DSTU2.py @@ -0,0 +1,19 @@ +# These are settings for the FHIR class generator + +from Python.settings import * + +# classes/resources +write_resources = True +tpl_resource_target_ptrn = '../fhirclient/models/DSTU2/{}.py' # where to write the generated class files to, with one placeholder for the class name +resource_base_target = '../fhirclient/models/DSTU2/' # resource target directory, likely the same as `tpl_resource_target_ptrn` without the filename pattern + +# factory methods +write_factory = True +tpl_factory_target = '../fhirclient/models/DSTU2/fhirelementfactory.py' + +# unit tests +write_unittests = True +tpl_unittest_target_ptrn = '../fhirclient/models/DSTU2/{}_tests.py' + +# jinja2 doesn't support '..', generate_models.sh copies this file here +tpl_unittest_source = 'env/template-unittest.py' diff --git a/fhir-parser-resources/settings.py b/fhir-parser-resources/settings.py index af9f69bc5..9126ff7b8 100644 --- a/fhir-parser-resources/settings.py +++ b/fhir-parser-resources/settings.py @@ -5,23 +5,23 @@ from Default.settings import * # Base URL for where to load specification data from -specification_url = 'http://hl7.org/fhir/R4' +specification_url = 'http://hl7.org/fhir/{FHIR_VERSION}' # 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' # classes/resources write_resources = True -tpl_resource_target = '../fhirclient/models' # target directory to write the generated class files to +tpl_resource_target = '../fhirclient/models/{FHIR_VERSION}' # target directory to write the generated class files to tpl_codesystems_source = None # the template to use as source when writing enums for CodeSystems; can be `None` # factory methods write_factory = True -tpl_factory_target = '../fhirclient/models/fhirelementfactory.py' # where to write the generated factory to +tpl_factory_target = '../fhirclient/models/{FHIR_VERSION}/fhirelementfactory.py' # where to write the generated factory to # unit tests write_unittests = True -tpl_unittest_target = '../fhirclient/models' # target directory to write the generated unit test files to +tpl_unittest_target = '../fhirclient/models/{FHIR_VERSION}' # target directory to write the generated unit test files to # all these files should be copied to dirname(`tpl_resource_target_ptrn`): tuples of (path/to/file, module, array-of-class-names) diff --git a/fhir-parser-resources/template-unittest.py b/fhir-parser-resources/template-unittest.py index 5e552a836..dfeae2998 100644 --- a/fhir-parser-resources/template-unittest.py +++ b/fhir-parser-resources/template-unittest.py @@ -4,7 +4,7 @@ # Generated from FHIR {{ info.version }} on {{ info.date }}. # {{ info.year }}, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/__init__.py b/fhirclient/__init__.py index 7b45e7658..e69de29bb 100644 --- a/fhirclient/__init__.py +++ b/fhirclient/__init__.py @@ -1,5 +0,0 @@ -import sys -import os.path -abspath = os.path.abspath(os.path.dirname(__file__)) -if abspath not in sys.path: - sys.path.insert(0, abspath) diff --git a/fhirclient/auth.py b/fhirclient/auth.py index 8fe639993..f7bd68b76 100644 --- a/fhirclient/auth.py +++ b/fhirclient/auth.py @@ -5,18 +5,19 @@ try: # Python 2.x import urlparse from urllib import urlencode -except Exception as e: # Python 3 +except Exception: # Python 3 import urllib.parse as urlparse from urllib.parse import urlencode logger = logging.getLogger(__name__) + class FHIRAuth(object): """ Superclass to handle authorization flow and state. """ auth_type = 'none' auth_classes = {} - + @classmethod def register(cls): """ Register this class to handle authorization types of the given @@ -27,18 +28,18 @@ def register(cls): FHIRAuth.auth_classes[cls.auth_type] = cls elif FHIRAuth.auth_classes[cls.auth_type] != cls: raise Exception('Class {0} is already registered for authorization type "{1}"'.format(FHIRAuth.auth_classes[cls.auth_type], cls.auth_type)) - + @classmethod - def from_capability_security(cls, security, state=None): - """ Supply a capabilitystatement.rest.security statement and this + def from_security(cls, security, state=None): + """ Supply a capabilitystatement.rest.security or conformance.rest.security statement and this method will figure out which type of security should be instantiated. - - :param security: A CapabilityStatementRestSecurity instance + + :param security: A CapabilityStatementRestSecurity or ConformanceRestSecurity instance :param state: A settings/state dictionary :returns: A FHIRAuth instance or subclass thereof """ auth_type = None - + # look for OAuth2 URLs in SMART security extensions if security is not None and security.extension is not None: for e in security.extension: @@ -54,9 +55,10 @@ def from_capability_security(cls, security, state=None): state['registration_uri'] = ee.valueUri break else: - logger.warning("SMART AUTH: invalid `http://fhir-registry.smarthealthit.org/StructureDefinition/oauth-uris` extension: needs to include sub-extensions to define OAuth2 endpoints but there are none") - - # fallback to old extension URLs + logger.warning("SMART AUTH: invalid `http://fhir-registry.smarthealthit.org/StructureDefinition/oauth-uris`" + " extension: needs to include sub-extensions to define OAuth2 endpoints but there are none") + + # fallback to old extension URLs elif "http://fhir-registry.smarthealthit.org/StructureDefinition/oauth-uris#register" == e.url: state['registration_uri'] = e.valueUri elif "http://fhir-registry.smarthealthit.org/StructureDefinition/oauth-uris#authorize" == e.url: @@ -64,9 +66,9 @@ def from_capability_security(cls, security, state=None): auth_type = 'oauth2' elif "http://fhir-registry.smarthealthit.org/StructureDefinition/oauth-uris#token" == e.url: state['token_uri'] = e.valueUri - + return cls.create(auth_type, state=state) - + @classmethod def create(cls, auth_type, state=None): """ Factory method to create the correct subclass for the given @@ -77,49 +79,47 @@ def create(cls, auth_type, state=None): klass = FHIRAuth.auth_classes[auth_type] return klass(state=state) raise Exception('No class registered for authorization type "{0}"'.format(auth_type)) - - + def __init__(self, state=None): self.app_id = None if state is not None: self.from_state(state) - + @property def ready(self): """ Indicates whether the authorization part is ready to make resource requests. """ return True - + def reset(self): pass - + def can_sign_headers(self): return False - + def authorize_uri(self, server): """ Return the authorize URL to use, if any. """ return None - + def handle_callback(self, url, server): """ Return the launch context. """ raise Exception("{0} cannot handle callback URL".format(self)) - + def reauthorize(self): """ Perform a re-authorization of some form. - + :returns: The launch context dictionary or None on failure """ return None - - + # MARK: State - + @property def state(self): return { 'app_id': self.app_id, } - + def from_state(self, state): """ Update ivars from given state information. """ @@ -131,52 +131,50 @@ class FHIROAuth2Auth(FHIRAuth): """ OAuth2 handling class for FHIR servers. """ auth_type = 'oauth2' - + def __init__(self, state=None): self.aud = None self._registration_uri = None self._authorize_uri = None self._redirect_uri = None self._token_uri = None - + self.auth_state = None self.app_secret = None self.access_token = None self.refresh_token = None - + super(FHIROAuth2Auth, self).__init__(state=state) - + @property def ready(self): return True if self.access_token else False - + def reset(self): super(FHIROAuth2Auth, self).reset() self.access_token = None self.auth_state = None - - + # MARK: Signing/Authorizing Request Headers - + def can_sign_headers(self): return True if self.access_token is not None else False - + def signed_headers(self, headers): """ Returns updated HTTP request headers, if possible, raises if there is no access_token. """ if not self.can_sign_headers(): raise Exception("Cannot sign headers since I have no access token") - + if headers is None: headers = {} headers['Authorization'] = "Bearer {0}".format(self.access_token) - + return headers - - + # MARK: OAuth2 Flow - + def authorize_uri(self, server): """ The URL to authorize against. The `server` param is supplied so that the server can be informed of state changes that need to be @@ -184,7 +182,7 @@ def authorize_uri(self, server): """ auth_params = self._authorize_params(server) logger.debug("SMART AUTH: Will use parameters for `authorize_uri`: {0}".format(auth_params)) - + # the authorize uri may have params, make sure to not lose them parts = list(urlparse.urlsplit(self._authorize_uri)) if len(parts[3]) > 0: @@ -192,9 +190,9 @@ def authorize_uri(self, server): args.update(auth_params) auth_params = args parts[3] = urlencode(auth_params, doseq=True) - + return urlparse.urlunsplit(parts) - + def _authorize_params(self, server): """ The URL parameters to use when requesting a token code. """ @@ -203,7 +201,7 @@ def _authorize_params(self, server): if self.auth_state is None: self.auth_state = str(uuid.uuid4())[:8] server.should_save_state() - + params = { 'response_type': 'code', 'client_id': self.app_id, @@ -215,11 +213,11 @@ def _authorize_params(self, server): if server.launch_token is not None: params['launch'] = server.launch_token return params - + def handle_callback(self, url, server): """ Verify OAuth2 callback URL and exchange the code, if everything goes well, for an access token. - + :param str url: The callback/redirect URL to handle :param server: The Server instance to use :returns: The launch context dictionary @@ -231,24 +229,24 @@ def handle_callback(self, url, server): args = dict(urlparse.parse_qsl(urlparse.urlsplit(url)[3])) except Exception as e: raise Exception("Invalid callback URL: {0}".format(e)) - + # verify response err = self.extract_oauth_error(args) if err is not None: raise Exception(err) - + stt = args.get('state') if stt is None or self.auth_state != stt: raise Exception("Invalid state, will not use this code. Have: {0}, want: {1}".format(stt, self.auth_state)) - + code = args.get('code') if code is None: raise Exception("Did not receive a code, only have: {0}".format(', '.join(args.keys()))) - + # exchange code for token exchange = self._code_exchange_params(code) return self._request_access_token(server, exchange) - + def _code_exchange_params(self, code): """ These parameters are used by to exchange the given code for an access token. @@ -260,31 +258,31 @@ def _code_exchange_params(self, code): 'redirect_uri': self._redirect_uri, 'state': self.auth_state, } - + def _request_access_token(self, server, params): """ Requests an access token from the instance's server via a form POST request, remembers the token (and patient id if there is one) or raises an Exception. - + :returns: A dictionary with launch params """ if server is None: raise Exception("I need a server to request an access token") - + logger.debug("SMART AUTH: Requesting access token from {0}".format(self._token_uri)) auth = None if self.app_secret: auth = (self.app_id, self.app_secret) ret_params = server.post_as_form(self._token_uri, params, auth).json() - + self.access_token = ret_params.get('access_token') if self.access_token is None: raise Exception("No access token received") del ret_params['access_token'] - + if 'expires_in' in ret_params: del ret_params['expires_in'] - + # The refresh token issued by the authorization server. If present, the # app should discard any previous refresh_token associated with this # launch, replacing it with this new value. @@ -292,28 +290,27 @@ def _request_access_token(self, server, params): if refresh_token is not None: self.refresh_token = refresh_token del ret_params['refresh_token'] - + logger.debug("SMART AUTH: Received access token: {0}, refresh token: {1}" - .format(self.access_token is not None, self.refresh_token is not None)) + .format(self.access_token is not None, self.refresh_token is not None)) return ret_params - - + # MARK: Reauthorization - + def reauthorize(self, server): """ Perform reauthorization. - + :param server: The Server instance to use :returns: The launch context dictionary, or None on failure """ if self.refresh_token is None: logger.debug("SMART AUTH: Cannot reauthorize without refresh token") return None - + logger.debug("SMART AUTH: Refreshing token") reauth = self._reauthorize_params() return self._request_access_token(server, reauth) - + def _reauthorize_params(self): """ Parameters to be used in a reauthorize request. """ @@ -321,14 +318,13 @@ def _reauthorize_params(self): raise Exception("Cannot produce reauthorize parameters without refresh token") return { 'client_id': self.app_id, - #'client_secret': None, # we don't use it + # 'client_secret': None, # we don't use it 'grant_type': 'refresh_token', 'refresh_token': self.refresh_token, } - - + # MARK: State - + @property def state(self): s = super(FHIROAuth2Auth, self).state @@ -345,9 +341,9 @@ def state(self): s['access_token'] = self.access_token if self.refresh_token is not None: s['refresh_token'] = self.refresh_token - + return s - + def from_state(self, state): """ Update ivars from given state information. """ @@ -359,20 +355,19 @@ def from_state(self, state): self._token_uri = state.get('token_uri') or self._token_uri self.auth_state = state.get('auth_state') or self.auth_state self.app_secret = state.get('app_secret') or self.app_secret - + self.access_token = state.get('access_token') or self.access_token self.refresh_token = state.get('refresh_token') or self.refresh_token - - # MARK: Utilities - + # MARK: Utilities + def extract_oauth_error(self, args): """ Check if an argument dictionary contains OAuth error information. """ # "error_description" is optional, we prefer it if it's present if 'error_description' in args: return args['error_description'].replace('+', ' ') - + # the "error" response is required if there are errors, look for it if 'error' in args: err_code = args['error'] @@ -391,9 +386,9 @@ def extract_oauth_error(self, args): if 'temporarily_unavailable' == err_code: return "The authorization server is currently unable to handle the request due to a temporary overloading or maintenance of the server." return "Authorization error: {0}.".format(err_code) - + return None - + # register classes FHIRAuth.register() diff --git a/fhirclient/client.py b/fhirclient/client.py index adfebb4c2..93d4b6893 100644 --- a/fhirclient/client.py +++ b/fhirclient/client.py @@ -1,10 +1,12 @@ # -*- coding: utf-8 -*- import logging +import importlib -from server import FHIRServer, FHIRUnauthorizedException, FHIRNotFoundException +from .server import FHIRServer, FHIRUnauthorizedException, FHIRNotFoundException +from .constants import FHIRVersion -__version__ = '4.0.0' +__version__ = '5.0.0' __author__ = 'SMART Platforms Team' __license__ = 'APACHE2' __copyright__ = "Copyright 2017 Boston Children's Hospital" @@ -19,9 +21,10 @@ class FHIRClient(object): """ Instances of this class handle authorizing and talking to SMART on FHIR servers. - + The settings dictionary supports: - + + - `version`: The FHIRVersion supported - `app_id`*: Your app/client-id, e.g. 'my_web_app' - `app_secret`*: Your app/client-secret - `api_base`*: The FHIR service to connect to, e.g. 'https://fhir-api-dstu2.smarthealthit.org' @@ -30,45 +33,47 @@ class FHIRClient(object): - `scope`: Space-separated list of scopes to request, if other than default - `launch_token`: The launch token """ - - def __init__(self, settings=None, state=None, save_func=lambda x:x): + + def __init__(self, settings=None, state=None, save_func=lambda x: x): + self.version = FHIRVersion.R4 self.app_id = None self.app_secret = None """ The app-id for the app this client is used in. """ - + self.server = None self.scope = scope_default self.redirect = None """ The redirect-uri that will be used to redirect after authorization. """ - + self.launch_token = None """ The token/id provided at launch, if any. """ - + self.launch_context = None """ Context parameters supplied by the server during launch. """ - + self.wants_patient = True """ If true and launched without patient, will add the correct scope to indicate that the server should prompt for a patient after login. """ - + self.patient_id = None self._patient = None - + if save_func is None: raise Exception("Must supply a save_func when initializing the SMART client") self._save_func = save_func - + # init from state if state is not None: self.from_state(state) - + # init from settings dict elif settings is not None: - if not 'app_id' in settings: + if 'app_id' not in settings: raise Exception("Must provide 'app_id' in settings dictionary") - if not 'api_base' in settings: + if 'api_base' not in settings: raise Exception("Must provide 'api_base' in settings dictionary") - + + self.version = settings.get('version', self.version) self.app_id = settings['app_id'] self.app_secret = settings.get('app_secret') self.redirect = settings.get('redirect_uri') @@ -78,10 +83,9 @@ def __init__(self, settings=None, state=None, save_func=lambda x:x): self.server = FHIRServer(self, base_uri=settings['api_base']) else: raise Exception("Must either supply settings or a state upon client initialization") - - + # MARK: Authorization - + @property def desired_scope(self): """ Ensures `self.scope` is completed with launch scopes, according to @@ -93,22 +97,22 @@ def desired_scope(self): elif self.patient_id is None and self.wants_patient: scope = ' '.join([scope_patientlaunch, scope]) return scope - + @property def ready(self): """ Returns True if the client is ready to make API calls (e.g. there is an access token or this is an open server). - + :returns: True if the server can make authenticated calls """ return self.server.ready if self.server is not None else False - + def prepare(self): """ Returns True if the client is ready to make API calls (e.g. there is an access token or this is an open server). In contrast to the `ready` property, this method will fetch the server's capability statement if it hasn't yet been fetched. - + :returns: True if the server can make authenticated calls """ if self.server: @@ -116,95 +120,97 @@ def prepare(self): return True return self.server.prepare() return False - + @property def authorize_url(self): """ The URL to use to receive an authorization token. """ return self.server.authorize_uri if self.server is not None else None - + def handle_callback(self, url): """ You can call this to have the client automatically handle the auth callback after the user has logged in. - + :param str url: The complete callback URL """ ctx = self.server.handle_callback(url) if self.server is not None else None self._handle_launch_context(ctx) - + def reauthorize(self): """ Try to reauthorize with the server. - + :returns: A bool indicating reauthorization success """ ctx = self.server.reauthorize() if self.server is not None else None self._handle_launch_context(ctx) return self.launch_context is not None - + def _handle_launch_context(self, ctx): logger.debug("SMART: Handling launch context: {0}".format(ctx)) if 'patient' in ctx: - #print('Patient id was {0}, row context is {1}'.format(self.patient_id, ctx)) + # print('Patient id was {0}, row context is {1}'.format(self.patient_id, ctx)) self.patient_id = ctx['patient'] # TODO: TEST THIS! if 'id_token' in ctx: logger.warning("SMART: Received an id_token, ignoring") self.launch_context = ctx self.save_state() - - + # MARK: Current Patient - + @property def patient(self): if self._patient is None and self.patient_id is not None and self.ready: - import models.patient + patient = importlib.import_module("fhirclient.models.{}.patient".format(self.version)) try: logger.debug("SMART: Attempting to read Patient {0}".format(self.patient_id)) - self._patient = models.patient.Patient.read(self.patient_id, self.server) - except FHIRUnauthorizedException as e: + self._patient = patient.Patient.read(self.patient_id, self.server) + except FHIRUnauthorizedException: if self.reauthorize(): logger.debug("SMART: Attempting to read Patient {0} after reauthorizing" - .format(self.patient_id)) - self._patient = models.patient.Patient.read(self.patient_id, self.server) - except FHIRNotFoundException as e: + .format(self.patient_id)) + self._patient = patient.Patient.read(self.patient_id, self.server) + except FHIRNotFoundException: logger.warning("SMART: Patient with id {0} not found".format(self.patient_id)) self.patient_id = None self.save_state() - + return self._patient - + def human_name(self, human_name_instance): """ Formats a `HumanName` instance into a string. """ if human_name_instance is None: return 'Unknown' - + parts = [] for n in [human_name_instance.prefix, human_name_instance.given]: if n is not None: parts.extend(n) if human_name_instance.family: - parts.append(human_name_instance.family) + if isinstance(human_name_instance.family, list): + parts.extend(human_name_instance.family) + else: + parts.append(human_name_instance.family) if human_name_instance.suffix and len(human_name_instance.suffix) > 0: if len(parts) > 0: parts[len(parts)-1] = parts[len(parts)-1]+',' parts.extend(human_name_instance.suffix) - + return ' '.join(parts) if len(parts) > 0 else 'Unnamed' - - + # MARK: State - + def reset_patient(self): self.launch_token = None self.launch_context = None self.patient_id = None self._patient = None self.save_state() - + @property def state(self): return { + 'version': self.version, 'app_id': self.app_id, 'app_secret': self.app_secret, 'scope': self.scope, @@ -214,9 +220,10 @@ def state(self): 'launch_token': self.launch_token, 'launch_context': self.launch_context, } - + def from_state(self, state): assert state + self.version = state.get('version') or self.version self.app_id = state.get('app_id') or self.app_id self.app_secret = state.get('app_secret') or self.app_secret self.scope = state.get('scope') or self.scope @@ -225,7 +232,6 @@ def from_state(self, state): self.launch_token = state.get('launch_token') or self.launch_token self.launch_context = state.get('launch_context') or self.launch_context self.server = FHIRServer(self, state=state.get('server')) - - def save_state (self): - self._save_func(self.state) + def save_state(self): + self._save_func(self.state) diff --git a/fhirclient/constants.py b/fhirclient/constants.py new file mode 100644 index 000000000..a5afd314e --- /dev/null +++ b/fhirclient/constants.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- + + +class FHIRVersion(object): + R4 = "R4" + STU3 = "STU3" + DSTU2 = "DSTU2" diff --git a/fhirclient/fhirreference_tests.py b/fhirclient/fhirreference_tests.py index 5e9870ed2..c95592eca 100755 --- a/fhirclient/fhirreference_tests.py +++ b/fhirclient/fhirreference_tests.py @@ -5,27 +5,23 @@ import os.path import logging import unittest -import models.questionnaire as questionnaire -import models.medication as medication -import models.resource as resource -import models.valueset as valueset -import models.patient as patient -import models.bundle as bundle -import server +from . import server logging.basicConfig(level=logging.CRITICAL) class TestResourceReference(unittest.TestCase): - - def testContainedResourceDetection(self): - with io.open('test_contained_resource.json', 'r', encoding='utf-8') as h: + + def testContainedResourceDetectionR4(self): + from .models.R4 import questionnaire, medication, resource, valueset + + with io.open('fhirclient/fixtures/test_contained_resource_R4.json', 'r', encoding='utf-8') as h: data = json.load(h) q = questionnaire.Questionnaire(data) self.assertIsNotNone(q, "Must instantiate Questionnaire") - self.assertEqual('Questionnaire', q.resource_type) - + self.assertEqual('Questionnaire', q.resource_type if hasattr(q, "resource_type") else q.resource_name) + group = q.item[0].item[3] self.assertEqual('Observation.subject', group.linkId) question = group.item[0] @@ -41,7 +37,7 @@ def testContainedResourceDetection(self): 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 = reference.resolved(medication.Medication) self.assertIsNone(contained, "Must not resolve on resource type mismatch") @@ -50,44 +46,146 @@ def testContainedResourceDetection(self): contained = reference.resolved(valueset.ValueSet) self.assertIsNotNone(contained, "Must resolve contained ValueSet") self.assertEqual('ValueSet', contained.resource_type) - - def testRelativeReference(self): - with io.open('test_relative_reference.json', 'r', encoding='utf-8') as h: + + def testContainedResourceDetectionSTU3(self): + from .models.STU3 import questionnaire, medication, resource, valueset + + with io.open('fhirclient/fixtures/test_contained_resource_STU3.json', 'r', encoding='utf-8') as h: + data = json.load(h) + q = questionnaire.Questionnaire(data) + self.assertIsNotNone(q, "Must instantiate Questionnaire") + self.assertEqual('Questionnaire', q.resource_type) + + group = q.item[0].item[3] + self.assertEqual('Observation.subject', group.linkId) + question = group.item[0] + self.assertEqual('Observation.subject._type', question.linkId) + self.assertIsNotNone(question.options) + with self.assertRaises(Exception): + question.options.resolved() + + # 1st resolve, extracting from contained resources + contained = question.options.resolved(medication.Medication) + self.assertIsNone(contained, "Must not resolve on resource type mismatch") + contained = question.options.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) + self.assertIsNone(contained, "Must not resolve on resource type mismatch") + contained = question.options.resolved(resource.Resource) + self.assertIsNotNone(contained, "Must resolve contained ValueSet even if requesting `Resource`") + contained = question.options.resolved(valueset.ValueSet) + self.assertIsNotNone(contained, "Must resolve contained ValueSet") + self.assertEqual('ValueSet', contained.resource_type) + + def testContainedResourceDetectionDSTU2(self): + from .models.DSTU2 import questionnaire, medication, resource, valueset + + with io.open('fhirclient/fixtures/test_contained_resource_DSTU2.json', 'r', encoding='utf-8') as h: + data = json.load(h) + q = questionnaire.Questionnaire(data) + self.assertIsNotNone(q, "Must instantiate Questionnaire") + self.assertEqual('Questionnaire', q.resource_name) + + group = q.group.group[3] + self.assertEqual('Observation.subject', group.linkId) + question = group.question[0] + self.assertEqual('Observation.subject._type', question.linkId) + self.assertIsNotNone(question.options) + with self.assertRaises(Exception): + question.options.resolved() + + # 1st resolve, extracting from contained resources + contained = question.options.resolved(medication.Medication) + self.assertIsNone(contained, "Must not resolve on resource type mismatch") + contained = question.options.resolved(valueset.ValueSet) + self.assertIsNotNone(contained, "Must resolve contained ValueSet") + self.assertEqual('ValueSet', contained.resource_name) + + # 2nd resolve, should pull from cache + contained = question.options.resolved(medication.Medication) + self.assertIsNone(contained, "Must not resolve on resource type mismatch") + contained = question.options.resolved(resource.Resource) + self.assertIsNotNone(contained, "Must resolve contained ValueSet even if requesting `Resource`") + contained = question.options.resolved(valueset.ValueSet) + self.assertIsNotNone(contained, "Must resolve contained ValueSet") + self.assertEqual('ValueSet', contained.resource_name) + + def testRelativeReferenceR4(self): + from .models.R4 import questionnaire, medication, resource, valueset + + with io.open('fhirclient/fixtures/test_relative_reference_R4.json', 'r', encoding='utf-8') as h: data = json.load(h) q = questionnaire.Questionnaire(data) self.assertIsNotNone(q, "Must instantiate Questionnaire") self.assertEqual('Questionnaire', q.resource_type) q._server = MockServer() - + group = q.item[0].item[0] self.assertEqual('Observation.subject', group.linkId) question = group.item[0] self.assertEqual('Observation.subject._type', question.linkId) - self.assertIsNotNone(question.answerOption) + if hasattr(question, 'answerOption'): + self.assertIsNotNone(question.answerOption) + else: + self.assertIsNotNone(question.option) with self.assertRaises(Exception): question.answerOption[0].valueReference.resolved() reference = question.answerOption[0].valueReference - + # resolve relative resource 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 = reference.resolved(medication.Medication) self.assertIsNone(relative, "Must not resolve on resource type mismatch") relative = reference.resolved(resource.Resource) self.assertIsNotNone(relative, "Must resolve relative ValueSet even if requesting `Resource`") - - def testBundleReferences(self): - with io.open('test_bundle.json', 'r', encoding='utf-8') as h: + + def testRelativeReferenceSTU3(self): + from .models.STU3 import questionnaire, medication, resource, valueset + + with io.open('fhirclient/fixtures/test_relative_reference_STU3.json', 'r', encoding='utf-8') as h: + data = json.load(h) + q = questionnaire.Questionnaire(data) + self.assertIsNotNone(q, "Must instantiate Questionnaire") + self.assertEqual('Questionnaire', q.resource_type) + q._server = MockServer() + + group = q.item[0].item[0] + self.assertEqual('Observation.subject', group.linkId) + question = group.item[0] + self.assertEqual('Observation.subject._type', question.linkId) + self.assertIsNotNone(question.options) + with self.assertRaises(Exception): + question.options.resolved() + + # resolve relative resource + relative = question.options.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) + self.assertIsNone(relative, "Must not resolve on resource type mismatch") + relative = question.options.resolved(resource.Resource) + self.assertIsNotNone(relative, "Must resolve relative ValueSet even if requesting `Resource`") + + def _doBundleReferences(self, bundle_fixture, medication, resource, patient, bundle): + with io.open(bundle_fixture, 'r', encoding='utf-8') as h: data = json.load(h) b = bundle.Bundle(data) self.assertIsNotNone(b, "Must instantiate Bundle") self.assertEqual('Bundle', b.resource_type) - #b._server = MockServer() - + # b._server = MockServer() + # get resources pat23 = b.entry[0].resource self.assertEqual('Patient', pat23.resource_type) @@ -101,11 +199,11 @@ def testBundleReferences(self): self.assertEqual('Observation', obs56.resource_type) obs34 = b.entry[4].resource self.assertEqual('Observation', obs34.resource_type) - + # test resolving w/o server (won't work) res = obs123.subject.resolved(patient.Patient) self.assertIsNone(res) - + # test resolving with server b._server = MockServer() res = obs123.subject.resolved(patient.Patient) @@ -117,19 +215,26 @@ def testBundleReferences(self): res = obs34.subject.resolved(patient.Patient) self.assertIsNone(res, "Must not resolve Patient on same server but different endpoint") + def testBundleReferencesR4(self): + from .models.R4 import medication, resource, patient, bundle + self._doBundleReferences('fhirclient/fixtures/test_bundle_R4.json', medication, resource, patient, bundle) + + def testBundleReferencesSTU3(self): + from .models.STU3 import medication, resource, patient, bundle + self._doBundleReferences('fhirclient/fixtures/test_bundle_STU3.json', medication, resource, patient, bundle) + class MockServer(server.FHIRServer): """ Reads local files. """ - + def __init__(self): - super().__init__(None, base_uri='https://fhir.smarthealthit.org') - + super(MockServer, self).__init__(None, base_uri='https://fhir.smarthealthit.org') + def request_json(self, path, nosign=False): assert path parts = os.path.split(path) filename = '_'.join(parts) + '.json' - with io.open(filename, 'r', encoding='utf-8') as handle: + with io.open(os.path.join('fhirclient/fixtures', filename), 'r', encoding='utf-8') as handle: return json.load(handle) return None - diff --git a/fhirclient/ValueSet_vs2r.json b/fhirclient/fixtures/ValueSet_vs2r.json similarity index 100% rename from fhirclient/ValueSet_vs2r.json rename to fhirclient/fixtures/ValueSet_vs2r.json diff --git a/fhirclient/test_bundle.json b/fhirclient/fixtures/test_bundle_R4.json old mode 100755 new mode 100644 similarity index 100% rename from fhirclient/test_bundle.json rename to fhirclient/fixtures/test_bundle_R4.json diff --git a/fhirclient/fixtures/test_bundle_STU3.json b/fhirclient/fixtures/test_bundle_STU3.json new file mode 100644 index 000000000..d525c2bfc --- /dev/null +++ b/fhirclient/fixtures/test_bundle_STU3.json @@ -0,0 +1,78 @@ +{ + "resourceType": "Bundle", + "type": "collection", + "entry": [ + { + "fullUrl": "https://fhir.smarthealthit.org/Patient/23", + "resource": { + "resourceType": "Patient", + "id": "23", + "name": [ + { + "given": ["Darth"], + "family": "Vader" + }, + { + "given": ["Anakin"], + "family": "Skywalker" + } + ] + } + }, + { + "fullUrl": "urn:uuid:04121321-4af5-424c-a0e1-ed3aab1c349d", + "resource": { + "resourceType": "Patient", + "name": [ + { + "given": ["Ben"], + "family": "Kenobi" + }, + { + "given": ["Obi-Wan"], + "family": "Kenobi" + } + ] + } + }, + { + "fullUrl": "https://fhir.smarthealthit.org/Observation/123", + "resource": { + "resourceType": "Observation", + "id": "123", + "subject": { + "reference": "Patient/23" + }, + "code": {}, + "status": "active", + "comment": "Observation 123, referencing subject relatively" + } + }, + { + "fullUrl": "https://fhir.smarthealthit.org/Observation/56", + "resource": { + "resourceType": "Observation", + "id": "56", + "subject": { + "reference": "urn:uuid:04121321-4af5-424c-a0e1-ed3aab1c349d" + }, + "code": {}, + "status": "active", + "comment": "Observation 56, referencing subject via UUID" + } + }, + { + "fullUrl": "https://fhir.smarthealthit.org/Observation/34", + "resource": { + "resourceType": "Observation", + "id": "34", + "subject": { + "reference": "https://fhir.smarthealthit.org/dev/Patient/99" + }, + "code": {}, + "status": "active", + "comment": "Observation 34 with absolute subject reference to different endpoint" + } + } + ] +} diff --git a/fhirclient/fixtures/test_contained_resource_DSTU2.json b/fhirclient/fixtures/test_contained_resource_DSTU2.json new file mode 100644 index 000000000..76d71b57f --- /dev/null +++ b/fhirclient/fixtures/test_contained_resource_DSTU2.json @@ -0,0 +1,174 @@ +{ + "resourceType": "Questionnaire", + "id": "qs1", + "contained": [ + { + "resourceType": "ValueSet", + "id": "vs2", + "name": "Type options for Observation.subject", + "status": "active", + "description": "Type options for Observation.subject", + "expansion": { + "identifier": "urn:uuid:5200236f-20ea-40b1-9a6b-b22301238b9c", + "timestamp": "2015-10-24T07:43:40+11:00", + "contains": [ + { + "system": "http://hl7.org/fhir/resource-types", + "code": "Patient", + "display": "Patient" + }, + { + "system": "http://hl7.org/fhir/resource-types", + "code": "Group", + "display": "Group" + }, + { + "system": "http://hl7.org/fhir/resource-types", + "code": "Device", + "display": "Device" + }, + { + "system": "http://hl7.org/fhir/resource-types", + "code": "Location", + "display": "Location" + } + ] + } + } + ], + "identifier": [ + { + "system": "urn:ietf:rfc:3986" + } + ], + "status": "draft", + "date": "2012-05-12T00:00:00+10:00", + "publisher": "Grahame Grieve", + "group": { + "linkId": "Observation", + "title": "Triglyceride Result", + "text": "Used for simple observations such as device measurements, laboratory atomic results, vital signs, height, weight, smoking status, comments, etc. Other resources are used to provide context for observations such as lab reports, etc.", + "required": true, + "repeats": false, + "group": [ + { + "extension": [ + { + "url": "http://hl7.org/fhir/Profile/questionnaire-extensions#flyover", + "valueString": "The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes. The only time that a resource does not have an id is when it is being submitted to the server using a create operation. Bundles always have an id, though it is usually a generated UUID." + }, + { + "url": "http://www.healthintersections.com.au/fhir/Profile/metadata#type", + "valueString": "string" + } + ], + "linkId": "Observation.id", + "required": false, + "repeats": true, + "question": [ + { + "linkId": "Observation.id.value", + "text": "Logical id of this artifact", + "type": "string", + "required": false, + "repeats": false + } + ] + }, + { + "extension": [ + { + "url": "http://hl7.org/fhir/Profile/questionnaire-extensions#flyover", + "valueString": "The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource." + } + ], + "linkId": "Observation.meta", + "text": "Metadata about the resource", + "required": false, + "repeats": true + }, + { + "extension": [ + { + "url": "http://hl7.org/fhir/Profile/questionnaire-extensions#flyover", + "valueString": "Triglyceride." + }, + { + "url": "http://www.healthintersections.com.au/fhir/Profile/metadata#type", + "valueString": "CodeableConcept" + } + ], + "linkId": "Observation.code", + "text": "Triglyceride", + "required": true, + "repeats": true, + "question": [ + { + "linkId": "Observation.code.coding", + "text": "code:", + "type": "open-choice", + "required": false, + "repeats": false + }, + { + "linkId": "Observation.code.text", + "text": "text:", + "type": "string", + "required": false, + "repeats": false + } + ] + }, + { + "extension": [ + { + "url": "http://hl7.org/fhir/Profile/questionnaire-extensions#flyover", + "valueString": "The patient, or group of patients, location, or device whose characteristics (direct or indirect) are described by the observation and into whose record the observation is placed. Comments: Indirect characteristics may be those of a specimen, fetus, donor, other observer (for example a relative or EMT), or any observation made about the subject. One would expect this element to be a cardinality of 1..1. The only circumstance in which the subject can be missing is when the observation is made by a device that does not know the patient. In this case, the observation SHALL be matched to a patient through some context/channel matching technique, and at this point, the observation should be updated.\r\rIf the target of the observation is different than the subject, the general extension [observation-focal-subject](extension-observation-focal-subject.html). may be used. However, the distinction between the patient's own value for an observation versus that of the fetus, or the donor or blood product unit, etc., are often specified in the observation code." + } + ], + "linkId": "Observation.subject", + "text": "Who and/or what this is about", + "required": false, + "repeats": true, + "question": [ + { + "linkId": "Observation.subject._type", + "text": "type", + "type": "choice", + "required": false, + "repeats": false, + "options": { + "reference": "#vs2" + }, + "group": [ + { + "extension": [ + { + "url": "http://www.healthintersections.com.au/fhir/Profile/metadata#type", + "valueString": "Reference" + } + ], + "linkId": "Observation.subject._Patient", + "question": [ + { + "extension": [ + { + "url": "http://www.healthintersections.com.au/fhir/Profile/metadata#reference", + "valueString": "/Patient?subject=$subj&patient=$subj&encounter=$encounter" + } + ], + "linkId": "Observation.subject._Patient.value", + "text": "Patient", + "type": "reference", + "required": false, + "repeats": false + } + ] + } + ] + } + ] + } + ] + } +} diff --git a/fhirclient/test_contained_resource.json b/fhirclient/fixtures/test_contained_resource_R4.json old mode 100755 new mode 100644 similarity index 100% rename from fhirclient/test_contained_resource.json rename to fhirclient/fixtures/test_contained_resource_R4.json diff --git a/fhirclient/fixtures/test_contained_resource_STU3.json b/fhirclient/fixtures/test_contained_resource_STU3.json new file mode 100644 index 000000000..e3c06338c --- /dev/null +++ b/fhirclient/fixtures/test_contained_resource_STU3.json @@ -0,0 +1,181 @@ +{ + "resourceType": "Questionnaire", + "id": "qs1", + "contained": [ + { + "resourceType": "ValueSet", + "id": "vs2", + "name": "Type options for Observation.subject", + "status": "active", + "description": "Type options for Observation.subject", + "expansion": { + "identifier": "urn:uuid:5200236f-20ea-40b1-9a6b-b22301238b9c", + "timestamp": "2015-10-24T07:43:40+11:00", + "contains": [ + { + "system": "http://hl7.org/fhir/resource-types", + "code": "Patient", + "display": "Patient" + }, + { + "system": "http://hl7.org/fhir/resource-types", + "code": "Group", + "display": "Group" + }, + { + "system": "http://hl7.org/fhir/resource-types", + "code": "Device", + "display": "Device" + }, + { + "system": "http://hl7.org/fhir/resource-types", + "code": "Location", + "display": "Location" + } + ] + } + } + ], + "identifier": [ + { + "system": "urn:ietf:rfc:3986" + } + ], + "status": "draft", + "date": "2012-05-12T00:00:00+10:00", + "publisher": "Grahame Grieve", + "item": [ + { + "linkId": "Observation", + "type": "group", + "text": "Used for simple observations such as device measurements, laboratory atomic results, vital signs, height, weight, smoking status, comments, etc. Other resources are used to provide context for observations such as lab reports, etc.", + "required": true, + "repeats": false, + "item": [ + { + "extension": [ + { + "url": "http://hl7.org/fhir/Profile/questionnaire-extensions#flyover", + "valueString": "The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes. The only time that a resource does not have an id is when it is being submitted to the server using a create operation. Bundles always have an id, though it is usually a generated UUID." + }, + { + "url": "http://www.healthintersections.com.au/fhir/Profile/metadata#type", + "valueString": "string" + } + ], + "linkId": "Observation.id", + "type": "group", + "required": false, + "repeats": true, + "item": [ + { + "linkId": "Observation.id.value", + "text": "Logical id of this artifact", + "type": "string", + "required": false, + "repeats": false + } + ] + }, + { + "extension": [ + { + "url": "http://hl7.org/fhir/Profile/questionnaire-extensions#flyover", + "valueString": "The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource." + } + ], + "linkId": "Observation.meta", + "type": "group", + "text": "Metadata about the resource", + "required": false, + "repeats": true + }, + { + "extension": [ + { + "url": "http://hl7.org/fhir/Profile/questionnaire-extensions#flyover", + "valueString": "Triglyceride." + }, + { + "url": "http://www.healthintersections.com.au/fhir/Profile/metadata#type", + "valueString": "CodeableConcept" + } + ], + "linkId": "Observation.code", + "type": "group", + "text": "Triglyceride", + "required": true, + "repeats": true, + "item": [ + { + "linkId": "Observation.code.coding", + "text": "code:", + "type": "open-choice", + "required": false, + "repeats": false + }, + { + "linkId": "Observation.code.text", + "text": "text:", + "type": "string", + "required": false, + "repeats": false + } + ] + }, + { + "extension": [ + { + "url": "http://hl7.org/fhir/Profile/questionnaire-extensions#flyover", + "valueString": "The patient, or group of patients, location, or device whose characteristics (direct or indirect) are described by the observation and into whose record the observation is placed. Comments: Indirect characteristics may be those of a specimen, fetus, donor, other observer (for example a relative or EMT), or any observation made about the subject. One would expect this element to be a cardinality of 1..1. The only circumstance in which the subject can be missing is when the observation is made by a device that does not know the patient. In this case, the observation SHALL be matched to a patient through some context/channel matching technique, and at this point, the observation should be updated.\r\rIf the target of the observation is different than the subject, the general extension [observation-focal-subject](extension-observation-focal-subject.html). may be used. However, the distinction between the patient's own value for an observation versus that of the fetus, or the donor or blood product unit, etc., are often specified in the observation code." + } + ], + "linkId": "Observation.subject", + "type": "group", + "text": "Who and/or what this is about", + "required": false, + "repeats": true, + "item": [ + { + "linkId": "Observation.subject._type", + "text": "type", + "type": "choice", + "required": false, + "repeats": false, + "options": { + "reference": "#vs2" + }, + "item": [ + { + "extension": [ + { + "url": "http://www.healthintersections.com.au/fhir/Profile/metadata#type", + "valueString": "Reference" + } + ], + "linkId": "Observation.subject._Patient", + "type": "group", + "item": [ + { + "extension": [ + { + "url": "http://www.healthintersections.com.au/fhir/Profile/metadata#reference", + "valueString": "/Patient?subject=$subj&patient=$subj&encounter=$encounter" + } + ], + "linkId": "Observation.subject._Patient.value", + "text": "Patient", + "type": "reference", + "required": false, + "repeats": false + } + ] + } + ] + } + ] + } + ] + } + ] +} diff --git a/fhirclient/test_metadata_invalid.json b/fhirclient/fixtures/test_metadata_invalid_R4.json old mode 100755 new mode 100644 similarity index 100% rename from fhirclient/test_metadata_invalid.json rename to fhirclient/fixtures/test_metadata_invalid_R4.json diff --git a/fhirclient/fixtures/test_metadata_valid_DSTU2.json b/fhirclient/fixtures/test_metadata_valid_DSTU2.json new file mode 100644 index 000000000..407407612 --- /dev/null +++ b/fhirclient/fixtures/test_metadata_valid_DSTU2.json @@ -0,0 +1,69 @@ +{ + "acceptUnknown": false, + "date": "2014-10-29T11:42:32.193-00:00", + "description": "Describes capabilities of this SMART on FHIR server", + "fhirVersion": "0.0.82", + "format": [ + "xml", + "json" + ], + "identifier": "https://fhir-api.smarthealthit.org/conformance", + "name": "SMART on FHIR Conformance Statement", + "publisher": "SMART on FHIR", + "resourceType": "Conformance", + "rest": [ + { + "documentation": "All the functionality defined in FHIR", + "mode": "server", + "operation": [ + { + "code": "transaction" + }, + { + "code": "history-system" + } + ], + "resource": [], + "security": { + "description": "SMART on FHIR uses OAuth2 for authorization", + "extension": [ + { + "url": "http://fhir-registry.smarthealthit.org/StructureDefinition/oauth-uris#register", + "valueUri": "https://authorize.smarthealthit.org/register" + }, + { + "url": "http://fhir-registry.smarthealthit.org/StructureDefinition/oauth-uris#authorize", + "valueUri": "https://authorize.smarthealthit.org/authorize" + }, + { + "url": "http://fhir-registry.smarthealthit.org/StructureDefinition/oauth-uris#token", + "valueUri": "https://authorize.smarthealthit.org/token" + } + ], + "service": [ + { + "coding": [ + { + "code": "OAuth2", + "system": "http://hl7.org/fhir/vs/restful-security-service" + } + ], + "text": "OAuth version 2 (see oauth.net)." + } + ] + } + } + ], + "status": "draft", + "telecom": [ + { + "system": "url", + "value": "https://fhir-api.smarthealthit.org" + } + ], + "text": { + "div": "
Generated Conformance Statement -- see structured representation.
", + "status": "generated" + }, + "version": "0.0.82.????" +} diff --git a/fhirclient/test_metadata_valid.json b/fhirclient/fixtures/test_metadata_valid_R4.json old mode 100755 new mode 100644 similarity index 100% rename from fhirclient/test_metadata_valid.json rename to fhirclient/fixtures/test_metadata_valid_R4.json diff --git a/fhirclient/fixtures/test_metadata_valid_STU3.json b/fhirclient/fixtures/test_metadata_valid_STU3.json new file mode 100644 index 000000000..e79ec4d86 --- /dev/null +++ b/fhirclient/fixtures/test_metadata_valid_STU3.json @@ -0,0 +1,70 @@ +{ + "acceptUnknown": "no", + "date": "2014-10-29T11:42:32.193-00:00", + "description": "Describes capabilities of this SMART on FHIR server", + "fhirVersion": "0.0.82", + "format": [ + "xml", + "json" + ], + "url": "https://fhir-api.smarthealthit.org/metadata", + "name": "SMART on FHIR CapabilityStatement", + "kind": "instance", + "publisher": "SMART on FHIR", + "resourceType": "CapabilityStatement", + "rest": [ + { + "documentation": "All the functionality defined in FHIR", + "mode": "server", + "operation": [ + { + "name": "transaction", + "definition": { + "reference": "#op-trans" + } + }, + { + "name": "history-system", + "definition": { + "reference": "#op-hist" + } + } + ], + "resource": [], + "security": { + "description": "SMART on FHIR uses OAuth2 for authorization", + "extension": [ + { + "url": "http://fhir-registry.smarthealthit.org/StructureDefinition/oauth-uris#register", + "valueUri": "https://authorize.smarthealthit.org/register" + }, + { + "url": "http://fhir-registry.smarthealthit.org/StructureDefinition/oauth-uris#authorize", + "valueUri": "https://authorize.smarthealthit.org/authorize" + }, + { + "url": "http://fhir-registry.smarthealthit.org/StructureDefinition/oauth-uris#token", + "valueUri": "https://authorize.smarthealthit.org/token" + } + ], + "service": [ + { + "coding": [ + { + "code": "OAuth2", + "system": "http://hl7.org/fhir/vs/restful-security-service" + } + ], + "text": "OAuth version 2 (see oauth.net)." + } + ] + } + } + ], + "status": "draft", + "text": { + "div": "
Generated CapabilityStatement -- see structured representation.
", + "status": "generated" + }, + "version": "0.0.82.????" +} diff --git a/fhirclient/test_relative_reference.json b/fhirclient/fixtures/test_relative_reference_R4.json old mode 100755 new mode 100644 similarity index 100% rename from fhirclient/test_relative_reference.json rename to fhirclient/fixtures/test_relative_reference_R4.json diff --git a/fhirclient/fixtures/test_relative_reference_STU3.json b/fhirclient/fixtures/test_relative_reference_STU3.json new file mode 100644 index 000000000..7f0d4aafa --- /dev/null +++ b/fhirclient/fixtures/test_relative_reference_STU3.json @@ -0,0 +1,64 @@ +{ + "resourceType": "Questionnaire", + "id": "qs1", + "identifier": [ + { + "system": "urn:ietf:rfc:3986" + } + ], + "status": "draft", + "date": "2012-05-12T00:00:00+10:00", + "publisher": "Grahame Grieve", + "item": [ + { + "linkId": "Observation", + "type": "group", + "text": "Used for simple observations such as device measurements, laboratory atomic results, vital signs, height, weight, smoking status, comments, etc. Other resources are used to provide context for observations such as lab reports, etc.", + "required": true, + "repeats": false, + "item": [ + { + "linkId": "Observation.subject", + "type": "group", + "text": "Who and/or what this is about", + "required": false, + "repeats": true, + "item": [ + { + "linkId": "Observation.subject._type", + "type": "group", + "text": "type", + "type": "choice", + "required": false, + "repeats": false, + "options": { + "reference": "ValueSet/vs2r" + }, + "item": [ + { + "linkId": "Observation.subject._Patient", + "type": "question", + "item": [ + { + "extension": [ + { + "url": "http://www.healthintersections.com.au/fhir/Profile/metadata#reference", + "valueString": "/Patient?subject=$subj&patient=$subj&encounter=$encounter" + } + ], + "linkId": "Observation.subject._Patient.value", + "text": "Patient", + "type": "reference", + "required": false, + "repeats": false + } + ] + } + ] + } + ] + } + ] + } + ] +} diff --git a/fhirclient/integration_tests.py b/fhirclient/integration_tests.py new file mode 100644 index 000000000..3cd390493 --- /dev/null +++ b/fhirclient/integration_tests.py @@ -0,0 +1,105 @@ +# -*- coding: utf-8 -*- + +from __future__ import unicode_literals +import unittest +import requests +from fhirclient.client import FHIRClient +from fhirclient.constants import FHIRVersion + + +SETTINGS = { + FHIRVersion.R4: { + "api_base": "https://launch.smarthealthit.org/v/r4/fhir", + # This is '{"a":"1","b":"8d1f86a8-3284-43bd-b45e-5931948c97e4","e":"e92c468f-8f1b-4d5e-bf96-76dc945d2e8c","f":"1"}' base64 + "launch_token": "eyJhIjoiMSIsImIiOiI4ZDFmODZhOC0zMjg0LTQzYmQtYjQ1ZS01OTMxOTQ4Yzk3ZTQiLCJlIjoiZTkyYzQ2OGYtOGYxYi00ZDVlLWJmOTYtNzZkYzk0NWQyZThjIiwiZiI6IjEifQ", + "name": "Mrs. Latanya Kohler", + }, + FHIRVersion.STU3: { + "api_base": "https://launch.smarthealthit.org/v/r3/fhir", + # This is '{"a":"1","b":"53918843-a2a2-499e-b397-2e25035cbeb3","e":"smart-Practitioner-71614502","f":"1"}' base64 + "launch_token": "eyJhIjoiMSIsImIiOiI1MzkxODg0My1hMmEyLTQ5OWUtYjM5Ny0yZTI1MDM1Y2JlYjMiLCJlIjoic21hcnQtUHJhY3RpdGlvbmVyLTcxNjE0NTAyIiwiZiI6IjEifQ", + "encounter": "2b3ead66-c990-4132-a609-2934f00ec52c", + "name": "Mr. Ronnie Gutmann", + "meds": { + "23fc6a0e-95a0-4dce-8c81-692d6d143e64", + "cfc013c2-8487-48a0-aa13-0b45b73ba53b", + "cfc013c2-8487-48a0-aa13-0b45b73ba53b", + } + }, + FHIRVersion.DSTU2: { + "api_base": "https://launch.smarthealthit.org/v/r2/fhir", + # This is '{"a":"1","b":"57b85682-ce42-4187-a593-7864248a9484","e":"SMART-1234","f":"1"}' base64 + "launch_token": "eyJhIjoiMSIsImIiOiI1N2I4NTY4Mi1jZTQyLTQxODctYTU5My03ODY0MjQ4YTk0ODQiLCJlIjoiU01BUlQtMTIzNCIsImYiOiIxIn0", + "encounter": "114b4ccb-cbf6-4abd-8f1b-8ded0dbb59a2", + "name": "Mr. Ronnie Gutmann", + "meds": { + "RES368466", + "RES368467", + } + }, +} + + +class IntegrationTest(unittest.TestCase): + + def launch(self, version): + settings = { + "redirect_uri": "fhirclient://callback", + "api_base": SETTINGS[version]["api_base"], + "launch_token": SETTINGS[version]["launch_token"], + "app_id": "app" + version, + "app_secret": "secret", + "version": version, + } + + state = {} + + def save(s): + state.clear() + state.update(s) + + client = FHIRClient(settings=settings, save_func=save) + + authorize_url = client.authorize_url + if "encounter" in SETTINGS[version]: + authorize_url += "&encounter=" + SETTINGS[version]["encounter"] + response = requests.get(authorize_url, allow_redirects=False) + response.raise_for_status() + + # Restore from state for fun + client = FHIRClient(state=state) + client.handle_callback(response.headers["Location"]) + name = client.human_name(client.patient.name[0]) + self.assertEqual(SETTINGS[version]["name"], name) + return client + + def test_launch_DSTU2(self): + from .models.DSTU2.medicationorder import MedicationOrder + client = self.launch(FHIRVersion.DSTU2) + search = MedicationOrder.where(struct={"patient": "Patient/{}".format(client.patient.id)}) + meds = search.perform_resources(client.server) + result = set() + for med in meds: + result.add(med.id) + self.assertEqual(SETTINGS[FHIRVersion.DSTU2]["meds"], result) + + def test_launch_STU3(self): + from .models.STU3.medicationrequest import MedicationRequest + client = self.launch(FHIRVersion.STU3) + search = MedicationRequest.where(struct={"patient": "Patient/{}".format(client.patient.id)}) + meds = search.perform_resources(client.server) + result = set() + for med in meds: + result.add(med.id) + self.assertEqual(SETTINGS[FHIRVersion.STU3]["meds"], result) + + @unittest.skip("r4 metadata currently broken") + def test_launch_R4(self): + from .models.R4.medicationrequest import MedicationRequest + client = self.launch(FHIRVersion.R4) + search = MedicationRequest.where(struct={"patient": "Patient/{}".format(client.patient.id)}) + meds = search.perform_resources(client.server) + result = set() + for med in meds: + result.add(med.id) + self.assertEqual(SETTINGS[FHIRVersion.R4]["meds"], result) diff --git a/fhirclient/models/DSTU2/__init__.py b/fhirclient/models/DSTU2/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/fhirclient/models/DSTU2/account.py b/fhirclient/models/DSTU2/account.py new file mode 100644 index 000000000..c3b1cf034 --- /dev/null +++ b/fhirclient/models/DSTU2/account.py @@ -0,0 +1,93 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Account) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Account(domainresource.DomainResource): + """ None. + + A financial tool for tracking value accrued for a particular purpose. In + the healthcare field, used to track charges for a patient, cost centres, + etc. + """ + + resource_name = "Account" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.activePeriod = None + """ Valid from..to. + Type `Period` (represented as `dict` in JSON). """ + + self.balance = None + """ How much is in account?. + Type `Quantity` referencing `Money` (represented as `dict` in JSON). """ + + self.coveragePeriod = None + """ Transaction window. + Type `Period` (represented as `dict` in JSON). """ + + self.currency = None + """ Base currency in which balance is tracked. + Type `Coding` (represented as `dict` in JSON). """ + + self.description = None + """ Explanation of purpose/use. + Type `str`. """ + + self.identifier = None + """ Account number. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.name = None + """ Human-readable label. + Type `str`. """ + + self.owner = None + """ Who is responsible?. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.status = None + """ active | inactive. + Type `str`. """ + + self.subject = None + """ What is account tied to?. + Type `FHIRReference` referencing `Patient, Device, Practitioner, Location, HealthcareService, Organization` (represented as `dict` in JSON). """ + + self.type = None + """ E.g. patient, expense, depreciation. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(Account, self).__init__(jsondict) + + def elementProperties(self): + js = super(Account, self).elementProperties() + js.extend([ + ("activePeriod", "activePeriod", period.Period, False, None, False), + ("balance", "balance", quantity.Quantity, False, None, False), + ("coveragePeriod", "coveragePeriod", period.Period, False, None, False), + ("currency", "currency", coding.Coding, False, None, False), + ("description", "description", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("name", "name", str, False, None, False), + ("owner", "owner", fhirreference.FHIRReference, False, None, False), + ("status", "status", str, False, None, False), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import codeableconcept +from . import coding +from . import fhirreference +from . import identifier +from . import period +from . import quantity diff --git a/fhirclient/models/DSTU2/account_tests.py b/fhirclient/models/DSTU2/account_tests.py new file mode 100644 index 000000000..e627fb387 --- /dev/null +++ b/fhirclient/models/DSTU2/account_tests.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import account +from .fhirdate import FHIRDate + + +class AccountTests(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("Account", js["resourceType"]) + return account.Account(js) + + def testAccount1(self): + inst = self.instantiate_from("account-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Account instance") + self.implAccount1(inst) + + js = inst.as_json() + self.assertEqual("Account", js["resourceType"]) + inst2 = account.Account(js) + self.implAccount1(inst2) + + def implAccount1(self, inst): + self.assertEqual(inst.id, "example") + self.assertEqual(inst.text.div, "
[Put rendering here]
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/address.py b/fhirclient/models/DSTU2/address.py new file mode 100644 index 000000000..7e72daede --- /dev/null +++ b/fhirclient/models/DSTU2/address.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Address) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Address(element.Element): + """ A postal address. + + There is a variety of postal address formats defined around the world. This + format defines a superset that is the basis for all addresses around the + world. + """ + + resource_name = "Address" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.city = None + """ Name of city, town etc.. + Type `str`. """ + + self.country = None + """ Country (can be ISO 3166 3 letter code). + Type `str`. """ + + self.district = None + """ District name (aka county). + Type `str`. """ + + self.line = None + """ Street name, number, direction & P.O. Box etc.. + List of `str` items. """ + + self.period = None + """ Time period when address was/is in use. + Type `Period` (represented as `dict` in JSON). """ + + self.postalCode = None + """ Postal code for area. + Type `str`. """ + + self.state = None + """ Sub-unit of country (abbreviations ok). + Type `str`. """ + + self.text = None + """ Text representation of the address. + Type `str`. """ + + self.type = None + """ postal | physical | both. + Type `str`. """ + + self.use = None + """ home | work | temp | old - purpose of this address. + Type `str`. """ + + super(Address, self).__init__(jsondict) + + def elementProperties(self): + js = super(Address, self).elementProperties() + js.extend([ + ("city", "city", str, False, None, False), + ("country", "country", str, False, None, False), + ("district", "district", str, False, None, False), + ("line", "line", str, True, None, False), + ("period", "period", period.Period, False, None, False), + ("postalCode", "postalCode", str, False, None, False), + ("state", "state", str, False, None, False), + ("text", "text", str, False, None, False), + ("type", "type", str, False, None, False), + ("use", "use", str, False, None, False), + ]) + return js + + +from . import period diff --git a/fhirclient/models/DSTU2/age.py b/fhirclient/models/DSTU2/age.py new file mode 100644 index 000000000..083364833 --- /dev/null +++ b/fhirclient/models/DSTU2/age.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Age) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import quantity + +class Age(quantity.Quantity): + """ A duration (length of time) with a UCUM code. + + There SHALL be a code if there is a value and it SHALL be an expression of + time. If system is present, it SHALL be UCUM. If value is present, it + SHALL be positive. + """ + + resource_name = "Age" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + super(Age, self).__init__(jsondict) + + diff --git a/fhirclient/models/DSTU2/allergyintolerance.py b/fhirclient/models/DSTU2/allergyintolerance.py new file mode 100644 index 000000000..ee4b7f630 --- /dev/null +++ b/fhirclient/models/DSTU2/allergyintolerance.py @@ -0,0 +1,172 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/AllergyIntolerance) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class AllergyIntolerance(domainresource.DomainResource): + """ Allergy or Intolerance (generally: Risk Of Adverse reaction to a substance). + + Risk of harmful or undesirable, physiological response which is unique to + an individual and associated with exposure to a substance. + """ + + resource_name = "AllergyIntolerance" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.category = None + """ food | medication | environment | other - Category of Substance. + Type `str`. """ + + self.criticality = None + """ CRITL | CRITH | CRITU. + Type `str`. """ + + self.identifier = None + """ External ids for this item. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.lastOccurence = None + """ Date(/time) of last known occurrence of a reaction. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.note = None + """ Additional text not captured in other fields. + Type `Annotation` (represented as `dict` in JSON). """ + + self.onset = None + """ Date(/time) when manifestations showed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.patient = None + """ Who the sensitivity is for. + Type `FHIRReference` referencing `Patient` (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 + """ When 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). """ + + self.reporter = None + """ Source of the information about the allergy. + Type `FHIRReference` referencing `Patient, RelatedPerson, Practitioner` (represented as `dict` in JSON). """ + + self.status = None + """ active | unconfirmed | confirmed | inactive | resolved | refuted | + entered-in-error. + Type `str`. """ + + self.substance = None + """ Substance, (or class) considered to be responsible for risk. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.type = None + """ allergy | intolerance - Underlying mechanism (if known). + Type `str`. """ + + super(AllergyIntolerance, self).__init__(jsondict) + + def elementProperties(self): + js = super(AllergyIntolerance, self).elementProperties() + js.extend([ + ("category", "category", str, False, None, False), + ("criticality", "criticality", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("lastOccurence", "lastOccurence", fhirdate.FHIRDate, False, None, False), + ("note", "note", annotation.Annotation, False, None, False), + ("onset", "onset", fhirdate.FHIRDate, False, None, 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), + ("reporter", "reporter", fhirreference.FHIRReference, False, None, False), + ("status", "status", str, False, None, False), + ("substance", "substance", codeableconcept.CodeableConcept, False, None, True), + ("type", "type", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class AllergyIntoleranceReaction(backboneelement.BackboneElement): + """ Adverse Reaction Events linked to exposure to substance. + + Details about each adverse reaction event linked to exposure to the + identified Substance. + """ + + resource_name = "AllergyIntoleranceReaction" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.certainty = None + """ unlikely | likely | confirmed - clinical certainty about the + specific substance. + Type `str`. """ + + self.description = None + """ Description of the event as a whole. + Type `str`. """ + + self.exposureRoute = None + """ How the subject was exposed to the substance. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.manifestation = None + """ Clinical symptoms/signs associated with the Event. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.note = None + """ Text about event not captured in other fields. + Type `Annotation` (represented as `dict` in JSON). """ + + self.onset = None + """ Date(/time) when manifestations showed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.severity = None + """ mild | moderate | severe (of event as a whole). + Type `str`. """ + + self.substance = None + """ Specific substance considered to be responsible for event. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(AllergyIntoleranceReaction, self).__init__(jsondict) + + def elementProperties(self): + js = super(AllergyIntoleranceReaction, self).elementProperties() + js.extend([ + ("certainty", "certainty", str, False, None, False), + ("description", "description", str, False, None, False), + ("exposureRoute", "exposureRoute", codeableconcept.CodeableConcept, False, None, False), + ("manifestation", "manifestation", codeableconcept.CodeableConcept, True, None, True), + ("note", "note", annotation.Annotation, False, None, False), + ("onset", "onset", fhirdate.FHIRDate, False, None, False), + ("severity", "severity", str, False, None, False), + ("substance", "substance", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import annotation +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier diff --git a/fhirclient/models/DSTU2/allergyintolerance_tests.py b/fhirclient/models/DSTU2/allergyintolerance_tests.py new file mode 100644 index 000000000..ba5f8ed0a --- /dev/null +++ b/fhirclient/models/DSTU2/allergyintolerance_tests.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import allergyintolerance +from .fhirdate import FHIRDate + + +class AllergyIntoleranceTests(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("AllergyIntolerance", js["resourceType"]) + return allergyintolerance.AllergyIntolerance(js) + + def testAllergyIntolerance1(self): + inst = self.instantiate_from("allergyintolerance-example.json") + self.assertIsNotNone(inst, "Must have instantiated a AllergyIntolerance instance") + self.implAllergyIntolerance1(inst) + + js = inst.as_json() + self.assertEqual("AllergyIntolerance", js["resourceType"]) + inst2 = allergyintolerance.AllergyIntolerance(js) + self.implAllergyIntolerance1(inst2) + + def implAllergyIntolerance1(self, inst): + self.assertEqual(inst.category, "food") + self.assertEqual(inst.criticality, "CRITH") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier[0].system, "http://acme.com/ids/patients/risks") + self.assertEqual(inst.identifier[0].value, "49476534") + self.assertEqual(inst.lastOccurence.date, FHIRDate("2012-06").date) + self.assertEqual(inst.lastOccurence.as_json(), "2012-06") + self.assertEqual(inst.reaction[0].description, "Challenge Protocol. Severe Reaction to 1/8 cashew. Epinephrine administered") + self.assertEqual(inst.reaction[0].manifestation[0].coding[0].code, "39579001") + self.assertEqual(inst.reaction[0].manifestation[0].coding[0].display, "Anaphylactic reaction") + self.assertEqual(inst.reaction[0].manifestation[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.reaction[0].onset.date, FHIRDate("2012-06-12").date) + self.assertEqual(inst.reaction[0].onset.as_json(), "2012-06-12") + self.assertEqual(inst.reaction[0].severity, "severe") + self.assertEqual(inst.reaction[0].substance.coding[0].code, "C3214954") + self.assertEqual(inst.reaction[0].substance.coding[0].display, "cashew nut allergenic extract Injectable Product") + self.assertEqual(inst.reaction[0].substance.coding[0].system, "http://www.nlm.nih.gov/research/umls/rxnorm") + self.assertEqual(inst.reaction[1].certainty, "likely") + self.assertEqual(inst.reaction[1].manifestation[0].coding[0].code, "64305001") + self.assertEqual(inst.reaction[1].manifestation[0].coding[0].display, "Urticaria") + self.assertEqual(inst.reaction[1].manifestation[0].coding[0].system, "http://snomed.info/sct") + 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.status, "confirmed") + self.assertEqual(inst.substance.coding[0].code, "227493005") + self.assertEqual(inst.substance.coding[0].display, "Cashew nuts") + self.assertEqual(inst.substance.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type, "allergy") + diff --git a/fhirclient/models/DSTU2/annotation.py b/fhirclient/models/DSTU2/annotation.py new file mode 100644 index 000000000..d06b01b18 --- /dev/null +++ b/fhirclient/models/DSTU2/annotation.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Annotation) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Annotation(element.Element): + """ Text node with attribution. + + A text note which also contains information about who made the statement + and when. + """ + + resource_name = "Annotation" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.authorReference = None + """ Individual responsible for the annotation. + Type `FHIRReference` referencing `Practitioner, Patient, RelatedPerson` (represented as `dict` in JSON). """ + + self.authorString = None + """ Individual responsible for the annotation. + Type `str`. """ + + self.text = None + """ The annotation - text content. + Type `str`. """ + + self.time = None + """ When the annotation was made. + Type `FHIRDate` (represented as `str` in JSON). """ + + super(Annotation, self).__init__(jsondict) + + def elementProperties(self): + js = super(Annotation, self).elementProperties() + js.extend([ + ("authorReference", "authorReference", fhirreference.FHIRReference, False, "author", False), + ("authorString", "authorString", str, False, "author", False), + ("text", "text", str, False, None, True), + ("time", "time", fhirdate.FHIRDate, False, None, False), + ]) + return js + + +from . import fhirdate +from . import fhirreference diff --git a/fhirclient/models/DSTU2/appointment.py b/fhirclient/models/DSTU2/appointment.py new file mode 100644 index 000000000..8e2c70d4c --- /dev/null +++ b/fhirclient/models/DSTU2/appointment.py @@ -0,0 +1,138 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Appointment) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Appointment(domainresource.DomainResource): + """ A booking of a healthcare event among patient(s), practitioner(s), related + person(s) and/or device(s) for a specific date/time. This may result in one + or more Encounter(s). + """ + + resource_name = "Appointment" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.comment = None + """ Additional comments. + Type `str`. """ + + self.description = None + """ Shown on a subject line in a meeting request, or appointment list. + Type `str`. """ + + self.end = None + """ When appointment is to conclude. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.identifier = None + """ External Ids for this item. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.minutesDuration = None + """ Can be less than start/end (e.g. estimate). + Type `int`. """ + + self.participant = None + """ Participants involved in appointment. + List of `AppointmentParticipant` items (represented as `dict` in JSON). """ + + self.priority = None + """ Used to make informed decisions if needing to re-prioritize. + Type `int`. """ + + self.reason = None + """ Reason this appointment is scheduled. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.slot = None + """ If provided, then no schedule and start/end values MUST match slot. + List of `FHIRReference` items referencing `Slot` (represented as `dict` in JSON). """ + + self.start = None + """ When appointment is to take place. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.status = None + """ proposed | pending | booked | arrived | fulfilled | cancelled | + noshow. + Type `str`. """ + + self.type = None + """ The type of appointment that is being booked. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(Appointment, self).__init__(jsondict) + + def elementProperties(self): + js = super(Appointment, self).elementProperties() + js.extend([ + ("comment", "comment", str, False, None, False), + ("description", "description", str, False, None, False), + ("end", "end", fhirdate.FHIRDate, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("minutesDuration", "minutesDuration", int, False, None, False), + ("participant", "participant", AppointmentParticipant, True, None, True), + ("priority", "priority", int, False, None, False), + ("reason", "reason", codeableconcept.CodeableConcept, False, None, False), + ("slot", "slot", fhirreference.FHIRReference, True, None, False), + ("start", "start", fhirdate.FHIRDate, False, None, False), + ("status", "status", str, False, None, True), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import backboneelement + +class AppointmentParticipant(backboneelement.BackboneElement): + """ Participants involved in appointment. + + List of participants involved in the appointment. + """ + + resource_name = "AppointmentParticipant" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.actor = None + """ Person, Location/HealthcareService or Device. + Type `FHIRReference` referencing `Patient, Practitioner, RelatedPerson, Device, HealthcareService, Location` (represented as `dict` in JSON). """ + + self.required = None + """ required | optional | information-only. + Type `str`. """ + + self.status = None + """ accepted | declined | tentative | needs-action. + Type `str`. """ + + self.type = None + """ Role of participant in the appointment. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(AppointmentParticipant, self).__init__(jsondict) + + def elementProperties(self): + js = super(AppointmentParticipant, self).elementProperties() + js.extend([ + ("actor", "actor", fhirreference.FHIRReference, False, None, False), + ("required", "required", str, False, None, False), + ("status", "status", str, False, None, True), + ("type", "type", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier diff --git a/fhirclient/models/DSTU2/appointment_tests.py b/fhirclient/models/DSTU2/appointment_tests.py new file mode 100644 index 000000000..e68b80df4 --- /dev/null +++ b/fhirclient/models/DSTU2/appointment_tests.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import appointment +from .fhirdate import FHIRDate + + +class AppointmentTests(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("Appointment", js["resourceType"]) + return appointment.Appointment(js) + + def testAppointment1(self): + inst = self.instantiate_from("appointment-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Appointment instance") + self.implAppointment1(inst) + + js = inst.as_json() + self.assertEqual("Appointment", js["resourceType"]) + inst2 = appointment.Appointment(js) + self.implAppointment1(inst2) + + def implAppointment1(self, inst): + self.assertEqual(inst.comment, "Further expand on the results of the MRI and determine the next actions that may be appropriate.") + 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.participant[0].required, "required") + self.assertEqual(inst.participant[0].status, "accepted") + self.assertEqual(inst.participant[1].required, "required") + self.assertEqual(inst.participant[1].status, "accepted") + self.assertEqual(inst.participant[1].type[0].coding[0].code, "attending") + self.assertEqual(inst.participant[2].required, "required") + self.assertEqual(inst.participant[2].status, "accepted") + self.assertEqual(inst.priority, 5) + 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") + self.assertEqual(inst.type.coding[0].code, "52") + self.assertEqual(inst.type.coding[0].display, "General Discussion") + + def testAppointment2(self): + inst = self.instantiate_from("appointment-example-request.json") + self.assertIsNotNone(inst, "Must have instantiated a Appointment instance") + self.implAppointment2(inst) + + js = inst.as_json() + self.assertEqual("Appointment", js["resourceType"]) + inst2 = appointment.Appointment(js) + self.implAppointment2(inst2) + + def implAppointment2(self, inst): + self.assertEqual(inst.comment, "Further expand on the results of the MRI and determine the next actions that may be appropriate.") + 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.participant[0].required, "required") + self.assertEqual(inst.participant[0].status, "needs-action") + self.assertEqual(inst.participant[1].required, "required") + self.assertEqual(inst.participant[1].status, "needs-action") + self.assertEqual(inst.participant[1].type[0].coding[0].code, "attending") + self.assertEqual(inst.participant[2].required, "required") + self.assertEqual(inst.participant[2].status, "accepted") + self.assertEqual(inst.priority, 5) + self.assertEqual(inst.reason.text, "Clinical Review") + self.assertEqual(inst.status, "proposed") + self.assertEqual(inst.text.div, "
Brian MRI results discussion
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.coding[0].code, "52") + self.assertEqual(inst.type.coding[0].display, "General Discussion") + + def testAppointment3(self): + inst = self.instantiate_from("appointment-example2doctors.json") + self.assertIsNotNone(inst, "Must have instantiated a Appointment instance") + self.implAppointment3(inst) + + js = inst.as_json() + self.assertEqual("Appointment", js["resourceType"]) + inst2 = appointment.Appointment(js) + self.implAppointment3(inst2) + + def implAppointment3(self, inst): + 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.participant[0].required, "information-only") + self.assertEqual(inst.participant[0].status, "accepted") + self.assertEqual(inst.participant[1].required, "required") + self.assertEqual(inst.participant[1].status, "accepted") + self.assertEqual(inst.participant[2].required, "required") + self.assertEqual(inst.participant[2].status, "accepted") + self.assertEqual(inst.participant[3].required, "information-only") + self.assertEqual(inst.participant[3].status, "accepted") + self.assertEqual(inst.priority, 5) + 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") + self.assertEqual(inst.text.div, "
Brian MRI results discussion
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.coding[0].code, "52") + self.assertEqual(inst.type.coding[0].display, "General Discussion") + diff --git a/fhirclient/models/DSTU2/appointmentresponse.py b/fhirclient/models/DSTU2/appointmentresponse.py new file mode 100644 index 000000000..4055c3172 --- /dev/null +++ b/fhirclient/models/DSTU2/appointmentresponse.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/AppointmentResponse) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class AppointmentResponse(domainresource.DomainResource): + """ A reply to an appointment request for a patient and/or practitioner(s), + such as a confirmation or rejection. + """ + + resource_name = "AppointmentResponse" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.actor = None + """ Person, Location/HealthcareService or Device. + Type `FHIRReference` referencing `Patient, Practitioner, RelatedPerson, Device, HealthcareService, Location` (represented as `dict` in JSON). """ + + self.appointment = None + """ Appointment this response relates to. + Type `FHIRReference` referencing `Appointment` (represented as `dict` in JSON). """ + + self.comment = None + """ Additional comments. + Type `str`. """ + + self.end = None + """ Time from appointment, or requested new end time. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.identifier = None + """ External Ids for this item. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.participantStatus = None + """ accepted | declined | tentative | in-process | completed | needs- + action. + Type `str`. """ + + self.participantType = None + """ Role of participant in the appointment. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.start = None + """ Time from appointment, or requested new start time. + Type `FHIRDate` (represented as `str` in JSON). """ + + super(AppointmentResponse, self).__init__(jsondict) + + def elementProperties(self): + js = super(AppointmentResponse, self).elementProperties() + js.extend([ + ("actor", "actor", fhirreference.FHIRReference, False, None, False), + ("appointment", "appointment", fhirreference.FHIRReference, False, None, True), + ("comment", "comment", str, False, None, False), + ("end", "end", fhirdate.FHIRDate, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("participantStatus", "participantStatus", str, False, None, True), + ("participantType", "participantType", codeableconcept.CodeableConcept, True, None, False), + ("start", "start", fhirdate.FHIRDate, False, None, False), + ]) + return js + + +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier diff --git a/fhirclient/models/DSTU2/appointmentresponse_tests.py b/fhirclient/models/DSTU2/appointmentresponse_tests.py new file mode 100644 index 000000000..b9113663c --- /dev/null +++ b/fhirclient/models/DSTU2/appointmentresponse_tests.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import appointmentresponse +from .fhirdate import FHIRDate + + +class AppointmentResponseTests(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("AppointmentResponse", js["resourceType"]) + return appointmentresponse.AppointmentResponse(js) + + def testAppointmentResponse1(self): + inst = self.instantiate_from("appointmentresponse-example-req.json") + self.assertIsNotNone(inst, "Must have instantiated a AppointmentResponse instance") + self.implAppointmentResponse1(inst) + + js = inst.as_json() + self.assertEqual("AppointmentResponse", js["resourceType"]) + inst2 = appointmentresponse.AppointmentResponse(js) + self.implAppointmentResponse1(inst2) + + def implAppointmentResponse1(self, inst): + self.assertEqual(inst.comment, "can't we try for this time, can't do mornings") + self.assertEqual(inst.end.date, FHIRDate("2013-12-25T13:30:00Z").date) + self.assertEqual(inst.end.as_json(), "2013-12-25T13:30:00Z") + 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.participantStatus, "tentative") + self.assertEqual(inst.participantType[0].coding[0].code, "attending") + 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
") + self.assertEqual(inst.text.status, "generated") + + def testAppointmentResponse2(self): + inst = self.instantiate_from("appointmentresponse-example.json") + self.assertIsNotNone(inst, "Must have instantiated a AppointmentResponse instance") + self.implAppointmentResponse2(inst) + + js = inst.as_json() + self.assertEqual("AppointmentResponse", js["resourceType"]) + inst2 = appointmentresponse.AppointmentResponse(js) + self.implAppointmentResponse2(inst2) + + def implAppointmentResponse2(self, inst): + self.assertEqual(inst.id, "example") + 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/DSTU2/attachment.py b/fhirclient/models/DSTU2/attachment.py new file mode 100644 index 000000000..2639869b8 --- /dev/null +++ b/fhirclient/models/DSTU2/attachment.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Attachment) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Attachment(element.Element): + """ Content in a format defined elsewhere. + + For referring to data content defined in other formats. + """ + + resource_name = "Attachment" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.contentType = None + """ Mime type of the content, with charset etc.. + Type `str`. """ + + self.creation = None + """ Date attachment was first created. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.data = None + """ Data inline, base64ed. + Type `str`. """ + + self.hash = None + """ Hash of the data (sha-1, base64ed). + Type `str`. """ + + self.language = None + """ Human language of the content (BCP-47). + Type `str`. """ + + self.size = None + """ Number of bytes of content (if url provided). + Type `int`. """ + + self.title = None + """ Label to display in place of the data. + Type `str`. """ + + self.url = None + """ Uri where the data can be found. + Type `str`. """ + + super(Attachment, self).__init__(jsondict) + + def elementProperties(self): + js = super(Attachment, self).elementProperties() + js.extend([ + ("contentType", "contentType", str, False, None, False), + ("creation", "creation", fhirdate.FHIRDate, False, None, False), + ("data", "data", str, False, None, False), + ("hash", "hash", str, False, None, False), + ("language", "language", str, False, None, False), + ("size", "size", int, False, None, False), + ("title", "title", str, False, None, False), + ("url", "url", str, False, None, False), + ]) + return js + + +from . import fhirdate diff --git a/fhirclient/models/DSTU2/auditevent.py b/fhirclient/models/DSTU2/auditevent.py new file mode 100644 index 000000000..05fcf1c13 --- /dev/null +++ b/fhirclient/models/DSTU2/auditevent.py @@ -0,0 +1,354 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/AuditEvent) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class AuditEvent(domainresource.DomainResource): + """ Event record kept for security purposes. + + A record of an event made for purposes of maintaining a security log. + Typical uses include detection of intrusion attempts and monitoring for + inappropriate usage. + """ + + resource_name = "AuditEvent" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.event = None + """ What was done. + Type `AuditEventEvent` (represented as `dict` in JSON). """ + + self.object = None + """ Specific instances of data or objects that have been accessed. + List of `AuditEventObject` items (represented as `dict` in JSON). """ + + self.participant = None + """ A person, a hardware device or software process. + List of `AuditEventParticipant` items (represented as `dict` in JSON). """ + + self.source = None + """ Application systems and processes. + Type `AuditEventSource` (represented as `dict` in JSON). """ + + super(AuditEvent, self).__init__(jsondict) + + def elementProperties(self): + js = super(AuditEvent, self).elementProperties() + js.extend([ + ("event", "event", AuditEventEvent, False, None, True), + ("object", "object", AuditEventObject, True, None, False), + ("participant", "participant", AuditEventParticipant, True, None, True), + ("source", "source", AuditEventSource, False, None, True), + ]) + return js + + +from . import backboneelement + +class AuditEventEvent(backboneelement.BackboneElement): + """ What was done. + + Identifies the name, action type, time, and disposition of the audited + event. + """ + + resource_name = "AuditEventEvent" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.action = None + """ Type of action performed during the event. + Type `str`. """ + + self.dateTime = None + """ Time when the event occurred on source. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.outcome = None + """ Whether the event succeeded or failed. + Type `str`. """ + + self.outcomeDesc = None + """ Description of the event outcome. + Type `str`. """ + + self.purposeOfEvent = None + """ The purposeOfUse of the event. + List of `Coding` items (represented as `dict` in JSON). """ + + self.subtype = None + """ More specific type/id for the event. + List of `Coding` items (represented as `dict` in JSON). """ + + self.type = None + """ Type/identifier of event. + Type `Coding` (represented as `dict` in JSON). """ + + super(AuditEventEvent, self).__init__(jsondict) + + def elementProperties(self): + js = super(AuditEventEvent, self).elementProperties() + js.extend([ + ("action", "action", str, False, None, False), + ("dateTime", "dateTime", fhirdate.FHIRDate, False, None, True), + ("outcome", "outcome", str, False, None, False), + ("outcomeDesc", "outcomeDesc", str, False, None, False), + ("purposeOfEvent", "purposeOfEvent", coding.Coding, True, None, False), + ("subtype", "subtype", coding.Coding, True, None, False), + ("type", "type", coding.Coding, False, None, True), + ]) + return js + + +class AuditEventObject(backboneelement.BackboneElement): + """ Specific instances of data or objects that have been accessed. + """ + + resource_name = "AuditEventObject" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.description = None + """ Descriptive text. + Type `str`. """ + + self.detail = None + """ Additional Information about the Object. + List of `AuditEventObjectDetail` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Specific instance of object (e.g. versioned). + Type `Identifier` (represented as `dict` in JSON). """ + + self.lifecycle = None + """ Life-cycle stage for the object. + Type `Coding` (represented as `dict` in JSON). """ + + self.name = None + """ Instance-specific descriptor for Object. + Type `str`. """ + + self.query = None + """ Actual query for object. + Type `str`. """ + + self.reference = None + """ Specific instance of resource (e.g. versioned). + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.role = None + """ What role the Object played. + Type `Coding` (represented as `dict` in JSON). """ + + self.securityLabel = None + """ Security labels applied to the object. + List of `Coding` items (represented as `dict` in JSON). """ + + self.type = None + """ Type of object involved. + Type `Coding` (represented as `dict` in JSON). """ + + super(AuditEventObject, self).__init__(jsondict) + + def elementProperties(self): + js = super(AuditEventObject, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, False), + ("detail", "detail", AuditEventObjectDetail, 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), + ]) + return js + + +class AuditEventObjectDetail(backboneelement.BackboneElement): + """ Additional Information about the Object. + """ + + resource_name = "AuditEventObjectDetail" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.type = None + """ Name of the property. + Type `str`. """ + + self.value = None + """ Property value. + Type `str`. """ + + super(AuditEventObjectDetail, self).__init__(jsondict) + + def elementProperties(self): + js = super(AuditEventObjectDetail, self).elementProperties() + js.extend([ + ("type", "type", str, False, None, True), + ("value", "value", str, False, None, True), + ]) + return js + + +class AuditEventParticipant(backboneelement.BackboneElement): + """ A person, a hardware device or software process. + """ + + resource_name = "AuditEventParticipant" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.altId = None + """ Alternative User id e.g. authentication. + Type `str`. """ + + self.location = None + """ Where. + Type `FHIRReference` referencing `Location` (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 user. + Type `str`. """ + + self.network = None + """ Logical network location for application activity. + Type `AuditEventParticipantNetwork` (represented as `dict` in JSON). """ + + self.policy = None + """ Policy that authorized event. + List of `str` items. """ + + self.purposeOfUse = None + """ Reason given for this user. + List of `Coding` 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`. """ + + self.role = None + """ User roles (e.g. local RBAC codes). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.userId = None + """ Unique identifier for the user. + Type `Identifier` (represented as `dict` in JSON). """ + + super(AuditEventParticipant, self).__init__(jsondict) + + def elementProperties(self): + js = super(AuditEventParticipant, self).elementProperties() + js.extend([ + ("altId", "altId", str, False, None, False), + ("location", "location", fhirreference.FHIRReference, False, None, False), + ("media", "media", coding.Coding, False, None, False), + ("name", "name", str, False, None, False), + ("network", "network", AuditEventParticipantNetwork, False, None, False), + ("policy", "policy", str, True, None, False), + ("purposeOfUse", "purposeOfUse", coding.Coding, 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), + ]) + return js + + +class AuditEventParticipantNetwork(backboneelement.BackboneElement): + """ Logical network location for application activity. + + Logical network location for application activity, if the activity has a + network location. + """ + + resource_name = "AuditEventParticipantNetwork" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.address = None + """ Identifier for the network access point of the user device. + Type `str`. """ + + self.type = None + """ The type of network access point. + Type `str`. """ + + super(AuditEventParticipantNetwork, self).__init__(jsondict) + + def elementProperties(self): + js = super(AuditEventParticipantNetwork, self).elementProperties() + js.extend([ + ("address", "address", str, False, None, False), + ("type", "type", str, False, None, False), + ]) + return js + + +class AuditEventSource(backboneelement.BackboneElement): + """ Application systems and processes. + """ + + resource_name = "AuditEventSource" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.identifier = None + """ The identity of source detecting the event. + Type `Identifier` (represented as `dict` in JSON). """ + + self.site = None + """ Logical source location within the enterprise. + Type `str`. """ + + self.type = None + """ The type of source where event originated. + List of `Coding` items (represented as `dict` in JSON). """ + + super(AuditEventSource, self).__init__(jsondict) + + def elementProperties(self): + js = super(AuditEventSource, self).elementProperties() + js.extend([ + ("identifier", "identifier", identifier.Identifier, False, None, True), + ("site", "site", str, False, None, False), + ("type", "type", coding.Coding, True, None, False), + ]) + return js + + +from . import codeableconcept +from . import coding +from . import fhirdate +from . import fhirreference +from . import identifier diff --git a/fhirclient/models/DSTU2/auditevent_tests.py b/fhirclient/models/DSTU2/auditevent_tests.py new file mode 100644 index 000000000..cb60c4282 --- /dev/null +++ b/fhirclient/models/DSTU2/auditevent_tests.py @@ -0,0 +1,411 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import auditevent +from .fhirdate import FHIRDate + + +class AuditEventTests(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("AuditEvent", js["resourceType"]) + return auditevent.AuditEvent(js) + + def testAuditEvent1(self): + inst = self.instantiate_from("audit-event-example-search.json") + self.assertIsNotNone(inst, "Must have instantiated a AuditEvent instance") + self.implAuditEvent1(inst) + + js = inst.as_json() + self.assertEqual("AuditEvent", js["resourceType"]) + inst2 = auditevent.AuditEvent(js) + self.implAuditEvent1(inst2) + + def implAuditEvent1(self, inst): + self.assertEqual(inst.event.action, "E") + self.assertEqual(inst.event.dateTime.date, FHIRDate("2015-08-22T23:42:24Z").date) + self.assertEqual(inst.event.dateTime.as_json(), "2015-08-22T23:42:24Z") + self.assertEqual(inst.event.outcome, "0") + self.assertEqual(inst.event.subtype[0].code, "search") + self.assertEqual(inst.event.subtype[0].display, "search") + self.assertEqual(inst.event.subtype[0].system, "http://hl7.org/fhir/restful-interaction") + self.assertEqual(inst.event.type.code, "rest") + self.assertEqual(inst.event.type.display, "Restful Operation") + self.assertEqual(inst.event.type.system, "http://hl7.org/fhir/audit-event-type") + self.assertEqual(inst.id, "example-search") + self.assertEqual(inst.object[0].query, "aHR0cDovL2ZoaXItZGV2LmhlYWx0aGludGVyc2VjdGlvbnMuY29tLmF1L29wZW4vRW5jb3VudGVyP3BhcnRpY2lwYW50PTEz") + self.assertEqual(inst.object[0].role.code, "24") + self.assertEqual(inst.object[0].role.display, "Query") + self.assertEqual(inst.object[0].role.system, "http://hl7.org/fhir/object-role") + self.assertEqual(inst.object[0].type.code, "2") + self.assertEqual(inst.object[0].type.display, "System Object") + self.assertEqual(inst.object[0].type.system, "http://hl7.org/fhir/object-type") + self.assertEqual(inst.participant[0].altId, "601847123") + self.assertEqual(inst.participant[0].name, "Grahame Grieve") + self.assertTrue(inst.participant[0].requestor) + self.assertEqual(inst.participant[0].userId.value, "95") + 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.text.status, "generated") + + def testAuditEvent2(self): + inst = self.instantiate_from("audit-event-example-logout.json") + self.assertIsNotNone(inst, "Must have instantiated a AuditEvent instance") + self.implAuditEvent2(inst) + + js = inst.as_json() + self.assertEqual("AuditEvent", js["resourceType"]) + inst2 = auditevent.AuditEvent(js) + self.implAuditEvent2(inst2) + + def implAuditEvent2(self, inst): + self.assertEqual(inst.event.action, "E") + self.assertEqual(inst.event.dateTime.date, FHIRDate("2013-06-20T23:46:41Z").date) + self.assertEqual(inst.event.dateTime.as_json(), "2013-06-20T23:46:41Z") + self.assertEqual(inst.event.outcome, "0") + self.assertEqual(inst.event.subtype[0].code, "110123") + self.assertEqual(inst.event.subtype[0].display, "Logout") + self.assertEqual(inst.event.subtype[0].system, "http://nema.org/dicom/dicm") + self.assertEqual(inst.event.type.code, "110114") + self.assertEqual(inst.event.type.display, "User Authentication") + self.assertEqual(inst.event.type.system, "http://nema.org/dicom/dicm") + self.assertEqual(inst.id, "example-logout") + self.assertEqual(inst.participant[0].altId, "601847123") + self.assertEqual(inst.participant[0].name, "Grahame Grieve") + self.assertEqual(inst.participant[0].network.address, "127.0.0.1") + self.assertEqual(inst.participant[0].network.type, "2") + self.assertTrue(inst.participant[0].requestor) + self.assertEqual(inst.participant[0].userId.value, "95") + 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.text.status, "generated") + + def testAuditEvent3(self): + inst = self.instantiate_from("audit-event-example-vread.json") + self.assertIsNotNone(inst, "Must have instantiated a AuditEvent instance") + self.implAuditEvent3(inst) + + js = inst.as_json() + self.assertEqual("AuditEvent", js["resourceType"]) + inst2 = auditevent.AuditEvent(js) + self.implAuditEvent3(inst2) + + def implAuditEvent3(self, inst): + self.assertEqual(inst.event.action, "R") + self.assertEqual(inst.event.dateTime.date, FHIRDate("2013-06-20T23:42:24Z").date) + self.assertEqual(inst.event.dateTime.as_json(), "2013-06-20T23:42:24Z") + self.assertEqual(inst.event.outcome, "0") + self.assertEqual(inst.event.subtype[0].code, "vread") + self.assertEqual(inst.event.subtype[0].display, "vread") + self.assertEqual(inst.event.subtype[0].system, "http://hl7.org/fhir/restful-interaction") + self.assertEqual(inst.event.type.code, "rest") + self.assertEqual(inst.event.type.display, "Restful Operation") + self.assertEqual(inst.event.type.system, "http://hl7.org/fhir/audit-event-type") + self.assertEqual(inst.id, "example-rest") + self.assertEqual(inst.object[0].lifecycle.code, "6") + self.assertEqual(inst.object[0].lifecycle.display, "Access / Use") + self.assertEqual(inst.object[0].lifecycle.system, "http://hl7.org/fhir/object-lifecycle") + self.assertEqual(inst.object[0].type.code, "2") + self.assertEqual(inst.object[0].type.display, "System Object") + self.assertEqual(inst.object[0].type.system, "http://hl7.org/fhir/object-type") + self.assertEqual(inst.participant[0].altId, "601847123") + self.assertEqual(inst.participant[0].name, "Grahame Grieve") + self.assertTrue(inst.participant[0].requestor) + self.assertEqual(inst.participant[0].userId.value, "95") + 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.text.status, "generated") + + 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.event.action, "R") + self.assertEqual(inst.event.dateTime.date, FHIRDate("2015-08-27T23:42:24Z").date) + self.assertEqual(inst.event.dateTime.as_json(), "2015-08-27T23:42:24Z") + self.assertEqual(inst.event.outcome, "0") + self.assertEqual(inst.event.subtype[0].code, "ITI-32") + self.assertEqual(inst.event.subtype[0].display, "Distribute Document Set on Media") + self.assertEqual(inst.event.subtype[0].system, "urn:oid:1.3.6.1.4.1.19376.1.2") + self.assertEqual(inst.event.type.code, "110106") + self.assertEqual(inst.event.type.display, "Export") + self.assertEqual(inst.event.type.system, "http://nema.org/dicom/dicm") + self.assertEqual(inst.id, "example-media") + self.assertEqual(inst.object[0].identifier.value, "e3cdfc81a0d24bd^^^&2.16.840.1.113883.4.2&ISO") + self.assertEqual(inst.object[0].role.code, "1") + self.assertEqual(inst.object[0].role.display, "Patient") + self.assertEqual(inst.object[0].role.system, "http://hl7.org/fhir/object-role") + self.assertEqual(inst.object[0].type.code, "1") + self.assertEqual(inst.object[0].type.display, "Person") + self.assertEqual(inst.object[0].type.system, "http://hl7.org/fhir/object-type") + self.assertEqual(inst.object[1].identifier.type.coding[0].code, "IHE XDS Metadata") + self.assertEqual(inst.object[1].identifier.type.coding[0].display, "submission set classificationNode") + self.assertEqual(inst.object[1].identifier.type.coding[0].system, "urn:uuid:a54d6aa5-d40d-43f9-88c5-b4633d873bdd") + self.assertEqual(inst.object[1].identifier.value, "e3cdfc81a0d24bd^^^&2.16.840.1.113883.4.2&ISO") + self.assertEqual(inst.object[1].role.code, "20") + self.assertEqual(inst.object[1].role.display, "Job") + self.assertEqual(inst.object[1].role.system, "http://hl7.org/fhir/object-role") + self.assertEqual(inst.object[1].type.code, "2") + self.assertEqual(inst.object[1].type.display, "System Object") + self.assertEqual(inst.object[1].type.system, "http://hl7.org/fhir/object-type") + self.assertEqual(inst.object[2].type.code, "2") + self.assertEqual(inst.object[2].type.display, "System Object") + self.assertEqual(inst.object[2].type.system, "http://hl7.org/fhir/object-type") + self.assertFalse(inst.participant[0].requestor) + self.assertEqual(inst.participant[0].role[0].coding[0].code, "110153") + self.assertEqual(inst.participant[0].role[0].coding[0].display, "Source Role ID") + self.assertEqual(inst.participant[0].role[0].coding[0].system, "http://nema.org/dicom/dicm") + self.assertEqual(inst.participant[0].userId.value, "ExportToMedia.app") + self.assertEqual(inst.participant[1].altId, "601847123") + self.assertEqual(inst.participant[1].name, "Grahame Grieve") + self.assertTrue(inst.participant[1].requestor) + self.assertEqual(inst.participant[1].userId.value, "95") + self.assertEqual(inst.participant[2].media.code, "110033") + self.assertEqual(inst.participant[2].media.display, "DVD") + self.assertEqual(inst.participant[2].media.system, "http://nema.org/dicom/dicm") + self.assertEqual(inst.participant[2].name, "Media title: Hello World") + self.assertFalse(inst.participant[2].requestor) + self.assertEqual(inst.source.identifier.value, "hl7connect.healthintersections.com.au") + self.assertEqual(inst.text.status, "generated") + + 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.event.action, "E") + self.assertEqual(inst.event.dateTime.date, FHIRDate("2013-06-20T23:41:23Z").date) + self.assertEqual(inst.event.dateTime.as_json(), "2013-06-20T23:41:23Z") + self.assertEqual(inst.event.outcome, "0") + self.assertEqual(inst.event.subtype[0].code, "110122") + self.assertEqual(inst.event.subtype[0].display, "Login") + self.assertEqual(inst.event.subtype[0].system, "http://nema.org/dicom/dicm") + self.assertEqual(inst.event.type.code, "110114") + self.assertEqual(inst.event.type.display, "User Authentication") + self.assertEqual(inst.event.type.system, "http://nema.org/dicom/dicm") + self.assertEqual(inst.id, "example-login") + self.assertEqual(inst.participant[0].altId, "601847123") + self.assertEqual(inst.participant[0].name, "Grahame Grieve") + self.assertEqual(inst.participant[0].network.address, "127.0.0.1") + self.assertEqual(inst.participant[0].network.type, "2") + self.assertTrue(inst.participant[0].requestor) + self.assertEqual(inst.participant[0].userId.value, "95") + 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.text.status, "generated") + + def testAuditEvent6(self): + inst = self.instantiate_from("audit-event-example-pixQuery.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.event.action, "E") + self.assertEqual(inst.event.dateTime.date, FHIRDate("2015-08-26T23:42:24Z").date) + self.assertEqual(inst.event.dateTime.as_json(), "2015-08-26T23:42:24Z") + self.assertEqual(inst.event.outcome, "0") + self.assertEqual(inst.event.subtype[0].code, "ITI-9") + self.assertEqual(inst.event.subtype[0].display, "PIX Query") + self.assertEqual(inst.event.subtype[0].system, "urn:oid:1.3.6.1.4.1.19376.1.2") + self.assertEqual(inst.event.type.code, "110112") + self.assertEqual(inst.event.type.display, "Query") + self.assertEqual(inst.event.type.system, "http://nema.org/dicom/dicm") + self.assertEqual(inst.id, "example-pixQuery") + self.assertEqual(inst.object[0].identifier.value, "e3cdfc81a0d24bd^^^&2.16.840.1.113883.4.2&ISO") + self.assertEqual(inst.object[0].role.code, "1") + self.assertEqual(inst.object[0].role.display, "Patient") + self.assertEqual(inst.object[0].role.system, "http://hl7.org/fhir/object-role") + self.assertEqual(inst.object[0].type.code, "1") + self.assertEqual(inst.object[0].type.display, "Person") + self.assertEqual(inst.object[0].type.system, "http://hl7.org/fhir/object-type") + self.assertEqual(inst.object[1].detail[0].type, "MSH-10") + self.assertEqual(inst.object[1].detail[0].value, "MS4yLjg0MC4xMTQzNTAuMS4xMy4wLjEuNy4xLjE=") + self.assertEqual(inst.object[1].role.code, "24") + self.assertEqual(inst.object[1].role.display, "Query") + self.assertEqual(inst.object[1].role.system, "http://hl7.org/fhir/object-role") + self.assertEqual(inst.object[1].type.code, "2") + self.assertEqual(inst.object[1].type.display, "System Object") + self.assertEqual(inst.object[1].type.system, "http://hl7.org/fhir/object-type") + self.assertEqual(inst.participant[0].altId, "6580") + self.assertEqual(inst.participant[0].network.address, "Workstation1.ehr.familyclinic.com") + self.assertEqual(inst.participant[0].network.type, "1") + self.assertFalse(inst.participant[0].requestor) + self.assertEqual(inst.participant[0].role[0].coding[0].code, "110153") + self.assertEqual(inst.participant[0].role[0].coding[0].display, "Source Role ID") + self.assertEqual(inst.participant[0].role[0].coding[0].system, "http://nema.org/dicom/dicm") + self.assertEqual(inst.participant[0].userId.value, "2.16.840.1.113883.4.2|2.16.840.1.113883.4.2") + self.assertEqual(inst.participant[1].altId, "601847123") + self.assertEqual(inst.participant[1].name, "Grahame Grieve") + self.assertTrue(inst.participant[1].requestor) + self.assertEqual(inst.participant[1].userId.value, "95") + self.assertEqual(inst.source.identifier.value, "hl7connect.healthintersections.com.au") + self.assertEqual(inst.text.status, "generated") + + def testAuditEvent7(self): + inst = self.instantiate_from("auditevent-example.json") + self.assertIsNotNone(inst, "Must have instantiated a AuditEvent instance") + self.implAuditEvent7(inst) + + js = inst.as_json() + self.assertEqual("AuditEvent", js["resourceType"]) + inst2 = auditevent.AuditEvent(js) + self.implAuditEvent7(inst2) + + def implAuditEvent7(self, inst): + self.assertEqual(inst.event.action, "E") + self.assertEqual(inst.event.dateTime.date, FHIRDate("2012-10-25T22:04:27+11:00").date) + self.assertEqual(inst.event.dateTime.as_json(), "2012-10-25T22:04:27+11:00") + self.assertEqual(inst.event.outcome, "0") + self.assertEqual(inst.event.subtype[0].code, "110120") + self.assertEqual(inst.event.subtype[0].display, "Application Start") + self.assertEqual(inst.event.subtype[0].system, "http://nema.org/dicom/dicm") + self.assertEqual(inst.event.type.code, "110100") + self.assertEqual(inst.event.type.display, "Application Activity") + self.assertEqual(inst.event.type.system, "http://nema.org/dicom/dicm") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.object[0].identifier.type.coding[0].code, "SNO") + self.assertEqual(inst.object[0].identifier.type.coding[0].system, "http://hl7.org/fhir/identifier-type") + self.assertEqual(inst.object[0].identifier.type.text, "Dell Serial Number") + self.assertEqual(inst.object[0].identifier.value, "ABCDEF") + self.assertEqual(inst.object[0].lifecycle.code, "6") + self.assertEqual(inst.object[0].lifecycle.display, "Access / Use") + self.assertEqual(inst.object[0].lifecycle.system, "http://hl7.org/fhir/object-lifecycle") + self.assertEqual(inst.object[0].name, "Grahame's Laptop") + self.assertEqual(inst.object[0].role.code, "4") + self.assertEqual(inst.object[0].role.display, "DomainResource") + self.assertEqual(inst.object[0].role.system, "http://hl7.org/fhir/object-role") + self.assertEqual(inst.object[0].type.code, "4") + self.assertEqual(inst.object[0].type.display, "Other") + self.assertEqual(inst.object[0].type.system, "http://hl7.org/fhir/object-type") + self.assertEqual(inst.participant[0].network.address, "127.0.0.1") + self.assertEqual(inst.participant[0].network.type, "2") + self.assertFalse(inst.participant[0].requestor) + self.assertEqual(inst.participant[0].role[0].text, "Service User (Logon)") + self.assertEqual(inst.participant[0].userId.value, "Grahame") + self.assertEqual(inst.source.identifier.value, "Grahame's Laptop") + self.assertEqual(inst.source.site, "Development") + self.assertEqual(inst.source.type[0].code, "1") + self.assertEqual(inst.source.type[0].system, "http://hl7.org/fhir/audit-event-sub-type") + self.assertEqual(inst.text.div, "
Application Start for under service login "Grahame" (id: Grahame's Test HL7Connect)
") + self.assertEqual(inst.text.status, "generated") + + def testAuditEvent8(self): + inst = self.instantiate_from("auditevent-example-disclosure.json") + self.assertIsNotNone(inst, "Must have instantiated a AuditEvent instance") + self.implAuditEvent8(inst) + + js = inst.as_json() + self.assertEqual("AuditEvent", js["resourceType"]) + inst2 = auditevent.AuditEvent(js) + self.implAuditEvent8(inst2) + + def implAuditEvent8(self, inst): + self.assertEqual(inst.event.action, "R") + self.assertEqual(inst.event.dateTime.date, FHIRDate("2013-09-22T00:08:00Z").date) + self.assertEqual(inst.event.dateTime.as_json(), "2013-09-22T00:08:00Z") + self.assertEqual(inst.event.outcome, "0") + self.assertEqual(inst.event.outcomeDesc, "Successful Disclosure") + self.assertEqual(inst.event.purposeOfEvent[0].code, "HMARKT") + self.assertEqual(inst.event.purposeOfEvent[0].display, "healthcare marketing") + self.assertEqual(inst.event.purposeOfEvent[0].system, "http://hl7.org/fhir/v3/ActReason") + self.assertEqual(inst.event.subtype[0].code, "Disclosure") + self.assertEqual(inst.event.subtype[0].display, "HIPAA disclosure") + self.assertEqual(inst.event.type.code, "110106") + self.assertEqual(inst.event.type.display, "Export") + self.assertEqual(inst.event.type.system, "http://nema.org/dicom/dicm") + self.assertEqual(inst.id, "example-disclosure") + self.assertEqual(inst.object[0].role.code, "1") + self.assertEqual(inst.object[0].role.display, "Patient") + self.assertEqual(inst.object[0].role.system, "http://hl7.org/fhir/valueset-object-role") + self.assertEqual(inst.object[0].type.code, "1") + self.assertEqual(inst.object[0].type.display, "Person") + self.assertEqual(inst.object[0].type.system, "http://hl7.org/fhir/object-type") + self.assertEqual(inst.object[1].description, "data about Everthing important") + self.assertEqual(inst.object[1].identifier.value, "What.id") + self.assertEqual(inst.object[1].lifecycle.code, "11") + self.assertEqual(inst.object[1].lifecycle.display, "Disclosure") + self.assertEqual(inst.object[1].lifecycle.system, "http://hl7.org/fhir/object-lifecycle") + self.assertEqual(inst.object[1].name, "Namne of What") + self.assertEqual(inst.object[1].role.code, "4") + self.assertEqual(inst.object[1].role.display, "DomainResource") + self.assertEqual(inst.object[1].role.system, "http://hl7.org/fhir/valueset-object-role") + self.assertEqual(inst.object[1].securityLabel[0].code, "V") + self.assertEqual(inst.object[1].securityLabel[0].display, "very restricted") + self.assertEqual(inst.object[1].securityLabel[0].system, "http://hl7.org/fhir/v3/Confidentiality") + self.assertEqual(inst.object[1].securityLabel[1].code, "STD") + self.assertEqual(inst.object[1].securityLabel[1].display, "sexually transmitted disease information sensitivity") + self.assertEqual(inst.object[1].securityLabel[1].system, "http://hl7.org/fhir/v3/ActCode") + self.assertEqual(inst.object[1].securityLabel[2].code, "DELAU") + self.assertEqual(inst.object[1].securityLabel[2].display, "delete after use") + self.assertEqual(inst.object[1].securityLabel[2].system, "http://hl7.org/fhir/v3/ActCode") + self.assertEqual(inst.object[1].type.code, "2") + self.assertEqual(inst.object[1].type.display, "System Object") + self.assertEqual(inst.object[1].type.system, "http://hl7.org/fhir/object-type") + self.assertEqual(inst.participant[0].altId, "notMe") + self.assertEqual(inst.participant[0].name, "That guy everyone wishes would be caught") + self.assertEqual(inst.participant[0].network.address, "custodian.net") + self.assertEqual(inst.participant[0].network.type, "1") + self.assertEqual(inst.participant[0].policy[0], "http://consent.com/yes") + self.assertTrue(inst.participant[0].requestor) + self.assertEqual(inst.participant[0].role[0].coding[0].code, "110153") + self.assertEqual(inst.participant[0].role[0].coding[0].display, "Source Role ID") + self.assertEqual(inst.participant[0].role[0].coding[0].system, "http://nema.org/dicom/dicm") + self.assertEqual(inst.participant[0].userId.value, "SomeIdiot@nowhere.com") + self.assertEqual(inst.participant[1].network.address, "marketing.land") + self.assertEqual(inst.participant[1].network.type, "1") + self.assertEqual(inst.participant[1].purposeOfUse[0].code, "HMARKT") + self.assertEqual(inst.participant[1].purposeOfUse[0].display, "healthcare marketing") + self.assertEqual(inst.participant[1].purposeOfUse[0].system, "http://hl7.org/fhir/v3/ActReason") + self.assertFalse(inst.participant[1].requestor) + self.assertEqual(inst.participant[1].role[0].coding[0].code, "110152") + self.assertEqual(inst.participant[1].role[0].coding[0].display, "Destination Role ID") + self.assertEqual(inst.participant[1].role[0].coding[0].system, "http://nema.org/dicom/dicm") + self.assertEqual(inst.participant[1].userId.value, "Where") + 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.text.div, "
Disclosure by some idiot, for marketing reasons, to places unknown, of a Poor Sap, data about Everthing important.
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/backboneelement.py b/fhirclient/models/DSTU2/backboneelement.py new file mode 100644 index 000000000..211faf39a --- /dev/null +++ b/fhirclient/models/DSTU2/backboneelement.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/BackboneElement) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class BackboneElement(element.Element): + """ Base for elements defined inside a resource. + + Base definition for all elements that are defined inside a resource - but + not those in a data type. + """ + + resource_name = "BackboneElement" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.modifierExtension = None + """ Extensions that cannot be ignored. + List of `Extension` items (represented as `dict` in JSON). """ + + super(BackboneElement, self).__init__(jsondict) + + def elementProperties(self): + js = super(BackboneElement, self).elementProperties() + js.extend([ + ("modifierExtension", "modifierExtension", extension.Extension, True, None, False), + ]) + return js + + +from . import extension diff --git a/fhirclient/models/DSTU2/basic.py b/fhirclient/models/DSTU2/basic.py new file mode 100644 index 000000000..b5a28c6dc --- /dev/null +++ b/fhirclient/models/DSTU2/basic.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Basic) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Basic(domainresource.DomainResource): + """ Resource for non-supported content. + + Basic is used for handling concepts not yet defined in FHIR, narrative-only + resources that don't map to an existing resource, and custom resources not + appropriate for inclusion in the FHIR specification. + """ + + resource_name = "Basic" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.author = None + """ Who created. + Type `FHIRReference` referencing `Practitioner, Patient, RelatedPerson` (represented as `dict` in JSON). """ + + self.code = None + """ Kind of Resource. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.created = None + """ When created. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.identifier = None + """ Business identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.subject = None + """ Identifies the focus of this resource. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + super(Basic, self).__init__(jsondict) + + def elementProperties(self): + js = super(Basic, self).elementProperties() + js.extend([ + ("author", "author", fhirreference.FHIRReference, False, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("created", "created", fhirdate.FHIRDate, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier diff --git a/fhirclient/models/DSTU2/basic_tests.py b/fhirclient/models/DSTU2/basic_tests.py new file mode 100644 index 000000000..668d1dc34 --- /dev/null +++ b/fhirclient/models/DSTU2/basic_tests.py @@ -0,0 +1,104 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import basic +from .fhirdate import FHIRDate + + +class BasicTests(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("Basic", js["resourceType"]) + return basic.Basic(js) + + def testBasic1(self): + inst = self.instantiate_from("basic-example2.json") + self.assertIsNotNone(inst, "Must have instantiated a Basic instance") + self.implBasic1(inst) + + js = inst.as_json() + self.assertEqual("Basic", js["resourceType"]) + inst2 = basic.Basic(js) + self.implBasic1(inst2) + + def implBasic1(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") + + def testBasic2(self): + inst = self.instantiate_from("basic-example-narrative.json") + self.assertIsNotNone(inst, "Must have instantiated a Basic instance") + self.implBasic2(inst) + + js = inst.as_json() + self.assertEqual("Basic", js["resourceType"]) + inst2 = basic.Basic(js) + 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.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.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") + self.assertEqual(inst.extension[1].url, "http://example.org/do-not-use/fhir-extensions/referral#notes") + self.assertEqual(inst.extension[1].valueString, "The patient had fever peaks over the last couple of days. He is worried about these peaks.") + self.assertEqual(inst.extension[2].url, "http://example.org/do-not-use/fhir-extensions/referral#fulfillingEncounter") + self.assertEqual(inst.id, "referral") + 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") + self.assertEqual(inst.modifierExtension[0].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.modifierExtension[1].url, "http://example.org/do-not-use/fhir-extensions/referral#targetDate") + self.assertEqual(inst.modifierExtension[1].valuePeriod.end.date, FHIRDate("2013-04-15").date) + self.assertEqual(inst.modifierExtension[1].valuePeriod.end.as_json(), "2013-04-15") + self.assertEqual(inst.modifierExtension[1].valuePeriod.start.date, FHIRDate("2013-04-01").date) + self.assertEqual(inst.modifierExtension[1].valuePeriod.start.as_json(), "2013-04-01") + 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") + diff --git a/fhirclient/models/DSTU2/binary.py b/fhirclient/models/DSTU2/binary.py new file mode 100644 index 000000000..aef5b1200 --- /dev/null +++ b/fhirclient/models/DSTU2/binary.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Binary) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import resource + +class Binary(resource.Resource): + """ Pure binary content defined by some other format than FHIR. + + A binary resource can contain any content, whether text, image, pdf, zip + archive, etc. + """ + + resource_name = "Binary" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.content = None + """ The actual content. + Type `str`. """ + + self.contentType = None + """ MimeType of the binary content. + Type `str`. """ + + super(Binary, self).__init__(jsondict) + + def elementProperties(self): + js = super(Binary, self).elementProperties() + js.extend([ + ("content", "content", str, False, None, True), + ("contentType", "contentType", str, False, None, True), + ]) + return js + + diff --git a/fhirclient/models/DSTU2/binary_tests.py b/fhirclient/models/DSTU2/binary_tests.py new file mode 100644 index 000000000..40fe005b0 --- /dev/null +++ b/fhirclient/models/DSTU2/binary_tests.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import binary +from .fhirdate import FHIRDate + + +class BinaryTests(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("Binary", js["resourceType"]) + return binary.Binary(js) + + def testBinary1(self): + inst = self.instantiate_from("binary-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Binary instance") + self.implBinary1(inst) + + js = inst.as_json() + self.assertEqual("Binary", js["resourceType"]) + inst2 = binary.Binary(js) + self.implBinary1(inst2) + + def implBinary1(self, inst): + self.assertEqual(inst.contentType, "application/pdf") + self.assertEqual(inst.id, "example") + diff --git a/fhirclient/models/DSTU2/bodysite.py b/fhirclient/models/DSTU2/bodysite.py new file mode 100644 index 000000000..385b151f7 --- /dev/null +++ b/fhirclient/models/DSTU2/bodysite.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/BodySite) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class BodySite(domainresource.DomainResource): + """ Specific and identified anatomical location. + + 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. + """ + + resource_name = "BodySite" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.code = None + """ Named anatomical location. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.description = None + """ The Description of anatomical location. + Type `str`. """ + + self.identifier = None + """ Bodysite 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.modifier = None + """ Modification to location code. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.patient = None + """ Patient. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + super(BodySite, self).__init__(jsondict) + + def elementProperties(self): + js = super(BodySite, self).elementProperties() + js.extend([ + ("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), + ("modifier", "modifier", codeableconcept.CodeableConcept, True, None, False), + ("patient", "patient", fhirreference.FHIRReference, False, None, True), + ]) + return js + + +from . import attachment +from . import codeableconcept +from . import fhirreference +from . import identifier diff --git a/fhirclient/models/DSTU2/bodysite_tests.py b/fhirclient/models/DSTU2/bodysite_tests.py new file mode 100644 index 000000000..887069c57 --- /dev/null +++ b/fhirclient/models/DSTU2/bodysite_tests.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +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.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, "53120007") + self.assertEqual(inst.code.coding[0].display, "Arm") + self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.code.text, "Arm") + self.assertEqual(inst.description, "front of upper left arm directly below the tattoo") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier[0].system, "http://www.acmehosp.com/bodysites") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "12345") + self.assertEqual(inst.image[0].contentType, "image/png;base64") + self.assertEqual(inst.image[0].title, "ARM") + self.assertEqual(inst.modifier[0].coding[0].code, "419161000") + self.assertEqual(inst.modifier[0].coding[0].display, "Unilateral left") + self.assertEqual(inst.modifier[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.modifier[0].text, "Left") + self.assertEqual(inst.modifier[1].coding[0].code, "261183002") + self.assertEqual(inst.modifier[1].coding[0].display, "Upper") + self.assertEqual(inst.modifier[1].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.modifier[1].text, "Upper") + self.assertEqual(inst.modifier[2].coding[0].code, "255549009") + self.assertEqual(inst.modifier[2].coding[0].display, "Anterior") + self.assertEqual(inst.modifier[2].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.modifier[2].text, "Anterior") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/bundle.py b/fhirclient/models/DSTU2/bundle.py new file mode 100644 index 000000000..3f7847355 --- /dev/null +++ b/fhirclient/models/DSTU2/bundle.py @@ -0,0 +1,269 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Bundle) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import resource + +class Bundle(resource.Resource): + """ Contains a collection of resources. + + A container for a collection of resources. + """ + + resource_name = "Bundle" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.entry = None + """ Entry in the bundle - will have a resource, or information. + List of `BundleEntry` items (represented as `dict` in JSON). """ + + self.link = None + """ Links related to this Bundle. + List of `BundleLink` items (represented as `dict` in JSON). """ + + self.signature = None + """ Digital Signature. + Type `Signature` (represented as `dict` in JSON). """ + + self.total = None + """ If search, the total number of matches. + Type `int`. """ + + self.type = None + """ document | message | transaction | transaction-response | batch | + batch-response | history | searchset | collection. + Type `str`. """ + + super(Bundle, self).__init__(jsondict) + + def elementProperties(self): + js = super(Bundle, self).elementProperties() + js.extend([ + ("entry", "entry", BundleEntry, True, None, False), + ("link", "link", BundleLink, True, None, False), + ("signature", "signature", signature.Signature, False, None, False), + ("total", "total", int, False, None, False), + ("type", "type", str, False, None, True), + ]) + return js + + +from . import backboneelement + +class BundleEntry(backboneelement.BackboneElement): + """ Entry in the bundle - will have a resource, or information. + + An entry in a bundle resource - will either contain a resource, or + information about a resource (transactions and history only). + """ + + resource_name = "BundleEntry" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.fullUrl = None + """ Absolute URL for resource (server address, or UUID/OID). + Type `str`. """ + + self.link = None + """ Links related to this entry. + List of `BundleLink` items (represented as `dict` in JSON). """ + + self.request = None + """ Transaction Related Information. + Type `BundleEntryRequest` (represented as `dict` in JSON). """ + + self.resource = None + """ A resource in the bundle. + Type `Resource` (represented as `dict` in JSON). """ + + self.response = None + """ Transaction Related Information. + Type `BundleEntryResponse` (represented as `dict` in JSON). """ + + self.search = None + """ Search related information. + Type `BundleEntrySearch` (represented as `dict` in JSON). """ + + super(BundleEntry, self).__init__(jsondict) + + def elementProperties(self): + js = super(BundleEntry, self).elementProperties() + js.extend([ + ("fullUrl", "fullUrl", str, False, None, False), + ("link", "link", BundleLink, True, None, False), + ("request", "request", BundleEntryRequest, False, None, False), + ("resource", "resource", resource.Resource, False, None, False), + ("response", "response", BundleEntryResponse, False, None, False), + ("search", "search", BundleEntrySearch, False, None, False), + ]) + return js + + +class BundleEntryRequest(backboneelement.BackboneElement): + """ Transaction Related Information. + + Additional information about how this entry should be processed as part of + a transaction. + """ + + resource_name = "BundleEntryRequest" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.ifMatch = None + """ For managing update contention. + Type `str`. """ + + self.ifModifiedSince = None + """ For managing update contention. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.ifNoneExist = None + """ For conditional creates. + Type `str`. """ + + self.ifNoneMatch = None + """ For managing cache currency. + Type `str`. """ + + self.method = None + """ GET | POST | PUT | DELETE. + Type `str`. """ + + self.url = None + """ URL for HTTP equivalent of this entry. + Type `str`. """ + + super(BundleEntryRequest, self).__init__(jsondict) + + def elementProperties(self): + js = super(BundleEntryRequest, self).elementProperties() + js.extend([ + ("ifMatch", "ifMatch", str, False, None, False), + ("ifModifiedSince", "ifModifiedSince", fhirdate.FHIRDate, False, None, False), + ("ifNoneExist", "ifNoneExist", str, False, None, False), + ("ifNoneMatch", "ifNoneMatch", str, False, None, False), + ("method", "method", str, False, None, True), + ("url", "url", str, False, None, True), + ]) + return js + + +class BundleEntryResponse(backboneelement.BackboneElement): + """ Transaction Related Information. + + Additional information about how this entry should be processed as part of + a transaction. + """ + + resource_name = "BundleEntryResponse" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.etag = None + """ The etag for the resource (if relevant). + Type `str`. """ + + self.lastModified = None + """ Server's date time modified. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.location = None + """ The location, if the operation returns a location. + Type `str`. """ + + self.status = None + """ Status return code for entry. + Type `str`. """ + + super(BundleEntryResponse, self).__init__(jsondict) + + def elementProperties(self): + js = super(BundleEntryResponse, self).elementProperties() + js.extend([ + ("etag", "etag", str, False, None, False), + ("lastModified", "lastModified", fhirdate.FHIRDate, False, None, False), + ("location", "location", str, False, None, False), + ("status", "status", str, False, None, True), + ]) + return js + + +class BundleEntrySearch(backboneelement.BackboneElement): + """ Search related information. + + Information about the search process that lead to the creation of this + entry. + """ + + resource_name = "BundleEntrySearch" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.mode = None + """ match | include | outcome - why this is in the result set. + Type `str`. """ + + self.score = None + """ Search ranking (between 0 and 1). + Type `float`. """ + + super(BundleEntrySearch, self).__init__(jsondict) + + def elementProperties(self): + js = super(BundleEntrySearch, self).elementProperties() + js.extend([ + ("mode", "mode", str, False, None, False), + ("score", "score", float, False, None, False), + ]) + return js + + +class BundleLink(backboneelement.BackboneElement): + """ Links related to this Bundle. + + A series of links that provide context to this bundle. + """ + + resource_name = "BundleLink" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.relation = None + """ http://www.iana.org/assignments/link-relations/link-relations.xhtml. + Type `str`. """ + + self.url = None + """ Reference details for the link. + Type `str`. """ + + super(BundleLink, self).__init__(jsondict) + + def elementProperties(self): + js = super(BundleLink, self).elementProperties() + js.extend([ + ("relation", "relation", str, False, None, True), + ("url", "url", str, False, None, True), + ]) + return js + + +from . import fhirdate +from . import signature diff --git a/fhirclient/models/DSTU2/bundle_tests.py b/fhirclient/models/DSTU2/bundle_tests.py new file mode 100644 index 000000000..be2ea3759 --- /dev/null +++ b/fhirclient/models/DSTU2/bundle_tests.py @@ -0,0 +1,423 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import bundle +from .fhirdate import FHIRDate + + +class BundleTests(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("Bundle", js["resourceType"]) + return bundle.Bundle(js) + + def testBundle1(self): + inst = self.instantiate_from("xds-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Bundle instance") + self.implBundle1(inst) + + js = inst.as_json() + self.assertEqual("Bundle", js["resourceType"]) + inst2 = bundle.Bundle(js) + self.implBundle1(inst2) + + def implBundle1(self, inst): + 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, "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, "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, "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, "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, "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.type, "transaction") + + def testBundle2(self): + inst = self.instantiate_from("practitioner-examples-general.json") + self.assertIsNotNone(inst, "Must have instantiated a Bundle instance") + self.implBundle2(inst) + + js = inst.as_json() + self.assertEqual("Bundle", js["resourceType"]) + inst2 = bundle.Bundle(js) + self.implBundle2(inst2) + + def implBundle2(self, inst): + self.assertEqual(inst.entry[0].fullUrl, "http://hl7.org/fhir/Practitioner/13") + self.assertEqual(inst.entry[0].resource.id, "13") + 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/Practitioner/14") + self.assertEqual(inst.entry[1].resource.id, "14") + 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/Practitioner/15") + self.assertEqual(inst.entry[2].resource.id, "15") + 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/Practitioner/16") + self.assertEqual(inst.entry[3].resource.id, "16") + 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/Practitioner/17") + self.assertEqual(inst.entry[4].resource.id, "17") + 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/Practitioner/18") + self.assertEqual(inst.entry[5].resource.id, "18") + 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/Practitioner/19") + self.assertEqual(inst.entry[6].resource.id, "19") + 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/Practitioner/20") + self.assertEqual(inst.entry[7].resource.id, "20") + 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/Practitioner/21") + self.assertEqual(inst.entry[8].resource.id, "21") + 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/Practitioner/22") + self.assertEqual(inst.entry[9].resource.id, "22") + 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, "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.type, "collection") + + def testBundle3(self): + inst = self.instantiate_from("document-example-dischargesummary.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, "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.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, "AuthorID") + self.assertEqual(inst.signature.type[0].system, "http://hl7.org/fhir/valueset-signature-type") + 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 testBundle4(self): + inst = self.instantiate_from("diagnosticreport-examples-lab-text.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://hl7.org/fhir/DiagnosticReport/103") + self.assertEqual(inst.entry[0].resource.id, "103") + 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/104") + self.assertEqual(inst.entry[1].resource.id, "104") + 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/105") + self.assertEqual(inst.entry[2].resource.id, "105") + 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/106") + self.assertEqual(inst.entry[3].resource.id, "106") + 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/107") + self.assertEqual(inst.entry[4].resource.id, "107") + 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/108") + self.assertEqual(inst.entry[5].resource.id, "108") + 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/109") + self.assertEqual(inst.entry[6].resource.id, "109") + 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/110") + self.assertEqual(inst.entry[7].resource.id, "110") + 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/111") + self.assertEqual(inst.entry[8].resource.id, "111") + 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/112") + self.assertEqual(inst.entry[9].resource.id, "112") + 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, "2763c3ea-6bce-4f15-bdc9-4b41aaceee03") + 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 testBundle5(self): + inst = self.instantiate_from("patient-examples-cypress-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/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 testBundle6(self): + inst = self.instantiate_from("bundle-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, "https://example.com/base/MedicationOrder/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/MedicationOrder?patient=347&_include=MedicationOrder.medication") + self.assertEqual(inst.link[1].relation, "next") + self.assertEqual(inst.link[1].url, "https://example.com/base/MedicationOrder?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") + + def testBundle7(self): + inst = self.instantiate_from("diagnosticreport-examples-general.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/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 testBundle8(self): + inst = self.instantiate_from("patient-examples-general.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, "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") + self.assertEqual(inst.type, "collection") + diff --git a/fhirclient/models/DSTU2/careplan.py b/fhirclient/models/DSTU2/careplan.py new file mode 100644 index 000000000..416fdf489 --- /dev/null +++ b/fhirclient/models/DSTU2/careplan.py @@ -0,0 +1,343 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/CarePlan) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class CarePlan(domainresource.DomainResource): + """ Healthcare plan for patient or group. + + Describes the intention of how one or more practitioners intend to deliver + care for a particular patient, group or community for a period of time, + possibly limited to care for a specific condition or set of conditions. + """ + + resource_name = "CarePlan" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.activity = None + """ Action to occur as part of plan. + List of `CarePlanActivity` items (represented as `dict` in JSON). """ + + self.addresses = None + """ Health issues this plan addresses. + List of `FHIRReference` items referencing `Condition` (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` (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.description = None + """ Summary of nature of plan. + Type `str`. """ + + self.goal = None + """ Desired outcome of plan. + List of `FHIRReference` items referencing `Goal` (represented as `dict` in JSON). """ + + self.identifier = None + """ External Ids for this plan. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.modified = None + """ When last updated. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.note = None + """ Comments about the plan. + Type `Annotation` (represented as `dict` in JSON). """ + + self.participant = None + """ Who's involved in plan?. + List of `CarePlanParticipant` items (represented as `dict` in JSON). """ + + self.period = None + """ Time period plan covers. + Type `Period` (represented as `dict` in JSON). """ + + self.relatedPlan = None + """ Plans related to this one. + List of `CarePlanRelatedPlan` items (represented as `dict` in JSON). """ + + self.status = None + """ proposed | draft | active | completed | cancelled. + Type `str`. """ + + self.subject = None + """ Who care plan is for. + Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ + + self.support = None + """ Information considered as part of plan. + List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + + super(CarePlan, self).__init__(jsondict) + + def elementProperties(self): + js = super(CarePlan, self).elementProperties() + js.extend([ + ("activity", "activity", CarePlanActivity, True, None, False), + ("addresses", "addresses", fhirreference.FHIRReference, True, None, False), + ("author", "author", fhirreference.FHIRReference, True, None, False), + ("category", "category", codeableconcept.CodeableConcept, True, None, False), + ("context", "context", fhirreference.FHIRReference, False, None, False), + ("description", "description", str, False, None, False), + ("goal", "goal", fhirreference.FHIRReference, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("modified", "modified", fhirdate.FHIRDate, False, None, False), + ("note", "note", annotation.Annotation, False, None, False), + ("participant", "participant", CarePlanParticipant, True, None, False), + ("period", "period", period.Period, False, None, False), + ("relatedPlan", "relatedPlan", CarePlanRelatedPlan, True, None, False), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ("support", "support", fhirreference.FHIRReference, True, None, False), + ]) + return js + + +from . import backboneelement + +class CarePlanActivity(backboneelement.BackboneElement): + """ Action to occur as part of plan. + + Identifies a planned action to occur as part of the plan. For example, a + medication to be used, lab tests to perform, self-monitoring, education, + etc. + """ + + resource_name = "CarePlanActivity" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.actionResulting = None + """ Appointments, orders, etc.. + List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + + self.detail = None + """ In-line definition of activity. + Type `CarePlanActivityDetail` (represented as `dict` in JSON). """ + + self.progress = None + """ Comments about the activity status/progress. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.reference = None + """ Activity details defined in specific resource. + Type `FHIRReference` referencing `Appointment, CommunicationRequest, DeviceUseRequest, DiagnosticOrder, MedicationOrder, NutritionOrder, Order, ProcedureRequest, ProcessRequest, ReferralRequest, SupplyRequest, VisionPrescription` (represented as `dict` in JSON). """ + + super(CarePlanActivity, self).__init__(jsondict) + + def elementProperties(self): + js = super(CarePlanActivity, self).elementProperties() + js.extend([ + ("actionResulting", "actionResulting", fhirreference.FHIRReference, True, None, False), + ("detail", "detail", CarePlanActivityDetail, False, None, False), + ("progress", "progress", annotation.Annotation, True, None, False), + ("reference", "reference", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +class CarePlanActivityDetail(backboneelement.BackboneElement): + """ In-line definition of activity. + + A simple summary of a planned activity suitable for a general care plan + system (e.g. form driven) that doesn't know about specific resources such + as procedure etc. + """ + + resource_name = "CarePlanActivityDetail" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + 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). """ + + self.dailyAmount = None + """ How to consume/day?. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + self.description = None + """ Extra info describing activity to perform. + Type `str`. """ + + self.goal = None + """ Goals this activity relates to. + List of `FHIRReference` items referencing `Goal` (represented as `dict` in JSON). """ + + self.location = None + """ Where it should happen. + Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + + self.performer = None + """ Who will be responsible?. + List of `FHIRReference` items referencing `Practitioner, Organization, RelatedPerson, Patient` (represented as `dict` in JSON). """ + + self.productCodeableConcept = None + """ What is to be administered/supplied. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + 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`. """ + + self.quantity = None + """ How much to administer/supply/consume. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + self.reasonCode = None + """ Why activity should be done. + 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). """ + + self.scheduledPeriod = None + """ When activity is to occur. + Type `Period` (represented as `dict` in JSON). """ + + self.scheduledString = None + """ When activity is to occur. + Type `str`. """ + + self.scheduledTiming = None + """ When activity is to occur. + Type `Timing` (represented as `dict` in JSON). """ + + self.status = None + """ not-started | scheduled | in-progress | on-hold | completed | + cancelled. + Type `str`. """ + + self.statusReason = None + """ Reason for current status. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(CarePlanActivityDetail, self).__init__(jsondict) + + 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), + ("description", "description", str, False, None, False), + ("goal", "goal", fhirreference.FHIRReference, True, 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, True), + ("quantity", "quantity", quantity.Quantity, False, None, False), + ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), + ("reasonReference", "reasonReference", fhirreference.FHIRReference, True, None, False), + ("scheduledPeriod", "scheduledPeriod", period.Period, False, "scheduled", False), + ("scheduledString", "scheduledString", str, False, "scheduled", False), + ("scheduledTiming", "scheduledTiming", timing.Timing, False, "scheduled", False), + ("status", "status", str, False, None, False), + ("statusReason", "statusReason", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class CarePlanParticipant(backboneelement.BackboneElement): + """ Who's involved in plan?. + + Identifies all people and organizations who are expected to be involved in + the care envisioned by this plan. + """ + + resource_name = "CarePlanParticipant" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.member = None + """ Who is involved. + Type `FHIRReference` referencing `Practitioner, RelatedPerson, Patient, Organization` (represented as `dict` in JSON). """ + + self.role = None + """ Type of involvement. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(CarePlanParticipant, self).__init__(jsondict) + + def elementProperties(self): + js = super(CarePlanParticipant, self).elementProperties() + js.extend([ + ("member", "member", fhirreference.FHIRReference, False, None, False), + ("role", "role", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class CarePlanRelatedPlan(backboneelement.BackboneElement): + """ Plans related to this one. + + Identifies CarePlans with some sort of formal relationship to the current + plan. + """ + + resource_name = "CarePlanRelatedPlan" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.code = None + """ includes | replaces | fulfills. + Type `str`. """ + + self.plan = None + """ Plan relationship exists with. + Type `FHIRReference` referencing `CarePlan` (represented as `dict` in JSON). """ + + super(CarePlanRelatedPlan, self).__init__(jsondict) + + def elementProperties(self): + js = super(CarePlanRelatedPlan, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, False), + ("plan", "plan", fhirreference.FHIRReference, False, None, True), + ]) + return js + + +from . import annotation +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier +from . import period +from . import quantity +from . import timing diff --git a/fhirclient/models/DSTU2/careplan_tests.py b/fhirclient/models/DSTU2/careplan_tests.py new file mode 100644 index 000000000..5c3da57a9 --- /dev/null +++ b/fhirclient/models/DSTU2/careplan_tests.py @@ -0,0 +1,537 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import careplan +from .fhirdate import FHIRDate + + +class CarePlanTests(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("CarePlan", js["resourceType"]) + return careplan.CarePlan(js) + + def testCarePlan1(self): + inst = self.instantiate_from("careplan-example-f002-lung.json") + self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") + self.implCarePlan1(inst) + + js = inst.as_json() + self.assertEqual("CarePlan", js["resourceType"]) + inst2 = careplan.CarePlan(js) + 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, "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-07-07T09:30:10+01:00") + self.assertEqual(inst.activity[0].detail.status, "completed") + self.assertEqual(inst.contained[0].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.assertEqual(inst.modified.date, FHIRDate("2011-07-07T09:30:10+01:00").date) + self.assertEqual(inst.modified.as_json(), "2011-07-07T09:30:10+01:00") + 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-f202-malignancy.json") + self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") + self.implCarePlan2(inst) + + js = inst.as_json() + self.assertEqual("CarePlan", js["resourceType"]) + inst2 = careplan.CarePlan(js) + 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, "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, "goal") + self.assertEqual(inst.id, "f202") + self.assertEqual(inst.participant[0].role.coding[0].code, "28995006") + self.assertEqual(inst.participant[0].role.coding[0].display, "Treated with") + self.assertEqual(inst.participant[0].role.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + + def testCarePlan3(self): + inst = self.instantiate_from("careplan-example.json") + self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") + self.implCarePlan3(inst) + + js = inst.as_json() + self.assertEqual("CarePlan", js["resourceType"]) + inst2 = careplan.CarePlan(js) + self.implCarePlan3(inst2) + + def implCarePlan3(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.text, "a code for weight measurement") + self.assertFalse(inst.activity[0].detail.prohibited) + 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.periodUnits, "d") + self.assertEqual(inst.contained[0].id, "p1") + self.assertEqual(inst.contained[1].id, "pr1") + self.assertEqual(inst.contained[2].id, "goal") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.participant[0].role.text, "responsiblePerson") + self.assertEqual(inst.participant[1].role.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") + self.assertEqual(inst.text.status, "additional") + + def testCarePlan4(self): + inst = self.instantiate_from("careplan-example-f201-renal.json") + self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") + self.implCarePlan4(inst) + + js = inst.as_json() + self.assertEqual("CarePlan", js["resourceType"]) + inst2 = careplan.CarePlan(js) + 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, "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") + self.assertEqual(inst.activity[0].detail.dailyAmount.code, "258718000") + 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.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.assertEqual(inst.activity[1].detail.status, "completed") + self.assertEqual(inst.contained[0].id, "goal") + self.assertEqual(inst.id, "f201") + self.assertEqual(inst.modified.date, FHIRDate("2013-03-11").date) + self.assertEqual(inst.modified.as_json(), "2013-03-11") + self.assertEqual(inst.participant[0].role.coding[0].code, "425268008") + self.assertEqual(inst.participant[0].role.coding[0].display, "Review of care plan") + self.assertEqual(inst.participant[0].role.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.participant[1].role.coding[0].code, "229774002") + self.assertEqual(inst.participant[1].role.coding[0].display, "Carer") + self.assertEqual(inst.participant[1].role.coding[0].system, "http://snomed.info/sct") + 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) + self.assertEqual(inst.period.start.as_json(), "2013-03-11") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + + def testCarePlan5(self): + inst = self.instantiate_from("careplan-example-GPVisit.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, "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.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.assertEqual(inst.activity[1].detail.status, "scheduled") + self.assertEqual(inst.contained[0].id, "p1") + self.assertEqual(inst.contained[1].id, "goal") + self.assertEqual(inst.id, "gpvisit") + self.assertEqual(inst.participant[0].id, "part1") + self.assertEqual(inst.participant[0].role.coding[0].code, "nur") + self.assertEqual(inst.participant[0].role.coding[0].system, "http://example.org/local") + self.assertEqual(inst.participant[0].role.text, "nurse") + self.assertEqual(inst.participant[1].id, "part2") + self.assertEqual(inst.participant[1].role.coding[0].code, "doc") + self.assertEqual(inst.participant[1].role.coding[0].system, "http://example.org/local") + self.assertEqual(inst.participant[1].role.text, "doctor") + 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 testCarePlan6(self): + inst = self.instantiate_from("careplan-example-integrated.json") + self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") + self.implCarePlan6(inst) + + js = inst.as_json() + self.assertEqual("CarePlan", js["resourceType"]) + inst2 = careplan.CarePlan(js) + self.implCarePlan6(inst2) + + def implCarePlan6(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") + self.assertEqual(inst.activity[0].detail.description, "Eve will review photos of high and low density foods and share with her parents") + self.assertEqual(inst.activity[0].detail.extension[0].url, "http://example.org/DoNotUse/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.assertEqual(inst.activity[1].detail.extension[0].url, "http://example.org/DoNotUse/General/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.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.assertEqual(inst.activity[2].detail.extension[0].url, "http://example.org/DoNotUse/General/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.assertEqual(inst.activity[3].detail.extension[0].url, "http://example.org/DoNotUse/General/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") + self.assertEqual(inst.activity[3].progress[0].text, "Eve would like to try for 5 days a week.") + self.assertEqual(inst.activity[3].progress[0].time.date, FHIRDate("2012-08-27").date) + self.assertEqual(inst.activity[3].progress[0].time.as_json(), "2012-08-27") + 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.assertEqual(inst.activity[4].detail.extension[0].url, "http://example.org/DoNotUse/General/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") + self.assertEqual(inst.activity[4].progress[0].text, "Eve walked 4 times the last week.") + self.assertEqual(inst.activity[4].progress[0].time.date, FHIRDate("2012-08-13").date) + self.assertEqual(inst.activity[4].progress[0].time.as_json(), "2012-08-13") + 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.extension[0].url, "http://example.org/DoNotUse/General/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.assertEqual(inst.activity[6].detail.extension[0].url, "http://example.org/DoNotUse/General/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") + self.assertEqual(inst.activity[6].progress[0].text, "After restarting the vinegar soaks the psoriasis is improved and Eve plans to treat the remainder with light treatments. She plans to start this week.") + self.assertEqual(inst.activity[6].progress[0].time.date, FHIRDate("2012-08-13").date) + self.assertEqual(inst.activity[6].progress[0].time.as_json(), "2012-08-13") + 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.assertEqual(inst.activity[7].detail.extension[0].url, "http://example.org/DoNotUse/General/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.assertEqual(inst.activity[8].detail.extension[0].url, "http://example.org/DoNotUse/General/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") + self.assertEqual(inst.activity[8].progress[0].text, "Will be able to esume exercise.") + self.assertEqual(inst.activity[8].progress[0].time.date, FHIRDate("2012-07-30").date) + self.assertEqual(inst.activity[8].progress[0].time.as_json(), "2012-07-30") + 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.assertEqual(inst.activity[9].detail.extension[0].url, "http://example.org/DoNotUse/General/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") + self.assertEqual(inst.contained[0].id, "p1") + self.assertEqual(inst.contained[1].id, "p2") + self.assertEqual(inst.contained[2].id, "p3") + self.assertEqual(inst.contained[3].id, "g1") + self.assertEqual(inst.contained[4].id, "g2") + self.assertEqual(inst.contained[5].id, "g3") + self.assertEqual(inst.contained[6].id, "g4") + self.assertEqual(inst.contained[7].id, "g5") + self.assertEqual(inst.id, "integrate") + self.assertEqual(inst.modified.date, FHIRDate("2012-09-10").date) + self.assertEqual(inst.modified.as_json(), "2012-09-10") + self.assertEqual(inst.note.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 testCarePlan7(self): + inst = self.instantiate_from("careplan-example-f003-pharynx.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, "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, "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.modified.date, FHIRDate("2013-06-27T09:30:10+01:00").date) + self.assertEqual(inst.modified.as_json(), "2013-06-27T09:30:10+01:00") + 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 testCarePlan8(self): + inst = self.instantiate_from("careplan-example-f001-heart.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.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].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, "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.modified.date, FHIRDate("2011-06-27T09:30:10+01:00").date) + self.assertEqual(inst.modified.as_json(), "2011-06-27T09:30:10+01:00") + 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 testCarePlan9(self): + inst = self.instantiate_from("careplan-example-pregnancy.json") + self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") + self.implCarePlan9(inst) + + js = inst.as_json() + self.assertEqual("CarePlan", js["resourceType"]) + inst2 = careplan.CarePlan(js) + self.implCarePlan9(inst2) + + def implCarePlan9(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, "1an") + self.assertEqual(inst.activity[0].detail.code.coding[0].system, "http://example.org/mySystem") + self.assertEqual(inst.activity[0].detail.code.text, "First Antenatal encounter") + self.assertEqual(inst.activity[0].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[0].detail.prohibited) + self.assertEqual(inst.activity[0].detail.scheduledTiming.repeat.boundsPeriod.end.date, FHIRDate("2013-02-28").date) + self.assertEqual(inst.activity[0].detail.scheduledTiming.repeat.boundsPeriod.end.as_json(), "2013-02-28") + self.assertEqual(inst.activity[0].detail.scheduledTiming.repeat.boundsPeriod.start.date, FHIRDate("2013-02-14").date) + self.assertEqual(inst.activity[0].detail.scheduledTiming.repeat.boundsPeriod.start.as_json(), "2013-02-14") + self.assertEqual(inst.activity[0].detail.status, "scheduled") + self.assertEqual(inst.activity[0].extension[0].url, "http://example.org/DoNotUse/careplan#andetails") + self.assertEqual(inst.activity[0].extension[0].valueUri, "http://orionhealth.com/fhir/careplan/1andetails") + 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, "an") + self.assertEqual(inst.activity[1].detail.code.coding[0].system, "http://example.org/mySystem") + self.assertEqual(inst.activity[1].detail.code.text, "Follow-up Antenatal encounter") + self.assertEqual(inst.activity[1].detail.description, "The second antenatal encounter. Discuss any issues that arose from the first antenatal encounter") + self.assertFalse(inst.activity[1].detail.prohibited) + self.assertEqual(inst.activity[1].detail.scheduledTiming.repeat.boundsPeriod.end.date, FHIRDate("2013-03-14").date) + self.assertEqual(inst.activity[1].detail.scheduledTiming.repeat.boundsPeriod.end.as_json(), "2013-03-14") + self.assertEqual(inst.activity[1].detail.scheduledTiming.repeat.boundsPeriod.start.date, FHIRDate("2013-03-01").date) + self.assertEqual(inst.activity[1].detail.scheduledTiming.repeat.boundsPeriod.start.as_json(), "2013-03-01") + self.assertEqual(inst.activity[1].detail.status, "not-started") + 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, "del") + self.assertEqual(inst.activity[2].detail.code.coding[0].system, "http://example.org/mySystem") + self.assertEqual(inst.activity[2].detail.code.text, "Delivery") + self.assertEqual(inst.activity[2].detail.description, "The delivery.") + self.assertFalse(inst.activity[2].detail.prohibited) + self.assertEqual(inst.activity[2].detail.scheduledTiming.repeat.boundsPeriod.end.date, FHIRDate("2013-09-14").date) + self.assertEqual(inst.activity[2].detail.scheduledTiming.repeat.boundsPeriod.end.as_json(), "2013-09-14") + self.assertEqual(inst.activity[2].detail.scheduledTiming.repeat.boundsPeriod.start.date, FHIRDate("2013-09-01").date) + self.assertEqual(inst.activity[2].detail.scheduledTiming.repeat.boundsPeriod.start.as_json(), "2013-09-01") + self.assertEqual(inst.activity[2].detail.status, "not-started") + self.assertEqual(inst.contained[0].id, "p1") + self.assertEqual(inst.contained[1].id, "pr1") + self.assertEqual(inst.contained[2].id, "pr2") + self.assertEqual(inst.contained[3].id, "goal") + self.assertEqual(inst.extension[0].url, "http://example.org/DoNotUse/careplan#lmp") + self.assertEqual(inst.extension[0].valueDateTime.date, FHIRDate("2013-01-01").date) + self.assertEqual(inst.extension[0].valueDateTime.as_json(), "2013-01-01") + self.assertEqual(inst.id, "preg") + self.assertEqual(inst.participant[0].role.coding[0].code, "lmc") + self.assertEqual(inst.participant[0].role.coding[0].system, "http://example.org/mysys") + self.assertEqual(inst.participant[0].role.text, "Midwife") + self.assertEqual(inst.participant[1].role.coding[0].code, "obs") + self.assertEqual(inst.participant[1].role.coding[0].system, "http://example.org/mysys") + self.assertEqual(inst.participant[1].role.text, "Obstretitian") + 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) + self.assertEqual(inst.period.start.as_json(), "2013-01-01") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "additional") + + def testCarePlan10(self): + inst = self.instantiate_from("careplan-example-f203-sepsis.json") + self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") + self.implCarePlan10(inst) + + js = inst.as_json() + self.assertEqual("CarePlan", js["resourceType"]) + inst2 = careplan.CarePlan(js) + self.implCarePlan10(inst2) + + def implCarePlan10(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, "goal") + self.assertEqual(inst.id, "f203") + self.assertEqual(inst.modified.date, FHIRDate("2013-03-11").date) + self.assertEqual(inst.modified.as_json(), "2013-03-11") + self.assertEqual(inst.participant[0].role.coding[0].code, "425268008") + self.assertEqual(inst.participant[0].role.coding[0].display, "Review of care plan") + self.assertEqual(inst.participant[0].role.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.participant[1].role.coding[0].code, "278110001") + self.assertEqual(inst.participant[1].role.coding[0].display, "Radiographic imaging") + self.assertEqual(inst.participant[1].role.coding[0].system, "http://snomed.info/sct") + 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") + diff --git a/fhirclient/models/DSTU2/claim.py b/fhirclient/models/DSTU2/claim.py new file mode 100644 index 000000000..a1ed057c6 --- /dev/null +++ b/fhirclient/models/DSTU2/claim.py @@ -0,0 +1,633 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Claim) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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. + """ + + resource_name = "Claim" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.accident = None + """ Accident Date. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.accidentType = None + """ Accident Type. + Type `Coding` (represented as `dict` in JSON). """ + + self.additionalMaterials = None + """ Additional materials, documents, etc.. + List of `Coding` items (represented as `dict` in JSON). """ + + self.condition = None + """ List of presenting Conditions. + List of `Coding` items (represented as `dict` in JSON). """ + + self.coverage = None + """ Insurance or medical plan. + List of `ClaimCoverage` items (represented as `dict` in JSON). """ + + self.created = None + """ Creation date. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.diagnosis = None + """ Diagnosis. + List of `ClaimDiagnosis` items (represented as `dict` in JSON). """ + + self.enterer = None + """ Author. + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + self.exception = None + """ Eligibility exceptions. + List of `Coding` items (represented as `dict` in JSON). """ + + self.facility = None + """ Servicing Facility. + Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + + self.fundsReserve = None + """ Funds requested to be reserved. + Type `Coding` (represented as `dict` in JSON). """ + + self.identifier = None + """ Claim number. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.interventionException = None + """ Intervention and exception code (Pharma). + List of `Coding` items (represented as `dict` in JSON). """ + + self.item = None + """ Goods and Services. + List of `ClaimItem` items (represented as `dict` in JSON). """ + + self.missingTeeth = None + """ Only if type = oral. + List of `ClaimMissingTeeth` 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. + Type `FHIRReference` referencing `MedicationOrder` (represented as `dict` in JSON). """ + + self.originalRuleset = None + """ Original specification followed. + Type `Coding` (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.payee = None + """ Payee. + Type `ClaimPayee` (represented as `dict` in JSON). """ + + self.prescription = None + """ Prescription. + Type `FHIRReference` referencing `MedicationOrder, VisionPrescription` (represented as `dict` in JSON). """ + + self.priority = None + """ Desired processing priority. + Type `Coding` (represented as `dict` in JSON). """ + + self.provider = None + """ Responsible provider. + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + self.referral = None + """ Treatment Referral. + Type `FHIRReference` referencing `ReferralRequest` (represented as `dict` in JSON). """ + + self.ruleset = None + """ Current specification followed. + Type `Coding` (represented as `dict` in JSON). """ + + self.school = None + """ Name of School. + Type `str`. """ + + self.target = None + """ Insurer. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.type = None + """ institutional | oral | pharmacy | professional | vision. + Type `str`. """ + + self.use = None + """ complete | proposed | exploratory | other. + Type `str`. """ + + super(Claim, self).__init__(jsondict) + + def elementProperties(self): + js = super(Claim, self).elementProperties() + js.extend([ + ("accident", "accident", fhirdate.FHIRDate, False, None, False), + ("accidentType", "accidentType", coding.Coding, False, None, False), + ("additionalMaterials", "additionalMaterials", coding.Coding, True, None, False), + ("condition", "condition", coding.Coding, True, None, False), + ("coverage", "coverage", ClaimCoverage, True, None, False), + ("created", "created", fhirdate.FHIRDate, False, None, False), + ("diagnosis", "diagnosis", ClaimDiagnosis, True, None, False), + ("enterer", "enterer", fhirreference.FHIRReference, False, None, False), + ("exception", "exception", coding.Coding, True, None, False), + ("facility", "facility", fhirreference.FHIRReference, False, None, False), + ("fundsReserve", "fundsReserve", coding.Coding, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("interventionException", "interventionException", coding.Coding, True, None, False), + ("item", "item", ClaimItem, True, None, False), + ("missingTeeth", "missingTeeth", ClaimMissingTeeth, True, None, False), + ("organization", "organization", fhirreference.FHIRReference, False, None, False), + ("originalPrescription", "originalPrescription", fhirreference.FHIRReference, False, None, False), + ("originalRuleset", "originalRuleset", coding.Coding, 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", coding.Coding, False, None, False), + ("provider", "provider", fhirreference.FHIRReference, False, None, False), + ("referral", "referral", fhirreference.FHIRReference, False, None, False), + ("ruleset", "ruleset", coding.Coding, False, None, False), + ("school", "school", str, False, None, False), + ("target", "target", fhirreference.FHIRReference, False, None, False), + ("type", "type", str, False, None, True), + ("use", "use", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class ClaimCoverage(backboneelement.BackboneElement): + """ Insurance or medical plan. + + Financial instrument by which payment information for health care. + """ + + resource_name = "ClaimCoverage" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.businessArrangement = None + """ Business agreement. + Type `str`. """ + + self.claimResponse = None + """ Adjudication results. + Type `FHIRReference` referencing `ClaimResponse` (represented as `dict` in JSON). """ + + self.coverage = None + """ Insurance information. + Type `FHIRReference` referencing `Coverage` (represented as `dict` in JSON). """ + + self.focal = None + """ The focal Coverage. + Type `bool`. """ + + self.originalRuleset = None + """ Original version. + Type `Coding` (represented as `dict` in JSON). """ + + self.preAuthRef = None + """ Pre-Authorization/Determination Reference. + List of `str` items. """ + + self.relationship = None + """ Patient relationship to subscriber. + Type `Coding` (represented as `dict` in JSON). """ + + self.sequence = None + """ Service instance identifier. + Type `int`. """ + + super(ClaimCoverage, self).__init__(jsondict) + + def elementProperties(self): + js = super(ClaimCoverage, self).elementProperties() + js.extend([ + ("businessArrangement", "businessArrangement", str, False, None, False), + ("claimResponse", "claimResponse", fhirreference.FHIRReference, False, None, False), + ("coverage", "coverage", fhirreference.FHIRReference, False, None, True), + ("focal", "focal", bool, False, None, True), + ("originalRuleset", "originalRuleset", coding.Coding, False, None, False), + ("preAuthRef", "preAuthRef", str, True, None, False), + ("relationship", "relationship", coding.Coding, False, None, True), + ("sequence", "sequence", int, False, None, True), + ]) + return js + + +class ClaimDiagnosis(backboneelement.BackboneElement): + """ Diagnosis. + + Ordered list of patient diagnosis for which care is sought. + """ + + resource_name = "ClaimDiagnosis" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.diagnosis = None + """ Patient's list of diagnosis. + Type `Coding` (represented as `dict` in JSON). """ + + self.sequence = None + """ Sequence of diagnosis. + Type `int`. """ + + super(ClaimDiagnosis, self).__init__(jsondict) + + def elementProperties(self): + js = super(ClaimDiagnosis, self).elementProperties() + js.extend([ + ("diagnosis", "diagnosis", coding.Coding, False, None, True), + ("sequence", "sequence", int, False, None, True), + ]) + return js + + +class ClaimItem(backboneelement.BackboneElement): + """ Goods and Services. + + First tier of goods and services. + """ + + resource_name = "ClaimItem" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.bodySite = None + """ Service Location. + Type `Coding` (represented as `dict` in JSON). """ + + self.detail = None + """ Additional items. + List of `ClaimItemDetail` items (represented as `dict` in JSON). """ + + self.diagnosisLinkId = None + """ Diagnosis Link. + List of `int` items. """ + + self.factor = None + """ Price scaling factor. + Type `float`. """ + + self.modifier = None + """ Service/Product billing modifiers. + List of `Coding` items (represented as `dict` in JSON). """ + + self.net = None + """ Total item cost. + Type `Quantity` referencing `Money` (represented as `dict` in JSON). """ + + self.points = None + """ Difficulty scaling factor. + Type `float`. """ + + self.prosthesis = None + """ Prosthetic details. + Type `ClaimItemProsthesis` (represented as `dict` in JSON). """ + + self.provider = None + """ Responsible practitioner. + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + self.quantity = None + """ Count of Products or Services. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + self.sequence = None + """ Service instance. + Type `int`. """ + + self.service = None + """ Item Code. + Type `Coding` (represented as `dict` in JSON). """ + + self.serviceDate = None + """ Date of Service. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.subSite = None + """ Service Sub-location. + List of `Coding` items (represented as `dict` in JSON). """ + + self.type = None + """ Group or type of product or service. + Type `Coding` (represented as `dict` in JSON). """ + + self.udi = None + """ Unique Device Identifier. + Type `Coding` (represented as `dict` in JSON). """ + + self.unitPrice = None + """ Fee, charge or cost per point. + Type `Quantity` referencing `Money` (represented as `dict` in JSON). """ + + super(ClaimItem, self).__init__(jsondict) + + def elementProperties(self): + js = super(ClaimItem, self).elementProperties() + js.extend([ + ("bodySite", "bodySite", coding.Coding, False, None, False), + ("detail", "detail", ClaimItemDetail, True, None, False), + ("diagnosisLinkId", "diagnosisLinkId", int, True, None, False), + ("factor", "factor", float, False, None, False), + ("modifier", "modifier", coding.Coding, True, None, False), + ("net", "net", quantity.Quantity, False, None, False), + ("points", "points", float, False, None, False), + ("prosthesis", "prosthesis", ClaimItemProsthesis, False, None, False), + ("provider", "provider", fhirreference.FHIRReference, False, None, False), + ("quantity", "quantity", quantity.Quantity, False, None, False), + ("sequence", "sequence", int, False, None, True), + ("service", "service", coding.Coding, False, None, True), + ("serviceDate", "serviceDate", fhirdate.FHIRDate, False, None, False), + ("subSite", "subSite", coding.Coding, True, None, False), + ("type", "type", coding.Coding, False, None, True), + ("udi", "udi", coding.Coding, False, None, False), + ("unitPrice", "unitPrice", quantity.Quantity, False, None, False), + ]) + return js + + +class ClaimItemDetail(backboneelement.BackboneElement): + """ Additional items. + + Second tier of goods and services. + """ + + resource_name = "ClaimItemDetail" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.factor = None + """ Price scaling factor. + Type `float`. """ + + self.net = None + """ Total additional item cost. + Type `Quantity` referencing `Money` (represented as `dict` in JSON). """ + + self.points = None + """ Difficulty scaling factor. + Type `float`. """ + + self.quantity = None + """ Count of Products or Services. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + self.sequence = None + """ Service instance. + Type `int`. """ + + self.service = None + """ Additional item codes. + Type `Coding` (represented as `dict` in JSON). """ + + self.subDetail = None + """ Additional items. + List of `ClaimItemDetailSubDetail` items (represented as `dict` in JSON). """ + + self.type = None + """ Group or type of product or service. + Type `Coding` (represented as `dict` in JSON). """ + + self.udi = None + """ Unique Device Identifier. + Type `Coding` (represented as `dict` in JSON). """ + + self.unitPrice = None + """ Fee, charge or cost per point. + Type `Quantity` referencing `Money` (represented as `dict` in JSON). """ + + super(ClaimItemDetail, self).__init__(jsondict) + + def elementProperties(self): + js = super(ClaimItemDetail, self).elementProperties() + js.extend([ + ("factor", "factor", float, False, None, False), + ("net", "net", quantity.Quantity, False, None, False), + ("points", "points", float, False, None, False), + ("quantity", "quantity", quantity.Quantity, False, None, False), + ("sequence", "sequence", int, False, None, True), + ("service", "service", coding.Coding, False, None, True), + ("subDetail", "subDetail", ClaimItemDetailSubDetail, True, None, False), + ("type", "type", coding.Coding, False, None, True), + ("udi", "udi", coding.Coding, False, None, False), + ("unitPrice", "unitPrice", quantity.Quantity, False, None, False), + ]) + return js + + +class ClaimItemDetailSubDetail(backboneelement.BackboneElement): + """ Additional items. + + Third tier of goods and services. + """ + + resource_name = "ClaimItemDetailSubDetail" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.factor = None + """ Price scaling factor. + Type `float`. """ + + self.net = None + """ Net additional item cost. + Type `Quantity` referencing `Money` (represented as `dict` in JSON). """ + + self.points = None + """ Difficulty scaling factor. + Type `float`. """ + + self.quantity = None + """ Count of Products or Services. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + self.sequence = None + """ Service instance. + Type `int`. """ + + self.service = None + """ Additional item codes. + Type `Coding` (represented as `dict` in JSON). """ + + self.type = None + """ Type of product or service. + Type `Coding` (represented as `dict` in JSON). """ + + self.udi = None + """ Unique Device Identifier. + Type `Coding` (represented as `dict` in JSON). """ + + self.unitPrice = None + """ Fee, charge or cost per point. + Type `Quantity` referencing `Money` (represented as `dict` in JSON). """ + + super(ClaimItemDetailSubDetail, self).__init__(jsondict) + + def elementProperties(self): + js = super(ClaimItemDetailSubDetail, self).elementProperties() + js.extend([ + ("factor", "factor", float, False, None, False), + ("net", "net", quantity.Quantity, False, None, False), + ("points", "points", float, False, None, False), + ("quantity", "quantity", quantity.Quantity, False, None, False), + ("sequence", "sequence", int, False, None, True), + ("service", "service", coding.Coding, False, None, True), + ("type", "type", coding.Coding, False, None, True), + ("udi", "udi", coding.Coding, False, None, False), + ("unitPrice", "unitPrice", quantity.Quantity, False, None, False), + ]) + return js + + +class ClaimItemProsthesis(backboneelement.BackboneElement): + """ Prosthetic details. + + The materials and placement date of prior fixed prosthesis. + """ + + resource_name = "ClaimItemProsthesis" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.initial = None + """ Is this the initial service. + Type `bool`. """ + + self.priorDate = None + """ Initial service Date. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.priorMaterial = None + """ Prosthetic Material. + Type `Coding` (represented as `dict` in JSON). """ + + super(ClaimItemProsthesis, self).__init__(jsondict) + + def elementProperties(self): + js = super(ClaimItemProsthesis, self).elementProperties() + js.extend([ + ("initial", "initial", bool, False, None, False), + ("priorDate", "priorDate", fhirdate.FHIRDate, False, None, False), + ("priorMaterial", "priorMaterial", coding.Coding, False, None, False), + ]) + return js + + +class ClaimMissingTeeth(backboneelement.BackboneElement): + """ Only if type = oral. + + A list of teeth which would be expected but are not found due to having + been previously extracted or for other reasons. + """ + + resource_name = "ClaimMissingTeeth" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.extractionDate = None + """ Date of Extraction. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.reason = None + """ Reason for missing. + Type `Coding` (represented as `dict` in JSON). """ + + self.tooth = None + """ Tooth Code. + Type `Coding` (represented as `dict` in JSON). """ + + super(ClaimMissingTeeth, self).__init__(jsondict) + + def elementProperties(self): + js = super(ClaimMissingTeeth, self).elementProperties() + js.extend([ + ("extractionDate", "extractionDate", fhirdate.FHIRDate, False, None, False), + ("reason", "reason", coding.Coding, False, None, False), + ("tooth", "tooth", coding.Coding, False, None, True), + ]) + return js + + +class ClaimPayee(backboneelement.BackboneElement): + """ Payee. + + The party to be reimbursed for the services. + """ + + resource_name = "ClaimPayee" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.organization = None + """ Organization who is the payee. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.person = None + """ Other person who is the payee. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.provider = None + """ Provider who is the payee. + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + self.type = None + """ Party to be paid any benefits payable. + Type `Coding` (represented as `dict` in JSON). """ + + super(ClaimPayee, self).__init__(jsondict) + + def elementProperties(self): + js = super(ClaimPayee, self).elementProperties() + js.extend([ + ("organization", "organization", fhirreference.FHIRReference, False, None, False), + ("person", "person", fhirreference.FHIRReference, False, None, False), + ("provider", "provider", fhirreference.FHIRReference, False, None, False), + ("type", "type", coding.Coding, False, None, False), + ]) + return js + + +from . import coding +from . import fhirdate +from . import fhirreference +from . import identifier +from . import quantity diff --git a/fhirclient/models/DSTU2/claim_tests.py b/fhirclient/models/DSTU2/claim_tests.py new file mode 100644 index 000000000..89813a3c9 --- /dev/null +++ b/fhirclient/models/DSTU2/claim_tests.py @@ -0,0 +1,572 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import claim +from .fhirdate import FHIRDate + + +class ClaimTests(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("Claim", js["resourceType"]) + return claim.Claim(js) + + def testClaim1(self): + inst = self.instantiate_from("claim-example-professional.json") + self.assertIsNotNone(inst, "Must have instantiated a Claim instance") + self.implClaim1(inst) + + js = inst.as_json() + self.assertEqual("Claim", js["resourceType"]) + inst2 = claim.Claim(js) + self.implClaim1(inst2) + + def implClaim1(self, inst): + self.assertTrue(inst.coverage[0].focal) + self.assertEqual(inst.coverage[0].relationship.code, "self") + self.assertEqual(inst.coverage[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].diagnosis.code, "654456") + self.assertEqual(inst.diagnosis[0].sequence, 1) + self.assertEqual(inst.id, "860150") + self.assertEqual(inst.identifier[0].system, "http://happypdocs.com/claim") + self.assertEqual(inst.identifier[0].value, "8612345") + 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, 75.0) + self.assertEqual(inst.item[0].sequence, 1) + self.assertEqual(inst.item[0].service.code, "exam") + self.assertEqual(inst.item[0].service.system, "http://hl7.org/fhir/ex-serviceproduct") + self.assertEqual(inst.item[0].serviceDate.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.item[0].serviceDate.as_json(), "2014-08-16") + self.assertEqual(inst.item[0].type.code, "service") + 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, 75.0) + self.assertEqual(inst.payee.type.code, "provider") + self.assertEqual(inst.priority.code, "normal") + self.assertEqual(inst.text.div, "
A human-readable rendering of the Claim
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type, "professional") + self.assertEqual(inst.use, "complete") + + def testClaim2(self): + inst = self.instantiate_from("claim-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Claim instance") + self.implClaim2(inst) + + js = inst.as_json() + self.assertEqual("Claim", js["resourceType"]) + inst2 = claim.Claim(js) + self.implClaim2(inst2) + + def implClaim2(self, inst): + self.assertTrue(inst.coverage[0].focal) + self.assertEqual(inst.coverage[0].relationship.code, "self") + self.assertEqual(inst.coverage[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].diagnosis.code, "123456") + self.assertEqual(inst.diagnosis[0].sequence, 1) + self.assertEqual(inst.id, "100150") + self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/claim") + self.assertEqual(inst.identifier[0].value, "12345") + 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].sequence, 1) + self.assertEqual(inst.item[0].service.code, "1200") + self.assertEqual(inst.item[0].serviceDate.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.item[0].serviceDate.as_json(), "2014-08-16") + self.assertEqual(inst.item[0].type.code, "service") + 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.payee.type.code, "provider") + self.assertEqual(inst.priority.code, "normal") + self.assertEqual(inst.text.div, "
A human-readable rendering of the Oral Health Claim
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type, "oral") + self.assertEqual(inst.use, "complete") + + def testClaim3(self): + inst = self.instantiate_from("claim-example-vision.json") + self.assertIsNotNone(inst, "Must have instantiated a Claim instance") + self.implClaim3(inst) + + js = inst.as_json() + self.assertEqual("Claim", js["resourceType"]) + inst2 = claim.Claim(js) + self.implClaim3(inst2) + + def implClaim3(self, inst): + self.assertTrue(inst.coverage[0].focal) + self.assertEqual(inst.coverage[0].relationship.code, "self") + self.assertEqual(inst.coverage[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].diagnosis.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.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, 80.0) + self.assertEqual(inst.item[0].sequence, 1) + self.assertEqual(inst.item[0].service.code, "exam") + self.assertEqual(inst.item[0].service.system, "http://hl7.org/fhir/ex-visionservice") + self.assertEqual(inst.item[0].serviceDate.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.item[0].serviceDate.as_json(), "2014-08-16") + self.assertEqual(inst.item[0].type.code, "service") + 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, 80.0) + self.assertEqual(inst.payee.type.code, "provider") + self.assertEqual(inst.priority.code, "normal") + self.assertEqual(inst.text.div, "
A human-readable rendering of the Vision Claim
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type, "vision") + self.assertEqual(inst.use, "complete") + + def testClaim4(self): + inst = self.instantiate_from("claim-example-institutional.json") + self.assertIsNotNone(inst, "Must have instantiated a Claim instance") + self.implClaim4(inst) + + js = inst.as_json() + self.assertEqual("Claim", js["resourceType"]) + inst2 = claim.Claim(js) + self.implClaim4(inst2) + + def implClaim4(self, inst): + self.assertTrue(inst.coverage[0].focal) + self.assertEqual(inst.coverage[0].relationship.code, "self") + self.assertEqual(inst.coverage[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].diagnosis.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.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].sequence, 1) + self.assertEqual(inst.item[0].service.code, "exam") + self.assertEqual(inst.item[0].service.system, "http://hl7.org/fhir/ex-serviceproduct") + self.assertEqual(inst.item[0].serviceDate.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.item[0].serviceDate.as_json(), "2014-08-16") + self.assertEqual(inst.item[0].type.code, "service") + 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.payee.type.code, "provider") + self.assertEqual(inst.priority.code, "normal") + self.assertEqual(inst.text.div, "
A human-readable rendering of the Claim
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type, "institutional") + self.assertEqual(inst.use, "complete") + + def testClaim5(self): + inst = self.instantiate_from("claim-example-oral-contained.json") + self.assertIsNotNone(inst, "Must have instantiated a Claim instance") + self.implClaim5(inst) + + js = inst.as_json() + self.assertEqual("Claim", js["resourceType"]) + inst2 = claim.Claim(js) + self.implClaim5(inst2) + + def implClaim5(self, inst): + self.assertEqual(inst.contained[0].id, "organization-1") + self.assertEqual(inst.contained[1].id, "organization-2") + self.assertEqual(inst.contained[2].id, "practitioner-1") + self.assertEqual(inst.contained[3].id, "patient-1") + self.assertEqual(inst.contained[4].id, "coverage-1") + self.assertTrue(inst.coverage[0].focal) + self.assertEqual(inst.coverage[0].relationship.code, "self") + self.assertEqual(inst.coverage[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].diagnosis.code, "123456") + 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.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].sequence, 1) + self.assertEqual(inst.item[0].service.code, "1200") + self.assertEqual(inst.item[0].serviceDate.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.item[0].serviceDate.as_json(), "2014-08-16") + self.assertEqual(inst.item[0].type.code, "service") + 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.payee.type.code, "provider") + self.assertEqual(inst.priority.code, "normal") + self.assertEqual(inst.text.div, "
A human-readable rendering of the Oral Health Claim
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type, "oral") + self.assertEqual(inst.use, "complete") + + def testClaim6(self): + inst = self.instantiate_from("claim-example-oral-orthoplan.json") + self.assertIsNotNone(inst, "Must have instantiated a Claim instance") + self.implClaim6(inst) + + js = inst.as_json() + self.assertEqual("Claim", js["resourceType"]) + inst2 = claim.Claim(js) + self.implClaim6(inst2) + + def implClaim6(self, inst): + self.assertTrue(inst.coverage[0].focal) + self.assertEqual(inst.coverage[0].relationship.code, "self") + self.assertEqual(inst.coverage[0].sequence, 1) + self.assertEqual(inst.created.date, FHIRDate("2015-03-16").date) + self.assertEqual(inst.created.as_json(), "2015-03-16") + self.assertEqual(inst.diagnosis[0].diagnosis.code, "123457") + self.assertEqual(inst.diagnosis[0].diagnosis.system, "http://hl7.org/fhir/sid/icd-10") + self.assertEqual(inst.diagnosis[0].sequence, 1) + self.assertEqual(inst.id, "100153") + self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/claim") + self.assertEqual(inst.identifier[0].value, "12355") + 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, 1000.0) + self.assertEqual(inst.item[0].detail[0].sequence, 1) + self.assertEqual(inst.item[0].detail[0].service.code, "ORTHOEXAM") + self.assertEqual(inst.item[0].detail[0].service.system, "http://hl7.org/fhir/oralservicecodes") + self.assertEqual(inst.item[0].detail[0].type.code, "CSINV") + self.assertEqual(inst.item[0].detail[0].type.system, "http://hl7.org/fhir/v3/ActCode") + 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.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.value, 1500.0) + self.assertEqual(inst.item[0].detail[1].sequence, 2) + self.assertEqual(inst.item[0].detail[1].service.code, "ORTHODIAG") + self.assertEqual(inst.item[0].detail[1].service.system, "http://hl7.org/fhir/oralservicecodes") + self.assertEqual(inst.item[0].detail[1].type.code, "CSINV") + self.assertEqual(inst.item[0].detail[1].type.system, "http://hl7.org/fhir/v3/ActCode") + 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.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.value, 500.0) + self.assertEqual(inst.item[0].detail[2].sequence, 3) + self.assertEqual(inst.item[0].detail[2].service.code, "ORTHOINITIAL") + self.assertEqual(inst.item[0].detail[2].service.system, "http://hl7.org/fhir/oralservicecodes") + self.assertEqual(inst.item[0].detail[2].type.code, "CSINV") + self.assertEqual(inst.item[0].detail[2].type.system, "http://hl7.org/fhir/v3/ActCode") + 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.value, 500.0) + 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.code, "ORTHOMONTHS") + self.assertEqual(inst.item[0].detail[3].service.system, "http://hl7.org/fhir/oralservicecodes") + self.assertEqual(inst.item[0].detail[3].type.code, "CSINV") + self.assertEqual(inst.item[0].detail[3].type.system, "http://hl7.org/fhir/v3/ActCode") + 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, 250.0) + 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.code, "ORTHOPERIODIC") + self.assertEqual(inst.item[0].detail[4].service.system, "http://hl7.org/fhir/oralservicecodes") + self.assertEqual(inst.item[0].detail[4].type.code, "CSINV") + self.assertEqual(inst.item[0].detail[4].type.system, "http://hl7.org/fhir/v3/ActCode") + 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.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].net.value, 9000.0) + self.assertEqual(inst.item[0].sequence, 1) + self.assertEqual(inst.item[0].service.code, "ORTHPLAN") + self.assertEqual(inst.item[0].service.system, "http://hl7.org/fhir/oralservicecodes") + self.assertEqual(inst.item[0].serviceDate.date, FHIRDate("2015-05-16").date) + self.assertEqual(inst.item[0].serviceDate.as_json(), "2015-05-16") + self.assertEqual(inst.item[0].type.code, "FRAMEING") + self.assertEqual(inst.item[0].type.system, "http://hl7.org/fhir/v3/ActCode") + 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, 9000.0) + self.assertEqual(inst.item[1].bodySite.code, "21") + self.assertEqual(inst.item[1].bodySite.system, "http://fdi.org/fhir/oraltoothcodes") + 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.code, "21211") + self.assertEqual(inst.item[1].service.system, "http://hl7.org/fhir/oralservicecodes") + self.assertEqual(inst.item[1].serviceDate.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.item[1].serviceDate.as_json(), "2014-08-16") + self.assertEqual(inst.item[1].subSite[0].code, "L") + self.assertEqual(inst.item[1].subSite[0].system, "http://fdi.org/fhir/oralsurfacecodes") + self.assertEqual(inst.item[1].type.code, "service") + 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.code, "36") + self.assertEqual(inst.item[2].bodySite.system, "http://fdi.org/fhir/oraltoothcodes") + 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.code, "27211") + self.assertEqual(inst.item[2].detail[0].service.system, "http://hl7.org/fhir/oralservicecodes") + self.assertEqual(inst.item[2].detail[0].type.code, "service") + 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, 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.value, 350.0) + self.assertEqual(inst.item[2].detail[1].sequence, 2) + self.assertEqual(inst.item[2].detail[1].service.code, "lab") + self.assertEqual(inst.item[2].detail[1].service.system, "http://hl7.org/fhir/oralservicecodes") + self.assertEqual(inst.item[2].detail[1].type.code, "service") + 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.code, "27211") + self.assertEqual(inst.item[2].service.system, "http://hl7.org/fhir/oralservicecodes") + self.assertEqual(inst.item[2].serviceDate.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.item[2].serviceDate.as_json(), "2014-08-16") + self.assertEqual(inst.item[2].type.code, "group") + 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.code, "provider") + self.assertEqual(inst.priority.code, "normal") + self.assertEqual(inst.text.div, "
A human-readable rendering of the Oral Health Claim
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type, "oral") + self.assertEqual(inst.use, "proposed") + + def testClaim7(self): + inst = self.instantiate_from("claim-example-oral-average.json") + self.assertIsNotNone(inst, "Must have instantiated a Claim instance") + self.implClaim7(inst) + + js = inst.as_json() + self.assertEqual("Claim", js["resourceType"]) + inst2 = claim.Claim(js) + self.implClaim7(inst2) + + def implClaim7(self, inst): + self.assertTrue(inst.coverage[0].focal) + self.assertEqual(inst.coverage[0].relationship.code, "self") + self.assertEqual(inst.coverage[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].diagnosis.code, "123456") + self.assertEqual(inst.diagnosis[0].sequence, 1) + self.assertEqual(inst.id, "100151") + self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/claim") + self.assertEqual(inst.identifier[0].value, "12346") + 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].sequence, 1) + self.assertEqual(inst.item[0].service.code, "1200") + self.assertEqual(inst.item[0].service.system, "http://hl7.org/fhir/oralservicecodes") + self.assertEqual(inst.item[0].serviceDate.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.item[0].serviceDate.as_json(), "2014-08-16") + self.assertEqual(inst.item[0].type.code, "service") + 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[1].bodySite.code, "21") + self.assertEqual(inst.item[1].bodySite.system, "http://fdi.org/fhir/oraltoothcodes") + 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.code, "21211") + self.assertEqual(inst.item[1].service.system, "http://hl7.org/fhir/oralservicecodes") + self.assertEqual(inst.item[1].serviceDate.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.item[1].serviceDate.as_json(), "2014-08-16") + self.assertEqual(inst.item[1].subSite[0].code, "L") + self.assertEqual(inst.item[1].subSite[0].system, "http://fdi.org/fhir/oralsurfacecodes") + self.assertEqual(inst.item[1].type.code, "service") + 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.code, "36") + self.assertEqual(inst.item[2].bodySite.system, "http://fdi.org/fhir/oraltoothcodes") + 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.code, "27211") + self.assertEqual(inst.item[2].detail[0].service.system, "http://hl7.org/fhir/oralservicecodes") + self.assertEqual(inst.item[2].detail[0].type.code, "service") + 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, 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.value, 350.0) + self.assertEqual(inst.item[2].detail[1].sequence, 2) + self.assertEqual(inst.item[2].detail[1].service.code, "lab") + self.assertEqual(inst.item[2].detail[1].service.system, "http://hl7.org/fhir/oralservicecodes") + self.assertEqual(inst.item[2].detail[1].type.code, "service") + 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.code, "27211") + self.assertEqual(inst.item[2].service.system, "http://hl7.org/fhir/oralservicecodes") + self.assertEqual(inst.item[2].serviceDate.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.item[2].serviceDate.as_json(), "2014-08-16") + self.assertEqual(inst.item[2].type.code, "group") + 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.code, "provider") + self.assertEqual(inst.priority.code, "normal") + self.assertEqual(inst.text.div, "
A human-readable rendering of the Oral Health Claim
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type, "oral") + self.assertEqual(inst.use, "complete") + + def testClaim8(self): + inst = self.instantiate_from("claim-example-vision-glasses.json") + self.assertIsNotNone(inst, "Must have instantiated a Claim instance") + self.implClaim8(inst) + + js = inst.as_json() + self.assertEqual("Claim", js["resourceType"]) + inst2 = claim.Claim(js) + self.implClaim8(inst2) + + def implClaim8(self, inst): + self.assertTrue(inst.coverage[0].focal) + self.assertEqual(inst.coverage[0].relationship.code, "self") + self.assertEqual(inst.coverage[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].diagnosis.code, "654321") + self.assertEqual(inst.diagnosis[0].sequence, 1) + self.assertEqual(inst.id, "660151") + self.assertEqual(inst.identifier[0].system, "http://happysight.com/claim") + self.assertEqual(inst.identifier[0].value, "6612346") + 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, 100.0) + self.assertEqual(inst.item[0].detail[0].sequence, 1) + self.assertEqual(inst.item[0].detail[0].service.code, "frame") + self.assertEqual(inst.item[0].detail[0].service.system, "http://hl7.org/fhir/ex-visionservice") + self.assertEqual(inst.item[0].detail[0].type.code, "product") + 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.value, 100.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.value, 100.0) + self.assertEqual(inst.item[0].detail[1].quantity.value, 2) + self.assertEqual(inst.item[0].detail[1].sequence, 2) + self.assertEqual(inst.item[0].detail[1].service.code, "lens") + self.assertEqual(inst.item[0].detail[1].service.system, "http://hl7.org/fhir/ex-visionservice") + self.assertEqual(inst.item[0].detail[1].type.code, "product") + 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.value, 50.0) + self.assertEqual(inst.item[0].detail[2].factor, 0.07) + 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, 14.0) + self.assertEqual(inst.item[0].detail[2].sequence, 3) + self.assertEqual(inst.item[0].detail[2].service.code, "fst") + self.assertEqual(inst.item[0].detail[2].service.system, "http://hl7.org/fhir/ex-visionservice") + self.assertEqual(inst.item[0].detail[2].type.code, "tax") + 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.value, 200.0) + 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, 214.0) + self.assertEqual(inst.item[0].sequence, 1) + self.assertEqual(inst.item[0].service.code, "glasses") + self.assertEqual(inst.item[0].service.system, "http://hl7.org/fhir/ex-visionservice") + self.assertEqual(inst.item[0].serviceDate.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.item[0].serviceDate.as_json(), "2014-08-16") + self.assertEqual(inst.item[0].type.code, "group") + 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, 214.0) + self.assertEqual(inst.payee.type.code, "provider") + self.assertEqual(inst.priority.code, "normal") + 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, "vision") + self.assertEqual(inst.use, "complete") + + def testClaim9(self): + inst = self.instantiate_from("claim-example-pharmacy.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.assertTrue(inst.coverage[0].focal) + self.assertEqual(inst.coverage[0].relationship.code, "self") + self.assertEqual(inst.coverage[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].diagnosis.code, "654456") + self.assertEqual(inst.diagnosis[0].sequence, 1) + self.assertEqual(inst.id, "760150") + self.assertEqual(inst.identifier[0].system, "http://happypharma.com/claim") + self.assertEqual(inst.identifier[0].value, "7612345") + 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, 60.0) + self.assertEqual(inst.item[0].sequence, 1) + self.assertEqual(inst.item[0].service.code, "smokecess") + self.assertEqual(inst.item[0].service.system, "http://hl7.org/fhir/ex-pharmaservice") + self.assertEqual(inst.item[0].serviceDate.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.item[0].serviceDate.as_json(), "2014-08-16") + self.assertEqual(inst.item[0].type.code, "service") + 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, 60.0) + self.assertEqual(inst.payee.type.code, "provider") + self.assertEqual(inst.priority.code, "stat") + self.assertEqual(inst.text.div, "
A human-readable rendering of the Pharmacy Claim
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type, "pharmacy") + self.assertEqual(inst.use, "complete") + diff --git a/fhirclient/models/DSTU2/claimresponse.py b/fhirclient/models/DSTU2/claimresponse.py new file mode 100644 index 000000000..ac34421fb --- /dev/null +++ b/fhirclient/models/DSTU2/claimresponse.py @@ -0,0 +1,681 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ClaimResponse) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class ClaimResponse(domainresource.DomainResource): + """ Remittance resource. + + This resource provides the adjudication details from the processing of a + Claim resource. + """ + + resource_name = "ClaimResponse" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.addItem = None + """ Insurer added line items. + List of `ClaimResponseAddItem` items (represented as `dict` in JSON). """ + + self.coverage = None + """ Insurance or medical plan. + List of `ClaimResponseCoverage` items (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 + """ Processing errors. + List of `ClaimResponseError` items (represented as `dict` in JSON). """ + + self.form = None + """ Printed Form Identifier. + Type `Coding` (represented as `dict` in JSON). """ + + self.identifier = None + """ Response number. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.item = None + """ Line items. + List of `ClaimResponseItem` items (represented as `dict` in JSON). """ + + self.note = None + """ Processing notes. + List of `ClaimResponseNote` items (represented as `dict` in JSON). """ + + self.organization = None + """ Insurer. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.originalRuleset = None + """ Original version. + Type `Coding` (represented as `dict` in JSON). """ + + self.outcome = None + """ complete | error. + Type `str`. """ + + self.payeeType = None + """ Party to be paid any benefits payable. + Type `Coding` (represented as `dict` in JSON). """ + + self.paymentAdjustment = None + """ Payment adjustment for non-Claim issues. + Type `Quantity` referencing `Money` (represented as `dict` in JSON). """ + + self.paymentAdjustmentReason = None + """ Reason for Payment adjustment. + Type `Coding` (represented as `dict` in JSON). """ + + self.paymentAmount = None + """ Payment amount. + Type `Quantity` referencing `Money` (represented as `dict` in JSON). """ + + self.paymentDate = None + """ Expected data of Payment. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.paymentRef = None + """ Payment identifier. + Type `Identifier` (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). """ + + self.reserved = None + """ Funds reserved status. + Type `Coding` (represented as `dict` in JSON). """ + + self.ruleset = None + """ Resource version. + Type `Coding` (represented as `dict` in JSON). """ + + self.totalBenefit = None + """ Total benefit payable for the Claim. + Type `Quantity` referencing `Money` (represented as `dict` in JSON). """ + + self.totalCost = None + """ Total Cost of service from the Claim. + Type `Quantity` referencing `Money` (represented as `dict` in JSON). """ + + self.unallocDeductable = None + """ Unallocated deductible. + Type `Quantity` referencing `Money` (represented as `dict` in JSON). """ + + super(ClaimResponse, self).__init__(jsondict) + + def elementProperties(self): + js = super(ClaimResponse, self).elementProperties() + js.extend([ + ("addItem", "addItem", ClaimResponseAddItem, True, None, False), + ("coverage", "coverage", ClaimResponseCoverage, True, None, False), + ("created", "created", fhirdate.FHIRDate, False, None, False), + ("disposition", "disposition", str, False, None, False), + ("error", "error", ClaimResponseError, True, None, False), + ("form", "form", coding.Coding, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("item", "item", ClaimResponseItem, True, None, False), + ("note", "note", ClaimResponseNote, True, None, False), + ("organization", "organization", fhirreference.FHIRReference, False, None, False), + ("originalRuleset", "originalRuleset", coding.Coding, False, None, False), + ("outcome", "outcome", str, False, None, False), + ("payeeType", "payeeType", coding.Coding, False, None, False), + ("paymentAdjustment", "paymentAdjustment", quantity.Quantity, False, None, False), + ("paymentAdjustmentReason", "paymentAdjustmentReason", coding.Coding, False, None, False), + ("paymentAmount", "paymentAmount", quantity.Quantity, False, None, False), + ("paymentDate", "paymentDate", fhirdate.FHIRDate, False, None, False), + ("paymentRef", "paymentRef", identifier.Identifier, False, 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), + ("ruleset", "ruleset", coding.Coding, False, None, False), + ("totalBenefit", "totalBenefit", quantity.Quantity, False, None, False), + ("totalCost", "totalCost", quantity.Quantity, False, None, False), + ("unallocDeductable", "unallocDeductable", quantity.Quantity, False, None, False), + ]) + return js + + +from . import backboneelement + +class ClaimResponseAddItem(backboneelement.BackboneElement): + """ Insurer added line items. + + The first tier service adjudications for payor added services. + """ + + resource_name = "ClaimResponseAddItem" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.adjudication = None + """ Added items adjudication. + List of `ClaimResponseAddItemAdjudication` items (represented as `dict` in JSON). """ + + self.detail = None + """ Added items details. + List of `ClaimResponseAddItemDetail` items (represented as `dict` in JSON). """ + + self.fee = None + """ Professional fee or Product charge. + Type `Quantity` referencing `Money` (represented as `dict` in JSON). """ + + self.noteNumberLinkId = None + """ List of note numbers which apply. + List of `int` items. """ + + self.sequenceLinkId = None + """ Service instances. + List of `int` items. """ + + self.service = None + """ Group, Service or Product. + Type `Coding` (represented as `dict` in JSON). """ + + super(ClaimResponseAddItem, self).__init__(jsondict) + + def elementProperties(self): + js = super(ClaimResponseAddItem, self).elementProperties() + js.extend([ + ("adjudication", "adjudication", ClaimResponseAddItemAdjudication, True, None, False), + ("detail", "detail", ClaimResponseAddItemDetail, True, None, False), + ("fee", "fee", quantity.Quantity, False, None, False), + ("noteNumberLinkId", "noteNumberLinkId", int, True, None, False), + ("sequenceLinkId", "sequenceLinkId", int, True, None, False), + ("service", "service", coding.Coding, False, None, True), + ]) + return js + + +class ClaimResponseAddItemAdjudication(backboneelement.BackboneElement): + """ Added items adjudication. + + The adjudications results. + """ + + resource_name = "ClaimResponseAddItemAdjudication" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.amount = None + """ Monetary amount. + Type `Quantity` referencing `Money` (represented as `dict` in JSON). """ + + self.code = None + """ Adjudication category such as co-pay, eligible, benefit, etc.. + Type `Coding` (represented as `dict` in JSON). """ + + self.value = None + """ Non-monetary value. + Type `float`. """ + + super(ClaimResponseAddItemAdjudication, self).__init__(jsondict) + + def elementProperties(self): + js = super(ClaimResponseAddItemAdjudication, self).elementProperties() + js.extend([ + ("amount", "amount", quantity.Quantity, False, None, False), + ("code", "code", coding.Coding, False, None, True), + ("value", "value", float, False, None, False), + ]) + return js + + +class ClaimResponseAddItemDetail(backboneelement.BackboneElement): + """ Added items details. + + The second tier service adjudications for payor added services. + """ + + resource_name = "ClaimResponseAddItemDetail" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.adjudication = None + """ Added items detail adjudication. + List of `ClaimResponseAddItemDetailAdjudication` items (represented as `dict` in JSON). """ + + self.fee = None + """ Professional fee or Product charge. + Type `Quantity` referencing `Money` (represented as `dict` in JSON). """ + + self.service = None + """ Service or Product. + Type `Coding` (represented as `dict` in JSON). """ + + super(ClaimResponseAddItemDetail, self).__init__(jsondict) + + def elementProperties(self): + js = super(ClaimResponseAddItemDetail, self).elementProperties() + js.extend([ + ("adjudication", "adjudication", ClaimResponseAddItemDetailAdjudication, True, None, False), + ("fee", "fee", quantity.Quantity, False, None, False), + ("service", "service", coding.Coding, False, None, True), + ]) + return js + + +class ClaimResponseAddItemDetailAdjudication(backboneelement.BackboneElement): + """ Added items detail adjudication. + + The adjudications results. + """ + + resource_name = "ClaimResponseAddItemDetailAdjudication" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.amount = None + """ Monetary amount. + Type `Quantity` referencing `Money` (represented as `dict` in JSON). """ + + self.code = None + """ Adjudication category such as co-pay, eligible, benefit, etc.. + Type `Coding` (represented as `dict` in JSON). """ + + self.value = None + """ Non-monetary value. + Type `float`. """ + + super(ClaimResponseAddItemDetailAdjudication, self).__init__(jsondict) + + def elementProperties(self): + js = super(ClaimResponseAddItemDetailAdjudication, self).elementProperties() + js.extend([ + ("amount", "amount", quantity.Quantity, False, None, False), + ("code", "code", coding.Coding, False, None, True), + ("value", "value", float, False, None, False), + ]) + return js + + +class ClaimResponseCoverage(backboneelement.BackboneElement): + """ Insurance or medical plan. + + Financial instrument by which payment information for health care. + """ + + resource_name = "ClaimResponseCoverage" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.businessArrangement = None + """ Business agreement. + Type `str`. """ + + self.claimResponse = None + """ Adjudication results. + Type `FHIRReference` referencing `ClaimResponse` (represented as `dict` in JSON). """ + + self.coverage = None + """ Insurance information. + Type `FHIRReference` referencing `Coverage` (represented as `dict` in JSON). """ + + self.focal = None + """ Is the focal Coverage. + Type `bool`. """ + + self.originalRuleset = None + """ Original version. + Type `Coding` (represented as `dict` in JSON). """ + + self.preAuthRef = None + """ Pre-Authorization/Determination Reference. + List of `str` items. """ + + self.relationship = None + """ Patient relationship to subscriber. + Type `Coding` (represented as `dict` in JSON). """ + + self.sequence = None + """ Service instance identifier. + Type `int`. """ + + super(ClaimResponseCoverage, self).__init__(jsondict) + + def elementProperties(self): + js = super(ClaimResponseCoverage, self).elementProperties() + js.extend([ + ("businessArrangement", "businessArrangement", str, False, None, False), + ("claimResponse", "claimResponse", fhirreference.FHIRReference, False, None, False), + ("coverage", "coverage", fhirreference.FHIRReference, False, None, True), + ("focal", "focal", bool, False, None, True), + ("originalRuleset", "originalRuleset", coding.Coding, False, None, False), + ("preAuthRef", "preAuthRef", str, True, None, False), + ("relationship", "relationship", coding.Coding, False, None, True), + ("sequence", "sequence", int, False, None, True), + ]) + return js + + +class ClaimResponseError(backboneelement.BackboneElement): + """ Processing errors. + + Mutually exclusive with Services Provided (Item). + """ + + resource_name = "ClaimResponseError" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.code = None + """ Error code detailing processing issues. + Type `Coding` (represented as `dict` in JSON). """ + + self.detailSequenceLinkId = None + """ Detail sequence number. + Type `int`. """ + + self.sequenceLinkId = None + """ Item sequence number. + Type `int`. """ + + self.subdetailSequenceLinkId = None + """ Subdetail sequence number. + Type `int`. """ + + super(ClaimResponseError, self).__init__(jsondict) + + def elementProperties(self): + js = super(ClaimResponseError, self).elementProperties() + js.extend([ + ("code", "code", coding.Coding, False, None, True), + ("detailSequenceLinkId", "detailSequenceLinkId", int, False, None, False), + ("sequenceLinkId", "sequenceLinkId", int, False, None, False), + ("subdetailSequenceLinkId", "subdetailSequenceLinkId", int, False, None, False), + ]) + return js + + +class ClaimResponseItem(backboneelement.BackboneElement): + """ Line items. + + The first tier service adjudications for submitted services. + """ + + resource_name = "ClaimResponseItem" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.adjudication = None + """ Adjudication details. + List of `ClaimResponseItemAdjudication` items (represented as `dict` in JSON). """ + + self.detail = None + """ Detail line items. + List of `ClaimResponseItemDetail` items (represented as `dict` in JSON). """ + + self.noteNumber = None + """ List of note numbers which apply. + List of `int` items. """ + + self.sequenceLinkId = None + """ Service instance. + Type `int`. """ + + super(ClaimResponseItem, self).__init__(jsondict) + + def elementProperties(self): + js = super(ClaimResponseItem, self).elementProperties() + js.extend([ + ("adjudication", "adjudication", ClaimResponseItemAdjudication, True, None, False), + ("detail", "detail", ClaimResponseItemDetail, True, None, False), + ("noteNumber", "noteNumber", int, True, None, False), + ("sequenceLinkId", "sequenceLinkId", int, False, None, True), + ]) + return js + + +class ClaimResponseItemAdjudication(backboneelement.BackboneElement): + """ Adjudication details. + + The adjudications results. + """ + + resource_name = "ClaimResponseItemAdjudication" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.amount = None + """ Monetary amount. + Type `Quantity` referencing `Money` (represented as `dict` in JSON). """ + + self.code = None + """ Adjudication category such as co-pay, eligible, benefit, etc.. + Type `Coding` (represented as `dict` in JSON). """ + + self.value = None + """ Non-monetary value. + Type `float`. """ + + super(ClaimResponseItemAdjudication, self).__init__(jsondict) + + def elementProperties(self): + js = super(ClaimResponseItemAdjudication, self).elementProperties() + js.extend([ + ("amount", "amount", quantity.Quantity, False, None, False), + ("code", "code", coding.Coding, False, None, True), + ("value", "value", float, False, None, False), + ]) + return js + + +class ClaimResponseItemDetail(backboneelement.BackboneElement): + """ Detail line items. + + The second tier service adjudications for submitted services. + """ + + resource_name = "ClaimResponseItemDetail" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.adjudication = None + """ Detail adjudication. + List of `ClaimResponseItemDetailAdjudication` items (represented as `dict` in JSON). """ + + self.sequenceLinkId = None + """ Service instance. + Type `int`. """ + + self.subDetail = None + """ Subdetail line items. + List of `ClaimResponseItemDetailSubDetail` items (represented as `dict` in JSON). """ + + super(ClaimResponseItemDetail, self).__init__(jsondict) + + def elementProperties(self): + js = super(ClaimResponseItemDetail, self).elementProperties() + js.extend([ + ("adjudication", "adjudication", ClaimResponseItemDetailAdjudication, True, None, False), + ("sequenceLinkId", "sequenceLinkId", int, False, None, True), + ("subDetail", "subDetail", ClaimResponseItemDetailSubDetail, True, None, False), + ]) + return js + + +class ClaimResponseItemDetailAdjudication(backboneelement.BackboneElement): + """ Detail adjudication. + + The adjudications results. + """ + + resource_name = "ClaimResponseItemDetailAdjudication" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.amount = None + """ Monetary amount. + Type `Quantity` referencing `Money` (represented as `dict` in JSON). """ + + self.code = None + """ Adjudication category such as co-pay, eligible, benefit, etc.. + Type `Coding` (represented as `dict` in JSON). """ + + self.value = None + """ Non-monetary value. + Type `float`. """ + + super(ClaimResponseItemDetailAdjudication, self).__init__(jsondict) + + def elementProperties(self): + js = super(ClaimResponseItemDetailAdjudication, self).elementProperties() + js.extend([ + ("amount", "amount", quantity.Quantity, False, None, False), + ("code", "code", coding.Coding, False, None, True), + ("value", "value", float, False, None, False), + ]) + return js + + +class ClaimResponseItemDetailSubDetail(backboneelement.BackboneElement): + """ Subdetail line items. + + The third tier service adjudications for submitted services. + """ + + resource_name = "ClaimResponseItemDetailSubDetail" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.adjudication = None + """ Subdetail adjudication. + List of `ClaimResponseItemDetailSubDetailAdjudication` items (represented as `dict` in JSON). """ + + self.sequenceLinkId = None + """ Service instance. + Type `int`. """ + + super(ClaimResponseItemDetailSubDetail, self).__init__(jsondict) + + def elementProperties(self): + js = super(ClaimResponseItemDetailSubDetail, self).elementProperties() + js.extend([ + ("adjudication", "adjudication", ClaimResponseItemDetailSubDetailAdjudication, True, None, False), + ("sequenceLinkId", "sequenceLinkId", int, False, None, True), + ]) + return js + + +class ClaimResponseItemDetailSubDetailAdjudication(backboneelement.BackboneElement): + """ Subdetail adjudication. + + The adjudications results. + """ + + resource_name = "ClaimResponseItemDetailSubDetailAdjudication" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.amount = None + """ Monetary amount. + Type `Quantity` referencing `Money` (represented as `dict` in JSON). """ + + self.code = None + """ Adjudication category such as co-pay, eligible, benefit, etc.. + Type `Coding` (represented as `dict` in JSON). """ + + self.value = None + """ Non-monetary value. + Type `float`. """ + + super(ClaimResponseItemDetailSubDetailAdjudication, self).__init__(jsondict) + + def elementProperties(self): + js = super(ClaimResponseItemDetailSubDetailAdjudication, self).elementProperties() + js.extend([ + ("amount", "amount", quantity.Quantity, False, None, False), + ("code", "code", coding.Coding, False, None, True), + ("value", "value", float, False, None, False), + ]) + return js + + +class ClaimResponseNote(backboneelement.BackboneElement): + """ Processing notes. + + Note text. + """ + + resource_name = "ClaimResponseNote" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.number = None + """ Note Number for this note. + Type `int`. """ + + self.text = None + """ Note explanatory text. + Type `str`. """ + + self.type = None + """ display | print | printoper. + Type `Coding` (represented as `dict` in JSON). """ + + super(ClaimResponseNote, self).__init__(jsondict) + + def elementProperties(self): + js = super(ClaimResponseNote, self).elementProperties() + js.extend([ + ("number", "number", int, False, None, False), + ("text", "text", str, False, None, False), + ("type", "type", coding.Coding, False, None, False), + ]) + return js + + +from . import coding +from . import fhirdate +from . import fhirreference +from . import identifier +from . import quantity diff --git a/fhirclient/models/DSTU2/claimresponse_tests.py b/fhirclient/models/DSTU2/claimresponse_tests.py new file mode 100644 index 000000000..c096e4381 --- /dev/null +++ b/fhirclient/models/DSTU2/claimresponse_tests.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import claimresponse +from .fhirdate import FHIRDate + + +class ClaimResponseTests(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("ClaimResponse", js["resourceType"]) + return claimresponse.ClaimResponse(js) + + def testClaimResponse1(self): + inst = self.instantiate_from("claimresponse-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ClaimResponse instance") + self.implClaimResponse1(inst) + + js = inst.as_json() + self.assertEqual("ClaimResponse", js["resourceType"]) + inst2 = claimresponse.ClaimResponse(js) + self.implClaimResponse1(inst2) + + def implClaimResponse1(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.value, 135.57) + self.assertEqual(inst.item[0].adjudication[0].code.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.value, 10.0) + self.assertEqual(inst.item[0].adjudication[1].code.code, "copay") + self.assertEqual(inst.item[0].adjudication[2].code.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].code.code, "benefit") + self.assertEqual(inst.item[0].sequenceLinkId, 1) + self.assertEqual(inst.outcome, "complete") + self.assertEqual(inst.payeeType.code, "provider") + self.assertEqual(inst.payeeType.system, "http://hl7.org/fhir/payeetype") + self.assertEqual(inst.paymentAmount.code, "USD") + self.assertEqual(inst.paymentAmount.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.paymentAmount.value, 100.47) + self.assertEqual(inst.paymentDate.date, FHIRDate("2014-08-31").date) + self.assertEqual(inst.paymentDate.as_json(), "2014-08-31") + self.assertEqual(inst.paymentRef.system, "http://www.BenefitsInc.com/fhir/paymentRef") + self.assertEqual(inst.paymentRef.value, "201408-2-1569478") + 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) + diff --git a/fhirclient/models/DSTU2/clinicalimpression.py b/fhirclient/models/DSTU2/clinicalimpression.py new file mode 100644 index 000000000..990d02e4d --- /dev/null +++ b/fhirclient/models/DSTU2/clinicalimpression.py @@ -0,0 +1,228 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ClinicalImpression) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class ClinicalImpression(domainresource.DomainResource): + """ A clinical assessment performed when planning treatments and management + strategies for a patient. + + A record of a clinical assessment performed to determine what problem(s) + may affect the patient and before planning the treatments or management + strategies that are best to manage a patient's condition. Assessments are + often 1:1 with a clinical consultation / encounter, but this varies + greatly depending on the clinical workflow. This resource is called + "ClinicalImpression" rather than "ClinicalAssessment" to avoid confusion + with the recording of assessment tools such as Apgar score. + """ + + resource_name = "ClinicalImpression" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.action = None + """ Actions taken during assessment. + List of `FHIRReference` items referencing `ReferralRequest, ProcedureRequest, Procedure, MedicationOrder, DiagnosticOrder, NutritionOrder, SupplyRequest, Appointment` (represented as `dict` in JSON). """ + + self.assessor = None + """ The clinician performing the assessment. + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + self.date = None + """ When the assessment occurred. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Why/how the assessment was performed. + Type `str`. """ + + self.finding = None + """ Possible or likely findings and diagnoses. + List of `ClinicalImpressionFinding` items (represented as `dict` in JSON). """ + + self.investigations = None + """ One or more sets of investigations (signs, symptions, etc.). + List of `ClinicalImpressionInvestigations` items (represented as `dict` in JSON). """ + + self.patient = None + """ The patient being assessed. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.plan = None + """ Plan of action after assessment. + List of `FHIRReference` items referencing `CarePlan, Appointment, CommunicationRequest, DeviceUseRequest, DiagnosticOrder, MedicationOrder, NutritionOrder, Order, ProcedureRequest, ProcessRequest, ReferralRequest, SupplyRequest, VisionPrescription` (represented as `dict` in JSON). """ + + self.previous = None + """ Reference to last assessment. + Type `FHIRReference` referencing `ClinicalImpression` (represented as `dict` in JSON). """ + + self.problem = None + """ General assessment of patient state. + List of `FHIRReference` items referencing `Condition, AllergyIntolerance` (represented as `dict` in JSON). """ + + self.prognosis = None + """ Estimate of likely outcome. + Type `str`. """ + + self.protocol = None + """ Clinical Protocol followed. + Type `str`. """ + + self.resolved = None + """ Diagnoses/conditions resolved since previous assessment. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.ruledOut = None + """ Diagnosis considered not possible. + List of `ClinicalImpressionRuledOut` items (represented as `dict` in JSON). """ + + self.status = None + """ in-progress | completed | entered-in-error. + Type `str`. """ + + self.summary = None + """ Summary of the assessment. + Type `str`. """ + + self.triggerCodeableConcept = None + """ Request or event that necessitated this assessment. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.triggerReference = None + """ Request or event that necessitated this assessment. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + super(ClinicalImpression, self).__init__(jsondict) + + def elementProperties(self): + js = super(ClinicalImpression, self).elementProperties() + js.extend([ + ("action", "action", fhirreference.FHIRReference, True, None, False), + ("assessor", "assessor", fhirreference.FHIRReference, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("description", "description", str, False, None, False), + ("finding", "finding", ClinicalImpressionFinding, True, None, False), + ("investigations", "investigations", ClinicalImpressionInvestigations, True, None, False), + ("patient", "patient", fhirreference.FHIRReference, False, None, True), + ("plan", "plan", fhirreference.FHIRReference, True, None, False), + ("previous", "previous", fhirreference.FHIRReference, False, None, False), + ("problem", "problem", fhirreference.FHIRReference, True, None, False), + ("prognosis", "prognosis", str, False, None, False), + ("protocol", "protocol", str, False, None, False), + ("resolved", "resolved", codeableconcept.CodeableConcept, True, None, False), + ("ruledOut", "ruledOut", ClinicalImpressionRuledOut, True, None, False), + ("status", "status", str, False, None, True), + ("summary", "summary", str, False, None, False), + ("triggerCodeableConcept", "triggerCodeableConcept", codeableconcept.CodeableConcept, False, "trigger", False), + ("triggerReference", "triggerReference", fhirreference.FHIRReference, False, "trigger", False), + ]) + return js + + +from . import backboneelement + +class ClinicalImpressionFinding(backboneelement.BackboneElement): + """ Possible or likely findings and diagnoses. + + Specific findings or diagnoses that was considered likely or relevant to + ongoing treatment. + """ + + resource_name = "ClinicalImpressionFinding" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.cause = None + """ Which investigations support finding. + Type `str`. """ + + self.item = None + """ Specific text or code for finding. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ClinicalImpressionFinding, self).__init__(jsondict) + + def elementProperties(self): + js = super(ClinicalImpressionFinding, self).elementProperties() + js.extend([ + ("cause", "cause", str, False, None, False), + ("item", "item", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +class ClinicalImpressionInvestigations(backboneelement.BackboneElement): + """ One or more sets of investigations (signs, symptions, etc.). + + One or more sets of investigations (signs, symptions, etc.). The actual + grouping of investigations vary 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. + """ + + resource_name = "ClinicalImpressionInvestigations" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.code = None + """ A name/code for the set. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.item = None + """ Record of a specific investigation. + List of `FHIRReference` items referencing `Observation, QuestionnaireResponse, FamilyMemberHistory, DiagnosticReport` (represented as `dict` in JSON). """ + + super(ClinicalImpressionInvestigations, self).__init__(jsondict) + + def elementProperties(self): + js = super(ClinicalImpressionInvestigations, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("item", "item", fhirreference.FHIRReference, True, None, False), + ]) + return js + + +class ClinicalImpressionRuledOut(backboneelement.BackboneElement): + """ Diagnosis considered not possible. + """ + + resource_name = "ClinicalImpressionRuledOut" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.item = None + """ Specific text of code for diagnosis. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.reason = None + """ Grounds for elimination. + Type `str`. """ + + super(ClinicalImpressionRuledOut, self).__init__(jsondict) + + def elementProperties(self): + js = super(ClinicalImpressionRuledOut, self).elementProperties() + js.extend([ + ("item", "item", codeableconcept.CodeableConcept, False, None, True), + ("reason", "reason", str, False, None, False), + ]) + return js + + +from . import codeableconcept +from . import fhirdate +from . import fhirreference diff --git a/fhirclient/models/DSTU2/clinicalimpression_tests.py b/fhirclient/models/DSTU2/clinicalimpression_tests.py new file mode 100644 index 000000000..e0b263993 --- /dev/null +++ b/fhirclient/models/DSTU2/clinicalimpression_tests.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import clinicalimpression +from .fhirdate import FHIRDate + + +class ClinicalImpressionTests(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("ClinicalImpression", js["resourceType"]) + return clinicalimpression.ClinicalImpression(js) + + def testClinicalImpression1(self): + inst = self.instantiate_from("clinicalimpression-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ClinicalImpression instance") + self.implClinicalImpression1(inst) + + js = inst.as_json() + self.assertEqual("ClinicalImpression", js["resourceType"]) + inst2 = clinicalimpression.ClinicalImpression(js) + self.implClinicalImpression1(inst2) + + def implClinicalImpression1(self, inst): + self.assertEqual(inst.date.date, FHIRDate("2014-12-06T22:33:00+11:00").date) + self.assertEqual(inst.date.as_json(), "2014-12-06T22:33:00+11:00") + self.assertEqual(inst.description, "This 26 yo male patient is brought into ER by ambulance after being involved in a motor vehicle accident") + self.assertEqual(inst.finding[0].item.coding[0].code, "850.0") + self.assertEqual(inst.finding[0].item.coding[0].system, "http://hl7.org/fhir/sid/icd-9") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.investigations[0].code.text, "Initial Examination") + 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/DSTU2/codeableconcept.py b/fhirclient/models/DSTU2/codeableconcept.py new file mode 100644 index 000000000..00d979ed0 --- /dev/null +++ b/fhirclient/models/DSTU2/codeableconcept.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/CodeableConcept) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class CodeableConcept(element.Element): + """ Concept - reference to a terminology or just text. + + A concept that may be defined by a formal reference to a terminology or + ontology or may be provided by text. + """ + + resource_name = "CodeableConcept" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.coding = None + """ Code defined by a terminology system. + List of `Coding` items (represented as `dict` in JSON). """ + + self.text = None + """ Plain text representation of the concept. + Type `str`. """ + + super(CodeableConcept, self).__init__(jsondict) + + def elementProperties(self): + js = super(CodeableConcept, self).elementProperties() + js.extend([ + ("coding", "coding", coding.Coding, True, None, False), + ("text", "text", str, False, None, False), + ]) + return js + + +from . import coding diff --git a/fhirclient/models/DSTU2/coding.py b/fhirclient/models/DSTU2/coding.py new file mode 100644 index 000000000..8cc68c55f --- /dev/null +++ b/fhirclient/models/DSTU2/coding.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Coding) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Coding(element.Element): + """ A reference to a code defined by a terminology system. + """ + + resource_name = "Coding" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.code = None + """ Symbol in syntax defined by the system. + Type `str`. """ + + self.display = None + """ Representation defined by the system. + Type `str`. """ + + self.system = None + """ Identity of the terminology system. + Type `str`. """ + + self.userSelected = None + """ If this coding was chosen directly by the user. + Type `bool`. """ + + self.version = None + """ Version of the system - if relevant. + Type `str`. """ + + super(Coding, self).__init__(jsondict) + + def elementProperties(self): + js = super(Coding, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, False), + ("display", "display", str, False, None, False), + ("system", "system", str, False, None, False), + ("userSelected", "userSelected", bool, False, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + diff --git a/fhirclient/models/DSTU2/communication.py b/fhirclient/models/DSTU2/communication.py new file mode 100644 index 000000000..ba415a7f8 --- /dev/null +++ b/fhirclient/models/DSTU2/communication.py @@ -0,0 +1,140 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Communication) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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 + reportable condition. + """ + + resource_name = "Communication" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.category = None + """ Message category. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.encounter = None + """ Encounter leading to message. + Type `FHIRReference` referencing `Encounter` (represented as `dict` in JSON). """ + + self.identifier = None + """ Unique identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.medium = None + """ A channel of communication. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.payload = None + """ Message payload. + List of `CommunicationPayload` items (represented as `dict` in JSON). """ + + self.reason = None + """ Indication for message. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.received = None + """ When received. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.recipient = None + """ Message recipient. + List of `FHIRReference` items referencing `Device, Organization, Patient, Practitioner, RelatedPerson, Group` (represented as `dict` in JSON). """ + + self.requestDetail = None + """ CommunicationRequest producing this message. + Type `FHIRReference` referencing `CommunicationRequest` (represented as `dict` in JSON). """ + + self.sender = None + """ Message sender. + Type `FHIRReference` referencing `Device, Organization, Patient, Practitioner, RelatedPerson` (represented as `dict` in JSON). """ + + self.sent = None + """ When sent. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.status = None + """ in-progress | completed | suspended | rejected | failed. + Type `str`. """ + + self.subject = None + """ Focus of message. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + super(Communication, self).__init__(jsondict) + + def elementProperties(self): + js = super(Communication, self).elementProperties() + js.extend([ + ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("medium", "medium", codeableconcept.CodeableConcept, True, None, False), + ("payload", "payload", CommunicationPayload, True, None, False), + ("reason", "reason", codeableconcept.CodeableConcept, True, None, False), + ("received", "received", fhirdate.FHIRDate, False, None, False), + ("recipient", "recipient", fhirreference.FHIRReference, True, None, False), + ("requestDetail", "requestDetail", fhirreference.FHIRReference, False, None, False), + ("sender", "sender", fhirreference.FHIRReference, False, None, False), + ("sent", "sent", fhirdate.FHIRDate, False, None, False), + ("status", "status", str, False, None, False), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +from . import backboneelement + +class CommunicationPayload(backboneelement.BackboneElement): + """ Message payload. + + Text, attachment(s), or resource(s) that was communicated to the recipient. + """ + + resource_name = "CommunicationPayload" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.contentAttachment = None + """ Message part content. + Type `Attachment` (represented as `dict` in JSON). """ + + self.contentReference = None + """ Message part content. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.contentString = None + """ Message part content. + Type `str`. """ + + super(CommunicationPayload, self).__init__(jsondict) + + def elementProperties(self): + js = super(CommunicationPayload, self).elementProperties() + js.extend([ + ("contentAttachment", "contentAttachment", attachment.Attachment, False, "content", True), + ("contentReference", "contentReference", fhirreference.FHIRReference, False, "content", True), + ("contentString", "contentString", str, False, "content", True), + ]) + return js + + +from . import attachment +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier diff --git a/fhirclient/models/DSTU2/communication_tests.py b/fhirclient/models/DSTU2/communication_tests.py new file mode 100644 index 000000000..db5a5f0d2 --- /dev/null +++ b/fhirclient/models/DSTU2/communication_tests.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import communication +from .fhirdate import FHIRDate + + +class CommunicationTests(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("Communication", js["resourceType"]) + return communication.Communication(js) + + def testCommunication1(self): + inst = self.instantiate_from("communication-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Communication instance") + self.implCommunication1(inst) + + js = inst.as_json() + self.assertEqual("Communication", js["resourceType"]) + inst2 = communication.Communication(js) + self.implCommunication1(inst2) + + def implCommunication1(self, inst): + self.assertEqual(inst.category.coding[0].code, "Alert") + self.assertEqual(inst.category.coding[0].system, "http://acme.org/messagetypes") + self.assertEqual(inst.category.text, "Alert") + self.assertEqual(inst.id, "example") + 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.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.sent.date, FHIRDate("2014-12-12T18:01:10-08:00").date) + self.assertEqual(inst.sent.as_json(), "2014-12-12T18:01:10-08:00") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.div, "
Patient has very high serum potassium
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/communicationrequest.py b/fhirclient/models/DSTU2/communicationrequest.py new file mode 100644 index 000000000..4cf08d887 --- /dev/null +++ b/fhirclient/models/DSTU2/communicationrequest.py @@ -0,0 +1,152 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/CommunicationRequest) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class CommunicationRequest(domainresource.DomainResource): + """ A request for information to be sent to a receiver. + + A request to convey information; e.g. the CDS system proposes that an alert + be sent to a responsible provider, the CDS system proposes that the public + health agency be notified about a reportable condition. + """ + + resource_name = "CommunicationRequest" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.category = None + """ Message category. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.encounter = None + """ Encounter leading to message. + Type `FHIRReference` referencing `Encounter` (represented as `dict` in JSON). """ + + self.identifier = None + """ Unique identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.medium = None + """ A channel of communication. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.payload = None + """ Message payload. + List of `CommunicationRequestPayload` items (represented as `dict` in JSON). """ + + self.priority = None + """ Message urgency. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.reason = None + """ Indication for message. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.recipient = None + """ Message recipient. + List of `FHIRReference` items referencing `Device, Organization, Patient, Practitioner, RelatedPerson` (represented as `dict` in JSON). """ + + self.requestedOn = None + """ When ordered or proposed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.requester = None + """ An individual who requested a communication. + Type `FHIRReference` referencing `Practitioner, Patient, RelatedPerson` (represented as `dict` in JSON). """ + + self.scheduledDateTime = None + """ When scheduled. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.scheduledPeriod = None + """ When scheduled. + Type `Period` (represented as `dict` in JSON). """ + + self.sender = None + """ Message sender. + Type `FHIRReference` referencing `Device, Organization, Patient, Practitioner, RelatedPerson` (represented as `dict` in JSON). """ + + self.status = None + """ proposed | planned | requested | received | accepted | in-progress + | completed | suspended | rejected | failed. + Type `str`. """ + + self.subject = None + """ Focus of message. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + super(CommunicationRequest, self).__init__(jsondict) + + def elementProperties(self): + js = super(CommunicationRequest, self).elementProperties() + js.extend([ + ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("medium", "medium", codeableconcept.CodeableConcept, True, None, False), + ("payload", "payload", CommunicationRequestPayload, True, None, False), + ("priority", "priority", codeableconcept.CodeableConcept, False, None, False), + ("reason", "reason", codeableconcept.CodeableConcept, True, None, False), + ("recipient", "recipient", fhirreference.FHIRReference, True, None, False), + ("requestedOn", "requestedOn", fhirdate.FHIRDate, False, None, False), + ("requester", "requester", fhirreference.FHIRReference, False, None, False), + ("scheduledDateTime", "scheduledDateTime", fhirdate.FHIRDate, False, "scheduled", False), + ("scheduledPeriod", "scheduledPeriod", period.Period, False, "scheduled", False), + ("sender", "sender", fhirreference.FHIRReference, False, None, False), + ("status", "status", str, False, None, False), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +from . import backboneelement + +class CommunicationRequestPayload(backboneelement.BackboneElement): + """ Message payload. + + Text, attachment(s), or resource(s) to be communicated to the recipient. + """ + + resource_name = "CommunicationRequestPayload" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.contentAttachment = None + """ Message part content. + Type `Attachment` (represented as `dict` in JSON). """ + + self.contentReference = None + """ Message part content. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.contentString = None + """ Message part content. + Type `str`. """ + + super(CommunicationRequestPayload, self).__init__(jsondict) + + def elementProperties(self): + js = super(CommunicationRequestPayload, self).elementProperties() + js.extend([ + ("contentAttachment", "contentAttachment", attachment.Attachment, False, "content", True), + ("contentReference", "contentReference", fhirreference.FHIRReference, False, "content", True), + ("contentString", "contentString", str, False, "content", True), + ]) + return js + + +from . import attachment +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier +from . import period diff --git a/fhirclient/models/DSTU2/communicationrequest_tests.py b/fhirclient/models/DSTU2/communicationrequest_tests.py new file mode 100644 index 000000000..bf924649c --- /dev/null +++ b/fhirclient/models/DSTU2/communicationrequest_tests.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import communicationrequest +from .fhirdate import FHIRDate + + +class CommunicationRequestTests(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("CommunicationRequest", js["resourceType"]) + return communicationrequest.CommunicationRequest(js) + + def testCommunicationRequest1(self): + inst = self.instantiate_from("communicationrequest-example.json") + self.assertIsNotNone(inst, "Must have instantiated a CommunicationRequest instance") + self.implCommunicationRequest1(inst) + + js = inst.as_json() + self.assertEqual("CommunicationRequest", js["resourceType"]) + inst2 = communicationrequest.CommunicationRequest(js) + self.implCommunicationRequest1(inst2) + + def implCommunicationRequest1(self, inst): + self.assertEqual(inst.id, "example") + self.assertEqual(inst.text.div, "
To be filled out at a later time
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/composition.py b/fhirclient/models/DSTU2/composition.py new file mode 100644 index 000000000..968bff94c --- /dev/null +++ b/fhirclient/models/DSTU2/composition.py @@ -0,0 +1,249 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Composition) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Composition(domainresource.DomainResource): + """ A set of resources composed into a single coherent clinical statement with + clinical attestation. + + A set of healthcare-related information that is assembled together into a + single logical document 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. + """ + + resource_name = "Composition" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.attester = None + """ Attests to accuracy of composition. + List of `CompositionAttester` items (represented as `dict` in JSON). """ + + self.author = None + """ Who and/or what authored the composition. + List of `FHIRReference` items referencing `Practitioner, Device, Patient, RelatedPerson` (represented as `dict` in JSON). """ + + self.class_fhir = None + """ Categorization of Composition. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.confidentiality = None + """ As defined by affinity domain. + Type `str`. """ + + self.custodian = None + """ Organization which maintains the composition. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.date = None + """ Composition editing time. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.encounter = None + """ Context of the Composition. + Type `FHIRReference` referencing `Encounter` (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). + Type `Identifier` (represented as `dict` in JSON). """ + + self.section = None + """ Composition is broken into sections. + List of `CompositionSection` items (represented as `dict` in JSON). """ + + self.status = None + """ preliminary | final | amended | entered-in-error. + Type `str`. """ + + self.subject = None + """ Who and/or what the composition is about. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.title = None + """ Human Readable name/title. + Type `str`. """ + + self.type = None + """ Kind of composition (LOINC if possible). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(Composition, self).__init__(jsondict) + + def elementProperties(self): + js = super(Composition, self).elementProperties() + js.extend([ + ("attester", "attester", CompositionAttester, True, None, False), + ("author", "author", fhirreference.FHIRReference, True, None, True), + ("class_fhir", "class", codeableconcept.CodeableConcept, False, None, False), + ("confidentiality", "confidentiality", str, False, None, False), + ("custodian", "custodian", fhirreference.FHIRReference, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, True), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), + ("event", "event", CompositionEvent, True, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("section", "section", CompositionSection, True, None, False), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, True), + ("title", "title", str, False, None, True), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +from . import backboneelement + +class CompositionAttester(backboneelement.BackboneElement): + """ Attests to accuracy of composition. + + A participant who has attested to the accuracy of the composition/document. + """ + + resource_name = "CompositionAttester" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.mode = None + """ personal | professional | legal | official. + List of `str` items. """ + + self.party = None + """ Who attested the composition. + Type `FHIRReference` referencing `Patient, Practitioner, Organization` (represented as `dict` in JSON). """ + + self.time = None + """ When composition attested. + Type `FHIRDate` (represented as `str` in JSON). """ + + super(CompositionAttester, self).__init__(jsondict) + + def elementProperties(self): + js = super(CompositionAttester, self).elementProperties() + js.extend([ + ("mode", "mode", str, True, None, True), + ("party", "party", fhirreference.FHIRReference, False, None, False), + ("time", "time", fhirdate.FHIRDate, False, None, False), + ]) + return js + + +class CompositionEvent(backboneelement.BackboneElement): + """ The clinical service(s) being documented. + + The clinical service, such as a colonoscopy or an appendectomy, being + documented. + """ + + resource_name = "CompositionEvent" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.code = None + """ Code(s) that apply to the event being documented. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.detail = None + """ The event(s) being documented. + List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + + self.period = None + """ The period covered by the documentation. + Type `Period` (represented as `dict` in JSON). """ + + super(CompositionEvent, self).__init__(jsondict) + + def elementProperties(self): + js = super(CompositionEvent, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, True, None, False), + ("detail", "detail", fhirreference.FHIRReference, True, None, False), + ("period", "period", period.Period, False, None, False), + ]) + return js + + +class CompositionSection(backboneelement.BackboneElement): + """ Composition is broken into sections. + + The root of the sections that make up the composition. + """ + + resource_name = "CompositionSection" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.code = None + """ Classification of section (recommended). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.emptyReason = None + """ Why the section is empty. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.entry = None + """ A reference to data that supports this section. + List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + + self.mode = None + """ working | snapshot | changes. + Type `str`. """ + + self.orderedBy = None + """ Order of section entries. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.section = None + """ Nested Section. + List of `CompositionSection` items (represented as `dict` in JSON). """ + + self.text = None + """ Text summary of the section, for human interpretation. + Type `Narrative` (represented as `dict` in JSON). """ + + self.title = None + """ Label for section (e.g. for ToC). + Type `str`. """ + + super(CompositionSection, self).__init__(jsondict) + + def elementProperties(self): + js = super(CompositionSection, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("emptyReason", "emptyReason", codeableconcept.CodeableConcept, False, None, False), + ("entry", "entry", fhirreference.FHIRReference, True, None, False), + ("mode", "mode", str, False, None, False), + ("orderedBy", "orderedBy", codeableconcept.CodeableConcept, False, None, False), + ("section", "section", CompositionSection, True, None, False), + ("text", "text", narrative.Narrative, False, None, False), + ("title", "title", str, False, None, False), + ]) + return js + + +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier +from . import narrative +from . import period diff --git a/fhirclient/models/DSTU2/composition_tests.py b/fhirclient/models/DSTU2/composition_tests.py new file mode 100644 index 000000000..8c1662f4e --- /dev/null +++ b/fhirclient/models/DSTU2/composition_tests.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import composition +from .fhirdate import FHIRDate + + +class CompositionTests(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("Composition", js["resourceType"]) + return composition.Composition(js) + + def testComposition1(self): + inst = self.instantiate_from("composition-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Composition instance") + self.implComposition1(inst) + + js = inst.as_json() + self.assertEqual("Composition", js["resourceType"]) + inst2 = composition.Composition(js) + self.implComposition1(inst2) + + def implComposition1(self, inst): + self.assertEqual(inst.attester[0].mode[0], "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.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].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) + self.assertEqual(inst.event[0].period.start.as_json(), "2010-07-18") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier.system, "http://healthintersections.com.au/test") + self.assertEqual(inst.identifier.value, "1") + self.assertEqual(inst.section[0].code.coding[0].code, "11348-0") + self.assertEqual(inst.section[0].code.coding[0].display, "History of past illness Narrative") + self.assertEqual(inst.section[0].code.coding[0].system, "http://loinc.org") + 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].text.status, "generated") + self.assertEqual(inst.section[0].title, "History of present illness") + self.assertEqual(inst.section[1].code.coding[0].code, "10157-6") + self.assertEqual(inst.section[1].code.coding[0].display, "History of family member diseases Narrative") + 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].mode, "snapshot") + self.assertEqual(inst.section[1].text.status, "generated") + self.assertEqual(inst.section[1].title, "History of family member diseases") + self.assertEqual(inst.status, "final") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "Consultation Note") + self.assertEqual(inst.type.coding[0].code, "11488-4") + self.assertEqual(inst.type.coding[0].display, "Consult note") + self.assertEqual(inst.type.coding[0].system, "http://loinc.org") + diff --git a/fhirclient/models/DSTU2/conceptmap.py b/fhirclient/models/DSTU2/conceptmap.py new file mode 100644 index 000000000..e63df19d0 --- /dev/null +++ b/fhirclient/models/DSTU2/conceptmap.py @@ -0,0 +1,287 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ConceptMap) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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. + """ + + resource_name = "ConceptMap" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.contact = None + """ Contact details of the publisher. + List of `ConceptMapContact` items (represented as `dict` in JSON). """ + + self.copyright = None + """ Use and/or publishing restrictions. + Type `str`. """ + + self.date = None + """ Date for given status. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Human language description of the concept map. + Type `str`. """ + + self.element = None + """ Mappings for a concept from the source set. + List of `ConceptMapElement` items (represented as `dict` in JSON). """ + + self.experimental = None + """ If for testing purposes, not real usage. + Type `bool`. """ + + self.identifier = None + """ Additional identifier for the concept map. + Type `Identifier` (represented as `dict` in JSON). """ + + self.name = None + """ Informal name for this concept map. + Type `str`. """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.requirements = None + """ Why needed. + Type `str`. """ + + self.sourceReference = None + """ Identifies the source of the concepts which are being mapped. + Type `FHIRReference` referencing `ValueSet, StructureDefinition` (represented as `dict` in JSON). """ + + self.sourceUri = None + """ Identifies the source of the concepts which are being mapped. + Type `str`. """ + + self.status = None + """ draft | active | retired. + Type `str`. """ + + self.targetReference = None + """ Provides context to the mappings. + Type `FHIRReference` referencing `ValueSet, StructureDefinition` (represented as `dict` in JSON). """ + + self.targetUri = None + """ Provides context to the mappings. + Type `str`. """ + + self.url = None + """ Globally unique logical id for concept map. + Type `str`. """ + + self.useContext = None + """ Content intends to support these contexts. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.version = None + """ Logical id for this version of the concept map. + Type `str`. """ + + super(ConceptMap, self).__init__(jsondict) + + def elementProperties(self): + js = super(ConceptMap, self).elementProperties() + js.extend([ + ("contact", "contact", ConceptMapContact, True, None, False), + ("copyright", "copyright", str, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("description", "description", str, False, None, False), + ("element", "element", ConceptMapElement, True, None, False), + ("experimental", "experimental", bool, False, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("name", "name", str, False, None, False), + ("publisher", "publisher", str, False, None, False), + ("requirements", "requirements", str, False, None, False), + ("sourceReference", "sourceReference", fhirreference.FHIRReference, False, "source", True), + ("sourceUri", "sourceUri", str, False, "source", True), + ("status", "status", str, False, None, True), + ("targetReference", "targetReference", fhirreference.FHIRReference, False, "target", True), + ("targetUri", "targetUri", str, False, "target", True), + ("url", "url", str, False, None, False), + ("useContext", "useContext", codeableconcept.CodeableConcept, True, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class ConceptMapContact(backboneelement.BackboneElement): + """ Contact details of the publisher. + + Contacts to assist a user in finding and communicating with the publisher. + """ + + resource_name = "ConceptMapContact" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.name = None + """ Name of a individual to contact. + Type `str`. """ + + self.telecom = None + """ Contact details for individual or publisher. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(ConceptMapContact, self).__init__(jsondict) + + def elementProperties(self): + js = super(ConceptMapContact, self).elementProperties() + js.extend([ + ("name", "name", str, False, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ]) + return js + + +class ConceptMapElement(backboneelement.BackboneElement): + """ Mappings for a concept from the source set. + + Mappings for an individual concept in the source to one or more concepts in + the target. + """ + + resource_name = "ConceptMapElement" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.code = None + """ Identifies element being mapped. + Type `str`. """ + + self.codeSystem = None + """ Code System (if value set crosses code systems). + Type `str`. """ + + self.target = None + """ Concept in target system for element. + List of `ConceptMapElementTarget` items (represented as `dict` in JSON). """ + + super(ConceptMapElement, self).__init__(jsondict) + + def elementProperties(self): + js = super(ConceptMapElement, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, False), + ("codeSystem", "codeSystem", str, False, None, False), + ("target", "target", ConceptMapElementTarget, True, None, False), + ]) + return js + + +class ConceptMapElementTarget(backboneelement.BackboneElement): + """ Concept in target system for element. + + A concept from the target value set that this concept maps to. + """ + + resource_name = "ConceptMapElementTarget" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.code = None + """ Code that identifies the target element. + Type `str`. """ + + self.codeSystem = None + """ System of the target (if necessary). + Type `str`. """ + + self.comments = None + """ Description of status/issues in mapping. + Type `str`. """ + + self.dependsOn = None + """ Other elements required for this mapping (from context). + List of `ConceptMapElementTargetDependsOn` items (represented as `dict` in JSON). """ + + self.equivalence = None + """ equivalent | equal | wider | subsumes | narrower | specializes | + inexact | unmatched | disjoint. + Type `str`. """ + + self.product = None + """ Other concepts that this mapping also produces. + List of `ConceptMapElementTargetDependsOn` items (represented as `dict` in JSON). """ + + super(ConceptMapElementTarget, self).__init__(jsondict) + + def elementProperties(self): + js = super(ConceptMapElementTarget, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, False), + ("codeSystem", "codeSystem", str, False, None, False), + ("comments", "comments", str, False, None, False), + ("dependsOn", "dependsOn", ConceptMapElementTargetDependsOn, True, None, False), + ("equivalence", "equivalence", str, False, None, True), + ("product", "product", ConceptMapElementTargetDependsOn, True, None, False), + ]) + return js + + +class ConceptMapElementTargetDependsOn(backboneelement.BackboneElement): + """ Other elements required for this mapping (from context). + + A set of additional dependencies for this mapping to hold. This mapping is + only applicable if the specified element can be resolved, and it has the + specified value. + """ + + resource_name = "ConceptMapElementTargetDependsOn" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.code = None + """ Value of the referenced element. + Type `str`. """ + + self.codeSystem = None + """ Code System (if necessary). + Type `str`. """ + + self.element = None + """ Reference to element/field/ValueSet mapping depends on. + Type `str`. """ + + super(ConceptMapElementTargetDependsOn, self).__init__(jsondict) + + def elementProperties(self): + js = super(ConceptMapElementTargetDependsOn, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("codeSystem", "codeSystem", str, False, None, True), + ("element", "element", str, False, None, True), + ]) + return js + + +from . import codeableconcept +from . import contactpoint +from . import fhirdate +from . import fhirreference +from . import identifier diff --git a/fhirclient/models/DSTU2/conceptmap_tests.py b/fhirclient/models/DSTU2/conceptmap_tests.py new file mode 100644 index 000000000..16f3e359a --- /dev/null +++ b/fhirclient/models/DSTU2/conceptmap_tests.py @@ -0,0 +1,171 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import conceptmap +from .fhirdate import FHIRDate + + +class ConceptMapTests(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("ConceptMap", js["resourceType"]) + return conceptmap.ConceptMap(js) + + def testConceptMap1(self): + inst = self.instantiate_from("conceptmap-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ConceptMap instance") + self.implConceptMap1(inst) + + js = inst.as_json() + self.assertEqual("ConceptMap", js["resourceType"]) + inst2 = conceptmap.ConceptMap(js) + 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, "other") + 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.assertEqual(inst.element[0].code, "home") + self.assertEqual(inst.element[0].codeSystem, "http://hl7.org/fhir/address-use") + self.assertEqual(inst.element[0].target[0].code, "H") + self.assertEqual(inst.element[0].target[0].codeSystem, "http://hl7.org/fhir/v3/AddressUse") + self.assertEqual(inst.element[0].target[0].equivalence, "equivalent") + self.assertEqual(inst.element[1].code, "home") + self.assertEqual(inst.element[1].codeSystem, "http://hl7.org/fhir/address-use") + self.assertEqual(inst.element[1].target[0].code, "H") + self.assertEqual(inst.element[1].target[0].codeSystem, "http://hl7.org/fhir/v3/AddressUse") + self.assertEqual(inst.element[1].target[0].equivalence, "equivalent") + self.assertEqual(inst.element[2].code, "work") + self.assertEqual(inst.element[2].codeSystem, "http://hl7.org/fhir/address-use") + self.assertEqual(inst.element[2].target[0].code, "WP") + self.assertEqual(inst.element[2].target[0].codeSystem, "http://hl7.org/fhir/v3/AddressUse") + self.assertEqual(inst.element[2].target[0].equivalence, "equivalent") + self.assertEqual(inst.element[3].code, "temp") + self.assertEqual(inst.element[3].codeSystem, "http://hl7.org/fhir/address-use") + self.assertEqual(inst.element[3].target[0].code, "TMP") + self.assertEqual(inst.element[3].target[0].codeSystem, "http://hl7.org/fhir/v3/AddressUse") + self.assertEqual(inst.element[3].target[0].equivalence, "equivalent") + self.assertEqual(inst.element[4].code, "old") + self.assertEqual(inst.element[4].codeSystem, "http://hl7.org/fhir/address-use") + self.assertEqual(inst.element[4].target[0].code, "BAD") + self.assertEqual(inst.element[4].target[0].codeSystem, "http://hl7.org/fhir/v3/AddressUse") + self.assertEqual(inst.element[4].target[0].comments, "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.element[4].target[0].equivalence, "disjoint") + self.assertTrue(inst.experimental) + 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 Mapping") + self.assertEqual(inst.publisher, "HL7, Inc") + self.assertEqual(inst.requirements, "To help implementers map from HL7 v3/CDA to FHIR") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.url, "http://hl7.org/fhir/ConceptMap/101") + self.assertEqual(inst.useContext[0].text, "for CDA Usage") + self.assertEqual(inst.version, "20120613") + + def testConceptMap2(self): + inst = self.instantiate_from("conceptmap-example-specimen-type.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].telecom[0].system, "other") + self.assertEqual(inst.contact[0].telecom[0].value, "http://hl7.org/fhir") + self.assertEqual(inst.contact[1].telecom[0].system, "other") + self.assertEqual(inst.contact[1].telecom[0].value, "http://www.phconnect.org/group/laboratorymessagingcommunityofpractice/forum/attachment/download?id=3649725%3AUploadedFile%3A145786") + self.assertEqual(inst.date.date, FHIRDate("2013-07-25").date) + self.assertEqual(inst.date.as_json(), "2013-07-25") + self.assertEqual(inst.element[0].code, "ACNE") + self.assertEqual(inst.element[0].codeSystem, "http://hl7.org/fhir/v2/0487") + self.assertEqual(inst.element[0].target[0].code, "309068002") + self.assertEqual(inst.element[0].target[0].codeSystem, "http://snomed.info/sct") + self.assertEqual(inst.element[0].target[0].equivalence, "equivalent") + self.assertEqual(inst.element[1].code, "ACNFLD") + self.assertEqual(inst.element[1].codeSystem, "http://hl7.org/fhir/v2/0487") + self.assertEqual(inst.element[1].target[0].code, "119323008") + self.assertEqual(inst.element[1].target[0].codeSystem, "http://snomed.info/sct") + self.assertEqual(inst.element[1].target[0].comments, "HL7 term is a historical term. mapped to Pus") + self.assertEqual(inst.element[1].target[0].equivalence, "equivalent") + self.assertEqual(inst.element[1].target[0].product[0].code, "47002008") + self.assertEqual(inst.element[1].target[0].product[0].codeSystem, "http://snomed.info/sct") + self.assertEqual(inst.element[1].target[0].product[0].element, "http://hl7.org/fhir/v2/element/SPM-5") + self.assertEqual(inst.element[2].code, "AIRS") + self.assertEqual(inst.element[2].codeSystem, "http://hl7.org/fhir/v2/0487") + self.assertEqual(inst.element[2].target[0].code, "446302006") + self.assertEqual(inst.element[2].target[0].codeSystem, "http://snomed.info/sct") + self.assertEqual(inst.element[2].target[0].equivalence, "equivalent") + self.assertEqual(inst.element[3].code, "ALL") + self.assertEqual(inst.element[3].codeSystem, "http://hl7.org/fhir/v2/0487") + self.assertEqual(inst.element[3].target[0].code, "119376003") + self.assertEqual(inst.element[3].target[0].codeSystem, "http://snomed.info/sct") + self.assertEqual(inst.element[3].target[0].equivalence, "equivalent") + self.assertEqual(inst.element[3].target[0].product[0].code, "7970006") + self.assertEqual(inst.element[3].target[0].product[0].codeSystem, "http://snomed.info/sct") + self.assertEqual(inst.element[3].target[0].product[0].element, "http://hl7.org/fhir/v2/element/SPM-5") + self.assertEqual(inst.element[4].code, "AMP") + self.assertEqual(inst.element[4].codeSystem, "http://hl7.org/fhir/v2/0487") + self.assertEqual(inst.element[4].target[0].code, "408654003") + self.assertEqual(inst.element[4].target[0].codeSystem, "http://snomed.info/sct") + self.assertEqual(inst.element[4].target[0].equivalence, "equivalent") + self.assertEqual(inst.element[4].target[0].product[0].code, "81723002") + self.assertEqual(inst.element[4].target[0].product[0].codeSystem, "http://snomed.info/sct") + self.assertEqual(inst.element[4].target[0].product[0].element, "http://hl7.org/fhir/v2/element/SPM-7") + self.assertEqual(inst.element[5].code, "ANGI") + self.assertEqual(inst.element[5].codeSystem, "http://hl7.org/fhir/v2/0487") + self.assertEqual(inst.element[5].target[0].code, "119312009") + self.assertEqual(inst.element[5].target[0].codeSystem, "http://snomed.info/sct") + self.assertEqual(inst.element[5].target[0].comments, "TBD in detail") + self.assertEqual(inst.element[5].target[0].equivalence, "equivalent") + self.assertEqual(inst.element[6].code, "ARTC") + self.assertEqual(inst.element[6].codeSystem, "http://hl7.org/fhir/v2/0487") + self.assertEqual(inst.element[6].target[0].code, "119312009") + self.assertEqual(inst.element[6].target[0].codeSystem, "http://snomed.info/sct") + self.assertEqual(inst.element[6].target[0].comments, "TBD in detail") + self.assertEqual(inst.element[6].target[0].equivalence, "equivalent") + self.assertEqual(inst.element[7].code, "ASERU") + self.assertEqual(inst.element[7].codeSystem, "http://hl7.org/fhir/v2/0487") + self.assertEqual(inst.element[7].target[0].codeSystem, "http://snomed.info/sct") + self.assertEqual(inst.element[7].target[0].comments, "pending") + self.assertEqual(inst.element[7].target[0].equivalence, "unmatched") + self.assertEqual(inst.element[8].code, "ASP") + self.assertEqual(inst.element[8].codeSystem, "http://hl7.org/fhir/v2/0487") + self.assertEqual(inst.element[8].target[0].code, "119295008") + self.assertEqual(inst.element[8].target[0].codeSystem, "http://snomed.info/sct") + self.assertEqual(inst.element[8].target[0].equivalence, "equivalent") + self.assertEqual(inst.element[8].target[0].product[0].code, "14766002") + self.assertEqual(inst.element[8].target[0].product[0].codeSystem, "http://snomed.info/sct") + self.assertEqual(inst.element[8].target[0].product[0].element, "http://hl7.org/fhir/v2/element/SPM-7") + self.assertEqual(inst.element[9].code, "ATTE") + self.assertEqual(inst.element[9].codeSystem, "http://hl7.org/fhir/v2/0487") + self.assertEqual(inst.element[9].target[0].codeSystem, "http://snomed.info/sct") + self.assertEqual(inst.element[9].target[0].comments, "TBD") + self.assertEqual(inst.element[9].target[0].equivalence, "unmatched") + self.assertFalse(inst.experimental) + 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.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.url, "http://hl7.org/fhir/ConceptMap/102") + self.assertEqual(inst.version, "20130725") + diff --git a/fhirclient/models/DSTU2/condition.py b/fhirclient/models/DSTU2/condition.py new file mode 100644 index 000000000..ba8c3674f --- /dev/null +++ b/fhirclient/models/DSTU2/condition.py @@ -0,0 +1,232 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Condition) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Condition(domainresource.DomainResource): + """ Detailed information about conditions, problems or diagnoses. + + Use to record detailed information about conditions, problems or diagnoses + recognized by a clinician. There are many uses including: recording a + diagnosis during an encounter; populating a problem list or a summary + statement, such as a discharge summary. + """ + + resource_name = "Condition" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.abatementBoolean = None + """ If/when in resolution/remission. + Type `bool`. """ + + self.abatementDateTime = None + """ If/when in resolution/remission. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.abatementPeriod = None + """ If/when in resolution/remission. + Type `Period` (represented as `dict` in JSON). """ + + self.abatementQuantity = None + """ If/when in resolution/remission. + Type `Quantity` referencing `Age` (represented as `dict` in JSON). """ + + self.abatementRange = None + """ If/when in resolution/remission. + Type `Range` (represented as `dict` in JSON). """ + + self.abatementString = None + """ If/when in resolution/remission. + Type `str`. """ + + self.asserter = None + """ Person who asserts this condition. + Type `FHIRReference` referencing `Practitioner, Patient` (represented as `dict` in JSON). """ + + self.bodySite = None + """ Anatomical location, if relevant. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.category = None + """ complaint | symptom | finding | diagnosis. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.clinicalStatus = None + """ active | relapse | remission | resolved. + Type `str`. """ + + self.code = None + """ Identification of the condition, problem or diagnosis. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.dateRecorded = None + """ When first entered. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.encounter = None + """ Encounter when condition first asserted. + Type `FHIRReference` referencing `Encounter` (represented as `dict` in JSON). """ + + self.evidence = None + """ Supporting evidence. + List of `ConditionEvidence` items (represented as `dict` in JSON). """ + + self.identifier = None + """ External Ids for this condition. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.notes = None + """ Additional information about the Condition. + Type `str`. """ + + self.onsetDateTime = None + """ Estimated or actual date, date-time, or age. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.onsetPeriod = None + """ Estimated or actual date, date-time, or age. + Type `Period` (represented as `dict` in JSON). """ + + self.onsetQuantity = None + """ Estimated or actual date, date-time, or age. + Type `Quantity` referencing `Age` (represented as `dict` in JSON). """ + + self.onsetRange = None + """ Estimated or actual date, date-time, or age. + Type `Range` (represented as `dict` in JSON). """ + + self.onsetString = None + """ Estimated or actual date, date-time, or age. + Type `str`. """ + + self.patient = None + """ Who has the condition?. + Type `FHIRReference` referencing `Patient` (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). """ + + self.verificationStatus = None + """ provisional | differential | confirmed | refuted | entered-in-error + | unknown. + Type `str`. """ + + super(Condition, self).__init__(jsondict) + + def elementProperties(self): + js = super(Condition, self).elementProperties() + js.extend([ + ("abatementBoolean", "abatementBoolean", bool, False, "abatement", False), + ("abatementDateTime", "abatementDateTime", fhirdate.FHIRDate, False, "abatement", False), + ("abatementPeriod", "abatementPeriod", period.Period, False, "abatement", False), + ("abatementQuantity", "abatementQuantity", quantity.Quantity, False, "abatement", False), + ("abatementRange", "abatementRange", range.Range, False, "abatement", False), + ("abatementString", "abatementString", str, False, "abatement", False), + ("asserter", "asserter", fhirreference.FHIRReference, False, None, False), + ("bodySite", "bodySite", codeableconcept.CodeableConcept, True, None, False), + ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("clinicalStatus", "clinicalStatus", str, False, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("dateRecorded", "dateRecorded", fhirdate.FHIRDate, False, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), + ("evidence", "evidence", ConditionEvidence, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("notes", "notes", str, False, None, False), + ("onsetDateTime", "onsetDateTime", fhirdate.FHIRDate, False, "onset", False), + ("onsetPeriod", "onsetPeriod", period.Period, False, "onset", False), + ("onsetQuantity", "onsetQuantity", quantity.Quantity, False, "onset", False), + ("onsetRange", "onsetRange", range.Range, False, "onset", False), + ("onsetString", "onsetString", str, False, "onset", False), + ("patient", "patient", fhirreference.FHIRReference, False, None, True), + ("severity", "severity", codeableconcept.CodeableConcept, False, None, False), + ("stage", "stage", ConditionStage, False, None, False), + ("verificationStatus", "verificationStatus", str, False, None, True), + ]) + return js + + +from . import backboneelement + +class ConditionEvidence(backboneelement.BackboneElement): + """ Supporting evidence. + + Supporting Evidence / manifestations that are the basis on which this + condition is suspected or confirmed. + """ + + resource_name = "ConditionEvidence" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.code = None + """ Manifestation/symptom. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.detail = None + """ Supporting information found elsewhere. + List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + + super(ConditionEvidence, self).__init__(jsondict) + + def elementProperties(self): + js = super(ConditionEvidence, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("detail", "detail", fhirreference.FHIRReference, True, None, False), + ]) + return js + + +class ConditionStage(backboneelement.BackboneElement): + """ Stage/grade, usually assessed formally. + + Clinical stage or grade of a condition. May include formal severity + assessments. + """ + + resource_name = "ConditionStage" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.assessment = None + """ Formal record of assessment. + List of `FHIRReference` items referencing `ClinicalImpression, DiagnosticReport, Observation` (represented as `dict` in JSON). """ + + self.summary = None + """ Simple summary (disease specific). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ConditionStage, self).__init__(jsondict) + + def elementProperties(self): + js = super(ConditionStage, self).elementProperties() + js.extend([ + ("assessment", "assessment", fhirreference.FHIRReference, True, None, False), + ("summary", "summary", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier +from . import period +from . import quantity +from . import range diff --git a/fhirclient/models/DSTU2/condition_tests.py b/fhirclient/models/DSTU2/condition_tests.py new file mode 100644 index 000000000..d501c302d --- /dev/null +++ b/fhirclient/models/DSTU2/condition_tests.py @@ -0,0 +1,347 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import condition +from .fhirdate import FHIRDate + + +class ConditionTests(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("Condition", js["resourceType"]) + return condition.Condition(js) + + def testCondition1(self): + inst = self.instantiate_from("condition-example-f003-abscess.json") + self.assertIsNotNone(inst, "Must have instantiated a Condition instance") + self.implCondition1(inst) + + js = inst.as_json() + self.assertEqual("Condition", js["resourceType"]) + inst2 = condition.Condition(js) + self.implCondition1(inst2) + + def implCondition1(self, inst): + 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.coding[0].code, "439401001") + self.assertEqual(inst.category.coding[0].display, "diagnosis") + self.assertEqual(inst.category.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.code.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.dateRecorded.date, FHIRDate("2012-02-20").date) + self.assertEqual(inst.dateRecorded.as_json(), "2012-02-20") + self.assertEqual(inst.evidence[0].code.coding[0].code, "169068008") + self.assertEqual(inst.evidence[0].code.coding[0].display, "CT of neck") + self.assertEqual(inst.evidence[0].code.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.text.status, "generated") + self.assertEqual(inst.verificationStatus, "confirmed") + + def testCondition2(self): + inst = self.instantiate_from("condition-example-f203-sepsis.json") + self.assertIsNotNone(inst, "Must have instantiated a Condition instance") + self.implCondition2(inst) + + js = inst.as_json() + self.assertEqual("Condition", js["resourceType"]) + inst2 = condition.Condition(js) + self.implCondition2(inst2) + + def implCondition2(self, inst): + 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.coding[0].code, "55607006") + self.assertEqual(inst.category.coding[0].display, "Problem") + self.assertEqual(inst.category.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.category.coding[1].code, "finding") + self.assertEqual(inst.category.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.code.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.dateRecorded.date, FHIRDate("2013-03-11").date) + self.assertEqual(inst.dateRecorded.as_json(), "2013-03-11") + 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.text.status, "generated") + self.assertEqual(inst.verificationStatus, "confirmed") + + def testCondition3(self): + inst = self.instantiate_from("condition-example-stroke.json") + self.assertIsNotNone(inst, "Must have instantiated a Condition instance") + self.implCondition3(inst) + + js = inst.as_json() + self.assertEqual("Condition", js["resourceType"]) + inst2 = condition.Condition(js) + self.implCondition3(inst2) + + def implCondition3(self, inst): + self.assertEqual(inst.category.coding[0].code, "diagnosis") + self.assertEqual(inst.category.coding[0].display, "Diagnosis") + self.assertEqual(inst.category.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.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.text.status, "generated") + self.assertEqual(inst.verificationStatus, "confirmed") + + def testCondition4(self): + inst = self.instantiate_from("condition-example-f002-lung.json") + self.assertIsNotNone(inst, "Must have instantiated a Condition instance") + self.implCondition4(inst) + + js = inst.as_json() + self.assertEqual("Condition", js["resourceType"]) + inst2 = condition.Condition(js) + self.implCondition4(inst2) + + def implCondition4(self, inst): + 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.coding[0].code, "439401001") + self.assertEqual(inst.category.coding[0].display, "diagnosis") + self.assertEqual(inst.category.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.code.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.dateRecorded.date, FHIRDate("2012-06-03").date) + self.assertEqual(inst.dateRecorded.as_json(), "2012-06-03") + self.assertEqual(inst.evidence[0].code.coding[0].code, "169069000") + self.assertEqual(inst.evidence[0].code.coding[0].display, "CT of thorax") + self.assertEqual(inst.evidence[0].code.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.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") + + def testCondition5(self): + inst = self.instantiate_from("condition-example-f205-infection.json") + self.assertIsNotNone(inst, "Must have instantiated a Condition instance") + self.implCondition5(inst) + + js = inst.as_json() + self.assertEqual("Condition", js["resourceType"]) + inst2 = condition.Condition(js) + self.implCondition5(inst2) + + def implCondition5(self, inst): + 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.dateRecorded.date, FHIRDate("2013-04-04").date) + self.assertEqual(inst.dateRecorded.as_json(), "2013-04-04") + self.assertEqual(inst.id, "f205") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.verificationStatus, "differential") + + def testCondition6(self): + inst = self.instantiate_from("condition-example-f204-renal.json") + self.assertIsNotNone(inst, "Must have instantiated a Condition instance") + self.implCondition6(inst) + + js = inst.as_json() + self.assertEqual("Condition", js["resourceType"]) + inst2 = condition.Condition(js) + self.implCondition6(inst2) + + def implCondition6(self, inst): + self.assertEqual(inst.abatementDateTime.date, FHIRDate("2013-03-20").date) + self.assertEqual(inst.abatementDateTime.as_json(), "2013-03-20") + 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") + self.assertEqual(inst.category.coding[0].code, "55607006") + self.assertEqual(inst.category.coding[0].display, "Problem") + self.assertEqual(inst.category.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.category.coding[1].code, "finding") + self.assertEqual(inst.category.coding[1].system, "http://hl7.org/fhir/condition-category") + self.assertEqual(inst.clinicalStatus, "active") + 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.dateRecorded.date, FHIRDate("2013-03-11").date) + self.assertEqual(inst.dateRecorded.as_json(), "2013-03-11") + self.assertEqual(inst.id, "f204") + self.assertEqual(inst.onsetDateTime.date, FHIRDate("2013-03-11").date) + self.assertEqual(inst.onsetDateTime.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.text.status, "generated") + self.assertEqual(inst.verificationStatus, "differential") + + def testCondition7(self): + inst = self.instantiate_from("condition-example2.json") + self.assertIsNotNone(inst, "Must have instantiated a Condition instance") + self.implCondition7(inst) + + js = inst.as_json() + self.assertEqual("Condition", js["resourceType"]) + inst2 = condition.Condition(js) + self.implCondition7(inst2) + + def implCondition7(self, inst): + self.assertEqual(inst.category.coding[0].code, "finding") + self.assertEqual(inst.category.coding[0].display, "Finding") + self.assertEqual(inst.category.coding[0].system, "http://hl7.org/fhir/condition-category") + self.assertEqual(inst.clinicalStatus, "active") + self.assertEqual(inst.code.text, "Asthma") + self.assertEqual(inst.id, "example2") + self.assertEqual(inst.onsetDateTime.date, FHIRDate("2012-11-12").date) + self.assertEqual(inst.onsetDateTime.as_json(), "2012-11-12") + 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: 21-Nov 2012)
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.verificationStatus, "confirmed") + + def testCondition8(self): + inst = self.instantiate_from("condition-example-f202-malignancy.json") + self.assertIsNotNone(inst, "Must have instantiated a Condition instance") + self.implCondition8(inst) + + js = inst.as_json() + self.assertEqual("Condition", js["resourceType"]) + inst2 = condition.Condition(js) + self.implCondition8(inst2) + + def implCondition8(self, inst): + 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.coding[0].code, "diagnosis") + self.assertEqual(inst.category.coding[0].system, "http://hl7.org/fhir/condition-category") + self.assertEqual(inst.clinicalStatus, "active") + 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.dateRecorded.date, FHIRDate("2012-12-01").date) + self.assertEqual(inst.dateRecorded.as_json(), "2012-12-01") + self.assertEqual(inst.id, "f202") + self.assertEqual(inst.onsetQuantity.code, "258707000") + self.assertEqual(inst.onsetQuantity.system, "http://snomed.info/sct") + self.assertEqual(inst.onsetQuantity.unit, "years") + self.assertEqual(inst.onsetQuantity.value, 52) + 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, "confirmed") + + def testCondition9(self): + inst = self.instantiate_from("condition-example-f201-fever.json") + self.assertIsNotNone(inst, "Must have instantiated a Condition instance") + self.implCondition9(inst) + + js = inst.as_json() + self.assertEqual("Condition", js["resourceType"]) + inst2 = condition.Condition(js) + self.implCondition9(inst2) + + def implCondition9(self, inst): + 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.coding[0].code, "55607006") + self.assertEqual(inst.category.coding[0].display, "Problem") + self.assertEqual(inst.category.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.category.coding[1].code, "finding") + self.assertEqual(inst.category.coding[1].system, "http://hl7.org/fhir/condition-category") + self.assertEqual(inst.clinicalStatus, "active") + 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.dateRecorded.date, FHIRDate("2013-04-04").date) + self.assertEqual(inst.dateRecorded.as_json(), "2013-04-04") + self.assertEqual(inst.evidence[0].code.coding[0].code, "258710007") + self.assertEqual(inst.evidence[0].code.coding[0].display, "degrees C") + self.assertEqual(inst.evidence[0].code.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.id, "f201") + 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.text.status, "generated") + self.assertEqual(inst.verificationStatus, "confirmed") + + def testCondition10(self): + inst = self.instantiate_from("condition-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Condition instance") + self.implCondition10(inst) + + js = inst.as_json() + self.assertEqual("Condition", js["resourceType"]) + inst2 = condition.Condition(js) + self.implCondition10(inst2) + + def implCondition10(self, inst): + self.assertEqual(inst.bodySite[0].coding[0].code, "49521004") + self.assertEqual(inst.bodySite[0].coding[0].display, "Left external ear structure") + self.assertEqual(inst.bodySite[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.bodySite[0].text, "Left Ear") + self.assertEqual(inst.category.coding[0].code, "diagnosis") + self.assertEqual(inst.category.coding[0].display, "Diagnosis") + self.assertEqual(inst.category.coding[0].system, "http://hl7.org/fhir/condition-category") + self.assertEqual(inst.category.coding[1].code, "439401001") + self.assertEqual(inst.category.coding[1].display, "Diagnosis") + self.assertEqual(inst.category.coding[1].system, "http://snomed.info/sct") + self.assertEqual(inst.code.coding[0].code, "39065001") + self.assertEqual(inst.code.coding[0].display, "Burn of ear") + self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.code.text, "Burnt Ear") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.onsetDateTime.date, FHIRDate("2012-05-24").date) + self.assertEqual(inst.onsetDateTime.as_json(), "2012-05-24") + 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.div, "
Severe burn of left ear (Date: 24-May 2012)
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.verificationStatus, "confirmed") + diff --git a/fhirclient/models/DSTU2/conformance.py b/fhirclient/models/DSTU2/conformance.py new file mode 100644 index 000000000..fd34129e8 --- /dev/null +++ b/fhirclient/models/DSTU2/conformance.py @@ -0,0 +1,786 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Conformance) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Conformance(domainresource.DomainResource): + """ A conformance statement. + + A conformance statement is a set of capabilities of a FHIR Server that may + be used as a statement of actual server functionality or a statement of + required or desired server implementation. + """ + + resource_name = "Conformance" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.acceptUnknown = None + """ no | extensions | elements | both. + Type `str`. """ + + self.contact = None + """ Contact details of the publisher. + List of `ConformanceContact` items (represented as `dict` in JSON). """ + + self.copyright = None + """ Use and/or publishing restrictions. + Type `str`. """ + + self.date = None + """ Publication Date(/time). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Human description of the conformance statement. + Type `str`. """ + + self.document = None + """ Document definition. + List of `ConformanceDocument` items (represented as `dict` in JSON). """ + + self.experimental = None + """ If for testing purposes, not real usage. + Type `bool`. """ + + self.fhirVersion = None + """ FHIR Version the system uses. + Type `str`. """ + + self.format = None + """ formats supported (xml | json | mime type). + List of `str` items. """ + + self.implementation = None + """ If this describes a specific instance. + Type `ConformanceImplementation` (represented as `dict` in JSON). """ + + self.kind = None + """ instance | capability | requirements. + Type `str`. """ + + self.messaging = None + """ If messaging is supported. + List of `ConformanceMessaging` items (represented as `dict` in JSON). """ + + self.name = None + """ Informal name for this conformance statement. + Type `str`. """ + + 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`. """ + + self.requirements = None + """ Why is this needed?. + Type `str`. """ + + self.rest = None + """ If the endpoint is a RESTful one. + List of `ConformanceRest` items (represented as `dict` in JSON). """ + + self.software = None + """ Software that is covered by this conformance statement. + Type `ConformanceSoftware` (represented as `dict` in JSON). """ + + self.status = None + """ draft | active | retired. + Type `str`. """ + + self.url = None + """ Logical uri to reference this statement. + Type `str`. """ + + self.version = None + """ Logical id for this version of the statement. + Type `str`. """ + + super(Conformance, self).__init__(jsondict) + + def elementProperties(self): + js = super(Conformance, self).elementProperties() + js.extend([ + ("acceptUnknown", "acceptUnknown", str, False, None, True), + ("contact", "contact", ConformanceContact, True, None, False), + ("copyright", "copyright", str, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, True), + ("description", "description", str, False, None, False), + ("document", "document", ConformanceDocument, True, None, False), + ("experimental", "experimental", bool, False, None, False), + ("fhirVersion", "fhirVersion", str, False, None, True), + ("format", "format", str, True, None, True), + ("implementation", "implementation", ConformanceImplementation, False, None, False), + ("kind", "kind", str, False, None, True), + ("messaging", "messaging", ConformanceMessaging, True, None, False), + ("name", "name", str, False, None, False), + ("profile", "profile", fhirreference.FHIRReference, True, None, False), + ("publisher", "publisher", str, False, None, False), + ("requirements", "requirements", str, False, None, False), + ("rest", "rest", ConformanceRest, True, None, False), + ("software", "software", ConformanceSoftware, False, None, False), + ("status", "status", str, False, None, False), + ("url", "url", str, False, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class ConformanceContact(backboneelement.BackboneElement): + """ Contact details of the publisher. + + Contacts to assist a user in finding and communicating with the publisher. + """ + + resource_name = "ConformanceContact" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.name = None + """ Name of a individual to contact. + Type `str`. """ + + self.telecom = None + """ Contact details for individual or publisher. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(ConformanceContact, self).__init__(jsondict) + + def elementProperties(self): + js = super(ConformanceContact, self).elementProperties() + js.extend([ + ("name", "name", str, False, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ]) + return js + + +class ConformanceDocument(backboneelement.BackboneElement): + """ Document definition. + + A document definition. + """ + + resource_name = "ConformanceDocument" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.documentation = None + """ Description of document support. + Type `str`. """ + + self.mode = None + """ producer | consumer. + Type `str`. """ + + self.profile = None + """ Constraint on a resource used in the document. + Type `FHIRReference` referencing `StructureDefinition` (represented as `dict` in JSON). """ + + super(ConformanceDocument, self).__init__(jsondict) + + def elementProperties(self): + js = super(ConformanceDocument, self).elementProperties() + js.extend([ + ("documentation", "documentation", str, False, None, False), + ("mode", "mode", str, False, None, True), + ("profile", "profile", fhirreference.FHIRReference, False, None, True), + ]) + return js + + +class ConformanceImplementation(backboneelement.BackboneElement): + """ If this describes a specific instance. + + Identifies a specific implementation instance that is described by the + conformance statement - i.e. a particular installation, rather than the + capabilities of a software program. + """ + + resource_name = "ConformanceImplementation" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.description = None + """ Describes this specific instance. + Type `str`. """ + + self.url = None + """ Base URL for the installation. + Type `str`. """ + + super(ConformanceImplementation, self).__init__(jsondict) + + def elementProperties(self): + js = super(ConformanceImplementation, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, True), + ("url", "url", str, False, None, False), + ]) + return js + + +class ConformanceMessaging(backboneelement.BackboneElement): + """ If messaging is supported. + + A description of the messaging capabilities of the solution. + """ + + resource_name = "ConformanceMessaging" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.documentation = None + """ Messaging interface behavior details. + Type `str`. """ + + self.endpoint = None + """ A messaging service end-point. + List of `ConformanceMessagingEndpoint` items (represented as `dict` in JSON). """ + + self.event = None + """ Declare support for this event. + List of `ConformanceMessagingEvent` items (represented as `dict` in JSON). """ + + self.reliableCache = None + """ Reliable Message Cache Length (min). + Type `int`. """ + + super(ConformanceMessaging, self).__init__(jsondict) + + def elementProperties(self): + js = super(ConformanceMessaging, self).elementProperties() + js.extend([ + ("documentation", "documentation", str, False, None, False), + ("endpoint", "endpoint", ConformanceMessagingEndpoint, True, None, False), + ("event", "event", ConformanceMessagingEvent, True, None, True), + ("reliableCache", "reliableCache", int, False, None, False), + ]) + return js + + +class ConformanceMessagingEndpoint(backboneelement.BackboneElement): + """ A messaging service end-point. + + An endpoint (network accessible address) to which messages and/or replies + are to be sent. + """ + + resource_name = "ConformanceMessagingEndpoint" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.address = None + """ Address of end-point. + Type `str`. """ + + self.protocol = None + """ http | ftp | mllp +. + Type `Coding` (represented as `dict` in JSON). """ + + super(ConformanceMessagingEndpoint, self).__init__(jsondict) + + def elementProperties(self): + js = super(ConformanceMessagingEndpoint, self).elementProperties() + js.extend([ + ("address", "address", str, False, None, True), + ("protocol", "protocol", coding.Coding, False, None, True), + ]) + return js + + +class ConformanceMessagingEvent(backboneelement.BackboneElement): + """ Declare support for this event. + + A description of the solution's support for an event at this end-point. + """ + + resource_name = "ConformanceMessagingEvent" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + 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(ConformanceMessagingEvent, self).__init__(jsondict) + + def elementProperties(self): + js = super(ConformanceMessagingEvent, 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 ConformanceRest(backboneelement.BackboneElement): + """ If the endpoint is a RESTful one. + + A definition of the restful capabilities of the solution, if any. + """ + + resource_name = "ConformanceRest" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.compartment = None + """ Compartments served/used by system. + List of `str` items. """ + + self.documentation = None + """ General description of implementation. + Type `str`. """ + + self.interaction = None + """ What operations are supported?. + List of `ConformanceRestInteraction` items (represented as `dict` in JSON). """ + + self.mode = None + """ client | server. + Type `str`. """ + + self.operation = None + """ Definition of an operation or a custom query. + List of `ConformanceRestOperation` items (represented as `dict` in JSON). """ + + self.resource = None + """ Resource served on the REST interface. + List of `ConformanceRestResource` items (represented as `dict` in JSON). """ + + self.searchParam = None + """ Search params for searching all resources. + List of `ConformanceRestResourceSearchParam` items (represented as `dict` in JSON). """ + + self.security = None + """ Information about security of implementation. + Type `ConformanceRestSecurity` (represented as `dict` in JSON). """ + + self.transactionMode = None + """ not-supported | batch | transaction | both. + Type `str`. """ + + super(ConformanceRest, self).__init__(jsondict) + + def elementProperties(self): + js = super(ConformanceRest, self).elementProperties() + js.extend([ + ("compartment", "compartment", str, True, None, False), + ("documentation", "documentation", str, False, None, False), + ("interaction", "interaction", ConformanceRestInteraction, True, None, False), + ("mode", "mode", str, False, None, True), + ("operation", "operation", ConformanceRestOperation, True, None, False), + ("resource", "resource", ConformanceRestResource, True, None, True), + ("searchParam", "searchParam", ConformanceRestResourceSearchParam, True, None, False), + ("security", "security", ConformanceRestSecurity, False, None, False), + ("transactionMode", "transactionMode", str, False, None, False), + ]) + return js + + +class ConformanceRestInteraction(backboneelement.BackboneElement): + """ What operations are supported?. + + A specification of restful operations supported by the system. + """ + + resource_name = "ConformanceRestInteraction" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.code = None + """ transaction | search-system | history-system. + Type `str`. """ + + self.documentation = None + """ Anything special about operation behavior. + Type `str`. """ + + super(ConformanceRestInteraction, self).__init__(jsondict) + + def elementProperties(self): + js = super(ConformanceRestInteraction, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("documentation", "documentation", str, False, None, False), + ]) + return js + + +class ConformanceRestOperation(backboneelement.BackboneElement): + """ Definition of an operation or a custom query. + + Definition of an operation or a named query and with its parameters and + their meaning and type. + """ + + resource_name = "ConformanceRestOperation" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + 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(ConformanceRestOperation, self).__init__(jsondict) + + def elementProperties(self): + js = super(ConformanceRestOperation, self).elementProperties() + js.extend([ + ("definition", "definition", fhirreference.FHIRReference, False, None, True), + ("name", "name", str, False, None, True), + ]) + return js + + +class ConformanceRestResource(backboneelement.BackboneElement): + """ Resource served on the REST interface. + + A specification of the restful capabilities of the solution for a specific + resource type. + """ + + resource_name = "ConformanceRestResource" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.conditionalCreate = None + """ If allows/uses conditional create. + Type `bool`. """ + + self.conditionalDelete = None + """ not-supported | single | multiple - how conditional delete is + supported. + Type `str`. """ + + self.conditionalUpdate = None + """ If allows/uses conditional update. + Type `bool`. """ + + self.interaction = None + """ What operations are supported?. + List of `ConformanceRestResourceInteraction` 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). """ + + self.readHistory = None + """ Whether vRead can return past versions. + Type `bool`. """ + + self.searchInclude = None + """ _include values supported by the server. + List of `str` items. """ + + self.searchParam = None + """ Search params supported by implementation. + List of `ConformanceRestResourceSearchParam` items (represented as `dict` in JSON). """ + + self.searchRevInclude = None + """ _revinclude values supported by the server. + List of `str` items. """ + + self.type = None + """ A resource type that is supported. + Type `str`. """ + + self.updateCreate = None + """ If update can commit to a new identity. + Type `bool`. """ + + self.versioning = None + """ no-version | versioned | versioned-update. + Type `str`. """ + + super(ConformanceRestResource, self).__init__(jsondict) + + def elementProperties(self): + js = super(ConformanceRestResource, self).elementProperties() + js.extend([ + ("conditionalCreate", "conditionalCreate", bool, False, None, False), + ("conditionalDelete", "conditionalDelete", str, False, None, False), + ("conditionalUpdate", "conditionalUpdate", bool, False, None, False), + ("interaction", "interaction", ConformanceRestResourceInteraction, True, None, True), + ("profile", "profile", fhirreference.FHIRReference, False, None, False), + ("readHistory", "readHistory", bool, False, None, False), + ("searchInclude", "searchInclude", str, True, None, False), + ("searchParam", "searchParam", ConformanceRestResourceSearchParam, True, None, False), + ("searchRevInclude", "searchRevInclude", str, True, None, False), + ("type", "type", str, False, None, True), + ("updateCreate", "updateCreate", bool, False, None, False), + ("versioning", "versioning", str, False, None, False), + ]) + return js + + +class ConformanceRestResourceInteraction(backboneelement.BackboneElement): + """ What operations are supported?. + + Identifies a restful operation supported by the solution. + """ + + resource_name = "ConformanceRestResourceInteraction" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.code = None + """ read | vread | update | delete | history-instance | validate | + history-type | create | search-type. + Type `str`. """ + + self.documentation = None + """ Anything special about operation behavior. + Type `str`. """ + + super(ConformanceRestResourceInteraction, self).__init__(jsondict) + + def elementProperties(self): + js = super(ConformanceRestResourceInteraction, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("documentation", "documentation", str, False, None, False), + ]) + return js + + +class ConformanceRestResourceSearchParam(backboneelement.BackboneElement): + """ Search params supported by implementation. + + Search parameters for implementations to support and/or make use of - + either references to ones defined in the specification, or additional ones + defined for/by the implementation. + """ + + resource_name = "ConformanceRestResourceSearchParam" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.chain = None + """ Chained names supported. + List of `str` items. """ + + self.definition = None + """ Source of definition for parameter. + Type `str`. """ + + self.documentation = None + """ Server-specific usage. + Type `str`. """ + + self.modifier = None + """ missing | exact | contains | not | text | in | not-in | below | + above | type. + List of `str` items. """ + + self.name = None + """ Name of search parameter. + Type `str`. """ + + self.target = None + """ Types of resource (if a resource reference). + List of `str` items. """ + + self.type = None + """ number | date | string | token | reference | composite | quantity | + uri. + Type `str`. """ + + super(ConformanceRestResourceSearchParam, self).__init__(jsondict) + + def elementProperties(self): + js = super(ConformanceRestResourceSearchParam, self).elementProperties() + js.extend([ + ("chain", "chain", str, True, None, False), + ("definition", "definition", str, False, None, False), + ("documentation", "documentation", str, False, None, False), + ("modifier", "modifier", str, True, None, False), + ("name", "name", str, False, None, True), + ("target", "target", str, True, None, False), + ("type", "type", str, False, None, True), + ]) + return js + + +class ConformanceRestSecurity(backboneelement.BackboneElement): + """ Information about security of implementation. + + Information about security implementation from an interface perspective - + what a client needs to know. + """ + + resource_name = "ConformanceRestSecurity" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.certificate = None + """ Certificates associated with security profiles. + List of `ConformanceRestSecurityCertificate` items (represented as `dict` in JSON). """ + + self.cors = None + """ Adds CORS Headers (http://enable-cors.org/). + Type `bool`. """ + + self.description = None + """ General description of how security works. + Type `str`. """ + + self.service = None + """ OAuth | SMART-on-FHIR | NTLM | Basic | Kerberos | Certificates. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(ConformanceRestSecurity, self).__init__(jsondict) + + def elementProperties(self): + js = super(ConformanceRestSecurity, self).elementProperties() + js.extend([ + ("certificate", "certificate", ConformanceRestSecurityCertificate, True, None, False), + ("cors", "cors", bool, False, None, False), + ("description", "description", str, False, None, False), + ("service", "service", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +class ConformanceRestSecurityCertificate(backboneelement.BackboneElement): + """ Certificates associated with security profiles. + """ + + resource_name = "ConformanceRestSecurityCertificate" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.blob = None + """ Actual certificate. + Type `str`. """ + + self.type = None + """ Mime type for certificate. + Type `str`. """ + + super(ConformanceRestSecurityCertificate, self).__init__(jsondict) + + def elementProperties(self): + js = super(ConformanceRestSecurityCertificate, self).elementProperties() + js.extend([ + ("blob", "blob", str, False, None, False), + ("type", "type", str, False, None, False), + ]) + return js + + +class ConformanceSoftware(backboneelement.BackboneElement): + """ Software that is covered by this conformance statement. + + Software that is covered by this conformance statement. It is used when + the conformance statement describes the capabilities of a particular + software version, independent of an installation. + """ + + resource_name = "ConformanceSoftware" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.name = None + """ A name the software is known by. + Type `str`. """ + + self.releaseDate = None + """ Date this version released. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.version = None + """ Version covered by this statement. + Type `str`. """ + + super(ConformanceSoftware, self).__init__(jsondict) + + def elementProperties(self): + js = super(ConformanceSoftware, self).elementProperties() + js.extend([ + ("name", "name", str, False, None, True), + ("releaseDate", "releaseDate", fhirdate.FHIRDate, False, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + +from . import codeableconcept +from . import coding +from . import contactpoint +from . import fhirdate +from . import fhirreference diff --git a/fhirclient/models/DSTU2/conformance_tests.py b/fhirclient/models/DSTU2/conformance_tests.py new file mode 100644 index 000000000..784027fbf --- /dev/null +++ b/fhirclient/models/DSTU2/conformance_tests.py @@ -0,0 +1,169 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import conformance +from .fhirdate import FHIRDate + + +class ConformanceTests(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("Conformance", js["resourceType"]) + return conformance.Conformance(js) + + def testConformance1(self): + inst = self.instantiate_from("conformance-phr-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Conformance instance") + self.implConformance1(inst) + + js = inst.as_json() + self.assertEqual("Conformance", js["resourceType"]) + inst2 = conformance.Conformance(js) + self.implConformance1(inst2) + + def implConformance1(self, inst): + self.assertEqual(inst.acceptUnknown, "no") + self.assertEqual(inst.contact[0].telecom[0].system, "other") + 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 Conformance Statement for September 2013 Connectathon") + self.assertEqual(inst.fhirVersion, "1.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.name, "PHR Template") + self.assertEqual(inst.publisher, "FHIR Project") + self.assertEqual(inst.rest[0].documentation, "Protoype server conformance statement for September 2013 Connectathon") + self.assertEqual(inst.rest[0].mode, "server") + self.assertEqual(inst.rest[0].resource[0].interaction[0].code, "read") + self.assertEqual(inst.rest[0].resource[0].interaction[1].code, "search-type") + self.assertEqual(inst.rest[0].resource[0].interaction[1].documentation, "When a client searches patients with no search criteria, they get a list of all patients they have access too. Servers may elect to offer additional search parameters, but this is not required") + self.assertEqual(inst.rest[0].resource[0].type, "Patient") + self.assertEqual(inst.rest[0].resource[1].interaction[0].code, "read") + self.assertEqual(inst.rest[0].resource[1].interaction[1].code, "search-type") + self.assertEqual(inst.rest[0].resource[1].searchParam[0].documentation, "_id parameter always supported. For the connectathon, servers may elect which search parameters are supported") + self.assertEqual(inst.rest[0].resource[1].searchParam[0].name, "_id") + self.assertEqual(inst.rest[0].resource[1].searchParam[0].type, "token") + self.assertEqual(inst.rest[0].resource[1].type, "DocumentReference") + self.assertEqual(inst.rest[0].resource[2].interaction[0].code, "read") + self.assertEqual(inst.rest[0].resource[2].interaction[1].code, "search-type") + self.assertEqual(inst.rest[0].resource[2].searchParam[0].documentation, "Standard _id parameter") + self.assertEqual(inst.rest[0].resource[2].searchParam[0].name, "_id") + self.assertEqual(inst.rest[0].resource[2].searchParam[0].type, "token") + self.assertEqual(inst.rest[0].resource[2].type, "Condition") + self.assertEqual(inst.rest[0].resource[3].interaction[0].code, "read") + self.assertEqual(inst.rest[0].resource[3].interaction[1].code, "search-type") + self.assertEqual(inst.rest[0].resource[3].searchParam[0].documentation, "Standard _id parameter") + self.assertEqual(inst.rest[0].resource[3].searchParam[0].name, "_id") + self.assertEqual(inst.rest[0].resource[3].searchParam[0].type, "token") + self.assertEqual(inst.rest[0].resource[3].searchParam[1].documentation, "which diagnostic discipline/department created the report") + self.assertEqual(inst.rest[0].resource[3].searchParam[1].name, "service") + self.assertEqual(inst.rest[0].resource[3].searchParam[1].type, "token") + self.assertEqual(inst.rest[0].resource[3].type, "DiagnosticReport") + self.assertEqual(inst.rest[0].security.service[0].text, "OAuth") + self.assertEqual(inst.software.name, "ACME PHR Server") + self.assertEqual(inst.text.status, "generated") + + def testConformance2(self): + inst = self.instantiate_from("conformance-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Conformance instance") + self.implConformance2(inst) + + js = inst.as_json() + self.assertEqual("Conformance", js["resourceType"]) + inst2 = conformance.Conformance(js) + self.implConformance2(inst2) + + def implConformance2(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") + self.assertEqual(inst.copyright, "Copyright © Acme Healthcare and GoodCorp EHR Systems") + 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 conformance 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.assertTrue(inst.experimental) + self.assertEqual(inst.fhirVersion, "1.0.0") + self.assertEqual(inst.format[0], "xml") + self.assertEqual(inst.format[1], "json") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.implementation.description, "main EHR at ACME") + self.assertEqual(inst.implementation.url, "http://10.2.3.4/fhir") + self.assertEqual(inst.kind, "instance") + 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-type") + 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].reliableCache, 30) + self.assertEqual(inst.name, "ACME EHR Conformance statement") + self.assertEqual(inst.publisher, "ACME Corporation") + self.assertEqual(inst.requirements, "Main EHR conformance statement, published for contracting and operational support") + self.assertEqual(inst.rest[0].compartment[0], "http://hl7.org/fhir/compartment/Patient") + self.assertEqual(inst.rest[0].documentation, "Main FHIR endpoint for acem health") + self.assertEqual(inst.rest[0].interaction[0].code, "transaction") + self.assertEqual(inst.rest[0].interaction[1].code, "history-system") + self.assertEqual(inst.rest[0].mode, "server") + self.assertTrue(inst.rest[0].resource[0].conditionalCreate) + self.assertEqual(inst.rest[0].resource[0].conditionalDelete, "not-supported") + self.assertFalse(inst.rest[0].resource[0].conditionalUpdate) + self.assertEqual(inst.rest[0].resource[0].interaction[0].code, "read") + self.assertEqual(inst.rest[0].resource[0].interaction[1].code, "vread") + self.assertEqual(inst.rest[0].resource[0].interaction[1].documentation, "Only supported for patient records since 12-Dec 2012") + self.assertEqual(inst.rest[0].resource[0].interaction[2].code, "update") + 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.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") + self.assertEqual(inst.rest[0].resource[0].searchParam[0].documentation, "Only supports search by institution MRN") + self.assertEqual(inst.rest[0].resource[0].searchParam[0].modifier[0], "missing") + self.assertEqual(inst.rest[0].resource[0].searchParam[0].name, "identifier") + self.assertEqual(inst.rest[0].resource[0].searchParam[0].type, "token") + self.assertEqual(inst.rest[0].resource[0].searchParam[1].chain[0], "name") + self.assertEqual(inst.rest[0].resource[0].searchParam[1].chain[1], "identifier") + self.assertEqual(inst.rest[0].resource[0].searchParam[1].definition, "http://hl7.org/fhir/SearchParameter/Patient-careprovider") + self.assertEqual(inst.rest[0].resource[0].searchParam[1].modifier[0], "missing") + self.assertEqual(inst.rest[0].resource[0].searchParam[1].name, "careprovider") + self.assertEqual(inst.rest[0].resource[0].searchParam[1].target[0], "Organization") + 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].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.software.name, "EHR") + self.assertEqual(inst.software.releaseDate.date, FHIRDate("2012-01-04").date) + self.assertEqual(inst.software.releaseDate.as_json(), "2012-01-04") + self.assertEqual(inst.software.version, "0.00.020.2134") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.url, "68D043B5-9ECF-4559-A57A-396E0D452311") + self.assertEqual(inst.version, "20130510") + diff --git a/fhirclient/models/DSTU2/contactpoint.py b/fhirclient/models/DSTU2/contactpoint.py new file mode 100644 index 000000000..8e546ee88 --- /dev/null +++ b/fhirclient/models/DSTU2/contactpoint.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ContactPoint) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class ContactPoint(element.Element): + """ Details of a Technology mediated contact point (phone, fax, email, etc.). + + Details for all kinds of technology mediated contact points for a person or + organization, including telephone, email, etc. + """ + + resource_name = "ContactPoint" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.period = None + """ Time period when the contact point was/is in use. + Type `Period` (represented as `dict` in JSON). """ + + self.rank = None + """ Specify preferred order of use (1 = highest). + Type `int`. """ + + self.system = None + """ phone | fax | email | pager | other. + Type `str`. """ + + self.use = None + """ home | work | temp | old | mobile - purpose of this contact point. + Type `str`. """ + + self.value = None + """ The actual contact point details. + Type `str`. """ + + super(ContactPoint, self).__init__(jsondict) + + def elementProperties(self): + js = super(ContactPoint, self).elementProperties() + js.extend([ + ("period", "period", period.Period, False, None, False), + ("rank", "rank", int, False, None, False), + ("system", "system", str, False, None, False), + ("use", "use", str, False, None, False), + ("value", "value", str, False, None, False), + ]) + return js + + +from . import period diff --git a/fhirclient/models/DSTU2/contract.py b/fhirclient/models/DSTU2/contract.py new file mode 100644 index 000000000..99b64958f --- /dev/null +++ b/fhirclient/models/DSTU2/contract.py @@ -0,0 +1,547 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Contract) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Contract(domainresource.DomainResource): + """ Contract. + + A formal agreement between parties regarding the conduct of business, + exchange of information or other matters. + """ + + resource_name = "Contract" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.action = None + """ Contract Action. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.actionReason = None + """ Contract Action Reason. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.actor = None + """ Contract Actor. + List of `ContractActor` items (represented as `dict` in JSON). """ + + self.applies = None + """ Effective time. + Type `Period` (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). """ + + 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.domain = None + """ Domain in which this Contract applies. + List of `FHIRReference` items referencing `Location` (represented as `dict` in JSON). """ + + self.friendly = None + """ Contract Friendly Language. + List of `ContractFriendly` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Contract identifier. + Type `Identifier` (represented as `dict` in JSON). """ + + self.issued = None + """ When this Contract was issued. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.legal = None + """ Contract Legal Language. + List of `ContractLegal` items (represented as `dict` in JSON). """ + + self.rule = None + """ Computable Contract Language. + List of `ContractRule` items (represented as `dict` in JSON). """ + + self.signer = None + """ Contract Signer. + List of `ContractSigner` items (represented as `dict` in JSON). """ + + self.subType = None + """ Contract Subtype. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.subject = None + """ Subject of this Contract. + List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + + self.term = None + """ Contract Term List. + List of `ContractTerm` items (represented as `dict` in JSON). """ + + self.type = None + """ Contract Tyoe. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valuedItem = None + """ Contract Valued Item. + List of `ContractValuedItem` items (represented as `dict` in JSON). """ + + super(Contract, self).__init__(jsondict) + + def elementProperties(self): + js = super(Contract, self).elementProperties() + js.extend([ + ("action", "action", codeableconcept.CodeableConcept, True, None, False), + ("actionReason", "actionReason", codeableconcept.CodeableConcept, True, None, False), + ("actor", "actor", ContractActor, True, None, False), + ("applies", "applies", period.Period, False, None, False), + ("authority", "authority", fhirreference.FHIRReference, True, None, False), + ("bindingAttachment", "bindingAttachment", attachment.Attachment, False, "binding", False), + ("bindingReference", "bindingReference", fhirreference.FHIRReference, False, "binding", False), + ("domain", "domain", fhirreference.FHIRReference, True, None, False), + ("friendly", "friendly", ContractFriendly, True, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("issued", "issued", fhirdate.FHIRDate, False, None, False), + ("legal", "legal", ContractLegal, True, None, False), + ("rule", "rule", ContractRule, True, None, False), + ("signer", "signer", ContractSigner, True, None, False), + ("subType", "subType", codeableconcept.CodeableConcept, True, None, False), + ("subject", "subject", fhirreference.FHIRReference, True, None, False), + ("term", "term", ContractTerm, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("valuedItem", "valuedItem", ContractValuedItem, True, None, False), + ]) + return js + + +from . import backboneelement + +class ContractActor(backboneelement.BackboneElement): + """ Contract Actor. + + List of Contract actors. + """ + + resource_name = "ContractActor" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.entity = None + """ Contract Actor Type. + Type `FHIRReference` referencing `Contract, Device, Group, Location, Organization, Patient, Practitioner, RelatedPerson, Substance` (represented as `dict` in JSON). """ + + self.role = None + """ Contract Actor Role. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(ContractActor, self).__init__(jsondict) + + def elementProperties(self): + js = super(ContractActor, self).elementProperties() + js.extend([ + ("entity", "entity", fhirreference.FHIRReference, False, None, True), + ("role", "role", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +class ContractFriendly(backboneelement.BackboneElement): + """ Contract Friendly Language. + + The "patient friendly language" versionof the Contract in whole or in + parts. "Patient friendly language" means the representation of the Contract + and Contract Provisions in a manner that is readily accessible and + understandable by a layperson in accordance with best practices for + communication styles that ensure that those agreeing to or signing the + Contract understand the roles, actions, obligations, responsibilities, and + implication of the agreement. + """ + + resource_name = "ContractFriendly" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.contentAttachment = None + """ Easily comprehended representation of this Contract. + Type `Attachment` (represented as `dict` in JSON). """ + + self.contentReference = None + """ Easily comprehended representation of this Contract. + Type `FHIRReference` referencing `Composition, DocumentReference, QuestionnaireResponse` (represented as `dict` in JSON). """ + + super(ContractFriendly, self).__init__(jsondict) + + def elementProperties(self): + js = super(ContractFriendly, self).elementProperties() + js.extend([ + ("contentAttachment", "contentAttachment", attachment.Attachment, False, "content", True), + ("contentReference", "contentReference", fhirreference.FHIRReference, False, "content", True), + ]) + return js + + +class ContractLegal(backboneelement.BackboneElement): + """ Contract Legal Language. + + List of Legal expressions or representations of this Contract. + """ + + resource_name = "ContractLegal" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.contentAttachment = None + """ Contract Legal Text. + Type `Attachment` (represented as `dict` in JSON). """ + + self.contentReference = None + """ Contract Legal Text. + Type `FHIRReference` referencing `Composition, DocumentReference, QuestionnaireResponse` (represented as `dict` in JSON). """ + + super(ContractLegal, self).__init__(jsondict) + + def elementProperties(self): + js = super(ContractLegal, self).elementProperties() + js.extend([ + ("contentAttachment", "contentAttachment", attachment.Attachment, False, "content", True), + ("contentReference", "contentReference", fhirreference.FHIRReference, False, "content", True), + ]) + return js + + +class ContractRule(backboneelement.BackboneElement): + """ Computable Contract Language. + + List of Computable Policy Rule Language Representations of this Contract. + """ + + resource_name = "ContractRule" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.contentAttachment = None + """ Computable Contract Rules. + Type `Attachment` (represented as `dict` in JSON). """ + + self.contentReference = None + """ Computable Contract Rules. + Type `FHIRReference` referencing `DocumentReference` (represented as `dict` in JSON). """ + + super(ContractRule, self).__init__(jsondict) + + def elementProperties(self): + js = super(ContractRule, self).elementProperties() + js.extend([ + ("contentAttachment", "contentAttachment", attachment.Attachment, False, "content", True), + ("contentReference", "contentReference", fhirreference.FHIRReference, False, "content", True), + ]) + return js + + +class ContractSigner(backboneelement.BackboneElement): + """ Contract Signer. + + Party signing this Contract. + """ + + resource_name = "ContractSigner" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.party = None + """ Contract Signatory Party. + Type `FHIRReference` referencing `Organization, Patient, Practitioner, RelatedPerson` (represented as `dict` in JSON). """ + + self.signature = None + """ Contract Documentation Signature. + Type `str`. """ + + self.type = None + """ Contract Signer Type. + Type `Coding` (represented as `dict` in JSON). """ + + super(ContractSigner, self).__init__(jsondict) + + def elementProperties(self): + js = super(ContractSigner, self).elementProperties() + js.extend([ + ("party", "party", fhirreference.FHIRReference, False, None, True), + ("signature", "signature", str, False, None, True), + ("type", "type", coding.Coding, False, None, True), + ]) + return js + + +class ContractTerm(backboneelement.BackboneElement): + """ Contract Term List. + + One or more Contract Provisions, which may be related and conveyed as a + group, and may contain nested groups. + """ + + resource_name = "ContractTerm" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.action = None + """ Contract Term Action. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.actionReason = None + """ Contract Term Action Reason. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.actor = None + """ Contract Term Actor List. + List of `ContractTermActor` items (represented as `dict` in JSON). """ + + self.applies = None + """ Contract Term Effective Time. + Type `Period` (represented as `dict` in JSON). """ + + self.group = None + """ Nested Contract Term Group. + List of `ContractTerm` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Contract Term identifier. + Type `Identifier` (represented as `dict` in JSON). """ + + self.issued = None + """ Contract Term Issue Date Time. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.subType = None + """ Contract Term Subtype. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.subject = None + """ Subject of this Contract Term. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.text = None + """ Human readable Contract term text. + Type `str`. """ + + self.type = None + """ Contract Term Type. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valuedItem = None + """ Contract Term Valued Item. + List of `ContractTermValuedItem` items (represented as `dict` in JSON). """ + + super(ContractTerm, self).__init__(jsondict) + + def elementProperties(self): + js = super(ContractTerm, self).elementProperties() + js.extend([ + ("action", "action", codeableconcept.CodeableConcept, True, None, False), + ("actionReason", "actionReason", codeableconcept.CodeableConcept, True, None, False), + ("actor", "actor", ContractTermActor, True, None, False), + ("applies", "applies", period.Period, False, None, False), + ("group", "group", ContractTerm, True, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("issued", "issued", fhirdate.FHIRDate, False, None, False), + ("subType", "subType", codeableconcept.CodeableConcept, False, None, False), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ("text", "text", str, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("valuedItem", "valuedItem", ContractTermValuedItem, True, None, False), + ]) + return js + + +class ContractTermActor(backboneelement.BackboneElement): + """ Contract Term Actor List. + + List of actors participating in this Contract Provision. + """ + + resource_name = "ContractTermActor" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.entity = None + """ Contract Term Actor. + Type `FHIRReference` referencing `Contract, Device, Group, Location, Organization, Patient, Practitioner, RelatedPerson, Substance` (represented as `dict` in JSON). """ + + self.role = None + """ Contract Term Actor Role. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(ContractTermActor, self).__init__(jsondict) + + def elementProperties(self): + js = super(ContractTermActor, self).elementProperties() + js.extend([ + ("entity", "entity", fhirreference.FHIRReference, False, None, True), + ("role", "role", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +class ContractTermValuedItem(backboneelement.BackboneElement): + """ Contract Term Valued Item. + + Contract Provision Valued Item List. + """ + + resource_name = "ContractTermValuedItem" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.effectiveTime = None + """ Contract Term Valued Item Effective Tiem. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.entityCodeableConcept = None + """ Contract Term Valued Item Type. + 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.factor = None + """ Contract Term Valued Item Price Scaling Factor. + Type `float`. """ + + self.identifier = None + """ Contract Term Valued Item Identifier. + Type `Identifier` (represented as `dict` in JSON). """ + + self.net = None + """ Total Contract Term Valued Item Value. + Type `Quantity` referencing `Money` (represented as `dict` in JSON). """ + + self.points = None + """ Contract Term Valued Item Difficulty Scaling Factor. + Type `float`. """ + + self.quantity = None + """ Contract Term Valued Item Count. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + self.unitPrice = None + """ Contract Term Valued Item fee, charge, or cost. + Type `Quantity` referencing `Money` (represented as `dict` in JSON). """ + + super(ContractTermValuedItem, self).__init__(jsondict) + + def elementProperties(self): + js = super(ContractTermValuedItem, 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", quantity.Quantity, False, None, False), + ("points", "points", float, False, None, False), + ("quantity", "quantity", quantity.Quantity, False, None, False), + ("unitPrice", "unitPrice", quantity.Quantity, False, None, False), + ]) + return js + + +class ContractValuedItem(backboneelement.BackboneElement): + """ Contract Valued Item. + + Contract Valued Item List. + """ + + resource_name = "ContractValuedItem" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.effectiveTime = None + """ Contract Valued Item Effective Tiem. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.entityCodeableConcept = None + """ Contract Valued Item Type. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.entityReference = None + """ Contract Valued Item Type. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.factor = None + """ Contract Valued Item Price Scaling Factor. + Type `float`. """ + + self.identifier = None + """ Contract Valued Item Identifier. + Type `Identifier` (represented as `dict` in JSON). """ + + self.net = None + """ Total Contract Valued Item Value. + Type `Quantity` referencing `Money` (represented as `dict` in JSON). """ + + self.points = None + """ Contract Valued Item Difficulty Scaling Factor. + Type `float`. """ + + self.quantity = None + """ Count of Contract Valued Items. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + self.unitPrice = None + """ Contract Valued Item fee, charge, or cost. + Type `Quantity` referencing `Money` (represented as `dict` in JSON). """ + + super(ContractValuedItem, self).__init__(jsondict) + + def elementProperties(self): + js = super(ContractValuedItem, 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", quantity.Quantity, False, None, False), + ("points", "points", float, False, None, False), + ("quantity", "quantity", quantity.Quantity, False, None, False), + ("unitPrice", "unitPrice", quantity.Quantity, False, None, False), + ]) + return js + + +from . import attachment +from . import codeableconcept +from . import coding +from . import fhirdate +from . import fhirreference +from . import identifier +from . import period +from . import quantity diff --git a/fhirclient/models/DSTU2/contract_tests.py b/fhirclient/models/DSTU2/contract_tests.py new file mode 100644 index 000000000..dd4140a2f --- /dev/null +++ b/fhirclient/models/DSTU2/contract_tests.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import contract +from .fhirdate import FHIRDate + + +class ContractTests(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("Contract", js["resourceType"]) + return contract.Contract(js) + + def testContract1(self): + inst = self.instantiate_from("contract-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Contract instance") + self.implContract1(inst) + + js = inst.as_json() + self.assertEqual("Contract", js["resourceType"]) + inst2 = contract.Contract(js) + self.implContract1(inst2) + + def implContract1(self, inst): + self.assertEqual(inst.id, "C-123") + self.assertEqual(inst.text.div, "
A human-readable rendering of the contract
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/count.py b/fhirclient/models/DSTU2/count.py new file mode 100644 index 000000000..8a12f9705 --- /dev/null +++ b/fhirclient/models/DSTU2/count.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Count) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import quantity + +class Count(quantity.Quantity): + """ A count of a discrete element (no unit). + + There SHALL be a code with a value of "1" if there is a value and it SHALL + be an expression of length. If system is present, it SHALL be UCUM. If + present, the value SHALL a whole number. + """ + + resource_name = "Count" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + super(Count, self).__init__(jsondict) + + diff --git a/fhirclient/models/DSTU2/coverage.py b/fhirclient/models/DSTU2/coverage.py new file mode 100644 index 000000000..8e0c8ceb7 --- /dev/null +++ b/fhirclient/models/DSTU2/coverage.py @@ -0,0 +1,105 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Coverage) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Coverage(domainresource.DomainResource): + """ Insurance or medical plan. + + Financial instrument which may be used to pay for or reimburse health care + products and services. + """ + + resource_name = "Coverage" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.bin = None + """ BIN Number. + Type `Identifier` (represented as `dict` in JSON). """ + + self.contract = None + """ Contract details. + List of `FHIRReference` items referencing `Contract` (represented as `dict` in JSON). """ + + self.dependent = None + """ The dependent number. + Type `int`. """ + + self.group = None + """ An identifier for the group. + Type `str`. """ + + self.identifier = None + """ The primary coverage ID. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.issuer = None + """ An identifier for the plan issuer. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.network = None + """ Insurer network. + Type `Identifier` (represented as `dict` in JSON). """ + + self.period = None + """ Coverage start and end dates. + Type `Period` (represented as `dict` in JSON). """ + + self.plan = None + """ An identifier for the plan. + Type `str`. """ + + self.sequence = None + """ The plan instance or sequence counter. + Type `int`. """ + + self.subPlan = None + """ An identifier for the subsection of the plan. + Type `str`. """ + + self.subscriber = None + """ Plan holder information. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.subscriberId = None + """ Subscriber ID. + Type `Identifier` (represented as `dict` in JSON). """ + + self.type = None + """ Type of coverage. + Type `Coding` (represented as `dict` in JSON). """ + + super(Coverage, self).__init__(jsondict) + + def elementProperties(self): + js = super(Coverage, self).elementProperties() + js.extend([ + ("bin", "bin", identifier.Identifier, False, None, False), + ("contract", "contract", fhirreference.FHIRReference, True, None, False), + ("dependent", "dependent", int, False, None, False), + ("group", "group", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("issuer", "issuer", fhirreference.FHIRReference, False, None, False), + ("network", "network", identifier.Identifier, False, None, False), + ("period", "period", period.Period, False, None, False), + ("plan", "plan", str, False, None, False), + ("sequence", "sequence", int, False, None, False), + ("subPlan", "subPlan", str, False, None, False), + ("subscriber", "subscriber", fhirreference.FHIRReference, False, None, False), + ("subscriberId", "subscriberId", identifier.Identifier, False, None, False), + ("type", "type", coding.Coding, False, None, False), + ]) + return js + + +from . import coding +from . import fhirreference +from . import identifier +from . import period diff --git a/fhirclient/models/DSTU2/coverage_tests.py b/fhirclient/models/DSTU2/coverage_tests.py new file mode 100644 index 000000000..b154fda7e --- /dev/null +++ b/fhirclient/models/DSTU2/coverage_tests.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import coverage +from .fhirdate import FHIRDate + + +class CoverageTests(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("Coverage", js["resourceType"]) + return coverage.Coverage(js) + + def testCoverage1(self): + inst = self.instantiate_from("coverage-example-2.json") + self.assertIsNotNone(inst, "Must have instantiated a Coverage instance") + self.implCoverage1(inst) + + js = inst.as_json() + self.assertEqual("Coverage", js["resourceType"]) + inst2 = coverage.Coverage(js) + self.implCoverage1(inst2) + + def implCoverage1(self, inst): + self.assertEqual(inst.dependent, 1) + self.assertEqual(inst.id, "7546D") + self.assertEqual(inst.identifier[0].system, "http://xyz.com/codes/identifier") + self.assertEqual(inst.identifier[0].value, "AB9876") + self.assertEqual(inst.period.end.date, FHIRDate("2012-03-17").date) + self.assertEqual(inst.period.end.as_json(), "2012-03-17") + self.assertEqual(inst.period.start.date, FHIRDate("2011-03-17").date) + self.assertEqual(inst.period.start.as_json(), "2011-03-17") + self.assertEqual(inst.plan, "11024") + self.assertEqual(inst.subPlan, "D15C9") + self.assertEqual(inst.text.div, "
A human-readable rendering of the coverage
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.code, "EHCPOL") + self.assertEqual(inst.type.display, "extended healthcare") + self.assertEqual(inst.type.system, "http://hl7.org/fhir/v3/ActCode") + + def testCoverage2(self): + inst = self.instantiate_from("coverage-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Coverage instance") + self.implCoverage2(inst) + + js = inst.as_json() + self.assertEqual("Coverage", js["resourceType"]) + inst2 = coverage.Coverage(js) + self.implCoverage2(inst2) + + def implCoverage2(self, inst): + self.assertEqual(inst.dependent, 1) + 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.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.plan, "CBI35") + self.assertEqual(inst.sequence, 1) + self.assertEqual(inst.subPlan, "123") + self.assertEqual(inst.text.div, "
A human-readable rendering of the coverage
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.code, "EHCPOL") + self.assertEqual(inst.type.display, "extended healthcare") + self.assertEqual(inst.type.system, "http://hl7.org/fhir/v3/ActCode") + diff --git a/fhirclient/models/DSTU2/dataelement.py b/fhirclient/models/DSTU2/dataelement.py new file mode 100644 index 000000000..7415360ca --- /dev/null +++ b/fhirclient/models/DSTU2/dataelement.py @@ -0,0 +1,182 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DataElement) on 2019-10-12. +# 2019, 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_name = "DataElement" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.contact = None + """ Contact details of the publisher. + List of `DataElementContact` items (represented as `dict` in JSON). """ + + self.copyright = None + """ Use and/or publishing restrictions. + Type `str`. """ + + self.date = None + """ Date for this version of the data element. + 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 + """ If for testing purposes, not real usage. + Type `bool`. """ + + self.identifier = None + """ Logical id to reference this data element. + List of `Identifier` 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 + """ Descriptive label for this element definition. + Type `str`. """ + + self.publisher = None + """ Name of the publisher (Organization or individual). + Type `str`. """ + + self.status = None + """ draft | active | retired. + Type `str`. """ + + self.stringency = None + """ comparable | fully-specified | equivalent | convertable | scaleable + | flexible. + Type `str`. """ + + self.url = None + """ Globally unique logical id for data element. + Type `str`. """ + + self.useContext = None + """ Content intends to support these contexts. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.version = None + """ Logical id for this version of the data element. + Type `str`. """ + + super(DataElement, self).__init__(jsondict) + + def elementProperties(self): + js = super(DataElement, self).elementProperties() + js.extend([ + ("contact", "contact", DataElementContact, 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), + ("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), + ("url", "url", str, False, None, False), + ("useContext", "useContext", codeableconcept.CodeableConcept, True, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class DataElementContact(backboneelement.BackboneElement): + """ Contact details of the publisher. + + Contacts to assist a user in finding and communicating with the publisher. + """ + + resource_name = "DataElementContact" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.name = None + """ Name of a individual to contact. + Type `str`. """ + + self.telecom = None + """ Contact details for individual or publisher. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(DataElementContact, self).__init__(jsondict) + + def elementProperties(self): + js = super(DataElementContact, self).elementProperties() + js.extend([ + ("name", "name", str, False, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ]) + return js + + +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_name = "DataElementMapping" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.comments = 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) + + def elementProperties(self): + js = super(DataElementMapping, self).elementProperties() + js.extend([ + ("comments", "comments", str, False, None, False), + ("identity", "identity", str, False, None, True), + ("name", "name", str, False, None, False), + ("uri", "uri", str, False, None, False), + ]) + return js + + +from . import codeableconcept +from . import contactpoint +from . import elementdefinition +from . import fhirdate +from . import identifier diff --git a/fhirclient/models/DSTU2/dataelement_tests.py b/fhirclient/models/DSTU2/dataelement_tests.py new file mode 100644 index 000000000..531cd2461 --- /dev/null +++ b/fhirclient/models/DSTU2/dataelement_tests.py @@ -0,0 +1,115 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +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.element[0].binding.strength, "required") + 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].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.name, "Gender Code") + self.assertEqual(inst.publisher, "DCP") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.useContext[0].coding[0].display, "FBPP Pooled Database") + self.assertEqual(inst.useContext[0].coding[0].system, "http://example.org/FBPP") + self.assertEqual(inst.useContext[0].coding[1].display, "Demographics") + self.assertEqual(inst.useContext[0].coding[1].system, "http://example.org/PhenX") + self.assertEqual(inst.useContext[0].coding[2].display, "Pt. Administrative") + self.assertEqual(inst.useContext[0].coding[2].system, "http://example.org/EligibilityCriteria") + self.assertEqual(inst.useContext[0].coding[3].display, "UAMS New CDEs") + self.assertEqual(inst.useContext[0].coding[3].system, "http://example.org/UAMSClinicalResearch") + self.assertEqual(inst.useContext[0].coding[4].display, "Substance Abuse and ") + self.assertEqual(inst.useContext[0].coding[4].system, "http://example.org/PhenX") + self.assertEqual(inst.useContext[0].coding[5].display, "CSAERS Adverse Event") + self.assertEqual(inst.useContext[0].coding[5].system, "http://example.org/Category") + self.assertEqual(inst.useContext[0].coding[6].display, "Core: Tier 1") + self.assertEqual(inst.useContext[0].coding[6].system, "http://example.org/PhenX") + self.assertEqual(inst.useContext[0].coding[7].display, "Case Report Forms") + self.assertEqual(inst.useContext[0].coding[7].system, "http://example.org/Category") + self.assertEqual(inst.useContext[0].coding[8].display, "CSAERS Review Set") + self.assertEqual(inst.useContext[0].coding[8].system, "http://example.org/Category") + self.assertEqual(inst.useContext[0].coding[9].display, "CIAF") + self.assertEqual(inst.useContext[0].coding[9].system, "http://example.org/Demonstration%20Applications") + 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].comments, "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].exampleDecimal, 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].comments, "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/DSTU2/detectedissue.py b/fhirclient/models/DSTU2/detectedissue.py new file mode 100644 index 000000000..7bed31d73 --- /dev/null +++ b/fhirclient/models/DSTU2/detectedissue.py @@ -0,0 +1,128 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DetectedIssue) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class DetectedIssue(domainresource.DomainResource): + """ Clinical issue with action. + + Indicates an actual or potential clinical issue with or between one or more + active or proposed clinical actions for a patient; e.g. Drug-drug + interaction, Ineffective treatment frequency, Procedure-condition conflict, + etc. + """ + + resource_name = "DetectedIssue" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.author = None + """ The provider or device that identified the issue. + Type `FHIRReference` referencing `Practitioner, Device` (represented as `dict` in JSON). """ + + self.category = 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.identifier = None + """ Unique id for the detected issue. + Type `Identifier` (represented as `dict` in JSON). """ + + self.implicated = None + """ Problem resource. + List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + + self.mitigation = None + """ Step taken to address. + List of `DetectedIssueMitigation` items (represented as `dict` in JSON). """ + + self.patient = None + """ Associated patient. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.reference = None + """ Authority for issue. + Type `str`. """ + + self.severity = None + """ high | moderate | low. + Type `str`. """ + + super(DetectedIssue, self).__init__(jsondict) + + 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), + ("detail", "detail", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("implicated", "implicated", fhirreference.FHIRReference, True, None, False), + ("mitigation", "mitigation", DetectedIssueMitigation, True, None, False), + ("patient", "patient", fhirreference.FHIRReference, False, None, False), + ("reference", "reference", str, False, None, False), + ("severity", "severity", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class DetectedIssueMitigation(backboneelement.BackboneElement): + """ Step taken to address. + + Indicates an action that has been taken or is committed to 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. + """ + + resource_name = "DetectedIssueMitigation" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.action = None + """ What mitigation?. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.author = None + """ Who is committing?. + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + self.date = None + """ Date committed. + Type `FHIRDate` (represented as `str` in JSON). """ + + super(DetectedIssueMitigation, self).__init__(jsondict) + + def elementProperties(self): + js = super(DetectedIssueMitigation, self).elementProperties() + js.extend([ + ("action", "action", codeableconcept.CodeableConcept, False, None, True), + ("author", "author", fhirreference.FHIRReference, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ]) + return js + + +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier diff --git a/fhirclient/models/DSTU2/detectedissue_tests.py b/fhirclient/models/DSTU2/detectedissue_tests.py new file mode 100644 index 000000000..59d9d6bdc --- /dev/null +++ b/fhirclient/models/DSTU2/detectedissue_tests.py @@ -0,0 +1,99 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import detectedissue +from .fhirdate import FHIRDate + + +class DetectedIssueTests(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("DetectedIssue", js["resourceType"]) + return detectedissue.DetectedIssue(js) + + def testDetectedIssue1(self): + inst = self.instantiate_from("detectedissue-example-allergy.json") + self.assertIsNotNone(inst, "Must have instantiated a DetectedIssue instance") + self.implDetectedIssue1(inst) + + js = inst.as_json() + self.assertEqual("DetectedIssue", js["resourceType"]) + inst2 = detectedissue.DetectedIssue(js) + self.implDetectedIssue1(inst2) + + def implDetectedIssue1(self, inst): + self.assertEqual(inst.id, "allergy") + self.assertEqual(inst.text.div, "
[Put rendering here]
") + self.assertEqual(inst.text.status, "generated") + + def testDetectedIssue2(self): + inst = self.instantiate_from("detectedissue-example-dup.json") + self.assertIsNotNone(inst, "Must have instantiated a DetectedIssue instance") + self.implDetectedIssue2(inst) + + js = inst.as_json() + self.assertEqual("DetectedIssue", js["resourceType"]) + inst2 = detectedissue.DetectedIssue(js) + 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.detail, "Similar test was performed within the past 14 days") + self.assertEqual(inst.id, "duplicate") + self.assertEqual(inst.text.status, "generated") + + def testDetectedIssue3(self): + inst = self.instantiate_from("detectedissue-example.json") + self.assertIsNotNone(inst, "Must have instantiated a DetectedIssue instance") + self.implDetectedIssue3(inst) + + js = inst.as_json() + self.assertEqual("DetectedIssue", js["resourceType"]) + inst2 = detectedissue.DetectedIssue(js) + self.implDetectedIssue3(inst2) + + def implDetectedIssue3(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.text.status, "generated") + + def testDetectedIssue4(self): + inst = self.instantiate_from("detectedissue-example-lab.json") + self.assertIsNotNone(inst, "Must have instantiated a DetectedIssue instance") + self.implDetectedIssue4(inst) + + js = inst.as_json() + self.assertEqual("DetectedIssue", js["resourceType"]) + inst2 = detectedissue.DetectedIssue(js) + self.implDetectedIssue4(inst2) + + def implDetectedIssue4(self, inst): + self.assertEqual(inst.id, "lab") + self.assertEqual(inst.text.div, "
[Put rendering here]
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/device.py b/fhirclient/models/DSTU2/device.py new file mode 100644 index 000000000..214d344d1 --- /dev/null +++ b/fhirclient/models/DSTU2/device.py @@ -0,0 +1,123 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Device) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Device(domainresource.DomainResource): + """ An instance of a manufactured te that is used in the provision of + healthcare. + + This resource identifies an instance 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 includes 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. + """ + + resource_name = "Device" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.contact = None + """ Details for human/organization for support. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + self.expiry = None + """ Date and time of expiry of this device (if applicable). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.identifier = None + """ Instance id from manufacturer, owner, and others. + 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). """ + + self.lotNumber = None + """ Lot number of manufacture. + Type `str`. """ + + self.manufactureDate = None + """ Manufacture date. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.manufacturer = None + """ Name of device manufacturer. + Type `str`. """ + + self.model = None + """ Model id assigned by the manufacturer. + Type `str`. """ + + self.note = None + """ Device notes and comments. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.owner = None + """ Organization responsible for device. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.patient = None + """ If the resource is affixed to a person. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.status = None + """ available | not-available | entered-in-error. + Type `str`. """ + + self.type = None + """ What kind of device this is. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.udi = None + """ FDA mandated Unique Device Identifier. + Type `str`. """ + + self.url = None + """ Network address to contact device. + Type `str`. """ + + self.version = None + """ Version number (i.e. software). + Type `str`. """ + + super(Device, self).__init__(jsondict) + + def elementProperties(self): + js = super(Device, self).elementProperties() + js.extend([ + ("contact", "contact", contactpoint.ContactPoint, True, None, False), + ("expiry", "expiry", 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), + ("note", "note", annotation.Annotation, True, None, False), + ("owner", "owner", fhirreference.FHIRReference, False, None, False), + ("patient", "patient", fhirreference.FHIRReference, False, None, False), + ("status", "status", str, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ("udi", "udi", str, False, None, False), + ("url", "url", str, False, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + +from . import annotation +from . import codeableconcept +from . import contactpoint +from . import fhirdate +from . import fhirreference +from . import identifier diff --git a/fhirclient/models/DSTU2/device_tests.py b/fhirclient/models/DSTU2/device_tests.py new file mode 100644 index 000000000..eec8d3261 --- /dev/null +++ b/fhirclient/models/DSTU2/device_tests.py @@ -0,0 +1,149 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import device +from .fhirdate import FHIRDate + + +class DeviceTests(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("Device", js["resourceType"]) + return device.Device(js) + + def testDevice1(self): + inst = self.instantiate_from("device-example-software.json") + self.assertIsNotNone(inst, "Must have instantiated a Device instance") + self.implDevice1(inst) + + js = inst.as_json() + self.assertEqual("Device", js["resourceType"]) + inst2 = device.Device(js) + self.implDevice1(inst2) + + def implDevice1(self, inst): + self.assertEqual(inst.contact[0].system, "other") + 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 testDevice2(self): + inst = self.instantiate_from("device-example-f001-feedingtube.json") + self.assertIsNotNone(inst, "Must have instantiated a Device instance") + self.implDevice2(inst) + + js = inst.as_json() + self.assertEqual("Device", js["resourceType"]) + inst2 = device.Device(js) + self.implDevice2(inst2) + + def implDevice2(self, inst): + self.assertEqual(inst.expiry.date, FHIRDate("2020-08-08").date) + self.assertEqual(inst.expiry.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.status, "available") + 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") + self.assertEqual(inst.udi, "(01)00000123000017(10)ABC123(17)120415") + + 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-ihe-pcd.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.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 testDevice5(self): + inst = self.instantiate_from("device-example.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.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, "available") + 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/DSTU2/devicecomponent.py b/fhirclient/models/DSTU2/devicecomponent.py new file mode 100644 index 000000000..04ec2fbc6 --- /dev/null +++ b/fhirclient/models/DSTU2/devicecomponent.py @@ -0,0 +1,126 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DeviceComponent) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class DeviceComponent(domainresource.DomainResource): + """ An instance of a medical-related component of a medical device. + + Describes the characteristics, operational status and capabilities of a + medical-related component of a medical device. + """ + + resource_name = "DeviceComponent" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + 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 + """ Component operational status. + 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 + """ Production specification of the component. + List of `DeviceComponentProductionSpecification` items (represented as `dict` in JSON). """ + + self.source = None + """ A source device of this component. + 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) + + 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, True), + ("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): + """ Production specification of the component. + + Describes the production specification such as component revision, serial + number, etc. + """ + + resource_name = "DeviceComponentProductionSpecification" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + 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 + """ Specification type. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(DeviceComponentProductionSpecification, self).__init__(jsondict) + + 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 + + +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier diff --git a/fhirclient/models/DSTU2/devicecomponent_tests.py b/fhirclient/models/DSTU2/devicecomponent_tests.py new file mode 100644 index 000000000..090e15d9a --- /dev/null +++ b/fhirclient/models/DSTU2/devicecomponent_tests.py @@ -0,0 +1,89 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +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.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.contained[0].id, "d1") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier.type.text, "Handle ID") + 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.operationalStatus[0].coding[0].code, "0") + self.assertEqual(inst.operationalStatus[0].coding[0].display, "disconnected") + self.assertEqual(inst.operationalStatus[0].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") + + def testDeviceComponent2(self): + inst = self.instantiate_from("devicecomponent-example-prodspec.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.contained[0].id, "d1") + self.assertEqual(inst.id, "example-prodspec") + self.assertEqual(inst.identifier.type.text, "Handle ID") + 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.operationalStatus[0].coding[0].code, "0") + self.assertEqual(inst.operationalStatus[0].coding[0].display, "disconnected") + self.assertEqual(inst.operationalStatus[0].coding[0].system, "urn:iso:std:iso:11073:10101") + self.assertEqual(inst.productionSpecification[0].productionSpec, "xa-12324-b") + self.assertEqual(inst.productionSpecification[0].specType.coding[0].code, "1") + 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, "3") + self.assertEqual(inst.productionSpecification[1].specType.coding[0].display, "Hardware version") + self.assertEqual(inst.productionSpecification[2].productionSpec, "1.12") + self.assertEqual(inst.productionSpecification[2].specType.coding[0].code, "4") + self.assertEqual(inst.productionSpecification[2].specType.coding[0].display, "Software version") + self.assertEqual(inst.productionSpecification[3].productionSpec, "1.0.23") + self.assertEqual(inst.productionSpecification[3].specType.coding[0].code, "5") + self.assertEqual(inst.productionSpecification[3].specType.coding[0].display, "Firmware version") + 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/DSTU2/devicemetric.py b/fhirclient/models/DSTU2/devicemetric.py new file mode 100644 index 000000000..65428b213 --- /dev/null +++ b/fhirclient/models/DSTU2/devicemetric.py @@ -0,0 +1,124 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DeviceMetric) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class DeviceMetric(domainresource.DomainResource): + """ Measurement, calculation or setting capability of a medical device. + + Describes a measurement, calculation or setting capability of a medical + device. + """ + + resource_name = "DeviceMetric" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.calibration = None + """ Describes the calibrations that have been performed or that are + required to be performed. + List of `DeviceMetricCalibration` items (represented as `dict` in JSON). """ + + self.category = None + """ measurement | setting | calculation | unspecified. + Type `str`. """ + + self.color = None + """ black | red | green | yellow | blue | magenta | cyan | white. + Type `str`. """ + + self.identifier = None + """ Unique identifier of this DeviceMetric. + Type `Identifier` (represented as `dict` in JSON). """ + + self.measurementPeriod = None + """ Describes the measurement repetition time. + Type `Timing` (represented as `dict` in JSON). """ + + self.operationalStatus = None + """ on | off | standby. + Type `str`. """ + + self.parent = None + """ Describes the link to the parent DeviceComponent. + Type `FHIRReference` referencing `DeviceComponent` (represented as `dict` in JSON). """ + + self.source = None + """ Describes the link to the source Device. + Type `FHIRReference` referencing `Device` (represented as `dict` in JSON). """ + + self.type = None + """ Type of metric. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.unit = None + """ Unit of metric. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(DeviceMetric, self).__init__(jsondict) + + def elementProperties(self): + js = super(DeviceMetric, self).elementProperties() + js.extend([ + ("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), + ("measurementPeriod", "measurementPeriod", timing.Timing, False, None, False), + ("operationalStatus", "operationalStatus", str, False, None, False), + ("parent", "parent", fhirreference.FHIRReference, False, None, False), + ("source", "source", fhirreference.FHIRReference, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ("unit", "unit", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import backboneelement + +class DeviceMetricCalibration(backboneelement.BackboneElement): + """ Describes the calibrations that have been performed or that are required to + be performed. + """ + + resource_name = "DeviceMetricCalibration" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.state = None + """ not-calibrated | calibration-required | calibrated | unspecified. + Type `str`. """ + + self.time = None + """ Describes the time last calibration has been performed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.type = None + """ unspecified | offset | gain | two-point. + Type `str`. """ + + super(DeviceMetricCalibration, self).__init__(jsondict) + + def elementProperties(self): + js = super(DeviceMetricCalibration, self).elementProperties() + js.extend([ + ("state", "state", str, False, None, False), + ("time", "time", fhirdate.FHIRDate, False, None, False), + ("type", "type", str, False, None, False), + ]) + return js + + +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier +from . import timing diff --git a/fhirclient/models/DSTU2/devicemetric_tests.py b/fhirclient/models/DSTU2/devicemetric_tests.py new file mode 100644 index 000000000..4cacf7bca --- /dev/null +++ b/fhirclient/models/DSTU2/devicemetric_tests.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import devicemetric +from .fhirdate import FHIRDate + + +class DeviceMetricTests(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("DeviceMetric", js["resourceType"]) + return devicemetric.DeviceMetric(js) + + def testDeviceMetric1(self): + inst = self.instantiate_from("devicemetric-example.json") + self.assertIsNotNone(inst, "Must have instantiated a DeviceMetric instance") + self.implDeviceMetric1(inst) + + js = inst.as_json() + self.assertEqual("DeviceMetric", js["resourceType"]) + inst2 = devicemetric.DeviceMetric(js) + self.implDeviceMetric1(inst2) + + def implDeviceMetric1(self, inst): + self.assertEqual(inst.category, "measurement") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier.system, "http://goodcare.org/devicemetric/id") + self.assertEqual(inst.identifier.value, "345675") + 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.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") + diff --git a/fhirclient/models/DSTU2/deviceuserequest.py b/fhirclient/models/DSTU2/deviceuserequest.py new file mode 100644 index 000000000..d0354c08c --- /dev/null +++ b/fhirclient/models/DSTU2/deviceuserequest.py @@ -0,0 +1,119 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DeviceUseRequest) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class DeviceUseRequest(domainresource.DomainResource): + """ A request for a patient to use or be given a medical device. + + Represents a request for a patient to employ a medical device. The device + may be an implantable device, or an external assistive device, such as a + walker. + """ + + resource_name = "DeviceUseRequest" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.bodySiteCodeableConcept = None + """ Target body site. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.bodySiteReference = None + """ Target body site. + Type `FHIRReference` referencing `BodySite` (represented as `dict` in JSON). """ + + self.device = None + """ Device requested. + Type `FHIRReference` referencing `Device` (represented as `dict` in JSON). """ + + self.encounter = None + """ Encounter motivating request. + Type `FHIRReference` referencing `Encounter` (represented as `dict` in JSON). """ + + self.identifier = None + """ Request identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.indication = None + """ Reason for request. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.notes = None + """ Notes or comments. + List of `str` items. """ + + self.orderedOn = None + """ When ordered. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.priority = None + """ routine | urgent | stat | asap. + Type `str`. """ + + self.prnReason = None + """ PRN. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.recordedOn = None + """ When recorded. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.status = None + """ proposed | planned | requested | received | accepted | in-progress + | completed | suspended | rejected | aborted. + Type `str`. """ + + self.subject = None + """ Focus of request. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.timingDateTime = None + """ Schedule for use. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.timingPeriod = None + """ Schedule for use. + Type `Period` (represented as `dict` in JSON). """ + + self.timingTiming = None + """ Schedule for use. + Type `Timing` (represented as `dict` in JSON). """ + + super(DeviceUseRequest, self).__init__(jsondict) + + def elementProperties(self): + js = super(DeviceUseRequest, self).elementProperties() + js.extend([ + ("bodySiteCodeableConcept", "bodySiteCodeableConcept", codeableconcept.CodeableConcept, False, "bodySite", False), + ("bodySiteReference", "bodySiteReference", fhirreference.FHIRReference, False, "bodySite", False), + ("device", "device", fhirreference.FHIRReference, False, None, True), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("indication", "indication", codeableconcept.CodeableConcept, True, None, False), + ("notes", "notes", str, True, None, False), + ("orderedOn", "orderedOn", fhirdate.FHIRDate, False, None, False), + ("priority", "priority", str, False, None, False), + ("prnReason", "prnReason", codeableconcept.CodeableConcept, True, None, False), + ("recordedOn", "recordedOn", fhirdate.FHIRDate, False, None, False), + ("status", "status", str, False, None, False), + ("subject", "subject", fhirreference.FHIRReference, False, None, True), + ("timingDateTime", "timingDateTime", fhirdate.FHIRDate, False, "timing", False), + ("timingPeriod", "timingPeriod", period.Period, False, "timing", False), + ("timingTiming", "timingTiming", timing.Timing, False, "timing", False), + ]) + return js + + +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier +from . import period +from . import timing diff --git a/fhirclient/models/DSTU2/deviceuserequest_tests.py b/fhirclient/models/DSTU2/deviceuserequest_tests.py new file mode 100644 index 000000000..cbacb9eba --- /dev/null +++ b/fhirclient/models/DSTU2/deviceuserequest_tests.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import deviceuserequest +from .fhirdate import FHIRDate + + +class DeviceUseRequestTests(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("DeviceUseRequest", js["resourceType"]) + return deviceuserequest.DeviceUseRequest(js) + + def testDeviceUseRequest1(self): + inst = self.instantiate_from("deviceuserequest-example.json") + self.assertIsNotNone(inst, "Must have instantiated a DeviceUseRequest instance") + self.implDeviceUseRequest1(inst) + + js = inst.as_json() + self.assertEqual("DeviceUseRequest", js["resourceType"]) + inst2 = deviceuserequest.DeviceUseRequest(js) + self.implDeviceUseRequest1(inst2) + + def implDeviceUseRequest1(self, inst): + self.assertEqual(inst.id, "example") + self.assertEqual(inst.text.div, "
To be filled out at a later time
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/deviceusestatement.py b/fhirclient/models/DSTU2/deviceusestatement.py new file mode 100644 index 000000000..a18212169 --- /dev/null +++ b/fhirclient/models/DSTU2/deviceusestatement.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DeviceUseStatement) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class DeviceUseStatement(domainresource.DomainResource): + """ None. + + A record of a device being used by a patient where the record is the result + of a report from the patient or another clinician. + """ + + resource_name = "DeviceUseStatement" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.bodySiteCodeableConcept = None + """ Target body site. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.bodySiteReference = None + """ Target body site. + Type `FHIRReference` referencing `BodySite` (represented as `dict` in JSON). """ + + self.device = None + """ None. + Type `FHIRReference` referencing `Device` (represented as `dict` in JSON). """ + + self.identifier = None + """ None. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.indication = None + """ None. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.notes = None + """ None. + List of `str` items. """ + + self.recordedOn = None + """ None. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.subject = None + """ None. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.timingDateTime = None + """ None. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.timingPeriod = None + """ None. + Type `Period` (represented as `dict` in JSON). """ + + self.timingTiming = None + """ None. + Type `Timing` (represented as `dict` in JSON). """ + + self.whenUsed = None + """ None. + Type `Period` (represented as `dict` in JSON). """ + + super(DeviceUseStatement, self).__init__(jsondict) + + def elementProperties(self): + js = super(DeviceUseStatement, self).elementProperties() + js.extend([ + ("bodySiteCodeableConcept", "bodySiteCodeableConcept", codeableconcept.CodeableConcept, False, "bodySite", False), + ("bodySiteReference", "bodySiteReference", fhirreference.FHIRReference, False, "bodySite", False), + ("device", "device", fhirreference.FHIRReference, False, None, True), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("indication", "indication", codeableconcept.CodeableConcept, True, None, False), + ("notes", "notes", str, True, None, False), + ("recordedOn", "recordedOn", fhirdate.FHIRDate, False, None, False), + ("subject", "subject", fhirreference.FHIRReference, False, None, True), + ("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 + + +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier +from . import period +from . import timing diff --git a/fhirclient/models/DSTU2/deviceusestatement_tests.py b/fhirclient/models/DSTU2/deviceusestatement_tests.py new file mode 100644 index 000000000..f4ae50bc0 --- /dev/null +++ b/fhirclient/models/DSTU2/deviceusestatement_tests.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import deviceusestatement +from .fhirdate import FHIRDate + + +class DeviceUseStatementTests(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("DeviceUseStatement", js["resourceType"]) + return deviceusestatement.DeviceUseStatement(js) + + def testDeviceUseStatement1(self): + inst = self.instantiate_from("deviceusestatement-example.json") + self.assertIsNotNone(inst, "Must have instantiated a DeviceUseStatement instance") + self.implDeviceUseStatement1(inst) + + js = inst.as_json() + self.assertEqual("DeviceUseStatement", js["resourceType"]) + inst2 = deviceusestatement.DeviceUseStatement(js) + self.implDeviceUseStatement1(inst2) + + def implDeviceUseStatement1(self, inst): + self.assertEqual(inst.id, "example") + self.assertEqual(inst.text.div, "
To be filled out at a later time
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/diagnosticorder.py b/fhirclient/models/DSTU2/diagnosticorder.py new file mode 100644 index 000000000..594ee1371 --- /dev/null +++ b/fhirclient/models/DSTU2/diagnosticorder.py @@ -0,0 +1,195 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DiagnosticOrder) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class DiagnosticOrder(domainresource.DomainResource): + """ A request for a diagnostic service. + + A record of a request for a diagnostic investigation service to be + performed. + """ + + resource_name = "DiagnosticOrder" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.encounter = None + """ The encounter that this diagnostic order is associated with. + Type `FHIRReference` referencing `Encounter` (represented as `dict` in JSON). """ + + self.event = None + """ A list of events of interest in the lifecycle. + List of `DiagnosticOrderEvent` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Identifiers assigned to this order. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.item = None + """ The items the orderer requested. + List of `DiagnosticOrderItem` items (represented as `dict` in JSON). """ + + self.note = None + """ Other notes and comments. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.orderer = None + """ Who ordered the test. + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + self.priority = None + """ routine | urgent | stat | asap. + Type `str`. """ + + self.reason = None + """ Explanation/Justification for test. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.specimen = None + """ If the whole order relates to specific specimens. + List of `FHIRReference` items referencing `Specimen` (represented as `dict` in JSON). """ + + self.status = None + """ proposed | draft | planned | requested | received | accepted | in- + progress | review | completed | cancelled | suspended | rejected | + failed. + Type `str`. """ + + self.subject = None + """ Who and/or what test is about. + Type `FHIRReference` referencing `Patient, Group, Location, Device` (represented as `dict` in JSON). """ + + self.supportingInformation = None + """ Additional clinical information. + List of `FHIRReference` items referencing `Observation, Condition, DocumentReference` (represented as `dict` in JSON). """ + + super(DiagnosticOrder, self).__init__(jsondict) + + def elementProperties(self): + js = super(DiagnosticOrder, self).elementProperties() + js.extend([ + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), + ("event", "event", DiagnosticOrderEvent, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("item", "item", DiagnosticOrderItem, True, None, False), + ("note", "note", annotation.Annotation, True, None, False), + ("orderer", "orderer", fhirreference.FHIRReference, False, None, False), + ("priority", "priority", str, False, None, False), + ("reason", "reason", codeableconcept.CodeableConcept, True, None, False), + ("specimen", "specimen", fhirreference.FHIRReference, True, None, False), + ("status", "status", str, False, None, False), + ("subject", "subject", fhirreference.FHIRReference, False, None, True), + ("supportingInformation", "supportingInformation", fhirreference.FHIRReference, True, None, False), + ]) + return js + + +from . import backboneelement + +class DiagnosticOrderEvent(backboneelement.BackboneElement): + """ A list of events of interest in the lifecycle. + + A summary of the events of interest that have occurred as the request is + processed; e.g. when the order was made, various processing steps + (specimens received), when it was completed. + """ + + resource_name = "DiagnosticOrderEvent" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.actor = None + """ Who recorded or did this. + Type `FHIRReference` referencing `Practitioner, Device` (represented as `dict` in JSON). """ + + self.dateTime = None + """ The date at which the event happened. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ More information about the event and its context. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.status = None + """ proposed | draft | planned | requested | received | accepted | in- + progress | review | completed | cancelled | suspended | rejected | + failed. + Type `str`. """ + + super(DiagnosticOrderEvent, self).__init__(jsondict) + + def elementProperties(self): + js = super(DiagnosticOrderEvent, self).elementProperties() + js.extend([ + ("actor", "actor", fhirreference.FHIRReference, False, None, False), + ("dateTime", "dateTime", fhirdate.FHIRDate, False, None, True), + ("description", "description", codeableconcept.CodeableConcept, False, None, False), + ("status", "status", str, False, None, True), + ]) + return js + + +class DiagnosticOrderItem(backboneelement.BackboneElement): + """ The items the orderer requested. + + The specific diagnostic investigations that are requested as part of this + request. Sometimes, there can only be one item per request, but in most + contexts, more than one investigation can be requested. + """ + + resource_name = "DiagnosticOrderItem" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.bodySite = None + """ Location of requested test (if applicable). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.code = None + """ Code to indicate the item (test or panel) being ordered. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.event = None + """ Events specific to this item. + List of `DiagnosticOrderEvent` items (represented as `dict` in JSON). """ + + self.specimen = None + """ If this item relates to specific specimens. + List of `FHIRReference` items referencing `Specimen` (represented as `dict` in JSON). """ + + self.status = None + """ proposed | draft | planned | requested | received | accepted | in- + progress | review | completed | cancelled | suspended | rejected | + failed. + Type `str`. """ + + super(DiagnosticOrderItem, self).__init__(jsondict) + + def elementProperties(self): + js = super(DiagnosticOrderItem, self).elementProperties() + js.extend([ + ("bodySite", "bodySite", codeableconcept.CodeableConcept, False, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("event", "event", DiagnosticOrderEvent, True, None, False), + ("specimen", "specimen", fhirreference.FHIRReference, True, None, False), + ("status", "status", str, False, None, False), + ]) + return js + + +from . import annotation +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier diff --git a/fhirclient/models/DSTU2/diagnosticorder_tests.py b/fhirclient/models/DSTU2/diagnosticorder_tests.py new file mode 100644 index 000000000..5b10cbaf2 --- /dev/null +++ b/fhirclient/models/DSTU2/diagnosticorder_tests.py @@ -0,0 +1,101 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import diagnosticorder +from .fhirdate import FHIRDate + + +class DiagnosticOrderTests(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("DiagnosticOrder", js["resourceType"]) + return diagnosticorder.DiagnosticOrder(js) + + def testDiagnosticOrder1(self): + inst = self.instantiate_from("diagnosticorder-example.json") + self.assertIsNotNone(inst, "Must have instantiated a DiagnosticOrder instance") + self.implDiagnosticOrder1(inst) + + js = inst.as_json() + self.assertEqual("DiagnosticOrder", js["resourceType"]) + inst2 = diagnosticorder.DiagnosticOrder(js) + self.implDiagnosticOrder1(inst2) + + def implDiagnosticOrder1(self, inst): + self.assertEqual(inst.contained[0].id, "fasting") + self.assertEqual(inst.event[0].dateTime.date, FHIRDate("2013-05-02T16:16:00-07:00").date) + self.assertEqual(inst.event[0].dateTime.as_json(), "2013-05-02T16:16:00-07:00") + self.assertEqual(inst.event[0].status, "requested") + self.assertEqual(inst.id, "example") + 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.item[0].code.coding[0].code, "LIPID") + self.assertEqual(inst.item[0].code.coding[0].system, "http://acme.org/tests") + self.assertEqual(inst.item[0].code.text, "Lipid Panel") + self.assertEqual(inst.note[0].text, "patient is afraid of needles") + self.assertEqual(inst.reason[0].coding[0].code, "V173") + self.assertEqual(inst.reason[0].coding[0].display, "Fam hx-ischem heart dis") + self.assertEqual(inst.reason[0].coding[0].system, "http://hl7.org/fhir/sid/icd-9") + self.assertEqual(inst.status, "received") + self.assertEqual(inst.text.status, "generated") + + def testDiagnosticOrder2(self): + inst = self.instantiate_from("diagnosticorder-example-ft4.json") + self.assertIsNotNone(inst, "Must have instantiated a DiagnosticOrder instance") + self.implDiagnosticOrder2(inst) + + js = inst.as_json() + self.assertEqual("DiagnosticOrder", js["resourceType"]) + inst2 = diagnosticorder.DiagnosticOrder(js) + self.implDiagnosticOrder2(inst2) + + def implDiagnosticOrder2(self, inst): + self.assertEqual(inst.contained[0].id, "rtt") + self.assertEqual(inst.event[0].dateTime.date, FHIRDate("2015-08-27T09:33:27+07:00").date) + self.assertEqual(inst.event[0].dateTime.as_json(), "2015-08-27T09:33:27+07:00") + self.assertEqual(inst.event[0].status, "requested") + self.assertEqual(inst.id, "ft4") + self.assertEqual(inst.item[0].code.coding[0].code, "3024-7") + self.assertEqual(inst.item[0].code.coding[0].system, "http://loinc.org") + self.assertEqual(inst.item[0].code.text, "Free T4") + self.assertEqual(inst.status, "requested") + self.assertEqual(inst.text.status, "generated") + + def testDiagnosticOrder3(self): + inst = self.instantiate_from("diagnosticorder-example-di.json") + self.assertIsNotNone(inst, "Must have instantiated a DiagnosticOrder instance") + self.implDiagnosticOrder3(inst) + + js = inst.as_json() + self.assertEqual("DiagnosticOrder", js["resourceType"]) + inst2 = diagnosticorder.DiagnosticOrder(js) + self.implDiagnosticOrder3(inst2) + + def implDiagnosticOrder3(self, inst): + self.assertEqual(inst.event[0].dateTime.date, FHIRDate("2013-05-08T09:33:27+07:00").date) + self.assertEqual(inst.event[0].dateTime.as_json(), "2013-05-08T09:33:27+07:00") + self.assertEqual(inst.event[0].status, "requested") + self.assertEqual(inst.id, "di") + self.assertEqual(inst.item[0].bodySite.coding[0].code, "51185008") + self.assertEqual(inst.item[0].bodySite.coding[0].display, "Thoracic structure") + self.assertEqual(inst.item[0].bodySite.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.item[0].code.coding[0].code, "24627-2") + self.assertEqual(inst.item[0].code.coding[0].system, "http://loinc.org") + self.assertEqual(inst.item[0].code.text, "Chest CT") + self.assertEqual(inst.reason[0].text, "Check for metastatic disease") + self.assertEqual(inst.status, "requested") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/diagnosticreport.py b/fhirclient/models/DSTU2/diagnosticreport.py new file mode 100644 index 000000000..fde73ea82 --- /dev/null +++ b/fhirclient/models/DSTU2/diagnosticreport.py @@ -0,0 +1,168 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DiagnosticReport) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class DiagnosticReport(domainresource.DomainResource): + """ A Diagnostic report - a combination of request information, atomic results, + images, interpretation, as well as formatted reports. + + The findings and interpretation of diagnostic tests performed on patients, + groups of patients, devices, and locations, and/or specimens derived from + these. The report includes clinical context such as requesting and provider + information, and some mix of atomic results, images, textual and coded + interpretations, and formatted representation of diagnostic reports. + """ + + resource_name = "DiagnosticReport" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.category = None + """ Service category. + Type `CodeableConcept` (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. + Type `str`. """ + + self.effectiveDateTime = None + """ Clinically Relevant time/time-period for report. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.effectivePeriod = None + """ 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` referencing `Encounter` (represented as `dict` in JSON). """ + + self.identifier = None + """ Id for external references to this 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, ImagingObjectSelection` (represented as `dict` in JSON). """ + + self.issued = None + """ DateTime this version was released. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.performer = None + """ Responsible Diagnostic Service. + Type `FHIRReference` referencing `Practitioner, Organization` (represented as `dict` in JSON). """ + + self.presentedForm = None + """ Entire report as issued. + List of `Attachment` items (represented as `dict` in JSON). """ + + self.request = None + """ What was requested. + List of `FHIRReference` items referencing `DiagnosticOrder, ProcedureRequest, ReferralRequest` (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). """ + + self.specimen = None + """ Specimens this report is based on. + List of `FHIRReference` items referencing `Specimen` (represented as `dict` in JSON). """ + + self.status = None + """ registered | partial | final | corrected | appended | cancelled | + entered-in-error. + Type `str`. """ + + 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). """ + + super(DiagnosticReport, self).__init__(jsondict) + + def elementProperties(self): + js = super(DiagnosticReport, self).elementProperties() + js.extend([ + ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("codedDiagnosis", "codedDiagnosis", codeableconcept.CodeableConcept, True, None, False), + ("conclusion", "conclusion", str, False, None, False), + ("effectiveDateTime", "effectiveDateTime", fhirdate.FHIRDate, False, "effective", True), + ("effectivePeriod", "effectivePeriod", period.Period, False, "effective", True), + ("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, True), + ("performer", "performer", fhirreference.FHIRReference, False, None, True), + ("presentedForm", "presentedForm", attachment.Attachment, True, None, False), + ("request", "request", fhirreference.FHIRReference, True, None, False), + ("result", "result", fhirreference.FHIRReference, True, None, False), + ("specimen", "specimen", fhirreference.FHIRReference, True, None, False), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, True), + ]) + return js + + +from . import backboneelement + +class DiagnosticReportImage(backboneelement.BackboneElement): + """ Key images associated with this report. + + A list of key images associated with this report. The images are generally + created during the diagnostic process, and may be directly of the patient, + or of treated specimens (i.e. slides of interest). + """ + + resource_name = "DiagnosticReportImage" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.comment = None + """ Comment about the image (e.g. explanation). + Type `str`. """ + + self.link = None + """ Reference to the image source. + Type `FHIRReference` referencing `Media` (represented as `dict` in JSON). """ + + super(DiagnosticReportImage, self).__init__(jsondict) + + def elementProperties(self): + js = super(DiagnosticReportImage, self).elementProperties() + js.extend([ + ("comment", "comment", str, False, None, False), + ("link", "link", fhirreference.FHIRReference, False, None, True), + ]) + return js + + +from . import attachment +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier +from . import period diff --git a/fhirclient/models/DSTU2/diagnosticreport_tests.py b/fhirclient/models/DSTU2/diagnosticreport_tests.py new file mode 100644 index 000000000..7265886c4 --- /dev/null +++ b/fhirclient/models/DSTU2/diagnosticreport_tests.py @@ -0,0 +1,284 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import diagnosticreport +from .fhirdate import FHIRDate + + +class DiagnosticReportTests(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("DiagnosticReport", js["resourceType"]) + return diagnosticreport.DiagnosticReport(js) + + def testDiagnosticReport1(self): + inst = self.instantiate_from("diagnosticreport-example-f202-bloodculture.json") + self.assertIsNotNone(inst, "Must have instantiated a DiagnosticReport instance") + self.implDiagnosticReport1(inst) + + js = inst.as_json() + self.assertEqual("DiagnosticReport", js["resourceType"]) + inst2 = diagnosticreport.DiagnosticReport(js) + self.implDiagnosticReport1(inst2) + + def implDiagnosticReport1(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.effectiveDateTime.date, FHIRDate("2013-03-11T03:45:00+01:00").date) + self.assertEqual(inst.effectiveDateTime.as_json(), "2013-03-11T03:45:00+01:00") + 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 testDiagnosticReport2(self): + inst = self.instantiate_from("diagnosticreport-example-ghp.json") + self.assertIsNotNone(inst, "Must have instantiated a DiagnosticReport instance") + self.implDiagnosticReport2(inst) + + js = inst.as_json() + self.assertEqual("DiagnosticReport", js["resourceType"]) + inst2 = diagnosticreport.DiagnosticReport(js) + self.implDiagnosticReport2(inst2) + + def implDiagnosticReport2(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") + self.assertEqual(inst.status, "final") + self.assertEqual(inst.text.status, "generated") + + def testDiagnosticReport3(self): + inst = self.instantiate_from("diagnosticreport-example-lipids.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, "HM") + self.assertEqual(inst.category.coding[0].system, "http://hl7.org/fhir/v2/0074") + self.assertEqual(inst.code.coding[0].code, "57698-3") + self.assertEqual(inst.code.coding[0].display, "Lipid panel with direct LDL - 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 testDiagnosticReport4(self): + inst = self.instantiate_from("diagnosticreport-example-f001-bloodexam.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, "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.effectiveDateTime.date, FHIRDate("2013-04-02").date) + self.assertEqual(inst.effectiveDateTime.as_json(), "2013-04-02") + 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 testDiagnosticReport5(self): + inst = self.instantiate_from("diagnosticreport-example-ultrasound.json") + self.assertIsNotNone(inst, "Must have instantiated a DiagnosticReport instance") + self.implDiagnosticReport5(inst) + + js = inst.as_json() + self.assertEqual("DiagnosticReport", js["resourceType"]) + inst2 = diagnosticreport.DiagnosticReport(js) + self.implDiagnosticReport5(inst2) + + def implDiagnosticReport5(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") + self.assertEqual(inst.status, "final") + self.assertEqual(inst.text.status, "generated") + + def testDiagnosticReport6(self): + inst = self.instantiate_from("diagnosticreport-example-f201-brainct.json") + self.assertIsNotNone(inst, "Must have instantiated a DiagnosticReport instance") + self.implDiagnosticReport6(inst) + + js = inst.as_json() + self.assertEqual("DiagnosticReport", js["resourceType"]) + inst2 = diagnosticreport.DiagnosticReport(js) + self.implDiagnosticReport6(inst2) + + def implDiagnosticReport6(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, "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.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.status, "final") + self.assertEqual(inst.text.status, "generated") + + def testDiagnosticReport7(self): + inst = self.instantiate_from("diagnosticreport-example.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, "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.code.coding[1].code, "CBC") + self.assertEqual(inst.code.coding[1].display, "MASTER FULL BLOOD COUNT") + self.assertEqual(inst.code.text, "Complete Blood Count") + self.assertEqual(inst.contained[0].id, "r1") + self.assertEqual(inst.contained[1].id, "r2") + self.assertEqual(inst.contained[2].id, "r3") + self.assertEqual(inst.contained[3].id, "r4") + self.assertEqual(inst.contained[4].id, "r5") + self.assertEqual(inst.contained[5].id, "r6") + self.assertEqual(inst.contained[6].id, "r7") + self.assertEqual(inst.contained[7].id, "r8") + self.assertEqual(inst.contained[8].id, "r9") + self.assertEqual(inst.contained[9].id, "r10") + 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, "101") + self.assertEqual(inst.identifier[0].system, "http://acme.com/lab/reports") + self.assertEqual(inst.identifier[0].value, "5234342") + self.assertEqual(inst.issued.date, FHIRDate("2011-03-04T11:45:33+11:00").date) + self.assertEqual(inst.issued.as_json(), "2011-03-04T11:45:33+11:00") + self.assertEqual(inst.presentedForm[0].contentType, "application/pdf") + self.assertEqual(inst.presentedForm[0].language, "en-AU") + self.assertEqual(inst.presentedForm[0].title, "HTML Report") + self.assertEqual(inst.status, "final") + self.assertEqual(inst.text.status, "generated") + + def testDiagnosticReport8(self): + inst = self.instantiate_from("diagnosticreport-example-dxa.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, "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.contained[0].id, "r1") + 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.status, "final") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/distance.py b/fhirclient/models/DSTU2/distance.py new file mode 100644 index 000000000..e7309e732 --- /dev/null +++ b/fhirclient/models/DSTU2/distance.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Distance) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import quantity + +class Distance(quantity.Quantity): + """ A measure of distance. + + There SHALL be a code if there is a value and it SHALL be an expression of + length. If system is present, it SHALL be UCUM. + """ + + resource_name = "Distance" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + super(Distance, self).__init__(jsondict) + + diff --git a/fhirclient/models/DSTU2/documentmanifest.py b/fhirclient/models/DSTU2/documentmanifest.py new file mode 100644 index 000000000..ed9f87d27 --- /dev/null +++ b/fhirclient/models/DSTU2/documentmanifest.py @@ -0,0 +1,157 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DocumentManifest) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class DocumentManifest(domainresource.DomainResource): + """ A manifest that defines a set of documents. + """ + + resource_name = "DocumentManifest" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + 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). """ + + self.content = None + """ The items included. + List of `DocumentManifestContent` items (represented as `dict` in JSON). """ + + self.created = None + """ When this document manifest created. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Human-readable description (title). + Type `str`. """ + + self.identifier = None + """ Other identifiers for the manifest. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.masterIdentifier = None + """ Unique Identifier for the set of documents. + Type `Identifier` (represented as `dict` in JSON). """ + + 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). """ + + self.related = None + """ Related things. + List of `DocumentManifestRelated` items (represented as `dict` in JSON). """ + + self.source = None + """ The source system/application/software. + Type `str`. """ + + self.status = None + """ current | superseded | entered-in-error. + Type `str`. """ + + self.subject = None + """ The subject of the set of documents. + Type `FHIRReference` referencing `Patient, Practitioner, Group, Device` (represented as `dict` in JSON). """ + + self.type = None + """ Kind of document set. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(DocumentManifest, self).__init__(jsondict) + + def elementProperties(self): + js = super(DocumentManifest, self).elementProperties() + js.extend([ + ("author", "author", fhirreference.FHIRReference, True, None, False), + ("content", "content", DocumentManifestContent, True, None, True), + ("created", "created", fhirdate.FHIRDate, False, None, False), + ("description", "description", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("masterIdentifier", "masterIdentifier", identifier.Identifier, False, None, False), + ("recipient", "recipient", fhirreference.FHIRReference, True, None, False), + ("related", "related", DocumentManifestRelated, True, None, False), + ("source", "source", str, False, None, False), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import backboneelement + +class DocumentManifestContent(backboneelement.BackboneElement): + """ The items included. + + The list of Documents included in the manifest. + """ + + resource_name = "DocumentManifestContent" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + 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) + + 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. + + Related identifiers or resources associated with the DocumentManifest. + """ + + resource_name = "DocumentManifestRelated" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.identifier = None + """ Identifiers of things that are related. + Type `Identifier` (represented as `dict` in JSON). """ + + self.ref = None + """ Related Resource. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + super(DocumentManifestRelated, self).__init__(jsondict) + + def elementProperties(self): + js = super(DocumentManifestRelated, self).elementProperties() + js.extend([ + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("ref", "ref", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +from . import attachment +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier diff --git a/fhirclient/models/DSTU2/documentmanifest_tests.py b/fhirclient/models/DSTU2/documentmanifest_tests.py new file mode 100644 index 000000000..814caa6e5 --- /dev/null +++ b/fhirclient/models/DSTU2/documentmanifest_tests.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import documentmanifest +from .fhirdate import FHIRDate + + +class DocumentManifestTests(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("DocumentManifest", js["resourceType"]) + return documentmanifest.DocumentManifest(js) + + def testDocumentManifest1(self): + inst = self.instantiate_from("documentmanifest-example.json") + self.assertIsNotNone(inst, "Must have instantiated a DocumentManifest instance") + self.implDocumentManifest1(inst) + + js = inst.as_json() + self.assertEqual("DocumentManifest", js["resourceType"]) + inst2 = documentmanifest.DocumentManifest(js) + self.implDocumentManifest1(inst2) + + def implDocumentManifest1(self, inst): + self.assertEqual(inst.contained[0].id, "a1") + self.assertEqual(inst.created.date, FHIRDate("2004-12-25T23:50:50-05:00").date) + self.assertEqual(inst.created.as_json(), "2004-12-25T23:50:50-05:00") + self.assertEqual(inst.description, "Physical") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier[0].system, "http://example.org/documents") + 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.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") + self.assertEqual(inst.status, "current") + self.assertEqual(inst.text.div, "
Text
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.text, "History and Physical") + diff --git a/fhirclient/models/DSTU2/documentreference.py b/fhirclient/models/DSTU2/documentreference.py new file mode 100644 index 000000000..374510722 --- /dev/null +++ b/fhirclient/models/DSTU2/documentreference.py @@ -0,0 +1,276 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DocumentReference) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class DocumentReference(domainresource.DomainResource): + """ A reference to a document. + + A reference to a document . + """ + + resource_name = "DocumentReference" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.authenticator = None + """ Who/what authenticated the document. + Type `FHIRReference` referencing `Practitioner, Organization` (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). """ + + self.class_fhir = None + """ Categorization of document. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.content = None + """ Document referenced. + List of `DocumentReferenceContent` items (represented as `dict` in JSON). """ + + self.context = None + """ 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). """ + + self.description = None + """ Human-readable description (title). + Type `str`. """ + + self.docStatus = None + """ preliminary | final | appended | amended | entered-in-error. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.identifier = None + """ Other identifiers for the document. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.indexed = None + """ When this document reference created. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.masterIdentifier = None + """ Master Version Specific Identifier. + Type `Identifier` (represented as `dict` in JSON). """ + + self.relatesTo = None + """ Relationships to other documents. + List of `DocumentReferenceRelatesTo` items (represented as `dict` in JSON). """ + + self.securityLabel = None + """ Document security-tags. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.status = None + """ current | superseded | entered-in-error. + Type `str`. """ + + self.subject = None + """ Who/what is the subject of the document. + Type `FHIRReference` referencing `Patient, Practitioner, Group, Device` (represented as `dict` in JSON). """ + + self.type = None + """ Kind of document (LOINC if possible). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(DocumentReference, self).__init__(jsondict) + + def elementProperties(self): + js = super(DocumentReference, self).elementProperties() + js.extend([ + ("authenticator", "authenticator", fhirreference.FHIRReference, False, None, False), + ("author", "author", fhirreference.FHIRReference, True, None, False), + ("class_fhir", "class", codeableconcept.CodeableConcept, False, 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), + ("description", "description", str, False, None, False), + ("docStatus", "docStatus", codeableconcept.CodeableConcept, 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), + ]) + return js + + +from . import backboneelement + +class DocumentReferenceContent(backboneelement.BackboneElement): + """ Document referenced. + + The document and format referenced. There may be multiple content element + repetitions, each with a different format. + """ + + resource_name = "DocumentReferenceContent" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.attachment = None + """ Where to access the document. + Type `Attachment` (represented as `dict` in JSON). """ + + self.format = None + """ Format/content rules for the document. + List of `Coding` items (represented as `dict` in JSON). """ + + super(DocumentReferenceContent, self).__init__(jsondict) + + def elementProperties(self): + js = super(DocumentReferenceContent, self).elementProperties() + js.extend([ + ("attachment", "attachment", attachment.Attachment, False, None, True), + ("format", "format", coding.Coding, True, None, False), + ]) + return js + + +class DocumentReferenceContext(backboneelement.BackboneElement): + """ Clinical context of document. + + The clinical context in which the document was prepared. + """ + + resource_name = "DocumentReferenceContext" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.encounter = None + """ Context of the document content. + Type `FHIRReference` referencing `Encounter` (represented as `dict` in JSON). """ + + self.event = None + """ Main Clinical Acts Documented. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.facilityType = None + """ Kind of facility where patient was seen. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.period = None + """ Time of service that is being documented. + Type `Period` (represented as `dict` in JSON). """ + + self.practiceSetting = None + """ Additional details about where the content was created (e.g. + clinical specialty). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.related = None + """ Related identifiers or resources. + List of `DocumentReferenceContextRelated` items (represented as `dict` in JSON). """ + + self.sourcePatientInfo = None + """ Patient demographics from source. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + super(DocumentReferenceContext, self).__init__(jsondict) + + def elementProperties(self): + js = super(DocumentReferenceContext, self).elementProperties() + js.extend([ + ("encounter", "encounter", fhirreference.FHIRReference, False, 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), + ("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_name = "DocumentReferenceContextRelated" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + 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) + + 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. + + Relationships that this document has with other document references that + already exist. + """ + + resource_name = "DocumentReferenceRelatesTo" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.code = None + """ replaces | transforms | signs | appends. + Type `str`. """ + + self.target = None + """ Target of the relationship. + Type `FHIRReference` referencing `DocumentReference` (represented as `dict` in JSON). """ + + super(DocumentReferenceRelatesTo, self).__init__(jsondict) + + def elementProperties(self): + js = super(DocumentReferenceRelatesTo, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("target", "target", fhirreference.FHIRReference, False, None, True), + ]) + return js + + +from . import attachment +from . import codeableconcept +from . import coding +from . import fhirdate +from . import fhirreference +from . import identifier +from . import period diff --git a/fhirclient/models/DSTU2/documentreference_tests.py b/fhirclient/models/DSTU2/documentreference_tests.py new file mode 100644 index 000000000..b2da021bc --- /dev/null +++ b/fhirclient/models/DSTU2/documentreference_tests.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import documentreference +from .fhirdate import FHIRDate + + +class DocumentReferenceTests(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("DocumentReference", js["resourceType"]) + return documentreference.DocumentReference(js) + + def testDocumentReference1(self): + inst = self.instantiate_from("documentreference-example.json") + self.assertIsNotNone(inst, "Must have instantiated a DocumentReference instance") + self.implDocumentReference1(inst) + + js = inst.as_json() + self.assertEqual("DocumentReference", js["resourceType"]) + inst2 = documentreference.DocumentReference(js) + 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.contained[0].id, "a2") + self.assertEqual(inst.content[0].attachment.contentType, "application/hl7-v3+xml") + 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.url, "http://example.org/xds/mhd/Binary/07a6483f-732b-461e-86b6-edb665c45510") + self.assertEqual(inst.content[0].format[0].code, "urn:ihe:pcc:handp:2008") + self.assertEqual(inst.content[0].format[0].display, "History and Physical Specification") + self.assertEqual(inst.content[0].format[0].system, "urn:oid:1.3.6.1.4.1.19376.1.2.3") + self.assertEqual(inst.context.event[0].coding[0].code, "T-D8200") + self.assertEqual(inst.context.event[0].coding[0].display, "Arm") + self.assertEqual(inst.context.event[0].coding[0].system, "http://ihe.net/xds/connectathon/eventCodes") + self.assertEqual(inst.context.facilityType.coding[0].code, "Outpatient") + self.assertEqual(inst.context.facilityType.coding[0].display, "Outpatient") + self.assertEqual(inst.context.facilityType.coding[0].system, "http://www.ihe.net/xds/connectathon/healthcareFacilityTypeCodes") + self.assertEqual(inst.context.period.end.date, FHIRDate("2004-12-23T08:01:00+11:00").date) + self.assertEqual(inst.context.period.end.as_json(), "2004-12-23T08:01:00+11:00") + self.assertEqual(inst.context.period.start.date, FHIRDate("2004-12-23T08:00:00+11:00").date) + self.assertEqual(inst.context.period.start.as_json(), "2004-12-23T08:00:00+11:00") + 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.description, "Physical") + self.assertEqual(inst.docStatus.coding[0].code, "preliminary") + self.assertEqual(inst.docStatus.coding[0].display, "preliminary") + self.assertEqual(inst.docStatus.coding[0].system, "http://hl7.org/fhir/composition-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.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.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.status, "current") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.coding[0].code, "34108-1") + self.assertEqual(inst.type.coding[0].display, "Outpatient Note") + self.assertEqual(inst.type.coding[0].system, "http://loinc.org") + diff --git a/fhirclient/models/DSTU2/domainresource.py b/fhirclient/models/DSTU2/domainresource.py new file mode 100644 index 000000000..d9123e329 --- /dev/null +++ b/fhirclient/models/DSTU2/domainresource.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DomainResource) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import resource + +class DomainResource(resource.Resource): + """ A resource with narrative, extensions, and contained resources. + + A resource that includes narrative, extensions, and contained resources. + """ + + resource_name = "DomainResource" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.contained = None + """ Contained, inline Resources. + List of `Resource` items (represented as `dict` in JSON). """ + + self.extension = None + """ Additional Content defined by implementations. + List of `Extension` items (represented as `dict` in JSON). """ + + self.modifierExtension = None + """ Extensions that cannot be ignored. + List of `Extension` items (represented as `dict` in JSON). """ + + self.text = None + """ Text summary of the resource, for human interpretation. + Type `Narrative` (represented as `dict` in JSON). """ + + super(DomainResource, self).__init__(jsondict) + + def elementProperties(self): + js = super(DomainResource, self).elementProperties() + js.extend([ + ("contained", "contained", resource.Resource, True, None, False), + ("extension", "extension", extension.Extension, True, None, False), + ("modifierExtension", "modifierExtension", extension.Extension, True, None, False), + ("text", "text", narrative.Narrative, False, None, False), + ]) + return js + + +from . import extension +from . import narrative diff --git a/fhirclient/models/DSTU2/duration.py b/fhirclient/models/DSTU2/duration.py new file mode 100644 index 000000000..6815244c4 --- /dev/null +++ b/fhirclient/models/DSTU2/duration.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Duration) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import quantity + +class Duration(quantity.Quantity): + """ A length of time. + + There SHALL be a code if there is a value and it SHALL be an expression of + time. If system is present, it SHALL be UCUM. + """ + + resource_name = "Duration" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + super(Duration, self).__init__(jsondict) + + diff --git a/fhirclient/models/DSTU2/element.py b/fhirclient/models/DSTU2/element.py new file mode 100644 index 000000000..0204ca06a --- /dev/null +++ b/fhirclient/models/DSTU2/element.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Element) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import fhirabstractbase + +class Element(fhirabstractbase.FHIRAbstractBase): + """ Base for all elements. + + Base definition for all elements in a resource. + """ + + resource_name = "Element" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.extension = None + """ Additional Content defined by implementations. + List of `Extension` items (represented as `dict` in JSON). """ + + self.id = None + """ xml:id (or equivalent in JSON). + Type `str`. """ + + super(Element, self).__init__(jsondict) + + def elementProperties(self): + js = super(Element, self).elementProperties() + from . import extension + js.extend([ + ("extension", "extension", extension.Extension, True, None, False), + ("id", "id", str, False, None, False), + ]) + return js + + diff --git a/fhirclient/models/DSTU2/elementdefinition.py b/fhirclient/models/DSTU2/elementdefinition.py new file mode 100644 index 000000000..f0b74e329 --- /dev/null +++ b/fhirclient/models/DSTU2/elementdefinition.py @@ -0,0 +1,1414 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ElementDefinition) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class ElementDefinition(element.Element): + """ Definition of an element in a resource or extension. + + Captures constraints on each element within the resource, profile, or + extension. + """ + + resource_name = "ElementDefinition" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.alias = None + """ Other names. + List of `str` items. """ + + self.base = None + """ Base definition information for tools. + Type `ElementDefinitionBase` (represented as `dict` in JSON). """ + + self.binding = None + """ ValueSet details if this is coded. + Type `ElementDefinitionBinding` (represented as `dict` in JSON). """ + + self.code = None + """ Defining code. + List of `Coding` items (represented as `dict` in JSON). """ + + self.comments = None + """ Comments about the use of this element. + Type `str`. """ + + self.condition = None + """ Reference to invariant about presence. + List of `str` items. """ + + self.constraint = None + """ Condition that must evaluate to true. + List of `ElementDefinitionConstraint` items (represented as `dict` in JSON). """ + + self.defaultValueAddress = None + """ Specified value it missing from instance. + Type `Address` (represented as `dict` in JSON). """ + + self.defaultValueAnnotation = None + """ Specified value it missing from instance. + Type `Annotation` (represented as `dict` in JSON). """ + + self.defaultValueAttachment = None + """ Specified value it missing from instance. + Type `Attachment` (represented as `dict` in JSON). """ + + self.defaultValueBase64Binary = None + """ Specified value it missing from instance. + Type `str`. """ + + self.defaultValueBoolean = None + """ Specified value it missing from instance. + Type `bool`. """ + + self.defaultValueCode = None + """ Specified value it missing from instance. + Type `str`. """ + + self.defaultValueCodeableConcept = None + """ Specified value it missing from instance. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.defaultValueCoding = None + """ Specified value it missing from instance. + Type `Coding` (represented as `dict` in JSON). """ + + self.defaultValueContactPoint = None + """ Specified value it missing from instance. + Type `ContactPoint` (represented as `dict` in JSON). """ + + self.defaultValueDate = None + """ Specified value it missing from instance. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.defaultValueDateTime = None + """ Specified value it missing from instance. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.defaultValueDecimal = None + """ Specified value it missing from instance. + Type `float`. """ + + self.defaultValueHumanName = None + """ Specified value it missing from instance. + Type `HumanName` (represented as `dict` in JSON). """ + + self.defaultValueId = None + """ Specified value it missing from instance. + Type `str`. """ + + self.defaultValueIdentifier = None + """ Specified value it missing from instance. + Type `Identifier` (represented as `dict` in JSON). """ + + self.defaultValueInstant = None + """ Specified value it missing from instance. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.defaultValueInteger = None + """ Specified value it missing from instance. + Type `int`. """ + + self.defaultValueMarkdown = None + """ Specified value it missing from instance. + Type `str`. """ + + self.defaultValueMeta = None + """ Specified value it missing from instance. + Type `Meta` (represented as `dict` in JSON). """ + + self.defaultValueOid = None + """ Specified value it missing from instance. + Type `str`. """ + + self.defaultValuePeriod = None + """ Specified value it missing from instance. + Type `Period` (represented as `dict` in JSON). """ + + self.defaultValuePositiveInt = None + """ Specified value it missing from instance. + Type `int`. """ + + self.defaultValueQuantity = None + """ Specified value it missing from instance. + Type `Quantity` (represented as `dict` in JSON). """ + + self.defaultValueRange = None + """ Specified value it missing from instance. + Type `Range` (represented as `dict` in JSON). """ + + self.defaultValueRatio = None + """ Specified value it missing from instance. + Type `Ratio` (represented as `dict` in JSON). """ + + self.defaultValueReference = None + """ Specified value it missing from instance. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.defaultValueSampledData = None + """ Specified value it missing from instance. + Type `SampledData` (represented as `dict` in JSON). """ + + self.defaultValueSignature = None + """ Specified value it missing from instance. + Type `Signature` (represented as `dict` in JSON). """ + + self.defaultValueString = None + """ Specified value it missing from instance. + Type `str`. """ + + self.defaultValueTime = None + """ Specified value it missing from instance. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.defaultValueTiming = None + """ Specified value it missing from instance. + Type `Timing` (represented as `dict` in JSON). """ + + self.defaultValueUnsignedInt = None + """ Specified value it missing from instance. + Type `int`. """ + + self.defaultValueUri = None + """ Specified value it missing from instance. + Type `str`. """ + + self.definition = None + """ Full formal definition as narrative text. + Type `str`. """ + + self.exampleAddress = None + """ Example value: [as defined for type]. + Type `Address` (represented as `dict` in JSON). """ + + self.exampleAnnotation = None + """ Example value: [as defined for type]. + Type `Annotation` (represented as `dict` in JSON). """ + + self.exampleAttachment = None + """ Example value: [as defined for type]. + Type `Attachment` (represented as `dict` in JSON). """ + + self.exampleBase64Binary = None + """ Example value: [as defined for type]. + Type `str`. """ + + self.exampleBoolean = None + """ Example value: [as defined for type]. + Type `bool`. """ + + self.exampleCode = None + """ Example value: [as defined for type]. + Type `str`. """ + + self.exampleCodeableConcept = None + """ Example value: [as defined for type]. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.exampleCoding = None + """ Example value: [as defined for type]. + Type `Coding` (represented as `dict` in JSON). """ + + self.exampleContactPoint = None + """ Example value: [as defined for type]. + Type `ContactPoint` (represented as `dict` in JSON). """ + + self.exampleDate = None + """ Example value: [as defined for type]. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.exampleDateTime = None + """ Example value: [as defined for type]. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.exampleDecimal = None + """ Example value: [as defined for type]. + Type `float`. """ + + self.exampleHumanName = None + """ Example value: [as defined for type]. + Type `HumanName` (represented as `dict` in JSON). """ + + self.exampleId = None + """ Example value: [as defined for type]. + Type `str`. """ + + self.exampleIdentifier = None + """ Example value: [as defined for type]. + Type `Identifier` (represented as `dict` in JSON). """ + + self.exampleInstant = None + """ Example value: [as defined for type]. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.exampleInteger = None + """ Example value: [as defined for type]. + Type `int`. """ + + self.exampleMarkdown = None + """ Example value: [as defined for type]. + Type `str`. """ + + self.exampleMeta = None + """ Example value: [as defined for type]. + Type `Meta` (represented as `dict` in JSON). """ + + self.exampleOid = None + """ Example value: [as defined for type]. + Type `str`. """ + + self.examplePeriod = None + """ Example value: [as defined for type]. + Type `Period` (represented as `dict` in JSON). """ + + self.examplePositiveInt = None + """ Example value: [as defined for type]. + Type `int`. """ + + self.exampleQuantity = None + """ Example value: [as defined for type]. + Type `Quantity` (represented as `dict` in JSON). """ + + self.exampleRange = None + """ Example value: [as defined for type]. + Type `Range` (represented as `dict` in JSON). """ + + self.exampleRatio = None + """ Example value: [as defined for type]. + Type `Ratio` (represented as `dict` in JSON). """ + + self.exampleReference = None + """ Example value: [as defined for type]. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.exampleSampledData = None + """ Example value: [as defined for type]. + Type `SampledData` (represented as `dict` in JSON). """ + + self.exampleSignature = None + """ Example value: [as defined for type]. + Type `Signature` (represented as `dict` in JSON). """ + + self.exampleString = None + """ Example value: [as defined for type]. + Type `str`. """ + + self.exampleTime = None + """ Example value: [as defined for type]. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.exampleTiming = None + """ Example value: [as defined for type]. + Type `Timing` (represented as `dict` in JSON). """ + + self.exampleUnsignedInt = None + """ Example value: [as defined for type]. + Type `int`. """ + + self.exampleUri = None + """ Example value: [as defined for type]. + Type `str`. """ + + self.fixedAddress = None + """ Value must be exactly this. + Type `Address` (represented as `dict` in JSON). """ + + self.fixedAnnotation = None + """ Value must be exactly this. + Type `Annotation` (represented as `dict` in JSON). """ + + self.fixedAttachment = None + """ Value must be exactly this. + Type `Attachment` (represented as `dict` in JSON). """ + + self.fixedBase64Binary = None + """ Value must be exactly this. + Type `str`. """ + + self.fixedBoolean = None + """ Value must be exactly this. + Type `bool`. """ + + self.fixedCode = None + """ Value must be exactly this. + Type `str`. """ + + self.fixedCodeableConcept = None + """ Value must be exactly this. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.fixedCoding = None + """ Value must be exactly this. + Type `Coding` (represented as `dict` in JSON). """ + + self.fixedContactPoint = None + """ Value must be exactly this. + Type `ContactPoint` (represented as `dict` in JSON). """ + + self.fixedDate = None + """ Value must be exactly this. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.fixedDateTime = None + """ Value must be exactly this. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.fixedDecimal = None + """ Value must be exactly this. + Type `float`. """ + + self.fixedHumanName = None + """ Value must be exactly this. + Type `HumanName` (represented as `dict` in JSON). """ + + self.fixedId = None + """ Value must be exactly this. + Type `str`. """ + + self.fixedIdentifier = None + """ Value must be exactly this. + Type `Identifier` (represented as `dict` in JSON). """ + + self.fixedInstant = None + """ Value must be exactly this. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.fixedInteger = None + """ Value must be exactly this. + Type `int`. """ + + self.fixedMarkdown = None + """ Value must be exactly this. + Type `str`. """ + + self.fixedMeta = None + """ Value must be exactly this. + Type `Meta` (represented as `dict` in JSON). """ + + self.fixedOid = None + """ Value must be exactly this. + Type `str`. """ + + self.fixedPeriod = None + """ Value must be exactly this. + Type `Period` (represented as `dict` in JSON). """ + + self.fixedPositiveInt = None + """ Value must be exactly this. + Type `int`. """ + + self.fixedQuantity = None + """ Value must be exactly this. + Type `Quantity` (represented as `dict` in JSON). """ + + self.fixedRange = None + """ Value must be exactly this. + Type `Range` (represented as `dict` in JSON). """ + + self.fixedRatio = None + """ Value must be exactly this. + Type `Ratio` (represented as `dict` in JSON). """ + + self.fixedReference = None + """ Value must be exactly this. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.fixedSampledData = None + """ Value must be exactly this. + Type `SampledData` (represented as `dict` in JSON). """ + + self.fixedSignature = None + """ Value must be exactly this. + Type `Signature` (represented as `dict` in JSON). """ + + self.fixedString = None + """ Value must be exactly this. + Type `str`. """ + + self.fixedTime = None + """ Value must be exactly this. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.fixedTiming = None + """ Value must be exactly this. + Type `Timing` (represented as `dict` in JSON). """ + + self.fixedUnsignedInt = None + """ Value must be exactly this. + Type `int`. """ + + self.fixedUri = None + """ Value must be exactly this. + Type `str`. """ + + self.isModifier = None + """ If this modifies the meaning of other elements. + Type `bool`. """ + + self.isSummary = None + """ Include when _summary = true?. + Type `bool`. """ + + self.label = None + """ Name for element to display with or prompt for element. + Type `str`. """ + + self.mapping = None + """ Map element to another set of definitions. + List of `ElementDefinitionMapping` items (represented as `dict` in JSON). """ + + self.max = None + """ Maximum Cardinality (a number or *). + Type `str`. """ + + self.maxLength = None + """ Max length for strings. + Type `int`. """ + + self.maxValueAddress = None + """ Maximum Allowed Value (for some types). + Type `Address` (represented as `dict` in JSON). """ + + self.maxValueAnnotation = None + """ Maximum Allowed Value (for some types). + Type `Annotation` (represented as `dict` in JSON). """ + + self.maxValueAttachment = None + """ Maximum Allowed Value (for some types). + Type `Attachment` (represented as `dict` in JSON). """ + + self.maxValueBase64Binary = None + """ Maximum Allowed Value (for some types). + Type `str`. """ + + self.maxValueBoolean = None + """ Maximum Allowed Value (for some types). + Type `bool`. """ + + self.maxValueCode = None + """ Maximum Allowed Value (for some types). + Type `str`. """ + + self.maxValueCodeableConcept = None + """ Maximum Allowed Value (for some types). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.maxValueCoding = None + """ Maximum Allowed Value (for some types). + Type `Coding` (represented as `dict` in JSON). """ + + self.maxValueContactPoint = None + """ Maximum Allowed Value (for some types). + Type `ContactPoint` (represented as `dict` in JSON). """ + + self.maxValueDate = None + """ Maximum Allowed Value (for some types). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.maxValueDateTime = None + """ Maximum Allowed Value (for some types). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.maxValueDecimal = None + """ Maximum Allowed Value (for some types). + Type `float`. """ + + self.maxValueHumanName = None + """ Maximum Allowed Value (for some types). + Type `HumanName` (represented as `dict` in JSON). """ + + self.maxValueId = None + """ Maximum Allowed Value (for some types). + Type `str`. """ + + self.maxValueIdentifier = None + """ Maximum Allowed Value (for some types). + Type `Identifier` (represented as `dict` in JSON). """ + + self.maxValueInstant = None + """ Maximum Allowed Value (for some types). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.maxValueInteger = None + """ Maximum Allowed Value (for some types). + Type `int`. """ + + self.maxValueMarkdown = None + """ Maximum Allowed Value (for some types). + Type `str`. """ + + self.maxValueMeta = None + """ Maximum Allowed Value (for some types). + Type `Meta` (represented as `dict` in JSON). """ + + self.maxValueOid = None + """ Maximum Allowed Value (for some types). + Type `str`. """ + + self.maxValuePeriod = None + """ Maximum Allowed Value (for some types). + Type `Period` (represented as `dict` in JSON). """ + + self.maxValuePositiveInt = None + """ Maximum Allowed Value (for some types). + Type `int`. """ + + self.maxValueQuantity = None + """ Maximum Allowed Value (for some types). + Type `Quantity` (represented as `dict` in JSON). """ + + self.maxValueRange = None + """ Maximum Allowed Value (for some types). + Type `Range` (represented as `dict` in JSON). """ + + self.maxValueRatio = None + """ Maximum Allowed Value (for some types). + Type `Ratio` (represented as `dict` in JSON). """ + + self.maxValueReference = None + """ Maximum Allowed Value (for some types). + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.maxValueSampledData = None + """ Maximum Allowed Value (for some types). + Type `SampledData` (represented as `dict` in JSON). """ + + self.maxValueSignature = None + """ Maximum Allowed Value (for some types). + Type `Signature` (represented as `dict` in JSON). """ + + self.maxValueString = None + """ Maximum Allowed Value (for some types). + Type `str`. """ + + self.maxValueTime = None + """ Maximum Allowed Value (for some types). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.maxValueTiming = None + """ Maximum Allowed Value (for some types). + Type `Timing` (represented as `dict` in JSON). """ + + self.maxValueUnsignedInt = None + """ Maximum Allowed Value (for some types). + Type `int`. """ + + self.maxValueUri = None + """ Maximum Allowed Value (for some types). + Type `str`. """ + + self.meaningWhenMissing = None + """ Implicit meaning when this element is missing. + Type `str`. """ + + self.min = None + """ Minimum Cardinality. + Type `int`. """ + + self.minValueAddress = None + """ Minimum Allowed Value (for some types). + Type `Address` (represented as `dict` in JSON). """ + + self.minValueAnnotation = None + """ Minimum Allowed Value (for some types). + Type `Annotation` (represented as `dict` in JSON). """ + + self.minValueAttachment = None + """ Minimum Allowed Value (for some types). + Type `Attachment` (represented as `dict` in JSON). """ + + self.minValueBase64Binary = None + """ Minimum Allowed Value (for some types). + Type `str`. """ + + self.minValueBoolean = None + """ Minimum Allowed Value (for some types). + Type `bool`. """ + + self.minValueCode = None + """ Minimum Allowed Value (for some types). + Type `str`. """ + + self.minValueCodeableConcept = None + """ Minimum Allowed Value (for some types). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.minValueCoding = None + """ Minimum Allowed Value (for some types). + Type `Coding` (represented as `dict` in JSON). """ + + self.minValueContactPoint = None + """ Minimum Allowed Value (for some types). + Type `ContactPoint` (represented as `dict` in JSON). """ + + self.minValueDate = None + """ Minimum Allowed Value (for some types). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.minValueDateTime = None + """ Minimum Allowed Value (for some types). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.minValueDecimal = None + """ Minimum Allowed Value (for some types). + Type `float`. """ + + self.minValueHumanName = None + """ Minimum Allowed Value (for some types). + Type `HumanName` (represented as `dict` in JSON). """ + + self.minValueId = None + """ Minimum Allowed Value (for some types). + Type `str`. """ + + self.minValueIdentifier = None + """ Minimum Allowed Value (for some types). + Type `Identifier` (represented as `dict` in JSON). """ + + self.minValueInstant = None + """ Minimum Allowed Value (for some types). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.minValueInteger = None + """ Minimum Allowed Value (for some types). + Type `int`. """ + + self.minValueMarkdown = None + """ Minimum Allowed Value (for some types). + Type `str`. """ + + self.minValueMeta = None + """ Minimum Allowed Value (for some types). + Type `Meta` (represented as `dict` in JSON). """ + + self.minValueOid = None + """ Minimum Allowed Value (for some types). + Type `str`. """ + + self.minValuePeriod = None + """ Minimum Allowed Value (for some types). + Type `Period` (represented as `dict` in JSON). """ + + self.minValuePositiveInt = None + """ Minimum Allowed Value (for some types). + Type `int`. """ + + self.minValueQuantity = None + """ Minimum Allowed Value (for some types). + Type `Quantity` (represented as `dict` in JSON). """ + + self.minValueRange = None + """ Minimum Allowed Value (for some types). + Type `Range` (represented as `dict` in JSON). """ + + self.minValueRatio = None + """ Minimum Allowed Value (for some types). + Type `Ratio` (represented as `dict` in JSON). """ + + self.minValueReference = None + """ Minimum Allowed Value (for some types). + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.minValueSampledData = None + """ Minimum Allowed Value (for some types). + Type `SampledData` (represented as `dict` in JSON). """ + + self.minValueSignature = None + """ Minimum Allowed Value (for some types). + Type `Signature` (represented as `dict` in JSON). """ + + self.minValueString = None + """ Minimum Allowed Value (for some types). + Type `str`. """ + + self.minValueTime = None + """ Minimum Allowed Value (for some types). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.minValueTiming = None + """ Minimum Allowed Value (for some types). + Type `Timing` (represented as `dict` in JSON). """ + + self.minValueUnsignedInt = None + """ Minimum Allowed Value (for some types). + Type `int`. """ + + self.minValueUri = None + """ Minimum Allowed Value (for some types). + Type `str`. """ + + self.mustSupport = None + """ If the element must supported. + Type `bool`. """ + + self.name = None + """ Name for this particular element definition (reference target). + Type `str`. """ + + self.nameReference = None + """ To another element constraint (by element.name). + Type `str`. """ + + self.path = None + """ The path of the element (see the Detailed Descriptions). + Type `str`. """ + + self.patternAddress = None + """ Value must have at least these property values. + Type `Address` (represented as `dict` in JSON). """ + + self.patternAnnotation = None + """ Value must have at least these property values. + Type `Annotation` (represented as `dict` in JSON). """ + + self.patternAttachment = None + """ Value must have at least these property values. + Type `Attachment` (represented as `dict` in JSON). """ + + self.patternBase64Binary = None + """ Value must have at least these property values. + Type `str`. """ + + self.patternBoolean = None + """ Value must have at least these property values. + Type `bool`. """ + + self.patternCode = None + """ Value must have at least these property values. + Type `str`. """ + + self.patternCodeableConcept = None + """ Value must have at least these property values. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.patternCoding = None + """ Value must have at least these property values. + Type `Coding` (represented as `dict` in JSON). """ + + self.patternContactPoint = None + """ Value must have at least these property values. + Type `ContactPoint` (represented as `dict` in JSON). """ + + self.patternDate = None + """ Value must have at least these property values. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.patternDateTime = None + """ Value must have at least these property values. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.patternDecimal = None + """ Value must have at least these property values. + Type `float`. """ + + self.patternHumanName = None + """ Value must have at least these property values. + Type `HumanName` (represented as `dict` in JSON). """ + + self.patternId = None + """ Value must have at least these property values. + Type `str`. """ + + self.patternIdentifier = None + """ Value must have at least these property values. + Type `Identifier` (represented as `dict` in JSON). """ + + self.patternInstant = None + """ Value must have at least these property values. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.patternInteger = None + """ Value must have at least these property values. + Type `int`. """ + + self.patternMarkdown = None + """ 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.patternOid = None + """ Value must have at least these property values. + Type `str`. """ + + self.patternPeriod = None + """ Value must have at least these property values. + Type `Period` (represented as `dict` in JSON). """ + + self.patternPositiveInt = None + """ Value must have at least these property values. + Type `int`. """ + + self.patternQuantity = None + """ Value must have at least these property values. + Type `Quantity` (represented as `dict` in JSON). """ + + self.patternRange = None + """ Value must have at least these property values. + Type `Range` (represented as `dict` in JSON). """ + + self.patternRatio = None + """ Value must have at least these property values. + Type `Ratio` (represented as `dict` in JSON). """ + + self.patternReference = None + """ Value must have at least these property values. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.patternSampledData = None + """ Value must have at least these property values. + Type `SampledData` (represented as `dict` in JSON). """ + + self.patternSignature = None + """ Value must have at least these property values. + Type `Signature` (represented as `dict` in JSON). """ + + self.patternString = None + """ Value must have at least these property values. + Type `str`. """ + + self.patternTime = None + """ Value must have at least these property values. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.patternTiming = None + """ Value must have at least these property values. + Type `Timing` (represented as `dict` in JSON). """ + + self.patternUnsignedInt = None + """ Value must have at least these property values. + Type `int`. """ + + self.patternUri = None + """ Value must have at least these property values. + Type `str`. """ + + self.representation = None + """ How this element is represented in instances. + List of `str` items. """ + + self.requirements = None + """ Why is this needed?. + Type `str`. """ + + self.short = None + """ Concise definition for xml presentation. + Type `str`. """ + + self.slicing = None + """ This element is sliced - slices follow. + Type `ElementDefinitionSlicing` (represented as `dict` in JSON). """ + + self.type = None + """ Data type and Profile for this element. + List of `ElementDefinitionType` items (represented as `dict` in JSON). """ + + super(ElementDefinition, self).__init__(jsondict) + + def elementProperties(self): + js = super(ElementDefinition, self).elementProperties() + js.extend([ + ("alias", "alias", str, True, None, False), + ("base", "base", ElementDefinitionBase, False, None, False), + ("binding", "binding", ElementDefinitionBinding, False, None, False), + ("code", "code", coding.Coding, True, None, False), + ("comments", "comments", str, False, None, False), + ("condition", "condition", str, True, None, False), + ("constraint", "constraint", ElementDefinitionConstraint, True, None, False), + ("defaultValueAddress", "defaultValueAddress", address.Address, False, "defaultValue", False), + ("defaultValueAnnotation", "defaultValueAnnotation", annotation.Annotation, False, "defaultValue", False), + ("defaultValueAttachment", "defaultValueAttachment", attachment.Attachment, False, "defaultValue", False), + ("defaultValueBase64Binary", "defaultValueBase64Binary", str, False, "defaultValue", False), + ("defaultValueBoolean", "defaultValueBoolean", bool, False, "defaultValue", False), + ("defaultValueCode", "defaultValueCode", str, False, "defaultValue", False), + ("defaultValueCodeableConcept", "defaultValueCodeableConcept", codeableconcept.CodeableConcept, False, "defaultValue", False), + ("defaultValueCoding", "defaultValueCoding", coding.Coding, False, "defaultValue", False), + ("defaultValueContactPoint", "defaultValueContactPoint", contactpoint.ContactPoint, False, "defaultValue", False), + ("defaultValueDate", "defaultValueDate", fhirdate.FHIRDate, False, "defaultValue", False), + ("defaultValueDateTime", "defaultValueDateTime", fhirdate.FHIRDate, False, "defaultValue", False), + ("defaultValueDecimal", "defaultValueDecimal", float, 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), + ("defaultValueOid", "defaultValueOid", str, 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), + ("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), + ("defaultValueUnsignedInt", "defaultValueUnsignedInt", int, False, "defaultValue", False), + ("defaultValueUri", "defaultValueUri", str, False, "defaultValue", False), + ("definition", "definition", str, False, None, False), + ("exampleAddress", "exampleAddress", address.Address, False, "example", False), + ("exampleAnnotation", "exampleAnnotation", annotation.Annotation, False, "example", False), + ("exampleAttachment", "exampleAttachment", attachment.Attachment, False, "example", False), + ("exampleBase64Binary", "exampleBase64Binary", str, False, "example", False), + ("exampleBoolean", "exampleBoolean", bool, False, "example", False), + ("exampleCode", "exampleCode", str, False, "example", False), + ("exampleCodeableConcept", "exampleCodeableConcept", codeableconcept.CodeableConcept, False, "example", False), + ("exampleCoding", "exampleCoding", coding.Coding, False, "example", False), + ("exampleContactPoint", "exampleContactPoint", contactpoint.ContactPoint, False, "example", False), + ("exampleDate", "exampleDate", fhirdate.FHIRDate, False, "example", False), + ("exampleDateTime", "exampleDateTime", fhirdate.FHIRDate, False, "example", False), + ("exampleDecimal", "exampleDecimal", float, False, "example", False), + ("exampleHumanName", "exampleHumanName", humanname.HumanName, False, "example", False), + ("exampleId", "exampleId", str, False, "example", False), + ("exampleIdentifier", "exampleIdentifier", identifier.Identifier, False, "example", False), + ("exampleInstant", "exampleInstant", fhirdate.FHIRDate, False, "example", False), + ("exampleInteger", "exampleInteger", int, False, "example", False), + ("exampleMarkdown", "exampleMarkdown", str, False, "example", False), + ("exampleMeta", "exampleMeta", meta.Meta, False, "example", False), + ("exampleOid", "exampleOid", str, False, "example", False), + ("examplePeriod", "examplePeriod", period.Period, False, "example", False), + ("examplePositiveInt", "examplePositiveInt", int, False, "example", False), + ("exampleQuantity", "exampleQuantity", quantity.Quantity, False, "example", False), + ("exampleRange", "exampleRange", range.Range, False, "example", False), + ("exampleRatio", "exampleRatio", ratio.Ratio, False, "example", False), + ("exampleReference", "exampleReference", fhirreference.FHIRReference, False, "example", False), + ("exampleSampledData", "exampleSampledData", sampleddata.SampledData, False, "example", False), + ("exampleSignature", "exampleSignature", signature.Signature, False, "example", False), + ("exampleString", "exampleString", str, False, "example", False), + ("exampleTime", "exampleTime", fhirdate.FHIRDate, False, "example", False), + ("exampleTiming", "exampleTiming", timing.Timing, False, "example", False), + ("exampleUnsignedInt", "exampleUnsignedInt", int, False, "example", False), + ("exampleUri", "exampleUri", str, False, "example", False), + ("fixedAddress", "fixedAddress", address.Address, False, "fixed", False), + ("fixedAnnotation", "fixedAnnotation", annotation.Annotation, False, "fixed", False), + ("fixedAttachment", "fixedAttachment", attachment.Attachment, False, "fixed", False), + ("fixedBase64Binary", "fixedBase64Binary", str, False, "fixed", False), + ("fixedBoolean", "fixedBoolean", bool, False, "fixed", False), + ("fixedCode", "fixedCode", str, False, "fixed", False), + ("fixedCodeableConcept", "fixedCodeableConcept", codeableconcept.CodeableConcept, False, "fixed", False), + ("fixedCoding", "fixedCoding", coding.Coding, False, "fixed", False), + ("fixedContactPoint", "fixedContactPoint", contactpoint.ContactPoint, False, "fixed", False), + ("fixedDate", "fixedDate", fhirdate.FHIRDate, False, "fixed", False), + ("fixedDateTime", "fixedDateTime", fhirdate.FHIRDate, False, "fixed", False), + ("fixedDecimal", "fixedDecimal", float, 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), + ("fixedOid", "fixedOid", str, 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), + ("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), + ("fixedUnsignedInt", "fixedUnsignedInt", int, False, "fixed", False), + ("fixedUri", "fixedUri", str, False, "fixed", False), + ("isModifier", "isModifier", bool, False, None, False), + ("isSummary", "isSummary", bool, False, None, False), + ("label", "label", str, False, None, False), + ("mapping", "mapping", ElementDefinitionMapping, True, None, False), + ("max", "max", str, False, None, False), + ("maxLength", "maxLength", int, False, None, False), + ("maxValueAddress", "maxValueAddress", address.Address, False, "maxValue", False), + ("maxValueAnnotation", "maxValueAnnotation", annotation.Annotation, False, "maxValue", False), + ("maxValueAttachment", "maxValueAttachment", attachment.Attachment, False, "maxValue", False), + ("maxValueBase64Binary", "maxValueBase64Binary", str, False, "maxValue", False), + ("maxValueBoolean", "maxValueBoolean", bool, False, "maxValue", False), + ("maxValueCode", "maxValueCode", str, False, "maxValue", False), + ("maxValueCodeableConcept", "maxValueCodeableConcept", codeableconcept.CodeableConcept, False, "maxValue", False), + ("maxValueCoding", "maxValueCoding", coding.Coding, False, "maxValue", False), + ("maxValueContactPoint", "maxValueContactPoint", contactpoint.ContactPoint, False, "maxValue", False), + ("maxValueDate", "maxValueDate", fhirdate.FHIRDate, False, "maxValue", False), + ("maxValueDateTime", "maxValueDateTime", fhirdate.FHIRDate, False, "maxValue", False), + ("maxValueDecimal", "maxValueDecimal", float, False, "maxValue", False), + ("maxValueHumanName", "maxValueHumanName", humanname.HumanName, False, "maxValue", False), + ("maxValueId", "maxValueId", str, False, "maxValue", False), + ("maxValueIdentifier", "maxValueIdentifier", identifier.Identifier, False, "maxValue", False), + ("maxValueInstant", "maxValueInstant", fhirdate.FHIRDate, False, "maxValue", False), + ("maxValueInteger", "maxValueInteger", int, False, "maxValue", False), + ("maxValueMarkdown", "maxValueMarkdown", str, False, "maxValue", False), + ("maxValueMeta", "maxValueMeta", meta.Meta, False, "maxValue", False), + ("maxValueOid", "maxValueOid", str, False, "maxValue", False), + ("maxValuePeriod", "maxValuePeriod", period.Period, False, "maxValue", False), + ("maxValuePositiveInt", "maxValuePositiveInt", int, False, "maxValue", False), + ("maxValueQuantity", "maxValueQuantity", quantity.Quantity, False, "maxValue", False), + ("maxValueRange", "maxValueRange", range.Range, False, "maxValue", False), + ("maxValueRatio", "maxValueRatio", ratio.Ratio, False, "maxValue", False), + ("maxValueReference", "maxValueReference", fhirreference.FHIRReference, False, "maxValue", False), + ("maxValueSampledData", "maxValueSampledData", sampleddata.SampledData, False, "maxValue", False), + ("maxValueSignature", "maxValueSignature", signature.Signature, False, "maxValue", False), + ("maxValueString", "maxValueString", str, False, "maxValue", False), + ("maxValueTime", "maxValueTime", fhirdate.FHIRDate, False, "maxValue", False), + ("maxValueTiming", "maxValueTiming", timing.Timing, False, "maxValue", False), + ("maxValueUnsignedInt", "maxValueUnsignedInt", int, False, "maxValue", False), + ("maxValueUri", "maxValueUri", str, False, "maxValue", False), + ("meaningWhenMissing", "meaningWhenMissing", str, False, None, False), + ("min", "min", int, False, None, False), + ("minValueAddress", "minValueAddress", address.Address, False, "minValue", False), + ("minValueAnnotation", "minValueAnnotation", annotation.Annotation, False, "minValue", False), + ("minValueAttachment", "minValueAttachment", attachment.Attachment, False, "minValue", False), + ("minValueBase64Binary", "minValueBase64Binary", str, False, "minValue", False), + ("minValueBoolean", "minValueBoolean", bool, False, "minValue", False), + ("minValueCode", "minValueCode", str, False, "minValue", False), + ("minValueCodeableConcept", "minValueCodeableConcept", codeableconcept.CodeableConcept, False, "minValue", False), + ("minValueCoding", "minValueCoding", coding.Coding, False, "minValue", False), + ("minValueContactPoint", "minValueContactPoint", contactpoint.ContactPoint, False, "minValue", False), + ("minValueDate", "minValueDate", fhirdate.FHIRDate, False, "minValue", False), + ("minValueDateTime", "minValueDateTime", fhirdate.FHIRDate, False, "minValue", False), + ("minValueDecimal", "minValueDecimal", float, False, "minValue", False), + ("minValueHumanName", "minValueHumanName", humanname.HumanName, False, "minValue", False), + ("minValueId", "minValueId", str, False, "minValue", False), + ("minValueIdentifier", "minValueIdentifier", identifier.Identifier, False, "minValue", False), + ("minValueInstant", "minValueInstant", fhirdate.FHIRDate, False, "minValue", False), + ("minValueInteger", "minValueInteger", int, False, "minValue", False), + ("minValueMarkdown", "minValueMarkdown", str, False, "minValue", False), + ("minValueMeta", "minValueMeta", meta.Meta, False, "minValue", False), + ("minValueOid", "minValueOid", str, False, "minValue", False), + ("minValuePeriod", "minValuePeriod", period.Period, False, "minValue", False), + ("minValuePositiveInt", "minValuePositiveInt", int, False, "minValue", False), + ("minValueQuantity", "minValueQuantity", quantity.Quantity, False, "minValue", False), + ("minValueRange", "minValueRange", range.Range, False, "minValue", False), + ("minValueRatio", "minValueRatio", ratio.Ratio, False, "minValue", False), + ("minValueReference", "minValueReference", fhirreference.FHIRReference, False, "minValue", False), + ("minValueSampledData", "minValueSampledData", sampleddata.SampledData, False, "minValue", False), + ("minValueSignature", "minValueSignature", signature.Signature, False, "minValue", False), + ("minValueString", "minValueString", str, False, "minValue", False), + ("minValueTime", "minValueTime", fhirdate.FHIRDate, False, "minValue", False), + ("minValueTiming", "minValueTiming", timing.Timing, False, "minValue", False), + ("minValueUnsignedInt", "minValueUnsignedInt", int, False, "minValue", False), + ("minValueUri", "minValueUri", str, False, "minValue", False), + ("mustSupport", "mustSupport", bool, False, None, False), + ("name", "name", str, False, None, False), + ("nameReference", "nameReference", str, False, None, False), + ("path", "path", str, False, None, True), + ("patternAddress", "patternAddress", address.Address, False, "pattern", False), + ("patternAnnotation", "patternAnnotation", annotation.Annotation, False, "pattern", False), + ("patternAttachment", "patternAttachment", attachment.Attachment, False, "pattern", False), + ("patternBase64Binary", "patternBase64Binary", str, False, "pattern", False), + ("patternBoolean", "patternBoolean", bool, False, "pattern", False), + ("patternCode", "patternCode", str, False, "pattern", False), + ("patternCodeableConcept", "patternCodeableConcept", codeableconcept.CodeableConcept, False, "pattern", False), + ("patternCoding", "patternCoding", coding.Coding, False, "pattern", False), + ("patternContactPoint", "patternContactPoint", contactpoint.ContactPoint, False, "pattern", False), + ("patternDate", "patternDate", fhirdate.FHIRDate, False, "pattern", False), + ("patternDateTime", "patternDateTime", fhirdate.FHIRDate, False, "pattern", False), + ("patternDecimal", "patternDecimal", float, 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), + ("patternOid", "patternOid", str, 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), + ("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), + ("patternUnsignedInt", "patternUnsignedInt", int, False, "pattern", False), + ("patternUri", "patternUri", str, False, "pattern", False), + ("representation", "representation", str, True, None, False), + ("requirements", "requirements", str, False, None, False), + ("short", "short", str, False, None, False), + ("slicing", "slicing", ElementDefinitionSlicing, False, None, False), + ("type", "type", ElementDefinitionType, True, None, False), + ]) + return js + + +class ElementDefinitionBase(element.Element): + """ Base definition information for tools. + + Information about the base definition of the element, provided to make it + unncessary for tools to trace the deviation of the element through the + derived and related profiles. This information is only provided where the + element definition represents a constraint on another element definition, + and must be present if there is a base element definition. + """ + + resource_name = "ElementDefinitionBase" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.max = None + """ Max cardinality of the base element. + Type `str`. """ + + self.min = None + """ Min cardinality of the base element. + Type `int`. """ + + self.path = None + """ Path that identifies the base element. + Type `str`. """ + + super(ElementDefinitionBase, self).__init__(jsondict) + + def elementProperties(self): + js = super(ElementDefinitionBase, self).elementProperties() + js.extend([ + ("max", "max", str, False, None, True), + ("min", "min", int, False, None, True), + ("path", "path", str, False, None, True), + ]) + return js + + +class ElementDefinitionBinding(element.Element): + """ ValueSet details if this is coded. + + Binds to a value set if this element is coded (code, Coding, + CodeableConcept). + """ + + resource_name = "ElementDefinitionBinding" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.description = None + """ Human explanation of the value set. + Type `str`. """ + + self.strength = None + """ 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 + """ Source of value set. + Type `str`. """ + + super(ElementDefinitionBinding, self).__init__(jsondict) + + def elementProperties(self): + js = super(ElementDefinitionBinding, self).elementProperties() + 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), + ]) + return js + + +class ElementDefinitionConstraint(element.Element): + """ Condition that must evaluate to true. + + Formal constraints such as co-occurrence and other constraints that can be + computationally evaluated within the context of the instance. + """ + + resource_name = "ElementDefinitionConstraint" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.human = None + """ Human description of constraint. + Type `str`. """ + + self.key = None + """ Target of 'condition' reference above. + Type `str`. """ + + self.requirements = None + """ Why this constraint necessary or appropriate. + Type `str`. """ + + self.severity = None + """ error | warning. + Type `str`. """ + + self.xpath = None + """ XPath expression of constraint. + Type `str`. """ + + super(ElementDefinitionConstraint, self).__init__(jsondict) + + def elementProperties(self): + js = super(ElementDefinitionConstraint, self).elementProperties() + js.extend([ + ("human", "human", str, False, None, True), + ("key", "key", str, False, None, True), + ("requirements", "requirements", str, False, None, False), + ("severity", "severity", str, False, None, True), + ("xpath", "xpath", str, False, None, True), + ]) + return js + + +class ElementDefinitionMapping(element.Element): + """ Map element to another set of definitions. + + Identifies a concept from an external specification that roughly + corresponds to this element. + """ + + resource_name = "ElementDefinitionMapping" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.identity = None + """ Reference to mapping declaration. + Type `str`. """ + + self.language = None + """ Computable language of mapping. + Type `str`. """ + + self.map = None + """ Details of the mapping. + Type `str`. """ + + super(ElementDefinitionMapping, self).__init__(jsondict) + + def elementProperties(self): + js = super(ElementDefinitionMapping, self).elementProperties() + js.extend([ + ("identity", "identity", str, False, None, True), + ("language", "language", str, False, None, False), + ("map", "map", str, False, None, True), + ]) + return js + + +class ElementDefinitionSlicing(element.Element): + """ This element is sliced - slices follow. + + Indicates that the element is sliced into a set of alternative definitions + (i.e. in a structure definition, there are multiple different constraints + on a single element in the base resource). Slicing can be used in any + resource that has cardinality ..* on the base resource, or any resource + with a choice of types. The set of slices is any elements that come after + this in the element sequence that have the same path, until a shorter path + occurs (the shorter path terminates the set). + """ + + resource_name = "ElementDefinitionSlicing" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.description = None + """ Text description of how slicing works (or not). + Type `str`. """ + + self.discriminator = None + """ Element values that used to distinguish the slices. + List of `str` items. """ + + self.ordered = None + """ If elements must be in same order as slices. + Type `bool`. """ + + self.rules = None + """ closed | open | openAtEnd. + Type `str`. """ + + super(ElementDefinitionSlicing, self).__init__(jsondict) + + def elementProperties(self): + js = super(ElementDefinitionSlicing, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, False), + ("discriminator", "discriminator", str, True, None, False), + ("ordered", "ordered", bool, False, None, False), + ("rules", "rules", str, False, None, True), + ]) + return js + + +class ElementDefinitionType(element.Element): + """ Data type and Profile for this element. + + The data type or resource that the value of this element is permitted to + be. + """ + + resource_name = "ElementDefinitionType" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.aggregation = None + """ contained | referenced | bundled - how aggregated. + List of `str` items. """ + + self.code = None + """ Name of Data type or Resource. + Type `str`. """ + + self.profile = None + """ Profile (StructureDefinition) to apply (or IG). + List of `str` items. """ + + super(ElementDefinitionType, self).__init__(jsondict) + + def elementProperties(self): + js = super(ElementDefinitionType, self).elementProperties() + js.extend([ + ("aggregation", "aggregation", str, True, None, False), + ("code", "code", str, False, None, True), + ("profile", "profile", str, True, None, False), + ]) + return js + + +from . import address +from . import annotation +from . import attachment +from . import codeableconcept +from . import coding +from . import contactpoint +from . import fhirdate +from . import fhirreference +from . import humanname +from . import identifier +from . import meta +from . import period +from . import quantity +from . import range +from . import ratio +from . import sampleddata +from . import signature +from . import timing diff --git a/fhirclient/models/DSTU2/eligibilityrequest.py b/fhirclient/models/DSTU2/eligibilityrequest.py new file mode 100644 index 000000000..2c7cfdbb7 --- /dev/null +++ b/fhirclient/models/DSTU2/eligibilityrequest.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/EligibilityRequest) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class EligibilityRequest(domainresource.DomainResource): + """ Eligibility request. + + This resource provides the insurance eligibility details from the insurer + regarding a specified coverage and optionally some class of service. + """ + + resource_name = "EligibilityRequest" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.created = None + """ Creation date. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.identifier = None + """ Business Identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.organization = None + """ Responsible organization. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.originalRuleset = None + """ Original version. + Type `Coding` (represented as `dict` in JSON). """ + + self.provider = None + """ Responsible practitioner. + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + self.ruleset = None + """ Resource version. + Type `Coding` (represented as `dict` in JSON). """ + + self.target = None + """ Insurer. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + super(EligibilityRequest, self).__init__(jsondict) + + def elementProperties(self): + js = super(EligibilityRequest, self).elementProperties() + js.extend([ + ("created", "created", fhirdate.FHIRDate, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("organization", "organization", fhirreference.FHIRReference, False, None, False), + ("originalRuleset", "originalRuleset", coding.Coding, False, None, False), + ("provider", "provider", fhirreference.FHIRReference, False, None, False), + ("ruleset", "ruleset", coding.Coding, False, None, False), + ("target", "target", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +from . import coding +from . import fhirdate +from . import fhirreference +from . import identifier diff --git a/fhirclient/models/DSTU2/eligibilityrequest_tests.py b/fhirclient/models/DSTU2/eligibilityrequest_tests.py new file mode 100644 index 000000000..0c42fa229 --- /dev/null +++ b/fhirclient/models/DSTU2/eligibilityrequest_tests.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +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.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.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.text.div, "
A human-readable rendering of the EligibilityRequest
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/eligibilityresponse.py b/fhirclient/models/DSTU2/eligibilityresponse.py new file mode 100644 index 000000000..f6033165a --- /dev/null +++ b/fhirclient/models/DSTU2/eligibilityresponse.py @@ -0,0 +1,85 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/EligibilityResponse) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class EligibilityResponse(domainresource.DomainResource): + """ EligibilityResponse resource. + + This resource provides eligibility and plan details from the processing of + an Eligibility resource. + """ + + resource_name = "EligibilityResponse" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.created = None + """ Creation date. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.disposition = None + """ Disposition Message. + Type `str`. """ + + self.identifier = None + """ Business Identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.organization = None + """ Insurer. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.originalRuleset = None + """ Original version. + Type `Coding` (represented as `dict` in JSON). """ + + self.outcome = None + """ complete | error. + Type `str`. """ + + self.request = None + """ Claim reference. + Type `FHIRReference` referencing `EligibilityRequest` (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.ruleset = None + """ Resource version. + Type `Coding` (represented as `dict` in JSON). """ + + super(EligibilityResponse, self).__init__(jsondict) + + def elementProperties(self): + js = super(EligibilityResponse, self).elementProperties() + js.extend([ + ("created", "created", fhirdate.FHIRDate, False, None, False), + ("disposition", "disposition", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("organization", "organization", fhirreference.FHIRReference, False, None, False), + ("originalRuleset", "originalRuleset", coding.Coding, 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), + ("ruleset", "ruleset", coding.Coding, False, None, False), + ]) + return js + + +from . import coding +from . import fhirdate +from . import fhirreference +from . import identifier diff --git a/fhirclient/models/DSTU2/eligibilityresponse_tests.py b/fhirclient/models/DSTU2/eligibilityresponse_tests.py new file mode 100644 index 000000000..856369fb2 --- /dev/null +++ b/fhirclient/models/DSTU2/eligibilityresponse_tests.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +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.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.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.assertEqual(inst.outcome, "complete") + self.assertEqual(inst.text.div, "
A human-readable rendering of the EligibilityResponse.
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/encounter.py b/fhirclient/models/DSTU2/encounter.py new file mode 100644 index 000000000..479a4a3d9 --- /dev/null +++ b/fhirclient/models/DSTU2/encounter.py @@ -0,0 +1,315 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Encounter) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Encounter(domainresource.DomainResource): + """ An interaction during which services are provided to the patient. + + An interaction between a patient and healthcare provider(s) for the purpose + of providing healthcare service(s) or assessing the health status of a + patient. + """ + + resource_name = "Encounter" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.appointment = None + """ The appointment that scheduled this encounter. + Type `FHIRReference` referencing `Appointment` (represented as `dict` in JSON). """ + + self.class_fhir = None + """ inpatient | outpatient | ambulatory | emergency +. + Type `str`. """ + + 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). """ + + self.hospitalization = None + """ Details about the admission to a healthcare service. + Type `EncounterHospitalization` (represented as `dict` in JSON). """ + + self.identifier = None + """ 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.indication = None + """ Reason the encounter takes place (resource). + List of `FHIRReference` items referencing `Condition, Procedure` (represented as `dict` in JSON). """ + + self.length = None + """ Quantity of time the encounter lasted (less time absent). + Type `Quantity` referencing `Duration` (represented as `dict` in JSON). """ + + self.location = None + """ List of locations where the patient has been. + List of `EncounterLocation` items (represented as `dict` in JSON). """ + + self.partOf = None + """ Another Encounter this encounter is part of. + Type `FHIRReference` referencing `Encounter` (represented as `dict` in JSON). """ + + self.participant = None + """ List of participants involved in the encounter. + List of `EncounterParticipant` items (represented as `dict` in JSON). """ + + self.patient = None + """ The patient present at the encounter. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.period = None + """ The start and end time of the encounter. + Type `Period` (represented as `dict` in JSON). """ + + self.priority = None + """ Indicates the urgency of the encounter. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.reason = None + """ Reason the encounter takes place (code). + List of `CodeableConcept` 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). """ + + self.status = None + """ planned | arrived | in-progress | onleave | finished | cancelled. + Type `str`. """ + + self.statusHistory = None + """ List of past encounter statuses. + List of `EncounterStatusHistory` items (represented as `dict` in JSON). """ + + self.type = None + """ Specific type of encounter. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(Encounter, self).__init__(jsondict) + + def elementProperties(self): + js = super(Encounter, self).elementProperties() + js.extend([ + ("appointment", "appointment", fhirreference.FHIRReference, False, None, False), + ("class_fhir", "class", str, False, 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), + ("indication", "indication", fhirreference.FHIRReference, True, None, False), + ("length", "length", quantity.Quantity, False, None, False), + ("location", "location", EncounterLocation, True, None, False), + ("partOf", "partOf", fhirreference.FHIRReference, False, None, False), + ("participant", "participant", EncounterParticipant, True, None, False), + ("patient", "patient", fhirreference.FHIRReference, False, None, False), + ("period", "period", period.Period, False, None, False), + ("priority", "priority", codeableconcept.CodeableConcept, False, None, False), + ("reason", "reason", codeableconcept.CodeableConcept, True, None, False), + ("serviceProvider", "serviceProvider", fhirreference.FHIRReference, False, None, False), + ("status", "status", str, False, None, True), + ("statusHistory", "statusHistory", EncounterStatusHistory, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +from . import backboneelement + +class EncounterHospitalization(backboneelement.BackboneElement): + """ Details about the admission to a healthcare service. + """ + + resource_name = "EncounterHospitalization" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.admitSource = None + """ From where patient was admitted (physician referral, transfer). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.admittingDiagnosis = None + """ The admitting diagnosis as reported by admitting practitioner. + List of `FHIRReference` items referencing `Condition` (represented as `dict` in JSON). """ + + self.destination = None + """ Location to which the patient is discharged. + Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + + self.dietPreference = None + """ Diet preferences reported by the patient. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.dischargeDiagnosis = None + """ The final diagnosis given a patient before release from the + hospital after all testing, surgery, and workup are complete. + List of `FHIRReference` items referencing `Condition` (represented as `dict` in JSON). """ + + self.dischargeDisposition = None + """ Category or kind of location after discharge. + 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). """ + + self.preAdmissionIdentifier = None + """ Pre-admission identifier. + Type `Identifier` (represented as `dict` in JSON). """ + + self.reAdmission = None + """ The type of hospital re-admission that has occurred (if any). If + the value is absent, then this is not identified as a readmission. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.specialArrangement = None + """ Wheelchair, translator, stretcher, etc.. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.specialCourtesy = None + """ Special courtesies (VIP, board member). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(EncounterHospitalization, self).__init__(jsondict) + + def elementProperties(self): + js = super(EncounterHospitalization, self).elementProperties() + js.extend([ + ("admitSource", "admitSource", codeableconcept.CodeableConcept, False, None, False), + ("admittingDiagnosis", "admittingDiagnosis", fhirreference.FHIRReference, True, None, False), + ("destination", "destination", fhirreference.FHIRReference, False, None, False), + ("dietPreference", "dietPreference", codeableconcept.CodeableConcept, True, None, False), + ("dischargeDiagnosis", "dischargeDiagnosis", fhirreference.FHIRReference, True, None, False), + ("dischargeDisposition", "dischargeDisposition", codeableconcept.CodeableConcept, False, None, False), + ("origin", "origin", fhirreference.FHIRReference, False, None, False), + ("preAdmissionIdentifier", "preAdmissionIdentifier", identifier.Identifier, False, None, False), + ("reAdmission", "reAdmission", codeableconcept.CodeableConcept, False, None, False), + ("specialArrangement", "specialArrangement", codeableconcept.CodeableConcept, True, None, False), + ("specialCourtesy", "specialCourtesy", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +class EncounterLocation(backboneelement.BackboneElement): + """ List of locations where the patient has been. + + List of locations where the patient has been during this encounter. + """ + + resource_name = "EncounterLocation" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.location = None + """ Location the encounter takes place. + Type `FHIRReference` referencing `Location` (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.status = None + """ planned | active | reserved | completed. + Type `str`. """ + + super(EncounterLocation, self).__init__(jsondict) + + def elementProperties(self): + js = super(EncounterLocation, self).elementProperties() + js.extend([ + ("location", "location", fhirreference.FHIRReference, False, None, True), + ("period", "period", period.Period, False, None, False), + ("status", "status", str, False, None, False), + ]) + return js + + +class EncounterParticipant(backboneelement.BackboneElement): + """ List of participants involved in the encounter. + + The list of people responsible for providing the service. + """ + + resource_name = "EncounterParticipant" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.individual = None + """ Persons involved in the encounter other than the patient. + Type `FHIRReference` referencing `Practitioner, RelatedPerson` (represented as `dict` in JSON). """ + + self.period = None + """ Period of time during the encounter participant was present. + Type `Period` (represented as `dict` in JSON). """ + + self.type = None + """ Role of participant in encounter. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(EncounterParticipant, self).__init__(jsondict) + + def elementProperties(self): + js = super(EncounterParticipant, self).elementProperties() + js.extend([ + ("individual", "individual", fhirreference.FHIRReference, False, None, False), + ("period", "period", period.Period, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +class EncounterStatusHistory(backboneelement.BackboneElement): + """ List of past encounter statuses. + + The status history permits the encounter resource to contain the status + history without needing to read through the historical versions of the + resource, or even have the server store them. + """ + + resource_name = "EncounterStatusHistory" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.period = None + """ The time that the episode was in the specified status. + Type `Period` (represented as `dict` in JSON). """ + + self.status = None + """ planned | arrived | in-progress | onleave | finished | cancelled. + Type `str`. """ + + super(EncounterStatusHistory, self).__init__(jsondict) + + def elementProperties(self): + js = super(EncounterStatusHistory, self).elementProperties() + js.extend([ + ("period", "period", period.Period, False, None, True), + ("status", "status", str, False, None, True), + ]) + return js + + +from . import codeableconcept +from . import fhirreference +from . import identifier +from . import period +from . import quantity diff --git a/fhirclient/models/DSTU2/encounter_tests.py b/fhirclient/models/DSTU2/encounter_tests.py new file mode 100644 index 000000000..d320f026a --- /dev/null +++ b/fhirclient/models/DSTU2/encounter_tests.py @@ -0,0 +1,310 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import encounter +from .fhirdate import FHIRDate + + +class EncounterTests(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("Encounter", js["resourceType"]) + return encounter.Encounter(js) + + def testEncounter1(self): + inst = self.instantiate_from("encounter-example-home.json") + self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") + self.implEncounter1(inst) + + js = inst.as_json() + self.assertEqual("Encounter", js["resourceType"]) + inst2 = encounter.Encounter(js) + self.implEncounter1(inst2) + + def implEncounter1(self, inst): + self.assertEqual(inst.class_fhir, "virtual") + 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.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-f201-20130404.json") + self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") + self.implEncounter2(inst) + + js = inst.as_json() + self.assertEqual("Encounter", js["resourceType"]) + inst2 = encounter.Encounter(js) + self.implEncounter2(inst2) + + def implEncounter2(self, inst): + self.assertEqual(inst.class_fhir, "outpatient") + 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 testEncounter3(self): + inst = self.instantiate_from("encounter-example-f003-abscess.json") + self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") + self.implEncounter3(inst) + + js = inst.as_json() + self.assertEqual("Encounter", js["resourceType"]) + inst2 = encounter.Encounter(js) + self.implEncounter3(inst2) + + def implEncounter3(self, inst): + self.assertEqual(inst.class_fhir, "outpatient") + 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, "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, "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, 90) + 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].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].valueInteger, 1) + 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 testEncounter4(self): + inst = self.instantiate_from("encounter-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") + self.implEncounter4(inst) + + js = inst.as_json() + self.assertEqual("Encounter", js["resourceType"]) + inst2 = encounter.Encounter(js) + self.implEncounter4(inst2) + + def implEncounter4(self, inst): + self.assertEqual(inst.class_fhir, "inpatient") + self.assertEqual(inst.id, "example") + 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, "outpatient") + 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, "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, "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, 140) + 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].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.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 testEncounter6(self): + inst = self.instantiate_from("encounter-example-f203-20130311.json") + self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") + self.implEncounter6(inst) + + js = inst.as_json() + self.assertEqual("Encounter", js["resourceType"]) + inst2 = encounter.Encounter(js) + self.implEncounter6(inst2) + + def implEncounter6(self, inst): + self.assertEqual(inst.class_fhir, "inpatient") + 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") + self.assertEqual(inst.hospitalization.dietPreference[0].coding[0].code, "276026009") + self.assertEqual(inst.hospitalization.dietPreference[0].coding[0].display, "Fluid balance regulation") + self.assertEqual(inst.hospitalization.dietPreference[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.hospitalization.reAdmission.coding[0].display, "readmitted") + self.assertEqual(inst.id, "f203") + self.assertEqual(inst.identifier[0].use, "temp") + self.assertEqual(inst.identifier[0].value, "Encounter_Roel_20130311") + 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) + self.assertEqual(inst.period.start.as_json(), "2013-03-11") + 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.status, "finished") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type[0].coding[0].code, "183807002") + 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, "outpatient") + 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.text.status, "generated") + + def testEncounter8(self): + inst = self.instantiate_from("encounter-example-f202-20130128.json") + self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") + self.implEncounter8(inst) + + js = inst.as_json() + self.assertEqual("Encounter", js["resourceType"]) + inst2 = encounter.Encounter(js) + self.implEncounter8(inst2) + + def implEncounter8(self, inst): + self.assertEqual(inst.class_fhir, "outpatient") + 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, "258701004") + self.assertEqual(inst.length.system, "http://snomed.info/sct") + 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].valueInteger, 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 testEncounter9(self): + inst = self.instantiate_from("encounter-example-f001-heart.json") + self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") + self.implEncounter9(inst) + + js = inst.as_json() + self.assertEqual("Encounter", js["resourceType"]) + inst2 = encounter.Encounter(js) + self.implEncounter9(inst2) + + def implEncounter9(self, inst): + self.assertEqual(inst.class_fhir, "outpatient") + 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.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.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/DSTU2/enrollmentrequest.py b/fhirclient/models/DSTU2/enrollmentrequest.py new file mode 100644 index 000000000..eea85ea71 --- /dev/null +++ b/fhirclient/models/DSTU2/enrollmentrequest.py @@ -0,0 +1,85 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/EnrollmentRequest) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class EnrollmentRequest(domainresource.DomainResource): + """ Enrollment request. + + This resource provides the insurance enrollment details to the insurer + regarding a specified coverage. + """ + + resource_name = "EnrollmentRequest" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.coverage = None + """ Insurance information. + Type `FHIRReference` referencing `Coverage` (represented as `dict` in JSON). """ + + self.created = None + """ Creation date. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.identifier = None + """ Business Identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.organization = None + """ Responsible organization. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.originalRuleset = None + """ Original version. + Type `Coding` (represented as `dict` in JSON). """ + + self.provider = None + """ Responsible practitioner. + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + self.relationship = None + """ Patient relationship to subscriber. + Type `Coding` (represented as `dict` in JSON). """ + + self.ruleset = None + """ Resource version. + Type `Coding` (represented as `dict` in JSON). """ + + self.subject = None + """ The subject of the Products and Services. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.target = None + """ Insurer. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + super(EnrollmentRequest, self).__init__(jsondict) + + def elementProperties(self): + js = super(EnrollmentRequest, self).elementProperties() + js.extend([ + ("coverage", "coverage", fhirreference.FHIRReference, False, None, True), + ("created", "created", fhirdate.FHIRDate, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("organization", "organization", fhirreference.FHIRReference, False, None, False), + ("originalRuleset", "originalRuleset", coding.Coding, False, None, False), + ("provider", "provider", fhirreference.FHIRReference, False, None, False), + ("relationship", "relationship", coding.Coding, False, None, True), + ("ruleset", "ruleset", coding.Coding, False, None, False), + ("subject", "subject", fhirreference.FHIRReference, False, None, True), + ("target", "target", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +from . import coding +from . import fhirdate +from . import fhirreference +from . import identifier diff --git a/fhirclient/models/DSTU2/enrollmentrequest_tests.py b/fhirclient/models/DSTU2/enrollmentrequest_tests.py new file mode 100644 index 000000000..7c2cce76f --- /dev/null +++ b/fhirclient/models/DSTU2/enrollmentrequest_tests.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import enrollmentrequest +from .fhirdate import FHIRDate + + +class EnrollmentRequestTests(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("EnrollmentRequest", js["resourceType"]) + return enrollmentrequest.EnrollmentRequest(js) + + def testEnrollmentRequest1(self): + inst = self.instantiate_from("enrollmentrequest-example.json") + self.assertIsNotNone(inst, "Must have instantiated a EnrollmentRequest instance") + self.implEnrollmentRequest1(inst) + + js = inst.as_json() + self.assertEqual("EnrollmentRequest", js["resourceType"]) + inst2 = enrollmentrequest.EnrollmentRequest(js) + self.implEnrollmentRequest1(inst2) + + def implEnrollmentRequest1(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, "22345") + self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/enrollmentrequest") + self.assertEqual(inst.identifier[0].value, "EN22345") + self.assertEqual(inst.relationship.code, "spouse") + self.assertEqual(inst.text.div, "
A human-readable rendering of the EnrollmentRequest.
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/enrollmentresponse.py b/fhirclient/models/DSTU2/enrollmentresponse.py new file mode 100644 index 000000000..3b8bc5078 --- /dev/null +++ b/fhirclient/models/DSTU2/enrollmentresponse.py @@ -0,0 +1,85 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/EnrollmentResponse) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class EnrollmentResponse(domainresource.DomainResource): + """ EnrollmentResponse resource. + + This resource provides enrollment and plan details from the processing of + an Enrollment resource. + """ + + resource_name = "EnrollmentResponse" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.created = None + """ Creation date. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.disposition = None + """ Disposition Message. + Type `str`. """ + + self.identifier = None + """ Business Identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.organization = None + """ Insurer. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.originalRuleset = None + """ Original version. + Type `Coding` (represented as `dict` in JSON). """ + + self.outcome = None + """ complete | error. + 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). """ + + self.requestProvider = None + """ Responsible practitioner. + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + self.ruleset = None + """ Resource version. + Type `Coding` (represented as `dict` in JSON). """ + + super(EnrollmentResponse, self).__init__(jsondict) + + def elementProperties(self): + js = super(EnrollmentResponse, self).elementProperties() + js.extend([ + ("created", "created", fhirdate.FHIRDate, False, None, False), + ("disposition", "disposition", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("organization", "organization", fhirreference.FHIRReference, False, None, False), + ("originalRuleset", "originalRuleset", coding.Coding, 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), + ("ruleset", "ruleset", coding.Coding, False, None, False), + ]) + return js + + +from . import coding +from . import fhirdate +from . import fhirreference +from . import identifier diff --git a/fhirclient/models/DSTU2/enrollmentresponse_tests.py b/fhirclient/models/DSTU2/enrollmentresponse_tests.py new file mode 100644 index 000000000..264271b8b --- /dev/null +++ b/fhirclient/models/DSTU2/enrollmentresponse_tests.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import enrollmentresponse +from .fhirdate import FHIRDate + + +class EnrollmentResponseTests(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("EnrollmentResponse", js["resourceType"]) + return enrollmentresponse.EnrollmentResponse(js) + + def testEnrollmentResponse1(self): + inst = self.instantiate_from("enrollmentresponse-example.json") + self.assertIsNotNone(inst, "Must have instantiated a EnrollmentResponse instance") + self.implEnrollmentResponse1(inst) + + js = inst.as_json() + self.assertEqual("EnrollmentResponse", js["resourceType"]) + inst2 = enrollmentresponse.EnrollmentResponse(js) + self.implEnrollmentResponse1(inst2) + + def implEnrollmentResponse1(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, "Dependant added to policy.") + 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, "complete") + self.assertEqual(inst.text.div, "
A human-readable rendering of the EnrollmentResponse
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/episodeofcare.py b/fhirclient/models/DSTU2/episodeofcare.py new file mode 100644 index 000000000..464d544ea --- /dev/null +++ b/fhirclient/models/DSTU2/episodeofcare.py @@ -0,0 +1,165 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/EpisodeOfCare) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class EpisodeOfCare(domainresource.DomainResource): + """ An association of a Patient with an Organization and Healthcare + Provider(s) for a period of time that the Organization assumes some level + of responsibility. + + An association between a patient and an organization / healthcare + provider(s) during which time encounters may occur. The managing + organization assumes a level of responsibility for the patient during this + time. + """ + + resource_name = "EpisodeOfCare" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.careManager = None + """ Care manager/care co-ordinator for the patient. + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + self.careTeam = None + """ Other practitioners facilitating this episode of care. + List of `EpisodeOfCareCareTeam` items (represented as `dict` in JSON). """ + + self.condition = None + """ Conditions/problems/diagnoses this episode of care is for. + List of `FHIRReference` items referencing `Condition` (represented as `dict` in JSON). """ + + self.identifier = None + """ Identifier(s) for the EpisodeOfCare. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.managingOrganization = None + """ Organization that assumes care. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.patient = None + """ Patient for this episode of care. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.period = None + """ Interval during responsibility is assumed. + Type `Period` (represented as `dict` in JSON). """ + + self.referralRequest = None + """ Originating Referral Request(s). + List of `FHIRReference` items referencing `ReferralRequest` (represented as `dict` in JSON). """ + + self.status = None + """ planned | waitlist | active | onhold | finished | cancelled. + Type `str`. """ + + self.statusHistory = None + """ Past list of status codes. + List of `EpisodeOfCareStatusHistory` items (represented as `dict` in JSON). """ + + self.type = None + """ Type/class - e.g. specialist referral, disease management. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(EpisodeOfCare, self).__init__(jsondict) + + def elementProperties(self): + js = super(EpisodeOfCare, self).elementProperties() + js.extend([ + ("careManager", "careManager", fhirreference.FHIRReference, False, None, False), + ("careTeam", "careTeam", EpisodeOfCareCareTeam, True, None, False), + ("condition", "condition", fhirreference.FHIRReference, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("managingOrganization", "managingOrganization", fhirreference.FHIRReference, False, None, False), + ("patient", "patient", fhirreference.FHIRReference, False, None, True), + ("period", "period", period.Period, False, None, False), + ("referralRequest", "referralRequest", fhirreference.FHIRReference, True, None, False), + ("status", "status", str, False, None, True), + ("statusHistory", "statusHistory", EpisodeOfCareStatusHistory, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +from . import backboneelement + +class EpisodeOfCareCareTeam(backboneelement.BackboneElement): + """ Other practitioners facilitating this episode of care. + + The list of practitioners that may be facilitating this episode of care for + specific purposes. + """ + + resource_name = "EpisodeOfCareCareTeam" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.member = None + """ The practitioner (or Organization) within the team. + Type `FHIRReference` referencing `Practitioner, Organization` (represented as `dict` in JSON). """ + + self.period = None + """ Period of time for this role. + Type `Period` (represented as `dict` in JSON). """ + + self.role = None + """ Role taken by this team member. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(EpisodeOfCareCareTeam, self).__init__(jsondict) + + def elementProperties(self): + js = super(EpisodeOfCareCareTeam, self).elementProperties() + js.extend([ + ("member", "member", fhirreference.FHIRReference, False, None, False), + ("period", "period", period.Period, False, None, False), + ("role", "role", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +class EpisodeOfCareStatusHistory(backboneelement.BackboneElement): + """ Past list of status codes. + + The history of statuses that the EpisodeOfCare has been through (without + requiring processing the history of the resource). + """ + + resource_name = "EpisodeOfCareStatusHistory" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.period = None + """ Period for the status. + Type `Period` (represented as `dict` in JSON). """ + + self.status = None + """ planned | waitlist | active | onhold | finished | cancelled. + Type `str`. """ + + super(EpisodeOfCareStatusHistory, self).__init__(jsondict) + + def elementProperties(self): + js = super(EpisodeOfCareStatusHistory, self).elementProperties() + js.extend([ + ("period", "period", period.Period, False, None, True), + ("status", "status", str, False, None, True), + ]) + return js + + +from . import codeableconcept +from . import fhirreference +from . import identifier +from . import period diff --git a/fhirclient/models/DSTU2/episodeofcare_tests.py b/fhirclient/models/DSTU2/episodeofcare_tests.py new file mode 100644 index 000000000..57e32790d --- /dev/null +++ b/fhirclient/models/DSTU2/episodeofcare_tests.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import episodeofcare +from .fhirdate import FHIRDate + + +class EpisodeOfCareTests(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("EpisodeOfCare", js["resourceType"]) + return episodeofcare.EpisodeOfCare(js) + + def testEpisodeOfCare1(self): + inst = self.instantiate_from("episodeofcare-example.json") + self.assertIsNotNone(inst, "Must have instantiated a EpisodeOfCare instance") + self.implEpisodeOfCare1(inst) + + js = inst.as_json() + self.assertEqual("EpisodeOfCare", js["resourceType"]) + inst2 = episodeofcare.EpisodeOfCare(js) + self.implEpisodeOfCare1(inst2) + + def implEpisodeOfCare1(self, inst): + self.assertEqual(inst.careTeam[0].period.end.date, FHIRDate("2014-09-16").date) + self.assertEqual(inst.careTeam[0].period.end.as_json(), "2014-09-16") + self.assertEqual(inst.careTeam[0].period.start.date, FHIRDate("2014-09-01").date) + self.assertEqual(inst.careTeam[0].period.start.as_json(), "2014-09-01") + self.assertEqual(inst.careTeam[0].role[0].coding[0].code, "AO") + self.assertEqual(inst.careTeam[0].role[0].coding[0].display, "Assessment Worker") + self.assertEqual(inst.careTeam[0].role[0].coding[0].system, "http://example.org/EpisodeOfCare/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.period.start.date, FHIRDate("2014-09-01").date) + self.assertEqual(inst.period.start.as_json(), "2014-09-01") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.statusHistory[0].period.end.date, FHIRDate("2014-09-14").date) + self.assertEqual(inst.statusHistory[0].period.end.as_json(), "2014-09-14") + self.assertEqual(inst.statusHistory[0].period.start.date, FHIRDate("2014-09-01").date) + self.assertEqual(inst.statusHistory[0].period.start.as_json(), "2014-09-01") + self.assertEqual(inst.statusHistory[0].status, "planned") + self.assertEqual(inst.statusHistory[1].period.end.date, FHIRDate("2014-09-21").date) + self.assertEqual(inst.statusHistory[1].period.end.as_json(), "2014-09-21") + self.assertEqual(inst.statusHistory[1].period.start.date, FHIRDate("2014-09-15").date) + self.assertEqual(inst.statusHistory[1].period.start.as_json(), "2014-09-15") + self.assertEqual(inst.statusHistory[1].status, "active") + self.assertEqual(inst.statusHistory[2].period.end.date, FHIRDate("2014-09-24").date) + self.assertEqual(inst.statusHistory[2].period.end.as_json(), "2014-09-24") + self.assertEqual(inst.statusHistory[2].period.start.date, FHIRDate("2014-09-22").date) + self.assertEqual(inst.statusHistory[2].period.start.as_json(), "2014-09-22") + self.assertEqual(inst.statusHistory[2].status, "onhold") + self.assertEqual(inst.statusHistory[3].period.start.date, FHIRDate("2014-09-25").date) + self.assertEqual(inst.statusHistory[3].period.start.as_json(), "2014-09-25") + self.assertEqual(inst.statusHistory[3].status, "active") + 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 Package") + self.assertEqual(inst.type[0].coding[0].system, "http://example.org/EpisodeOfCare/Type") + diff --git a/fhirclient/models/DSTU2/explanationofbenefit.py b/fhirclient/models/DSTU2/explanationofbenefit.py new file mode 100644 index 000000000..3964b3f56 --- /dev/null +++ b/fhirclient/models/DSTU2/explanationofbenefit.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ExplanationOfBenefit) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class ExplanationOfBenefit(domainresource.DomainResource): + """ Remittance resource. + + This resource provides: the claim details; adjudication details from the + processing of a Claim; and optionally account balance information, for + informing the subscriber of the benefits provided. + """ + + resource_name = "ExplanationOfBenefit" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.created = None + """ Creation date. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.disposition = None + """ Disposition Message. + Type `str`. """ + + self.identifier = None + """ Business Identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.organization = None + """ Insurer. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.originalRuleset = None + """ Original version. + Type `Coding` (represented as `dict` in JSON). """ + + self.outcome = None + """ complete | error. + Type `str`. """ + + self.request = None + """ Claim reference. + 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). """ + + self.ruleset = None + """ Resource version. + Type `Coding` (represented as `dict` in JSON). """ + + super(ExplanationOfBenefit, self).__init__(jsondict) + + def elementProperties(self): + js = super(ExplanationOfBenefit, self).elementProperties() + js.extend([ + ("created", "created", fhirdate.FHIRDate, False, None, False), + ("disposition", "disposition", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("organization", "organization", fhirreference.FHIRReference, False, None, False), + ("originalRuleset", "originalRuleset", coding.Coding, 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), + ("ruleset", "ruleset", coding.Coding, False, None, False), + ]) + return js + + +from . import coding +from . import fhirdate +from . import fhirreference +from . import identifier diff --git a/fhirclient/models/DSTU2/explanationofbenefit_tests.py b/fhirclient/models/DSTU2/explanationofbenefit_tests.py new file mode 100644 index 000000000..f0f660dcc --- /dev/null +++ b/fhirclient/models/DSTU2/explanationofbenefit_tests.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import explanationofbenefit +from .fhirdate import FHIRDate + + +class ExplanationOfBenefitTests(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("ExplanationOfBenefit", js["resourceType"]) + return explanationofbenefit.ExplanationOfBenefit(js) + + def testExplanationOfBenefit1(self): + inst = self.instantiate_from("explanationofbenefit-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ExplanationOfBenefit instance") + self.implExplanationOfBenefit1(inst) + + js = inst.as_json() + self.assertEqual("ExplanationOfBenefit", js["resourceType"]) + inst2 = explanationofbenefit.ExplanationOfBenefit(js) + self.implExplanationOfBenefit1(inst2) + + def implExplanationOfBenefit1(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/eob") + self.assertEqual(inst.identifier[0].value, "987654321") + self.assertEqual(inst.outcome, "complete") + self.assertEqual(inst.text.div, "
A human-readable rendering of the ExplanationOfBenefit
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/extension.py b/fhirclient/models/DSTU2/extension.py new file mode 100644 index 000000000..7fcb2d907 --- /dev/null +++ b/fhirclient/models/DSTU2/extension.py @@ -0,0 +1,218 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Extension) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Extension(element.Element): + """ None. + + Optional Extensions Element - found in all resources. + """ + + resource_name = "Extension" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.url = None + """ identifies the meaning of the extension. + Type `str`. """ + + self.valueAddress = None + """ Value of extension. + Type `Address` (represented as `dict` in JSON). """ + + self.valueAnnotation = None + """ Value of extension. + Type `Annotation` (represented as `dict` in JSON). """ + + self.valueAttachment = None + """ Value of extension. + Type `Attachment` (represented as `dict` in JSON). """ + + self.valueBase64Binary = None + """ Value of extension. + Type `str`. """ + + self.valueBoolean = None + """ Value of extension. + Type `bool`. """ + + self.valueCode = None + """ Value of extension. + Type `str`. """ + + self.valueCodeableConcept = None + """ Value of extension. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueCoding = None + """ Value of extension. + Type `Coding` (represented as `dict` in JSON). """ + + self.valueContactPoint = None + """ Value of extension. + Type `ContactPoint` (represented as `dict` in JSON). """ + + self.valueDate = None + """ Value of extension. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueDateTime = None + """ Value of extension. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueDecimal = None + """ Value of extension. + Type `float`. """ + + self.valueHumanName = None + """ Value of extension. + Type `HumanName` (represented as `dict` in JSON). """ + + self.valueId = None + """ Value of extension. + Type `str`. """ + + self.valueIdentifier = None + """ Value of extension. + Type `Identifier` (represented as `dict` in JSON). """ + + self.valueInstant = None + """ Value of extension. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueInteger = None + """ Value of extension. + Type `int`. """ + + self.valueMarkdown = None + """ Value of extension. + Type `str`. """ + + self.valueMeta = None + """ Value of extension. + Type `Meta` (represented as `dict` in JSON). """ + + self.valueOid = None + """ Value of extension. + Type `str`. """ + + self.valuePeriod = None + """ Value of extension. + Type `Period` (represented as `dict` in JSON). """ + + self.valuePositiveInt = None + """ Value of extension. + Type `int`. """ + + self.valueQuantity = None + """ Value of extension. + Type `Quantity` (represented as `dict` in JSON). """ + + self.valueRange = None + """ Value of extension. + Type `Range` (represented as `dict` in JSON). """ + + self.valueRatio = None + """ Value of extension. + Type `Ratio` (represented as `dict` in JSON). """ + + self.valueReference = None + """ Value of extension. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.valueSampledData = None + """ Value of extension. + Type `SampledData` (represented as `dict` in JSON). """ + + self.valueSignature = None + """ Value of extension. + Type `Signature` (represented as `dict` in JSON). """ + + self.valueString = None + """ Value of extension. + Type `str`. """ + + self.valueTime = None + """ Value of extension. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueTiming = None + """ Value of extension. + Type `Timing` (represented as `dict` in JSON). """ + + self.valueUnsignedInt = None + """ Value of extension. + Type `int`. """ + + self.valueUri = None + """ Value of extension. + Type `str`. """ + + super(Extension, self).__init__(jsondict) + + def elementProperties(self): + js = super(Extension, self).elementProperties() + js.extend([ + ("url", "url", str, False, None, True), + ("valueAddress", "valueAddress", address.Address, False, "value", False), + ("valueAnnotation", "valueAnnotation", annotation.Annotation, False, "value", False), + ("valueAttachment", "valueAttachment", attachment.Attachment, False, "value", False), + ("valueBase64Binary", "valueBase64Binary", str, False, "value", False), + ("valueBoolean", "valueBoolean", bool, False, "value", False), + ("valueCode", "valueCode", str, False, "value", False), + ("valueCodeableConcept", "valueCodeableConcept", codeableconcept.CodeableConcept, False, "value", False), + ("valueCoding", "valueCoding", coding.Coding, False, "value", False), + ("valueContactPoint", "valueContactPoint", contactpoint.ContactPoint, False, "value", False), + ("valueDate", "valueDate", fhirdate.FHIRDate, False, "value", False), + ("valueDateTime", "valueDateTime", fhirdate.FHIRDate, False, "value", False), + ("valueDecimal", "valueDecimal", float, 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), + ("valueOid", "valueOid", str, 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), + ("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), + ("valueUnsignedInt", "valueUnsignedInt", int, False, "value", False), + ("valueUri", "valueUri", str, False, "value", False), + ]) + return js + + +from . import address +from . import annotation +from . import attachment +from . import codeableconcept +from . import coding +from . import contactpoint +from . import fhirdate +from . import fhirreference +from . import humanname +from . import identifier +from . import meta +from . import period +from . import quantity +from . import range +from . import ratio +from . import sampleddata +from . import signature +from . import timing diff --git a/fhirclient/models/DSTU2/familymemberhistory.py b/fhirclient/models/DSTU2/familymemberhistory.py new file mode 100644 index 000000000..799534ca3 --- /dev/null +++ b/fhirclient/models/DSTU2/familymemberhistory.py @@ -0,0 +1,200 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/FamilyMemberHistory) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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. + """ + + resource_name = "FamilyMemberHistory" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.ageQuantity = None + """ (approximate) age. + Type `Quantity` referencing `Age` (represented as `dict` in JSON). """ + + self.ageRange = None + """ (approximate) age. + Type `Range` (represented as `dict` in JSON). """ + + self.ageString = None + """ (approximate) age. + Type `str`. """ + + self.bornDate = None + """ (approximate) date of birth. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.bornPeriod = None + """ (approximate) date of birth. + Type `Period` (represented as `dict` in JSON). """ + + self.bornString = None + """ (approximate) date of birth. + Type `str`. """ + + self.condition = None + """ Condition that the related person had. + List of `FamilyMemberHistoryCondition` items (represented as `dict` in JSON). """ + + self.date = None + """ When history was captured/updated. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.deceasedBoolean = None + """ Dead? How old/when?. + Type `bool`. """ + + self.deceasedDate = None + """ Dead? How old/when?. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.deceasedQuantity = None + """ Dead? How old/when?. + Type `Quantity` referencing `Age` (represented as `dict` in JSON). """ + + self.deceasedRange = None + """ Dead? How old/when?. + Type `Range` (represented as `dict` in JSON). """ + + self.deceasedString = None + """ Dead? How old/when?. + Type `str`. """ + + 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.name = None + """ The family member described. + Type `str`. """ + + self.note = None + """ General note about related person. + Type `Annotation` (represented as `dict` in JSON). """ + + self.patient = None + """ Patient history is about. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.relationship = None + """ Relationship to the subject. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.status = None + """ partial | completed | entered-in-error | health-unknown. + Type `str`. """ + + super(FamilyMemberHistory, self).__init__(jsondict) + + def elementProperties(self): + js = super(FamilyMemberHistory, self).elementProperties() + js.extend([ + ("ageQuantity", "ageQuantity", quantity.Quantity, False, "age", False), + ("ageRange", "ageRange", range.Range, False, "age", False), + ("ageString", "ageString", str, False, "age", False), + ("bornDate", "bornDate", fhirdate.FHIRDate, False, "born", False), + ("bornPeriod", "bornPeriod", period.Period, False, "born", False), + ("bornString", "bornString", str, False, "born", False), + ("condition", "condition", FamilyMemberHistoryCondition, True, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("deceasedBoolean", "deceasedBoolean", bool, False, "deceased", False), + ("deceasedDate", "deceasedDate", fhirdate.FHIRDate, False, "deceased", False), + ("deceasedQuantity", "deceasedQuantity", quantity.Quantity, False, "deceased", False), + ("deceasedRange", "deceasedRange", range.Range, False, "deceased", False), + ("deceasedString", "deceasedString", str, False, "deceased", False), + ("gender", "gender", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("name", "name", str, False, None, False), + ("note", "note", annotation.Annotation, False, None, False), + ("patient", "patient", fhirreference.FHIRReference, False, None, True), + ("relationship", "relationship", codeableconcept.CodeableConcept, False, None, True), + ("status", "status", str, False, None, True), + ]) + return js + + +from . import backboneelement + +class FamilyMemberHistoryCondition(backboneelement.BackboneElement): + """ Condition that the related person had. + + The significant Conditions (or condition) that the family member had. This + is a repeating section to allow a system to represent more than one + condition per resource, though there is nothing stopping multiple resources + - one per condition. + """ + + resource_name = "FamilyMemberHistoryCondition" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.code = None + """ Condition suffered by relation. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.note = None + """ Extra information about condition. + Type `Annotation` (represented as `dict` in JSON). """ + + self.onsetPeriod = None + """ When condition first manifested. + Type `Period` (represented as `dict` in JSON). """ + + self.onsetQuantity = None + """ When condition first manifested. + Type `Quantity` referencing `Age` (represented as `dict` in JSON). """ + + self.onsetRange = None + """ When condition first manifested. + Type `Range` (represented as `dict` in JSON). """ + + self.onsetString = None + """ When condition first manifested. + Type `str`. """ + + self.outcome = None + """ deceased | permanent disability | etc.. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(FamilyMemberHistoryCondition, self).__init__(jsondict) + + def elementProperties(self): + js = super(FamilyMemberHistoryCondition, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("note", "note", annotation.Annotation, False, None, False), + ("onsetPeriod", "onsetPeriod", period.Period, False, "onset", False), + ("onsetQuantity", "onsetQuantity", quantity.Quantity, False, "onset", False), + ("onsetRange", "onsetRange", range.Range, False, "onset", False), + ("onsetString", "onsetString", str, False, "onset", False), + ("outcome", "outcome", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import annotation +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier +from . import period +from . import quantity +from . import range diff --git a/fhirclient/models/DSTU2/familymemberhistory_tests.py b/fhirclient/models/DSTU2/familymemberhistory_tests.py new file mode 100644 index 000000000..4ec37bdf6 --- /dev/null +++ b/fhirclient/models/DSTU2/familymemberhistory_tests.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import familymemberhistory +from .fhirdate import FHIRDate + + +class FamilyMemberHistoryTests(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("FamilyMemberHistory", js["resourceType"]) + return familymemberhistory.FamilyMemberHistory(js) + + def testFamilyMemberHistory1(self): + inst = self.instantiate_from("familymemberhistory-example.json") + self.assertIsNotNone(inst, "Must have instantiated a FamilyMemberHistory instance") + self.implFamilyMemberHistory1(inst) + + js = inst.as_json() + self.assertEqual("FamilyMemberHistory", js["resourceType"]) + inst2 = familymemberhistory.FamilyMemberHistory(js) + self.implFamilyMemberHistory1(inst2) + + def implFamilyMemberHistory1(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].system, "http://snomed.info/sct") + self.assertEqual(inst.condition[0].code.text, "Heart Attack") + self.assertEqual(inst.condition[0].note.text, "Was fishing at the time. At least he went doing someting he loved.") + self.assertEqual(inst.condition[0].onsetQuantity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.condition[0].onsetQuantity.unit, "a") + self.assertEqual(inst.condition[0].onsetQuantity.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.relationship.coding[0].code, "father") + self.assertEqual(inst.relationship.coding[0].system, "http://hl7.org/fhir/familial-relationship") + self.assertEqual(inst.status, "completed") + 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-mother.json") + self.assertIsNotNone(inst, "Must have instantiated a FamilyMemberHistory instance") + self.implFamilyMemberHistory2(inst) + + js = inst.as_json() + self.assertEqual("FamilyMemberHistory", js["resourceType"]) + inst2 = familymemberhistory.FamilyMemberHistory(js) + self.implFamilyMemberHistory2(inst2) + + def implFamilyMemberHistory2(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].system, "http://snomed.info/sct") + self.assertEqual(inst.condition[0].code.text, "Stroke") + self.assertEqual(inst.condition[0].onsetQuantity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.condition[0].onsetQuantity.unit, "a") + self.assertEqual(inst.condition[0].onsetQuantity.value, 56) + self.assertEqual(inst.id, "mother") + self.assertEqual(inst.relationship.coding[0].code, "mother") + self.assertEqual(inst.relationship.coding[0].system, "http://hl7.org/fhir/familial-relationship") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.div, "
Mother died of a stroke aged 56
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/fhirabstractbase.py b/fhirclient/models/DSTU2/fhirabstractbase.py new file mode 100644 index 000000000..8c7729ae1 --- /dev/null +++ b/fhirclient/models/DSTU2/fhirabstractbase.py @@ -0,0 +1,190 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Base class for all FHIR elements. + +import logging + + +class FHIRAbstractBase(object): + """ Abstract base class for all FHIR elements. + """ + + def __init__(self, jsondict=None): + + self._resolved = None + """ Dictionary of resolved resources. """ + + self._owner = None + """ Points to the parent resource, if there is one. """ + + if jsondict is not None: + self.update_with_json(jsondict) + + + # MARK: Instantiation from JSON + + @classmethod + def with_json(cls, jsonobj): + """ Initialize an element from a JSON dictionary or array. + + If the JSON dictionary has a "resourceType" entry and the specified + resource type is not the receiving classes type, uses + `FHIRElementFactory` to return a correct class instance. + + :param jsonobj: A dict or list of dicts to instantiate from + :returns: An instance or a list of instances created from JSON data + """ + if isinstance(jsonobj, dict): + return cls._with_json_dict(jsonobj) + + arr = [] + for jsondict in jsonobj: + arr.append(cls._with_json_dict(jsondict)) + return arr + + @classmethod + def _with_json_dict(cls, jsondict): + if not isinstance(jsondict, dict): + raise Exception("Cannot use this method with anything but a JSON dictionary, got {}" + .format(jsondict)) + return cls(jsondict) + + @classmethod + def with_json_and_owner(cls, jsonobj, owner): + """ Instantiates by forwarding to `with_json()`, then remembers the + "owner" of the instantiated elements. The "owner" is the resource + containing the receiver and is used to resolve contained resources. + + :param dict jsonobj: Decoded JSON dictionary + :param FHIRElement owner: The owning parent + :returns: An instance or a list of instances created from JSON data + """ + instance = cls.with_json(jsonobj) + if isinstance(instance, list): + for inst in instance: + inst._owner = owner + else: + instance._owner = owner + + return instance + + + # MARK: (De)Serialization + + def elementProperties(self): + """ Returns a list of tuples, one tuple for each property that should + be serialized, as: ("name", "json_name", type, is_list, "of_many", not_optional) + """ + return [] + + def update_with_json(self, jsondict): + """ Update the receiver with data in a JSON dictionary. + """ + if jsondict is None: + return + if not isinstance(jsondict, dict): + logging.warning("Non-dict type {} fed to `update_with_json` on {}" + .format(type(jsondict), type(self))) + return + + # loop all registered properties and instantiate + found = set(['resourceType', 'fhir_comments']) + nonoptionals = set() + for name, jsname, typ, is_list, of_many, not_optional in self.elementProperties(): + if not jsname in jsondict: + if not_optional: + nonoptionals.add(of_many or jsname) + continue + + if hasattr(typ, 'with_json_and_owner'): + setattr(self, name, typ.with_json_and_owner(jsondict[jsname], self)) + else: + setattr(self, name, jsondict[jsname]) + # TODO: look at `_name` if this is a primitive + found.add(jsname) + found.add('_'+jsname) + if of_many is not None: + found.add(of_many) + + # were there missing non-optional entries? + if len(nonoptionals - found) > 0: + for miss in nonoptionals - found: + logging.warning("Non-optional property '{}' on {} is missing from JSON" + .format(miss, self)) + + # were there superfluous dictionary keys? + if len(set(jsondict.keys()) - found) > 0: + for supflu in set(jsondict.keys()) - found: + logging.warning("Superfluous entry '{}' in JSON for {}" + .format(supflu, self)) + + def as_json(self): + """ Serializes to JSON by inspecting `elementProperties()` and creating + a JSON dictionary of all registered properties. + """ + js = {} + + # JSONify all registered properties + found = set() + nonoptionals = set() + for name, jsname, typ, is_list, of_many, not_optional in self.elementProperties(): + if not_optional: + nonoptionals.add(of_many or jsname) + + val = getattr(self, name) + if val is None: + continue + if is_list: + if len(val) > 0: + found.add(of_many or jsname) + js[jsname] = [v.as_json() if hasattr(v, 'as_json') else v for v in val] + else: + found.add(of_many or jsname) + js[jsname] = val.as_json() if hasattr(val, 'as_json') else val + + # any missing non-optionals? + if len(nonoptionals - found) > 0: + for nonop in nonoptionals - found: + logging.warning("Element '{}' is not optional, you should provide a value for it on {}" + .format(nonop, self)) + return js + + + # MARK: Handling References + + def owningResource(self): + """ Walks the owner hierarchy and returns the next parent that is a + `DomainResource` instance. + """ + owner = self._owner + while owner is not None and not hasattr(owner, "contained"): + owner = owner._owner + return owner + + def resolvedReference(self, refid): + """ Returns the resolved reference with the given id, if it has been + resolved already. If it hasn't, forwards the call to its owner if it + has one. + + You should probably use `resolve()` on the `FHIRReference` itself. + + :param refid: The id of the resource to resolve + :returns: An instance of `Resource`, if it was found + """ + if self._resolved and refid in self._resolved: + return self._resolved[refid] + return self._owner.resolvedReference(refid) if self._owner is not None else None + + def didResolveReference(self, refid, resolved): + """ Called by `FHIRResource` when it resolves a reference. Stores the + resolved reference into the `_resolved` dictionary. + + :param refid: The id of the resource that was resolved + :param refid: The resolved resource, ready to be cached + """ + if self._resolved is not None: + self._resolved[refid] = resolved + else: + self._resolved = {refid: resolved} + diff --git a/fhirclient/models/DSTU2/fhirabstractresource.py b/fhirclient/models/DSTU2/fhirabstractresource.py new file mode 100644 index 000000000..f1b0f1754 --- /dev/null +++ b/fhirclient/models/DSTU2/fhirabstractresource.py @@ -0,0 +1,186 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Base class for FHIR resources. +# 2014, SMART Health IT. + +from . import fhirabstractbase + + +class FHIRAbstractResource(fhirabstractbase.FHIRAbstractBase): + """ Extends the FHIRAbstractBase with server talking capabilities. + """ + resource_name = 'FHIRAbstractResource' + + def __init__(self, jsondict=None): + self._server = None + """ The server the instance was read from. """ + + super(FHIRAbstractResource, self).__init__(jsondict) + + @classmethod + def _with_json_dict(cls, jsondict): + """ Overridden to use a factory if called when "resourceType" is + defined in the JSON but does not match the receiver's resource_name. + """ + if not isinstance(jsondict, dict): + raise Exception("Cannot use this method with anything but a JSON dictionary, got {}" + .format(jsondict)) + + res_type = jsondict.get('resourceType') + if res_type and res_type != cls.resource_name: + return fhirelementfactory.FHIRElementFactory.instantiate(res_type, jsondict) + return super(FHIRAbstractResource, cls)._with_json_dict(jsondict) + + def as_json(self): + js = super(FHIRAbstractResource, self).as_json() + js['resourceType'] = self.resource_name + return js + + + # MARK: Handling Paths + + def relativeBase(self): + return self.__class__.resource_name + + def relativePath(self): + return "{}/{}".format(self.relativeBase(), self.id) + + + # MARK: Server Connection + + @property + def server(self): + """ Walks the owner hierarchy until it finds an owner with a server. + """ + if self._server is None: + owningRes = self.owningResource() + self._server = owningRes.server if owningRes is not None else None + return self._server + + @classmethod + def read(cls, rem_id, server): + """ Read the resource with the given id from the given server. The + passed-in server instance must support a `request_json()` method call, + taking a relative path as first (and only mandatory) argument. + + :param str rem_id: The id of the resource on the remote server + :param FHIRServer server: An instance of a FHIR server or compatible class + :returns: An instance of the receiving class + """ + if not rem_id: + raise Exception("Cannot read resource without remote id") + + path = '{}/{}'.format(cls.resource_name, rem_id) + instance = cls.read_from(path, server) + instance._local_id = rem_id + + return instance + + @classmethod + def read_from(cls, path, server): + """ Requests data from the given REST path on the server and creates + an instance of the receiving class. + + :param str path: The REST path to read from + :param FHIRServer server: An instance of a FHIR server or compatible class + :returns: An instance of the receiving class + """ + if not path: + raise Exception("Cannot read resource without REST path") + if server is None: + raise Exception("Cannot read resource without server instance") + + ret = server.request_json(path) + instance = cls(jsondict=ret) + instance._server = server + return instance + + def create(self, server): + """ Attempt to create the receiver on the given server, using a POST + command. + + :param FHIRServer server: The server to create the receiver on + :returns: None or the response JSON on success + """ + srv = server or self.server + if srv is None: + raise Exception("Cannot create a resource without a server") + if self.id: + raise Exception("This resource already has an id, cannot create") + + ret = srv.post_json(self.relativePath(), self.as_json()) + if len(ret.text) > 0: + return ret.json() + return None + + def update(self, server=None): + """ Update the receiver's representation on the given server, issuing + a PUT command. + + :param FHIRServer server: The server to update the receiver on; + optional, will use the instance's `server` if needed. + :returns: None or the response JSON on success + """ + srv = server or self.server + if srv is None: + raise Exception("Cannot update a resource that does not have a server") + if not self.id: + raise Exception("Cannot update a resource that does not have an id") + + ret = srv.put_json(self.relativePath(), self.as_json()) + if len(ret.text) > 0: + return ret.json() + return None + + def delete(self): + """ Delete the receiver from the given server with a DELETE command. + + :returns: None or the response JSON on success + """ + if self.server is None: + raise Exception("Cannot delete a resource that does not have a server") + if not self.id: + raise Exception("Cannot delete a resource that does not have an id") + + ret = self.server.delete_json(self.relativePath()) + if len(ret.text) > 0: + return ret.json() + return None + + + # MARK: Search + + def search(self, struct=None): + """ Search can be started via a dictionary containing a search + construct. + + Calling this method with a search struct will return a `FHIRSearch` + object representing the search struct, with "$type" and "id" added. + + :param dict struct: An optional search structure + :returns: A FHIRSearch instance + """ + if struct is None: + struct = {'$type': self.__class__.resource_name} + if self._local_id is not None or self.id is not None: + struct['id'] = self._local_id or self.id + return self.__class__.where(struct) + + @classmethod + def where(cls, struct): + """ Search can be started via a dictionary containing a search + construct. + + Calling this method with a search struct will return a `FHIRSearch` + object representing the search struct + + :param dict struct: A search structure + :returns: A FHIRSearch instance + """ + return fhirsearch.FHIRSearch(cls, struct) + + +from . import fhirdate +from . import fhirsearch +from . import fhirelementfactory diff --git a/fhirclient/models/DSTU2/fhirdate.py b/fhirclient/models/DSTU2/fhirdate.py new file mode 100644 index 000000000..f86dca509 --- /dev/null +++ b/fhirclient/models/DSTU2/fhirdate.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Facilitate working with dates. +# 2014, SMART Health IT. + +import sys +import isodate +import datetime + + +class FHIRDate(object): + """ Facilitate working with dates. + + - `date`: datetime object representing the receiver's date-time + """ + + def __init__(self, jsonval=None): + self.date = None + if jsonval is not None: + if 'T' in jsonval: + self.date = isodate.parse_datetime(jsonval) + else: + self.date = isodate.parse_date(jsonval) + self.origval = jsonval + + def __setattr__(self, prop, value): + if 'date' == prop: + self.origval = None + object.__setattr__(self, prop, value) + + @property + def isostring(self): + if self.date is None: + return None + if isinstance(self.date, datetime.datetime): + return isodate.datetime_isoformat(self.date) + return isodate.date_isoformat(self.date) + + @classmethod + def with_json(cls, jsonobj): + """ Initialize a date from an ISO date string. + """ + isstr = isinstance(jsonobj, str) + if not isstr and sys.version_info[0] < 3: # Python 2.x has 'str' and 'unicode' + isstr = isinstance(jsonobj, basestring) + if isstr: + return cls(jsonobj) + + arr = [] + for jsonval in jsonobj: + arr.append(cls(jsonval)) + return arr + + @classmethod + def with_json_and_owner(cls, jsonobj, owner): + """ Added for compatibility reasons to FHIRElement; "owner" is + discarded. + """ + return cls.with_json(jsonobj) + + def as_json(self): + if self.origval is not None: + return self.origval + return self.isostring + diff --git a/fhirclient/models/DSTU2/fhirelementfactory.py b/fhirclient/models/DSTU2/fhirelementfactory.py new file mode 100644 index 000000000..be0555d30 --- /dev/null +++ b/fhirclient/models/DSTU2/fhirelementfactory.py @@ -0,0 +1,1063 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from . import element + + +class FHIRElementFactory(object): + """ Factory class to instantiate resources by resource name. + """ + + @classmethod + def instantiate(cls, resource_name, jsondict): + """ Instantiate a resource of the type correlating to "resource_name". + + :param str resource_name: The name/type of the resource to instantiate + :param dict jsondict: The JSON dictionary to use for data + :returns: A resource of the respective type or `Element` + """ + if "Account" == resource_name: + from . import account + return account.Account(jsondict) + if "Address" == resource_name: + from . import address + return address.Address(jsondict) + if "Age" == resource_name: + from . import age + return age.Age(jsondict) + if "AllergyIntolerance" == resource_name: + from . import allergyintolerance + return allergyintolerance.AllergyIntolerance(jsondict) + if "AllergyIntoleranceReaction" == resource_name: + from . import allergyintolerance + return allergyintolerance.AllergyIntoleranceReaction(jsondict) + if "Annotation" == resource_name: + from . import annotation + return annotation.Annotation(jsondict) + if "Appointment" == resource_name: + from . import appointment + return appointment.Appointment(jsondict) + if "AppointmentParticipant" == resource_name: + from . import appointment + return appointment.AppointmentParticipant(jsondict) + if "AppointmentResponse" == resource_name: + from . import appointmentresponse + return appointmentresponse.AppointmentResponse(jsondict) + if "Attachment" == resource_name: + from . import attachment + return attachment.Attachment(jsondict) + if "AuditEvent" == resource_name: + from . import auditevent + return auditevent.AuditEvent(jsondict) + if "AuditEventEvent" == resource_name: + from . import auditevent + return auditevent.AuditEventEvent(jsondict) + if "AuditEventObject" == resource_name: + from . import auditevent + return auditevent.AuditEventObject(jsondict) + if "AuditEventObjectDetail" == resource_name: + from . import auditevent + return auditevent.AuditEventObjectDetail(jsondict) + if "AuditEventParticipant" == resource_name: + from . import auditevent + return auditevent.AuditEventParticipant(jsondict) + if "AuditEventParticipantNetwork" == resource_name: + from . import auditevent + return auditevent.AuditEventParticipantNetwork(jsondict) + if "AuditEventSource" == resource_name: + from . import auditevent + return auditevent.AuditEventSource(jsondict) + if "BackboneElement" == resource_name: + from . import backboneelement + return backboneelement.BackboneElement(jsondict) + if "Basic" == resource_name: + from . import basic + return basic.Basic(jsondict) + if "Binary" == resource_name: + from . import binary + return binary.Binary(jsondict) + if "BodySite" == resource_name: + from . import bodysite + return bodysite.BodySite(jsondict) + if "Bundle" == resource_name: + from . import bundle + return bundle.Bundle(jsondict) + if "BundleEntry" == resource_name: + from . import bundle + return bundle.BundleEntry(jsondict) + if "BundleEntryRequest" == resource_name: + from . import bundle + return bundle.BundleEntryRequest(jsondict) + if "BundleEntryResponse" == resource_name: + from . import bundle + return bundle.BundleEntryResponse(jsondict) + if "BundleEntrySearch" == resource_name: + from . import bundle + return bundle.BundleEntrySearch(jsondict) + if "BundleLink" == resource_name: + from . import bundle + return bundle.BundleLink(jsondict) + if "CarePlan" == resource_name: + from . import careplan + return careplan.CarePlan(jsondict) + if "CarePlanActivity" == resource_name: + from . import careplan + return careplan.CarePlanActivity(jsondict) + if "CarePlanActivityDetail" == resource_name: + from . import careplan + return careplan.CarePlanActivityDetail(jsondict) + if "CarePlanParticipant" == resource_name: + from . import careplan + return careplan.CarePlanParticipant(jsondict) + if "CarePlanRelatedPlan" == resource_name: + from . import careplan + return careplan.CarePlanRelatedPlan(jsondict) + if "Claim" == resource_name: + from . import claim + return claim.Claim(jsondict) + if "ClaimCoverage" == resource_name: + from . import claim + return claim.ClaimCoverage(jsondict) + if "ClaimDiagnosis" == resource_name: + from . import claim + return claim.ClaimDiagnosis(jsondict) + if "ClaimItem" == resource_name: + from . import claim + return claim.ClaimItem(jsondict) + if "ClaimItemDetail" == resource_name: + from . import claim + return claim.ClaimItemDetail(jsondict) + if "ClaimItemDetailSubDetail" == resource_name: + from . import claim + return claim.ClaimItemDetailSubDetail(jsondict) + if "ClaimItemProsthesis" == resource_name: + from . import claim + return claim.ClaimItemProsthesis(jsondict) + if "ClaimMissingTeeth" == resource_name: + from . import claim + return claim.ClaimMissingTeeth(jsondict) + if "ClaimPayee" == resource_name: + from . import claim + return claim.ClaimPayee(jsondict) + if "ClaimResponse" == resource_name: + from . import claimresponse + return claimresponse.ClaimResponse(jsondict) + if "ClaimResponseAddItem" == resource_name: + from . import claimresponse + return claimresponse.ClaimResponseAddItem(jsondict) + if "ClaimResponseAddItemAdjudication" == resource_name: + from . import claimresponse + return claimresponse.ClaimResponseAddItemAdjudication(jsondict) + if "ClaimResponseAddItemDetail" == resource_name: + from . import claimresponse + return claimresponse.ClaimResponseAddItemDetail(jsondict) + if "ClaimResponseAddItemDetailAdjudication" == resource_name: + from . import claimresponse + return claimresponse.ClaimResponseAddItemDetailAdjudication(jsondict) + if "ClaimResponseCoverage" == resource_name: + from . import claimresponse + return claimresponse.ClaimResponseCoverage(jsondict) + if "ClaimResponseError" == resource_name: + from . import claimresponse + return claimresponse.ClaimResponseError(jsondict) + if "ClaimResponseItem" == resource_name: + from . import claimresponse + return claimresponse.ClaimResponseItem(jsondict) + if "ClaimResponseItemAdjudication" == resource_name: + from . import claimresponse + return claimresponse.ClaimResponseItemAdjudication(jsondict) + if "ClaimResponseItemDetail" == resource_name: + from . import claimresponse + return claimresponse.ClaimResponseItemDetail(jsondict) + if "ClaimResponseItemDetailAdjudication" == resource_name: + from . import claimresponse + return claimresponse.ClaimResponseItemDetailAdjudication(jsondict) + if "ClaimResponseItemDetailSubDetail" == resource_name: + from . import claimresponse + return claimresponse.ClaimResponseItemDetailSubDetail(jsondict) + if "ClaimResponseItemDetailSubDetailAdjudication" == resource_name: + from . import claimresponse + return claimresponse.ClaimResponseItemDetailSubDetailAdjudication(jsondict) + if "ClaimResponseNote" == resource_name: + from . import claimresponse + return claimresponse.ClaimResponseNote(jsondict) + if "ClinicalImpression" == resource_name: + from . import clinicalimpression + return clinicalimpression.ClinicalImpression(jsondict) + if "ClinicalImpressionFinding" == resource_name: + from . import clinicalimpression + return clinicalimpression.ClinicalImpressionFinding(jsondict) + if "ClinicalImpressionInvestigations" == resource_name: + from . import clinicalimpression + return clinicalimpression.ClinicalImpressionInvestigations(jsondict) + if "ClinicalImpressionRuledOut" == resource_name: + from . import clinicalimpression + return clinicalimpression.ClinicalImpressionRuledOut(jsondict) + if "CodeableConcept" == resource_name: + from . import codeableconcept + return codeableconcept.CodeableConcept(jsondict) + if "Coding" == resource_name: + from . import coding + return coding.Coding(jsondict) + if "Communication" == resource_name: + from . import communication + return communication.Communication(jsondict) + if "CommunicationPayload" == resource_name: + from . import communication + return communication.CommunicationPayload(jsondict) + if "CommunicationRequest" == resource_name: + from . import communicationrequest + return communicationrequest.CommunicationRequest(jsondict) + if "CommunicationRequestPayload" == resource_name: + from . import communicationrequest + return communicationrequest.CommunicationRequestPayload(jsondict) + if "Composition" == resource_name: + from . import composition + return composition.Composition(jsondict) + if "CompositionAttester" == resource_name: + from . import composition + return composition.CompositionAttester(jsondict) + if "CompositionEvent" == resource_name: + from . import composition + return composition.CompositionEvent(jsondict) + if "CompositionSection" == resource_name: + from . import composition + return composition.CompositionSection(jsondict) + if "ConceptMap" == resource_name: + from . import conceptmap + return conceptmap.ConceptMap(jsondict) + if "ConceptMapContact" == resource_name: + from . import conceptmap + return conceptmap.ConceptMapContact(jsondict) + if "ConceptMapElement" == resource_name: + from . import conceptmap + return conceptmap.ConceptMapElement(jsondict) + if "ConceptMapElementTarget" == resource_name: + from . import conceptmap + return conceptmap.ConceptMapElementTarget(jsondict) + if "ConceptMapElementTargetDependsOn" == resource_name: + from . import conceptmap + return conceptmap.ConceptMapElementTargetDependsOn(jsondict) + if "Condition" == resource_name: + from . import condition + return condition.Condition(jsondict) + if "ConditionEvidence" == resource_name: + from . import condition + return condition.ConditionEvidence(jsondict) + if "ConditionStage" == resource_name: + from . import condition + return condition.ConditionStage(jsondict) + if "Conformance" == resource_name: + from . import conformance + return conformance.Conformance(jsondict) + if "ConformanceContact" == resource_name: + from . import conformance + return conformance.ConformanceContact(jsondict) + if "ConformanceDocument" == resource_name: + from . import conformance + return conformance.ConformanceDocument(jsondict) + if "ConformanceImplementation" == resource_name: + from . import conformance + return conformance.ConformanceImplementation(jsondict) + if "ConformanceMessaging" == resource_name: + from . import conformance + return conformance.ConformanceMessaging(jsondict) + if "ConformanceMessagingEndpoint" == resource_name: + from . import conformance + return conformance.ConformanceMessagingEndpoint(jsondict) + if "ConformanceMessagingEvent" == resource_name: + from . import conformance + return conformance.ConformanceMessagingEvent(jsondict) + if "ConformanceRest" == resource_name: + from . import conformance + return conformance.ConformanceRest(jsondict) + if "ConformanceRestInteraction" == resource_name: + from . import conformance + return conformance.ConformanceRestInteraction(jsondict) + if "ConformanceRestOperation" == resource_name: + from . import conformance + return conformance.ConformanceRestOperation(jsondict) + if "ConformanceRestResource" == resource_name: + from . import conformance + return conformance.ConformanceRestResource(jsondict) + if "ConformanceRestResourceInteraction" == resource_name: + from . import conformance + return conformance.ConformanceRestResourceInteraction(jsondict) + if "ConformanceRestResourceSearchParam" == resource_name: + from . import conformance + return conformance.ConformanceRestResourceSearchParam(jsondict) + if "ConformanceRestSecurity" == resource_name: + from . import conformance + return conformance.ConformanceRestSecurity(jsondict) + if "ConformanceRestSecurityCertificate" == resource_name: + from . import conformance + return conformance.ConformanceRestSecurityCertificate(jsondict) + if "ConformanceSoftware" == resource_name: + from . import conformance + return conformance.ConformanceSoftware(jsondict) + if "ContactPoint" == resource_name: + from . import contactpoint + return contactpoint.ContactPoint(jsondict) + if "Contract" == resource_name: + from . import contract + return contract.Contract(jsondict) + if "ContractActor" == resource_name: + from . import contract + return contract.ContractActor(jsondict) + if "ContractFriendly" == resource_name: + from . import contract + return contract.ContractFriendly(jsondict) + if "ContractLegal" == resource_name: + from . import contract + return contract.ContractLegal(jsondict) + if "ContractRule" == resource_name: + from . import contract + return contract.ContractRule(jsondict) + if "ContractSigner" == resource_name: + from . import contract + return contract.ContractSigner(jsondict) + if "ContractTerm" == resource_name: + from . import contract + return contract.ContractTerm(jsondict) + if "ContractTermActor" == resource_name: + from . import contract + return contract.ContractTermActor(jsondict) + if "ContractTermValuedItem" == resource_name: + from . import contract + return contract.ContractTermValuedItem(jsondict) + if "ContractValuedItem" == resource_name: + from . import contract + return contract.ContractValuedItem(jsondict) + if "Count" == resource_name: + from . import count + return count.Count(jsondict) + if "Coverage" == resource_name: + from . import coverage + return coverage.Coverage(jsondict) + if "DataElement" == resource_name: + from . import dataelement + return dataelement.DataElement(jsondict) + if "DataElementContact" == resource_name: + from . import dataelement + return dataelement.DataElementContact(jsondict) + if "DataElementMapping" == resource_name: + from . import dataelement + return dataelement.DataElementMapping(jsondict) + if "DetectedIssue" == resource_name: + from . import detectedissue + return detectedissue.DetectedIssue(jsondict) + if "DetectedIssueMitigation" == resource_name: + from . import detectedissue + return detectedissue.DetectedIssueMitigation(jsondict) + if "Device" == resource_name: + from . import device + return device.Device(jsondict) + if "DeviceComponent" == resource_name: + from . import devicecomponent + return devicecomponent.DeviceComponent(jsondict) + if "DeviceComponentProductionSpecification" == resource_name: + from . import devicecomponent + return devicecomponent.DeviceComponentProductionSpecification(jsondict) + if "DeviceMetric" == resource_name: + from . import devicemetric + return devicemetric.DeviceMetric(jsondict) + if "DeviceMetricCalibration" == resource_name: + from . import devicemetric + return devicemetric.DeviceMetricCalibration(jsondict) + if "DeviceUseRequest" == resource_name: + from . import deviceuserequest + return deviceuserequest.DeviceUseRequest(jsondict) + if "DeviceUseStatement" == resource_name: + from . import deviceusestatement + return deviceusestatement.DeviceUseStatement(jsondict) + if "DiagnosticOrder" == resource_name: + from . import diagnosticorder + return diagnosticorder.DiagnosticOrder(jsondict) + if "DiagnosticOrderEvent" == resource_name: + from . import diagnosticorder + return diagnosticorder.DiagnosticOrderEvent(jsondict) + if "DiagnosticOrderItem" == resource_name: + from . import diagnosticorder + return diagnosticorder.DiagnosticOrderItem(jsondict) + if "DiagnosticReport" == resource_name: + from . import diagnosticreport + return diagnosticreport.DiagnosticReport(jsondict) + if "DiagnosticReportImage" == resource_name: + from . import diagnosticreport + return diagnosticreport.DiagnosticReportImage(jsondict) + if "Distance" == resource_name: + from . import distance + return distance.Distance(jsondict) + if "DocumentManifest" == resource_name: + from . import documentmanifest + return documentmanifest.DocumentManifest(jsondict) + if "DocumentManifestContent" == resource_name: + from . import documentmanifest + return documentmanifest.DocumentManifestContent(jsondict) + if "DocumentManifestRelated" == resource_name: + from . import documentmanifest + return documentmanifest.DocumentManifestRelated(jsondict) + if "DocumentReference" == resource_name: + from . import documentreference + return documentreference.DocumentReference(jsondict) + if "DocumentReferenceContent" == resource_name: + from . import documentreference + return documentreference.DocumentReferenceContent(jsondict) + if "DocumentReferenceContext" == resource_name: + from . import documentreference + return documentreference.DocumentReferenceContext(jsondict) + if "DocumentReferenceContextRelated" == resource_name: + from . import documentreference + return documentreference.DocumentReferenceContextRelated(jsondict) + if "DocumentReferenceRelatesTo" == resource_name: + from . import documentreference + return documentreference.DocumentReferenceRelatesTo(jsondict) + if "DomainResource" == resource_name: + from . import domainresource + return domainresource.DomainResource(jsondict) + if "Duration" == resource_name: + from . import duration + return duration.Duration(jsondict) + if "Element" == resource_name: + from . import element + return element.Element(jsondict) + if "ElementDefinition" == resource_name: + from . import elementdefinition + return elementdefinition.ElementDefinition(jsondict) + if "ElementDefinitionBase" == resource_name: + from . import elementdefinition + return elementdefinition.ElementDefinitionBase(jsondict) + if "ElementDefinitionBinding" == resource_name: + from . import elementdefinition + return elementdefinition.ElementDefinitionBinding(jsondict) + if "ElementDefinitionConstraint" == resource_name: + from . import elementdefinition + return elementdefinition.ElementDefinitionConstraint(jsondict) + if "ElementDefinitionMapping" == resource_name: + from . import elementdefinition + return elementdefinition.ElementDefinitionMapping(jsondict) + if "ElementDefinitionSlicing" == resource_name: + from . import elementdefinition + return elementdefinition.ElementDefinitionSlicing(jsondict) + if "ElementDefinitionType" == resource_name: + from . import elementdefinition + return elementdefinition.ElementDefinitionType(jsondict) + if "EligibilityRequest" == resource_name: + from . import eligibilityrequest + return eligibilityrequest.EligibilityRequest(jsondict) + if "EligibilityResponse" == resource_name: + from . import eligibilityresponse + return eligibilityresponse.EligibilityResponse(jsondict) + if "Encounter" == resource_name: + from . import encounter + return encounter.Encounter(jsondict) + if "EncounterHospitalization" == resource_name: + from . import encounter + return encounter.EncounterHospitalization(jsondict) + if "EncounterLocation" == resource_name: + from . import encounter + return encounter.EncounterLocation(jsondict) + if "EncounterParticipant" == resource_name: + from . import encounter + return encounter.EncounterParticipant(jsondict) + if "EncounterStatusHistory" == resource_name: + from . import encounter + return encounter.EncounterStatusHistory(jsondict) + if "EnrollmentRequest" == resource_name: + from . import enrollmentrequest + return enrollmentrequest.EnrollmentRequest(jsondict) + if "EnrollmentResponse" == resource_name: + from . import enrollmentresponse + return enrollmentresponse.EnrollmentResponse(jsondict) + if "EpisodeOfCare" == resource_name: + from . import episodeofcare + return episodeofcare.EpisodeOfCare(jsondict) + if "EpisodeOfCareCareTeam" == resource_name: + from . import episodeofcare + return episodeofcare.EpisodeOfCareCareTeam(jsondict) + if "EpisodeOfCareStatusHistory" == resource_name: + from . import episodeofcare + return episodeofcare.EpisodeOfCareStatusHistory(jsondict) + if "ExplanationOfBenefit" == resource_name: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefit(jsondict) + if "Extension" == resource_name: + from . import extension + return extension.Extension(jsondict) + if "FamilyMemberHistory" == resource_name: + from . import familymemberhistory + return familymemberhistory.FamilyMemberHistory(jsondict) + if "FamilyMemberHistoryCondition" == resource_name: + from . import familymemberhistory + return familymemberhistory.FamilyMemberHistoryCondition(jsondict) + if "Flag" == resource_name: + from . import flag + return flag.Flag(jsondict) + if "Goal" == resource_name: + from . import goal + return goal.Goal(jsondict) + if "GoalOutcome" == resource_name: + from . import goal + return goal.GoalOutcome(jsondict) + if "Group" == resource_name: + from . import group + return group.Group(jsondict) + if "GroupCharacteristic" == resource_name: + from . import group + return group.GroupCharacteristic(jsondict) + if "GroupMember" == resource_name: + from . import group + return group.GroupMember(jsondict) + if "HealthcareService" == resource_name: + from . import healthcareservice + return healthcareservice.HealthcareService(jsondict) + if "HealthcareServiceAvailableTime" == resource_name: + from . import healthcareservice + return healthcareservice.HealthcareServiceAvailableTime(jsondict) + if "HealthcareServiceNotAvailable" == resource_name: + from . import healthcareservice + return healthcareservice.HealthcareServiceNotAvailable(jsondict) + if "HealthcareServiceServiceType" == resource_name: + from . import healthcareservice + return healthcareservice.HealthcareServiceServiceType(jsondict) + if "HumanName" == resource_name: + from . import humanname + return humanname.HumanName(jsondict) + if "Identifier" == resource_name: + from . import identifier + return identifier.Identifier(jsondict) + if "ImagingObjectSelection" == resource_name: + from . import imagingobjectselection + return imagingobjectselection.ImagingObjectSelection(jsondict) + if "ImagingObjectSelectionStudy" == resource_name: + from . import imagingobjectselection + return imagingobjectselection.ImagingObjectSelectionStudy(jsondict) + if "ImagingObjectSelectionStudySeries" == resource_name: + from . import imagingobjectselection + return imagingobjectselection.ImagingObjectSelectionStudySeries(jsondict) + if "ImagingObjectSelectionStudySeriesInstance" == resource_name: + from . import imagingobjectselection + return imagingobjectselection.ImagingObjectSelectionStudySeriesInstance(jsondict) + if "ImagingObjectSelectionStudySeriesInstanceFrames" == resource_name: + from . import imagingobjectselection + return imagingobjectselection.ImagingObjectSelectionStudySeriesInstanceFrames(jsondict) + if "ImagingStudy" == resource_name: + from . import imagingstudy + return imagingstudy.ImagingStudy(jsondict) + if "ImagingStudySeries" == resource_name: + from . import imagingstudy + return imagingstudy.ImagingStudySeries(jsondict) + if "ImagingStudySeriesInstance" == resource_name: + from . import imagingstudy + return imagingstudy.ImagingStudySeriesInstance(jsondict) + if "Immunization" == resource_name: + from . import immunization + return immunization.Immunization(jsondict) + if "ImmunizationExplanation" == resource_name: + from . import immunization + return immunization.ImmunizationExplanation(jsondict) + if "ImmunizationReaction" == resource_name: + from . import immunization + return immunization.ImmunizationReaction(jsondict) + if "ImmunizationRecommendation" == resource_name: + from . import immunizationrecommendation + return immunizationrecommendation.ImmunizationRecommendation(jsondict) + if "ImmunizationRecommendationRecommendation" == resource_name: + from . import immunizationrecommendation + return immunizationrecommendation.ImmunizationRecommendationRecommendation(jsondict) + if "ImmunizationRecommendationRecommendationDateCriterion" == resource_name: + from . import immunizationrecommendation + return immunizationrecommendation.ImmunizationRecommendationRecommendationDateCriterion(jsondict) + if "ImmunizationRecommendationRecommendationProtocol" == resource_name: + from . import immunizationrecommendation + return immunizationrecommendation.ImmunizationRecommendationRecommendationProtocol(jsondict) + if "ImmunizationVaccinationProtocol" == resource_name: + from . import immunization + return immunization.ImmunizationVaccinationProtocol(jsondict) + if "ImplementationGuide" == resource_name: + from . import implementationguide + return implementationguide.ImplementationGuide(jsondict) + if "ImplementationGuideContact" == resource_name: + from . import implementationguide + return implementationguide.ImplementationGuideContact(jsondict) + if "ImplementationGuideDependency" == resource_name: + from . import implementationguide + return implementationguide.ImplementationGuideDependency(jsondict) + if "ImplementationGuideGlobal" == resource_name: + from . import implementationguide + return implementationguide.ImplementationGuideGlobal(jsondict) + if "ImplementationGuidePackage" == resource_name: + from . import implementationguide + return implementationguide.ImplementationGuidePackage(jsondict) + if "ImplementationGuidePackageResource" == resource_name: + from . import implementationguide + return implementationguide.ImplementationGuidePackageResource(jsondict) + if "ImplementationGuidePage" == resource_name: + from . import implementationguide + return implementationguide.ImplementationGuidePage(jsondict) + if "List" == resource_name: + from . import list + return list.List(jsondict) + if "ListEntry" == resource_name: + from . import list + return list.ListEntry(jsondict) + if "Location" == resource_name: + from . import location + return location.Location(jsondict) + if "LocationPosition" == resource_name: + from . import location + return location.LocationPosition(jsondict) + if "Media" == resource_name: + from . import media + return media.Media(jsondict) + if "Medication" == resource_name: + from . import medication + return medication.Medication(jsondict) + if "MedicationAdministration" == resource_name: + from . import medicationadministration + return medicationadministration.MedicationAdministration(jsondict) + if "MedicationAdministrationDosage" == resource_name: + from . import medicationadministration + return medicationadministration.MedicationAdministrationDosage(jsondict) + if "MedicationDispense" == resource_name: + from . import medicationdispense + return medicationdispense.MedicationDispense(jsondict) + if "MedicationDispenseDosageInstruction" == resource_name: + from . import medicationdispense + return medicationdispense.MedicationDispenseDosageInstruction(jsondict) + if "MedicationDispenseSubstitution" == resource_name: + from . import medicationdispense + return medicationdispense.MedicationDispenseSubstitution(jsondict) + if "MedicationOrder" == resource_name: + from . import medicationorder + return medicationorder.MedicationOrder(jsondict) + if "MedicationOrderDispenseRequest" == resource_name: + from . import medicationorder + return medicationorder.MedicationOrderDispenseRequest(jsondict) + if "MedicationOrderDosageInstruction" == resource_name: + from . import medicationorder + return medicationorder.MedicationOrderDosageInstruction(jsondict) + if "MedicationOrderSubstitution" == resource_name: + from . import medicationorder + return medicationorder.MedicationOrderSubstitution(jsondict) + if "MedicationPackage" == resource_name: + from . import medication + return medication.MedicationPackage(jsondict) + if "MedicationPackageContent" == resource_name: + from . import medication + return medication.MedicationPackageContent(jsondict) + if "MedicationProduct" == resource_name: + from . import medication + return medication.MedicationProduct(jsondict) + if "MedicationProductBatch" == resource_name: + from . import medication + return medication.MedicationProductBatch(jsondict) + if "MedicationProductIngredient" == resource_name: + from . import medication + return medication.MedicationProductIngredient(jsondict) + if "MedicationStatement" == resource_name: + from . import medicationstatement + return medicationstatement.MedicationStatement(jsondict) + if "MedicationStatementDosage" == resource_name: + from . import medicationstatement + return medicationstatement.MedicationStatementDosage(jsondict) + if "MessageHeader" == resource_name: + from . import messageheader + return messageheader.MessageHeader(jsondict) + if "MessageHeaderDestination" == resource_name: + from . import messageheader + return messageheader.MessageHeaderDestination(jsondict) + if "MessageHeaderResponse" == resource_name: + from . import messageheader + return messageheader.MessageHeaderResponse(jsondict) + if "MessageHeaderSource" == resource_name: + from . import messageheader + return messageheader.MessageHeaderSource(jsondict) + if "Meta" == resource_name: + from . import meta + return meta.Meta(jsondict) + if "Money" == resource_name: + from . import money + return money.Money(jsondict) + if "NamingSystem" == resource_name: + from . import namingsystem + return namingsystem.NamingSystem(jsondict) + if "NamingSystemContact" == resource_name: + from . import namingsystem + return namingsystem.NamingSystemContact(jsondict) + if "NamingSystemUniqueId" == resource_name: + from . import namingsystem + return namingsystem.NamingSystemUniqueId(jsondict) + if "Narrative" == resource_name: + from . import narrative + return narrative.Narrative(jsondict) + if "NutritionOrder" == resource_name: + from . import nutritionorder + return nutritionorder.NutritionOrder(jsondict) + if "NutritionOrderEnteralFormula" == resource_name: + from . import nutritionorder + return nutritionorder.NutritionOrderEnteralFormula(jsondict) + if "NutritionOrderEnteralFormulaAdministration" == resource_name: + from . import nutritionorder + return nutritionorder.NutritionOrderEnteralFormulaAdministration(jsondict) + if "NutritionOrderOralDiet" == resource_name: + from . import nutritionorder + return nutritionorder.NutritionOrderOralDiet(jsondict) + if "NutritionOrderOralDietNutrient" == resource_name: + from . import nutritionorder + return nutritionorder.NutritionOrderOralDietNutrient(jsondict) + if "NutritionOrderOralDietTexture" == resource_name: + from . import nutritionorder + return nutritionorder.NutritionOrderOralDietTexture(jsondict) + if "NutritionOrderSupplement" == resource_name: + from . import nutritionorder + return nutritionorder.NutritionOrderSupplement(jsondict) + if "Observation" == resource_name: + from . import observation + return observation.Observation(jsondict) + if "ObservationComponent" == resource_name: + from . import observation + return observation.ObservationComponent(jsondict) + if "ObservationReferenceRange" == resource_name: + from . import observation + return observation.ObservationReferenceRange(jsondict) + if "ObservationRelated" == resource_name: + from . import observation + return observation.ObservationRelated(jsondict) + if "OperationDefinition" == resource_name: + from . import operationdefinition + return operationdefinition.OperationDefinition(jsondict) + if "OperationDefinitionContact" == resource_name: + from . import operationdefinition + return operationdefinition.OperationDefinitionContact(jsondict) + if "OperationDefinitionParameter" == resource_name: + from . import operationdefinition + return operationdefinition.OperationDefinitionParameter(jsondict) + if "OperationDefinitionParameterBinding" == resource_name: + from . import operationdefinition + return operationdefinition.OperationDefinitionParameterBinding(jsondict) + if "OperationOutcome" == resource_name: + from . import operationoutcome + return operationoutcome.OperationOutcome(jsondict) + if "OperationOutcomeIssue" == resource_name: + from . import operationoutcome + return operationoutcome.OperationOutcomeIssue(jsondict) + if "Order" == resource_name: + from . import order + return order.Order(jsondict) + if "OrderResponse" == resource_name: + from . import orderresponse + return orderresponse.OrderResponse(jsondict) + if "OrderWhen" == resource_name: + from . import order + return order.OrderWhen(jsondict) + if "Organization" == resource_name: + from . import organization + return organization.Organization(jsondict) + if "OrganizationContact" == resource_name: + from . import organization + return organization.OrganizationContact(jsondict) + if "Parameters" == resource_name: + from . import parameters + return parameters.Parameters(jsondict) + if "ParametersParameter" == resource_name: + from . import parameters + return parameters.ParametersParameter(jsondict) + if "Patient" == resource_name: + from . import patient + return patient.Patient(jsondict) + if "PatientAnimal" == resource_name: + from . import patient + return patient.PatientAnimal(jsondict) + if "PatientCommunication" == resource_name: + from . import patient + return patient.PatientCommunication(jsondict) + if "PatientContact" == resource_name: + from . import patient + return patient.PatientContact(jsondict) + if "PatientLink" == resource_name: + from . import patient + return patient.PatientLink(jsondict) + if "PaymentNotice" == resource_name: + from . import paymentnotice + return paymentnotice.PaymentNotice(jsondict) + if "PaymentReconciliation" == resource_name: + from . import paymentreconciliation + return paymentreconciliation.PaymentReconciliation(jsondict) + if "PaymentReconciliationDetail" == resource_name: + from . import paymentreconciliation + return paymentreconciliation.PaymentReconciliationDetail(jsondict) + if "PaymentReconciliationNote" == resource_name: + from . import paymentreconciliation + return paymentreconciliation.PaymentReconciliationNote(jsondict) + if "Period" == resource_name: + from . import period + return period.Period(jsondict) + if "Person" == resource_name: + from . import person + return person.Person(jsondict) + if "PersonLink" == resource_name: + from . import person + return person.PersonLink(jsondict) + if "Practitioner" == resource_name: + from . import practitioner + return practitioner.Practitioner(jsondict) + if "PractitionerPractitionerRole" == resource_name: + from . import practitioner + return practitioner.PractitionerPractitionerRole(jsondict) + if "PractitionerQualification" == resource_name: + from . import practitioner + return practitioner.PractitionerQualification(jsondict) + if "Procedure" == resource_name: + from . import procedure + return procedure.Procedure(jsondict) + if "ProcedureFocalDevice" == resource_name: + from . import procedure + return procedure.ProcedureFocalDevice(jsondict) + if "ProcedurePerformer" == resource_name: + from . import procedure + return procedure.ProcedurePerformer(jsondict) + if "ProcedureRequest" == resource_name: + from . import procedurerequest + return procedurerequest.ProcedureRequest(jsondict) + if "ProcessRequest" == resource_name: + from . import processrequest + return processrequest.ProcessRequest(jsondict) + if "ProcessRequestItem" == resource_name: + from . import processrequest + return processrequest.ProcessRequestItem(jsondict) + if "ProcessResponse" == resource_name: + from . import processresponse + return processresponse.ProcessResponse(jsondict) + if "ProcessResponseNotes" == resource_name: + from . import processresponse + return processresponse.ProcessResponseNotes(jsondict) + if "Provenance" == resource_name: + from . import provenance + return provenance.Provenance(jsondict) + if "ProvenanceAgent" == resource_name: + from . import provenance + return provenance.ProvenanceAgent(jsondict) + if "ProvenanceAgentRelatedAgent" == resource_name: + from . import provenance + return provenance.ProvenanceAgentRelatedAgent(jsondict) + if "ProvenanceEntity" == resource_name: + from . import provenance + return provenance.ProvenanceEntity(jsondict) + if "Quantity" == resource_name: + from . import quantity + return quantity.Quantity(jsondict) + if "Questionnaire" == resource_name: + from . import questionnaire + return questionnaire.Questionnaire(jsondict) + if "QuestionnaireGroup" == resource_name: + from . import questionnaire + return questionnaire.QuestionnaireGroup(jsondict) + if "QuestionnaireGroupQuestion" == resource_name: + from . import questionnaire + return questionnaire.QuestionnaireGroupQuestion(jsondict) + if "QuestionnaireResponse" == resource_name: + from . import questionnaireresponse + return questionnaireresponse.QuestionnaireResponse(jsondict) + if "QuestionnaireResponseGroup" == resource_name: + from . import questionnaireresponse + return questionnaireresponse.QuestionnaireResponseGroup(jsondict) + if "QuestionnaireResponseGroupQuestion" == resource_name: + from . import questionnaireresponse + return questionnaireresponse.QuestionnaireResponseGroupQuestion(jsondict) + if "QuestionnaireResponseGroupQuestionAnswer" == resource_name: + from . import questionnaireresponse + return questionnaireresponse.QuestionnaireResponseGroupQuestionAnswer(jsondict) + if "Range" == resource_name: + from . import range + return range.Range(jsondict) + if "Ratio" == resource_name: + from . import ratio + return ratio.Ratio(jsondict) + if "Reference" == resource_name: + from . import reference + return reference.Reference(jsondict) + if "ReferralRequest" == resource_name: + from . import referralrequest + return referralrequest.ReferralRequest(jsondict) + if "RelatedPerson" == resource_name: + from . import relatedperson + return relatedperson.RelatedPerson(jsondict) + if "Resource" == resource_name: + from . import resource + return resource.Resource(jsondict) + if "RiskAssessment" == resource_name: + from . import riskassessment + return riskassessment.RiskAssessment(jsondict) + if "RiskAssessmentPrediction" == resource_name: + from . import riskassessment + return riskassessment.RiskAssessmentPrediction(jsondict) + if "SampledData" == resource_name: + from . import sampleddata + return sampleddata.SampledData(jsondict) + if "Schedule" == resource_name: + from . import schedule + return schedule.Schedule(jsondict) + if "SearchParameter" == resource_name: + from . import searchparameter + return searchparameter.SearchParameter(jsondict) + if "SearchParameterContact" == resource_name: + from . import searchparameter + return searchparameter.SearchParameterContact(jsondict) + if "Signature" == resource_name: + from . import signature + return signature.Signature(jsondict) + if "Slot" == resource_name: + from . import slot + return slot.Slot(jsondict) + if "Specimen" == resource_name: + from . import specimen + return specimen.Specimen(jsondict) + if "SpecimenCollection" == resource_name: + from . import specimen + return specimen.SpecimenCollection(jsondict) + if "SpecimenContainer" == resource_name: + from . import specimen + return specimen.SpecimenContainer(jsondict) + if "SpecimenTreatment" == resource_name: + from . import specimen + return specimen.SpecimenTreatment(jsondict) + if "StructureDefinition" == resource_name: + from . import structuredefinition + return structuredefinition.StructureDefinition(jsondict) + if "StructureDefinitionContact" == resource_name: + from . import structuredefinition + return structuredefinition.StructureDefinitionContact(jsondict) + if "StructureDefinitionDifferential" == resource_name: + from . import structuredefinition + return structuredefinition.StructureDefinitionDifferential(jsondict) + if "StructureDefinitionMapping" == resource_name: + from . import structuredefinition + return structuredefinition.StructureDefinitionMapping(jsondict) + if "StructureDefinitionSnapshot" == resource_name: + from . import structuredefinition + return structuredefinition.StructureDefinitionSnapshot(jsondict) + if "Subscription" == resource_name: + from . import subscription + return subscription.Subscription(jsondict) + if "SubscriptionChannel" == resource_name: + from . import subscription + return subscription.SubscriptionChannel(jsondict) + if "Substance" == resource_name: + from . import substance + return substance.Substance(jsondict) + if "SubstanceIngredient" == resource_name: + from . import substance + return substance.SubstanceIngredient(jsondict) + if "SubstanceInstance" == resource_name: + from . import substance + return substance.SubstanceInstance(jsondict) + if "SupplyDelivery" == resource_name: + from . import supplydelivery + return supplydelivery.SupplyDelivery(jsondict) + if "SupplyRequest" == resource_name: + from . import supplyrequest + return supplyrequest.SupplyRequest(jsondict) + if "SupplyRequestWhen" == resource_name: + from . import supplyrequest + return supplyrequest.SupplyRequestWhen(jsondict) + if "TestScript" == resource_name: + from . import testscript + return testscript.TestScript(jsondict) + if "TestScriptContact" == resource_name: + from . import testscript + return testscript.TestScriptContact(jsondict) + if "TestScriptFixture" == resource_name: + from . import testscript + return testscript.TestScriptFixture(jsondict) + if "TestScriptMetadata" == resource_name: + from . import testscript + return testscript.TestScriptMetadata(jsondict) + if "TestScriptMetadataCapability" == resource_name: + from . import testscript + return testscript.TestScriptMetadataCapability(jsondict) + if "TestScriptMetadataLink" == resource_name: + from . import testscript + return testscript.TestScriptMetadataLink(jsondict) + if "TestScriptSetup" == resource_name: + from . import testscript + return testscript.TestScriptSetup(jsondict) + if "TestScriptSetupAction" == resource_name: + from . import testscript + return testscript.TestScriptSetupAction(jsondict) + if "TestScriptSetupActionAssert" == resource_name: + from . import testscript + return testscript.TestScriptSetupActionAssert(jsondict) + if "TestScriptSetupActionOperation" == resource_name: + from . import testscript + return testscript.TestScriptSetupActionOperation(jsondict) + if "TestScriptSetupActionOperationRequestHeader" == resource_name: + from . import testscript + return testscript.TestScriptSetupActionOperationRequestHeader(jsondict) + if "TestScriptTeardown" == resource_name: + from . import testscript + return testscript.TestScriptTeardown(jsondict) + if "TestScriptTeardownAction" == resource_name: + from . import testscript + return testscript.TestScriptTeardownAction(jsondict) + if "TestScriptTest" == resource_name: + from . import testscript + return testscript.TestScriptTest(jsondict) + if "TestScriptTestAction" == resource_name: + from . import testscript + return testscript.TestScriptTestAction(jsondict) + if "TestScriptVariable" == resource_name: + from . import testscript + return testscript.TestScriptVariable(jsondict) + if "Timing" == resource_name: + from . import timing + return timing.Timing(jsondict) + if "TimingRepeat" == resource_name: + from . import timing + return timing.TimingRepeat(jsondict) + if "ValueSet" == resource_name: + from . import valueset + return valueset.ValueSet(jsondict) + if "ValueSetCodeSystem" == resource_name: + from . import valueset + return valueset.ValueSetCodeSystem(jsondict) + if "ValueSetCodeSystemConcept" == resource_name: + from . import valueset + return valueset.ValueSetCodeSystemConcept(jsondict) + if "ValueSetCodeSystemConceptDesignation" == resource_name: + from . import valueset + return valueset.ValueSetCodeSystemConceptDesignation(jsondict) + if "ValueSetCompose" == resource_name: + from . import valueset + return valueset.ValueSetCompose(jsondict) + if "ValueSetComposeInclude" == resource_name: + from . import valueset + return valueset.ValueSetComposeInclude(jsondict) + if "ValueSetComposeIncludeConcept" == resource_name: + from . import valueset + return valueset.ValueSetComposeIncludeConcept(jsondict) + if "ValueSetComposeIncludeFilter" == resource_name: + from . import valueset + return valueset.ValueSetComposeIncludeFilter(jsondict) + if "ValueSetContact" == resource_name: + from . import valueset + return valueset.ValueSetContact(jsondict) + if "ValueSetExpansion" == resource_name: + from . import valueset + return valueset.ValueSetExpansion(jsondict) + if "ValueSetExpansionContains" == resource_name: + from . import valueset + return valueset.ValueSetExpansionContains(jsondict) + if "ValueSetExpansionParameter" == resource_name: + from . import valueset + return valueset.ValueSetExpansionParameter(jsondict) + if "VisionPrescription" == resource_name: + from . import visionprescription + return visionprescription.VisionPrescription(jsondict) + if "VisionPrescriptionDispense" == resource_name: + from . import visionprescription + return visionprescription.VisionPrescriptionDispense(jsondict) + return element.Element(json) diff --git a/fhirclient/models/DSTU2/fhirreference.py b/fhirclient/models/DSTU2/fhirreference.py new file mode 100644 index 000000000..47eac8faa --- /dev/null +++ b/fhirclient/models/DSTU2/fhirreference.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Subclassing FHIR's reference to add resolving capabilities + +import logging +from . import reference + + +class FHIRReference(reference.Reference): + """ Subclassing FHIR's `Reference` resource to add resolving capabilities. + """ + + def resolved(self, klass): + """ Resolves the reference and caches the result, returning instance(s) + of the referenced classes. + + :param klass: The expected class of the resource + :returns: An instance (or list thereof) of the resolved reference if + dereferencing was successful, `None` otherwise + """ + owning_resource = self.owningResource() + if owning_resource is None: + raise Exception("Cannot resolve reference without having an owner (which must be a `DomainResource`)") + if klass is None: + raise Exception("Cannot resolve reference without knowing the class") + + refid = self.processedReferenceIdentifier() + if not refid: + logging.warning("No `reference` set, cannot resolve") + return None + + resolved = owning_resource.resolvedReference(refid) + if resolved is not None: + if isinstance(resolved, klass): + return resolved + logging.warning("Referenced resource {} is not a {} but a {}".format(refid, klass, resolved.__class__)) + return None + + # not yet resolved, see if it's a contained resource + if owning_resource.contained is not None: + for contained in owning_resource.contained: + if contained.id == refid: + owning_resource.didResolveReference(refid, contained) + if isinstance(contained, klass): + return contained + logging.warning("Contained resource {} is not a {} but a {}".format(refid, klass, contained.__class__)) + return None + + # fetch remote resources + if '://' not in self.reference: + server = owning_resource.server() if owning_resource else None + if server is not None: + return self._referenced_class.read_from(self.reference, server) + + logging.warning("Reference owner {} does not have a server, cannot resolve relative reference {}" + .format(self._owner, self.reference)) + return None + + # absolute resource + logging.warning("Not implemented: resolving absolute reference to resource {}" + .format(self.reference)) + return None + + def processedReferenceIdentifier(self): + """ Normalizes the reference-id. + """ + if not self.reference: + return None + + if '#' == self.reference[0]: + return self.reference[1:] + + # TODO: distinguish absolute (has "://") and relative URLs + return None + diff --git a/fhirclient/models/DSTU2/fhirsearch.py b/fhirclient/models/DSTU2/fhirsearch.py new file mode 100644 index 000000000..16b3a13e3 --- /dev/null +++ b/fhirclient/models/DSTU2/fhirsearch.py @@ -0,0 +1,270 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Create FHIR search params from NoSQL-like query structures. +# 2014, SMART Health IT. + +try: + from urllib import quote_plus +except Exception as e: + from urllib.parse import quote_plus + + +class FHIRSearch(object): + """ Create a FHIR search from NoSQL-like query structures. + """ + + def __init__(self, resource_type, struct=None): + self.resource_type = resource_type + """ The resource type class. """ + + self.params = [] + """ FHIRSearchParam instances. """ + + self.wants_expand = False + """ Used internally; whether or not `params` must be expanded first. """ + + if struct is not None: + if dict != type(struct): + raise Exception("Must pass a Python dictionary, but got a {}".format(type(struct))) + self.wants_expand = True + for key, val in struct.items(): + self.params.append(FHIRSearchParam(key, val)) + + + # MARK: Execution + + def construct(self): + """ Constructs the URL with query string from the receiver's params. + """ + if self.resource_type is None: + raise Exception("Need resource_type set to construct a search query") + + parts = [] + if self.params is not None: + for param in self.params: + if self.wants_expand: + for expanded in param.handle(): + parts.append(expanded.as_parameter()) + else: + parts.append(param.as_parameter()) + + return '{}?{}'.format(self.resource_type.resource_name, '&'.join(parts)) + + def perform(self, server): + """ Construct the search URL and execute it against the given server. + + :param server: The server against which to perform the search + :returns: A Bundle resource + """ + if server is None: + raise Exception("Need a server to perform search") + + from . import bundle + res = server.request_json(self.construct()) + bundle = bundle.Bundle(res) + bundle._server = server + return bundle + + def perform_resources(self, server): + """ Performs the search by calling `perform`, then extracts all Bundle + entries and returns a list of Resource instances. + + :param server: The server against which to perform the search + :returns: A list of Resource instances + """ + bundle = self.perform(server) + resources = [] + if bundle is not None and bundle.entry is not None: + for entry in bundle.entry: + resources.append(entry.resource) + + return resources + + +class FHIRSearchParam(object): + """ Holds one search parameter. + + The instance's `value` can either be a string value or a search construct + dictionary. In the latter case the class's `handle` method must be called + to arrive at search parameter instances that can be converted into a URL + query. + """ + + def __init__(self, name, value): + self.name = name + self.value = value + + def copy(self): + clone = object.__new__(self.__class__) + clone.__dict__ = self.__dict__.copy() + return clone + + def handle(self): + """ Parses the receiver's value and returns a list of FHIRSearchParam + instances. Needs only be called if the param needs to be handled, i.e. + its value is a query structure. + + :returns: A list with one or more FHIRSearchParam instances, not + altering the receiver + """ + handler = FHIRSearchParamHandler.handler_for(self.name)(None, self.value) + return handler.handle(self.copy()) + + def as_parameter(self): + """ Return a string that represents the reciever as "key=value". + """ + return '{}={}'.format(self.name, quote_plus(self.value, safe=',<=>')) + + +class FHIRSearchParamHandler(object): + handles = None + handlers = [] + + @classmethod + def announce_handler(cls, handler): + cls.handlers.append(handler) + + @classmethod + def handler_for(cls, key): + for handler in cls.handlers: + if handler.can_handle(key): + return handler + return cls + + @classmethod + def can_handle(cls, key): + if cls.handles is not None: + return key in cls.handles + return True # base class handles everything else, so be sure to test it last! + + + def __init__(self, key, value): + self.key = key + self.value = value + self.modifier = [] + self.multiplier = [] + + def handle(self, param): + """ Applies all handlers to the given search parameter. + :returns: A list of one or more new `FHIRSearchParam` instances + """ + self.prepare() + return self.expand(param) + + def prepare(self, parent=None): + """ Creates sub-handlers as needed, then prepares the receiver. + """ + if dict == type(self.value): + for key, val in self.value.items(): + handler = FHIRSearchParamHandler.handler_for(key)(key, val) + handler.prepare(self) + + if parent is not None: + parent.multiplier.append(self) + + def expand(self, param): + """ Executes the receiver's modifier and multiplier on itself, applying + changes to the given search param instance. + + :returns: A list of one or more FHIRSearchParam instances + """ + for handler in self.modifier: + handler.expand(param) + + self.apply(param) + + # if we have multiplier, expand sequentially + if len(self.multiplier) > 0: + expanded = [] + for handler in self.multiplier: + clone = param.copy() + expanded.extend(handler.expand(clone)) + + return expanded + + # no multiplier, just return the passed-in paramater + return [param] + + def apply(self, param): + if self.key is not None: + param.name = '{}.{}'.format(param.name, self.key) + if 0 == len(self.multiplier): + param.value = self.value + + +class FHIRSearchParamModifierHandler(FHIRSearchParamHandler): + modifiers = { + '$asc': ':asc', + '$desc': ':desc', + '$exact': ':exact', + '$missing': ':missing', + '$null': ':missing', + '$text': ':text', + } + handles = modifiers.keys() + + def apply(self, param): + if self.key not in self.__class__.modifiers: + raise Exception('Unknown modifier "{}" for "{}"'.format(self.key, param.name)) + param.name += self.__class__.modifiers[self.key] + param.value = self.value + + +class FHIRSearchParamOperatorHandler(FHIRSearchParamHandler): + operators = { + '$gt': '>', + '$lt': '<', + '$lte': '<=', + '$gte': '>=', + } + handles = operators.keys() + + def apply(self, param): + if self.key not in self.__class__.operators: + raise Exception('Unknown operator "{}" for "{}"'.format(self.key, parent.name)) + param.value = self.__class__.operators[self.key] + self.value + + +class FHIRSearchParamMultiHandler(FHIRSearchParamHandler): + handles = ['$and', '$or'] + + def prepare(self, parent): + if list != type(self.value): + raise Exception('Expecting a list argument for "{}" but got {}'.format(parent.key, self.value)) + + handlers = [] + for val in self.value: + if dict == type(val): + for kkey, vval in val.items(): + handlers.append(FHIRSearchParamHandler.handler_for(kkey)(kkey, vval)) + else: + handlers.append(FHIRSearchParamHandler.handler_for(parent.key)(None, val)) + + if '$and' == self.key: + for handler in handlers: + handler.prepare(parent) + elif '$or' == self.key: + ors = [h.value for h in handlers] + handler = FHIRSearchParamHandler.handler_for(parent.key)(None, ','.join(ors)) + handler.prepare(parent) + else: + raise Exception('I cannot handle "{}"'.format(self.key)) + + +class FHIRSearchParamTypeHandler(FHIRSearchParamHandler): + handles = ['$type'] + + def prepare(self, parent): + parent.modifier.append(self) + + def apply(self, param): + param.name = '{}:{}'.format(param.name, self.value) + + +# announce all handlers +FHIRSearchParamHandler.announce_handler(FHIRSearchParamModifierHandler) +FHIRSearchParamHandler.announce_handler(FHIRSearchParamOperatorHandler) +FHIRSearchParamHandler.announce_handler(FHIRSearchParamMultiHandler) +FHIRSearchParamHandler.announce_handler(FHIRSearchParamTypeHandler) + diff --git a/fhirclient/models/DSTU2/flag.py b/fhirclient/models/DSTU2/flag.py new file mode 100644 index 000000000..e0f31bc5b --- /dev/null +++ b/fhirclient/models/DSTU2/flag.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Flag) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Flag(domainresource.DomainResource): + """ Key information to flag to healthcare providers. + + Prospective warnings of potential issues when providing care to the + patient. + """ + + resource_name = "Flag" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.author = None + """ Flag creator. + Type `FHIRReference` referencing `Device, Organization, Patient, Practitioner` (represented as `dict` in JSON). """ + + self.category = None + """ Clinical, administrative, etc.. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.code = None + """ Partially deaf, Requires easy open caps, No permanent address, etc.. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.encounter = None + """ Alert relevant during encounter. + Type `FHIRReference` referencing `Encounter` (represented as `dict` in JSON). """ + + self.identifier = None + """ Business identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.period = None + """ Time period when flag is active. + Type `Period` (represented as `dict` in JSON). """ + + self.status = None + """ active | inactive | entered-in-error. + Type `str`. """ + + self.subject = None + """ Who/What is flag about?. + Type `FHIRReference` referencing `Patient, Location, Group, Organization, Practitioner` (represented as `dict` in JSON). """ + + super(Flag, self).__init__(jsondict) + + def elementProperties(self): + js = super(Flag, self).elementProperties() + js.extend([ + ("author", "author", fhirreference.FHIRReference, False, None, False), + ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("period", "period", period.Period, False, None, False), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, True), + ]) + return js + + +from . import codeableconcept +from . import fhirreference +from . import identifier +from . import period diff --git a/fhirclient/models/DSTU2/flag_tests.py b/fhirclient/models/DSTU2/flag_tests.py new file mode 100644 index 000000000..ff23a81b6 --- /dev/null +++ b/fhirclient/models/DSTU2/flag_tests.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import flag +from .fhirdate import FHIRDate + + +class FlagTests(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("Flag", js["resourceType"]) + return flag.Flag(js) + + def testFlag1(self): + inst = self.instantiate_from("flag-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Flag instance") + self.implFlag1(inst) + + js = inst.as_json() + self.assertEqual("Flag", js["resourceType"]) + inst2 = flag.Flag(js) + self.implFlag1(inst2) + + def implFlag1(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.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.status, "active") + 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.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") + diff --git a/fhirclient/models/DSTU2/goal.py b/fhirclient/models/DSTU2/goal.py new file mode 100644 index 000000000..f2caa777c --- /dev/null +++ b/fhirclient/models/DSTU2/goal.py @@ -0,0 +1,154 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Goal) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Goal(domainresource.DomainResource): + """ Describes the intended objective(s) for a patient, group or organization. + + Describes the intended objective(s) for a patient, group or organization + care, for example, weight loss, restoring an activity of daily living, + obtaining herd immunity via immunization, meeting a process improvement + objective, etc. + """ + + resource_name = "Goal" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.addresses = None + """ Issues addressed by this goal. + List of `FHIRReference` items referencing `Condition, Observation, MedicationStatement, NutritionOrder, ProcedureRequest, RiskAssessment` (represented as `dict` in JSON). """ + + self.author = None + """ Who's responsible for creating Goal?. + Type `FHIRReference` referencing `Patient, Practitioner, RelatedPerson` (represented as `dict` in JSON). """ + + self.category = None + """ E.g. Treatment, dietary, behavioral, etc.. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.description = None + """ What's the desired outcome?. + Type `str`. """ + + self.identifier = None + """ External Ids for this goal. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.note = None + """ Comments about the goal. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.outcome = None + """ What was end result of goal?. + List of `GoalOutcome` items (represented as `dict` in JSON). """ + + self.priority = None + """ high | medium |low. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.startCodeableConcept = None + """ When goal pursuit begins. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.startDate = None + """ When goal pursuit begins. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.status = None + """ proposed | planned | accepted | rejected | in-progress | achieved | + sustaining | on-hold | cancelled. + Type `str`. """ + + self.statusDate = None + """ When goal status took effect. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.statusReason = None + """ Reason for current status. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.subject = None + """ Who this goal is intended for. + Type `FHIRReference` referencing `Patient, Group, Organization` (represented as `dict` in JSON). """ + + self.targetDate = None + """ Reach goal on or before. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.targetQuantity = None + """ Reach goal on or before. + Type `Quantity` referencing `Duration` (represented as `dict` in JSON). """ + + super(Goal, self).__init__(jsondict) + + def elementProperties(self): + js = super(Goal, self).elementProperties() + js.extend([ + ("addresses", "addresses", fhirreference.FHIRReference, True, None, False), + ("author", "author", fhirreference.FHIRReference, False, None, False), + ("category", "category", codeableconcept.CodeableConcept, True, None, False), + ("description", "description", str, False, None, True), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("note", "note", annotation.Annotation, True, None, False), + ("outcome", "outcome", GoalOutcome, 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", codeableconcept.CodeableConcept, False, None, False), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ("targetDate", "targetDate", fhirdate.FHIRDate, False, "target", False), + ("targetQuantity", "targetQuantity", quantity.Quantity, False, "target", False), + ]) + return js + + +from . import backboneelement + +class GoalOutcome(backboneelement.BackboneElement): + """ What was end result of goal?. + + Identifies the change (or lack of change) at the point where the goal was + deepmed to be cancelled or achieved. + """ + + resource_name = "GoalOutcome" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.resultCodeableConcept = None + """ Code or observation that resulted from goal. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.resultReference = None + """ Code or observation that resulted from goal. + Type `FHIRReference` referencing `Observation` (represented as `dict` in JSON). """ + + super(GoalOutcome, self).__init__(jsondict) + + def elementProperties(self): + js = super(GoalOutcome, self).elementProperties() + js.extend([ + ("resultCodeableConcept", "resultCodeableConcept", codeableconcept.CodeableConcept, False, "result", False), + ("resultReference", "resultReference", fhirreference.FHIRReference, False, "result", False), + ]) + return js + + +from . import annotation +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier +from . import quantity diff --git a/fhirclient/models/DSTU2/goal_tests.py b/fhirclient/models/DSTU2/goal_tests.py new file mode 100644 index 000000000..494f68d06 --- /dev/null +++ b/fhirclient/models/DSTU2/goal_tests.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import goal +from .fhirdate import FHIRDate + + +class GoalTests(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("Goal", js["resourceType"]) + return goal.Goal(js) + + def testGoal1(self): + inst = self.instantiate_from("goal-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Goal instance") + self.implGoal1(inst) + + js = inst.as_json() + self.assertEqual("Goal", js["resourceType"]) + inst2 = goal.Goal(js) + self.implGoal1(inst2) + + def implGoal1(self, inst): + self.assertEqual(inst.description, "Target weight is 160 to 180 lbs.") + self.assertEqual(inst.extension[0].extension[0].url, "measure") + self.assertEqual(inst.extension[0].extension[0].valueCodeableConcept.coding[0].code, "3141-9") + self.assertEqual(inst.extension[0].extension[0].valueCodeableConcept.coding[0].display, "Weight Measured") + self.assertEqual(inst.extension[0].extension[0].valueCodeableConcept.coding[0].system, "http://loinc.org") + self.assertEqual(inst.extension[0].extension[1].url, "detail") + self.assertEqual(inst.extension[0].extension[1].valueRange.high.code, "[lb_av]") + self.assertEqual(inst.extension[0].extension[1].valueRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.extension[0].extension[1].valueRange.high.unit, "lbs") + self.assertEqual(inst.extension[0].extension[1].valueRange.high.value, 180) + self.assertEqual(inst.extension[0].extension[1].valueRange.low.code, "[lb_av]") + self.assertEqual(inst.extension[0].extension[1].valueRange.low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.extension[0].extension[1].valueRange.low.unit, "lbs") + self.assertEqual(inst.extension[0].extension[1].valueRange.low.value, 160) + self.assertEqual(inst.extension[0].url, "http://hl7.org/fhir/StructureDefinition/goal-target") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.status, "in-progress") + self.assertEqual(inst.text.status, "additional") + diff --git a/fhirclient/models/DSTU2/group.py b/fhirclient/models/DSTU2/group.py new file mode 100644 index 000000000..3f90b6eea --- /dev/null +++ b/fhirclient/models/DSTU2/group.py @@ -0,0 +1,173 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Group) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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 + not formally or legally recognized; i.e. a collection of entities that + isn't an Organization. + """ + + resource_name = "Group" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.actual = None + """ Descriptive or actual. + Type `bool`. """ + + self.characteristic = None + """ Trait of group members. + List of `GroupCharacteristic` items (represented as `dict` in JSON). """ + + self.code = None + """ Kind of Group members. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.identifier = None + """ Unique id. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.member = None + """ Who or what is in group. + List of `GroupMember` items (represented as `dict` in JSON). """ + + self.name = None + """ Label for Group. + Type `str`. """ + + self.quantity = None + """ Number of members. + Type `int`. """ + + self.type = None + """ person | animal | practitioner | device | medication | substance. + Type `str`. """ + + super(Group, self).__init__(jsondict) + + def elementProperties(self): + js = super(Group, self).elementProperties() + js.extend([ + ("actual", "actual", bool, False, None, True), + ("characteristic", "characteristic", GroupCharacteristic, True, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("member", "member", GroupMember, True, None, False), + ("name", "name", str, False, None, False), + ("quantity", "quantity", int, False, None, False), + ("type", "type", str, False, None, True), + ]) + return js + + +from . import backboneelement + +class GroupCharacteristic(backboneelement.BackboneElement): + """ Trait of group members. + + Identifies the traits shared by members of the group. + """ + + resource_name = "GroupCharacteristic" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.code = None + """ Kind of characteristic. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.exclude = None + """ Group includes or excludes. + Type `bool`. """ + + self.period = None + """ Period over which characteristic is tested. + Type `Period` (represented as `dict` in JSON). """ + + self.valueBoolean = None + """ Value held by characteristic. + Type `bool`. """ + + self.valueCodeableConcept = None + """ Value held by characteristic. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueQuantity = None + """ Value held by characteristic. + Type `Quantity` (represented as `dict` in JSON). """ + + self.valueRange = None + """ Value held by characteristic. + Type `Range` (represented as `dict` in JSON). """ + + super(GroupCharacteristic, self).__init__(jsondict) + + def elementProperties(self): + js = super(GroupCharacteristic, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("exclude", "exclude", bool, False, None, True), + ("period", "period", period.Period, False, None, False), + ("valueBoolean", "valueBoolean", bool, False, "value", True), + ("valueCodeableConcept", "valueCodeableConcept", codeableconcept.CodeableConcept, False, "value", True), + ("valueQuantity", "valueQuantity", quantity.Quantity, False, "value", True), + ("valueRange", "valueRange", range.Range, False, "value", True), + ]) + return js + + +class GroupMember(backboneelement.BackboneElement): + """ Who or what is in group. + + Identifies the resource instances that are members of the group. + """ + + resource_name = "GroupMember" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.entity = None + """ Reference to the group member. + Type `FHIRReference` referencing `Patient, Practitioner, Device, Medication, Substance` (represented as `dict` in JSON). """ + + self.inactive = None + """ If member is no longer in group. + Type `bool`. """ + + self.period = None + """ Period member belonged to the group. + Type `Period` (represented as `dict` in JSON). """ + + super(GroupMember, self).__init__(jsondict) + + def elementProperties(self): + js = super(GroupMember, self).elementProperties() + js.extend([ + ("entity", "entity", fhirreference.FHIRReference, False, None, True), + ("inactive", "inactive", bool, False, None, False), + ("period", "period", period.Period, False, None, False), + ]) + return js + + +from . import codeableconcept +from . import fhirreference +from . import identifier +from . import period +from . import quantity +from . import range diff --git a/fhirclient/models/DSTU2/group_tests.py b/fhirclient/models/DSTU2/group_tests.py new file mode 100644 index 000000000..82622dc69 --- /dev/null +++ b/fhirclient/models/DSTU2/group_tests.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import group +from .fhirdate import FHIRDate + + +class GroupTests(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("Group", js["resourceType"]) + return group.Group(js) + + def testGroup1(self): + inst = self.instantiate_from("group-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Group instance") + self.implGroup1(inst) + + js = inst.as_json() + self.assertEqual("Group", js["resourceType"]) + inst2 = group.Group(js) + 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.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) + self.assertEqual(inst.member[0].period.start.as_json(), "2014-10-08") + self.assertTrue(inst.member[1].inactive) + self.assertEqual(inst.member[1].period.start.date, FHIRDate("2015-04-02").date) + self.assertEqual(inst.member[1].period.start.as_json(), "2015-04-02") + self.assertEqual(inst.member[2].period.start.date, FHIRDate("2015-08-06").date) + 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.text.status, "additional") + self.assertEqual(inst.type, "person") + diff --git a/fhirclient/models/DSTU2/healthcareservice.py b/fhirclient/models/DSTU2/healthcareservice.py new file mode 100644 index 000000000..971cf7348 --- /dev/null +++ b/fhirclient/models/DSTU2/healthcareservice.py @@ -0,0 +1,253 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/HealthcareService) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class HealthcareService(domainresource.DomainResource): + """ The details of a healthcare service available at a location. + """ + + resource_name = "HealthcareService" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.appointmentRequired = None + """ If an appointment is required for access to this service. + Type `bool`. """ + + self.availabilityExceptions = None + """ Description of availability exceptions. + Type `str`. """ + + self.availableTime = None + """ Times the Service Site is available. + List of `HealthcareServiceAvailableTime` items (represented as `dict` in JSON). """ + + self.characteristic = None + """ Collection of characteristics (attributes). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.comment = None + """ Additional description and/or any specific issues not covered + elsewhere. + Type `str`. """ + + self.coverageArea = None + """ Location(s) service is inteded for/available to. + List of `FHIRReference` items referencing `Location` (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`. """ + + self.extraDetails = None + """ Extra details about the service that can't be placed in the other + fields. + Type `str`. """ + + self.identifier = None + """ External identifiers for this item. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.location = None + """ Location where service may be provided. + Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + + self.notAvailable = None + """ Not available during this time due to provided reason. + List of `HealthcareServiceNotAvailable` items (represented as `dict` in JSON). """ + + self.photo = None + """ 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.providedBy = None + """ Organization that provides this service. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.publicKey = None + """ PKI Public keys to support secure communications. + Type `str`. """ + + self.referralMethod = None + """ Ways that the service accepts referrals. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.serviceCategory = None + """ Broad category of service being performed or delivered. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.serviceName = None + """ Description of service as presented to a consumer while searching. + Type `str`. """ + + self.serviceProvisionCode = None + """ Conditions under which service is available/offered. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.serviceType = None + """ Specific service delivered or performed. + List of `HealthcareServiceServiceType` items (represented as `dict` in JSON). """ + + self.telecom = None + """ Contacts related to the healthcare service. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(HealthcareService, self).__init__(jsondict) + + def elementProperties(self): + js = super(HealthcareService, self).elementProperties() + js.extend([ + ("appointmentRequired", "appointmentRequired", bool, False, None, False), + ("availabilityExceptions", "availabilityExceptions", str, False, None, False), + ("availableTime", "availableTime", HealthcareServiceAvailableTime, True, None, False), + ("characteristic", "characteristic", codeableconcept.CodeableConcept, True, None, False), + ("comment", "comment", str, False, None, False), + ("coverageArea", "coverageArea", fhirreference.FHIRReference, True, None, False), + ("eligibility", "eligibility", codeableconcept.CodeableConcept, False, None, False), + ("eligibilityNote", "eligibilityNote", str, False, None, False), + ("extraDetails", "extraDetails", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("location", "location", fhirreference.FHIRReference, False, None, True), + ("notAvailable", "notAvailable", HealthcareServiceNotAvailable, True, None, False), + ("photo", "photo", attachment.Attachment, False, None, False), + ("programName", "programName", str, True, None, False), + ("providedBy", "providedBy", fhirreference.FHIRReference, False, None, False), + ("publicKey", "publicKey", str, False, None, False), + ("referralMethod", "referralMethod", codeableconcept.CodeableConcept, True, None, False), + ("serviceCategory", "serviceCategory", codeableconcept.CodeableConcept, False, None, False), + ("serviceName", "serviceName", str, False, None, False), + ("serviceProvisionCode", "serviceProvisionCode", codeableconcept.CodeableConcept, True, None, False), + ("serviceType", "serviceType", HealthcareServiceServiceType, True, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ]) + return js + + +from . import backboneelement + +class HealthcareServiceAvailableTime(backboneelement.BackboneElement): + """ Times the Service Site is available. + + A collection of times that the Service Site is available. + """ + + resource_name = "HealthcareServiceAvailableTime" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.allDay = None + """ Always available? e.g. 24 hour service. + Type `bool`. """ + + self.availableEndTime = None + """ Closing time of day (ignored if allDay = true). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.availableStartTime = None + """ Opening time of day (ignored if allDay = true). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.daysOfWeek = None + """ mon | tue | wed | thu | fri | sat | sun. + List of `str` items. """ + + super(HealthcareServiceAvailableTime, self).__init__(jsondict) + + def elementProperties(self): + js = super(HealthcareServiceAvailableTime, self).elementProperties() + js.extend([ + ("allDay", "allDay", bool, False, None, False), + ("availableEndTime", "availableEndTime", fhirdate.FHIRDate, False, None, False), + ("availableStartTime", "availableStartTime", fhirdate.FHIRDate, False, None, False), + ("daysOfWeek", "daysOfWeek", str, True, None, False), + ]) + return js + + +class HealthcareServiceNotAvailable(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. + """ + + resource_name = "HealthcareServiceNotAvailable" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.description = None + """ Reason presented to the user explaining why time not available. + Type `str`. """ + + self.during = None + """ Service not availablefrom this date. + Type `Period` (represented as `dict` in JSON). """ + + super(HealthcareServiceNotAvailable, self).__init__(jsondict) + + def elementProperties(self): + js = super(HealthcareServiceNotAvailable, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, True), + ("during", "during", period.Period, False, None, False), + ]) + return js + + +class HealthcareServiceServiceType(backboneelement.BackboneElement): + """ Specific service delivered or performed. + + A specific type of service that may be delivered or performed. + """ + + resource_name = "HealthcareServiceServiceType" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.specialty = None + """ Specialties handled by the Service Site. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.type = None + """ Type of service delivered or performed. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(HealthcareServiceServiceType, self).__init__(jsondict) + + def elementProperties(self): + js = super(HealthcareServiceServiceType, self).elementProperties() + js.extend([ + ("specialty", "specialty", codeableconcept.CodeableConcept, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +from . import attachment +from . import codeableconcept +from . import contactpoint +from . import fhirdate +from . import fhirreference +from . import identifier +from . import period diff --git a/fhirclient/models/DSTU2/healthcareservice_tests.py b/fhirclient/models/DSTU2/healthcareservice_tests.py new file mode 100644 index 000000000..429af5593 --- /dev/null +++ b/fhirclient/models/DSTU2/healthcareservice_tests.py @@ -0,0 +1,95 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import healthcareservice +from .fhirdate import FHIRDate + + +class HealthcareServiceTests(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("HealthcareService", js["resourceType"]) + return healthcareservice.HealthcareService(js) + + def testHealthcareService1(self): + inst = self.instantiate_from("healthcareservice-example.json") + self.assertIsNotNone(inst, "Must have instantiated a HealthcareService instance") + self.implHealthcareService1(inst) + + js = inst.as_json() + self.assertEqual("HealthcareService", js["resourceType"]) + inst2 = healthcareservice.HealthcareService(js) + self.implHealthcareService1(inst2) + + def implHealthcareService1(self, inst): + self.assertFalse(inst.appointmentRequired) + self.assertEqual(inst.availabilityExceptions, "Reduced capacity is available during the Christmas period") + self.assertEqual(inst.availableTime[0].availableEndTime.date, FHIRDate("05:30:00").date) + self.assertEqual(inst.availableTime[0].availableEndTime.as_json(), "05:30:00") + self.assertEqual(inst.availableTime[0].availableStartTime.date, FHIRDate("08:30:00").date) + self.assertEqual(inst.availableTime[0].availableStartTime.as_json(), "08:30:00") + self.assertEqual(inst.availableTime[0].daysOfWeek[0], "mon") + self.assertEqual(inst.availableTime[0].daysOfWeek[1], "tue") + self.assertEqual(inst.availableTime[0].daysOfWeek[2], "wed") + self.assertEqual(inst.availableTime[0].daysOfWeek[3], "thu") + self.assertEqual(inst.availableTime[0].daysOfWeek[4], "fri") + self.assertEqual(inst.availableTime[1].availableEndTime.date, FHIRDate("04:30:00").date) + self.assertEqual(inst.availableTime[1].availableEndTime.as_json(), "04:30:00") + self.assertEqual(inst.availableTime[1].availableStartTime.date, FHIRDate("09:30:00").date) + self.assertEqual(inst.availableTime[1].availableStartTime.as_json(), "09:30:00") + self.assertEqual(inst.availableTime[1].daysOfWeek[0], "sat") + self.assertEqual(inst.availableTime[1].daysOfWeek[1], "fri") + 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.id, "example") + self.assertEqual(inst.notAvailable[0].description, "Christmas/Boxing Day") + self.assertEqual(inst.notAvailable[0].during.end.date, FHIRDate("2015-12-26").date) + self.assertEqual(inst.notAvailable[0].during.end.as_json(), "2015-12-26") + self.assertEqual(inst.notAvailable[0].during.start.date, FHIRDate("2015-12-25").date) + self.assertEqual(inst.notAvailable[0].during.start.as_json(), "2015-12-25") + self.assertEqual(inst.notAvailable[1].description, "New Years Day") + self.assertEqual(inst.notAvailable[1].during.end.date, FHIRDate("2016-01-01").date) + 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.publicKey, "*** Base64 public key goes here to be used for secure messaging ***") + 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") + self.assertEqual(inst.referralMethod[1].coding[0].display, "Fax") + self.assertEqual(inst.referralMethod[2].coding[0].code, "elec") + self.assertEqual(inst.referralMethod[2].coding[0].display, "Secure Messaging") + self.assertEqual(inst.referralMethod[3].coding[0].code, "semail") + self.assertEqual(inst.referralMethod[3].coding[0].display, "Secure Email") + self.assertEqual(inst.serviceName, "Consulting psychologists and/or psychology services") + self.assertEqual(inst.serviceType[0].type.coding[0].code, "394913002") + self.assertEqual(inst.serviceType[0].type.coding[0].display, "Psychotherapy") + self.assertEqual(inst.serviceType[0].type.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.serviceType[1].specialty[0].coding[0].code, "47505003") + self.assertEqual(inst.serviceType[1].specialty[0].coding[0].display, "Posttraumatic stress disorder") + self.assertEqual(inst.serviceType[1].specialty[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.serviceType[1].type.coding[0].code, "394587001") + self.assertEqual(inst.serviceType[1].type.coding[0].display, "Psychiatry") + self.assertEqual(inst.serviceType[1].type.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, "(555) silent") + self.assertEqual(inst.telecom[1].system, "email") + self.assertEqual(inst.telecom[1].use, "work") + self.assertEqual(inst.telecom[1].value, "directaddress@example.com") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/humanname.py b/fhirclient/models/DSTU2/humanname.py new file mode 100644 index 000000000..19ab8a4d8 --- /dev/null +++ b/fhirclient/models/DSTU2/humanname.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/HumanName) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class HumanName(element.Element): + """ Name of a human - parts and usage. + + A human's name with the ability to identify parts and usage. + """ + + resource_name = "HumanName" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.family = None + """ Family name (often called 'Surname'). + List of `str` items. """ + + self.given = None + """ Given names (not always 'first'). Includes middle names. + List of `str` items. """ + + self.period = None + """ Time period when name was/is in use. + Type `Period` (represented as `dict` in JSON). """ + + self.prefix = None + """ Parts that come before the name. + List of `str` items. """ + + self.suffix = None + """ Parts that come after the name. + List of `str` items. """ + + self.text = None + """ Text representation of the full name. + Type `str`. """ + + self.use = None + """ usual | official | temp | nickname | anonymous | old | maiden. + Type `str`. """ + + super(HumanName, self).__init__(jsondict) + + def elementProperties(self): + js = super(HumanName, self).elementProperties() + js.extend([ + ("family", "family", str, True, None, False), + ("given", "given", str, True, None, False), + ("period", "period", period.Period, False, None, False), + ("prefix", "prefix", str, True, None, False), + ("suffix", "suffix", str, True, None, False), + ("text", "text", str, False, None, False), + ("use", "use", str, False, None, False), + ]) + return js + + +from . import period diff --git a/fhirclient/models/DSTU2/identifier.py b/fhirclient/models/DSTU2/identifier.py new file mode 100644 index 000000000..a48a50a8e --- /dev/null +++ b/fhirclient/models/DSTU2/identifier.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Identifier) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Identifier(element.Element): + """ An identifier intended for computation. + + A technical identifier - identifies some entity uniquely and unambiguously. + """ + + resource_name = "Identifier" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.assigner = None + """ Organization that issued id (may be just text). + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.period = None + """ Time period when id is/was valid for use. + Type `Period` (represented as `dict` in JSON). """ + + self.system = None + """ The namespace for the identifier. + Type `str`. """ + + self.type = None + """ Description of identifier. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.use = None + """ usual | official | temp | secondary (If known). + Type `str`. """ + + self.value = None + """ The value that is unique. + Type `str`. """ + + super(Identifier, self).__init__(jsondict) + + def elementProperties(self): + js = super(Identifier, self).elementProperties() + js.extend([ + ("assigner", "assigner", fhirreference.FHIRReference, False, None, False), + ("period", "period", period.Period, False, None, False), + ("system", "system", str, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("use", "use", str, False, None, False), + ("value", "value", str, False, None, False), + ]) + return js + + +from . import codeableconcept +from . import fhirreference +from . import period diff --git a/fhirclient/models/DSTU2/imagingobjectselection.py b/fhirclient/models/DSTU2/imagingobjectselection.py new file mode 100644 index 000000000..cf90dc7e0 --- /dev/null +++ b/fhirclient/models/DSTU2/imagingobjectselection.py @@ -0,0 +1,230 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ImagingObjectSelection) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class ImagingObjectSelection(domainresource.DomainResource): + """ Key Object Selection. + + A manifest of a set of DICOM Service-Object Pair Instances (SOP Instances). + The referenced SOP Instances (images or other content) are for a single + patient, and may be from one or more studies. The referenced SOP Instances + have been selected for a purpose, such as quality assurance, conference, or + consult. Reflecting that range of purposes, typical ImagingObjectSelection + resources may include all SOP Instances in a study (perhaps for sharing + through a Health Information Exchange); key images from multiple studies + (for reference by a referring or treating physician); a multi-frame + ultrasound instance ("cine" video clip) and a set of measurements taken + from that instance (for inclusion in a teaching file); and so on. + """ + + resource_name = "ImagingObjectSelection" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.author = None + """ Author (human or machine). + Type `FHIRReference` referencing `Practitioner, Device, Organization, Patient, RelatedPerson` (represented as `dict` in JSON). """ + + self.authoringTime = None + """ Authoring time of the selection. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Description text. + Type `str`. """ + + 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 `ImagingObjectSelectionStudy` items (represented as `dict` in JSON). """ + + self.title = None + """ Reason for selection. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.uid = None + """ Instance UID. + Type `str`. """ + + super(ImagingObjectSelection, self).__init__(jsondict) + + def elementProperties(self): + js = super(ImagingObjectSelection, self).elementProperties() + js.extend([ + ("author", "author", fhirreference.FHIRReference, False, None, False), + ("authoringTime", "authoringTime", fhirdate.FHIRDate, False, None, False), + ("description", "description", str, False, None, False), + ("patient", "patient", fhirreference.FHIRReference, False, None, True), + ("study", "study", ImagingObjectSelectionStudy, True, None, True), + ("title", "title", codeableconcept.CodeableConcept, False, None, True), + ("uid", "uid", str, False, None, True), + ]) + return js + + +from . import backboneelement + +class ImagingObjectSelectionStudy(backboneelement.BackboneElement): + """ Study identity of the selected instances. + + Study identity and locating information of the DICOM SOP instances in the + selection. + """ + + resource_name = "ImagingObjectSelectionStudy" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + 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 `ImagingObjectSelectionStudySeries` items (represented as `dict` in JSON). """ + + self.uid = None + """ Study instance UID. + Type `str`. """ + + self.url = None + """ Retrieve study URL. + Type `str`. """ + + super(ImagingObjectSelectionStudy, self).__init__(jsondict) + + def elementProperties(self): + js = super(ImagingObjectSelectionStudy, self).elementProperties() + js.extend([ + ("imagingStudy", "imagingStudy", fhirreference.FHIRReference, False, None, False), + ("series", "series", ImagingObjectSelectionStudySeries, True, None, True), + ("uid", "uid", str, False, None, True), + ("url", "url", str, False, None, False), + ]) + return js + + +class ImagingObjectSelectionStudySeries(backboneelement.BackboneElement): + """ Series identity of the selected instances. + + Series identity and locating information of the DICOM SOP instances in the + selection. + """ + + resource_name = "ImagingObjectSelectionStudySeries" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.instance = None + """ The selected instance. + List of `ImagingObjectSelectionStudySeriesInstance` items (represented as `dict` in JSON). """ + + self.uid = None + """ Series instance UID. + Type `str`. """ + + self.url = None + """ Retrieve series URL. + Type `str`. """ + + super(ImagingObjectSelectionStudySeries, self).__init__(jsondict) + + def elementProperties(self): + js = super(ImagingObjectSelectionStudySeries, self).elementProperties() + js.extend([ + ("instance", "instance", ImagingObjectSelectionStudySeriesInstance, True, None, True), + ("uid", "uid", str, False, None, False), + ("url", "url", str, False, None, False), + ]) + return js + + +class ImagingObjectSelectionStudySeriesInstance(backboneelement.BackboneElement): + """ The selected instance. + + Identity and locating information of the selected DICOM SOP instances. + """ + + resource_name = "ImagingObjectSelectionStudySeriesInstance" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.frames = None + """ The frame set. + List of `ImagingObjectSelectionStudySeriesInstanceFrames` items (represented as `dict` in JSON). """ + + self.sopClass = None + """ SOP class UID of instance. + Type `str`. """ + + self.uid = None + """ Selected instance UID. + Type `str`. """ + + self.url = None + """ Retrieve instance URL. + Type `str`. """ + + super(ImagingObjectSelectionStudySeriesInstance, self).__init__(jsondict) + + def elementProperties(self): + js = super(ImagingObjectSelectionStudySeriesInstance, self).elementProperties() + js.extend([ + ("frames", "frames", ImagingObjectSelectionStudySeriesInstanceFrames, True, None, False), + ("sopClass", "sopClass", str, False, None, True), + ("uid", "uid", str, False, None, True), + ("url", "url", str, False, None, True), + ]) + return js + + +class ImagingObjectSelectionStudySeriesInstanceFrames(backboneelement.BackboneElement): + """ The frame set. + + Identity and location information of the frames in the selected instance. + """ + + resource_name = "ImagingObjectSelectionStudySeriesInstanceFrames" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.frameNumbers = None + """ Frame numbers. + List of `int` items. """ + + self.url = None + """ Retrieve frame URL. + Type `str`. """ + + super(ImagingObjectSelectionStudySeriesInstanceFrames, self).__init__(jsondict) + + def elementProperties(self): + js = super(ImagingObjectSelectionStudySeriesInstanceFrames, self).elementProperties() + js.extend([ + ("frameNumbers", "frameNumbers", int, True, None, True), + ("url", "url", str, False, None, True), + ]) + return js + + +from . import codeableconcept +from . import fhirdate +from . import fhirreference diff --git a/fhirclient/models/DSTU2/imagingobjectselection_tests.py b/fhirclient/models/DSTU2/imagingobjectselection_tests.py new file mode 100644 index 000000000..3fe58ddf1 --- /dev/null +++ b/fhirclient/models/DSTU2/imagingobjectselection_tests.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import imagingobjectselection +from .fhirdate import FHIRDate + + +class ImagingObjectSelectionTests(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("ImagingObjectSelection", js["resourceType"]) + return imagingobjectselection.ImagingObjectSelection(js) + + def testImagingObjectSelection1(self): + inst = self.instantiate_from("imagingobjectselection-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ImagingObjectSelection instance") + self.implImagingObjectSelection1(inst) + + js = inst.as_json() + self.assertEqual("ImagingObjectSelection", js["resourceType"]) + inst2 = imagingobjectselection.ImagingObjectSelection(js) + self.implImagingObjectSelection1(inst2) + + def implImagingObjectSelection1(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.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].instance[0].url, "http://localhost/wado/SCP/2.16.124.113543.6003.189642796.63084.16749.2599092904") + 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[0].url, "http://localhost/wado/SCP/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].instance[1].url, "http://localhost/wado/SCP/2.16.124.113543.6003.189642796.63084.16750.2599092902") + 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 accompanying to an exam document, including one SC image and two CT images, to publish the exam sharing
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title.coding[0].code, "113030") + self.assertEqual(inst.title.coding[0].display, "Manifest") + self.assertEqual(inst.title.coding[0].system, "http://nema.org/dicom/dicm") + self.assertEqual(inst.title.text, "A set of objects that have been exported for sharing") + self.assertEqual(inst.uid, "urn:oid:2.16.124.113543.6003.189642796.63084.16748.2599092901") + diff --git a/fhirclient/models/DSTU2/imagingstudy.py b/fhirclient/models/DSTU2/imagingstudy.py new file mode 100644 index 000000000..7f096a217 --- /dev/null +++ b/fhirclient/models/DSTU2/imagingstudy.py @@ -0,0 +1,250 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ImagingStudy) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class ImagingStudy(domainresource.DomainResource): + """ A set of images produced in single study (one or more series of references + images). + + Representation of the content produced in a DICOM imaging study. A study + comprises a set of series, each of which includes a set of Service-Object + Pair Instances (SOP Instances - images or other data) acquired or produced + in a common context. A series is of only one modality (e.g. X-ray, CT, MR, + ultrasound), but a study may have multiple series of different modalities. + """ + + resource_name = "ImagingStudy" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.accession = None + """ Related workflow identifier ("Accession Number"). + Type `Identifier` (represented as `dict` in JSON). """ + + self.availability = None + """ ONLINE | OFFLINE | NEARLINE | UNAVAILABLE (0008,0056). + Type `str`. """ + + self.description = None + """ Institution-generated description. + Type `str`. """ + + self.identifier = None + """ Other identifiers for the study. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.interpreter = None + """ Who interpreted images. + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + self.modalityList = None + """ All series modality if actual acquisition modalities. + List of `Coding` items (represented as `dict` in JSON). """ + + self.numberOfInstances = None + """ Number of Study Related Instances. + Type `int`. """ + + self.numberOfSeries = None + """ Number of Study Related Series. + Type `int`. """ + + self.order = None + """ Order(s) that caused this study to be performed. + List of `FHIRReference` items referencing `DiagnosticOrder` (represented as `dict` in JSON). """ + + self.patient = None + """ Who the images are of. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.procedure = None + """ Type of procedure performed. + List of `FHIRReference` items referencing `Procedure` (represented as `dict` in JSON). """ + + self.referrer = None + """ Referring physician (0008,0090). + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + self.series = None + """ Each study has one or more series of instances. + List of `ImagingStudySeries` items (represented as `dict` in JSON). """ + + self.started = None + """ When the study was started. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.uid = None + """ Formal identifier for the study. + Type `str`. """ + + self.url = None + """ Retrieve URI. + Type `str`. """ + + super(ImagingStudy, self).__init__(jsondict) + + def elementProperties(self): + js = super(ImagingStudy, self).elementProperties() + js.extend([ + ("accession", "accession", identifier.Identifier, False, None, False), + ("availability", "availability", str, False, None, False), + ("description", "description", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("interpreter", "interpreter", fhirreference.FHIRReference, False, None, False), + ("modalityList", "modalityList", coding.Coding, True, None, False), + ("numberOfInstances", "numberOfInstances", int, False, None, True), + ("numberOfSeries", "numberOfSeries", int, False, None, True), + ("order", "order", fhirreference.FHIRReference, True, None, False), + ("patient", "patient", fhirreference.FHIRReference, False, None, True), + ("procedure", "procedure", 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), + ("url", "url", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class ImagingStudySeries(backboneelement.BackboneElement): + """ Each study has one or more series of instances. + + Each study has one or more series of images or other content. + """ + + resource_name = "ImagingStudySeries" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.availability = None + """ ONLINE | OFFLINE | NEARLINE | UNAVAILABLE. + Type `str`. """ + + self.bodySite = None + """ Body part examined. + Type `Coding` (represented as `dict` in JSON). """ + + self.description = None + """ A description of the series. + Type `str`. """ + + self.instance = None + """ A single SOP instance from the series. + List of `ImagingStudySeriesInstance` items (represented as `dict` in JSON). """ + + self.laterality = None + """ Body part laterality. + Type `Coding` (represented as `dict` in JSON). """ + + self.modality = None + """ The modality of the instances in the series. + Type `Coding` (represented as `dict` in JSON). """ + + self.number = None + """ Numeric identifier of this series. + Type `int`. """ + + self.numberOfInstances = None + """ Number of Series Related Instances. + Type `int`. """ + + self.started = None + """ When the series started. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.uid = None + """ Formal identifier for this series. + Type `str`. """ + + self.url = None + """ Location of the referenced instance(s). + Type `str`. """ + + super(ImagingStudySeries, self).__init__(jsondict) + + 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), + ("instance", "instance", ImagingStudySeriesInstance, True, None, False), + ("laterality", "laterality", coding.Coding, False, None, False), + ("modality", "modality", coding.Coding, False, None, True), + ("number", "number", int, False, None, False), + ("numberOfInstances", "numberOfInstances", int, False, None, True), + ("started", "started", fhirdate.FHIRDate, False, None, False), + ("uid", "uid", str, False, None, True), + ("url", "url", str, False, None, False), + ]) + return js + + +class ImagingStudySeriesInstance(backboneelement.BackboneElement): + """ A single SOP instance from the series. + + A single SOP Instance within the series, e.g. an image, or presentation + state. + """ + + resource_name = "ImagingStudySeriesInstance" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.content = None + """ Content of the instance. + List of `Attachment` items (represented as `dict` in JSON). """ + + self.number = None + """ The number of this instance in the series. + Type `int`. """ + + self.sopClass = None + """ DICOM class type. + Type `str`. """ + + self.title = None + """ Description of instance. + Type `str`. """ + + self.type = None + """ Type of instance (image etc.). + Type `str`. """ + + self.uid = None + """ Formal identifier for this instance. + Type `str`. """ + + super(ImagingStudySeriesInstance, self).__init__(jsondict) + + def elementProperties(self): + js = super(ImagingStudySeriesInstance, self).elementProperties() + js.extend([ + ("content", "content", attachment.Attachment, True, None, False), + ("number", "number", int, False, None, False), + ("sopClass", "sopClass", str, False, None, True), + ("title", "title", str, False, None, False), + ("type", "type", str, False, None, False), + ("uid", "uid", str, False, None, True), + ]) + return js + + +from . import attachment +from . import coding +from . import fhirdate +from . import fhirreference +from . import identifier diff --git a/fhirclient/models/DSTU2/imagingstudy_tests.py b/fhirclient/models/DSTU2/imagingstudy_tests.py new file mode 100644 index 000000000..eda1bfe89 --- /dev/null +++ b/fhirclient/models/DSTU2/imagingstudy_tests.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import imagingstudy +from .fhirdate import FHIRDate + + +class ImagingStudyTests(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("ImagingStudy", js["resourceType"]) + return imagingstudy.ImagingStudy(js) + + def testImagingStudy1(self): + inst = self.instantiate_from("imagingstudy-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ImagingStudy instance") + self.implImagingStudy1(inst) + + js = inst.as_json() + self.assertEqual("ImagingStudy", js["resourceType"]) + inst2 = imagingstudy.ImagingStudy(js) + self.implImagingStudy1(inst2) + + def implImagingStudy1(self, inst): + self.assertEqual(inst.id, "example") + self.assertEqual(inst.numberOfInstances, 1) + self.assertEqual(inst.numberOfSeries, 1) + self.assertEqual(inst.series[0].bodySite.code, "67734004") + self.assertEqual(inst.series[0].bodySite.display, "Upper Trunk Structure") + 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].content[0].url, "http://localhost/fhir/Binary/1.2.840.11361907579238403408700.3.0.14.19970327150033") + 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].modality.code, "CT") + self.assertEqual(inst.series[0].modality.system, "http://nema.org/dicom/dicm") + 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.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.text.div, "
Image 1 from Series 3: CT Images on Patient MINT (MINT1234) taken at 1-Jan 2011 01:20 AM
") + 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/DSTU2/immunization.py b/fhirclient/models/DSTU2/immunization.py new file mode 100644 index 000000000..ba490b1ae --- /dev/null +++ b/fhirclient/models/DSTU2/immunization.py @@ -0,0 +1,276 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Immunization) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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. + """ + + resource_name = "Immunization" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.date = None + """ Vaccination administration date. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.doseQuantity = None + """ Amount of vaccine administered. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + self.encounter = None + """ Encounter administered as part of. + Type `FHIRReference` referencing `Encounter` (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.identifier = None + """ Business identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.location = None + """ Where vaccination occurred. + Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + + self.lotNumber = None + """ Vaccine lot number. + Type `str`. """ + + self.manufacturer = None + """ Vaccine manufacturer. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.note = None + """ Vaccination notes. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.patient = None + """ Who was immunized. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.performer = None + """ Who administered vaccine. + Type `FHIRReference` referencing `Practitioner` (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.reported = None + """ Indicates a self-reported record. + Type `bool`. """ + + self.requester = None + """ Who ordered vaccination. + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + self.route = None + """ How vaccine entered body. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.site = None + """ Body site vaccine was administered. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.status = None + """ in-progress | on-hold | completed | entered-in-error | stopped. + Type `str`. """ + + self.vaccinationProtocol = None + """ What protocol was followed. + List of `ImmunizationVaccinationProtocol` items (represented as `dict` in JSON). """ + + self.vaccineCode = None + """ Vaccine product administered. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.wasNotGiven = None + """ Flag for whether immunization was given. + Type `bool`. """ + + super(Immunization, self).__init__(jsondict) + + def elementProperties(self): + js = super(Immunization, self).elementProperties() + js.extend([ + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("doseQuantity", "doseQuantity", quantity.Quantity, False, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), + ("expirationDate", "expirationDate", fhirdate.FHIRDate, False, None, False), + ("explanation", "explanation", ImmunizationExplanation, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("location", "location", fhirreference.FHIRReference, False, None, False), + ("lotNumber", "lotNumber", str, False, None, False), + ("manufacturer", "manufacturer", fhirreference.FHIRReference, False, None, False), + ("note", "note", annotation.Annotation, True, None, False), + ("patient", "patient", fhirreference.FHIRReference, False, None, True), + ("performer", "performer", fhirreference.FHIRReference, False, None, False), + ("reaction", "reaction", ImmunizationReaction, True, None, False), + ("reported", "reported", bool, False, None, True), + ("requester", "requester", fhirreference.FHIRReference, 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), + ("vaccineCode", "vaccineCode", codeableconcept.CodeableConcept, False, None, True), + ("wasNotGiven", "wasNotGiven", bool, False, None, True), + ]) + return js + + +from . import backboneelement + +class ImmunizationExplanation(backboneelement.BackboneElement): + """ Administration/non-administration reasons. + + Reasons why a vaccine was or was not administered. + """ + + resource_name = "ImmunizationExplanation" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.reason = None + """ Why immunization occurred. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.reasonNotGiven = None + """ Why immunization did not occur. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(ImmunizationExplanation, self).__init__(jsondict) + + def elementProperties(self): + js = super(ImmunizationExplanation, self).elementProperties() + js.extend([ + ("reason", "reason", codeableconcept.CodeableConcept, True, None, False), + ("reasonNotGiven", "reasonNotGiven", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +class ImmunizationReaction(backboneelement.BackboneElement): + """ Details of a reaction that follows immunization. + + Categorical data indicating that an adverse event is associated in time to + an immunization. + """ + + resource_name = "ImmunizationReaction" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.date = None + """ When reaction started. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.detail = None + """ Additional information on reaction. + Type `FHIRReference` referencing `Observation` (represented as `dict` in JSON). """ + + self.reported = None + """ Indicates self-reported reaction. + Type `bool`. """ + + super(ImmunizationReaction, self).__init__(jsondict) + + def elementProperties(self): + js = super(ImmunizationReaction, self).elementProperties() + js.extend([ + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("detail", "detail", fhirreference.FHIRReference, False, None, False), + ("reported", "reported", bool, False, None, False), + ]) + return js + + +class ImmunizationVaccinationProtocol(backboneelement.BackboneElement): + """ What protocol was followed. + + Contains information about the protocol(s) under which the vaccine was + administered. + """ + + resource_name = "ImmunizationVaccinationProtocol" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + 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.seriesDoses = None + """ Recommended number of doses for immunity. + Type `int`. """ + + self.targetDisease = None + """ Disease immunized against. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(ImmunizationVaccinationProtocol, self).__init__(jsondict) + + def elementProperties(self): + js = super(ImmunizationVaccinationProtocol, self).elementProperties() + js.extend([ + ("authority", "authority", fhirreference.FHIRReference, False, None, False), + ("description", "description", str, False, None, False), + ("doseSequence", "doseSequence", int, False, None, True), + ("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), + ]) + return js + + +from . import annotation +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier +from . import quantity diff --git a/fhirclient/models/DSTU2/immunization_tests.py b/fhirclient/models/DSTU2/immunization_tests.py new file mode 100644 index 000000000..80d4cfb24 --- /dev/null +++ b/fhirclient/models/DSTU2/immunization_tests.py @@ -0,0 +1,102 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import immunization +from .fhirdate import FHIRDate + + +class ImmunizationTests(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("Immunization", js["resourceType"]) + return immunization.Immunization(js) + + def testImmunization1(self): + inst = self.instantiate_from("immunization-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Immunization instance") + self.implImmunization1(inst) + + js = inst.as_json() + self.assertEqual("Immunization", js["resourceType"]) + inst2 = immunization.Immunization(js) + self.implImmunization1(inst2) + + def implImmunization1(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") + 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.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.lotNumber, "AAJN11K") + self.assertEqual(inst.note[0].text, "Notes on adminstration of vaccine") + 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.assertFalse(inst.reported) + 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.status, "completed") + 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].system, "urn:oid:1.2.36.1.2001.1005.17") + self.assertEqual(inst.vaccineCode.text, "Fluvax (Influenza)") + self.assertFalse(inst.wasNotGiven) + + def testImmunization2(self): + inst = self.instantiate_from("immunization-example-refused.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.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") + self.assertEqual(inst.id, "notGiven") + self.assertFalse(inst.reported) + self.assertEqual(inst.status, "completed") + 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") + self.assertTrue(inst.wasNotGiven) + diff --git a/fhirclient/models/DSTU2/immunizationrecommendation.py b/fhirclient/models/DSTU2/immunizationrecommendation.py new file mode 100644 index 000000000..b79548d64 --- /dev/null +++ b/fhirclient/models/DSTU2/immunizationrecommendation.py @@ -0,0 +1,186 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ImmunizationRecommendation) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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. + """ + + resource_name = "ImmunizationRecommendation" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + 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). """ + + self.recommendation = None + """ Vaccine administration recommendations. + List of `ImmunizationRecommendationRecommendation` items (represented as `dict` in JSON). """ + + super(ImmunizationRecommendation, self).__init__(jsondict) + + def elementProperties(self): + js = super(ImmunizationRecommendation, self).elementProperties() + js.extend([ + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("patient", "patient", fhirreference.FHIRReference, False, None, True), + ("recommendation", "recommendation", ImmunizationRecommendationRecommendation, True, None, True), + ]) + return js + + +from . import backboneelement + +class ImmunizationRecommendationRecommendation(backboneelement.BackboneElement): + """ Vaccine administration recommendations. + """ + + resource_name = "ImmunizationRecommendationRecommendation" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.date = None + """ Date recommendation created. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.dateCriterion = None + """ Dates governing proposed immunization. + List of `ImmunizationRecommendationRecommendationDateCriterion` items (represented as `dict` in JSON). """ + + self.doseNumber = None + """ Recommended dose number. + Type `int`. """ + + self.forecastStatus = None + """ Vaccine administration status. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.protocol = None + """ Protocol used by recommendation. + Type `ImmunizationRecommendationRecommendationProtocol` (represented as `dict` in JSON). """ + + self.supportingImmunization = None + """ Past immunizations supporting recommendation. + List of `FHIRReference` items referencing `Immunization` (represented as `dict` in JSON). """ + + self.supportingPatientInformation = None + """ Patient observations supporting recommendation. + List of `FHIRReference` items referencing `Observation, AllergyIntolerance` (represented as `dict` in JSON). """ + + self.vaccineCode = None + """ Vaccine recommendation applies to. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ImmunizationRecommendationRecommendation, self).__init__(jsondict) + + def elementProperties(self): + js = super(ImmunizationRecommendationRecommendation, self).elementProperties() + js.extend([ + ("date", "date", fhirdate.FHIRDate, False, None, True), + ("dateCriterion", "dateCriterion", ImmunizationRecommendationRecommendationDateCriterion, True, None, False), + ("doseNumber", "doseNumber", int, False, None, False), + ("forecastStatus", "forecastStatus", codeableconcept.CodeableConcept, False, None, True), + ("protocol", "protocol", ImmunizationRecommendationRecommendationProtocol, False, None, False), + ("supportingImmunization", "supportingImmunization", fhirreference.FHIRReference, True, None, False), + ("supportingPatientInformation", "supportingPatientInformation", fhirreference.FHIRReference, True, None, False), + ("vaccineCode", "vaccineCode", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +class ImmunizationRecommendationRecommendationDateCriterion(backboneelement.BackboneElement): + """ Dates governing proposed immunization. + + Vaccine date recommendations. For example, earliest date to administer, + latest date to administer, etc. + """ + + resource_name = "ImmunizationRecommendationRecommendationDateCriterion" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.code = None + """ Type of date. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.value = None + """ Recommended date. + Type `FHIRDate` (represented as `str` in JSON). """ + + super(ImmunizationRecommendationRecommendationDateCriterion, self).__init__(jsondict) + + def elementProperties(self): + js = super(ImmunizationRecommendationRecommendationDateCriterion, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("value", "value", fhirdate.FHIRDate, False, None, True), + ]) + return js + + +class ImmunizationRecommendationRecommendationProtocol(backboneelement.BackboneElement): + """ Protocol used by recommendation. + + Contains information about the protocol under which the vaccine was + administered. + """ + + resource_name = "ImmunizationRecommendationRecommendationProtocol" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + 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) + + 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 + + +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier diff --git a/fhirclient/models/DSTU2/immunizationrecommendation_tests.py b/fhirclient/models/DSTU2/immunizationrecommendation_tests.py new file mode 100644 index 000000000..07a4c9921 --- /dev/null +++ b/fhirclient/models/DSTU2/immunizationrecommendation_tests.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import immunizationrecommendation +from .fhirdate import FHIRDate + + +class ImmunizationRecommendationTests(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("ImmunizationRecommendation", js["resourceType"]) + return immunizationrecommendation.ImmunizationRecommendation(js) + + def testImmunizationRecommendation1(self): + inst = self.instantiate_from("immunizationrecommendation-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ImmunizationRecommendation instance") + self.implImmunizationRecommendation1(inst) + + js = inst.as_json() + self.assertEqual("ImmunizationRecommendation", js["resourceType"]) + inst2 = immunizationrecommendation.ImmunizationRecommendation(js) + self.implImmunizationRecommendation1(inst2) + + def implImmunizationRecommendation1(self, inst): + 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.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].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].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].forecastStatus.coding[0].code, "Not Complete") + self.assertEqual(inst.recommendation[0].forecastStatus.coding[0].display, "Not Complete") + self.assertEqual(inst.recommendation[0].forecastStatus.coding[0].system, "http://hl7.org/fhir/immunization-recommendation-status") + 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.text.div, "
Authored by Joginder Madra
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/implementationguide.py b/fhirclient/models/DSTU2/implementationguide.py new file mode 100644 index 000000000..3335ae02f --- /dev/null +++ b/fhirclient/models/DSTU2/implementationguide.py @@ -0,0 +1,373 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ImplementationGuide) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class ImplementationGuide(domainresource.DomainResource): + """ A set of rules about how FHIR is used. + + A set of rules or 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. + """ + + resource_name = "ImplementationGuide" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.binary = None + """ Image, css, script, etc.. + List of `str` items. """ + + self.contact = None + """ Contact details of the publisher. + List of `ImplementationGuideContact` items (represented as `dict` in JSON). """ + + self.copyright = None + """ Use and/or publishing restrictions. + Type `str`. """ + + self.date = None + """ Date for this version of the Implementation Guide. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.dependency = None + """ Another Implementation guide this depends on. + List of `ImplementationGuideDependency` items (represented as `dict` in JSON). """ + + self.description = None + """ Natural language description of the Implementation Guide. + Type `str`. """ + + self.experimental = None + """ If for testing purposes, not real usage. + Type `bool`. """ + + self.fhirVersion = None + """ FHIR Version this Implementation Guide targets. + Type `str`. """ + + self.global_fhir = None + """ Profiles that apply globally. + List of `ImplementationGuideGlobal` items (represented as `dict` in JSON). """ + + self.name = None + """ Informal name for this Implementation Guide. + 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.publisher = None + """ Name of the publisher (Organization or individual). + Type `str`. """ + + self.status = None + """ draft | active | retired. + Type `str`. """ + + self.url = None + """ Absolute URL used to reference this Implementation Guide. + Type `str`. """ + + self.useContext = None + """ The implementation guide is intended to support these contexts. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.version = None + """ Logical id for this version of the Implementation Guide. + Type `str`. """ + + super(ImplementationGuide, self).__init__(jsondict) + + def elementProperties(self): + js = super(ImplementationGuide, self).elementProperties() + js.extend([ + ("binary", "binary", str, True, None, False), + ("contact", "contact", ImplementationGuideContact, True, None, False), + ("copyright", "copyright", str, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("dependency", "dependency", ImplementationGuideDependency, True, None, False), + ("description", "description", str, False, None, False), + ("experimental", "experimental", bool, False, None, False), + ("fhirVersion", "fhirVersion", str, False, None, False), + ("global_fhir", "global", ImplementationGuideGlobal, True, None, False), + ("name", "name", str, False, None, True), + ("package", "package", ImplementationGuidePackage, True, None, True), + ("page", "page", ImplementationGuidePage, False, None, True), + ("publisher", "publisher", str, False, None, False), + ("status", "status", str, False, None, True), + ("url", "url", str, False, None, True), + ("useContext", "useContext", codeableconcept.CodeableConcept, True, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class ImplementationGuideContact(backboneelement.BackboneElement): + """ Contact details of the publisher. + + Contacts to assist a user in finding and communicating with the publisher. + """ + + resource_name = "ImplementationGuideContact" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.name = None + """ Name of a individual to contact. + Type `str`. """ + + self.telecom = None + """ Contact details for individual or publisher. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(ImplementationGuideContact, self).__init__(jsondict) + + def elementProperties(self): + js = super(ImplementationGuideContact, self).elementProperties() + js.extend([ + ("name", "name", str, False, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ]) + return js + + +class ImplementationGuideDependency(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_name = "ImplementationGuideDependency" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.type = None + """ reference | inclusion. + Type `str`. """ + + self.uri = None + """ Where to find dependency. + Type `str`. """ + + super(ImplementationGuideDependency, self).__init__(jsondict) + + def elementProperties(self): + js = super(ImplementationGuideDependency, self).elementProperties() + js.extend([ + ("type", "type", str, False, None, True), + ("uri", "uri", str, False, None, True), + ]) + 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_name = "ImplementationGuideGlobal" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.profile = None + """ Profile that all resources must conform to. + Type `FHIRReference` referencing `StructureDefinition` (represented as `dict` in JSON). """ + + self.type = None + """ Type this profiles applies to. + Type `str`. """ + + super(ImplementationGuideGlobal, self).__init__(jsondict) + + def elementProperties(self): + js = super(ImplementationGuideGlobal, self).elementProperties() + js.extend([ + ("profile", "profile", fhirreference.FHIRReference, False, None, True), + ("type", "type", str, False, None, True), + ]) + return js + + +class ImplementationGuidePackage(backboneelement.BackboneElement): + """ Group of resources as used in .page.package. + + A logical group of resources. Logical groups can be used when building + pages. + """ + + resource_name = "ImplementationGuidePackage" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.description = None + """ Human readable text describing the package. + Type `str`. """ + + self.name = None + """ Name used .page.package. + Type `str`. """ + + self.resource = None + """ Resource in the implementation guide. + List of `ImplementationGuidePackageResource` items (represented as `dict` in JSON). """ + + super(ImplementationGuidePackage, self).__init__(jsondict) + + def elementProperties(self): + js = super(ImplementationGuidePackage, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, False), + ("name", "name", str, False, None, True), + ("resource", "resource", ImplementationGuidePackageResource, True, None, True), + ]) + return js + + +class ImplementationGuidePackageResource(backboneelement.BackboneElement): + """ Resource in the implementation guide. + + A resource that is part of the implementation guide. Conformance resources + (value set, structure definition, conformance statements etc.) are obvious + candidates for inclusion, but any kind of resource can be included as an + example resource. + """ + + resource_name = "ImplementationGuidePackageResource" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.acronym = None + """ Short code to identify the resource. + Type `str`. """ + + self.description = None + """ Reason why included in guide. + Type `str`. """ + + self.exampleFor = None + """ Resource this is an example of (if applicable). + Type `FHIRReference` referencing `StructureDefinition` (represented as `dict` in JSON). """ + + self.name = None + """ Human Name for the resource. + Type `str`. """ + + self.purpose = None + """ example | terminology | profile | extension | dictionary | logical. + Type `str`. """ + + self.sourceReference = None + """ Location of the resource. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.sourceUri = None + """ Location of the resource. + Type `str`. """ + + super(ImplementationGuidePackageResource, self).__init__(jsondict) + + def elementProperties(self): + js = super(ImplementationGuidePackageResource, self).elementProperties() + js.extend([ + ("acronym", "acronym", str, False, None, False), + ("description", "description", str, False, None, False), + ("exampleFor", "exampleFor", fhirreference.FHIRReference, False, None, False), + ("name", "name", str, False, None, False), + ("purpose", "purpose", str, False, None, True), + ("sourceReference", "sourceReference", fhirreference.FHIRReference, False, "source", True), + ("sourceUri", "sourceUri", str, False, "source", True), + ]) + return js + + +class ImplementationGuidePage(backboneelement.BackboneElement): + """ Page/Section in the Guide. + + A page / section in the implementation guide. The root page is the + implementation guide home page. + """ + + resource_name = "ImplementationGuidePage" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.format = None + """ Format of the page (e.g. html, markdown, etc.). + Type `str`. """ + + self.kind = None + """ page | example | list | include | directory | dictionary | toc | + resource. + Type `str`. """ + + self.name = None + """ Short name shown for navigational assistance. + Type `str`. """ + + self.package = None + """ Name of package to include. + List of `str` items. """ + + self.page = None + """ Nested Pages / Sections. + List of `ImplementationGuidePage` items (represented as `dict` in JSON). """ + + self.source = None + """ Where to find that page. + Type `str`. """ + + self.type = None + """ Kind of resource to include in the list. + List of `str` items. """ + + super(ImplementationGuidePage, self).__init__(jsondict) + + def elementProperties(self): + js = super(ImplementationGuidePage, self).elementProperties() + js.extend([ + ("format", "format", str, False, None, False), + ("kind", "kind", str, False, None, True), + ("name", "name", str, False, None, True), + ("package", "package", str, True, None, False), + ("page", "page", ImplementationGuidePage, True, None, False), + ("source", "source", str, False, None, True), + ("type", "type", str, True, None, False), + ]) + return js + + +from . import codeableconcept +from . import contactpoint +from . import fhirdate +from . import fhirreference diff --git a/fhirclient/models/DSTU2/implementationguide_tests.py b/fhirclient/models/DSTU2/implementationguide_tests.py new file mode 100644 index 000000000..724fcca7e --- /dev/null +++ b/fhirclient/models/DSTU2/implementationguide_tests.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import implementationguide +from .fhirdate import FHIRDate + + +class ImplementationGuideTests(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("ImplementationGuide", js["resourceType"]) + return implementationguide.ImplementationGuide(js) + + def testImplementationGuide1(self): + inst = self.instantiate_from("implementationguide-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ImplementationGuide instance") + self.implImplementationGuide1(inst) + + js = inst.as_json() + self.assertEqual("ImplementationGuide", js["resourceType"]) + inst2 = implementationguide.ImplementationGuide(js) + 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, "other") + self.assertEqual(inst.contact[0].telecom[0].value, "http://www.healthit.gov") + self.assertEqual(inst.contact[1].name, "HL7") + self.assertEqual(inst.contact[1].telecom[0].system, "other") + self.assertEqual(inst.contact[1].telecom[0].value, "http://hl7.org/fhir") + 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.assertFalse(inst.experimental) + self.assertEqual(inst.fhirVersion, "1.0.0") + self.assertEqual(inst.global_fhir[0].type, "Patient") + self.assertEqual(inst.id, "example") + 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.assertEqual(inst.package[0].resource[0].name, "Test Example") + self.assertEqual(inst.package[0].resource[0].purpose, "example") + self.assertEqual(inst.package[0].resource[0].sourceUri, "test.html") + self.assertEqual(inst.page.kind, "page") + self.assertEqual(inst.page.name, "Example Patient Page") + self.assertEqual(inst.page.page[0].format, "text/html") + self.assertEqual(inst.page.page[0].kind, "list") + self.assertEqual(inst.page.page[0].name, "Value Set Page") + self.assertEqual(inst.page.page[0].package[0], "test") + self.assertEqual(inst.page.page[0].source, "list.html") + self.assertEqual(inst.page.page[0].type[0], "ValueSet") + self.assertEqual(inst.page.source, "patient-example.html") + self.assertEqual(inst.publisher, "ONC / HL7 Joint project") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.url, "http://hl7.org/fhir/daf") + self.assertEqual(inst.useContext[0].coding[0].code, "US") + self.assertEqual(inst.useContext[0].coding[0].system, "urn:iso:std:iso:3166") + self.assertEqual(inst.version, "0") + diff --git a/fhirclient/models/DSTU2/list.py b/fhirclient/models/DSTU2/list.py new file mode 100644 index 000000000..6b0e11bff --- /dev/null +++ b/fhirclient/models/DSTU2/list.py @@ -0,0 +1,142 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/List) on 2019-10-12. +# 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. + """ + + resource_name = "List" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.code = None + """ What the purpose of this list is. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.date = None + """ When the list was prepared. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.emptyReason = None + """ Why list is empty. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.encounter = None + """ Context in which list created. + Type `FHIRReference` referencing `Encounter` (represented as `dict` in JSON). """ + + self.entry = None + """ Entries in the list. + List of `ListEntry` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Business identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.mode = None + """ working | snapshot | changes. + Type `str`. """ + + self.note = None + """ Comments about the list. + Type `str`. """ + + self.orderedBy = None + """ What order the list has. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.source = None + """ Who and/or what defined the list contents (aka Author). + Type `FHIRReference` referencing `Practitioner, Patient, Device` (represented as `dict` in JSON). """ + + self.status = None + """ current | retired | entered-in-error. + Type `str`. """ + + self.subject = None + """ If all resources have the same subject. + Type `FHIRReference` referencing `Patient, Group, Device, Location` (represented as `dict` in JSON). """ + + self.title = None + """ Descriptive name for the list. + Type `str`. """ + + super(List, self).__init__(jsondict) + + def elementProperties(self): + js = super(List, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("emptyReason", "emptyReason", codeableconcept.CodeableConcept, False, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), + ("entry", "entry", ListEntry, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("mode", "mode", str, False, None, True), + ("note", "note", str, False, None, False), + ("orderedBy", "orderedBy", codeableconcept.CodeableConcept, False, None, False), + ("source", "source", fhirreference.FHIRReference, False, None, False), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ("title", "title", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class ListEntry(backboneelement.BackboneElement): + """ Entries in the list. + + Entries in this list. + """ + + resource_name = "ListEntry" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.date = None + """ When item added to list. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.deleted = None + """ If this item is actually marked as deleted. + Type `bool`. """ + + self.flag = None + """ Status/Workflow information about this item. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.item = None + """ Actual entry. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + super(ListEntry, self).__init__(jsondict) + + def elementProperties(self): + js = super(ListEntry, self).elementProperties() + js.extend([ + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("deleted", "deleted", bool, False, None, False), + ("flag", "flag", codeableconcept.CodeableConcept, False, None, False), + ("item", "item", fhirreference.FHIRReference, False, None, True), + ]) + return js + + +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier diff --git a/fhirclient/models/DSTU2/list_tests.py b/fhirclient/models/DSTU2/list_tests.py new file mode 100644 index 000000000..7d7c8e7d8 --- /dev/null +++ b/fhirclient/models/DSTU2/list_tests.py @@ -0,0 +1,207 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import list +from .fhirdate import FHIRDate + + +class ListTests(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("List", js["resourceType"]) + return list.List(js) + + def testList1(self): + inst = self.instantiate_from("list-example-medlist.json") + self.assertIsNotNone(inst, "Must have instantiated a List instance") + self.implList1(inst) + + js = inst.as_json() + self.assertEqual("List", js["resourceType"]) + inst2 = list.List(js) + self.implList1(inst2) + + def implList1(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.mode, "changes") + self.assertEqual(inst.status, "current") + self.assertEqual(inst.text.status, "generated") + + def testList2(self): + inst = self.instantiate_from("list-example-familyhistory-genetics-profile-annie.json") + self.assertIsNotNone(inst, "Must have instantiated a List instance") + self.implList2(inst) + + js = inst.as_json() + self.assertEqual("List", js["resourceType"]) + inst2 = list.List(js) + self.implList2(inst2) + + def implList2(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, "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.contained[8].id, "9") + self.assertEqual(inst.contained[9].id, "10") + self.assertEqual(inst.id, "prognosis") + 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") + self.assertIsNotNone(inst, "Must have instantiated a List instance") + self.implList3(inst) + + js = inst.as_json() + self.assertEqual("List", js["resourceType"]) + inst2 = list.List(js) + 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.mode, "snapshot") + self.assertEqual(inst.status, "current") + self.assertEqual(inst.text.status, "generated") + + def testList4(self): + inst = self.instantiate_from("list-example-familyhistory-genetics-profile.json") + self.assertIsNotNone(inst, "Must have instantiated a List instance") + self.implList4(inst) + + js = inst.as_json() + self.assertEqual("List", js["resourceType"]) + inst2 = list.List(js) + 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, "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.mode, "snapshot") + self.assertEqual(inst.status, "current") + self.assertEqual(inst.text.div, "
To do
") + self.assertEqual(inst.text.status, "generated") + + def testList5(self): + inst = self.instantiate_from("list-example-familyhistory-f201-roel.json") + self.assertIsNotNone(inst, "Must have instantiated a List instance") + self.implList5(inst) + + js = inst.as_json() + self.assertEqual("List", js["resourceType"]) + inst2 = list.List(js) + self.implList5(inst2) + + 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, "fmh-1") + self.assertEqual(inst.contained[1].id, "fmh-2") + self.assertEqual(inst.id, "f201") + self.assertEqual(inst.mode, "snapshot") + self.assertEqual(inst.note, "Both parents, both brothers and both children (twin) are still alive.") + self.assertEqual(inst.status, "current") + self.assertEqual(inst.text.status, "generated") + + def testList6(self): + inst = self.instantiate_from("list-example.json") + self.assertIsNotNone(inst, "Must have instantiated a List instance") + self.implList6(inst) + + js = inst.as_json() + self.assertEqual("List", js["resourceType"]) + inst2 = list.List(js) + self.implList6(inst2) + + def implList6(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.mode, "changes") + self.assertEqual(inst.status, "current") + self.assertEqual(inst.text.status, "generated") + + def testList7(self): + inst = self.instantiate_from("list-example-allergies.json") + self.assertIsNotNone(inst, "Must have instantiated a List instance") + self.implList7(inst) + + js = inst.as_json() + self.assertEqual("List", js["resourceType"]) + inst2 = list.List(js) + self.implList7(inst2) + + def implList7(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.status, "current") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "Current Allergy List") + diff --git a/fhirclient/models/DSTU2/location.py b/fhirclient/models/DSTU2/location.py new file mode 100644 index 000000000..43728c8bc --- /dev/null +++ b/fhirclient/models/DSTU2/location.py @@ -0,0 +1,136 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Location) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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 + accommodated. + """ + + resource_name = "Location" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.address = None + """ Physical location. + Type `Address` (represented as `dict` in JSON). """ + + self.description = None + """ Description of the location. + Type `str`. """ + + self.identifier = None + """ Unique code or number identifying the location to its users. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.managingOrganization = None + """ Organization responsible for provisioning and upkeep. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.mode = None + """ instance | kind. + Type `str`. """ + + self.name = None + """ Name of the location as used by humans. + Type `str`. """ + + self.partOf = None + """ Another Location this one is physically part of. + Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + + self.physicalType = None + """ Physical form of the location. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.position = None + """ The absolute geographic location. + Type `LocationPosition` (represented as `dict` in JSON). """ + + self.status = None + """ active | suspended | inactive. + Type `str`. """ + + self.telecom = None + """ Contact details of the location. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + self.type = None + """ Type of function performed. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(Location, self).__init__(jsondict) + + def elementProperties(self): + js = super(Location, self).elementProperties() + js.extend([ + ("address", "address", address.Address, False, None, False), + ("description", "description", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("managingOrganization", "managingOrganization", fhirreference.FHIRReference, False, None, False), + ("mode", "mode", str, False, None, False), + ("name", "name", str, False, None, False), + ("partOf", "partOf", fhirreference.FHIRReference, False, None, False), + ("physicalType", "physicalType", codeableconcept.CodeableConcept, False, None, False), + ("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), + ]) + return js + + +from . import backboneelement + +class LocationPosition(backboneelement.BackboneElement): + """ The absolute geographic location. + + The absolute geographic location of the Location, expressed using the WGS84 + datum (This is the same co-ordinate system used in KML). + """ + + resource_name = "LocationPosition" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.altitude = None + """ Altitude with WGS84 datum. + Type `float`. """ + + self.latitude = None + """ Latitude with WGS84 datum. + Type `float`. """ + + self.longitude = None + """ Longitude with WGS84 datum. + Type `float`. """ + + super(LocationPosition, self).__init__(jsondict) + + def elementProperties(self): + js = super(LocationPosition, self).elementProperties() + js.extend([ + ("altitude", "altitude", float, False, None, False), + ("latitude", "latitude", float, False, None, True), + ("longitude", "longitude", float, False, None, True), + ]) + return js + + +from . import address +from . import codeableconcept +from . import contactpoint +from . import fhirreference +from . import identifier diff --git a/fhirclient/models/DSTU2/location_tests.py b/fhirclient/models/DSTU2/location_tests.py new file mode 100644 index 000000000..36157406f --- /dev/null +++ b/fhirclient/models/DSTU2/location_tests.py @@ -0,0 +1,212 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import location +from .fhirdate import FHIRDate + + +class LocationTests(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("Location", js["resourceType"]) + return location.Location(js) + + def testLocation1(self): + inst = self.instantiate_from("location-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Location instance") + self.implLocation1(inst) + + js = inst.as_json() + self.assertEqual("Location", js["resourceType"]) + inst2 = location.Location(js) + self.implLocation1(inst2) + + def implLocation1(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.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.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[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, "other") + 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") + + def testLocation2(self): + inst = self.instantiate_from("location-example-room.json") + self.assertIsNotNone(inst, "Must have instantiated a Location instance") + self.implLocation2(inst) + + js = inst.as_json() + self.assertEqual("Location", js["resourceType"]) + inst2 = location.Location(js) + self.implLocation2(inst2) + + def implLocation2(self, inst): + 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.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.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") + + def testLocation3(self): + inst = self.instantiate_from("location-example-ambulance.json") + self.assertIsNotNone(inst, "Must have instantiated a Location instance") + self.implLocation3(inst) + + js = inst.as_json() + self.assertEqual("Location", js["resourceType"]) + inst2 = location.Location(js) + self.implLocation3(inst2) + + def implLocation3(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.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.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 testLocation4(self): + inst = self.instantiate_from("location-example-ukpharmacy.json") + self.assertIsNotNone(inst, "Must have instantiated a Location instance") + self.implLocation4(inst) + + js = inst.as_json() + self.assertEqual("Location", js["resourceType"]) + inst2 = location.Location(js) + self.implLocation4(inst2) + + def implLocation4(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.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.status, "active") + self.assertEqual(inst.text.div, "
UK Pharmacies
") + 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") + + def testLocation5(self): + inst = self.instantiate_from("location-example-patients-home.json") + self.assertIsNotNone(inst, "Must have instantiated a Location instance") + self.implLocation5(inst) + + js = inst.as_json() + self.assertEqual("Location", js["resourceType"]) + inst2 = location.Location(js) + self.implLocation5(inst2) + + def implLocation5(self, inst): + self.assertEqual(inst.description, "Patient's Home") + self.assertEqual(inst.id, "ph") + 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.status, "active") + self.assertEqual(inst.text.div, "
Patient's Home
") + 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") + + def testLocation6(self): + inst = self.instantiate_from("location-example-hl7hq.json") + self.assertIsNotNone(inst, "Must have instantiated a Location instance") + self.implLocation6(inst) + + js = inst.as_json() + self.assertEqual("Location", js["resourceType"]) + inst2 = location.Location(js) + self.implLocation6(inst2) + + def implLocation6(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.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.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.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") + diff --git a/fhirclient/models/DSTU2/media.py b/fhirclient/models/DSTU2/media.py new file mode 100644 index 000000000..42f991f0b --- /dev/null +++ b/fhirclient/models/DSTU2/media.py @@ -0,0 +1,93 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Media) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Media(domainresource.DomainResource): + """ A photo, video, or audio recording acquired or used in healthcare. The + actual content may be inline or provided by direct reference. + """ + + resource_name = "Media" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.content = None + """ Actual Media - reference or data. + Type `Attachment` (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`. """ + + self.frames = None + """ Number of frames if > 1 (photo). + Type `int`. """ + + self.height = None + """ Height of the image in pixels (photo/video). + Type `int`. """ + + self.identifier = None + """ Identifier(s) for the image. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.operator = None + """ The person who generated the image. + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + 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). """ + + self.type = None + """ photo | video | audio. + Type `str`. """ + + self.view = None + """ Imaging view, e.g. Lateral or Antero-posterior. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.width = None + """ Width of the image in pixels (photo/video). + Type `int`. """ + + super(Media, self).__init__(jsondict) + + def elementProperties(self): + js = super(Media, self).elementProperties() + js.extend([ + ("content", "content", attachment.Attachment, False, None, True), + ("deviceName", "deviceName", str, False, None, False), + ("duration", "duration", int, False, None, False), + ("frames", "frames", int, False, None, False), + ("height", "height", int, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("operator", "operator", fhirreference.FHIRReference, False, None, False), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ("subtype", "subtype", codeableconcept.CodeableConcept, False, None, False), + ("type", "type", str, False, None, True), + ("view", "view", codeableconcept.CodeableConcept, False, None, False), + ("width", "width", int, False, None, False), + ]) + return js + + +from . import attachment +from . import codeableconcept +from . import fhirreference +from . import identifier diff --git a/fhirclient/models/DSTU2/media_tests.py b/fhirclient/models/DSTU2/media_tests.py new file mode 100644 index 000000000..c42df4967 --- /dev/null +++ b/fhirclient/models/DSTU2/media_tests.py @@ -0,0 +1,108 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import media +from .fhirdate import FHIRDate + + +class MediaTests(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("Media", js["resourceType"]) + return media.Media(js) + + def testMedia1(self): + inst = self.instantiate_from("media-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Media instance") + self.implMedia1(inst) + + js = inst.as_json() + self.assertEqual("Media", js["resourceType"]) + inst2 = media.Media(js) + 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.deviceName, "Acme Camera") + 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-method") + self.assertEqual(inst.text.div, "
Diagram for Patient Henry Levin (MRN 12345):
\"diagram\"
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type, "photo") + 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.deviceName, "G.E. Medical Systems") + 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.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[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].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].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://nema.org/dicom/dicm") + 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 testMedia3(self): + inst = self.instantiate_from("media-example-sound.json") + self.assertIsNotNone(inst, "Must have instantiated a Media instance") + self.implMedia3(inst) + + js = inst.as_json() + self.assertEqual("Media", js["resourceType"]) + inst2 = media.Media(js) + self.implMedia3(inst2) + + def implMedia3(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") + diff --git a/fhirclient/models/DSTU2/medication.py b/fhirclient/models/DSTU2/medication.py new file mode 100644 index 000000000..ea80e56f9 --- /dev/null +++ b/fhirclient/models/DSTU2/medication.py @@ -0,0 +1,224 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Medication) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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. + """ + + resource_name = "Medication" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.code = None + """ Codes that identify this medication. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.isBrand = None + """ True if a brand. + 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). """ + + self.product = None + """ Administrable medication details. + Type `MedicationProduct` (represented as `dict` in JSON). """ + + super(Medication, self).__init__(jsondict) + + def elementProperties(self): + js = super(Medication, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("isBrand", "isBrand", bool, False, None, False), + ("manufacturer", "manufacturer", fhirreference.FHIRReference, False, None, False), + ("package", "package", MedicationPackage, False, None, False), + ("product", "product", MedicationProduct, False, None, False), + ]) + return js + + +from . import backboneelement + +class MedicationPackage(backboneelement.BackboneElement): + """ Details about packaged medications. + + Information that only applies to packages (not products). + """ + + resource_name = "MedicationPackage" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + 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) + + def elementProperties(self): + js = super(MedicationPackage, self).elementProperties() + js.extend([ + ("container", "container", codeableconcept.CodeableConcept, False, None, False), + ("content", "content", MedicationPackageContent, True, None, False), + ]) + return js + + +class MedicationPackageContent(backboneelement.BackboneElement): + """ What is in the package. + + A set of components that go to make up the described item. + """ + + resource_name = "MedicationPackageContent" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.amount = None + """ Quantity present in the package. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + self.item = None + """ A product in the package. + Type `FHIRReference` referencing `Medication` (represented as `dict` in JSON). """ + + super(MedicationPackageContent, self).__init__(jsondict) + + def elementProperties(self): + js = super(MedicationPackageContent, self).elementProperties() + js.extend([ + ("amount", "amount", quantity.Quantity, False, None, False), + ("item", "item", fhirreference.FHIRReference, False, None, True), + ]) + return js + + +class MedicationProduct(backboneelement.BackboneElement): + """ Administrable medication details. + + Information that only applies to products (not packages). + """ + + resource_name = "MedicationProduct" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.batch = None + """ None. + List of `MedicationProductBatch` items (represented as `dict` in JSON). """ + + self.form = None + """ powder | tablets | carton +. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.ingredient = None + """ Active or inactive ingredient. + List of `MedicationProductIngredient` items (represented as `dict` in JSON). """ + + super(MedicationProduct, self).__init__(jsondict) + + def elementProperties(self): + js = super(MedicationProduct, self).elementProperties() + js.extend([ + ("batch", "batch", MedicationProductBatch, True, None, False), + ("form", "form", codeableconcept.CodeableConcept, False, None, False), + ("ingredient", "ingredient", MedicationProductIngredient, True, None, False), + ]) + return js + + +class MedicationProductBatch(backboneelement.BackboneElement): + """ None. + + Information about a group of medication produced or packaged from one + production run. + """ + + resource_name = "MedicationProductBatch" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.expirationDate = None + """ None. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.lotNumber = None + """ None. + Type `str`. """ + + super(MedicationProductBatch, self).__init__(jsondict) + + def elementProperties(self): + js = super(MedicationProductBatch, self).elementProperties() + js.extend([ + ("expirationDate", "expirationDate", fhirdate.FHIRDate, False, None, False), + ("lotNumber", "lotNumber", str, False, None, False), + ]) + return js + + +class MedicationProductIngredient(backboneelement.BackboneElement): + """ Active or inactive ingredient. + + Identifies a particular constituent of interest in the product. + """ + + resource_name = "MedicationProductIngredient" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.amount = None + """ Quantity of ingredient present. + Type `Ratio` (represented as `dict` in JSON). """ + + self.item = None + """ The product contained. + Type `FHIRReference` referencing `Substance, Medication` (represented as `dict` in JSON). """ + + super(MedicationProductIngredient, self).__init__(jsondict) + + def elementProperties(self): + js = super(MedicationProductIngredient, self).elementProperties() + js.extend([ + ("amount", "amount", ratio.Ratio, False, None, False), + ("item", "item", fhirreference.FHIRReference, False, None, True), + ]) + return js + + +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import quantity +from . import ratio diff --git a/fhirclient/models/DSTU2/medication_tests.py b/fhirclient/models/DSTU2/medication_tests.py new file mode 100644 index 000000000..104a1e15a --- /dev/null +++ b/fhirclient/models/DSTU2/medication_tests.py @@ -0,0 +1,208 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import medication +from .fhirdate import FHIRDate + + +class MedicationTests(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("Medication", js["resourceType"]) + return medication.Medication(js) + + def testMedication1(self): + inst = self.instantiate_from("medication-example-f005-enalapril.json") + self.assertIsNotNone(inst, "Must have instantiated a Medication instance") + self.implMedication1(inst) + + js = inst.as_json() + self.assertEqual("Medication", js["resourceType"]) + inst2 = medication.Medication(js) + self.implMedication1(inst2) + + def implMedication1(self, inst): + self.assertEqual(inst.code.coding[0].code, "318851002") + self.assertEqual(inst.code.coding[0].display, "Enalapril maleate 5mg tablet") + self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.id, "f005") + self.assertTrue(inst.isBrand) + self.assertEqual(inst.package.container.coding[0].code, "398124009") + self.assertEqual(inst.package.container.coding[0].display, "drug container") + self.assertEqual(inst.package.container.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.text.status, "generated") + + def testMedication2(self): + inst = self.instantiate_from("medication-example-f001-combivent.json") + self.assertIsNotNone(inst, "Must have instantiated a Medication instance") + self.implMedication2(inst) + + js = inst.as_json() + self.assertEqual("Medication", js["resourceType"]) + inst2 = medication.Medication(js) + self.implMedication2(inst2) + + def implMedication2(self, inst): + self.assertEqual(inst.code.coding[0].code, "320442002") + self.assertEqual(inst.code.coding[0].display, "Salbutamol+ipratropium bromide 100micrograms/20micrograms inhaler") + self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.id, "f001") + self.assertTrue(inst.isBrand) + self.assertEqual(inst.product.form.coding[0].code, "420317006") + self.assertEqual(inst.product.form.coding[0].display, "Inhaler (qualifier value)") + self.assertEqual(inst.product.form.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.product.ingredient[0].amount.denominator.value, 1) + self.assertEqual(inst.product.ingredient[0].amount.numerator.code, "ml") + self.assertEqual(inst.product.ingredient[0].amount.numerator.system, "http://unitsofmeasure.org") + self.assertEqual(inst.product.ingredient[0].amount.numerator.unit, "ml") + self.assertEqual(inst.product.ingredient[0].amount.numerator.value, 100) + self.assertEqual(inst.text.status, "generated") + + def testMedication3(self): + inst = self.instantiate_from("medication-example-f003-tolbutamide.json") + self.assertIsNotNone(inst, "Must have instantiated a Medication instance") + self.implMedication3(inst) + + js = inst.as_json() + self.assertEqual("Medication", js["resourceType"]) + inst2 = medication.Medication(js) + self.implMedication3(inst2) + + def implMedication3(self, inst): + self.assertEqual(inst.code.coding[0].code, "325267004") + self.assertEqual(inst.code.coding[0].display, "Tolbutamide 500mg tablet") + self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.id, "f003") + self.assertTrue(inst.isBrand) + self.assertEqual(inst.package.container.coding[0].code, "398124009") + self.assertEqual(inst.package.container.coding[0].display, "drug container") + self.assertEqual(inst.package.container.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.text.status, "generated") + + def testMedication4(self): + inst = self.instantiate_from("medication-example-f002-crestor.json") + self.assertIsNotNone(inst, "Must have instantiated a Medication instance") + self.implMedication4(inst) + + js = inst.as_json() + self.assertEqual("Medication", js["resourceType"]) + inst2 = medication.Medication(js) + self.implMedication4(inst2) + + def implMedication4(self, inst): + self.assertEqual(inst.code.coding[0].code, "408036003") + self.assertEqual(inst.code.coding[0].display, "Rosuvastatin 10mg tablet") + self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.id, "f002") + self.assertTrue(inst.isBrand) + self.assertEqual(inst.package.container.coding[0].code, "398124009") + self.assertEqual(inst.package.container.coding[0].display, "drug container") + self.assertEqual(inst.package.container.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.text.status, "generated") + + def testMedication5(self): + inst = self.instantiate_from("medication-example-f004-metoprolol.json") + self.assertIsNotNone(inst, "Must have instantiated a Medication instance") + self.implMedication5(inst) + + js = inst.as_json() + self.assertEqual("Medication", js["resourceType"]) + inst2 = medication.Medication(js) + self.implMedication5(inst2) + + def implMedication5(self, inst): + self.assertEqual(inst.code.coding[0].code, "318475005") + self.assertEqual(inst.code.coding[0].display, "Metoprolol tartrate 50mg tablet") + self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.id, "f004") + self.assertTrue(inst.isBrand) + self.assertEqual(inst.package.container.coding[0].code, "398124009") + self.assertEqual(inst.package.container.coding[0].display, "drug container") + self.assertEqual(inst.package.container.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.text.status, "generated") + + def testMedication6(self): + inst = self.instantiate_from("medication-example-f201-salmeterol.json") + self.assertIsNotNone(inst, "Must have instantiated a Medication instance") + self.implMedication6(inst) + + js = inst.as_json() + self.assertEqual("Medication", js["resourceType"]) + inst2 = medication.Medication(js) + self.implMedication6(inst2) + + def implMedication6(self, inst): + self.assertEqual(inst.code.coding[0].code, "411106009") + self.assertEqual(inst.code.coding[0].display, "25ug Flutacisone + 250ug Salmeterol") + self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.id, "f201") + self.assertFalse(inst.isBrand) + self.assertEqual(inst.product.form.coding[0].code, "421606006") + self.assertEqual(inst.product.form.coding[0].display, "Aerosol spray") + self.assertEqual(inst.product.form.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.product.ingredient[0].amount.denominator.code, "PUFF") + self.assertEqual(inst.product.ingredient[0].amount.denominator.system, "http://hl7.org/fhir/v3/orderableDrugForm") + self.assertEqual(inst.product.ingredient[0].amount.denominator.value, 1) + self.assertEqual(inst.product.ingredient[0].amount.numerator.code, "ug") + self.assertEqual(inst.product.ingredient[0].amount.numerator.system, "http://unitsofmeasure.org") + self.assertEqual(inst.product.ingredient[0].amount.numerator.value, 25) + self.assertEqual(inst.product.ingredient[1].amount.denominator.code, "PUFF") + self.assertEqual(inst.product.ingredient[1].amount.denominator.system, "http://hl7.org/fhir/v3/orderableDrugForm") + self.assertEqual(inst.product.ingredient[1].amount.denominator.value, 1) + self.assertEqual(inst.product.ingredient[1].amount.numerator.code, "ug") + self.assertEqual(inst.product.ingredient[1].amount.numerator.system, "http://unitsofmeasure.org") + self.assertEqual(inst.product.ingredient[1].amount.numerator.value, 250) + self.assertEqual(inst.text.status, "generated") + + def testMedication7(self): + inst = self.instantiate_from("medication-example-f203-paracetamol.json") + self.assertIsNotNone(inst, "Must have instantiated a Medication instance") + self.implMedication7(inst) + + js = inst.as_json() + self.assertEqual("Medication", js["resourceType"]) + inst2 = medication.Medication(js) + self.implMedication7(inst2) + + def implMedication7(self, inst): + self.assertEqual(inst.code.coding[0].code, "387517004") + self.assertEqual(inst.code.coding[0].display, "Paracetamol") + self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.id, "f203") + self.assertFalse(inst.isBrand) + self.assertEqual(inst.product.form.coding[0].code, "385055001") + self.assertEqual(inst.product.form.coding[0].display, "Tablet") + self.assertEqual(inst.product.form.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.text.status, "generated") + + def testMedication8(self): + inst = self.instantiate_from("medication-example-f202-flucloxacilline.json") + self.assertIsNotNone(inst, "Must have instantiated a Medication instance") + self.implMedication8(inst) + + js = inst.as_json() + self.assertEqual("Medication", js["resourceType"]) + inst2 = medication.Medication(js) + self.implMedication8(inst2) + + def implMedication8(self, inst): + self.assertEqual(inst.code.coding[0].code, "387544009") + self.assertEqual(inst.code.coding[0].display, "Flucloxacillin") + self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.id, "f202") + self.assertFalse(inst.isBrand) + self.assertEqual(inst.product.form.coding[0].code, "385218009") + self.assertEqual(inst.product.form.coding[0].display, "Injection") + self.assertEqual(inst.product.form.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/medicationadministration.py b/fhirclient/models/DSTU2/medicationadministration.py new file mode 100644 index 000000000..9802c16f5 --- /dev/null +++ b/fhirclient/models/DSTU2/medicationadministration.py @@ -0,0 +1,186 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/MedicationAdministration) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class MedicationAdministration(domainresource.DomainResource): + """ Administration of medication to a patient. + + Describes the event of a patient consuming or otherwise being administered + a medication. This may be as simple as swallowing a tablet or it may be a + long running infusion. Related resources tie this event to the authorizing + prescription, and the specific encounter between patient and health care + practitioner. + """ + + resource_name = "MedicationAdministration" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.device = None + """ Device used to administer. + List of `FHIRReference` items referencing `Device` (represented as `dict` in JSON). """ + + self.dosage = None + """ Details of how medication was taken. + Type `MedicationAdministrationDosage` (represented as `dict` in JSON). """ + + self.effectiveTimeDateTime = None + """ Start and end time of administration. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.effectiveTimePeriod = None + """ Start and end time of administration. + Type `Period` (represented as `dict` in JSON). """ + + self.encounter = None + """ Encounter administered as part of. + Type `FHIRReference` referencing `Encounter` (represented as `dict` in JSON). """ + + self.identifier = None + """ External identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + 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.note = None + """ Information about the administration. + Type `str`. """ + + self.patient = None + """ Who received medication. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.practitioner = None + """ Who administered substance. + Type `FHIRReference` referencing `Practitioner, Patient, RelatedPerson` (represented as `dict` in JSON). """ + + self.prescription = None + """ Order administration performed against. + Type `FHIRReference` referencing `MedicationOrder` (represented as `dict` in JSON). """ + + self.reasonGiven = 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.status = None + """ in-progress | on-hold | completed | entered-in-error | stopped. + Type `str`. """ + + self.wasNotGiven = None + """ True if medication not administered. + Type `bool`. """ + + super(MedicationAdministration, self).__init__(jsondict) + + def elementProperties(self): + js = super(MedicationAdministration, self).elementProperties() + js.extend([ + ("device", "device", fhirreference.FHIRReference, True, None, False), + ("dosage", "dosage", MedicationAdministrationDosage, False, None, False), + ("effectiveTimeDateTime", "effectiveTimeDateTime", fhirdate.FHIRDate, False, "effectiveTime", True), + ("effectiveTimePeriod", "effectiveTimePeriod", period.Period, False, "effectiveTime", True), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("medicationCodeableConcept", "medicationCodeableConcept", codeableconcept.CodeableConcept, False, "medication", True), + ("medicationReference", "medicationReference", fhirreference.FHIRReference, False, "medication", True), + ("note", "note", str, False, None, False), + ("patient", "patient", fhirreference.FHIRReference, False, None, True), + ("practitioner", "practitioner", fhirreference.FHIRReference, False, None, False), + ("prescription", "prescription", fhirreference.FHIRReference, False, None, False), + ("reasonGiven", "reasonGiven", codeableconcept.CodeableConcept, True, None, False), + ("reasonNotGiven", "reasonNotGiven", codeableconcept.CodeableConcept, True, None, False), + ("status", "status", str, False, None, True), + ("wasNotGiven", "wasNotGiven", bool, False, None, False), + ]) + return js + + +from . import backboneelement + +class MedicationAdministrationDosage(backboneelement.BackboneElement): + """ Details of how medication was taken. + + Describes the medication dosage information details e.g. dose, rate, site, + route, etc. + """ + + resource_name = "MedicationAdministrationDosage" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.method = None + """ How drug was administered. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.quantity = None + """ Amount administered in one dose. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + self.rateRange = None + """ Dose quantity per unit of time. + Type `Range` (represented as `dict` in JSON). """ + + self.rateRatio = None + """ Dose quantity per unit of time. + Type `Ratio` (represented as `dict` in JSON). """ + + self.route = None + """ Path of substance into body. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.siteCodeableConcept = None + """ Body site administered to. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.siteReference = None + """ Body site administered to. + Type `FHIRReference` referencing `BodySite` (represented as `dict` in JSON). """ + + self.text = None + """ Dosage Instructions. + Type `str`. """ + + super(MedicationAdministrationDosage, self).__init__(jsondict) + + def elementProperties(self): + js = super(MedicationAdministrationDosage, self).elementProperties() + js.extend([ + ("method", "method", codeableconcept.CodeableConcept, False, None, False), + ("quantity", "quantity", quantity.Quantity, False, None, False), + ("rateRange", "rateRange", range.Range, False, "rate", False), + ("rateRatio", "rateRatio", ratio.Ratio, False, "rate", False), + ("route", "route", codeableconcept.CodeableConcept, False, None, False), + ("siteCodeableConcept", "siteCodeableConcept", codeableconcept.CodeableConcept, False, "site", False), + ("siteReference", "siteReference", fhirreference.FHIRReference, False, "site", False), + ("text", "text", str, False, None, False), + ]) + return js + + +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier +from . import period +from . import quantity +from . import range +from . import ratio diff --git a/fhirclient/models/DSTU2/medicationdispense.py b/fhirclient/models/DSTU2/medicationdispense.py new file mode 100644 index 000000000..79e8444b6 --- /dev/null +++ b/fhirclient/models/DSTU2/medicationdispense.py @@ -0,0 +1,259 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/MedicationDispense) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class MedicationDispense(domainresource.DomainResource): + """ Dispensing a medication to a named patient. + + Indicates that a medication product is to be or has been dispensed for a + named person/patient. This includes a description of the medication + product (supply) provided and the instructions for administering the + medication. The medication dispense is the result of a pharmacy system + responding to a medication order. + """ + + resource_name = "MedicationDispense" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.authorizingPrescription = None + """ Medication order that authorizes the dispense. + List of `FHIRReference` items referencing `MedicationOrder` (represented as `dict` in JSON). """ + + self.daysSupply = None + """ Days Supply. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + self.destination = None + """ Where the medication was sent. + Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + + self.dispenser = None + """ Practitioner responsible for dispensing medication. + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + self.dosageInstruction = None + """ Medicine administration instructions to the patient/caregiver. + List of `MedicationDispenseDosageInstruction` items (represented as `dict` in JSON). """ + + self.identifier = None + """ External identifier. + Type `Identifier` (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.note = None + """ Information about the dispense. + Type `str`. """ + + self.patient = None + """ Who the dispense is for. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.quantity = None + """ Amount dispensed. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + self.receiver = None + """ Who collected the medication. + List of `FHIRReference` items referencing `Patient, Practitioner` (represented as `dict` in JSON). """ + + self.status = None + """ in-progress | on-hold | completed | entered-in-error | stopped. + Type `str`. """ + + self.substitution = None + """ Deals with substitution of one medicine for another. + Type `MedicationDispenseSubstitution` (represented as `dict` in JSON). """ + + self.type = None + """ Trial fill, partial fill, emergency fill, etc.. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.whenHandedOver = None + """ When product was given out. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.whenPrepared = None + """ Dispense processing time. + Type `FHIRDate` (represented as `str` in JSON). """ + + super(MedicationDispense, self).__init__(jsondict) + + def elementProperties(self): + js = super(MedicationDispense, self).elementProperties() + js.extend([ + ("authorizingPrescription", "authorizingPrescription", fhirreference.FHIRReference, True, None, False), + ("daysSupply", "daysSupply", quantity.Quantity, False, None, False), + ("destination", "destination", fhirreference.FHIRReference, False, None, False), + ("dispenser", "dispenser", fhirreference.FHIRReference, False, None, False), + ("dosageInstruction", "dosageInstruction", MedicationDispenseDosageInstruction, True, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("medicationCodeableConcept", "medicationCodeableConcept", codeableconcept.CodeableConcept, False, "medication", True), + ("medicationReference", "medicationReference", fhirreference.FHIRReference, False, "medication", True), + ("note", "note", str, False, None, False), + ("patient", "patient", fhirreference.FHIRReference, False, None, False), + ("quantity", "quantity", quantity.Quantity, False, None, False), + ("receiver", "receiver", fhirreference.FHIRReference, True, None, False), + ("status", "status", str, False, None, False), + ("substitution", "substitution", MedicationDispenseSubstitution, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("whenHandedOver", "whenHandedOver", fhirdate.FHIRDate, False, None, False), + ("whenPrepared", "whenPrepared", fhirdate.FHIRDate, False, None, False), + ]) + return js + + +from . import backboneelement + +class MedicationDispenseDosageInstruction(backboneelement.BackboneElement): + """ Medicine administration instructions to the patient/caregiver. + + Indicates how the medication is to be used by the patient. + """ + + resource_name = "MedicationDispenseDosageInstruction" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.additionalInstructions = None + """ E.g. "Take with food". + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.asNeededBoolean = None + """ Take "as needed" f(or x). + Type `bool`. """ + + self.asNeededCodeableConcept = None + """ Take "as needed" f(or x). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.doseQuantity = None + """ Amount of medication per dose. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + self.doseRange = None + """ Amount of medication per dose. + Type `Range` (represented as `dict` in JSON). """ + + self.maxDosePerPeriod = None + """ Upper limit on medication per unit of time. + Type `Ratio` (represented as `dict` in JSON). """ + + self.method = None + """ Technique for administering medication. + Type `CodeableConcept` (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). """ + + self.siteCodeableConcept = None + """ Body site to administer to. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.siteReference = None + """ Body site to administer to. + Type `FHIRReference` referencing `BodySite` (represented as `dict` in JSON). """ + + self.text = None + """ Dosage Instructions. + Type `str`. """ + + self.timing = None + """ When medication should be administered. + Type `Timing` (represented as `dict` in JSON). """ + + super(MedicationDispenseDosageInstruction, self).__init__(jsondict) + + def elementProperties(self): + js = super(MedicationDispenseDosageInstruction, self).elementProperties() + js.extend([ + ("additionalInstructions", "additionalInstructions", codeableconcept.CodeableConcept, False, 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), + ("maxDosePerPeriod", "maxDosePerPeriod", ratio.Ratio, False, None, False), + ("method", "method", codeableconcept.CodeableConcept, False, None, False), + ("rateRange", "rateRange", range.Range, False, "rate", False), + ("rateRatio", "rateRatio", ratio.Ratio, False, "rate", False), + ("route", "route", codeableconcept.CodeableConcept, False, None, False), + ("siteCodeableConcept", "siteCodeableConcept", codeableconcept.CodeableConcept, False, "site", False), + ("siteReference", "siteReference", fhirreference.FHIRReference, False, "site", False), + ("text", "text", str, False, None, False), + ("timing", "timing", timing.Timing, False, None, False), + ]) + return js + + +class MedicationDispenseSubstitution(backboneelement.BackboneElement): + """ Deals with substitution of one medicine for another. + + 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 + cases substitution is not expected but does happen. This block explains + what substitution did or did not happen and why. + """ + + resource_name = "MedicationDispenseSubstitution" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.reason = None + """ Why was substitution made. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.responsibleParty = None + """ Who is responsible for the substitution. + List of `FHIRReference` items referencing `Practitioner` (represented as `dict` in JSON). """ + + self.type = None + """ Type of substitution. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(MedicationDispenseSubstitution, self).__init__(jsondict) + + def elementProperties(self): + js = super(MedicationDispenseSubstitution, self).elementProperties() + js.extend([ + ("reason", "reason", codeableconcept.CodeableConcept, True, None, False), + ("responsibleParty", "responsibleParty", fhirreference.FHIRReference, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier +from . import quantity +from . import range +from . import ratio +from . import timing diff --git a/fhirclient/models/DSTU2/medicationorder.py b/fhirclient/models/DSTU2/medicationorder.py new file mode 100644 index 000000000..478a63028 --- /dev/null +++ b/fhirclient/models/DSTU2/medicationorder.py @@ -0,0 +1,311 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/MedicationOrder) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class MedicationOrder(domainresource.DomainResource): + """ Prescription of medication to for patient. + + An order for both supply of the medication and the instructions for + administration of the medication to a patient. The resource is called + "MedicationOrder" rather than "MedicationPrescription" to generalize the + use across inpatient and outpatient settings as well as for care plans, + etc. + """ + + resource_name = "MedicationOrder" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.dateEnded = None + """ When prescription was stopped. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.dateWritten = None + """ When prescription was authorized. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.dispenseRequest = None + """ Medication supply authorization. + Type `MedicationOrderDispenseRequest` (represented as `dict` in JSON). """ + + self.dosageInstruction = None + """ How medication should be taken. + List of `MedicationOrderDosageInstruction` items (represented as `dict` in JSON). """ + + self.encounter = None + """ Created during encounter/admission/stay. + Type `FHIRReference` referencing `Encounter` (represented as `dict` in JSON). """ + + self.identifier = None + """ External identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.medicationCodeableConcept = None + """ Medication to be taken. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.medicationReference = None + """ Medication to be taken. + Type `FHIRReference` referencing `Medication` (represented as `dict` in JSON). """ + + self.note = None + """ Information about the prescription. + Type `str`. """ + + self.patient = None + """ Who prescription is for. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.prescriber = None + """ Who ordered the medication(s). + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + self.priorPrescription = None + """ An order/prescription that this supersedes. + Type `FHIRReference` referencing `MedicationOrder` (represented as `dict` in JSON). """ + + self.reasonCodeableConcept = None + """ Reason or indication for writing the prescription. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.reasonEnded = None + """ Why prescription was stopped. + 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). """ + + self.status = None + """ active | on-hold | completed | entered-in-error | stopped | draft. + Type `str`. """ + + self.substitution = None + """ Any restrictions on medication substitution. + Type `MedicationOrderSubstitution` (represented as `dict` in JSON). """ + + super(MedicationOrder, self).__init__(jsondict) + + def elementProperties(self): + js = super(MedicationOrder, self).elementProperties() + js.extend([ + ("dateEnded", "dateEnded", fhirdate.FHIRDate, False, None, False), + ("dateWritten", "dateWritten", fhirdate.FHIRDate, False, None, False), + ("dispenseRequest", "dispenseRequest", MedicationOrderDispenseRequest, False, None, False), + ("dosageInstruction", "dosageInstruction", MedicationOrderDosageInstruction, True, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("medicationCodeableConcept", "medicationCodeableConcept", codeableconcept.CodeableConcept, False, "medication", True), + ("medicationReference", "medicationReference", fhirreference.FHIRReference, False, "medication", True), + ("note", "note", str, False, None, False), + ("patient", "patient", fhirreference.FHIRReference, False, None, False), + ("prescriber", "prescriber", fhirreference.FHIRReference, False, None, False), + ("priorPrescription", "priorPrescription", fhirreference.FHIRReference, False, None, False), + ("reasonCodeableConcept", "reasonCodeableConcept", codeableconcept.CodeableConcept, False, "reason", False), + ("reasonEnded", "reasonEnded", codeableconcept.CodeableConcept, False, None, False), + ("reasonReference", "reasonReference", fhirreference.FHIRReference, False, "reason", False), + ("status", "status", str, False, None, False), + ("substitution", "substitution", MedicationOrderSubstitution, False, None, False), + ]) + return js + + +from . import backboneelement + +class MedicationOrderDispenseRequest(backboneelement.BackboneElement): + """ Medication supply authorization. + + Indicates the specific details for the dispense or medication supply part + of a medication order (also known as a Medication Prescription). Note that + this information is NOT always sent with the order. There may be in some + settings (e.g. hospitals) institutional or system support for completing + the dispense details in the pharmacy department. + """ + + resource_name = "MedicationOrderDispenseRequest" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.expectedSupplyDuration = None + """ Number of days supply per dispense. + Type `Quantity` referencing `Duration` (represented as `dict` in JSON). """ + + self.medicationCodeableConcept = None + """ Product to be supplied. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.medicationReference = None + """ Product to be supplied. + Type `FHIRReference` referencing `Medication` (represented as `dict` in JSON). """ + + self.numberOfRepeatsAllowed = None + """ Number of refills authorized. + Type `int`. """ + + self.quantity = None + """ Amount of medication to supply per dispense. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + self.validityPeriod = None + """ Time period supply is authorized for. + Type `Period` (represented as `dict` in JSON). """ + + super(MedicationOrderDispenseRequest, self).__init__(jsondict) + + def elementProperties(self): + js = super(MedicationOrderDispenseRequest, self).elementProperties() + js.extend([ + ("expectedSupplyDuration", "expectedSupplyDuration", quantity.Quantity, False, None, False), + ("medicationCodeableConcept", "medicationCodeableConcept", codeableconcept.CodeableConcept, False, "medication", False), + ("medicationReference", "medicationReference", fhirreference.FHIRReference, False, "medication", False), + ("numberOfRepeatsAllowed", "numberOfRepeatsAllowed", int, False, None, False), + ("quantity", "quantity", quantity.Quantity, False, None, False), + ("validityPeriod", "validityPeriod", period.Period, False, None, False), + ]) + return js + + +class MedicationOrderDosageInstruction(backboneelement.BackboneElement): + """ How medication should be taken. + + Indicates how the medication is to be used by the patient. + """ + + resource_name = "MedicationOrderDosageInstruction" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.additionalInstructions = None + """ Supplemental instructions - e.g. "with meals". + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.asNeededBoolean = None + """ Take "as needed" (for x). + Type `bool`. """ + + self.asNeededCodeableConcept = None + """ Take "as needed" (for x). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.doseQuantity = None + """ Amount of medication per dose. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + self.doseRange = None + """ Amount of medication per dose. + Type `Range` (represented as `dict` in JSON). """ + + self.maxDosePerPeriod = None + """ Upper limit on medication per unit of time. + Type `Ratio` (represented as `dict` in JSON). """ + + self.method = None + """ Technique for administering medication. + Type `CodeableConcept` (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). """ + + self.siteCodeableConcept = None + """ Body site to administer to. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.siteReference = None + """ Body site to administer to. + Type `FHIRReference` referencing `BodySite` (represented as `dict` in JSON). """ + + self.text = None + """ Dosage instructions expressed as text. + Type `str`. """ + + self.timing = None + """ When medication should be administered. + Type `Timing` (represented as `dict` in JSON). """ + + super(MedicationOrderDosageInstruction, self).__init__(jsondict) + + def elementProperties(self): + js = super(MedicationOrderDosageInstruction, self).elementProperties() + js.extend([ + ("additionalInstructions", "additionalInstructions", codeableconcept.CodeableConcept, False, 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), + ("maxDosePerPeriod", "maxDosePerPeriod", ratio.Ratio, False, None, False), + ("method", "method", codeableconcept.CodeableConcept, False, None, False), + ("rateRange", "rateRange", range.Range, False, "rate", False), + ("rateRatio", "rateRatio", ratio.Ratio, False, "rate", False), + ("route", "route", codeableconcept.CodeableConcept, False, None, False), + ("siteCodeableConcept", "siteCodeableConcept", codeableconcept.CodeableConcept, False, "site", False), + ("siteReference", "siteReference", fhirreference.FHIRReference, False, "site", False), + ("text", "text", str, False, None, False), + ("timing", "timing", timing.Timing, False, None, False), + ]) + return js + + +class MedicationOrderSubstitution(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 + substitution must not happen, and in others it does not matter. This block + explains the prescriber's intent. If nothing is specified substitution may + be done. + """ + + resource_name = "MedicationOrderSubstitution" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.reason = None + """ Why should (not) substitution be made. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.type = None + """ generic | formulary +. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(MedicationOrderSubstitution, self).__init__(jsondict) + + def elementProperties(self): + js = super(MedicationOrderSubstitution, self).elementProperties() + js.extend([ + ("reason", "reason", codeableconcept.CodeableConcept, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier +from . import period +from . import quantity +from . import range +from . import ratio +from . import timing diff --git a/fhirclient/models/DSTU2/medicationorder_tests.py b/fhirclient/models/DSTU2/medicationorder_tests.py new file mode 100644 index 000000000..b58ffb048 --- /dev/null +++ b/fhirclient/models/DSTU2/medicationorder_tests.py @@ -0,0 +1,360 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import medicationorder +from .fhirdate import FHIRDate + + +class MedicationOrderTests(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("MedicationOrder", js["resourceType"]) + return medicationorder.MedicationOrder(js) + + def testMedicationOrder1(self): + inst = self.instantiate_from("medicationorder-example-f203-paracetamol.json") + self.assertIsNotNone(inst, "Must have instantiated a MedicationOrder instance") + self.implMedicationOrder1(inst) + + js = inst.as_json() + self.assertEqual("MedicationOrder", js["resourceType"]) + inst2 = medicationorder.MedicationOrder(js) + self.implMedicationOrder1(inst2) + + def implMedicationOrder1(self, inst): + self.assertEqual(inst.dateWritten.date, FHIRDate("2013-04-04").date) + self.assertEqual(inst.dateWritten.as_json(), "2013-04-04") + self.assertEqual(inst.dosageInstruction[0].maxDosePerPeriod.denominator.code, "258702006") + self.assertEqual(inst.dosageInstruction[0].maxDosePerPeriod.denominator.system, "http://snomed.info/sct") + self.assertEqual(inst.dosageInstruction[0].maxDosePerPeriod.denominator.unit, "hours") + self.assertEqual(inst.dosageInstruction[0].maxDosePerPeriod.denominator.value, 24) + self.assertEqual(inst.dosageInstruction[0].maxDosePerPeriod.numerator.code, "258684004") + self.assertEqual(inst.dosageInstruction[0].maxDosePerPeriod.numerator.system, "http://snomed.info/sct") + self.assertEqual(inst.dosageInstruction[0].maxDosePerPeriod.numerator.unit, "milligram") + self.assertEqual(inst.dosageInstruction[0].maxDosePerPeriod.numerator.value, 3000) + self.assertEqual(inst.dosageInstruction[0].method.coding[0].code, "322236009") + self.assertEqual(inst.dosageInstruction[0].method.coding[0].display, "Paracetamol 500mg tablet") + self.assertEqual(inst.dosageInstruction[0].method.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.dosageInstruction[0].text, "Paracetamol 3xdaags 1000mg") + self.assertEqual(inst.id, "f203") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + + def testMedicationOrder2(self): + inst = self.instantiate_from("medicationorder-example-f202-flucloxacilline.json") + self.assertIsNotNone(inst, "Must have instantiated a MedicationOrder instance") + self.implMedicationOrder2(inst) + + js = inst.as_json() + self.assertEqual("MedicationOrder", js["resourceType"]) + inst2 = medicationorder.MedicationOrder(js) + self.implMedicationOrder2(inst2) + + def implMedicationOrder2(self, inst): + self.assertEqual(inst.dateWritten.date, FHIRDate("2013-03-11").date) + self.assertEqual(inst.dateWritten.as_json(), "2013-03-11") + self.assertEqual(inst.dosageInstruction[0].maxDosePerPeriod.denominator.code, "258702006") + self.assertEqual(inst.dosageInstruction[0].maxDosePerPeriod.denominator.system, "http://snomed.info/sct") + self.assertEqual(inst.dosageInstruction[0].maxDosePerPeriod.denominator.unit, "hours") + self.assertEqual(inst.dosageInstruction[0].maxDosePerPeriod.denominator.value, 24) + self.assertEqual(inst.dosageInstruction[0].maxDosePerPeriod.numerator.code, "258682000") + self.assertEqual(inst.dosageInstruction[0].maxDosePerPeriod.numerator.system, "http://snomed.info/sct") + self.assertEqual(inst.dosageInstruction[0].maxDosePerPeriod.numerator.unit, "gram") + self.assertEqual(inst.dosageInstruction[0].maxDosePerPeriod.numerator.value, 12) + self.assertEqual(inst.dosageInstruction[0].method.coding[0].code, "323493005") + self.assertEqual(inst.dosageInstruction[0].method.coding[0].display, "Injected floxacillin") + self.assertEqual(inst.dosageInstruction[0].method.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.dosageInstruction[0].route.coding[0].code, "47625008") + self.assertEqual(inst.dosageInstruction[0].route.coding[0].display, "Intravenous route") + self.assertEqual(inst.dosageInstruction[0].route.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.dosageInstruction[0].text, "Flucloxacilline 12g/24h") + self.assertEqual(inst.dosageInstruction[0].timing.repeat.boundsPeriod.end.date, FHIRDate("2013-03-21").date) + self.assertEqual(inst.dosageInstruction[0].timing.repeat.boundsPeriod.end.as_json(), "2013-03-21") + self.assertEqual(inst.dosageInstruction[0].timing.repeat.boundsPeriod.start.date, FHIRDate("2013-03-11").date) + self.assertEqual(inst.dosageInstruction[0].timing.repeat.boundsPeriod.start.as_json(), "2013-03-11") + self.assertEqual(inst.id, "f202") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.status, "generated") + + def testMedicationOrder3(self): + inst = self.instantiate_from("medicationorder-example-f005-enalapril.json") + self.assertIsNotNone(inst, "Must have instantiated a MedicationOrder instance") + self.implMedicationOrder3(inst) + + js = inst.as_json() + self.assertEqual("MedicationOrder", js["resourceType"]) + inst2 = medicationorder.MedicationOrder(js) + self.implMedicationOrder3(inst2) + + def implMedicationOrder3(self, inst): + self.assertEqual(inst.dateWritten.date, FHIRDate("2011-05-01").date) + self.assertEqual(inst.dateWritten.as_json(), "2011-05-01") + self.assertEqual(inst.dispenseRequest.quantity.code, "46992007") + self.assertEqual(inst.dispenseRequest.quantity.system, "http://snomed.info/sct") + self.assertEqual(inst.dispenseRequest.quantity.value, 28) + self.assertEqual(inst.dispenseRequest.validityPeriod.start.date, FHIRDate("2011-05-01").date) + self.assertEqual(inst.dispenseRequest.validityPeriod.start.as_json(), "2011-05-01") + self.assertEqual(inst.dosageInstruction[0].doseQuantity.code, "mg") + self.assertEqual(inst.dosageInstruction[0].doseQuantity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.dosageInstruction[0].doseQuantity.unit, "mg") + self.assertEqual(inst.dosageInstruction[0].doseQuantity.value, 5) + self.assertEqual(inst.dosageInstruction[0].route.coding[0].code, "386359008") + self.assertEqual(inst.dosageInstruction[0].route.coding[0].display, "Administration of drug or medicament via oral route") + self.assertEqual(inst.dosageInstruction[0].route.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.dosageInstruction[0].siteCodeableConcept.coding[0].code, "181220002") + self.assertEqual(inst.dosageInstruction[0].siteCodeableConcept.coding[0].display, "Entire oral cavity") + self.assertEqual(inst.dosageInstruction[0].siteCodeableConcept.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.dosageInstruction[0].timing.repeat.boundsPeriod.start.date, FHIRDate("2011-05-01").date) + self.assertEqual(inst.dosageInstruction[0].timing.repeat.boundsPeriod.start.as_json(), "2011-05-01") + self.assertEqual(inst.dosageInstruction[0].timing.repeat.frequency, 1) + self.assertEqual(inst.dosageInstruction[0].timing.repeat.period, 1) + self.assertEqual(inst.dosageInstruction[0].timing.repeat.periodUnits, "d") + self.assertEqual(inst.id, "f005") + self.assertEqual(inst.identifier[0].system, "http://www.bmc.nl/portal/prescriptions") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "order9823343") + self.assertEqual(inst.reasonCodeableConcept.coding[0].code, "38341003") + self.assertEqual(inst.reasonCodeableConcept.coding[0].display, "High blood pressure") + self.assertEqual(inst.reasonCodeableConcept.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + + def testMedicationOrder4(self): + inst = self.instantiate_from("medicationorder-example-f001-combivent.json") + self.assertIsNotNone(inst, "Must have instantiated a MedicationOrder instance") + self.implMedicationOrder4(inst) + + js = inst.as_json() + self.assertEqual("MedicationOrder", js["resourceType"]) + inst2 = medicationorder.MedicationOrder(js) + self.implMedicationOrder4(inst2) + + def implMedicationOrder4(self, inst): + self.assertEqual(inst.dateWritten.date, FHIRDate("2013-05-25T19:32:52+01:00").date) + self.assertEqual(inst.dateWritten.as_json(), "2013-05-25T19:32:52+01:00") + self.assertEqual(inst.dispenseRequest.expectedSupplyDuration.code, "d") + self.assertEqual(inst.dispenseRequest.expectedSupplyDuration.system, "urn:oid:2.16.840.1.113883.6.8") + self.assertEqual(inst.dispenseRequest.expectedSupplyDuration.unit, "days") + self.assertEqual(inst.dispenseRequest.expectedSupplyDuration.value, 40) + self.assertEqual(inst.dispenseRequest.numberOfRepeatsAllowed, 20) + self.assertEqual(inst.dispenseRequest.quantity.code, "ug") + self.assertEqual(inst.dispenseRequest.quantity.system, "urn:oid:2.16.840.1.113883.6.8") + self.assertEqual(inst.dispenseRequest.quantity.unit, "mcg") + self.assertEqual(inst.dispenseRequest.quantity.value, 100) + self.assertEqual(inst.dispenseRequest.validityPeriod.end.date, FHIRDate("2013-05-30").date) + self.assertEqual(inst.dispenseRequest.validityPeriod.end.as_json(), "2013-05-30") + self.assertEqual(inst.dispenseRequest.validityPeriod.start.date, FHIRDate("2013-04-08").date) + self.assertEqual(inst.dispenseRequest.validityPeriod.start.as_json(), "2013-04-08") + self.assertEqual(inst.dosageInstruction[0].additionalInstructions.text, "for use during pregnancy, contact physician") + self.assertEqual(inst.dosageInstruction[0].doseQuantity.code, "ml") + self.assertEqual(inst.dosageInstruction[0].doseQuantity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.dosageInstruction[0].doseQuantity.unit, "ml") + self.assertEqual(inst.dosageInstruction[0].doseQuantity.value, 10) + self.assertEqual(inst.dosageInstruction[0].route.coding[0].code, "394899003") + self.assertEqual(inst.dosageInstruction[0].route.coding[0].display, "oral administration of treatment") + self.assertEqual(inst.dosageInstruction[0].route.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.dosageInstruction[0].siteCodeableConcept.coding[0].code, "181220002") + self.assertEqual(inst.dosageInstruction[0].siteCodeableConcept.coding[0].display, "Entire oral cavity") + self.assertEqual(inst.dosageInstruction[0].siteCodeableConcept.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.dosageInstruction[0].text, "3 tot 4 maal daags 1 flacon") + self.assertEqual(inst.dosageInstruction[0].timing.repeat.boundsPeriod.end.date, FHIRDate("2013-11-05").date) + self.assertEqual(inst.dosageInstruction[0].timing.repeat.boundsPeriod.end.as_json(), "2013-11-05") + self.assertEqual(inst.dosageInstruction[0].timing.repeat.boundsPeriod.start.date, FHIRDate("2013-08-04").date) + self.assertEqual(inst.dosageInstruction[0].timing.repeat.boundsPeriod.start.as_json(), "2013-08-04") + self.assertEqual(inst.dosageInstruction[0].timing.repeat.frequency, 3) + self.assertEqual(inst.dosageInstruction[0].timing.repeat.period, 1) + self.assertEqual(inst.dosageInstruction[0].timing.repeat.periodUnits, "d") + self.assertEqual(inst.id, "f001") + self.assertEqual(inst.identifier[0].system, "http://www.bmc/portal/prescriptions") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "order9837293") + self.assertEqual(inst.reasonCodeableConcept.coding[0].code, "13645005") + self.assertEqual(inst.reasonCodeableConcept.coding[0].display, "Chronic obstructive pulmonary disease") + self.assertEqual(inst.reasonCodeableConcept.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + + def testMedicationOrder5(self): + inst = self.instantiate_from("medicationorder-example-f002-crestor.json") + self.assertIsNotNone(inst, "Must have instantiated a MedicationOrder instance") + self.implMedicationOrder5(inst) + + js = inst.as_json() + self.assertEqual("MedicationOrder", js["resourceType"]) + inst2 = medicationorder.MedicationOrder(js) + self.implMedicationOrder5(inst2) + + def implMedicationOrder5(self, inst): + self.assertEqual(inst.dateWritten.date, FHIRDate("2013-04-08").date) + self.assertEqual(inst.dateWritten.as_json(), "2013-04-08") + self.assertEqual(inst.dispenseRequest.quantity.code, "46992007") + self.assertEqual(inst.dispenseRequest.quantity.system, "http://snomed.info/sct") + self.assertEqual(inst.dispenseRequest.quantity.value, 90) + self.assertEqual(inst.dispenseRequest.validityPeriod.start.date, FHIRDate("2013-04-08").date) + self.assertEqual(inst.dispenseRequest.validityPeriod.start.as_json(), "2013-04-08") + self.assertEqual(inst.dosageInstruction[0].doseQuantity.code, "mg") + self.assertEqual(inst.dosageInstruction[0].doseQuantity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.dosageInstruction[0].doseQuantity.unit, "mg") + self.assertEqual(inst.dosageInstruction[0].doseQuantity.value, 10) + self.assertEqual(inst.dosageInstruction[0].route.coding[0].code, "386359008") + self.assertEqual(inst.dosageInstruction[0].route.coding[0].display, "Administration of drug or medicament via oral route") + self.assertEqual(inst.dosageInstruction[0].route.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.dosageInstruction[0].siteCodeableConcept.coding[0].code, "181220002") + self.assertEqual(inst.dosageInstruction[0].siteCodeableConcept.coding[0].display, "Entire oral cavity") + self.assertEqual(inst.dosageInstruction[0].siteCodeableConcept.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.dosageInstruction[0].timing.repeat.boundsPeriod.start.date, FHIRDate("2013-08-04").date) + self.assertEqual(inst.dosageInstruction[0].timing.repeat.boundsPeriod.start.as_json(), "2013-08-04") + self.assertEqual(inst.dosageInstruction[0].timing.repeat.frequency, 1) + self.assertEqual(inst.dosageInstruction[0].timing.repeat.period, 1) + self.assertEqual(inst.dosageInstruction[0].timing.repeat.periodUnits, "d") + self.assertEqual(inst.id, "f002") + self.assertEqual(inst.identifier[0].system, "http://www.bmc.nl/portal/prescriptions") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "order9837343") + self.assertEqual(inst.reasonCodeableConcept.coding[0].code, "28036006") + self.assertEqual(inst.reasonCodeableConcept.coding[0].display, "High density lipoprotein cholesterol level") + self.assertEqual(inst.reasonCodeableConcept.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + + def testMedicationOrder6(self): + inst = self.instantiate_from("medicationorder-example-f003-tolbutamide.json") + self.assertIsNotNone(inst, "Must have instantiated a MedicationOrder instance") + self.implMedicationOrder6(inst) + + js = inst.as_json() + self.assertEqual("MedicationOrder", js["resourceType"]) + inst2 = medicationorder.MedicationOrder(js) + self.implMedicationOrder6(inst2) + + def implMedicationOrder6(self, inst): + self.assertEqual(inst.dateWritten.date, FHIRDate("2011-05-01").date) + self.assertEqual(inst.dateWritten.as_json(), "2011-05-01") + self.assertEqual(inst.dispenseRequest.quantity.code, "46992007") + self.assertEqual(inst.dispenseRequest.quantity.system, "http://snomed.info/sct") + self.assertEqual(inst.dispenseRequest.quantity.value, 90) + self.assertEqual(inst.dispenseRequest.validityPeriod.start.date, FHIRDate("2011-05-01").date) + self.assertEqual(inst.dispenseRequest.validityPeriod.start.as_json(), "2011-05-01") + self.assertEqual(inst.dosageInstruction[0].doseQuantity.code, "mg") + self.assertEqual(inst.dosageInstruction[0].doseQuantity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.dosageInstruction[0].doseQuantity.unit, "mg") + self.assertEqual(inst.dosageInstruction[0].doseQuantity.value, 500) + self.assertEqual(inst.dosageInstruction[0].route.coding[0].code, "386359008") + self.assertEqual(inst.dosageInstruction[0].route.coding[0].display, "Administration of drug or medicament via oral route") + self.assertEqual(inst.dosageInstruction[0].route.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.dosageInstruction[0].siteCodeableConcept.coding[0].code, "181220002") + self.assertEqual(inst.dosageInstruction[0].siteCodeableConcept.coding[0].display, "Entire oral cavity") + self.assertEqual(inst.dosageInstruction[0].siteCodeableConcept.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.dosageInstruction[0].timing.repeat.boundsPeriod.start.date, FHIRDate("2011-05-01").date) + self.assertEqual(inst.dosageInstruction[0].timing.repeat.boundsPeriod.start.as_json(), "2011-05-01") + self.assertEqual(inst.dosageInstruction[0].timing.repeat.frequency, 3) + self.assertEqual(inst.dosageInstruction[0].timing.repeat.period, 1) + self.assertEqual(inst.dosageInstruction[0].timing.repeat.periodUnits, "d") + self.assertEqual(inst.id, "f003") + self.assertEqual(inst.identifier[0].system, "http://www.bmc.nl/portal/prescriptions") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "order9845343") + self.assertEqual(inst.reasonCodeableConcept.coding[0].code, "444780001") + self.assertEqual(inst.reasonCodeableConcept.coding[0].display, "High glucose level in blood") + self.assertEqual(inst.reasonCodeableConcept.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + + def testMedicationOrder7(self): + inst = self.instantiate_from("medicationorder-example-f004-metoprolol.json") + self.assertIsNotNone(inst, "Must have instantiated a MedicationOrder instance") + self.implMedicationOrder7(inst) + + js = inst.as_json() + self.assertEqual("MedicationOrder", js["resourceType"]) + inst2 = medicationorder.MedicationOrder(js) + self.implMedicationOrder7(inst2) + + def implMedicationOrder7(self, inst): + self.assertEqual(inst.dateWritten.date, FHIRDate("2011-05-01").date) + self.assertEqual(inst.dateWritten.as_json(), "2011-05-01") + self.assertEqual(inst.dispenseRequest.quantity.code, "46992007") + self.assertEqual(inst.dispenseRequest.quantity.system, "http://snomed.info/sct") + self.assertEqual(inst.dispenseRequest.quantity.value, 90) + self.assertEqual(inst.dispenseRequest.validityPeriod.start.date, FHIRDate("2011-05-01").date) + self.assertEqual(inst.dispenseRequest.validityPeriod.start.as_json(), "2011-05-01") + self.assertEqual(inst.dosageInstruction[0].doseQuantity.code, "mg") + self.assertEqual(inst.dosageInstruction[0].doseQuantity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.dosageInstruction[0].doseQuantity.unit, "mg") + self.assertEqual(inst.dosageInstruction[0].doseQuantity.value, 50) + self.assertEqual(inst.dosageInstruction[0].route.coding[0].code, "386359008") + self.assertEqual(inst.dosageInstruction[0].route.coding[0].display, "Administration of drug or medicament via oral route") + self.assertEqual(inst.dosageInstruction[0].route.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.dosageInstruction[0].siteCodeableConcept.coding[0].code, "181220002") + self.assertEqual(inst.dosageInstruction[0].siteCodeableConcept.coding[0].display, "Entire oral cavity") + self.assertEqual(inst.dosageInstruction[0].siteCodeableConcept.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.dosageInstruction[0].timing.repeat.boundsPeriod.start.date, FHIRDate("2011-05-01").date) + self.assertEqual(inst.dosageInstruction[0].timing.repeat.boundsPeriod.start.as_json(), "2011-05-01") + self.assertEqual(inst.dosageInstruction[0].timing.repeat.frequency, 1) + self.assertEqual(inst.dosageInstruction[0].timing.repeat.period, 1) + self.assertEqual(inst.dosageInstruction[0].timing.repeat.periodUnits, "d") + self.assertEqual(inst.id, "f004") + self.assertEqual(inst.identifier[0].system, "http://www.bmc.nl/portal/prescriptions") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "order9845343") + self.assertEqual(inst.reasonCodeableConcept.coding[0].code, "38341003") + self.assertEqual(inst.reasonCodeableConcept.coding[0].display, "High blood pressure") + self.assertEqual(inst.reasonCodeableConcept.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + + def testMedicationOrder8(self): + inst = self.instantiate_from("medicationorder-example-f201-salmeterol.json") + self.assertIsNotNone(inst, "Must have instantiated a MedicationOrder instance") + self.implMedicationOrder8(inst) + + js = inst.as_json() + self.assertEqual("MedicationOrder", js["resourceType"]) + inst2 = medicationorder.MedicationOrder(js) + self.implMedicationOrder8(inst2) + + def implMedicationOrder8(self, inst): + self.assertEqual(inst.dateWritten.date, FHIRDate("2013-03-11").date) + self.assertEqual(inst.dateWritten.as_json(), "2013-03-11") + self.assertEqual(inst.dosageInstruction[0].doseQuantity.code, "PUFF") + self.assertEqual(inst.dosageInstruction[0].doseQuantity.system, "http://hl7.org/fhir/v3/orderableDrugForm") + self.assertEqual(inst.dosageInstruction[0].doseQuantity.value, 1) + self.assertEqual(inst.dosageInstruction[0].maxDosePerPeriod.denominator.code, "259032004") + self.assertEqual(inst.dosageInstruction[0].maxDosePerPeriod.denominator.system, "http://snomed.info/sct") + self.assertEqual(inst.dosageInstruction[0].maxDosePerPeriod.denominator.unit, "daily") + self.assertEqual(inst.dosageInstruction[0].maxDosePerPeriod.denominator.value, 1) + self.assertEqual(inst.dosageInstruction[0].maxDosePerPeriod.numerator.code, "415215001") + self.assertEqual(inst.dosageInstruction[0].maxDosePerPeriod.numerator.system, "http://snomed.info/sct") + self.assertEqual(inst.dosageInstruction[0].maxDosePerPeriod.numerator.unit, "puffs") + self.assertEqual(inst.dosageInstruction[0].maxDosePerPeriod.numerator.value, 2) + self.assertEqual(inst.dosageInstruction[0].method.coding[0].code, "320276009") + self.assertEqual(inst.dosageInstruction[0].method.coding[0].display, "Salmeterol+fluticasone 25/250ug inhaler") + self.assertEqual(inst.dosageInstruction[0].method.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.dosageInstruction[0].route.coding[0].code, "321667001") + self.assertEqual(inst.dosageInstruction[0].route.coding[0].display, "Respiratory tract") + self.assertEqual(inst.dosageInstruction[0].route.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.dosageInstruction[0].siteCodeableConcept.coding[0].code, "74262004") + self.assertEqual(inst.dosageInstruction[0].siteCodeableConcept.coding[0].display, "Oral cavity") + self.assertEqual(inst.dosageInstruction[0].siteCodeableConcept.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.dosageInstruction[0].text, "aerosol 25/250ug/do 120do 2x - 1 dose - daily") + self.assertEqual(inst.dosageInstruction[0].timing.repeat.boundsPeriod.end.date, FHIRDate("2013-05-11").date) + self.assertEqual(inst.dosageInstruction[0].timing.repeat.boundsPeriod.end.as_json(), "2013-05-11") + self.assertEqual(inst.dosageInstruction[0].timing.repeat.boundsPeriod.start.date, FHIRDate("2013-03-11").date) + self.assertEqual(inst.dosageInstruction[0].timing.repeat.boundsPeriod.start.as_json(), "2013-03-11") + self.assertEqual(inst.dosageInstruction[0].timing.repeat.frequency, 2) + self.assertEqual(inst.dosageInstruction[0].timing.repeat.period, 1) + self.assertEqual(inst.dosageInstruction[0].timing.repeat.periodUnits, "d") + self.assertEqual(inst.id, "f201") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/medicationstatement.py b/fhirclient/models/DSTU2/medicationstatement.py new file mode 100644 index 000000000..68e8b47dd --- /dev/null +++ b/fhirclient/models/DSTU2/medicationstatement.py @@ -0,0 +1,228 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/MedicationStatement) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class MedicationStatement(domainresource.DomainResource): + """ Record of medication being taken by a patient. + + 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 + 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 e.g. the patient's memory, from a prescription + bottle, or from a list of medications the patient, clinician or other + party maintains The primary difference between a medication statement and + a medication administration is that the medication administration has + complete administration information and is based on actual administration + information from the person who administered the medication. A medication + statement is often, if not always, less specific. There is no required + date/time when the medication was administered, in fact we only know that a + source has reported the patient is taking this medication, where details + such as time, quantity, or rate or even medication product may be + incomplete or missing or less precise. As stated earlier, the medication + statement information may come from the patient's memory, from a + prescription bottle or from a list of medications the patient, clinician or + other party maintains. Medication administration is more formal and is not + missing detailed information. + """ + + resource_name = "MedicationStatement" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.dateAsserted = None + """ When the statement was asserted?. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.dosage = None + """ Details of how medication was taken. + List of `MedicationStatementDosage` items (represented as `dict` in JSON). """ + + self.effectiveDateTime = None + """ Over what period was medication consumed?. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.effectivePeriod = None + """ Over what period was medication consumed?. + Type `Period` (represented as `dict` in JSON). """ + + self.identifier = None + """ External identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.informationSource = None + """ None. + Type `FHIRReference` referencing `Patient, Practitioner, RelatedPerson` (represented as `dict` in JSON). """ + + self.medicationCodeableConcept = None + """ What medication was taken. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.medicationReference = None + """ What medication was taken. + Type `FHIRReference` referencing `Medication` (represented as `dict` in JSON). """ + + self.note = None + """ Further information about the statement. + Type `str`. """ + + self.patient = None + """ Who is/was taking the medication. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.reasonForUseCodeableConcept = None + """ None. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.reasonForUseReference = None + """ None. + Type `FHIRReference` referencing `Condition` (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.status = None + """ active | completed | entered-in-error | intended. + Type `str`. """ + + self.supportingInformation = None + """ Additional supporting information. + List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + + self.wasNotTaken = None + """ True if medication is/was not being taken. + Type `bool`. """ + + super(MedicationStatement, self).__init__(jsondict) + + def elementProperties(self): + js = super(MedicationStatement, self).elementProperties() + js.extend([ + ("dateAsserted", "dateAsserted", fhirdate.FHIRDate, False, None, False), + ("dosage", "dosage", MedicationStatementDosage, True, None, False), + ("effectiveDateTime", "effectiveDateTime", fhirdate.FHIRDate, False, "effective", False), + ("effectivePeriod", "effectivePeriod", period.Period, False, "effective", False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("informationSource", "informationSource", fhirreference.FHIRReference, False, None, False), + ("medicationCodeableConcept", "medicationCodeableConcept", codeableconcept.CodeableConcept, False, "medication", True), + ("medicationReference", "medicationReference", fhirreference.FHIRReference, False, "medication", True), + ("note", "note", str, False, None, False), + ("patient", "patient", fhirreference.FHIRReference, False, None, True), + ("reasonForUseCodeableConcept", "reasonForUseCodeableConcept", codeableconcept.CodeableConcept, False, "reasonForUse", False), + ("reasonForUseReference", "reasonForUseReference", fhirreference.FHIRReference, False, "reasonForUse", False), + ("reasonNotTaken", "reasonNotTaken", codeableconcept.CodeableConcept, True, None, False), + ("status", "status", str, False, None, True), + ("supportingInformation", "supportingInformation", fhirreference.FHIRReference, True, None, False), + ("wasNotTaken", "wasNotTaken", bool, False, None, False), + ]) + return js + + +from . import backboneelement + +class MedicationStatementDosage(backboneelement.BackboneElement): + """ Details of how medication was taken. + + Indicates how the medication is/was used by the patient. + """ + + resource_name = "MedicationStatementDosage" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.asNeededBoolean = None + """ Take "as needed" (for x). + Type `bool`. """ + + self.asNeededCodeableConcept = None + """ Take "as needed" (for x). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.maxDosePerPeriod = None + """ Maximum dose that was consumed per unit of time. + Type `Ratio` (represented as `dict` in JSON). """ + + self.method = None + """ Technique used to administer medication. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.quantityQuantity = None + """ Amount administered in one dose. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + self.quantityRange = None + """ Amount administered in one dose. + Type `Range` (represented as `dict` in JSON). """ + + self.rateRange = None + """ Dose quantity per unit of time. + Type `Range` (represented as `dict` in JSON). """ + + self.rateRatio = None + """ Dose quantity per unit of time. + Type `Ratio` (represented as `dict` in JSON). """ + + self.route = None + """ How the medication entered the body. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.siteCodeableConcept = None + """ Where (on body) medication is/was administered. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.siteReference = None + """ Where (on body) medication is/was administered. + Type `FHIRReference` referencing `BodySite` (represented as `dict` in JSON). """ + + self.text = None + """ Reported dosage information. + Type `str`. """ + + self.timing = None + """ When/how often was medication taken. + Type `Timing` (represented as `dict` in JSON). """ + + super(MedicationStatementDosage, self).__init__(jsondict) + + def elementProperties(self): + js = super(MedicationStatementDosage, self).elementProperties() + js.extend([ + ("asNeededBoolean", "asNeededBoolean", bool, False, "asNeeded", False), + ("asNeededCodeableConcept", "asNeededCodeableConcept", codeableconcept.CodeableConcept, False, "asNeeded", False), + ("maxDosePerPeriod", "maxDosePerPeriod", ratio.Ratio, False, None, False), + ("method", "method", codeableconcept.CodeableConcept, False, None, False), + ("quantityQuantity", "quantityQuantity", quantity.Quantity, False, "quantity", False), + ("quantityRange", "quantityRange", range.Range, False, "quantity", False), + ("rateRange", "rateRange", range.Range, False, "rate", False), + ("rateRatio", "rateRatio", ratio.Ratio, False, "rate", False), + ("route", "route", codeableconcept.CodeableConcept, False, None, False), + ("siteCodeableConcept", "siteCodeableConcept", codeableconcept.CodeableConcept, False, "site", False), + ("siteReference", "siteReference", fhirreference.FHIRReference, False, "site", False), + ("text", "text", str, False, None, False), + ("timing", "timing", timing.Timing, False, None, False), + ]) + return js + + +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier +from . import period +from . import quantity +from . import range +from . import ratio +from . import timing diff --git a/fhirclient/models/DSTU2/messageheader.py b/fhirclient/models/DSTU2/messageheader.py new file mode 100644 index 000000000..5a9ac8f9f --- /dev/null +++ b/fhirclient/models/DSTU2/messageheader.py @@ -0,0 +1,215 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/MessageHeader) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class MessageHeader(domainresource.DomainResource): + """ A resource that describes a message that is exchanged between systems. + + The header for a message exchange that is either requesting or responding + to an action. The reference(s) that are the subject of the action as well + as other information related to the action are typically transmitted in a + bundle in which the MessageHeader resource instance is the first resource + in the bundle. + """ + + resource_name = "MessageHeader" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.author = None + """ The source of the decision. + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + self.data = None + """ The actual content of the message. + List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + + self.destination = None + """ Message Destination Application(s). + List of `MessageHeaderDestination` items (represented as `dict` in JSON). """ + + self.enterer = None + """ The source of the data entry. + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + self.event = None + """ Code for the event this message represents. + Type `Coding` (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). """ + + 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) + + def elementProperties(self): + js = super(MessageHeader, self).elementProperties() + js.extend([ + ("author", "author", fhirreference.FHIRReference, False, None, False), + ("data", "data", fhirreference.FHIRReference, True, None, False), + ("destination", "destination", MessageHeaderDestination, True, None, False), + ("enterer", "enterer", fhirreference.FHIRReference, False, None, False), + ("event", "event", coding.Coding, False, None, True), + ("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), + ("source", "source", MessageHeaderSource, False, None, True), + ("timestamp", "timestamp", fhirdate.FHIRDate, False, None, True), + ]) + return js + + +from . import backboneelement + +class MessageHeaderDestination(backboneelement.BackboneElement): + """ Message Destination Application(s). + + The destination application which the message is intended for. + """ + + resource_name = "MessageHeaderDestination" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.endpoint = None + """ Actual destination address or id. + Type `str`. """ + + self.name = None + """ Name of system. + Type `str`. """ + + self.target = None + """ Particular delivery destination within the destination. + Type `FHIRReference` referencing `Device` (represented as `dict` in JSON). """ + + super(MessageHeaderDestination, self).__init__(jsondict) + + def elementProperties(self): + js = super(MessageHeaderDestination, self).elementProperties() + js.extend([ + ("endpoint", "endpoint", str, False, None, True), + ("name", "name", str, False, None, False), + ("target", "target", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +class MessageHeaderResponse(backboneelement.BackboneElement): + """ If this is a reply to prior message. + + Information about the message that this message is a response to. Only + present if this message is a response. + """ + + resource_name = "MessageHeaderResponse" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.code = None + """ ok | transient-error | fatal-error. + Type `str`. """ + + self.details = None + """ Specific list of hints/warnings/errors. + Type `FHIRReference` referencing `OperationOutcome` (represented as `dict` in JSON). """ + + self.identifier = None + """ Id of original message. + Type `str`. """ + + super(MessageHeaderResponse, self).__init__(jsondict) + + def elementProperties(self): + js = super(MessageHeaderResponse, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("details", "details", fhirreference.FHIRReference, False, None, False), + ("identifier", "identifier", str, False, None, True), + ]) + return js + + +class MessageHeaderSource(backboneelement.BackboneElement): + """ Message Source Application. + + The source application from which this message originated. + """ + + resource_name = "MessageHeaderSource" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.contact = None + """ Human contact for problems. + Type `ContactPoint` (represented as `dict` in JSON). """ + + self.endpoint = None + """ Actual message source address or id. + Type `str`. """ + + self.name = None + """ Name of system. + Type `str`. """ + + self.software = None + """ Name of software running the system. + Type `str`. """ + + self.version = None + """ Version of software running. + Type `str`. """ + + super(MessageHeaderSource, self).__init__(jsondict) + + def elementProperties(self): + js = super(MessageHeaderSource, self).elementProperties() + js.extend([ + ("contact", "contact", contactpoint.ContactPoint, False, None, False), + ("endpoint", "endpoint", str, False, None, True), + ("name", "name", str, False, None, False), + ("software", "software", str, False, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + +from . import codeableconcept +from . import coding +from . import contactpoint +from . import fhirdate +from . import fhirreference diff --git a/fhirclient/models/DSTU2/messageheader_tests.py b/fhirclient/models/DSTU2/messageheader_tests.py new file mode 100644 index 000000000..ac7b4c6f2 --- /dev/null +++ b/fhirclient/models/DSTU2/messageheader_tests.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import messageheader +from .fhirdate import FHIRDate + + +class MessageHeaderTests(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("MessageHeader", js["resourceType"]) + return messageheader.MessageHeader(js) + + def testMessageHeader1(self): + inst = self.instantiate_from("messageheader-example.json") + self.assertIsNotNone(inst, "Must have instantiated a MessageHeader instance") + self.implMessageHeader1(inst) + + js = inst.as_json() + self.assertEqual("MessageHeader", js["resourceType"]) + inst2 = messageheader.MessageHeader(js) + self.implMessageHeader1(inst2) + + def implMessageHeader1(self, inst): + 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-update") + self.assertEqual(inst.event.system, "http://hl7.org/fhir/message-type") + self.assertEqual(inst.id, "1cbdfb97-5859-48a4-8301-d54eab818d68") + 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.response.code, "ok") + self.assertEqual(inst.response.identifier, "5015fe84-8e76-4526-89d8-44b322e8d4fb") + self.assertEqual(inst.source.contact.system, "phone") + self.assertEqual(inst.source.contact.value, "+1 (555) 123 4567") + self.assertEqual(inst.source.endpoint, "llp:10.11.12.13:5432") + self.assertEqual(inst.source.name, "Acme Central Patient Registry") + 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/DSTU2/meta.py b/fhirclient/models/DSTU2/meta.py new file mode 100644 index 000000000..2c479747b --- /dev/null +++ b/fhirclient/models/DSTU2/meta.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Meta) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +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. + """ + + resource_name = "Meta" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.lastUpdated = None + """ When the resource version last changed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.profile = None + """ Profiles this resource claims to conform to. + List of `str` items. """ + + self.security = None + """ Security Labels applied to this resource. + List of `Coding` items (represented as `dict` in JSON). """ + + self.tag = None + """ Tags applied to this resource. + List of `Coding` items (represented as `dict` in JSON). """ + + self.versionId = None + """ Version specific identifier. + Type `str`. """ + + super(Meta, self).__init__(jsondict) + + def elementProperties(self): + js = super(Meta, self).elementProperties() + js.extend([ + ("lastUpdated", "lastUpdated", fhirdate.FHIRDate, False, None, False), + ("profile", "profile", str, True, None, False), + ("security", "security", coding.Coding, True, None, False), + ("tag", "tag", coding.Coding, True, None, False), + ("versionId", "versionId", str, False, None, False), + ]) + return js + + +from . import coding +from . import fhirdate diff --git a/fhirclient/models/DSTU2/money.py b/fhirclient/models/DSTU2/money.py new file mode 100644 index 000000000..f266fc34e --- /dev/null +++ b/fhirclient/models/DSTU2/money.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Money) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import quantity + +class Money(quantity.Quantity): + """ An amount of money. With regard to precision, see [Decimal + Precision](datatypes.html#precision). + + There SHALL be a code if there is a value and it SHALL be an expression of + currency. If system is present, it SHALL be ISO 4217 (system = + "urn:iso:std:iso:4217" - currency). + """ + + resource_name = "Money" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + super(Money, self).__init__(jsondict) + + diff --git a/fhirclient/models/DSTU2/namingsystem.py b/fhirclient/models/DSTU2/namingsystem.py new file mode 100644 index 000000000..da082f74f --- /dev/null +++ b/fhirclient/models/DSTU2/namingsystem.py @@ -0,0 +1,177 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/NamingSystem) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class NamingSystem(domainresource.DomainResource): + """ System of unique identification. + + A curated namespace that issues unique symbols within that namespace for + the identification of concepts, people, devices, etc. Represents a + "System" used within the Identifier and Coding data types. + """ + + resource_name = "NamingSystem" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.contact = None + """ Contact details of the publisher. + List of `NamingSystemContact` items (represented as `dict` in JSON). """ + + self.date = None + """ Publication Date(/time). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ What does naming system identify?. + Type `str`. """ + + self.kind = None + """ codesystem | identifier | root. + Type `str`. """ + + self.name = None + """ Human-readable label. + Type `str`. """ + + self.publisher = None + """ 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`. """ + + self.status = None + """ draft | active | retired. + Type `str`. """ + + self.type = None + """ e.g. driver, provider, patient, bank etc.. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.uniqueId = None + """ Unique identifiers used for system. + List of `NamingSystemUniqueId` items (represented as `dict` in JSON). """ + + self.usage = None + """ How/where is it used. + Type `str`. """ + + self.useContext = None + """ Content intends to support these contexts. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(NamingSystem, self).__init__(jsondict) + + def elementProperties(self): + js = super(NamingSystem, self).elementProperties() + js.extend([ + ("contact", "contact", NamingSystemContact, True, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, True), + ("description", "description", str, False, None, False), + ("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), + ("uniqueId", "uniqueId", NamingSystemUniqueId, True, None, True), + ("usage", "usage", str, False, None, False), + ("useContext", "useContext", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +from . import backboneelement + +class NamingSystemContact(backboneelement.BackboneElement): + """ Contact details of the publisher. + + Contacts to assist a user in finding and communicating with the publisher. + """ + + resource_name = "NamingSystemContact" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.name = None + """ Name of a individual to contact. + Type `str`. """ + + self.telecom = None + """ Contact details for individual or publisher. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(NamingSystemContact, self).__init__(jsondict) + + def elementProperties(self): + js = super(NamingSystemContact, self).elementProperties() + js.extend([ + ("name", "name", str, False, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ]) + return js + + +class NamingSystemUniqueId(backboneelement.BackboneElement): + """ Unique identifiers used for system. + + Indicates how the system may be identified when referenced in electronic + exchange. + """ + + resource_name = "NamingSystemUniqueId" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.period = None + """ When is identifier valid?. + Type `Period` (represented as `dict` in JSON). """ + + self.preferred = None + """ Is this the id that should be used for this type. + Type `bool`. """ + + self.type = None + """ oid | uuid | uri | other. + Type `str`. """ + + self.value = None + """ The unique identifier. + Type `str`. """ + + super(NamingSystemUniqueId, self).__init__(jsondict) + + def elementProperties(self): + js = super(NamingSystemUniqueId, self).elementProperties() + js.extend([ + ("period", "period", period.Period, False, None, False), + ("preferred", "preferred", bool, False, None, False), + ("type", "type", str, False, None, True), + ("value", "value", str, False, None, True), + ]) + return js + + +from . import codeableconcept +from . import contactpoint +from . import fhirdate +from . import fhirreference +from . import period diff --git a/fhirclient/models/DSTU2/namingsystem_tests.py b/fhirclient/models/DSTU2/namingsystem_tests.py new file mode 100644 index 000000000..d6d042c22 --- /dev/null +++ b/fhirclient/models/DSTU2/namingsystem_tests.py @@ -0,0 +1,114 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import namingsystem +from .fhirdate import FHIRDate + + +class NamingSystemTests(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("NamingSystem", js["resourceType"]) + return namingsystem.NamingSystem(js) + + def testNamingSystem1(self): + inst = self.instantiate_from("namingsystem-example-id.json") + self.assertIsNotNone(inst, "Must have instantiated a NamingSystem instance") + self.implNamingSystem1(inst) + + js = inst.as_json() + self.assertEqual("NamingSystem", js["resourceType"]) + inst2 = namingsystem.NamingSystem(js) + self.implNamingSystem1(inst2) + + def implNamingSystem1(self, inst): + self.assertEqual(inst.contact[0].name, "HL7 Australia FHIR Team") + self.assertEqual(inst.contact[0].telecom[0].system, "other") + 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.id, "example-id") + self.assertEqual(inst.kind, "identifier") + 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") + self.assertEqual(inst.status, "active") + 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.text, "IHI") + self.assertEqual(inst.uniqueId[0].type, "oid") + self.assertEqual(inst.uniqueId[0].value, "1.2.36.1.2001.1003.0") + self.assertEqual(inst.uniqueId[1].period.start.date, FHIRDate("2015-08-21").date) + self.assertEqual(inst.uniqueId[1].period.start.as_json(), "2015-08-21") + self.assertTrue(inst.uniqueId[1].preferred) + self.assertEqual(inst.uniqueId[1].type, "uri") + self.assertEqual(inst.uniqueId[1].value, "http://ns.electronichealth.net.au/id/hi/ihi/1.0") + self.assertEqual(inst.usage, "Used in Australia for identifying patients") + self.assertEqual(inst.useContext[0].coding[0].code, "AU") + self.assertEqual(inst.useContext[0].coding[0].system, "urn:iso:std:iso:3166") + + def testNamingSystem2(self): + inst = self.instantiate_from("namingsystem-example-replaced.json") + self.assertIsNotNone(inst, "Must have instantiated a NamingSystem instance") + self.implNamingSystem2(inst) + + js = inst.as_json() + self.assertEqual("NamingSystem", js["resourceType"]) + inst2 = namingsystem.NamingSystem(js) + 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, "other") + self.assertEqual(inst.contact[0].telecom[0].value, "http://hl7.org/fhir") + self.assertEqual(inst.date.date, FHIRDate("2014-12-13").date) + self.assertEqual(inst.date.as_json(), "2014-12-13") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.kind, "codesystem") + self.assertEqual(inst.name, "SNOMED CT") + self.assertEqual(inst.publisher, "HL7 International on behalf of IHTSDO") + self.assertEqual(inst.responsible, "IHTSDO & affiliates") + self.assertEqual(inst.status, "active") + 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") + self.assertTrue(inst.uniqueId[1].preferred) + self.assertEqual(inst.uniqueId[1].type, "uri") + self.assertEqual(inst.uniqueId[1].value, "http://snomed.info/sct") + diff --git a/fhirclient/models/DSTU2/narrative.py b/fhirclient/models/DSTU2/narrative.py new file mode 100644 index 000000000..96fd774c9 --- /dev/null +++ b/fhirclient/models/DSTU2/narrative.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Narrative) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Narrative(element.Element): + """ A human-readable formatted text, including images. + """ + + resource_name = "Narrative" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.div = None + """ Limited xhtml content. + Type `str`. """ + + self.status = None + """ generated | extensions | additional | empty. + Type `str`. """ + + super(Narrative, self).__init__(jsondict) + + def elementProperties(self): + js = super(Narrative, self).elementProperties() + js.extend([ + ("div", "div", str, False, None, True), + ("status", "status", str, False, None, True), + ]) + return js + + diff --git a/fhirclient/models/DSTU2/nutritionorder.py b/fhirclient/models/DSTU2/nutritionorder.py new file mode 100644 index 000000000..de7112bb3 --- /dev/null +++ b/fhirclient/models/DSTU2/nutritionorder.py @@ -0,0 +1,379 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/NutritionOrder) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class NutritionOrder(domainresource.DomainResource): + """ A request for a diet, formula or nutritional supplement. + + A request to supply a diet, formula feeding (enteral) or oral nutritional + supplement to a patient/resident. + """ + + resource_name = "NutritionOrder" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + 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). """ + + self.dateTime = None + """ Date and time the nutrition order was requested. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.encounter = None + """ The encounter associated with this nutrition order. + Type `FHIRReference` referencing `Encounter` (represented as `dict` in JSON). """ + + self.enteralFormula = None + """ Enteral formula components. + Type `NutritionOrderEnteralFormula` (represented as `dict` in JSON). """ + + self.excludeFoodModifier = None + """ Order-specific modifier about the type of food that should not be + given. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.foodPreferenceModifier = None + """ Order-specific modifier about the type of food that should be given. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Identifiers assigned to this order. + List of `Identifier` 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). """ + + self.patient = None + """ The person who requires the diet, formula or nutritional supplement. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.status = None + """ proposed | draft | planned | requested | active | on-hold | + completed | cancelled. + Type `str`. """ + + self.supplement = None + """ Supplement components. + List of `NutritionOrderSupplement` items (represented as `dict` in JSON). """ + + super(NutritionOrder, self).__init__(jsondict) + + def elementProperties(self): + js = super(NutritionOrder, self).elementProperties() + js.extend([ + ("allergyIntolerance", "allergyIntolerance", fhirreference.FHIRReference, True, None, False), + ("dateTime", "dateTime", fhirdate.FHIRDate, False, None, True), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), + ("enteralFormula", "enteralFormula", NutritionOrderEnteralFormula, False, None, False), + ("excludeFoodModifier", "excludeFoodModifier", codeableconcept.CodeableConcept, True, None, False), + ("foodPreferenceModifier", "foodPreferenceModifier", codeableconcept.CodeableConcept, True, None, False), + ("identifier", "identifier", identifier.Identifier, 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), + ("supplement", "supplement", NutritionOrderSupplement, True, None, False), + ]) + return js + + +from . import backboneelement + +class NutritionOrderEnteralFormula(backboneelement.BackboneElement): + """ Enteral formula components. + + Feeding provided through the gastrointestinal tract via a tube, catheter, + or stoma that delivers nutrition distal to the oral cavity. + """ + + resource_name = "NutritionOrderEnteralFormula" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.additiveProductName = None + """ Product or brand name of the modular additive. + Type `str`. """ + + self.additiveType = None + """ Type of modular component to add to the feeding. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.administration = None + """ Formula feeding instruction as structured data. + List of `NutritionOrderEnteralFormulaAdministration` items (represented as `dict` in JSON). """ + + self.administrationInstruction = None + """ Formula feeding instructions expressed as text. + Type `str`. """ + + self.baseFormulaProductName = None + """ Product or brand name of the enteral or infant formula. + Type `str`. """ + + self.baseFormulaType = None + """ Type of enteral or infant formula. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.caloricDensity = None + """ Amount of energy per specified volume that is required. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + self.maxVolumeToDeliver = None + """ Upper limit on formula volume per unit of time. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + self.routeofAdministration = None + """ How the formula should enter the patient's gastrointestinal tract. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(NutritionOrderEnteralFormula, self).__init__(jsondict) + + def elementProperties(self): + js = super(NutritionOrderEnteralFormula, self).elementProperties() + js.extend([ + ("additiveProductName", "additiveProductName", str, False, None, False), + ("additiveType", "additiveType", codeableconcept.CodeableConcept, False, None, False), + ("administration", "administration", NutritionOrderEnteralFormulaAdministration, True, None, False), + ("administrationInstruction", "administrationInstruction", str, False, None, False), + ("baseFormulaProductName", "baseFormulaProductName", str, False, None, False), + ("baseFormulaType", "baseFormulaType", codeableconcept.CodeableConcept, False, None, False), + ("caloricDensity", "caloricDensity", quantity.Quantity, False, None, False), + ("maxVolumeToDeliver", "maxVolumeToDeliver", quantity.Quantity, False, None, False), + ("routeofAdministration", "routeofAdministration", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class NutritionOrderEnteralFormulaAdministration(backboneelement.BackboneElement): + """ Formula feeding instruction as structured data. + + Formula administration instructions as structured data. This repeating + structure allows for changing the administration rate or volume over time + for both bolus and continuous feeding. An example of this would be an + instruction to increase the rate of continuous feeding every 2 hours. + """ + + resource_name = "NutritionOrderEnteralFormulaAdministration" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.quantity = None + """ The volume of formula to provide. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + self.rateQuantity = None + """ Speed with which the formula is provided per period of time. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + self.rateRatio = None + """ Speed with which the formula is provided per period of time. + Type `Ratio` (represented as `dict` in JSON). """ + + self.schedule = None + """ Scheduled frequency of enteral feeding. + Type `Timing` (represented as `dict` in JSON). """ + + super(NutritionOrderEnteralFormulaAdministration, self).__init__(jsondict) + + def elementProperties(self): + js = super(NutritionOrderEnteralFormulaAdministration, self).elementProperties() + js.extend([ + ("quantity", "quantity", quantity.Quantity, False, None, False), + ("rateQuantity", "rateQuantity", quantity.Quantity, False, "rate", False), + ("rateRatio", "rateRatio", ratio.Ratio, False, "rate", False), + ("schedule", "schedule", timing.Timing, False, None, False), + ]) + return js + + +class NutritionOrderOralDiet(backboneelement.BackboneElement): + """ Oral diet components. + + Diet given orally in contrast to enteral (tube) feeding. + """ + + resource_name = "NutritionOrderOralDiet" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.fluidConsistencyType = None + """ The required consistency of fluids and liquids provided to the + patient. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.instruction = None + """ Instructions or additional information about the oral diet. + Type `str`. """ + + self.nutrient = None + """ Required nutrient modifications. + List of `NutritionOrderOralDietNutrient` items (represented as `dict` in JSON). """ + + self.schedule = None + """ Scheduled frequency of diet. + List of `Timing` items (represented as `dict` in JSON). """ + + self.texture = None + """ Required texture modifications. + List of `NutritionOrderOralDietTexture` items (represented as `dict` in JSON). """ + + self.type = None + """ Type of oral diet or diet restrictions that describe what can be + consumed orally. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(NutritionOrderOralDiet, self).__init__(jsondict) + + def elementProperties(self): + js = super(NutritionOrderOralDiet, self).elementProperties() + js.extend([ + ("fluidConsistencyType", "fluidConsistencyType", codeableconcept.CodeableConcept, True, None, False), + ("instruction", "instruction", str, False, None, False), + ("nutrient", "nutrient", NutritionOrderOralDietNutrient, True, None, False), + ("schedule", "schedule", timing.Timing, True, None, False), + ("texture", "texture", NutritionOrderOralDietTexture, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +class NutritionOrderOralDietNutrient(backboneelement.BackboneElement): + """ Required nutrient modifications. + + Class that defines the quantity and type of nutrient modifications required + for the oral diet. + """ + + resource_name = "NutritionOrderOralDietNutrient" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.amount = None + """ Quantity of the specified nutrient. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + self.modifier = None + """ Type of nutrient that is being modified. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(NutritionOrderOralDietNutrient, self).__init__(jsondict) + + def elementProperties(self): + js = super(NutritionOrderOralDietNutrient, self).elementProperties() + js.extend([ + ("amount", "amount", quantity.Quantity, False, None, False), + ("modifier", "modifier", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class NutritionOrderOralDietTexture(backboneelement.BackboneElement): + """ Required texture modifications. + + Class that describes any texture modifications required for the patient to + safely consume various types of solid foods. + """ + + resource_name = "NutritionOrderOralDietTexture" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.foodType = None + """ Concepts that are used to identify an entity that is ingested for + nutritional purposes. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.modifier = None + """ Code to indicate how to alter the texture of the foods, e.g. pureed. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(NutritionOrderOralDietTexture, self).__init__(jsondict) + + def elementProperties(self): + js = super(NutritionOrderOralDietTexture, self).elementProperties() + js.extend([ + ("foodType", "foodType", codeableconcept.CodeableConcept, False, None, False), + ("modifier", "modifier", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class NutritionOrderSupplement(backboneelement.BackboneElement): + """ Supplement components. + + Oral nutritional products given in order to add further nutritional value + to the patient's diet. + """ + + resource_name = "NutritionOrderSupplement" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.instruction = None + """ Instructions or additional information about the oral supplement. + Type `str`. """ + + self.productName = None + """ Product or brand name of the nutritional supplement. + Type `str`. """ + + self.quantity = None + """ Amount of the nutritional supplement. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + self.schedule = None + """ Scheduled frequency of supplement. + List of `Timing` items (represented as `dict` in JSON). """ + + self.type = None + """ Type of supplement product requested. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(NutritionOrderSupplement, self).__init__(jsondict) + + def elementProperties(self): + js = super(NutritionOrderSupplement, self).elementProperties() + js.extend([ + ("instruction", "instruction", str, False, None, False), + ("productName", "productName", str, False, None, False), + ("quantity", "quantity", quantity.Quantity, False, None, False), + ("schedule", "schedule", timing.Timing, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier +from . import quantity +from . import ratio +from . import timing diff --git a/fhirclient/models/DSTU2/nutritionorder_tests.py b/fhirclient/models/DSTU2/nutritionorder_tests.py new file mode 100644 index 000000000..98e7bd12d --- /dev/null +++ b/fhirclient/models/DSTU2/nutritionorder_tests.py @@ -0,0 +1,503 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import nutritionorder +from .fhirdate import FHIRDate + + +class NutritionOrderTests(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("NutritionOrder", js["resourceType"]) + return nutritionorder.NutritionOrder(js) + + def testNutritionOrder1(self): + inst = self.instantiate_from("nutritionorder-example-diabeticsupplement.json") + self.assertIsNotNone(inst, "Must have instantiated a NutritionOrder instance") + self.implNutritionOrder1(inst) + + js = inst.as_json() + self.assertEqual("NutritionOrder", js["resourceType"]) + inst2 = nutritionorder.NutritionOrder(js) + 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, "kosher") + self.assertEqual(inst.foodPreferenceModifier[0].coding[0].system, "http://hl7.org/fhir/diet") + self.assertEqual(inst.id, "diabeticsupplement") + self.assertEqual(inst.identifier[0].system, "http://goodhealthhospital.org/nutrition-orders") + self.assertEqual(inst.identifier[0].value, "123") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.supplement[0].productName, "Glucerna") + self.assertEqual(inst.supplement[0].quantity.unit, "8 oz bottle") + self.assertEqual(inst.supplement[0].quantity.value, 1) + self.assertEqual(inst.supplement[0].schedule[0].repeat.boundsPeriod.start.date, FHIRDate("2015-02-10T15:00:00Z").date) + self.assertEqual(inst.supplement[0].schedule[0].repeat.boundsPeriod.start.as_json(), "2015-02-10T15:00:00Z") + self.assertEqual(inst.supplement[0].schedule[0].repeat.frequency, 1) + self.assertEqual(inst.supplement[0].schedule[0].repeat.period, 24) + self.assertEqual(inst.supplement[0].schedule[0].repeat.periodUnits, "h") + self.assertEqual(inst.supplement[0].schedule[1].repeat.duration, 1) + self.assertEqual(inst.supplement[0].schedule[1].repeat.durationUnits, "h") + self.assertEqual(inst.supplement[0].schedule[1].repeat.when, "HS") + self.assertEqual(inst.supplement[0].type.coding[0].code, "443051000124104") + self.assertEqual(inst.supplement[0].type.coding[0].display, "Adult diabetes specialty 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 diabetic formula") + self.assertEqual(inst.supplement[0].type.coding[1].system, "http://goodhealthhospital.org/supplement-type-codes") + self.assertEqual(inst.supplement[0].type.text, "Adult diabetic formula") + self.assertEqual(inst.text.status, "generated") + + def testNutritionOrder2(self): + inst = self.instantiate_from("nutritionorder-example-enteralbolus.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.enteralFormula.additiveProductName, "Acme Lipid Additive") + self.assertEqual(inst.enteralFormula.additiveType.coding[0].code, "lipid") + self.assertEqual(inst.enteralFormula.additiveType.coding[0].display, "Modular lipid enteral formula component") + self.assertEqual(inst.enteralFormula.additiveType.coding[0].system, "http://hl7.org/fhir/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") + self.assertEqual(inst.enteralFormula.administration[0].quantity.unit, "milliliters") + self.assertEqual(inst.enteralFormula.administration[0].quantity.value, 240) + self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.boundsPeriod.start.date, FHIRDate("2014-09-17T16:00:00Z").date) + self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.boundsPeriod.start.as_json(), "2014-09-17T16:00:00Z") + self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.frequency, 1) + self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.period, 4) + self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.periodUnits, "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].display, "Adult high protein formula") + self.assertEqual(inst.enteralFormula.baseFormulaType.coding[0].system, "http://usextension/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.5) + 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, 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.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, "enteralbolus") + 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 testNutritionOrder3(self): + inst = self.instantiate_from("nutritionorder-example-fiberrestricteddiet.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") + 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, "fiberrestricteddiet") + self.assertEqual(inst.identifier[0].system, "http://goodhealthhospital.org/nutrition-orders") + 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, 50) + self.assertEqual(inst.oralDiet.nutrient[0].modifier.coding[0].code, "256674009") + self.assertEqual(inst.oralDiet.nutrient[0].modifier.coding[0].display, "Fat") + 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.periodUnits, "d") + self.assertEqual(inst.oralDiet.type[0].coding[0].code, "15108003") + self.assertEqual(inst.oralDiet.type[0].coding[0].display, "Restricted fiber diet") + self.assertEqual(inst.oralDiet.type[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.oralDiet.type[0].coding[1].code, "1000") + self.assertEqual(inst.oralDiet.type[0].coding[1].display, "Fiber restricted") + self.assertEqual(inst.oralDiet.type[0].coding[1].system, "http://goodhealthhospital.org/diet-type-codes") + self.assertEqual(inst.oralDiet.type[0].text, "Fiber restricted diet") + self.assertEqual(inst.oralDiet.type[1].coding[0].code, "16208003") + self.assertEqual(inst.oralDiet.type[1].coding[0].display, "Low fat diet") + self.assertEqual(inst.oralDiet.type[1].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.oralDiet.type[1].coding[1].code, "1100") + self.assertEqual(inst.oralDiet.type[1].coding[1].display, "Low Fat") + self.assertEqual(inst.oralDiet.type[1].coding[1].system, "http://goodhealthhospital.org/diet-type-codes") + self.assertEqual(inst.oralDiet.type[1].text, "Low fat diet") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + + 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-orders") + self.assertEqual(inst.identifier[0].value, "123") + 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.periodUnits, "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-orders") + self.assertEqual(inst.identifier[0].value, "123") + 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.periodUnits, "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.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.additiveProductName, "Acme High Carbohydrate Additive") + self.assertEqual(inst.enteralFormula.additiveType.coding[0].code, "carbohydrate") + self.assertEqual(inst.enteralFormula.additiveType.coding[0].display, "Modular carbohydrate enteral formula component") + self.assertEqual(inst.enteralFormula.additiveType.coding[0].system, "http://hl7.org/fhir/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") + self.assertEqual(inst.enteralFormula.administration[0].quantity.unit, "ounces") + self.assertEqual(inst.enteralFormula.administration[0].quantity.value, 4) + self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.boundsPeriod.start.date, FHIRDate("2014-09-17").date) + self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.boundsPeriod.start.as_json(), "2014-09-17") + self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.frequency, 1) + self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.period, 3) + self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.periodUnits, "h") + self.assertEqual(inst.enteralFormula.baseFormulaProductName, "Acme Infant Formula + Iron") + self.assertEqual(inst.enteralFormula.baseFormulaType.coding[0].code, "412414007") + self.assertEqual(inst.enteralFormula.baseFormulaType.coding[0].display, "infant formula + iron") + self.assertEqual(inst.enteralFormula.baseFormulaType.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.enteralFormula.caloricDensity.code, "cal/[foz_us]") + self.assertEqual(inst.enteralFormula.caloricDensity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.enteralFormula.caloricDensity.unit, "calories per ounce") + self.assertEqual(inst.enteralFormula.caloricDensity.value, 20) + self.assertEqual(inst.enteralFormula.maxVolumeToDeliver.code, "[foz_us]") + self.assertEqual(inst.enteralFormula.maxVolumeToDeliver.system, "http://unitsofmeasure.org") + self.assertEqual(inst.enteralFormula.maxVolumeToDeliver.unit, "ounces") + 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.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.status, "active") + self.assertEqual(inst.text.status, "generated") + + def testNutritionOrder7(self): + inst = self.instantiate_from("nutritionorder-example-enteralcontinuous.json") + self.assertIsNotNone(inst, "Must have instantiated a NutritionOrder instance") + self.implNutritionOrder7(inst) + + js = inst.as_json() + self.assertEqual("NutritionOrder", js["resourceType"]) + inst2 = nutritionorder.NutritionOrder(js) + self.implNutritionOrder7(inst2) + + 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.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 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://hl7.org/fhir/diet") + self.assertEqual(inst.id, "cardiacdiet") + self.assertEqual(inst.identifier[0].system, "http://goodhealthhospital.org/nutrition-orders") + 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 testNutritionOrder9(self): + inst = self.instantiate_from("nutritionorder-example-pureeddiet.json") + self.assertIsNotNone(inst, "Must have instantiated a NutritionOrder instance") + self.implNutritionOrder9(inst) + + js = inst.as_json() + self.assertEqual("NutritionOrder", js["resourceType"]) + inst2 = nutritionorder.NutritionOrder(js) + self.implNutritionOrder9(inst2) + + 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.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, "pureeddiet") + self.assertEqual(inst.identifier[0].system, "http://goodhealthhospital.org/nutrition-orders") + self.assertEqual(inst.identifier[0].value, "123") + 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.periodUnits, "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.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://hl7.org/fhir/diet") + self.assertEqual(inst.id, "diabeticdiet") + self.assertEqual(inst.identifier[0].system, "http://goodhealthhospital.org/nutrition-orders") + 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.periodUnits, "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/DSTU2/observation.py b/fhirclient/models/DSTU2/observation.py new file mode 100644 index 000000000..fd3d99945 --- /dev/null +++ b/fhirclient/models/DSTU2/observation.py @@ -0,0 +1,364 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Observation) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Observation(domainresource.DomainResource): + """ Measurements and simple assertions. + + Measurements and simple assertions made about a patient, device or other + subject. + """ + + resource_name = "Observation" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.bodySite = None + """ Observed body part. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.category = None + """ Classification of type of observation. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.code = None + """ Type of observation (code / type). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.comments = None + """ Comments about result. + Type `str`. """ + + self.component = None + """ Component results. + List of `ObservationComponent` items (represented as `dict` in JSON). """ + + self.dataAbsentReason = None + """ Why the result is missing. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.device = None + """ (Measurement) Device. + Type `FHIRReference` referencing `Device, DeviceMetric` (represented as `dict` in JSON). """ + + self.effectiveDateTime = 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.encounter = None + """ Healthcare event during which this observation is made. + Type `FHIRReference` referencing `Encounter` (represented as `dict` in JSON). """ + + self.identifier = None + """ Unique Id for this particular observation. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.interpretation = None + """ High, low, normal, etc.. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.issued = None + """ Date/Time this 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.performer = None + """ Who is responsible for the observation. + List of `FHIRReference` items referencing `Practitioner, Organization, Patient, RelatedPerson` (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). """ + + 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). """ + + self.valueCodeableConcept = None + """ Actual result. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueDateTime = None + """ Actual result. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valuePeriod = None + """ Actual result. + Type `Period` (represented as `dict` in JSON). """ + + self.valueQuantity = None + """ Actual result. + Type `Quantity` (represented as `dict` in JSON). """ + + self.valueRange = None + """ Actual result. + Type `Range` (represented as `dict` in JSON). """ + + self.valueRatio = None + """ Actual result. + Type `Ratio` (represented as `dict` in JSON). """ + + self.valueSampledData = None + """ Actual result. + Type `SampledData` (represented as `dict` in JSON). """ + + self.valueString = None + """ Actual result. + Type `str`. """ + + self.valueTime = None + """ Actual result. + Type `FHIRDate` (represented as `str` in JSON). """ + + super(Observation, self).__init__(jsondict) + + def elementProperties(self): + js = super(Observation, self).elementProperties() + js.extend([ + ("bodySite", "bodySite", codeableconcept.CodeableConcept, False, None, False), + ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("comments", "comments", str, False, None, False), + ("component", "component", ObservationComponent, True, None, False), + ("dataAbsentReason", "dataAbsentReason", codeableconcept.CodeableConcept, False, None, False), + ("device", "device", fhirreference.FHIRReference, False, 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), + ("interpretation", "interpretation", codeableconcept.CodeableConcept, False, None, False), + ("issued", "issued", fhirdate.FHIRDate, False, None, False), + ("method", "method", codeableconcept.CodeableConcept, False, 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), + ("valueCodeableConcept", "valueCodeableConcept", codeableconcept.CodeableConcept, False, "value", False), + ("valueDateTime", "valueDateTime", fhirdate.FHIRDate, False, "value", False), + ("valuePeriod", "valuePeriod", period.Period, False, "value", False), + ("valueQuantity", "valueQuantity", quantity.Quantity, False, "value", False), + ("valueRange", "valueRange", range.Range, False, "value", False), + ("valueRatio", "valueRatio", ratio.Ratio, False, "value", False), + ("valueSampledData", "valueSampledData", sampleddata.SampledData, False, "value", False), + ("valueString", "valueString", str, False, "value", False), + ("valueTime", "valueTime", fhirdate.FHIRDate, False, "value", False), + ]) + return js + + +from . import backboneelement + +class ObservationComponent(backboneelement.BackboneElement): + """ Component results. + + Some observations have multiple component observations. These component + observations are expressed as separate code value pairs that share the same + attributes. Examples include systolic and diastolic component observations + for blood pressure measurement and multiple component observations for + genetics observations. + """ + + resource_name = "ObservationComponent" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.code = None + """ Type of component observation (code / type). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.dataAbsentReason = None + """ Why the component result is missing. + Type `CodeableConcept` (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 + """ Actual component result. + Type `Attachment` (represented as `dict` in JSON). """ + + self.valueCodeableConcept = None + """ Actual component result. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueDateTime = None + """ Actual component result. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valuePeriod = None + """ Actual component result. + Type `Period` (represented as `dict` in JSON). """ + + self.valueQuantity = None + """ Actual component result. + Type `Quantity` (represented as `dict` in JSON). """ + + self.valueRange = None + """ Actual component result. + Type `Range` (represented as `dict` in JSON). """ + + self.valueRatio = None + """ Actual component result. + Type `Ratio` (represented as `dict` in JSON). """ + + self.valueSampledData = None + """ Actual component result. + Type `SampledData` (represented as `dict` in JSON). """ + + self.valueString = None + """ Actual component result. + Type `str`. """ + + self.valueTime = None + """ Actual component result. + Type `FHIRDate` (represented as `str` in JSON). """ + + super(ObservationComponent, self).__init__(jsondict) + + def elementProperties(self): + js = super(ObservationComponent, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("dataAbsentReason", "dataAbsentReason", codeableconcept.CodeableConcept, False, None, False), + ("referenceRange", "referenceRange", ObservationReferenceRange, True, None, False), + ("valueAttachment", "valueAttachment", attachment.Attachment, False, "value", False), + ("valueCodeableConcept", "valueCodeableConcept", codeableconcept.CodeableConcept, False, "value", False), + ("valueDateTime", "valueDateTime", fhirdate.FHIRDate, False, "value", False), + ("valuePeriod", "valuePeriod", period.Period, False, "value", False), + ("valueQuantity", "valueQuantity", quantity.Quantity, False, "value", False), + ("valueRange", "valueRange", range.Range, False, "value", False), + ("valueRatio", "valueRatio", ratio.Ratio, False, "value", False), + ("valueSampledData", "valueSampledData", sampleddata.SampledData, False, "value", False), + ("valueString", "valueString", str, False, "value", False), + ("valueTime", "valueTime", fhirdate.FHIRDate, False, "value", False), + ]) + return js + + +class ObservationReferenceRange(backboneelement.BackboneElement): + """ Provides guide for interpretation. + + Guidance on how to interpret the value by comparison to a normal or + recommended range. + """ + + resource_name = "ObservationReferenceRange" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.age = None + """ Applicable age range, if relevant. + Type `Range` (represented as `dict` in JSON). """ + + self.high = None + """ High Range, if relevant. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + self.low = None + """ Low Range, if relevant. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + self.meaning = None + """ Indicates the meaning/use of this range of this range. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.text = None + """ Text based reference range in an observation. + Type `str`. """ + + super(ObservationReferenceRange, self).__init__(jsondict) + + def elementProperties(self): + js = super(ObservationReferenceRange, self).elementProperties() + js.extend([ + ("age", "age", range.Range, False, None, False), + ("high", "high", quantity.Quantity, False, None, False), + ("low", "low", quantity.Quantity, False, None, False), + ("meaning", "meaning", codeableconcept.CodeableConcept, False, None, False), + ("text", "text", str, False, None, False), + ]) + return js + + +class ObservationRelated(backboneelement.BackboneElement): + """ Resource related to this observation. + + A reference to another resource (usually another Observation but could + also be a QuestionnaireAnswer) whose relationship is defined by the + relationship type code. + """ + + resource_name = "ObservationRelated" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.target = None + """ Resource that is related to this one. + Type `FHIRReference` referencing `Observation, QuestionnaireResponse` (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) + + 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 + + +from . import attachment +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier +from . import period +from . import quantity +from . import range +from . import ratio +from . import sampleddata diff --git a/fhirclient/models/DSTU2/observation_tests.py b/fhirclient/models/DSTU2/observation_tests.py new file mode 100644 index 000000000..f7166a91a --- /dev/null +++ b/fhirclient/models/DSTU2/observation_tests.py @@ -0,0 +1,391 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import observation +from .fhirdate import FHIRDate + + +class ObservationTests(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("Observation", js["resourceType"]) + return observation.Observation(js) + + def testObservation1(self): + inst = self.instantiate_from("observation-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Observation instance") + self.implObservation1(inst) + + js = inst.as_json() + self.assertEqual("Observation", js["resourceType"]) + inst2 = observation.Observation(js) + self.implObservation1(inst2) + + def implObservation1(self, inst): + self.assertEqual(inst.category.coding[0].code, "vital-signs") + self.assertEqual(inst.category.coding[0].display, "Vital Signs") + self.assertEqual(inst.category.coding[0].system, "http://hl7.org/fhir/observation-category") + self.assertEqual(inst.code.coding[0].code, "3141-9") + self.assertEqual(inst.code.coding[0].display, "Weight Measured") + self.assertEqual(inst.code.coding[0].system, "http://loinc.org") + self.assertEqual(inst.code.coding[1].code, "27113001") + self.assertEqual(inst.code.coding[1].display, "Body weight") + self.assertEqual(inst.code.coding[1].system, "http://snomed.info/sct") + self.assertEqual(inst.code.coding[2].code, "body-weight") + self.assertEqual(inst.code.coding[2].display, "Body Weight") + self.assertEqual(inst.code.coding[2].system, "http://acme.org/devices/clinical-codes") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.status, "final") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.valueQuantity.code, "[lb_av]") + self.assertEqual(inst.valueQuantity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.valueQuantity.unit, "lbs") + self.assertEqual(inst.valueQuantity.value, 185) + + def testObservation2(self): + inst = self.instantiate_from("obs-genetics-example3-mutationlist-4.json") + self.assertIsNotNone(inst, "Must have instantiated a Observation instance") + self.implObservation2(inst) + + js = inst.as_json() + self.assertEqual("Observation", js["resourceType"]) + inst2 = observation.Observation(js) + self.implObservation2(inst2) + + def implObservation2(self, inst): + self.assertEqual(inst.code.coding[0].code, "49874-1") + self.assertEqual(inst.code.coding[0].display, "ABCB4 gene mutation analysis") + self.assertEqual(inst.code.coding[0].system, "http://loinc.org") + self.assertEqual(inst.component[0].code.coding[0].code, "53037-8") + self.assertEqual(inst.component[0].code.coding[0].display, "Genetic disease sequence variation interpretation") + self.assertEqual(inst.component[0].code.coding[0].system, "http://loinc.org") + self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].code, "LA6675-8") + self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].display, "Benign") + self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].system, "http://www.genenames.org") + self.assertEqual(inst.extension[0].url, "http://hl7.org/fhir/StructureDefinition/geneticsDNARegionName") + self.assertEqual(inst.extension[0].valueString, "intron 26") + self.assertEqual(inst.extension[1].url, "http://hl7.org/fhir/StructureDefinition/geneticsVariationId") + self.assertEqual(inst.extension[1].valueCodeableConcept.coding[0].code, "31653") + self.assertEqual(inst.extension[1].valueCodeableConcept.coding[0].display, "c.3487-16T>C") + self.assertEqual(inst.extension[1].valueCodeableConcept.coding[0].system, "http://www.ncbi.nlm.nih.gov/projects/SNP") + self.assertEqual(inst.id, "genetics-example3-mutationlist-4") + self.assertEqual(inst.status, "final") + self.assertEqual(inst.text.status, "generated") + + def testObservation3(self): + inst = self.instantiate_from("observation-example-f002-excess.json") + self.assertIsNotNone(inst, "Must have instantiated a Observation instance") + self.implObservation3(inst) + + js = inst.as_json() + self.assertEqual("Observation", js["resourceType"]) + inst2 = observation.Observation(js) + self.implObservation3(inst2) + + def implObservation3(self, inst): + self.assertEqual(inst.code.coding[0].code, "11555-0") + self.assertEqual(inst.code.coding[0].display, "Base excess in Blood by calculation") + self.assertEqual(inst.code.coding[0].system, "http://loinc.org") + self.assertEqual(inst.effectivePeriod.end.date, FHIRDate("2013-04-05T10:30:10+01:00").date) + self.assertEqual(inst.effectivePeriod.end.as_json(), "2013-04-05T10:30:10+01:00") + self.assertEqual(inst.effectivePeriod.start.date, FHIRDate("2013-04-02T10:30:10+01:00").date) + self.assertEqual(inst.effectivePeriod.start.as_json(), "2013-04-02T10:30:10+01:00") + self.assertEqual(inst.id, "f002") + self.assertEqual(inst.identifier[0].system, "http://www.bmc.nl/zorgportal/identifiers/observations") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "6324") + self.assertEqual(inst.interpretation.coding[0].code, "H") + self.assertEqual(inst.interpretation.coding[0].display, "Above high normal") + self.assertEqual(inst.interpretation.coding[0].system, "http://hl7.org/fhir/v2/0078") + 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.referenceRange[0].high.code, "mmol/L") + self.assertEqual(inst.referenceRange[0].high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.referenceRange[0].high.unit, "mmol/l") + self.assertEqual(inst.referenceRange[0].high.value, 11.2) + self.assertEqual(inst.referenceRange[0].low.code, "mmol/L") + self.assertEqual(inst.referenceRange[0].low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.referenceRange[0].low.unit, "mmol/l") + self.assertEqual(inst.referenceRange[0].low.value, 7.1) + self.assertEqual(inst.status, "final") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.valueQuantity.code, "mmol/L") + self.assertEqual(inst.valueQuantity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.valueQuantity.unit, "mmol/l") + self.assertEqual(inst.valueQuantity.value, 12.6) + + def testObservation4(self): + inst = self.instantiate_from("obs-genetics-example3-mutationlist-2.json") + self.assertIsNotNone(inst, "Must have instantiated a Observation instance") + self.implObservation4(inst) + + js = inst.as_json() + self.assertEqual("Observation", js["resourceType"]) + inst2 = observation.Observation(js) + self.implObservation4(inst2) + + def implObservation4(self, inst): + self.assertEqual(inst.code.coding[0].code, "49874-1") + self.assertEqual(inst.code.coding[0].display, "ABCB4 gene mutation analysis") + self.assertEqual(inst.code.coding[0].system, "http://loinc.org") + self.assertEqual(inst.component[0].code.coding[0].code, "53037-8") + self.assertEqual(inst.component[0].code.coding[0].display, "Genetic disease sequence variation interpretation") + self.assertEqual(inst.component[0].code.coding[0].system, "http://loinc.org") + self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].code, "LA6675-8") + self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].display, "Benign") + self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].system, "http://www.genenames.org") + self.assertEqual(inst.extension[0].url, "http://hl7.org/fhir/StructureDefinition/geneticsDNARegionName") + self.assertEqual(inst.extension[0].valueString, "Exon 6") + self.assertEqual(inst.extension[1].url, "http://hl7.org/fhir/StructureDefinition/geneticsAminoAcidChange") + self.assertEqual(inst.extension[1].valueString, "p.N168N") + self.assertEqual(inst.extension[2].url, "http://hl7.org/fhir/StructureDefinition/geneticsVariationId") + self.assertEqual(inst.extension[2].valueCodeableConcept.coding[0].code, "1202283") + self.assertEqual(inst.extension[2].valueCodeableConcept.coding[0].display, "c.181T>G") + self.assertEqual(inst.extension[2].valueCodeableConcept.coding[0].system, "http://www.ncbi.nlm.nih.gov/projects/SNP") + self.assertEqual(inst.id, "genetics-example3-mutationlist-2") + self.assertEqual(inst.status, "final") + self.assertEqual(inst.text.status, "generated") + + def testObservation5(self): + inst = self.instantiate_from("observation-example-f206-staphylococcus.json") + self.assertIsNotNone(inst, "Must have instantiated a Observation instance") + self.implObservation5(inst) + + js = inst.as_json() + self.assertEqual("Observation", js["resourceType"]) + inst2 = observation.Observation(js) + self.implObservation5(inst2) + + def implObservation5(self, inst): + self.assertEqual(inst.code.coding[0].code, "104177") + self.assertEqual(inst.code.coding[0].display, "Blood culture") + self.assertEqual(inst.code.coding[0].system, "http://acmelabs.org") + self.assertEqual(inst.code.coding[1].code, "600-7") + self.assertEqual(inst.code.coding[1].display, "Bacteria identified in Blood by Culture") + self.assertEqual(inst.code.coding[1].system, "http://loinc.org") + self.assertEqual(inst.id, "f206") + self.assertEqual(inst.interpretation.coding[0].code, "POS") + self.assertEqual(inst.interpretation.coding[0].system, "http://hl7.org/fhir/v2/0078") + 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.method.coding[0].code, "104177005") + self.assertEqual(inst.method.coding[0].display, "Blood culture for bacteria, including anaerobic screen") + self.assertEqual(inst.method.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.status, "final") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.valueCodeableConcept.coding[0].code, "3092008") + self.assertEqual(inst.valueCodeableConcept.coding[0].display, "Staphylococcus aureus") + self.assertEqual(inst.valueCodeableConcept.coding[0].system, "http://snomed.info/sct") + + def testObservation6(self): + inst = self.instantiate_from("observation-example-bloodpressure-cancel.json") + self.assertIsNotNone(inst, "Must have instantiated a Observation instance") + self.implObservation6(inst) + + js = inst.as_json() + self.assertEqual("Observation", js["resourceType"]) + inst2 = observation.Observation(js) + 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.code.coding[0].code, "55284-4") + self.assertEqual(inst.code.coding[0].display, "Blood pressure systolic & diastolic") + self.assertEqual(inst.code.coding[0].system, "http://loinc.org") + self.assertEqual(inst.comments, "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, "Below low normal") + self.assertEqual(inst.interpretation.coding[0].system, "http://hl7.org/fhir/v2/0078") + self.assertEqual(inst.interpretation.text, "low") + self.assertEqual(inst.meta.lastUpdated.date, FHIRDate("2014-01-30T22:35:23+11:00").date) + self.assertEqual(inst.meta.lastUpdated.as_json(), "2014-01-30T22:35:23+11:00") + self.assertEqual(inst.status, "cancelled") + self.assertEqual(inst.text.status, "generated") + + def testObservation7(self): + inst = self.instantiate_from("obs-genetics-example3-mutationlist-3.json") + self.assertIsNotNone(inst, "Must have instantiated a Observation instance") + self.implObservation7(inst) + + js = inst.as_json() + self.assertEqual("Observation", js["resourceType"]) + inst2 = observation.Observation(js) + self.implObservation7(inst2) + + def implObservation7(self, inst): + self.assertEqual(inst.code.coding[0].code, "49874-1") + self.assertEqual(inst.code.coding[0].display, "ABCB4 gene mutation analysis") + self.assertEqual(inst.code.coding[0].system, "http://loinc.org") + self.assertEqual(inst.component[0].code.coding[0].code, "53037-8") + self.assertEqual(inst.component[0].code.coding[0].display, "Genetic disease sequence variation interpretation") + self.assertEqual(inst.component[0].code.coding[0].system, "http://loinc.org") + self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].code, "LA6675-8") + self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].display, "Benign") + self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].system, "http://www.genenames.org") + self.assertEqual(inst.extension[0].url, "http://hl7.org/fhir/StructureDefinition/geneticsDNARegionName") + self.assertEqual(inst.extension[0].valueString, "intron 16") + self.assertEqual(inst.extension[1].url, "http://hl7.org/fhir/StructureDefinition/geneticsVariationId") + self.assertEqual(inst.extension[1].valueCodeableConcept.coding[0].code, "31668") + self.assertEqual(inst.extension[1].valueCodeableConcept.coding[0].display, "c.2211+16C>T") + self.assertEqual(inst.extension[1].valueCodeableConcept.coding[0].system, "http://www.ncbi.nlm.nih.gov/projects/SNP") + self.assertEqual(inst.id, "genetics-example3-mutationlist-3") + self.assertEqual(inst.status, "final") + self.assertEqual(inst.text.status, "generated") + + def testObservation8(self): + inst = self.instantiate_from("observation-example-glasgow.json") + self.assertIsNotNone(inst, "Must have instantiated a Observation instance") + self.implObservation8(inst) + + js = inst.as_json() + self.assertEqual("Observation", js["resourceType"]) + inst2 = observation.Observation(js) + self.implObservation8(inst2) + + def implObservation8(self, inst): + self.assertEqual(inst.code.coding[0].code, "9269-2") + self.assertEqual(inst.code.coding[0].display, "Glasgow coma score total") + self.assertEqual(inst.code.coding[0].system, "http://loinc.org") + self.assertEqual(inst.code.text, "Glasgow Coma Scale , (GCS)") + self.assertEqual(inst.contained[0].id, "motor") + self.assertEqual(inst.contained[1].id, "verbal") + self.assertEqual(inst.contained[2].id, "eyes") + self.assertEqual(inst.effectiveDateTime.date, FHIRDate("2014-12-11T04:44:16Z").date) + self.assertEqual(inst.effectiveDateTime.as_json(), "2014-12-11T04:44:16Z") + self.assertEqual(inst.id, "glasgow") + self.assertEqual(inst.referenceRange[0].high.code, "{score}") + self.assertEqual(inst.referenceRange[0].high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.referenceRange[0].high.value, 8) + self.assertEqual(inst.referenceRange[0].meaning.text, "Severe TBI") + self.assertEqual(inst.referenceRange[1].high.code, "{score}") + self.assertEqual(inst.referenceRange[1].high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.referenceRange[1].high.value, 12) + self.assertEqual(inst.referenceRange[1].low.code, "{score}") + self.assertEqual(inst.referenceRange[1].low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.referenceRange[1].low.value, 9) + self.assertEqual(inst.referenceRange[1].meaning.text, "Moderate TBI") + self.assertEqual(inst.referenceRange[2].low.code, "{score}") + self.assertEqual(inst.referenceRange[2].low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.referenceRange[2].low.value, 13) + self.assertEqual(inst.referenceRange[2].meaning.text, "Mild TBI") + self.assertEqual(inst.related[0].type, "derived-from") + self.assertEqual(inst.related[1].type, "derived-from") + self.assertEqual(inst.related[2].type, "derived-from") + 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, 13) + + def testObservation9(self): + inst = self.instantiate_from("observation-example-satO2.json") + self.assertIsNotNone(inst, "Must have instantiated a Observation instance") + self.implObservation9(inst) + + js = inst.as_json() + self.assertEqual("Observation", js["resourceType"]) + inst2 = observation.Observation(js) + self.implObservation9(inst2) + + def implObservation9(self, inst): + self.assertEqual(inst.code.coding[0].code, "150456") + self.assertEqual(inst.code.coding[0].display, "MDC_PULS_OXIM_SAT_O2") + self.assertEqual(inst.code.coding[0].system, "https://rtmms.nist.gov") + self.assertEqual(inst.effectiveDateTime.date, FHIRDate("2014-12-05T09:30:10+01:00").date) + self.assertEqual(inst.effectiveDateTime.as_json(), "2014-12-05T09:30:10+01:00") + self.assertEqual(inst.id, "satO2") + self.assertEqual(inst.identifier[0].system, "http://goodcare.org/observation/id") + self.assertEqual(inst.identifier[0].value, "o1223435-10") + self.assertEqual(inst.interpretation.coding[0].code, "N") + self.assertEqual(inst.interpretation.coding[0].display, "Normal (applies to non-numeric results)") + self.assertEqual(inst.interpretation.coding[0].system, "http://hl7.org/fhir/v2/0078") + self.assertEqual(inst.referenceRange[0].high.code, "262688") + self.assertEqual(inst.referenceRange[0].high.system, "https://rtmms.nist.gov") + self.assertEqual(inst.referenceRange[0].high.unit, "%") + self.assertEqual(inst.referenceRange[0].high.value, 99) + self.assertEqual(inst.referenceRange[0].low.code, "262688") + self.assertEqual(inst.referenceRange[0].low.system, "https://rtmms.nist.gov") + self.assertEqual(inst.referenceRange[0].low.unit, "%") + self.assertEqual(inst.referenceRange[0].low.value, 90) + self.assertEqual(inst.status, "final") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.valueQuantity.code, "262688") + self.assertEqual(inst.valueQuantity.system, "https://rtmms.nist.gov") + self.assertEqual(inst.valueQuantity.unit, "%") + self.assertEqual(inst.valueQuantity.value, 95) + + def testObservation10(self): + inst = self.instantiate_from("observation-example-glasgow-qa.json") + self.assertIsNotNone(inst, "Must have instantiated a Observation instance") + self.implObservation10(inst) + + js = inst.as_json() + self.assertEqual("Observation", js["resourceType"]) + inst2 = observation.Observation(js) + self.implObservation10(inst2) + + def implObservation10(self, inst): + self.assertEqual(inst.code.coding[0].code, "9269-2") + self.assertEqual(inst.code.coding[0].display, "Glasgow coma score total") + self.assertEqual(inst.code.coding[0].system, "http://loinc.org") + self.assertEqual(inst.code.text, "Glasgow Coma Scale , (GCS)") + self.assertEqual(inst.effectiveDateTime.date, FHIRDate("2014-12-11T04:44:16Z").date) + self.assertEqual(inst.effectiveDateTime.as_json(), "2014-12-11T04:44:16Z") + self.assertEqual(inst.id, "gcs-qa") + self.assertEqual(inst.referenceRange[0].high.code, "{score}") + self.assertEqual(inst.referenceRange[0].high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.referenceRange[0].high.value, 8) + self.assertEqual(inst.referenceRange[0].meaning.text, "Severe TBI") + self.assertEqual(inst.referenceRange[1].high.code, "{score}") + self.assertEqual(inst.referenceRange[1].high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.referenceRange[1].high.value, 12) + self.assertEqual(inst.referenceRange[1].low.code, "{score}") + self.assertEqual(inst.referenceRange[1].low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.referenceRange[1].low.value, 9) + self.assertEqual(inst.referenceRange[1].meaning.text, "Moderate TBI") + self.assertEqual(inst.referenceRange[2].low.code, "{score}") + self.assertEqual(inst.referenceRange[2].low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.referenceRange[2].low.value, 13) + self.assertEqual(inst.referenceRange[2].meaning.text, "Mild TBI") + self.assertEqual(inst.related[0].type, "derived-from") + 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, 13) + diff --git a/fhirclient/models/DSTU2/operationdefinition.py b/fhirclient/models/DSTU2/operationdefinition.py new file mode 100644 index 000000000..1499b0866 --- /dev/null +++ b/fhirclient/models/DSTU2/operationdefinition.py @@ -0,0 +1,265 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/OperationDefinition) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class OperationDefinition(domainresource.DomainResource): + """ Definition of an operation or a named query. + + A formal computable definition of an operation (on the RESTful interface) + or a named query (using the search interaction). + """ + + resource_name = "OperationDefinition" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.base = None + """ Marks this as a profile of the base. + Type `FHIRReference` referencing `OperationDefinition` (represented as `dict` in JSON). """ + + self.code = None + """ Name used to invoke the operation. + Type `str`. """ + + self.contact = None + """ Contact details of the publisher. + List of `OperationDefinitionContact` items (represented as `dict` in JSON). """ + + self.date = None + """ Date for this version of the operation definition. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Natural language description of the operation. + Type `str`. """ + + self.experimental = None + """ If for testing purposes, not real usage. + Type `bool`. """ + + self.idempotent = None + """ Whether content is unchanged by operation. + Type `bool`. """ + + self.instance = None + """ Invoke on an instance?. + Type `bool`. """ + + self.kind = None + """ operation | query. + Type `str`. """ + + self.name = None + """ Informal name for this operation. + Type `str`. """ + + self.notes = None + """ Additional information about use. + Type `str`. """ + + self.parameter = None + """ Parameters for the operation/query. + List of `OperationDefinitionParameter` items (represented as `dict` in JSON). """ + + self.publisher = None + """ Name of the publisher (Organization or individual). + Type `str`. """ + + self.requirements = None + """ Why is this needed?. + Type `str`. """ + + self.status = None + """ draft | active | retired. + Type `str`. """ + + self.system = None + """ Invoke at the system level?. + Type `bool`. """ + + self.type = None + """ Invoke at resource level for these type. + List of `str` items. """ + + self.url = None + """ Logical URL to reference this operation definition. + Type `str`. """ + + self.version = None + """ Logical id for this version of the operation definition. + Type `str`. """ + + super(OperationDefinition, self).__init__(jsondict) + + def elementProperties(self): + js = super(OperationDefinition, self).elementProperties() + js.extend([ + ("base", "base", fhirreference.FHIRReference, False, None, False), + ("code", "code", str, False, None, True), + ("contact", "contact", OperationDefinitionContact, 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), + ("instance", "instance", bool, False, None, True), + ("kind", "kind", str, False, None, True), + ("name", "name", str, False, None, True), + ("notes", "notes", str, False, None, False), + ("parameter", "parameter", OperationDefinitionParameter, True, None, False), + ("publisher", "publisher", str, False, None, False), + ("requirements", "requirements", str, False, None, False), + ("status", "status", str, False, None, True), + ("system", "system", bool, False, None, True), + ("type", "type", str, True, None, False), + ("url", "url", str, False, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class OperationDefinitionContact(backboneelement.BackboneElement): + """ Contact details of the publisher. + + Contacts to assist a user in finding and communicating with the publisher. + """ + + resource_name = "OperationDefinitionContact" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.name = None + """ Name of a individual to contact. + Type `str`. """ + + self.telecom = None + """ Contact details for individual or publisher. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(OperationDefinitionContact, self).__init__(jsondict) + + def elementProperties(self): + js = super(OperationDefinitionContact, self).elementProperties() + js.extend([ + ("name", "name", str, False, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ]) + return js + + +class OperationDefinitionParameter(backboneelement.BackboneElement): + """ Parameters for the operation/query. + + The parameters for the operation/query. + """ + + resource_name = "OperationDefinitionParameter" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.binding = None + """ ValueSet details if this is coded. + Type `OperationDefinitionParameterBinding` (represented as `dict` in JSON). """ + + self.documentation = None + """ Description of meaning/use. + Type `str`. """ + + self.max = None + """ Maximum Cardinality (a number or *). + Type `str`. """ + + self.min = None + """ Minimum Cardinality. + Type `int`. """ + + self.name = None + """ Name in Parameters.parameter.name or in URL. + Type `str`. """ + + self.part = None + """ Parts of a Tuple 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.type = None + """ What type this parameter has. + Type `str`. """ + + self.use = None + """ in | out. + Type `str`. """ + + super(OperationDefinitionParameter, self).__init__(jsondict) + + def elementProperties(self): + js = super(OperationDefinitionParameter, self).elementProperties() + js.extend([ + ("binding", "binding", OperationDefinitionParameterBinding, False, None, False), + ("documentation", "documentation", str, False, None, False), + ("max", "max", str, False, None, True), + ("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), + ("type", "type", str, False, None, False), + ("use", "use", str, False, None, True), + ]) + return js + + +class OperationDefinitionParameterBinding(backboneelement.BackboneElement): + """ ValueSet details if this is coded. + + Binds to a value set if this parameter is coded (code, Coding, + CodeableConcept). + """ + + resource_name = "OperationDefinitionParameterBinding" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.strength = None + """ 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 + """ Source of value set. + Type `str`. """ + + super(OperationDefinitionParameterBinding, self).__init__(jsondict) + + 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), + ]) + return js + + +from . import contactpoint +from . import fhirdate +from . import fhirreference diff --git a/fhirclient/models/DSTU2/operationdefinition_tests.py b/fhirclient/models/DSTU2/operationdefinition_tests.py new file mode 100644 index 000000000..4e469ca70 --- /dev/null +++ b/fhirclient/models/DSTU2/operationdefinition_tests.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import operationdefinition +from .fhirdate import FHIRDate + + +class OperationDefinitionTests(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("OperationDefinition", js["resourceType"]) + return operationdefinition.OperationDefinition(js) + + def testOperationDefinition1(self): + inst = self.instantiate_from("operationdefinition-example.json") + self.assertIsNotNone(inst, "Must have instantiated a OperationDefinition instance") + self.implOperationDefinition1(inst) + + js = inst.as_json() + self.assertEqual("OperationDefinition", js["resourceType"]) + inst2 = operationdefinition.OperationDefinition(js) + self.implOperationDefinition1(inst2) + + def implOperationDefinition1(self, inst): + self.assertEqual(inst.code, "populate") + 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, "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.id, "example") + self.assertTrue(inst.instance) + self.assertEqual(inst.kind, "operation") + self.assertEqual(inst.name, "Populate Questionnaire") + self.assertEqual(inst.notes, "Only implemented for Labs and Medications so far") + self.assertEqual(inst.parameter[0].max, "1") + self.assertEqual(inst.parameter[0].min, 1) + self.assertEqual(inst.parameter[0].name, "subject") + self.assertEqual(inst.parameter[0].type, "Reference") + self.assertEqual(inst.parameter[0].use, "in") + self.assertEqual(inst.parameter[1].documentation, "The partially (or fully)-populated set of answers for the specified Questionnaire") + self.assertEqual(inst.parameter[1].max, "1") + self.assertEqual(inst.parameter[1].min, 1) + self.assertEqual(inst.parameter[1].name, "return") + self.assertEqual(inst.parameter[1].type, "QuestionnaireResponse") + self.assertEqual(inst.parameter[1].use, "out") + self.assertEqual(inst.publisher, "Acme Healthcare Services") + self.assertEqual(inst.status, "draft") + self.assertFalse(inst.system) + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type[0], "Questionnaire") + self.assertEqual(inst.url, "http://h7.org/fhir/OperationDefinition/example") + self.assertEqual(inst.version, "B") + diff --git a/fhirclient/models/DSTU2/operationoutcome.py b/fhirclient/models/DSTU2/operationoutcome.py new file mode 100644 index 000000000..6840132a6 --- /dev/null +++ b/fhirclient/models/DSTU2/operationoutcome.py @@ -0,0 +1,85 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/OperationOutcome) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class OperationOutcome(domainresource.DomainResource): + """ Information about the success/failure of an action. + + A collection of error, warning or information messages that result from a + system action. + """ + + resource_name = "OperationOutcome" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.issue = None + """ A single issue associated with the action. + List of `OperationOutcomeIssue` items (represented as `dict` in JSON). """ + + super(OperationOutcome, self).__init__(jsondict) + + def elementProperties(self): + js = super(OperationOutcome, self).elementProperties() + js.extend([ + ("issue", "issue", OperationOutcomeIssue, True, None, True), + ]) + return js + + +from . import backboneelement + +class OperationOutcomeIssue(backboneelement.BackboneElement): + """ A single issue associated with the action. + + An error, warning or information message that results from a system action. + """ + + resource_name = "OperationOutcomeIssue" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.code = None + """ Error or warning code. + Type `str`. """ + + self.details = None + """ Additional details about the error. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.diagnostics = None + """ Additional diagnostic information about the issue. + Type `str`. """ + + self.location = None + """ XPath of element(s) related to issue. + List of `str` items. """ + + self.severity = None + """ fatal | error | warning | information. + Type `str`. """ + + super(OperationOutcomeIssue, self).__init__(jsondict) + + def elementProperties(self): + js = super(OperationOutcomeIssue, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("details", "details", codeableconcept.CodeableConcept, False, None, False), + ("diagnostics", "diagnostics", str, False, None, False), + ("location", "location", str, True, None, False), + ("severity", "severity", str, False, None, True), + ]) + return js + + +from . import codeableconcept diff --git a/fhirclient/models/DSTU2/operationoutcome_tests.py b/fhirclient/models/DSTU2/operationoutcome_tests.py new file mode 100644 index 000000000..f259a02c6 --- /dev/null +++ b/fhirclient/models/DSTU2/operationoutcome_tests.py @@ -0,0 +1,132 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import operationoutcome +from .fhirdate import FHIRDate + + +class OperationOutcomeTests(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("OperationOutcome", js["resourceType"]) + return operationoutcome.OperationOutcome(js) + + def testOperationOutcome1(self): + inst = self.instantiate_from("operationoutcome-example-validationfail.json") + self.assertIsNotNone(inst, "Must have instantiated a OperationOutcome instance") + self.implOperationOutcome1(inst) + + js = inst.as_json() + self.assertEqual("OperationOutcome", js["resourceType"]) + inst2 = operationoutcome.OperationOutcome(js) + self.implOperationOutcome1(inst2) + + def implOperationOutcome1(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].location[0], "/f:Patient/f:identifier") + self.assertEqual(inst.issue[0].severity, "error") + self.assertEqual(inst.text.status, "generated") + + def testOperationOutcome2(self): + inst = self.instantiate_from("operationoutcome-example-break-the-glass.json") + self.assertIsNotNone(inst, "Must have instantiated a OperationOutcome instance") + self.implOperationOutcome2(inst) + + js = inst.as_json() + self.assertEqual("OperationOutcome", js["resourceType"]) + inst2 = operationoutcome.OperationOutcome(js) + self.implOperationOutcome2(inst2) + + def implOperationOutcome2(self, inst): + self.assertEqual(inst.id, "break-the-glass") + 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.text, "Additional information may be available using the Break-The-Glass Protocol") + self.assertEqual(inst.issue[0].severity, "information") + self.assertEqual(inst.text.status, "generated") + + def testOperationOutcome3(self): + inst = self.instantiate_from("operationoutcome-example-searchfail.json") + self.assertIsNotNone(inst, "Must have instantiated a OperationOutcome instance") + self.implOperationOutcome3(inst) + + js = inst.as_json() + self.assertEqual("OperationOutcome", js["resourceType"]) + inst2 = operationoutcome.OperationOutcome(js) + self.implOperationOutcome3(inst2) + + def implOperationOutcome3(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.text.status, "generated") + + def testOperationOutcome4(self): + inst = self.instantiate_from("operationoutcome-example-exception.json") + self.assertIsNotNone(inst, "Must have instantiated a OperationOutcome instance") + self.implOperationOutcome4(inst) + + js = inst.as_json() + self.assertEqual("OperationOutcome", js["resourceType"]) + inst2 = operationoutcome.OperationOutcome(js) + self.implOperationOutcome4(inst2) + + def implOperationOutcome4(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") + + def testOperationOutcome5(self): + inst = self.instantiate_from("operationoutcome-example.json") + self.assertIsNotNone(inst, "Must have instantiated a OperationOutcome instance") + self.implOperationOutcome5(inst) + + js = inst.as_json() + self.assertEqual("OperationOutcome", js["resourceType"]) + inst2 = operationoutcome.OperationOutcome(js) + self.implOperationOutcome5(inst2) + + def implOperationOutcome5(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].location[0], "/f:Person/f:gender") + self.assertEqual(inst.issue[0].severity, "error") + self.assertEqual(inst.text.status, "additional") + + def testOperationOutcome6(self): + inst = self.instantiate_from("operationoutcome-example-allok.json") + self.assertIsNotNone(inst, "Must have instantiated a OperationOutcome instance") + self.implOperationOutcome6(inst) + + js = inst.as_json() + self.assertEqual("OperationOutcome", js["resourceType"]) + inst2 = operationoutcome.OperationOutcome(js) + self.implOperationOutcome6(inst2) + + def implOperationOutcome6(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") + diff --git a/fhirclient/models/DSTU2/order.py b/fhirclient/models/DSTU2/order.py new file mode 100644 index 000000000..11cfa1ea1 --- /dev/null +++ b/fhirclient/models/DSTU2/order.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Order) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Order(domainresource.DomainResource): + """ A request to perform an action. + """ + + resource_name = "Order" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.date = None + """ When the order was made. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.detail = None + """ What action is being ordered. + List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + + self.identifier = None + """ Identifiers assigned to this order by the orderer or by the + receiver. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.reasonCodeableConcept = None + """ Text - why the order was made. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.reasonReference = None + """ Text - why the order was made. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.source = None + """ Who initiated the order. + Type `FHIRReference` referencing `Practitioner, Organization` (represented as `dict` in JSON). """ + + self.subject = None + """ Patient this order is about. + Type `FHIRReference` referencing `Patient, Group, Device, Substance` (represented as `dict` in JSON). """ + + self.target = None + """ Who is intended to fulfill the order. + Type `FHIRReference` referencing `Organization, Device, Practitioner` (represented as `dict` in JSON). """ + + self.when = None + """ When order should be fulfilled. + Type `OrderWhen` (represented as `dict` in JSON). """ + + super(Order, self).__init__(jsondict) + + def elementProperties(self): + js = super(Order, self).elementProperties() + js.extend([ + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("detail", "detail", fhirreference.FHIRReference, True, None, True), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("reasonCodeableConcept", "reasonCodeableConcept", codeableconcept.CodeableConcept, False, "reason", False), + ("reasonReference", "reasonReference", fhirreference.FHIRReference, False, "reason", False), + ("source", "source", fhirreference.FHIRReference, False, None, False), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ("target", "target", fhirreference.FHIRReference, False, None, False), + ("when", "when", OrderWhen, False, None, False), + ]) + return js + + +from . import backboneelement + +class OrderWhen(backboneelement.BackboneElement): + """ When order should be fulfilled. + """ + + resource_name = "OrderWhen" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.code = None + """ Code specifies when request should be done. The code may simply be + a priority code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.schedule = None + """ A formal schedule. + Type `Timing` (represented as `dict` in JSON). """ + + super(OrderWhen, self).__init__(jsondict) + + def elementProperties(self): + js = super(OrderWhen, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("schedule", "schedule", timing.Timing, False, None, False), + ]) + return js + + +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier +from . import timing diff --git a/fhirclient/models/DSTU2/order_tests.py b/fhirclient/models/DSTU2/order_tests.py new file mode 100644 index 000000000..5cec1b4eb --- /dev/null +++ b/fhirclient/models/DSTU2/order_tests.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import order +from .fhirdate import FHIRDate + + +class OrderTests(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("Order", js["resourceType"]) + return order.Order(js) + + def testOrder1(self): + inst = self.instantiate_from("order-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Order instance") + self.implOrder1(inst) + + js = inst.as_json() + self.assertEqual("Order", js["resourceType"]) + inst2 = order.Order(js) + self.implOrder1(inst2) + + def implOrder1(self, inst): + self.assertEqual(inst.date.date, FHIRDate("2012-12-28T09:03:04+11:00").date) + self.assertEqual(inst.date.as_json(), "2012-12-28T09:03:04+11:00") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.reasonCodeableConcept.text, "Standard admission testing") + self.assertEqual(inst.text.div, "
Request for Prescription (on patient Donald DUCK @ Acme Healthcare, Inc. MR = 654321)
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.when.code.coding[0].code, "today") + self.assertEqual(inst.when.code.coding[0].system, "http://acme.com/codes/request-priority") + + def testOrder2(self): + inst = self.instantiate_from("order-example-f201-physiotherapy.json") + self.assertIsNotNone(inst, "Must have instantiated a Order instance") + self.implOrder2(inst) + + js = inst.as_json() + self.assertEqual("Order", js["resourceType"]) + inst2 = order.Order(js) + self.implOrder2(inst2) + + def implOrder2(self, inst): + self.assertEqual(inst.date.date, FHIRDate("2013-03-05T12:00:00+01:00").date) + self.assertEqual(inst.date.as_json(), "2013-03-05T12:00:00+01:00") + self.assertEqual(inst.id, "f201") + self.assertEqual(inst.reasonCodeableConcept.text, "It concerns a one-off order for consultation in order to evaluate the stairs walking ability of Roel.") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.when.code.coding[0].code, "394848005") + self.assertEqual(inst.when.code.coding[0].display, "Normal priority") + self.assertEqual(inst.when.code.coding[0].system, "http://snomed.info/sct") + diff --git a/fhirclient/models/DSTU2/orderresponse.py b/fhirclient/models/DSTU2/orderresponse.py new file mode 100644 index 000000000..38f0ee388 --- /dev/null +++ b/fhirclient/models/DSTU2/orderresponse.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/OrderResponse) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class OrderResponse(domainresource.DomainResource): + """ A response to an order. + """ + + resource_name = "OrderResponse" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.date = None + """ When the response was made. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Additional description of the response. + Type `str`. """ + + self.fulfillment = None + """ Details of the outcome of performing the order. + List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + + self.identifier = None + """ Identifiers assigned to this order by the orderer or by the + receiver. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.orderStatus = None + """ pending | review | rejected | error | accepted | cancelled | + replaced | aborted | completed. + Type `str`. """ + + self.request = None + """ The order that this is a response to. + Type `FHIRReference` referencing `Order` (represented as `dict` in JSON). """ + + self.who = None + """ Who made the response. + Type `FHIRReference` referencing `Practitioner, Organization, Device` (represented as `dict` in JSON). """ + + super(OrderResponse, self).__init__(jsondict) + + def elementProperties(self): + js = super(OrderResponse, self).elementProperties() + js.extend([ + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("description", "description", str, False, None, False), + ("fulfillment", "fulfillment", fhirreference.FHIRReference, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("orderStatus", "orderStatus", str, False, None, True), + ("request", "request", fhirreference.FHIRReference, False, None, True), + ("who", "who", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +from . import fhirdate +from . import fhirreference +from . import identifier diff --git a/fhirclient/models/DSTU2/orderresponse_tests.py b/fhirclient/models/DSTU2/orderresponse_tests.py new file mode 100644 index 000000000..14eb3a09c --- /dev/null +++ b/fhirclient/models/DSTU2/orderresponse_tests.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import orderresponse +from .fhirdate import FHIRDate + + +class OrderResponseTests(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("OrderResponse", js["resourceType"]) + return orderresponse.OrderResponse(js) + + def testOrderResponse1(self): + inst = self.instantiate_from("orderresponse-example.json") + self.assertIsNotNone(inst, "Must have instantiated a OrderResponse instance") + self.implOrderResponse1(inst) + + js = inst.as_json() + self.assertEqual("OrderResponse", js["resourceType"]) + inst2 = orderresponse.OrderResponse(js) + self.implOrderResponse1(inst2) + + def implOrderResponse1(self, inst): + self.assertEqual(inst.date.date, FHIRDate("2012-12-28T13:10:56+11:00").date) + self.assertEqual(inst.date.as_json(), "2012-12-28T13:10:56+11:00") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.orderStatus, "completed") + self.assertEqual(inst.text.div, "
Lab Report completed at 13:10 28-Dec 2012
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/organization.py b/fhirclient/models/DSTU2/organization.py new file mode 100644 index 000000000..36286b060 --- /dev/null +++ b/fhirclient/models/DSTU2/organization.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Organization) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Organization(domainresource.DomainResource): + """ A grouping of people or organizations with a common purpose. + + 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. + """ + + resource_name = "Organization" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.active = None + """ Whether the organization's record is still in active use. + Type `bool`. """ + + self.address = None + """ An address for the organization. + List of `Address` items (represented as `dict` in JSON). """ + + self.contact = None + """ Contact for the organization for a certain purpose. + List of `OrganizationContact` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Identifies this organization across multiple systems. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.name = None + """ Name used for the organization. + Type `str`. """ + + self.partOf = None + """ The organization of which this organization forms a part. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.telecom = None + """ A contact detail for the organization. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + self.type = None + """ Kind of organization. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(Organization, self).__init__(jsondict) + + def elementProperties(self): + js = super(Organization, self).elementProperties() + js.extend([ + ("active", "active", bool, False, None, False), + ("address", "address", address.Address, True, None, False), + ("contact", "contact", OrganizationContact, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("name", "name", str, False, None, False), + ("partOf", "partOf", fhirreference.FHIRReference, False, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import backboneelement + +class OrganizationContact(backboneelement.BackboneElement): + """ Contact for the organization for a certain purpose. + """ + + resource_name = "OrganizationContact" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + 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(OrganizationContact, self).__init__(jsondict) + + def elementProperties(self): + js = super(OrganizationContact, 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 + + +from . import address +from . import codeableconcept +from . import contactpoint +from . import fhirreference +from . import humanname +from . import identifier diff --git a/fhirclient/models/DSTU2/organization_tests.py b/fhirclient/models/DSTU2/organization_tests.py new file mode 100644 index 000000000..dbbb07ffc --- /dev/null +++ b/fhirclient/models/DSTU2/organization_tests.py @@ -0,0 +1,325 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import organization +from .fhirdate import FHIRDate + + +class OrganizationTests(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("Organization", js["resourceType"]) + return organization.Organization(js) + + def testOrganization1(self): + inst = self.instantiate_from("organization-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Organization instance") + self.implOrganization1(inst) + + js = inst.as_json() + self.assertEqual("Organization", js["resourceType"]) + inst2 = organization.Organization(js) + self.implOrganization1(inst2) + + def implOrganization1(self, inst): + 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.extension[0].url, "http://hl7.org/fhir/StructureDefinition/organization-alias") + self.assertEqual(inst.extension[0].valueString, "HL7 International") + self.assertEqual(inst.id, "hl7") + self.assertEqual(inst.name, "Health Level Seven International") + 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.text.status, "generated") + + def testOrganization2(self): + inst = self.instantiate_from("organization-example-gastro.json") + self.assertIsNotNone(inst, "Must have instantiated a Organization instance") + self.implOrganization2(inst) + + js = inst.as_json() + self.assertEqual("Organization", js["resourceType"]) + inst2 = organization.Organization(js) + self.implOrganization2(inst2) + + def implOrganization2(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 testOrganization3(self): + inst = self.instantiate_from("organization-example-lab.json") + self.assertIsNotNone(inst, "Must have instantiated a Organization instance") + self.implOrganization3(inst) + + js = inst.as_json() + self.assertEqual("Organization", js["resourceType"]) + inst2 = organization.Organization(js) + self.implOrganization3(inst2) + + def implOrganization3(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.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 testOrganization4(self): + inst = self.instantiate_from("organization-example-f002-burgers-card.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.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.text.status, "generated") + self.assertEqual(inst.type.coding[0].code, "dept") + self.assertEqual(inst.type.coding[0].display, "Hospital Department") + self.assertEqual(inst.type.coding[0].system, "http://hl7.org/fhir/organization-type") + + def testOrganization5(self): + inst = self.instantiate_from("organization-example-f201-aumc.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, "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.contact[0].address.city, "Den helder") + self.assertEqual(inst.contact[0].address.country, "NLD") + self.assertEqual(inst.contact[0].address.line[0], "Walvisbaai 3") + self.assertEqual(inst.contact[0].address.line[1], "Gebouw 2") + self.assertEqual(inst.contact[0].address.postalCode, "2333ZA") + self.assertEqual(inst.contact[0].name.family[0], "Brand") + self.assertEqual(inst.contact[0].name.given[0], "Ronald") + self.assertEqual(inst.contact[0].name.prefix[0], "Prof.Dr.") + self.assertEqual(inst.contact[0].name.text, "Professor Brand") + self.assertEqual(inst.contact[0].name.use, "official") + 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, "+31715269702") + self.assertEqual(inst.id, "f201") + 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.name, "Artis University Medical Center (AUMC)") + 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") + self.assertEqual(inst.type.coding[0].code, "405608006") + self.assertEqual(inst.type.coding[0].display, "Academic Medical Center") + self.assertEqual(inst.type.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.type.coding[1].code, "V6") + self.assertEqual(inst.type.coding[1].display, "University Medical Hospital") + self.assertEqual(inst.type.coding[1].system, "urn:oid:2.16.840.1.113883.2.4.15.1060") + self.assertEqual(inst.type.coding[2].code, "prov") + self.assertEqual(inst.type.coding[2].display, "Healthcare Provider") + self.assertEqual(inst.type.coding[2].system, "http://hl7.org/fhir/organization-type") + + def testOrganization6(self): + inst = self.instantiate_from("organization-example-good-health-care.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, "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.name, "Good Health Clinic") + self.assertEqual(inst.text.status, "generated") + + def testOrganization7(self): + inst = self.instantiate_from("organization-example-f001-burgers.json") + self.assertIsNotNone(inst, "Must have instantiated a Organization instance") + self.implOrganization7(inst) + + js = inst.as_json() + self.assertEqual("Organization", js["resourceType"]) + inst2 = organization.Organization(js) + self.implOrganization7(inst2) + + def implOrganization7(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.telecom[0].system, "phone") + self.assertEqual(inst.telecom[0].use, "work") + self.assertEqual(inst.telecom[0].value, "022-655 2300") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.coding[0].code, "V6") + self.assertEqual(inst.type.coding[0].display, "University Medical Hospital") + self.assertEqual(inst.type.coding[0].system, "urn:oid:2.16.840.1.113883.2.4.15.1060") + self.assertEqual(inst.type.coding[1].code, "prov") + self.assertEqual(inst.type.coding[1].display, "Healthcare Provider") + self.assertEqual(inst.type.coding[1].system, "http://hl7.org/fhir/organization-type") + + 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.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-f203-bumc.json") + self.assertIsNotNone(inst, "Must have instantiated a Organization instance") + self.implOrganization9(inst) + + js = inst.as_json() + self.assertEqual("Organization", js["resourceType"]) + inst2 = organization.Organization(js) + self.implOrganization9(inst2) + + def implOrganization9(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.coding[0].code, "405608006") + self.assertEqual(inst.type.coding[0].display, "Academic Medical Center") + self.assertEqual(inst.type.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.type.coding[1].code, "prov") + self.assertEqual(inst.type.coding[1].system, "http://hl7.org/fhir/organization-type") + + def testOrganization10(self): + inst = self.instantiate_from("organization-example-f003-burgers-ENT.json") + self.assertIsNotNone(inst, "Must have instantiated a Organization instance") + self.implOrganization10(inst) + + js = inst.as_json() + self.assertEqual("Organization", js["resourceType"]) + inst2 = organization.Organization(js) + self.implOrganization10(inst2) + + def implOrganization10(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.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 7654") + 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[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.telecom[0].system, "phone") + self.assertEqual(inst.telecom[0].value, "022-655 6780") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.coding[0].code, "dept") + self.assertEqual(inst.type.coding[0].display, "Hospital Department") + self.assertEqual(inst.type.coding[0].system, "http://hl7.org/fhir/organization-type") + diff --git a/fhirclient/models/DSTU2/parameters.py b/fhirclient/models/DSTU2/parameters.py new file mode 100644 index 000000000..6011ebc98 --- /dev/null +++ b/fhirclient/models/DSTU2/parameters.py @@ -0,0 +1,258 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Parameters) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import resource + +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. + """ + + resource_name = "Parameters" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.parameter = None + """ Operation Parameter. + List of `ParametersParameter` items (represented as `dict` in JSON). """ + + super(Parameters, self).__init__(jsondict) + + def elementProperties(self): + js = super(Parameters, self).elementProperties() + js.extend([ + ("parameter", "parameter", ParametersParameter, True, None, False), + ]) + return js + + +from . import backboneelement + +class ParametersParameter(backboneelement.BackboneElement): + """ Operation Parameter. + + A parameter passed to or received from the operation. + """ + + resource_name = "ParametersParameter" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.name = None + """ Name from the definition. + Type `str`. """ + + self.part = None + """ Named part of a parameter (e.g. Tuple). + List of `ParametersParameter` items (represented as `dict` in JSON). """ + + self.resource = None + """ If parameter is a whole resource. + Type `Resource` (represented as `dict` in JSON). """ + + self.valueAddress = None + """ If parameter is a data type. + Type `Address` (represented as `dict` in JSON). """ + + self.valueAnnotation = None + """ If parameter is a data type. + Type `Annotation` (represented as `dict` in JSON). """ + + self.valueAttachment = None + """ If parameter is a data type. + Type `Attachment` (represented as `dict` in JSON). """ + + self.valueBase64Binary = None + """ If parameter is a data type. + Type `str`. """ + + self.valueBoolean = None + """ If parameter is a data type. + Type `bool`. """ + + self.valueCode = None + """ If parameter is a data type. + Type `str`. """ + + self.valueCodeableConcept = None + """ If parameter is a data type. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueCoding = None + """ If parameter is a data type. + Type `Coding` (represented as `dict` in JSON). """ + + self.valueContactPoint = None + """ If parameter is a data type. + Type `ContactPoint` (represented as `dict` in JSON). """ + + self.valueDate = None + """ If parameter is a data type. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueDateTime = None + """ If parameter is a data type. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueDecimal = None + """ If parameter is a data type. + Type `float`. """ + + self.valueHumanName = None + """ If parameter is a data type. + Type `HumanName` (represented as `dict` in JSON). """ + + self.valueId = None + """ If parameter is a data type. + Type `str`. """ + + self.valueIdentifier = None + """ If parameter is a data type. + Type `Identifier` (represented as `dict` in JSON). """ + + self.valueInstant = None + """ If parameter is a data type. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueInteger = None + """ If parameter is a data type. + Type `int`. """ + + self.valueMarkdown = None + """ 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.valueOid = None + """ If parameter is a data type. + Type `str`. """ + + self.valuePeriod = None + """ If parameter is a data type. + Type `Period` (represented as `dict` in JSON). """ + + self.valuePositiveInt = None + """ If parameter is a data type. + Type `int`. """ + + self.valueQuantity = None + """ If parameter is a data type. + Type `Quantity` (represented as `dict` in JSON). """ + + self.valueRange = None + """ If parameter is a data type. + Type `Range` (represented as `dict` in JSON). """ + + self.valueRatio = None + """ If parameter is a data type. + Type `Ratio` (represented as `dict` in JSON). """ + + self.valueReference = None + """ If parameter is a data type. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.valueSampledData = None + """ If parameter is a data type. + Type `SampledData` (represented as `dict` in JSON). """ + + self.valueSignature = None + """ If parameter is a data type. + Type `Signature` (represented as `dict` in JSON). """ + + self.valueString = None + """ If parameter is a data type. + Type `str`. """ + + self.valueTime = None + """ If parameter is a data type. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueTiming = None + """ If parameter is a data type. + Type `Timing` (represented as `dict` in JSON). """ + + self.valueUnsignedInt = None + """ If parameter is a data type. + Type `int`. """ + + self.valueUri = None + """ If parameter is a data type. + Type `str`. """ + + super(ParametersParameter, self).__init__(jsondict) + + def elementProperties(self): + js = super(ParametersParameter, self).elementProperties() + js.extend([ + ("name", "name", str, False, None, True), + ("part", "part", ParametersParameter, True, None, False), + ("resource", "resource", resource.Resource, False, None, False), + ("valueAddress", "valueAddress", address.Address, False, "value", False), + ("valueAnnotation", "valueAnnotation", annotation.Annotation, False, "value", False), + ("valueAttachment", "valueAttachment", attachment.Attachment, False, "value", False), + ("valueBase64Binary", "valueBase64Binary", str, False, "value", False), + ("valueBoolean", "valueBoolean", bool, False, "value", False), + ("valueCode", "valueCode", str, False, "value", False), + ("valueCodeableConcept", "valueCodeableConcept", codeableconcept.CodeableConcept, False, "value", False), + ("valueCoding", "valueCoding", coding.Coding, False, "value", False), + ("valueContactPoint", "valueContactPoint", contactpoint.ContactPoint, False, "value", False), + ("valueDate", "valueDate", fhirdate.FHIRDate, False, "value", False), + ("valueDateTime", "valueDateTime", fhirdate.FHIRDate, False, "value", False), + ("valueDecimal", "valueDecimal", float, 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), + ("valueOid", "valueOid", str, 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), + ("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), + ("valueUnsignedInt", "valueUnsignedInt", int, False, "value", False), + ("valueUri", "valueUri", str, False, "value", False), + ]) + return js + + +from . import address +from . import annotation +from . import attachment +from . import codeableconcept +from . import coding +from . import contactpoint +from . import fhirdate +from . import fhirreference +from . import humanname +from . import identifier +from . import meta +from . import period +from . import quantity +from . import range +from . import ratio +from . import sampleddata +from . import signature +from . import timing diff --git a/fhirclient/models/DSTU2/parameters_tests.py b/fhirclient/models/DSTU2/parameters_tests.py new file mode 100644 index 000000000..3cacd870e --- /dev/null +++ b/fhirclient/models/DSTU2/parameters_tests.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import parameters +from .fhirdate import FHIRDate + + +class ParametersTests(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("Parameters", js["resourceType"]) + return parameters.Parameters(js) + + def testParameters1(self): + inst = self.instantiate_from("parameters-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Parameters instance") + self.implParameters1(inst) + + js = inst.as_json() + self.assertEqual("Parameters", js["resourceType"]) + inst2 = parameters.Parameters(js) + 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") + diff --git a/fhirclient/models/DSTU2/patient.py b/fhirclient/models/DSTU2/patient.py new file mode 100644 index 000000000..7f6e92b40 --- /dev/null +++ b/fhirclient/models/DSTU2/patient.py @@ -0,0 +1,295 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Patient) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Patient(domainresource.DomainResource): + """ Information about an individual or animal receiving health care services. + + Demographics and other administrative information about an individual or + animal receiving care or other health-related services. + """ + + resource_name = "Patient" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.active = None + """ Whether this patient's record is in active use. + Type `bool`. """ + + self.address = None + """ Addresses 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.careProvider = None + """ Patient's nominated primary care provider. + List of `FHIRReference` items referencing `Organization, Practitioner` (represented as `dict` in JSON). """ + + self.communication = None + """ A list of Languages 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 + """ A contact party (e.g. guardian, partner, friend) for the patient. + List of `PatientContact` items (represented as `dict` in JSON). """ + + self.deceasedBoolean = None + """ Indicates if the individual is deceased or not. + Type `bool`. """ + + self.deceasedDateTime = None + """ Indicates if the individual is deceased or not. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.gender = None + """ male | female | other | unknown. + Type `str`. """ + + self.identifier = None + """ An identifier for this patient. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.link = None + """ Link to another patient resource that concerns the same actual + person. + List of `PatientLink` items (represented as `dict` in JSON). """ + + self.managingOrganization = None + """ Organization that is the custodian of the patient record. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.maritalStatus = None + """ Marital (civil) status of a patient. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.multipleBirthBoolean = None + """ Whether patient is part of a multiple birth. + Type `bool`. """ + + self.multipleBirthInteger = None + """ Whether patient is part of a multiple birth. + Type `int`. """ + + self.name = None + """ A name associated with the patient. + List of `HumanName` items (represented as `dict` in JSON). """ + + self.photo = None + """ Image of the patient. + List of `Attachment` items (represented as `dict` in JSON). """ + + self.telecom = None + """ A contact detail for the individual. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(Patient, self).__init__(jsondict) + + def elementProperties(self): + js = super(Patient, self).elementProperties() + 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), + ("careProvider", "careProvider", fhirreference.FHIRReference, True, None, False), + ("communication", "communication", PatientCommunication, True, None, False), + ("contact", "contact", PatientContact, True, None, False), + ("deceasedBoolean", "deceasedBoolean", bool, False, "deceased", False), + ("deceasedDateTime", "deceasedDateTime", fhirdate.FHIRDate, False, "deceased", False), + ("gender", "gender", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("link", "link", PatientLink, True, None, False), + ("managingOrganization", "managingOrganization", fhirreference.FHIRReference, False, None, False), + ("maritalStatus", "maritalStatus", codeableconcept.CodeableConcept, False, None, False), + ("multipleBirthBoolean", "multipleBirthBoolean", bool, False, "multipleBirth", False), + ("multipleBirthInteger", "multipleBirthInteger", int, False, "multipleBirth", False), + ("name", "name", humanname.HumanName, True, None, False), + ("photo", "photo", attachment.Attachment, True, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ]) + return js + + +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_name = "PatientAnimal" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + 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) + + 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 + her health. + """ + + resource_name = "PatientCommunication" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + 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(PatientCommunication, self).__init__(jsondict) + + def elementProperties(self): + js = super(PatientCommunication, self).elementProperties() + js.extend([ + ("language", "language", codeableconcept.CodeableConcept, False, None, True), + ("preferred", "preferred", bool, False, None, False), + ]) + return js + + +class PatientContact(backboneelement.BackboneElement): + """ A contact party (e.g. guardian, partner, friend) for the patient. + """ + + resource_name = "PatientContact" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.address = None + """ Address for the contact person. + Type `Address` (represented as `dict` in JSON). """ + + self.gender = None + """ male | female | other | unknown. + Type `str`. """ + + self.name = None + """ A name associated with the contact person. + Type `HumanName` (represented as `dict` in JSON). """ + + self.organization = None + """ Organization that is associated with the contact. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.period = None + """ The period during which this contact person or organization is + valid to be contacted relating to this patient. + Type `Period` (represented as `dict` in JSON). """ + + self.relationship = None + """ The kind of relationship. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.telecom = None + """ A contact detail for the person. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(PatientContact, self).__init__(jsondict) + + def elementProperties(self): + js = super(PatientContact, self).elementProperties() + js.extend([ + ("address", "address", address.Address, False, None, False), + ("gender", "gender", str, False, None, False), + ("name", "name", humanname.HumanName, False, None, False), + ("organization", "organization", fhirreference.FHIRReference, False, None, False), + ("period", "period", period.Period, False, None, False), + ("relationship", "relationship", codeableconcept.CodeableConcept, True, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ]) + return js + + +class PatientLink(backboneelement.BackboneElement): + """ Link to another patient resource that concerns the same actual person. + + Link to another patient resource that concerns the same actual patient. + """ + + resource_name = "PatientLink" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.other = None + """ The other patient resource that the link refers to. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.type = None + """ replace | refer | seealso - type of link. + Type `str`. """ + + super(PatientLink, self).__init__(jsondict) + + def elementProperties(self): + js = super(PatientLink, self).elementProperties() + js.extend([ + ("other", "other", fhirreference.FHIRReference, False, None, True), + ("type", "type", str, False, None, True), + ]) + return js + + +from . import address +from . import attachment +from . import codeableconcept +from . import contactpoint +from . import fhirdate +from . import fhirreference +from . import humanname +from . import identifier +from . import period diff --git a/fhirclient/models/DSTU2/patient_tests.py b/fhirclient/models/DSTU2/patient_tests.py new file mode 100644 index 000000000..252e303a6 --- /dev/null +++ b/fhirclient/models/DSTU2/patient_tests.py @@ -0,0 +1,385 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import patient +from .fhirdate import FHIRDate + + +class PatientTests(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("Patient", js["resourceType"]) + return patient.Patient(js) + + def testPatient1(self): + inst = self.instantiate_from("patient-example-xds.json") + self.assertIsNotNone(inst, "Must have instantiated a Patient instance") + self.implPatient1(inst) + + js = inst.as_json() + self.assertEqual("Patient", js["resourceType"]) + inst2 = patient.Patient(js) + self.implPatient1(inst2) + + def implPatient1(self, inst): + self.assertTrue(inst.active) + 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, "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].use, "usual") + self.assertEqual(inst.identifier[0].value, "89765a87b") + self.assertEqual(inst.name[0].family[0], "Doe") + self.assertEqual(inst.name[0].given[0], "John") + self.assertEqual(inst.text.status, "generated") + + def testPatient2(self): + inst = self.instantiate_from("patient-example-f001-pieter.json") + self.assertIsNotNone(inst, "Must have instantiated a Patient instance") + self.implPatient2(inst) + + js = inst.as_json() + self.assertEqual("Patient", js["resourceType"]) + inst2 = patient.Patient(js) + self.implPatient2(inst2) + + def implPatient2(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].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[0], "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, "partner") + self.assertEqual(inst.contact[0].relationship[0].coding[0].system, "http://hl7.org/fhir/patient-contact-relationship") + 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[0], "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-d.json") + self.assertIsNotNone(inst, "Must have instantiated a Patient instance") + self.implPatient3(inst) + + js = inst.as_json() + self.assertEqual("Patient", js["resourceType"]) + inst2 = patient.Patient(js) + self.implPatient3(inst2) + + def implPatient3(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[0], "Notsowell") + self.assertEqual(inst.name[0].given[0], "Sandy") + self.assertEqual(inst.name[0].use, "official") + self.assertEqual(inst.text.status, "generated") + + def testPatient4(self): + inst = self.instantiate_from("patient-example-b.json") + self.assertIsNotNone(inst, "Must have instantiated a Patient instance") + self.implPatient4(inst) + + js = inst.as_json() + self.assertEqual("Patient", js["resourceType"]) + inst2 = patient.Patient(js) + self.implPatient4(inst2) + + def implPatient4(self, inst): + self.assertTrue(inst.active) + 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://hl7.org/fhir/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[0], "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/gif") + self.assertEqual(inst.text.status, "generated") + + def testPatient5(self): + inst = self.instantiate_from("patient-example-c.json") + self.assertIsNotNone(inst, "Must have instantiated a Patient instance") + self.implPatient5(inst) + + js = inst.as_json() + self.assertEqual("Patient", js["resourceType"]) + inst2 = patient.Patient(js) + self.implPatient5(inst2) + + def implPatient5(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.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[0], "Notsowell") + self.assertEqual(inst.name[0].given[0], "Simon") + self.assertEqual(inst.name[0].use, "official") + self.assertEqual(inst.text.status, "generated") + + def testPatient6(self): + inst = self.instantiate_from("patient-example-ihe-pcd.json") + self.assertIsNotNone(inst, "Must have instantiated a Patient instance") + self.implPatient6(inst) + + js = inst.as_json() + self.assertEqual("Patient", js["resourceType"]) + inst2 = patient.Patient(js) + self.implPatient6(inst2) + + def implPatient6(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[0], "BROOKS") + self.assertEqual(inst.name[0].given[0], "ALBERT") + self.assertEqual(inst.text.div, "
Albert Brooks, Id: AB60001
") + self.assertEqual(inst.text.status, "generated") + + def testPatient7(self): + inst = self.instantiate_from("patient-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Patient instance") + self.implPatient7(inst) + + js = inst.as_json() + self.assertEqual("Patient", js["resourceType"]) + inst2 = patient.Patient(js) + self.implPatient7(inst2) + + def implPatient7(self, inst): + self.assertTrue(inst.active) + self.assertEqual(inst.address[0].city, "PleasantVille") + self.assertEqual(inst.address[0].district, "Rainbow") + self.assertEqual(inst.address[0].line[0], "534 Erewhon St") + 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, "3999") + self.assertEqual(inst.address[0].state, "Vic") + 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.assertEqual(inst.contact[0].gender, "female") + self.assertEqual(inst.contact[0].name.family[0], "du") + self.assertEqual(inst.contact[0].name.family[1], "Marché") + self.assertEqual(inst.contact[0].name.given[0], "Bénédicte") + self.assertEqual(inst.contact[0].period.start.date, FHIRDate("2012").date) + self.assertEqual(inst.contact[0].period.start.as_json(), "2012") + self.assertEqual(inst.contact[0].relationship[0].coding[0].code, "partner") + self.assertEqual(inst.contact[0].relationship[0].coding[0].system, "http://hl7.org/fhir/patient-contact-relationship") + self.assertEqual(inst.contact[0].telecom[0].system, "phone") + self.assertEqual(inst.contact[0].telecom[0].value, "+33 (237) 998327") + self.assertFalse(inst.deceasedBoolean) + self.assertEqual(inst.gender, "male") + self.assertEqual(inst.id, "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, "12345") + self.assertEqual(inst.name[0].family[0], "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.name[1].given[0], "Jim") + self.assertEqual(inst.name[1].use, "usual") + 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, "(03) 5555 6473") + self.assertEqual(inst.text.status, "generated") + + def testPatient8(self): + inst = self.instantiate_from("patient-example-proband.json") + self.assertIsNotNone(inst, "Must have instantiated a Patient instance") + self.implPatient8(inst) + + js = inst.as_json() + self.assertEqual("Patient", js["resourceType"]) + inst2 = patient.Patient(js) + self.implPatient8(inst2) + + def implPatient8(self, inst): + self.assertTrue(inst.active) + self.assertEqual(inst.birthDate.date, FHIRDate("1966-04-04").date) + self.assertEqual(inst.birthDate.as_json(), "1966-04-04") + self.assertFalse(inst.deceasedBoolean) + self.assertEqual(inst.extension[0].url, "http://hl7.org/fhir/StructureDefinition/us-core-race") + self.assertEqual(inst.extension[0].valueCodeableConcept.coding[0].code, "2106-3") + self.assertEqual(inst.extension[0].valueCodeableConcept.coding[0].display, "white") + self.assertEqual(inst.extension[0].valueCodeableConcept.coding[0].system, "urn:oid:2.16.840.1.113883.6.238") + self.assertEqual(inst.gender, "female") + self.assertEqual(inst.id, "proband") + self.assertEqual(inst.identifier[0].system, "urn:oid:2.16.840.1.113883.6.117") + self.assertEqual(inst.identifier[0].type.text, "Computer-Stored Abulatory Records (COSTAR)") + self.assertEqual(inst.identifier[0].use, "usual") + self.assertEqual(inst.identifier[0].value, "999999999") + self.assertEqual(inst.text.status, "generated") + + def testPatient9(self): + inst = self.instantiate_from("patient-example-f201-roel.json") + self.assertIsNotNone(inst, "Must have instantiated a Patient instance") + self.implPatient9(inst) + + js = inst.as_json() + self.assertEqual("Patient", js["resourceType"]) + inst2 = patient.Patient(js) + self.implPatient9(inst2) + + 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, "partner") + self.assertEqual(inst.contact[0].relationship[0].coding[1].system, "http://hl7.org/fhir/patient-contact-relationship") + 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[0], "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.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.text.status, "generated") + + def testPatient10(self): + inst = self.instantiate_from("patient-example-xcda.json") + self.assertIsNotNone(inst, "Must have instantiated a Patient instance") + self.implPatient10(inst) + + js = inst.as_json() + self.assertEqual("Patient", js["resourceType"]) + inst2 = patient.Patient(js) + self.implPatient10(inst2) + + def implPatient10(self, inst): + self.assertTrue(inst.active) + self.assertEqual(inst.birthDate.date, FHIRDate("1932-09-24").date) + self.assertEqual(inst.birthDate.as_json(), "1932-09-24") + self.assertEqual(inst.gender, "male") + self.assertEqual(inst.id, "xcda") + self.assertEqual(inst.identifier[0].system, "urn:oid:2.16.840.1.113883.19.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].use, "usual") + self.assertEqual(inst.identifier[0].value, "12345") + self.assertEqual(inst.name[0].family[0], "Levin") + self.assertEqual(inst.name[0].given[0], "Henry") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/paymentnotice.py b/fhirclient/models/DSTU2/paymentnotice.py new file mode 100644 index 000000000..055cdb6f3 --- /dev/null +++ b/fhirclient/models/DSTU2/paymentnotice.py @@ -0,0 +1,85 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/PaymentNotice) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class PaymentNotice(domainresource.DomainResource): + """ PaymentNotice request. + + This resource provides the status of the payment for goods and services + rendered, and the request and response resource references. + """ + + resource_name = "PaymentNotice" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.created = None + """ Creation date. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.identifier = None + """ Business Identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.organization = None + """ Responsible organization. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.originalRuleset = None + """ Original version. + Type `Coding` (represented as `dict` in JSON). """ + + self.paymentStatus = None + """ Status of the payment. + Type `Coding` (represented as `dict` in JSON). """ + + self.provider = None + """ Responsible practitioner. + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + self.request = None + """ Request reference. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.response = None + """ Response reference. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.ruleset = None + """ Resource version. + Type `Coding` (represented as `dict` in JSON). """ + + self.target = None + """ Insurer or Regulatory body. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + super(PaymentNotice, self).__init__(jsondict) + + def elementProperties(self): + js = super(PaymentNotice, self).elementProperties() + js.extend([ + ("created", "created", fhirdate.FHIRDate, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("organization", "organization", fhirreference.FHIRReference, False, None, False), + ("originalRuleset", "originalRuleset", coding.Coding, False, None, False), + ("paymentStatus", "paymentStatus", coding.Coding, False, None, True), + ("provider", "provider", fhirreference.FHIRReference, False, None, False), + ("request", "request", fhirreference.FHIRReference, False, None, False), + ("response", "response", fhirreference.FHIRReference, False, None, False), + ("ruleset", "ruleset", coding.Coding, False, None, False), + ("target", "target", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +from . import coding +from . import fhirdate +from . import fhirreference +from . import identifier diff --git a/fhirclient/models/DSTU2/paymentnotice_tests.py b/fhirclient/models/DSTU2/paymentnotice_tests.py new file mode 100644 index 000000000..400b22ff2 --- /dev/null +++ b/fhirclient/models/DSTU2/paymentnotice_tests.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import paymentnotice +from .fhirdate import FHIRDate + + +class PaymentNoticeTests(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("PaymentNotice", js["resourceType"]) + return paymentnotice.PaymentNotice(js) + + def testPaymentNotice1(self): + inst = self.instantiate_from("paymentnotice-example.json") + self.assertIsNotNone(inst, "Must have instantiated a PaymentNotice instance") + self.implPaymentNotice1(inst) + + js = inst.as_json() + self.assertEqual("PaymentNotice", js["resourceType"]) + inst2 = paymentnotice.PaymentNotice(js) + self.implPaymentNotice1(inst2) + + def implPaymentNotice1(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, "77654") + self.assertEqual(inst.identifier[0].system, "http://benefitsinc.com/paymentnotice") + self.assertEqual(inst.identifier[0].value, "776543") + self.assertEqual(inst.paymentStatus.code, "paid") + self.assertEqual(inst.paymentStatus.system, "http://hl7.org/fhir/paymentstatus") + self.assertEqual(inst.text.div, "
A human-readable rendering of the PaymentNotice
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/paymentreconciliation.py b/fhirclient/models/DSTU2/paymentreconciliation.py new file mode 100644 index 000000000..e402e0aed --- /dev/null +++ b/fhirclient/models/DSTU2/paymentreconciliation.py @@ -0,0 +1,201 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/PaymentReconciliation) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class PaymentReconciliation(domainresource.DomainResource): + """ PaymentReconciliation resource. + + This resource provides payment details and claim references supporting a + bulk payment. + """ + + resource_name = "PaymentReconciliation" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.created = None + """ Creation date. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.detail = None + """ Details. + List of `PaymentReconciliationDetail` items (represented as `dict` in JSON). """ + + self.disposition = None + """ Disposition Message. + Type `str`. """ + + self.form = None + """ Printed Form Identifier. + Type `Coding` (represented as `dict` in JSON). """ + + self.identifier = None + """ Business Identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.note = None + """ Note text. + List of `PaymentReconciliationNote` items (represented as `dict` in JSON). """ + + self.organization = None + """ Insurer. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.originalRuleset = None + """ Original version. + Type `Coding` (represented as `dict` in JSON). """ + + self.outcome = None + """ complete | error. + Type `str`. """ + + self.period = None + """ Period covered. + Type `Period` (represented as `dict` in JSON). """ + + self.request = None + """ Claim reference. + Type `FHIRReference` referencing `ProcessRequest` (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.ruleset = None + """ Resource version. + Type `Coding` (represented as `dict` in JSON). """ + + self.total = None + """ Total amount of Payment. + Type `Quantity` referencing `Money` (represented as `dict` in JSON). """ + + super(PaymentReconciliation, self).__init__(jsondict) + + def elementProperties(self): + js = super(PaymentReconciliation, self).elementProperties() + js.extend([ + ("created", "created", fhirdate.FHIRDate, False, None, False), + ("detail", "detail", PaymentReconciliationDetail, True, None, False), + ("disposition", "disposition", str, False, None, False), + ("form", "form", coding.Coding, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("note", "note", PaymentReconciliationNote, True, None, False), + ("organization", "organization", fhirreference.FHIRReference, False, None, False), + ("originalRuleset", "originalRuleset", coding.Coding, False, None, False), + ("outcome", "outcome", str, False, None, False), + ("period", "period", period.Period, False, None, False), + ("request", "request", fhirreference.FHIRReference, False, None, False), + ("requestOrganization", "requestOrganization", fhirreference.FHIRReference, False, None, False), + ("requestProvider", "requestProvider", fhirreference.FHIRReference, False, None, False), + ("ruleset", "ruleset", coding.Coding, False, None, False), + ("total", "total", quantity.Quantity, False, None, True), + ]) + return js + + +from . import backboneelement + +class PaymentReconciliationDetail(backboneelement.BackboneElement): + """ Details. + + List of individual settlement amounts and the corresponding transaction. + """ + + resource_name = "PaymentReconciliationDetail" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.amount = None + """ Detail amount. + Type `Quantity` referencing `Money` (represented as `dict` in JSON). """ + + self.date = None + """ Invoice date. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.payee = None + """ Payee. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.request = None + """ Claim. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.responce = None + """ Claim Response. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.submitter = None + """ Submitter. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.type = None + """ Type code. + Type `Coding` (represented as `dict` in JSON). """ + + super(PaymentReconciliationDetail, self).__init__(jsondict) + + def elementProperties(self): + js = super(PaymentReconciliationDetail, self).elementProperties() + js.extend([ + ("amount", "amount", quantity.Quantity, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("payee", "payee", fhirreference.FHIRReference, False, None, False), + ("request", "request", fhirreference.FHIRReference, False, None, False), + ("responce", "responce", fhirreference.FHIRReference, False, None, False), + ("submitter", "submitter", fhirreference.FHIRReference, False, None, False), + ("type", "type", coding.Coding, False, None, True), + ]) + return js + + +class PaymentReconciliationNote(backboneelement.BackboneElement): + """ Note text. + + Suite of notes. + """ + + resource_name = "PaymentReconciliationNote" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.text = None + """ Notes text. + Type `str`. """ + + self.type = None + """ display | print | printoper. + Type `Coding` (represented as `dict` in JSON). """ + + super(PaymentReconciliationNote, self).__init__(jsondict) + + def elementProperties(self): + js = super(PaymentReconciliationNote, self).elementProperties() + js.extend([ + ("text", "text", str, False, None, False), + ("type", "type", coding.Coding, False, None, False), + ]) + return js + + +from . import coding +from . import fhirdate +from . import fhirreference +from . import identifier +from . import period +from . import quantity diff --git a/fhirclient/models/DSTU2/paymentreconciliation_tests.py b/fhirclient/models/DSTU2/paymentreconciliation_tests.py new file mode 100644 index 000000000..ed2df4fe3 --- /dev/null +++ b/fhirclient/models/DSTU2/paymentreconciliation_tests.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import paymentreconciliation +from .fhirdate import FHIRDate + + +class PaymentReconciliationTests(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("PaymentReconciliation", js["resourceType"]) + return paymentreconciliation.PaymentReconciliation(js) + + def testPaymentReconciliation1(self): + inst = self.instantiate_from("paymentreconciliation-example.json") + self.assertIsNotNone(inst, "Must have instantiated a PaymentReconciliation instance") + self.implPaymentReconciliation1(inst) + + js = inst.as_json() + self.assertEqual("PaymentReconciliation", js["resourceType"]) + inst2 = paymentreconciliation.PaymentReconciliation(js) + self.implPaymentReconciliation1(inst2) + + 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].date.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.detail[0].date.as_json(), "2014-08-16") + self.assertEqual(inst.detail[0].type.code, "payment") + self.assertEqual(inst.detail[0].type.system, "http://hl7.org/fhir/paymenttype") + self.assertEqual(inst.detail[1].amount.code, "USD") + self.assertEqual(inst.detail[1].amount.system, "urn:iso:std:iso:4217") + 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].type.code, "payment") + self.assertEqual(inst.detail[1].type.system, "http://hl7.org/fhir/paymenttype") + self.assertEqual(inst.detail[2].amount.code, "USD") + self.assertEqual(inst.detail[2].amount.system, "urn:iso:std:iso:4217") + 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].type.code, "advance") + self.assertEqual(inst.detail[2].type.system, "http://hl7.org/fhir/paymenttype") + self.assertEqual(inst.disposition, "2014 August mid-month settlement.") + 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, "complete") + 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/DSTU2/period.py b/fhirclient/models/DSTU2/period.py new file mode 100644 index 000000000..d305719c5 --- /dev/null +++ b/fhirclient/models/DSTU2/period.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Period) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Period(element.Element): + """ Time range defined by start and end date/time. + + A time period defined by a start and end date and optionally time. + """ + + resource_name = "Period" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.end = None + """ End time with inclusive boundary, if not ongoing. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.start = None + """ Starting time with inclusive boundary. + Type `FHIRDate` (represented as `str` in JSON). """ + + super(Period, self).__init__(jsondict) + + def elementProperties(self): + js = super(Period, self).elementProperties() + js.extend([ + ("end", "end", fhirdate.FHIRDate, False, None, False), + ("start", "start", fhirdate.FHIRDate, False, None, False), + ]) + return js + + +from . import fhirdate diff --git a/fhirclient/models/DSTU2/person.py b/fhirclient/models/DSTU2/person.py new file mode 100644 index 000000000..f1e07b8e6 --- /dev/null +++ b/fhirclient/models/DSTU2/person.py @@ -0,0 +1,119 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Person) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Person(domainresource.DomainResource): + """ A generic person record. + + Demographics and administrative information about a person independent of a + specific health-related context. + """ + + resource_name = "Person" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.active = None + """ This person's record is in active use. + Type `bool`. """ + + self.address = None + """ One or more addresses for the person. + List of `Address` items (represented as `dict` in JSON). """ + + self.birthDate = None + """ The date on which the person was born. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.gender = None + """ male | female | other | unknown. + Type `str`. """ + + self.identifier = None + """ A human identifier for this person. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.link = None + """ Link to a resource that concerns the same actual person. + List of `PersonLink` items (represented as `dict` in JSON). """ + + self.managingOrganization = None + """ The organization that is the custodian of the person record. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.name = None + """ A name associated with the person. + List of `HumanName` items (represented as `dict` in JSON). """ + + self.photo = None + """ Image of the person. + Type `Attachment` (represented as `dict` in JSON). """ + + self.telecom = None + """ A contact detail for the person. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(Person, self).__init__(jsondict) + + def elementProperties(self): + js = super(Person, self).elementProperties() + js.extend([ + ("active", "active", bool, False, None, False), + ("address", "address", address.Address, True, None, False), + ("birthDate", "birthDate", fhirdate.FHIRDate, False, None, False), + ("gender", "gender", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("link", "link", PersonLink, True, None, False), + ("managingOrganization", "managingOrganization", fhirreference.FHIRReference, False, None, False), + ("name", "name", humanname.HumanName, True, None, False), + ("photo", "photo", attachment.Attachment, False, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ]) + return js + + +from . import backboneelement + +class PersonLink(backboneelement.BackboneElement): + """ Link to a resource that concerns the same actual person. + """ + + resource_name = "PersonLink" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.assurance = None + """ level1 | level2 | level3 | level4. + Type `str`. """ + + self.target = None + """ The resource to which this actual person is associated. + Type `FHIRReference` referencing `Patient, Practitioner, RelatedPerson, Person` (represented as `dict` in JSON). """ + + super(PersonLink, self).__init__(jsondict) + + def elementProperties(self): + js = super(PersonLink, self).elementProperties() + js.extend([ + ("assurance", "assurance", str, False, None, False), + ("target", "target", fhirreference.FHIRReference, False, None, True), + ]) + return js + + +from . import address +from . import attachment +from . import contactpoint +from . import fhirdate +from . import fhirreference +from . import humanname +from . import identifier diff --git a/fhirclient/models/DSTU2/person_tests.py b/fhirclient/models/DSTU2/person_tests.py new file mode 100644 index 000000000..0ffdf961c --- /dev/null +++ b/fhirclient/models/DSTU2/person_tests.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import person +from .fhirdate import FHIRDate + + +class PersonTests(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("Person", js["resourceType"]) + return person.Person(js) + + def testPerson1(self): + inst = self.instantiate_from("person-example-f002-ariadne.json") + self.assertIsNotNone(inst, "Must have instantiated a Person instance") + self.implPerson1(inst) + + js = inst.as_json() + self.assertEqual("Person", js["resourceType"]) + inst2 = person.Person(js) + self.implPerson1(inst2) + + def implPerson1(self, inst): + self.assertTrue(inst.active) + 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.name[0].use, "usual") + self.assertEqual(inst.photo.contentType, "image/jpeg") + 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") + + def testPerson2(self): + inst = self.instantiate_from("person-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Person instance") + self.implPerson2(inst) + + js = inst.as_json() + self.assertEqual("Person", js["resourceType"]) + inst2 = person.Person(js) + self.implPerson2(inst2) + + def implPerson2(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.birthDate.date, FHIRDate("1974-12-25").date) + self.assertEqual(inst.birthDate.as_json(), "1974-12-25") + self.assertEqual(inst.gender, "male") + self.assertEqual(inst.id, "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, "12345") + self.assertEqual(inst.name[0].family[0], "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.name[1].given[0], "Jim") + self.assertEqual(inst.name[1].use, "usual") + 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, "(03) 5555 6473") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/practitioner.py b/fhirclient/models/DSTU2/practitioner.py new file mode 100644 index 000000000..a8a33834a --- /dev/null +++ b/fhirclient/models/DSTU2/practitioner.py @@ -0,0 +1,190 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Practitioner) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Practitioner(domainresource.DomainResource): + """ A person with a formal responsibility in the provisioning of healthcare or + related services. + + A person who is directly or indirectly involved in the provisioning of + healthcare. + """ + + resource_name = "Practitioner" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.active = None + """ Whether this practitioner's record is in active use. + Type `bool`. """ + + self.address = None + """ Where practitioner can be found/visited. + List of `Address` items (represented as `dict` in JSON). """ + + self.birthDate = None + """ The date on which the practitioner was born. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.communication = None + """ A language the practitioner is able to use in patient communication. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.gender = None + """ male | female | other | unknown. + Type `str`. """ + + self.identifier = None + """ A identifier for the person as this agent. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.name = None + """ A name associated with the person. + Type `HumanName` (represented as `dict` in JSON). """ + + self.photo = None + """ Image of the person. + List of `Attachment` items (represented as `dict` in JSON). """ + + self.practitionerRole = None + """ Roles/organizations the practitioner is associated with. + List of `PractitionerPractitionerRole` items (represented as `dict` in JSON). """ + + self.qualification = None + """ Qualifications obtained by training and certification. + List of `PractitionerQualification` items (represented as `dict` in JSON). """ + + self.telecom = None + """ A contact detail for the practitioner. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(Practitioner, self).__init__(jsondict) + + def elementProperties(self): + js = super(Practitioner, self).elementProperties() + js.extend([ + ("active", "active", bool, False, None, False), + ("address", "address", address.Address, True, None, False), + ("birthDate", "birthDate", fhirdate.FHIRDate, False, None, False), + ("communication", "communication", codeableconcept.CodeableConcept, True, None, False), + ("gender", "gender", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("name", "name", humanname.HumanName, False, None, False), + ("photo", "photo", attachment.Attachment, True, None, False), + ("practitionerRole", "practitionerRole", PractitionerPractitionerRole, True, None, False), + ("qualification", "qualification", PractitionerQualification, True, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ]) + return js + + +from . import backboneelement + +class PractitionerPractitionerRole(backboneelement.BackboneElement): + """ Roles/organizations the practitioner is associated with. + + The list of roles/organizations that the practitioner is associated with. + """ + + resource_name = "PractitionerPractitionerRole" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + 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). """ + + self.location = None + """ The location(s) at which this practitioner provides care. + List of `FHIRReference` items referencing `Location` (represented as `dict` in JSON). """ + + self.managingOrganization = None + """ Organization where the roles are performed. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.period = None + """ The period during which the practitioner is authorized to perform + in these role(s). + Type `Period` (represented as `dict` in JSON). """ + + self.role = None + """ Roles which this practitioner may perform. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.specialty = None + """ Specific specialty of the practitioner. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(PractitionerPractitionerRole, self).__init__(jsondict) + + def elementProperties(self): + js = super(PractitionerPractitionerRole, self).elementProperties() + js.extend([ + ("healthcareService", "healthcareService", fhirreference.FHIRReference, True, None, False), + ("location", "location", fhirreference.FHIRReference, True, None, False), + ("managingOrganization", "managingOrganization", fhirreference.FHIRReference, False, None, False), + ("period", "period", period.Period, False, None, False), + ("role", "role", codeableconcept.CodeableConcept, False, None, False), + ("specialty", "specialty", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +class PractitionerQualification(backboneelement.BackboneElement): + """ Qualifications obtained by training and certification. + """ + + resource_name = "PractitionerQualification" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.code = None + """ Coded representation of the qualification. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.identifier = None + """ An identifier for this qualification for the practitioner. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.issuer = None + """ Organization that regulates and issues the qualification. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.period = None + """ Period during which the qualification is valid. + Type `Period` (represented as `dict` in JSON). """ + + super(PractitionerQualification, self).__init__(jsondict) + + def elementProperties(self): + js = super(PractitionerQualification, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("issuer", "issuer", fhirreference.FHIRReference, False, None, False), + ("period", "period", period.Period, False, None, False), + ]) + return js + + +from . import address +from . import attachment +from . import codeableconcept +from . import contactpoint +from . import fhirdate +from . import fhirreference +from . import humanname +from . import identifier +from . import period diff --git a/fhirclient/models/DSTU2/practitioner_tests.py b/fhirclient/models/DSTU2/practitioner_tests.py new file mode 100644 index 000000000..46c2cda62 --- /dev/null +++ b/fhirclient/models/DSTU2/practitioner_tests.py @@ -0,0 +1,414 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import practitioner +from .fhirdate import FHIRDate + + +class PractitionerTests(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("Practitioner", js["resourceType"]) + return practitioner.Practitioner(js) + + def testPractitioner1(self): + inst = self.instantiate_from("practitioner-example-f203-jvg.json") + self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") + self.implPractitioner1(inst) + + js = inst.as_json() + self.assertEqual("Practitioner", js["resourceType"]) + inst2 = practitioner.Practitioner(js) + self.implPractitioner1(inst2) + + def implPractitioner1(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.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.text, "Juri van Gelder") + self.assertEqual(inst.name.use, "official") + self.assertEqual(inst.practitionerRole[0].role.coding[0].code, "36682004") + self.assertEqual(inst.practitionerRole[0].role.coding[0].display, "Physical therapist") + self.assertEqual(inst.practitionerRole[0].role.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.practitionerRole[0].specialty[0].coding[0].code, "410158009") + self.assertEqual(inst.practitionerRole[0].specialty[0].coding[0].display, "Assess physical therapist service") + self.assertEqual(inst.practitionerRole[0].specialty[0].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 testPractitioner2(self): + inst = self.instantiate_from("practitioner-example-f201-ab.json") + self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") + self.implPractitioner2(inst) + + js = inst.as_json() + self.assertEqual("Practitioner", js["resourceType"]) + inst2 = practitioner.Practitioner(js) + self.implPractitioner2(inst2) + + def implPractitioner2(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.family[0], "Bronsig") + self.assertEqual(inst.name.given[0], "Arend") + self.assertEqual(inst.name.prefix[0], "Dr.") + self.assertEqual(inst.name.text, "Dokter Bronsig") + self.assertEqual(inst.name.use, "official") + self.assertEqual(inst.practitionerRole[0].role.coding[0].code, "225304007") + self.assertEqual(inst.practitionerRole[0].role.coding[0].display, "Implementation of planned interventions") + self.assertEqual(inst.practitionerRole[0].role.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.practitionerRole[0].specialty[0].coding[0].code, "310512001") + self.assertEqual(inst.practitionerRole[0].specialty[0].coding[0].display, "Medical oncologist") + self.assertEqual(inst.practitionerRole[0].specialty[0].coding[0].system, "http://snomed.info/sct") + 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 testPractitioner3(self): + inst = self.instantiate_from("practitioner-example-f202-lm.json") + self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") + self.implPractitioner3(inst) + + js = inst.as_json() + self.assertEqual("Practitioner", js["resourceType"]) + inst2 = practitioner.Practitioner(js) + self.implPractitioner3(inst2) + + def implPractitioner3(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.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.family[0], "Maas") + self.assertEqual(inst.name.given[0], "Luigi") + self.assertEqual(inst.name.prefix[0], "Dr.") + self.assertEqual(inst.name.text, "Luigi Maas") + self.assertEqual(inst.name.use, "official") + self.assertEqual(inst.practitionerRole[0].role.coding[0].code, "33526004") + self.assertEqual(inst.practitionerRole[0].role.coding[0].display, "Electronic laboratory reporting") + self.assertEqual(inst.practitionerRole[0].role.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.practitionerRole[0].specialty[0].coding[0].code, "159285000") + self.assertEqual(inst.practitionerRole[0].specialty[0].coding[0].display, "Medical laboratory technician") + self.assertEqual(inst.practitionerRole[0].specialty[0].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 testPractitioner4(self): + inst = self.instantiate_from("practitioner-example-xcda-author.json") + self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") + self.implPractitioner4(inst) + + js = inst.as_json() + self.assertEqual("Practitioner", js["resourceType"]) + inst2 = practitioner.Practitioner(js) + self.implPractitioner4(inst2) + + def implPractitioner4(self, inst): + self.assertEqual(inst.id, "xcda-author") + self.assertEqual(inst.name.family[0], "Hippocrates") + self.assertEqual(inst.name.given[0], "Harold") + self.assertEqual(inst.name.suffix[0], "MD") + self.assertEqual(inst.text.status, "generated") + + def testPractitioner5(self): + inst = self.instantiate_from("practitioner-example-f003-mv.json") + self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") + self.implPractitioner5(inst) + + js = inst.as_json() + self.assertEqual("Practitioner", js["resourceType"]) + inst2 = practitioner.Practitioner(js) + self.implPractitioner5(inst2) + + 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 91") + self.assertEqual(inst.address[0].postalCode, "1105 AZ") + 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.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, "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.family[0], "Versteegh") + self.assertEqual(inst.name.given[0], "Marc") + self.assertEqual(inst.name.suffix[0], "MD") + self.assertEqual(inst.name.use, "official") + self.assertEqual(inst.practitionerRole[0].role.coding[0].code, "01.000") + self.assertEqual(inst.practitionerRole[0].role.coding[0].display, "Arts") + self.assertEqual(inst.practitionerRole[0].role.coding[0].system, "urn:oid:2.16.840.1.113883.2.4.15.111") + self.assertEqual(inst.practitionerRole[0].role.text, "Care role") + self.assertEqual(inst.practitionerRole[0].specialty[0].coding[0].code, "01.011") + self.assertEqual(inst.practitionerRole[0].specialty[0].coding[0].display, "Cardiothoracal surgery") + self.assertEqual(inst.practitionerRole[0].specialty[0].coding[0].system, "urn:oid:2.16.840.1.113883.2.4.15.111") + self.assertEqual(inst.practitionerRole[0].specialty[0].text, "specialization") + 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.text.status, "generated") + + def testPractitioner6(self): + inst = self.instantiate_from("practitioner-example-f002-pv.json") + self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") + self.implPractitioner6(inst) + + js = inst.as_json() + self.assertEqual("Practitioner", js["resourceType"]) + inst2 = practitioner.Practitioner(js) + self.implPractitioner6(inst2) + + def implPractitioner6(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.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, "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, "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.family[0], "Voigt") + self.assertEqual(inst.name.given[0], "Pieter") + self.assertEqual(inst.name.suffix[0], "MD") + self.assertEqual(inst.name.use, "official") + self.assertEqual(inst.practitionerRole[0].role.coding[0].code, "01.000") + self.assertEqual(inst.practitionerRole[0].role.coding[0].display, "Arts") + self.assertEqual(inst.practitionerRole[0].role.coding[0].system, "urn:oid:2.16.840.1.113883.2.4.15.111") + self.assertEqual(inst.practitionerRole[0].role.text, "Care role") + self.assertEqual(inst.practitionerRole[0].specialty[0].coding[0].code, "01.011") + self.assertEqual(inst.practitionerRole[0].specialty[0].coding[0].display, "Cardiothoracal surgery") + self.assertEqual(inst.practitionerRole[0].specialty[0].coding[0].system, "urn:oid:2.16.840.1.113883.2.4.15.111") + self.assertEqual(inst.practitionerRole[0].specialty[0].text, "specialization") + 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.text.status, "generated") + + def testPractitioner7(self): + inst = self.instantiate_from("practitioner-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") + self.implPractitioner7(inst) + + js = inst.as_json() + self.assertEqual("Practitioner", js["resourceType"]) + inst2 = practitioner.Practitioner(js) + self.implPractitioner7(inst2) + + def implPractitioner7(self, inst): + self.assertTrue(inst.active) + 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.name.family[0], "Careful") + self.assertEqual(inst.name.given[0], "Adam") + self.assertEqual(inst.name.prefix[0], "Dr") + self.assertEqual(inst.practitionerRole[0].period.end.date, FHIRDate("2012-03-31").date) + self.assertEqual(inst.practitionerRole[0].period.end.as_json(), "2012-03-31") + self.assertEqual(inst.practitionerRole[0].period.start.date, FHIRDate("2012-01-01").date) + self.assertEqual(inst.practitionerRole[0].period.start.as_json(), "2012-01-01") + self.assertEqual(inst.practitionerRole[0].role.coding[0].code, "RP") + self.assertEqual(inst.practitionerRole[0].role.coding[0].system, "http://hl7.org/fhir/v2/0286") + 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") + self.assertEqual(inst.address[0].postalCode, "9105 PZ") + self.assertEqual(inst.address[0].use, "work") + self.assertEqual(inst.birthDate.date, FHIRDate("1971-11-07").date) + self.assertEqual(inst.birthDate.as_json(), "1971-11-07") + self.assertEqual(inst.gender, "female") + self.assertEqual(inst.id, "f007") + 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, "874635264") + 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.name.family[0], "Heps") + self.assertEqual(inst.name.given[0], "Simone") + self.assertEqual(inst.name.suffix[0], "MD") + self.assertEqual(inst.name.use, "official") + self.assertEqual(inst.practitionerRole[0].role.coding[0].code, "01.000") + self.assertEqual(inst.practitionerRole[0].role.coding[0].display, "Arts") + self.assertEqual(inst.practitionerRole[0].role.coding[0].system, "urn:oid:2.16.840.1.113883.2.4.15.111") + self.assertEqual(inst.practitionerRole[0].role.text, "Care role") + self.assertEqual(inst.practitionerRole[0].specialty[0].coding[0].code, "01.015") + self.assertEqual(inst.practitionerRole[0].specialty[0].coding[0].display, "Physician") + self.assertEqual(inst.practitionerRole[0].specialty[0].coding[0].system, "urn:oid:2.16.840.1.113883.2.4.15.111") + self.assertEqual(inst.practitionerRole[0].specialty[0].text, "specialization") + self.assertEqual(inst.telecom[0].system, "phone") + self.assertEqual(inst.telecom[0].use, "work") + self.assertEqual(inst.telecom[0].value, "020556936") + self.assertEqual(inst.telecom[1].system, "email") + self.assertEqual(inst.telecom[1].use, "work") + self.assertEqual(inst.telecom[1].value, "S.M.Heps@bmc.nl") + self.assertEqual(inst.telecom[2].system, "fax") + self.assertEqual(inst.telecom[2].use, "work") + self.assertEqual(inst.telecom[2].value, "0205669283") + self.assertEqual(inst.text.status, "generated") + + def testPractitioner9(self): + inst = self.instantiate_from("practitioner-example-f204-ce.json") + self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") + self.implPractitioner9(inst) + + js = inst.as_json() + self.assertEqual("Practitioner", js["resourceType"]) + inst2 = practitioner.Practitioner(js) + self.implPractitioner9(inst2) + + def implPractitioner9(self, inst): + 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("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, "12345678904") + self.assertEqual(inst.name.text, "Carla Espinosa") + self.assertEqual(inst.name.use, "usual") + self.assertEqual(inst.practitionerRole[0].role.coding[0].code, "224565004") + self.assertEqual(inst.practitionerRole[0].role.coding[0].display, "Renal nurse") + self.assertEqual(inst.practitionerRole[0].role.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.practitionerRole[0].specialty[0].coding[0].code, "9632001") + self.assertEqual(inst.practitionerRole[0].specialty[0].coding[0].display, "Nursing procedure") + self.assertEqual(inst.practitionerRole[0].specialty[0].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, "+31715262169") + self.assertEqual(inst.text.status, "generated") + + def testPractitioner10(self): + inst = self.instantiate_from("practitioner-example-xcda1.json") + self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") + self.implPractitioner10(inst) + + js = inst.as_json() + self.assertEqual("Practitioner", js["resourceType"]) + inst2 = practitioner.Practitioner(js) + self.implPractitioner10(inst2) + + def implPractitioner10(self, inst): + 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, "D234123") + self.assertEqual(inst.name.family[0], "Dopplemeyer") + self.assertEqual(inst.name.given[0], "Sherry") + self.assertEqual(inst.practitionerRole[0].role.text, "Primary Surgon") + self.assertEqual(inst.practitionerRole[0].specialty[0].text, "Orthopedic") + 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/DSTU2/procedure.py b/fhirclient/models/DSTU2/procedure.py new file mode 100644 index 000000000..158448cab --- /dev/null +++ b/fhirclient/models/DSTU2/procedure.py @@ -0,0 +1,219 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Procedure) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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. + """ + + resource_name = "Procedure" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.bodySite = None + """ Target body sites. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.category = None + """ Classification of the procedure. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.code = None + """ Identification of the procedure. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.complication = None + """ Complication following the procedure. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.encounter = None + """ The encounter associated with the procedure. + Type `FHIRReference` referencing `Encounter` (represented as `dict` in JSON). """ + + self.focalDevice = None + """ Device changed in procedure. + List of `ProcedureFocalDevice` items (represented as `dict` in JSON). """ + + self.followUp = None + """ Instructions for follow up. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.identifier = None + """ 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.notPerformed = None + """ True if procedure was not performed as scheduled. + Type `bool`. """ + + self.notes = None + """ Additional information about the procedure. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.outcome = None + """ The result of procedure. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.performedDateTime = None + """ Date/Period the procedure was performed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.performedPeriod = None + """ Date/Period the procedure was performed. + Type `Period` (represented as `dict` in JSON). """ + + self.performer = None + """ The people who performed the procedure. + List of `ProcedurePerformer` items (represented as `dict` in JSON). """ + + self.reasonCodeableConcept = None + """ Reason procedure performed. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.reasonNotPerformed = None + """ Reason procedure was not performed. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.reasonReference = None + """ Reason procedure performed. + Type `FHIRReference` referencing `Condition` (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). """ + + self.request = None + """ A request for this procedure. + Type `FHIRReference` referencing `CarePlan, DiagnosticOrder, ProcedureRequest, ReferralRequest` (represented as `dict` in JSON). """ + + self.status = None + """ in-progress | aborted | completed | entered-in-error. + Type `str`. """ + + self.subject = None + """ Who the procedure was performed on. + Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ + + self.used = None + """ Items used during procedure. + List of `FHIRReference` items referencing `Device, Medication, Substance` (represented as `dict` in JSON). """ + + super(Procedure, self).__init__(jsondict) + + def elementProperties(self): + js = super(Procedure, self).elementProperties() + js.extend([ + ("bodySite", "bodySite", codeableconcept.CodeableConcept, True, None, False), + ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("complication", "complication", codeableconcept.CodeableConcept, 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), + ("location", "location", fhirreference.FHIRReference, False, None, False), + ("notPerformed", "notPerformed", bool, False, None, False), + ("notes", "notes", annotation.Annotation, True, None, False), + ("outcome", "outcome", codeableconcept.CodeableConcept, False, None, False), + ("performedDateTime", "performedDateTime", fhirdate.FHIRDate, False, "performed", False), + ("performedPeriod", "performedPeriod", period.Period, False, "performed", False), + ("performer", "performer", ProcedurePerformer, True, None, False), + ("reasonCodeableConcept", "reasonCodeableConcept", codeableconcept.CodeableConcept, False, "reason", False), + ("reasonNotPerformed", "reasonNotPerformed", codeableconcept.CodeableConcept, True, None, False), + ("reasonReference", "reasonReference", fhirreference.FHIRReference, False, "reason", False), + ("report", "report", fhirreference.FHIRReference, True, None, False), + ("request", "request", fhirreference.FHIRReference, False, None, False), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, True), + ("used", "used", fhirreference.FHIRReference, True, None, False), + ]) + return js + + +from . import backboneelement + +class ProcedureFocalDevice(backboneelement.BackboneElement): + """ Device changed in procedure. + + A device that is implanted, removed or otherwise manipulated (calibration, + battery replacement, fitting a prosthesis, attaching a wound-vac, etc.) as + a focal portion of the Procedure. + """ + + resource_name = "ProcedureFocalDevice" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.action = None + """ Kind of change to device. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.manipulated = None + """ Device that was changed. + Type `FHIRReference` referencing `Device` (represented as `dict` in JSON). """ + + super(ProcedureFocalDevice, self).__init__(jsondict) + + def elementProperties(self): + js = super(ProcedureFocalDevice, self).elementProperties() + js.extend([ + ("action", "action", codeableconcept.CodeableConcept, False, None, False), + ("manipulated", "manipulated", fhirreference.FHIRReference, False, None, True), + ]) + return js + + +class ProcedurePerformer(backboneelement.BackboneElement): + """ The people who performed the procedure. + + Limited to 'real' people rather than equipment. + """ + + resource_name = "ProcedurePerformer" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.actor = None + """ The reference to the practitioner. + Type `FHIRReference` referencing `Practitioner, Organization, Patient, RelatedPerson` (represented as `dict` in JSON). """ + + self.role = None + """ The role the actor was in. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ProcedurePerformer, self).__init__(jsondict) + + def elementProperties(self): + js = super(ProcedurePerformer, self).elementProperties() + js.extend([ + ("actor", "actor", fhirreference.FHIRReference, False, None, False), + ("role", "role", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import annotation +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier +from . import period diff --git a/fhirclient/models/DSTU2/procedure_tests.py b/fhirclient/models/DSTU2/procedure_tests.py new file mode 100644 index 000000000..0e9c9669f --- /dev/null +++ b/fhirclient/models/DSTU2/procedure_tests.py @@ -0,0 +1,261 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import procedure +from .fhirdate import FHIRDate + + +class ProcedureTests(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("Procedure", js["resourceType"]) + return procedure.Procedure(js) + + def testProcedure1(self): + inst = self.instantiate_from("procedure-example-f201-tpf.json") + self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") + self.implProcedure1(inst) + + js = inst.as_json() + self.assertEqual("Procedure", js["resourceType"]) + inst2 = procedure.Procedure(js) + self.implProcedure1(inst2) + + def implProcedure1(self, inst): + 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.id, "f201") + self.assertEqual(inst.notes[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].role.coding[0].code, "310512001") + self.assertEqual(inst.performer[0].role.coding[0].display, "Medical oncologist") + self.assertEqual(inst.performer[0].role.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.reasonCodeableConcept.text, "DiagnosticReport/f201") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.status, "generated") + + def testProcedure2(self): + inst = self.instantiate_from("procedure-example-implant.json") + self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") + self.implProcedure2(inst) + + js = inst.as_json() + self.assertEqual("Procedure", js["resourceType"]) + inst2 = procedure.Procedure(js) + self.implProcedure2(inst2) + + def implProcedure2(self, inst): + 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.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.notes[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.reasonCodeableConcept.text, "Bradycardia") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.status, "generated") + + def testProcedure3(self): + inst = self.instantiate_from("procedure-example-f004-tracheotomy.json") + self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") + self.implProcedure3(inst) + + js = inst.as_json() + self.assertEqual("Procedure", js["resourceType"]) + inst2 = procedure.Procedure(js) + self.implProcedure3(inst2) + + def implProcedure3(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].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.reasonCodeableConcept.text, "ensure breathing during surgery") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.status, "generated") + + def testProcedure4(self): + inst = self.instantiate_from("procedure-example-f003-abscess.json") + self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") + self.implProcedure4(inst) + + js = inst.as_json() + self.assertEqual("Procedure", js["resourceType"]) + inst2 = procedure.Procedure(js) + self.implProcedure4(inst2) + + def implProcedure4(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, "172960003") + self.assertEqual(inst.code.coding[0].display, "Incision of retropharyngeal abscess") + 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.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.reasonCodeableConcept.text, "abcess in retropharyngeal area") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.status, "generated") + + def testProcedure5(self): + inst = self.instantiate_from("procedure-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") + self.implProcedure5(inst) + + js = inst.as_json() + self.assertEqual("Procedure", js["resourceType"]) + inst2 = procedure.Procedure(js) + self.implProcedure5(inst2) + + def implProcedure5(self, inst): + 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.code.text, "Appendectomy") + self.assertEqual(inst.followUp[0].text, "ROS 5 days - 2013-04-10") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.notes[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.reasonCodeableConcept.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") + + def testProcedure6(self): + inst = self.instantiate_from("procedure-example-f001-heart.json") + self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") + self.implProcedure6(inst) + + js = inst.as_json() + self.assertEqual("Procedure", js["resourceType"]) + inst2 = procedure.Procedure(js) + self.implProcedure6(inst2) + + def implProcedure6(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].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.reasonCodeableConcept.text, "Heart valve disorder") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.status, "generated") + + def testProcedure7(self): + inst = self.instantiate_from("procedure-example-f002-lung.json") + self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") + self.implProcedure7(inst) + + js = inst.as_json() + self.assertEqual("Procedure", js["resourceType"]) + inst2 = procedure.Procedure(js) + self.implProcedure7(inst2) + + def implProcedure7(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].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.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.reasonCodeableConcept.text, "Malignant tumor of lung") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.status, "generated") + + def testProcedure8(self): + inst = self.instantiate_from("procedure-example-biopsy.json") + self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") + self.implProcedure8(inst) + + js = inst.as_json() + self.assertEqual("Procedure", js["resourceType"]) + inst2 = procedure.Procedure(js) + self.implProcedure8(inst2) + + def implProcedure8(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.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].system, "http://snomed.info/sct") + self.assertEqual(inst.code.text, "Biopsy of suspected melanoma L) arm") + self.assertEqual(inst.followUp[0].text, "Review in clinic") + self.assertEqual(inst.id, "biopsy") + self.assertEqual(inst.notes[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.reasonCodeableConcept.text, "Dark lesion l) forearm. getting darker last 3 months.") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.div, "
Biopsy of suspected melanoma L) arm
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/procedurerequest.py b/fhirclient/models/DSTU2/procedurerequest.py new file mode 100644 index 000000000..7d8c929b0 --- /dev/null +++ b/fhirclient/models/DSTU2/procedurerequest.py @@ -0,0 +1,128 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ProcedureRequest) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class ProcedureRequest(domainresource.DomainResource): + """ A request for a procedure to be performed. + + A request for a procedure to be performed. May be a proposal or an order. + """ + + resource_name = "ProcedureRequest" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.asNeededBoolean = None + """ Preconditions for procedure. + Type `bool`. """ + + self.asNeededCodeableConcept = None + """ Preconditions for procedure. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.bodySite = None + """ What part of body to perform on. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.code = None + """ What procedure to perform. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.encounter = None + """ Encounter request created during. + Type `FHIRReference` referencing `Encounter` (represented as `dict` in JSON). """ + + self.identifier = None + """ Unique identifier for the request. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.notes = None + """ Additional information about desired procedure. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.orderedOn = None + """ When request was created. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.orderer = None + """ Who made request. + Type `FHIRReference` referencing `Practitioner, Patient, RelatedPerson, Device` (represented as `dict` in JSON). """ + + self.performer = None + """ Who should perform the procedure. + Type `FHIRReference` referencing `Practitioner, Organization, Patient, RelatedPerson` (represented as `dict` in JSON). """ + + self.priority = None + """ routine | urgent | stat | asap. + Type `str`. """ + + self.reasonCodeableConcept = None + """ Why procedure should occur. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.reasonReference = None + """ Why procedure should occur. + Type `FHIRReference` referencing `Condition` (represented as `dict` in JSON). """ + + self.scheduledDateTime = None + """ When procedure should occur. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.scheduledPeriod = None + """ When procedure should occur. + Type `Period` (represented as `dict` in JSON). """ + + self.scheduledTiming = None + """ When procedure should occur. + Type `Timing` (represented as `dict` in JSON). """ + + self.status = None + """ proposed | draft | requested | received | accepted | in-progress | + completed | suspended | rejected | aborted. + Type `str`. """ + + self.subject = None + """ Who the procedure should be done to. + Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ + + super(ProcedureRequest, self).__init__(jsondict) + + def elementProperties(self): + js = super(ProcedureRequest, self).elementProperties() + js.extend([ + ("asNeededBoolean", "asNeededBoolean", bool, False, "asNeeded", False), + ("asNeededCodeableConcept", "asNeededCodeableConcept", codeableconcept.CodeableConcept, False, "asNeeded", False), + ("bodySite", "bodySite", 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), + ("notes", "notes", annotation.Annotation, True, None, False), + ("orderedOn", "orderedOn", fhirdate.FHIRDate, False, None, False), + ("orderer", "orderer", fhirreference.FHIRReference, False, None, False), + ("performer", "performer", fhirreference.FHIRReference, False, None, False), + ("priority", "priority", str, False, None, False), + ("reasonCodeableConcept", "reasonCodeableConcept", codeableconcept.CodeableConcept, False, "reason", False), + ("reasonReference", "reasonReference", fhirreference.FHIRReference, False, "reason", False), + ("scheduledDateTime", "scheduledDateTime", fhirdate.FHIRDate, False, "scheduled", False), + ("scheduledPeriod", "scheduledPeriod", period.Period, False, "scheduled", False), + ("scheduledTiming", "scheduledTiming", timing.Timing, False, "scheduled", False), + ("status", "status", str, False, None, False), + ("subject", "subject", fhirreference.FHIRReference, False, None, True), + ]) + return js + + +from . import annotation +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier +from . import period +from . import timing diff --git a/fhirclient/models/DSTU2/procedurerequest_tests.py b/fhirclient/models/DSTU2/procedurerequest_tests.py new file mode 100644 index 000000000..9c4c10ae6 --- /dev/null +++ b/fhirclient/models/DSTU2/procedurerequest_tests.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +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.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.code.coding[0].code, "323418000") + self.assertEqual(inst.code.coding[0].display, "Fix me up") + self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.text.div, "
To be added
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/processrequest.py b/fhirclient/models/DSTU2/processrequest.py new file mode 100644 index 000000000..4cf8cf9f5 --- /dev/null +++ b/fhirclient/models/DSTU2/processrequest.py @@ -0,0 +1,145 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ProcessRequest) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class ProcessRequest(domainresource.DomainResource): + """ Process request. + + 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_name = "ProcessRequest" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + 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 + """ Nullify. + Type `bool`. """ + + self.organization = None + """ Responsible organization. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.originalRuleset = None + """ Original version. + Type `Coding` (represented as `dict` in JSON). """ + + self.period = None + """ 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 + """ Request reference. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.response = None + """ Response reference. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.ruleset = None + """ Resource version. + Type `Coding` (represented as `dict` in JSON). """ + + self.target = None + """ Target of the request. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + super(ProcessRequest, self).__init__(jsondict) + + def elementProperties(self): + js = super(ProcessRequest, self).elementProperties() + js.extend([ + ("action", "action", str, False, None, True), + ("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), + ("originalRuleset", "originalRuleset", coding.Coding, 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), + ("ruleset", "ruleset", coding.Coding, 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_name = "ProcessRequestItem" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.sequenceLinkId = None + """ Service instance. + Type `int`. """ + + super(ProcessRequestItem, self).__init__(jsondict) + + def elementProperties(self): + js = super(ProcessRequestItem, self).elementProperties() + js.extend([ + ("sequenceLinkId", "sequenceLinkId", int, False, None, True), + ]) + return js + + +from . import coding +from . import fhirdate +from . import fhirreference +from . import identifier +from . import period diff --git a/fhirclient/models/DSTU2/processrequest_tests.py b/fhirclient/models/DSTU2/processrequest_tests.py new file mode 100644 index 000000000..4bae0f348 --- /dev/null +++ b/fhirclient/models/DSTU2/processrequest_tests.py @@ -0,0 +1,215 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +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-exclusive.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.exclude[0], "SupportingDocumentation") + self.assertEqual(inst.exclude[1], "Reconciliation") + 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.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-eob.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.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.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-specific.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, "1111") + self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/processrequest") + self.assertEqual(inst.identifier[0].value, "111") + 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-inclusive.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, "1112") + self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/processrequest") + self.assertEqual(inst.identifier[0].value, "112") + self.assertEqual(inst.include[0], "Reconciliation") + 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-payrec.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, "1114") + self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/processrequest") + self.assertEqual(inst.identifier[0].value, "114") + self.assertEqual(inst.include[0], "Reconciliation") + 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.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.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, "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.text.div, "
A human-readable rendering of the Poll ProcessRequest
") + 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.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-reprocess.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, "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.text.div, "
A human-readable rendering of the ReProcess ProcessRequest resource.
") + self.assertEqual(inst.text.status, "generated") + + def testProcessRequest9(self): + inst = self.instantiate_from("processrequest-example-status.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, "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.text.div, "
A human-readable rendering of the Status ProcessRequest
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/processresponse.py b/fhirclient/models/DSTU2/processresponse.py new file mode 100644 index 000000000..39517e8d1 --- /dev/null +++ b/fhirclient/models/DSTU2/processresponse.py @@ -0,0 +1,134 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ProcessResponse) on 2019-10-12. +# 2019, 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_name = "ProcessResponse" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + 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 `Coding` items (represented as `dict` in JSON). """ + + self.form = None + """ Printed Form Identifier. + Type `Coding` (represented as `dict` in JSON). """ + + self.identifier = None + """ Business Identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.notes = None + """ Notes. + List of `ProcessResponseNotes` items (represented as `dict` in JSON). """ + + self.organization = None + """ Authoring Organization. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.originalRuleset = None + """ Original version. + Type `Coding` (represented as `dict` in JSON). """ + + self.outcome = None + """ Processing outcome. + Type `Coding` (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.ruleset = None + """ Resource version. + Type `Coding` (represented as `dict` in JSON). """ + + super(ProcessResponse, self).__init__(jsondict) + + def elementProperties(self): + js = super(ProcessResponse, self).elementProperties() + js.extend([ + ("created", "created", fhirdate.FHIRDate, False, None, False), + ("disposition", "disposition", str, False, None, False), + ("error", "error", coding.Coding, True, None, False), + ("form", "form", coding.Coding, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("notes", "notes", ProcessResponseNotes, True, None, False), + ("organization", "organization", fhirreference.FHIRReference, False, None, False), + ("originalRuleset", "originalRuleset", coding.Coding, False, None, False), + ("outcome", "outcome", coding.Coding, False, None, False), + ("request", "request", fhirreference.FHIRReference, False, None, False), + ("requestOrganization", "requestOrganization", fhirreference.FHIRReference, False, None, False), + ("requestProvider", "requestProvider", fhirreference.FHIRReference, False, None, False), + ("ruleset", "ruleset", coding.Coding, False, None, False), + ]) + return js + + +from . import backboneelement + +class ProcessResponseNotes(backboneelement.BackboneElement): + """ Notes. + + Suite of processing note or additional requirements is the processing has + been held. + """ + + resource_name = "ProcessResponseNotes" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.text = None + """ Notes text. + Type `str`. """ + + self.type = None + """ display | print | printoper. + Type `Coding` (represented as `dict` in JSON). """ + + super(ProcessResponseNotes, self).__init__(jsondict) + + def elementProperties(self): + js = super(ProcessResponseNotes, self).elementProperties() + js.extend([ + ("text", "text", str, False, None, False), + ("type", "type", coding.Coding, False, None, False), + ]) + return js + + +from . import coding +from . import fhirdate +from . import fhirreference +from . import identifier diff --git a/fhirclient/models/DSTU2/processresponse_tests.py b/fhirclient/models/DSTU2/processresponse_tests.py new file mode 100644 index 000000000..fc357a04c --- /dev/null +++ b/fhirclient/models/DSTU2/processresponse_tests.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +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.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-08-16").date) + self.assertEqual(inst.created.as_json(), "2014-08-16") + self.assertEqual(inst.disposition, "Specified coverage is currently in-force.") + 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.code, "complete") + self.assertEqual(inst.outcome.system, "http://hl7.org/fhir/processoutcomecodes") + self.assertEqual(inst.text.div, "
A human-readable rendering of the ProcessResponse
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/provenance.py b/fhirclient/models/DSTU2/provenance.py new file mode 100644 index 000000000..7916732a6 --- /dev/null +++ b/fhirclient/models/DSTU2/provenance.py @@ -0,0 +1,220 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Provenance) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Provenance(domainresource.DomainResource): + """ Who, What, When for a set of resources. + + Provenance of a resource is a record that describes entities and processes + involved in producing and delivering or otherwise influencing that + resource. Provenance provides a critical foundation for assessing + authenticity, enabling trust, and allowing reproducibility. Provenance + assertions are a form of contextual metadata and can themselves become + important records with their own provenance. Provenance statement indicates + clinical significance in terms of confidence in authenticity, reliability, + and trustworthiness, integrity, and stage in lifecycle (e.g. Document + Completion - has the artifact been legally authenticated), all of which may + impact security, privacy, and trust policies. + """ + + resource_name = "Provenance" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.activity = None + """ Activity that occurred. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.agent = None + """ Agents involved in creating resource. + List of `ProvenanceAgent` items (represented as `dict` in JSON). """ + + self.entity = None + """ An entity used in this activity. + List of `ProvenanceEntity` items (represented as `dict` in JSON). """ + + self.location = None + """ Where the activity occurred, if relevant. + Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + + self.period = None + """ When the activity occurred. + Type `Period` (represented as `dict` in JSON). """ + + self.policy = None + """ Policy or plan the activity was defined by. + List of `str` items. """ + + self.reason = None + """ Reason the activity is occurring. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.recorded = None + """ When the activity was recorded / updated. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.signature = None + """ Signature on target. + List of `Signature` items (represented as `dict` in JSON). """ + + self.target = None + """ Target Reference(s) (usually version specific). + List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + + super(Provenance, self).__init__(jsondict) + + def elementProperties(self): + js = super(Provenance, self).elementProperties() + js.extend([ + ("activity", "activity", codeableconcept.CodeableConcept, False, None, False), + ("agent", "agent", ProvenanceAgent, True, None, False), + ("entity", "entity", ProvenanceEntity, True, None, False), + ("location", "location", fhirreference.FHIRReference, False, None, False), + ("period", "period", period.Period, False, None, False), + ("policy", "policy", str, 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), + ]) + return js + + +from . import backboneelement + +class ProvenanceAgent(backboneelement.BackboneElement): + """ Agents involved in creating resource. + + An agent takes a role in an activity such that the agent can be assigned + some degree of responsibility for the activity taking place. An agent can + be a person, an organization, software, or other entities that may be + ascribed responsibility. + """ + + resource_name = "ProvenanceAgent" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.actor = None + """ Individual, device or organization playing role. + Type `FHIRReference` referencing `Practitioner, RelatedPerson, Patient, Device, Organization` (represented as `dict` in JSON). """ + + self.relatedAgent = None + """ Track delegation between agents. + List of `ProvenanceAgentRelatedAgent` items (represented as `dict` in JSON). """ + + self.role = None + """ What the agents involvement was. + Type `Coding` (represented as `dict` in JSON). """ + + self.userId = None + """ Authorization-system identifier for the agent. + Type `Identifier` (represented as `dict` in JSON). """ + + super(ProvenanceAgent, self).__init__(jsondict) + + def elementProperties(self): + js = super(ProvenanceAgent, self).elementProperties() + js.extend([ + ("actor", "actor", fhirreference.FHIRReference, False, None, False), + ("relatedAgent", "relatedAgent", ProvenanceAgentRelatedAgent, True, None, False), + ("role", "role", coding.Coding, False, None, True), + ("userId", "userId", identifier.Identifier, False, None, False), + ]) + return js + + +class ProvenanceAgentRelatedAgent(backboneelement.BackboneElement): + """ Track delegation between agents. + + A relationship between two the agents referenced in this resource. This is + defined to allow for explicit description of the delegation between agents. + For example, this human author used this device, or one person acted on + another's behest. + """ + + resource_name = "ProvenanceAgentRelatedAgent" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.target = None + """ Reference to other agent in this resource by identifier. + Type `str`. """ + + self.type = None + """ Type of relationship between agents. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ProvenanceAgentRelatedAgent, self).__init__(jsondict) + + def elementProperties(self): + js = super(ProvenanceAgentRelatedAgent, self).elementProperties() + js.extend([ + ("target", "target", str, False, None, True), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +class ProvenanceEntity(backboneelement.BackboneElement): + """ An entity used in this activity. + """ + + resource_name = "ProvenanceEntity" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.agent = None + """ Entity is attributed to this agent. + Type `ProvenanceAgent` (represented as `dict` in JSON). """ + + self.display = None + """ Human description of entity. + Type `str`. """ + + self.reference = None + """ Identity of entity. + Type `str`. """ + + self.role = None + """ derivation | revision | quotation | source. + Type `str`. """ + + self.type = None + """ The type of resource in this entity. + Type `Coding` (represented as `dict` in JSON). """ + + super(ProvenanceEntity, self).__init__(jsondict) + + def elementProperties(self): + js = super(ProvenanceEntity, self).elementProperties() + js.extend([ + ("agent", "agent", ProvenanceAgent, False, None, False), + ("display", "display", str, False, None, False), + ("reference", "reference", str, False, None, True), + ("role", "role", str, False, None, True), + ("type", "type", coding.Coding, False, None, True), + ]) + return js + + +from . import codeableconcept +from . import coding +from . import fhirdate +from . import fhirreference +from . import identifier +from . import period +from . import signature diff --git a/fhirclient/models/DSTU2/provenance_tests.py b/fhirclient/models/DSTU2/provenance_tests.py new file mode 100644 index 000000000..429049664 --- /dev/null +++ b/fhirclient/models/DSTU2/provenance_tests.py @@ -0,0 +1,96 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import provenance +from .fhirdate import FHIRDate + + +class ProvenanceTests(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("Provenance", js["resourceType"]) + return provenance.Provenance(js) + + def testProvenance1(self): + inst = self.instantiate_from("provenance-example-sig.json") + self.assertIsNotNone(inst, "Must have instantiated a Provenance instance") + self.implProvenance1(inst) + + js = inst.as_json() + self.assertEqual("Provenance", js["resourceType"]) + inst2 = provenance.Provenance(js) + self.implProvenance1(inst2) + + def implProvenance1(self, inst): + self.assertEqual(inst.activity.coding[0].code, "AU") + self.assertEqual(inst.activity.coding[0].display, "authenticated") + self.assertEqual(inst.activity.coding[0].system, "http://hl7.org/fhir/v3/DocumentCompletion") + self.assertEqual(inst.agent[0].role.code, "verifier") + self.assertEqual(inst.agent[0].role.system, "http://hl7.org/fhir/provenance-participant-role") + self.assertEqual(inst.agent[0].userId.system, "http://acme.com/fhir/users/sso") + self.assertEqual(inst.agent[0].userId.value, "hhd") + self.assertEqual(inst.id, "signature") + 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://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") + self.assertEqual(inst.signature[0].type[0].system, "http://hl7.org/fhir/valueset-signature-type") + 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): + inst = self.instantiate_from("provenance-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Provenance instance") + self.implProvenance2(inst) + + js = inst.as_json() + self.assertEqual("Provenance", js["resourceType"]) + inst2 = provenance.Provenance(js) + self.implProvenance2(inst2) + + def implProvenance2(self, inst): + self.assertEqual(inst.agent[0].relatedAgent[0].target, "#a1") + self.assertEqual(inst.agent[0].relatedAgent[0].type.text, "used") + self.assertEqual(inst.agent[0].role.code, "author") + self.assertEqual(inst.agent[0].role.system, "http://hl7.org/fhir/provenance-participant-role") + self.assertEqual(inst.agent[0].userId.system, "http://acme.com/fhir/users/sso") + self.assertEqual(inst.agent[0].userId.value, "hhd") + self.assertEqual(inst.agent[1].id, "a1") + self.assertEqual(inst.agent[1].role.code, "DEV") + self.assertEqual(inst.agent[1].role.system, "http://hl7.org/fhir/v3/ParticipationType") + self.assertEqual(inst.entity[0].display, "CDA Document in XDS repository") + self.assertEqual(inst.entity[0].reference, "DocumentReference/90f55916-9d15-4b8f-87a9-2d7ade8670c8") + self.assertEqual(inst.entity[0].role, "source") + self.assertEqual(inst.entity[0].type.code, "57133-1") + self.assertEqual(inst.entity[0].type.display, "Referral note") + self.assertEqual(inst.entity[0].type.system, "http://loinc.org") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.period.start.date, FHIRDate("2015-06-27").date) + self.assertEqual(inst.period.start.as_json(), "2015-06-27") + self.assertEqual(inst.policy[0], "http://acme.com/fhir/Consent/25") + 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.reason[0].text, "Accepting a referral") + 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 Referral received 26-June
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/quantity.py b/fhirclient/models/DSTU2/quantity.py new file mode 100644 index 000000000..f38bc7d90 --- /dev/null +++ b/fhirclient/models/DSTU2/quantity.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Quantity) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Quantity(element.Element): + """ A measured or measurable amount. + + A measured amount (or an amount that can potentially be measured). Note + that measured amounts include amounts that are not precisely quantified, + including amounts involving arbitrary units and floating currencies. + """ + + resource_name = "Quantity" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.code = None + """ Coded form of the unit. + Type `str`. """ + + self.comparator = None + """ < | <= | >= | > - how to understand the value. + Type `str`. """ + + self.system = None + """ System that defines coded unit form. + Type `str`. """ + + self.unit = None + """ Unit representation. + Type `str`. """ + + self.value = None + """ Numerical value (with implicit precision). + Type `float`. """ + + super(Quantity, self).__init__(jsondict) + + def elementProperties(self): + js = super(Quantity, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, False), + ("comparator", "comparator", str, False, None, False), + ("system", "system", str, False, None, False), + ("unit", "unit", str, False, None, False), + ("value", "value", float, False, None, False), + ]) + return js + + diff --git a/fhirclient/models/DSTU2/questionnaire.py b/fhirclient/models/DSTU2/questionnaire.py new file mode 100644 index 000000000..3cafd1f24 --- /dev/null +++ b/fhirclient/models/DSTU2/questionnaire.py @@ -0,0 +1,207 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Questionnaire) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Questionnaire(domainresource.DomainResource): + """ A structured set of questions. + + A structured set of questions intended to guide the collection of answers. + The questions are ordered and grouped into coherent subsets, corresponding + to the structure of the grouping of the underlying questions. + """ + + resource_name = "Questionnaire" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.date = None + """ Date this version was authored. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.group = None + """ Grouped questions. + Type `QuestionnaireGroup` (represented as `dict` in JSON). """ + + self.identifier = None + """ External identifiers for this questionnaire. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.publisher = None + """ Organization/individual who designed the questionnaire. + Type `str`. """ + + self.status = None + """ draft | published | retired. + Type `str`. """ + + self.subjectType = None + """ Resource that can be subject of QuestionnaireResponse. + List of `str` items. """ + + self.telecom = None + """ Contact information of the publisher. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + self.version = None + """ Logical identifier for this version of Questionnaire. + Type `str`. """ + + super(Questionnaire, self).__init__(jsondict) + + def elementProperties(self): + js = super(Questionnaire, self).elementProperties() + js.extend([ + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("group", "group", QuestionnaireGroup, False, None, True), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("publisher", "publisher", str, False, None, False), + ("status", "status", str, False, None, True), + ("subjectType", "subjectType", str, True, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class QuestionnaireGroup(backboneelement.BackboneElement): + """ Grouped questions. + + A collection of related questions (or further groupings of questions). + """ + + resource_name = "QuestionnaireGroup" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.concept = None + """ Concept that represents this section in a questionnaire. + List of `Coding` items (represented as `dict` in JSON). """ + + self.group = None + """ Nested questionnaire group. + List of `QuestionnaireGroup` items (represented as `dict` in JSON). """ + + self.linkId = None + """ To link questionnaire with questionnaire response. + Type `str`. """ + + self.question = None + """ Questions in this group. + List of `QuestionnaireGroupQuestion` items (represented as `dict` in JSON). """ + + self.repeats = None + """ Whether the group may repeat. + Type `bool`. """ + + self.required = None + """ Whether the group must be included in data results. + Type `bool`. """ + + self.text = None + """ Additional text for the group. + Type `str`. """ + + self.title = None + """ Name to be displayed for group. + Type `str`. """ + + super(QuestionnaireGroup, self).__init__(jsondict) + + def elementProperties(self): + js = super(QuestionnaireGroup, self).elementProperties() + js.extend([ + ("concept", "concept", coding.Coding, True, None, False), + ("group", "group", QuestionnaireGroup, True, None, False), + ("linkId", "linkId", str, False, None, False), + ("question", "question", QuestionnaireGroupQuestion, True, None, False), + ("repeats", "repeats", bool, False, None, False), + ("required", "required", bool, False, None, False), + ("text", "text", str, False, None, False), + ("title", "title", str, False, None, False), + ]) + return js + + +class QuestionnaireGroupQuestion(backboneelement.BackboneElement): + """ Questions in this group. + + Set of questions within this group. The order of questions within the group + is relevant. + """ + + resource_name = "QuestionnaireGroupQuestion" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.concept = None + """ Concept that represents this question on a questionnaire. + List of `Coding` items (represented as `dict` in JSON). """ + + self.group = None + """ Nested questionnaire group. + List of `QuestionnaireGroup` items (represented as `dict` in JSON). """ + + self.linkId = None + """ To link questionnaire with questionnaire response. + Type `str`. """ + + self.option = None + """ Permitted answer. + List of `Coding` items (represented as `dict` in JSON). """ + + self.options = None + """ Valueset containing permitted answers. + Type `FHIRReference` referencing `ValueSet` (represented as `dict` in JSON). """ + + self.repeats = None + """ Whether the question can have multiple answers. + Type `bool`. """ + + self.required = None + """ Whether the question must be answered in data results. + Type `bool`. """ + + self.text = None + """ Text of the question as it is shown to the user. + Type `str`. """ + + self.type = None + """ boolean | decimal | integer | date | dateTime +. + Type `str`. """ + + super(QuestionnaireGroupQuestion, self).__init__(jsondict) + + def elementProperties(self): + js = super(QuestionnaireGroupQuestion, self).elementProperties() + js.extend([ + ("concept", "concept", coding.Coding, True, None, False), + ("group", "group", QuestionnaireGroup, True, None, False), + ("linkId", "linkId", str, False, None, False), + ("option", "option", coding.Coding, True, None, False), + ("options", "options", fhirreference.FHIRReference, False, None, False), + ("repeats", "repeats", bool, False, None, False), + ("required", "required", bool, False, None, False), + ("text", "text", str, False, None, False), + ("type", "type", str, False, None, False), + ]) + return js + + +from . import coding +from . import contactpoint +from . import fhirdate +from . import fhirreference +from . import identifier diff --git a/fhirclient/models/DSTU2/questionnaire_tests.py b/fhirclient/models/DSTU2/questionnaire_tests.py new file mode 100644 index 000000000..ad45128c0 --- /dev/null +++ b/fhirclient/models/DSTU2/questionnaire_tests.py @@ -0,0 +1,215 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import questionnaire +from .fhirdate import FHIRDate + + +class QuestionnaireTests(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("Questionnaire", js["resourceType"]) + return questionnaire.Questionnaire(js) + + def testQuestionnaire1(self): + inst = self.instantiate_from("questionnaire-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Questionnaire instance") + self.implQuestionnaire1(inst) + + js = inst.as_json() + self.assertEqual("Questionnaire", js["resourceType"]) + inst2 = questionnaire.Questionnaire(js) + self.implQuestionnaire1(inst2) + + def implQuestionnaire1(self, inst): + self.assertEqual(inst.contained[0].id, "yesno") + self.assertEqual(inst.date.date, FHIRDate("2012-01").date) + self.assertEqual(inst.date.as_json(), "2012-01") + self.assertEqual(inst.group.group[0].concept[0].code, "COMORBIDITY") + self.assertEqual(inst.group.group[0].concept[0].system, "http://example.org/system/code/sections") + self.assertEqual(inst.group.group[0].linkId, "1.1") + self.assertEqual(inst.group.group[0].question[0].concept[0].code, "COMORB") + self.assertEqual(inst.group.group[0].question[0].concept[0].system, "http://example.org/system/code/questions") + self.assertEqual(inst.group.group[0].question[0].group[0].concept[0].code, "CARDIAL") + self.assertEqual(inst.group.group[0].question[0].group[0].concept[0].system, "http://example.org/system/code/sections") + self.assertEqual(inst.group.group[0].question[0].group[0].linkId, "1.1.1.1") + self.assertEqual(inst.group.group[0].question[0].group[0].question[0].concept[0].code, "COMORBCAR") + self.assertEqual(inst.group.group[0].question[0].group[0].question[0].concept[0].system, "http://example.org/system/code/questions") + self.assertEqual(inst.group.group[0].question[0].group[0].question[0].linkId, "1.1.1.1.1") + self.assertEqual(inst.group.group[0].question[0].group[0].question[0].type, "choice") + self.assertEqual(inst.group.group[0].question[0].group[0].question[1].concept[0].code, "COMCAR00") + self.assertEqual(inst.group.group[0].question[0].group[0].question[1].concept[0].display, "Angina Pectoris") + self.assertEqual(inst.group.group[0].question[0].group[0].question[1].concept[0].system, "http://example.org/system/code/questions") + self.assertEqual(inst.group.group[0].question[0].group[0].question[1].concept[1].code, "194828000") + self.assertEqual(inst.group.group[0].question[0].group[0].question[1].concept[1].display, "Angina (disorder)") + self.assertEqual(inst.group.group[0].question[0].group[0].question[1].concept[1].system, "http://snomed.info/sct") + self.assertEqual(inst.group.group[0].question[0].group[0].question[1].linkId, "1.1.1.1.2") + self.assertEqual(inst.group.group[0].question[0].group[0].question[1].type, "choice") + self.assertEqual(inst.group.group[0].question[0].group[0].question[2].concept[0].code, "22298006") + self.assertEqual(inst.group.group[0].question[0].group[0].question[2].concept[0].display, "Myocardial infarction (disorder)") + self.assertEqual(inst.group.group[0].question[0].group[0].question[2].concept[0].system, "http://snomed.info/sct") + self.assertEqual(inst.group.group[0].question[0].group[0].question[2].linkId, "1.1.1.1.3") + self.assertEqual(inst.group.group[0].question[0].group[0].question[2].type, "choice") + self.assertEqual(inst.group.group[0].question[0].group[1].concept[0].code, "VASCULAR") + self.assertEqual(inst.group.group[0].question[0].group[1].concept[0].system, "http://example.org/system/code/sections") + self.assertEqual(inst.group.group[0].question[0].group[1].linkId, "1.1.1.2") + self.assertEqual(inst.group.group[0].question[0].linkId, "1.1.1") + self.assertEqual(inst.group.group[0].question[0].type, "choice") + self.assertEqual(inst.group.group[1].concept[0].code, "HISTOPATHOLOGY") + self.assertEqual(inst.group.group[1].concept[0].system, "http://example.org/system/code/sections") + self.assertEqual(inst.group.group[1].group[0].concept[0].code, "ABDOMINAL") + self.assertEqual(inst.group.group[1].group[0].concept[0].system, "http://example.org/system/code/sections") + self.assertEqual(inst.group.group[1].group[0].linkId, "1.2.1") + self.assertEqual(inst.group.group[1].group[0].question[0].concept[0].code, "STADPT") + self.assertEqual(inst.group.group[1].group[0].question[0].concept[0].display, "pT category") + self.assertEqual(inst.group.group[1].group[0].question[0].concept[0].system, "http://example.org/system/code/questions") + self.assertEqual(inst.group.group[1].group[0].question[0].linkId, "1.2.1.2") + self.assertEqual(inst.group.group[1].linkId, "1.2") + self.assertEqual(inst.group.linkId, "1") + self.assertTrue(inst.group.required) + self.assertEqual(inst.group.title, "Cancer Quality Forum Questionnaire 2012") + self.assertEqual(inst.id, "3141") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.subjectType[0], "Patient") + self.assertEqual(inst.text.status, "generated") + + def testQuestionnaire2(self): + inst = self.instantiate_from("questionnaire-example-f201-lifelines.json") + self.assertIsNotNone(inst, "Must have instantiated a Questionnaire instance") + self.implQuestionnaire2(inst) + + js = inst.as_json() + self.assertEqual("Questionnaire", js["resourceType"]) + inst2 = questionnaire.Questionnaire(js) + self.implQuestionnaire2(inst2) + + def implQuestionnaire2(self, inst): + self.assertEqual(inst.date.date, FHIRDate("2010").date) + self.assertEqual(inst.date.as_json(), "2010") + self.assertEqual(inst.group.concept[0].code, "VL 1-1, 18-65_1.2.2") + self.assertEqual(inst.group.concept[0].display, "Lifelines Questionnaire 1 part 1") + self.assertEqual(inst.group.concept[0].system, "http://example.org/system/code/lifelines/nl") + self.assertEqual(inst.group.group[0].linkId, "1") + self.assertEqual(inst.group.group[0].question[0].linkId, "1.1") + self.assertEqual(inst.group.group[0].question[0].text, "Do you have allergies?") + self.assertEqual(inst.group.group[1].linkId, "2") + self.assertEqual(inst.group.group[1].question[0].linkId, "2.1") + self.assertEqual(inst.group.group[1].question[0].text, "What is your gender?") + self.assertEqual(inst.group.group[1].question[1].linkId, "2.2") + self.assertEqual(inst.group.group[1].question[1].text, "What is your date of birth?") + self.assertEqual(inst.group.group[1].question[2].linkId, "2.3") + self.assertEqual(inst.group.group[1].question[2].text, "What is your country of birth?") + self.assertEqual(inst.group.group[1].question[3].linkId, "2.4") + self.assertEqual(inst.group.group[1].question[3].text, "What is your marital status?") + self.assertEqual(inst.group.group[1].text, "General questions") + self.assertEqual(inst.group.group[2].linkId, "3") + self.assertEqual(inst.group.group[2].question[0].linkId, "3.1") + self.assertEqual(inst.group.group[2].question[0].text, "Do you smoke?") + self.assertEqual(inst.group.group[2].question[1].linkId, "3.2") + self.assertEqual(inst.group.group[2].question[1].text, "Do you drink alchohol?") + self.assertEqual(inst.group.group[2].title, "Intoxications") + self.assertEqual(inst.group.linkId, "root") + self.assertTrue(inst.group.required) + self.assertEqual(inst.id, "f201") + self.assertEqual(inst.status, "published") + self.assertEqual(inst.subjectType[0], "Patient") + self.assertEqual(inst.text.status, "generated") + + def testQuestionnaire3(self): + inst = self.instantiate_from("questionnaire-example-gcs.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.contained[0].id, "motor") + self.assertEqual(inst.contained[1].id, "verbal") + self.assertEqual(inst.contained[2].id, "eye") + self.assertEqual(inst.date.date, FHIRDate("2015-08-03").date) + self.assertEqual(inst.date.as_json(), "2015-08-03") + self.assertEqual(inst.group.concept[0].code, "9269-2") + self.assertEqual(inst.group.concept[0].system, "http://loinc.org") + self.assertEqual(inst.group.linkId, "1") + self.assertEqual(inst.group.question[0].concept[0].code, "9270-0") + self.assertEqual(inst.group.question[0].concept[0].system, "http://loinc.org") + self.assertEqual(inst.group.question[0].linkId, "1.1") + self.assertEqual(inst.group.question[0].type, "choice") + self.assertEqual(inst.group.question[1].concept[0].code, "9268-4") + self.assertEqual(inst.group.question[1].concept[0].system, "http://loinc.org") + self.assertEqual(inst.group.question[1].linkId, "1.2") + self.assertEqual(inst.group.question[1].type, "choice") + self.assertEqual(inst.group.question[2].concept[0].code, "9267-6") + self.assertEqual(inst.group.question[2].concept[0].system, "http://loinc.org") + self.assertEqual(inst.group.question[2].linkId, "1.3") + self.assertEqual(inst.group.question[2].type, "choice") + self.assertTrue(inst.group.required) + self.assertEqual(inst.group.title, "Glasgow Coma Score") + self.assertEqual(inst.id, "gcs") + self.assertEqual(inst.publisher, "FHIR Project team") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.subjectType[0], "Patient") + self.assertEqual(inst.text.status, "generated") + + def testQuestionnaire4(self): + inst = self.instantiate_from("questionnaire-example-bluebook.json") + self.assertIsNotNone(inst, "Must have instantiated a Questionnaire instance") + self.implQuestionnaire4(inst) + + js = inst.as_json() + self.assertEqual("Questionnaire", js["resourceType"]) + inst2 = questionnaire.Questionnaire(js) + self.implQuestionnaire4(inst2) + + def implQuestionnaire4(self, inst): + self.assertEqual(inst.date.date, FHIRDate("2013-02-19").date) + self.assertEqual(inst.date.as_json(), "2013-02-19") + self.assertEqual(inst.group.group[0].group[0].question[0].linkId, "nameOfChild") + self.assertEqual(inst.group.group[0].group[0].question[0].text, "Name of child") + self.assertEqual(inst.group.group[0].group[0].question[1].linkId, "sex") + self.assertEqual(inst.group.group[0].group[0].question[1].text, "Sex") + self.assertEqual(inst.group.group[0].group[1].linkId, "neonatalInformation") + self.assertEqual(inst.group.group[0].group[1].question[0].linkId, "birthWeight") + self.assertEqual(inst.group.group[0].group[1].question[0].text, "Birth weight (kg)") + self.assertEqual(inst.group.group[0].group[1].question[1].linkId, "birthLength") + self.assertEqual(inst.group.group[0].group[1].question[1].text, "Birth length (cm)") + self.assertEqual(inst.group.group[0].group[1].question[2].group[0].extension[0].url, "http://example.org/Profile/questionnaire#visibilityCondition") + self.assertEqual(inst.group.group[0].group[1].question[2].group[0].extension[0].valueString, "HAS_VALUE(../choice/code) AND NEQ(../choice/code,'NO')") + self.assertEqual(inst.group.group[0].group[1].question[2].group[0].linkId, "vitaminKgivenDoses") + self.assertEqual(inst.group.group[0].group[1].question[2].group[0].question[0].linkId, "vitaminiKDose1") + self.assertEqual(inst.group.group[0].group[1].question[2].group[0].question[0].text, "1st dose") + self.assertEqual(inst.group.group[0].group[1].question[2].group[0].question[1].linkId, "vitaminiKDose2") + self.assertEqual(inst.group.group[0].group[1].question[2].group[0].question[1].text, "2nd dose") + self.assertEqual(inst.group.group[0].group[1].question[2].linkId, "vitaminKgiven") + self.assertEqual(inst.group.group[0].group[1].question[2].text, "Vitamin K given") + self.assertEqual(inst.group.group[0].group[1].question[3].group[0].question[0].linkId, "hepBgivenDate") + self.assertEqual(inst.group.group[0].group[1].question[3].group[0].question[0].text, "Date given") + self.assertEqual(inst.group.group[0].group[1].question[3].linkId, "hepBgiven") + self.assertEqual(inst.group.group[0].group[1].question[3].text, "Hep B given y / n") + self.assertEqual(inst.group.group[0].group[1].question[4].linkId, "abnormalitiesAtBirth") + self.assertEqual(inst.group.group[0].group[1].question[4].text, "Abnormalities noted at birth") + self.assertEqual(inst.group.group[0].group[1].title, "Neonatal Information") + self.assertEqual(inst.group.group[0].linkId, "birthDetails") + self.assertEqual(inst.group.group[0].title, "Birth details - To be completed by health professional") + self.assertEqual(inst.group.linkId, "PHR") + self.assertTrue(inst.group.required) + self.assertEqual(inst.group.title, "NSW Government My Personal Health Record") + self.assertEqual(inst.id, "bb") + 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") + diff --git a/fhirclient/models/DSTU2/questionnaireresponse.py b/fhirclient/models/DSTU2/questionnaireresponse.py new file mode 100644 index 000000000..681ff2021 --- /dev/null +++ b/fhirclient/models/DSTU2/questionnaireresponse.py @@ -0,0 +1,265 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class QuestionnaireResponse(domainresource.DomainResource): + """ A structured set of questions and their answers. + + A structured set of questions and their answers. The questions are ordered + and grouped into coherent subsets, corresponding to the structure of the + grouping of the underlying questions. + """ + + resource_name = "QuestionnaireResponse" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.author = None + """ Person who received and recorded the answers. + Type `FHIRReference` referencing `Device, Practitioner, Patient, RelatedPerson` (represented as `dict` in JSON). """ + + self.authored = None + """ Date this version was authored. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.encounter = None + """ Primary encounter during which the answers were collected. + Type `FHIRReference` referencing `Encounter` (represented as `dict` in JSON). """ + + self.group = None + """ Grouped questions. + Type `QuestionnaireResponseGroup` (represented as `dict` in JSON). """ + + self.identifier = None + """ Unique id for this set of answers. + Type `Identifier` (represented as `dict` in JSON). """ + + self.questionnaire = None + """ Form being answered. + Type `FHIRReference` referencing `Questionnaire` (represented as `dict` in JSON). """ + + self.source = None + """ The person who answered the questions. + Type `FHIRReference` referencing `Patient, Practitioner, RelatedPerson` (represented as `dict` in JSON). """ + + self.status = None + """ in-progress | completed | amended. + Type `str`. """ + + self.subject = None + """ The subject of the questions. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + super(QuestionnaireResponse, self).__init__(jsondict) + + def elementProperties(self): + js = super(QuestionnaireResponse, self).elementProperties() + js.extend([ + ("author", "author", fhirreference.FHIRReference, False, None, False), + ("authored", "authored", fhirdate.FHIRDate, False, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), + ("group", "group", QuestionnaireResponseGroup, False, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("questionnaire", "questionnaire", fhirreference.FHIRReference, False, None, False), + ("source", "source", fhirreference.FHIRReference, False, None, False), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +from . import backboneelement + +class QuestionnaireResponseGroup(backboneelement.BackboneElement): + """ Grouped questions. + + A group of questions to a possibly similarly grouped set of questions in + the questionnaire response. + """ + + resource_name = "QuestionnaireResponseGroup" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.group = None + """ Nested questionnaire response group. + List of `QuestionnaireResponseGroup` items (represented as `dict` in JSON). """ + + self.linkId = None + """ Corresponding group within Questionnaire. + Type `str`. """ + + self.question = None + """ Questions in this group. + List of `QuestionnaireResponseGroupQuestion` items (represented as `dict` in JSON). """ + + self.subject = None + """ The subject this group's answers are about. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.text = None + """ Additional text for the group. + Type `str`. """ + + self.title = None + """ Name for this group. + Type `str`. """ + + super(QuestionnaireResponseGroup, self).__init__(jsondict) + + def elementProperties(self): + js = super(QuestionnaireResponseGroup, self).elementProperties() + js.extend([ + ("group", "group", QuestionnaireResponseGroup, True, None, False), + ("linkId", "linkId", str, False, None, False), + ("question", "question", QuestionnaireResponseGroupQuestion, True, None, False), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ("text", "text", str, False, None, False), + ("title", "title", str, False, None, False), + ]) + return js + + +class QuestionnaireResponseGroupQuestion(backboneelement.BackboneElement): + """ Questions in this group. + + Set of questions within this group. The order of questions within the group + is relevant. + """ + + resource_name = "QuestionnaireResponseGroupQuestion" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.answer = None + """ The response(s) to the question. + List of `QuestionnaireResponseGroupQuestionAnswer` items (represented as `dict` in JSON). """ + + self.linkId = None + """ Corresponding question within Questionnaire. + Type `str`. """ + + self.text = None + """ Text of the question as it is shown to the user. + Type `str`. """ + + super(QuestionnaireResponseGroupQuestion, self).__init__(jsondict) + + def elementProperties(self): + js = super(QuestionnaireResponseGroupQuestion, self).elementProperties() + js.extend([ + ("answer", "answer", QuestionnaireResponseGroupQuestionAnswer, True, None, False), + ("linkId", "linkId", str, False, None, False), + ("text", "text", str, False, None, False), + ]) + return js + + +class QuestionnaireResponseGroupQuestionAnswer(backboneelement.BackboneElement): + """ The response(s) to the question. + + The respondent's answer(s) to the question. + """ + + resource_name = "QuestionnaireResponseGroupQuestionAnswer" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.group = None + """ Nested questionnaire group. + List of `QuestionnaireResponseGroup` items (represented as `dict` in JSON). """ + + self.valueAttachment = None + """ Single-valued answer to the question. + Type `Attachment` (represented as `dict` in JSON). """ + + self.valueBoolean = None + """ Single-valued answer to the question. + Type `bool`. """ + + self.valueCoding = None + """ Single-valued answer to the question. + Type `Coding` (represented as `dict` in JSON). """ + + self.valueDate = None + """ Single-valued answer to the question. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueDateTime = None + """ Single-valued answer to the question. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueDecimal = None + """ Single-valued answer to the question. + Type `float`. """ + + self.valueInstant = None + """ Single-valued answer to the question. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueInteger = None + """ Single-valued answer to the question. + Type `int`. """ + + self.valueQuantity = None + """ Single-valued answer to the question. + Type `Quantity` (represented as `dict` in JSON). """ + + self.valueReference = None + """ Single-valued answer to the question. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.valueString = None + """ Single-valued answer to the question. + Type `str`. """ + + self.valueTime = None + """ Single-valued answer to the question. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueUri = None + """ Single-valued answer to the question. + Type `str`. """ + + super(QuestionnaireResponseGroupQuestionAnswer, self).__init__(jsondict) + + def elementProperties(self): + js = super(QuestionnaireResponseGroupQuestionAnswer, self).elementProperties() + js.extend([ + ("group", "group", QuestionnaireResponseGroup, True, None, False), + ("valueAttachment", "valueAttachment", attachment.Attachment, False, "value", False), + ("valueBoolean", "valueBoolean", bool, False, "value", False), + ("valueCoding", "valueCoding", coding.Coding, False, "value", False), + ("valueDate", "valueDate", fhirdate.FHIRDate, False, "value", False), + ("valueDateTime", "valueDateTime", fhirdate.FHIRDate, False, "value", False), + ("valueDecimal", "valueDecimal", float, False, "value", False), + ("valueInstant", "valueInstant", fhirdate.FHIRDate, False, "value", False), + ("valueInteger", "valueInteger", int, False, "value", False), + ("valueQuantity", "valueQuantity", quantity.Quantity, False, "value", False), + ("valueReference", "valueReference", fhirreference.FHIRReference, False, "value", False), + ("valueString", "valueString", str, False, "value", False), + ("valueTime", "valueTime", fhirdate.FHIRDate, False, "value", False), + ("valueUri", "valueUri", str, False, "value", False), + ]) + return js + + +from . import attachment +from . import coding +from . import fhirdate +from . import fhirreference +from . import identifier +from . import quantity diff --git a/fhirclient/models/DSTU2/questionnaireresponse_tests.py b/fhirclient/models/DSTU2/questionnaireresponse_tests.py new file mode 100644 index 000000000..792c30a02 --- /dev/null +++ b/fhirclient/models/DSTU2/questionnaireresponse_tests.py @@ -0,0 +1,194 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import questionnaireresponse +from .fhirdate import FHIRDate + + +class QuestionnaireResponseTests(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("QuestionnaireResponse", js["resourceType"]) + return questionnaireresponse.QuestionnaireResponse(js) + + def testQuestionnaireResponse1(self): + inst = self.instantiate_from("questionnaireresponse-example.json") + self.assertIsNotNone(inst, "Must have instantiated a QuestionnaireResponse instance") + self.implQuestionnaireResponse1(inst) + + js = inst.as_json() + self.assertEqual("QuestionnaireResponse", js["resourceType"]) + inst2 = questionnaireresponse.QuestionnaireResponse(js) + self.implQuestionnaireResponse1(inst2) + + def implQuestionnaireResponse1(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, "questauth") + self.assertEqual(inst.contained[2].id, "obs.pt-category") + self.assertEqual(inst.group.group[0].question[0].answer[0].group[0].question[0].answer[0].valueCoding.code, "1") + self.assertEqual(inst.group.group[0].question[0].answer[0].group[0].question[0].answer[0].valueCoding.system, "http://cancer.questionnaire.org/system/code/yesno") + self.assertEqual(inst.group.group[0].question[0].answer[0].group[0].question[1].answer[0].valueCoding.code, "1") + self.assertEqual(inst.group.group[0].question[0].answer[0].group[0].question[1].answer[0].valueCoding.system, "http://cancer.questionnaire.org/system/code/yesno") + self.assertEqual(inst.group.group[0].question[0].answer[0].group[0].question[2].answer[0].valueCoding.code, "0") + self.assertEqual(inst.group.group[0].question[0].answer[0].group[0].question[2].answer[0].valueCoding.system, "http://cancer.questionnaire.org/system/code/yesno") + self.assertEqual(inst.group.group[0].question[0].answer[0].valueCoding.code, "1") + self.assertEqual(inst.group.group[0].question[0].answer[0].valueCoding.display, "Yes") + self.assertEqual(inst.group.group[0].question[0].answer[0].valueCoding.system, "http://cancer.questionnaire.org/system/code/yesno") + self.assertEqual(inst.group.title, "Cancer Quality Forum Questionnaire 2012") + self.assertEqual(inst.id, "3141") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.status, "generated") + + def testQuestionnaireResponse2(self): + inst = self.instantiate_from("questionnaireresponse-example-f201-lifelines.json") + self.assertIsNotNone(inst, "Must have instantiated a QuestionnaireResponse instance") + self.implQuestionnaireResponse2(inst) + + js = inst.as_json() + self.assertEqual("QuestionnaireResponse", js["resourceType"]) + inst2 = questionnaireresponse.QuestionnaireResponse(js) + 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.group.group[0].linkId, "1") + self.assertEqual(inst.group.group[0].question[0].answer[0].valueString, "I am allergic to house dust") + self.assertEqual(inst.group.group[0].question[0].linkId, "1.1") + self.assertEqual(inst.group.group[0].question[0].text, "Do you have allergies?") + self.assertEqual(inst.group.group[1].linkId, "2") + self.assertEqual(inst.group.group[1].question[0].answer[0].valueString, "Male") + self.assertEqual(inst.group.group[1].question[0].linkId, "2.1") + self.assertEqual(inst.group.group[1].question[0].text, "What is your gender?") + self.assertEqual(inst.group.group[1].question[1].answer[0].valueDate.date, FHIRDate("1960-03-13").date) + self.assertEqual(inst.group.group[1].question[1].answer[0].valueDate.as_json(), "1960-03-13") + self.assertEqual(inst.group.group[1].question[1].linkId, "2.2") + self.assertEqual(inst.group.group[1].question[1].text, "What is your date of birth?") + self.assertEqual(inst.group.group[1].question[2].answer[0].valueString, "The Netherlands") + self.assertEqual(inst.group.group[1].question[2].linkId, "2.3") + self.assertEqual(inst.group.group[1].question[2].text, "What is your country of birth?") + self.assertEqual(inst.group.group[1].question[3].answer[0].valueString, "married") + self.assertEqual(inst.group.group[1].question[3].linkId, "2.4") + self.assertEqual(inst.group.group[1].question[3].text, "What is your marital status?") + self.assertEqual(inst.group.group[1].title, "General questions") + self.assertEqual(inst.group.group[2].linkId, "3") + self.assertEqual(inst.group.group[2].question[0].answer[0].valueString, "No") + self.assertEqual(inst.group.group[2].question[0].linkId, "3.1") + self.assertEqual(inst.group.group[2].question[0].text, "Do you smoke?") + self.assertEqual(inst.group.group[2].question[1].answer[0].valueString, "No, but I used to drink") + self.assertEqual(inst.group.group[2].question[1].linkId, "3.2") + self.assertEqual(inst.group.group[2].question[1].text, "Do you drink alchohol?") + self.assertEqual(inst.group.group[2].title, "Intoxications") + self.assertEqual(inst.group.linkId, "root") + self.assertEqual(inst.id, "f201") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.status, "generated") + + def testQuestionnaireResponse3(self): + inst = self.instantiate_from("questionnaireresponse-example-bluebook.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-02-19T14:15:00+10:00").date) + self.assertEqual(inst.authored.as_json(), "2013-02-19T14:15:00+10:00") + self.assertEqual(inst.group.group[0].group[0].question[0].answer[0].valueString, "Cathy Jones") + self.assertEqual(inst.group.group[0].group[0].question[0].linkId, "nameOfChild") + self.assertEqual(inst.group.group[0].group[0].question[0].text, "Name of child") + self.assertEqual(inst.group.group[0].group[0].question[1].answer[0].valueCoding.code, "f") + self.assertEqual(inst.group.group[0].group[0].question[1].linkId, "sex") + self.assertEqual(inst.group.group[0].group[0].question[1].text, "Sex") + self.assertEqual(inst.group.group[0].group[1].linkId, "neonatalInformation") + self.assertEqual(inst.group.group[0].group[1].question[0].answer[0].valueDecimal, 3.25) + self.assertEqual(inst.group.group[0].group[1].question[0].linkId, "birthWeight") + self.assertEqual(inst.group.group[0].group[1].question[0].text, "Birth weight (kg)") + self.assertEqual(inst.group.group[0].group[1].question[1].answer[0].valueDecimal, 44.3) + self.assertEqual(inst.group.group[0].group[1].question[1].linkId, "birthLength") + self.assertEqual(inst.group.group[0].group[1].question[1].text, "Birth length (cm)") + self.assertEqual(inst.group.group[0].group[1].question[2].answer[0].group[0].extension[0].url, "http://example.org/Profile/questionnaire#visibilityCondition") + self.assertEqual(inst.group.group[0].group[1].question[2].answer[0].group[0].extension[0].valueString, "HAS_VALUE(../choice/code) AND NEQ(../choice/code,'NO')") + self.assertEqual(inst.group.group[0].group[1].question[2].answer[0].group[0].linkId, "vitaminKgivenDoses") + self.assertEqual(inst.group.group[0].group[1].question[2].answer[0].group[0].question[0].answer[0].valueDate.date, FHIRDate("1972-11-30").date) + self.assertEqual(inst.group.group[0].group[1].question[2].answer[0].group[0].question[0].answer[0].valueDate.as_json(), "1972-11-30") + self.assertEqual(inst.group.group[0].group[1].question[2].answer[0].group[0].question[0].linkId, "vitaminiKDose1") + self.assertEqual(inst.group.group[0].group[1].question[2].answer[0].group[0].question[0].text, "1st dose") + self.assertEqual(inst.group.group[0].group[1].question[2].answer[0].group[0].question[1].answer[0].valueDate.date, FHIRDate("1972-12-11").date) + self.assertEqual(inst.group.group[0].group[1].question[2].answer[0].group[0].question[1].answer[0].valueDate.as_json(), "1972-12-11") + self.assertEqual(inst.group.group[0].group[1].question[2].answer[0].group[0].question[1].linkId, "vitaminiKDose2") + self.assertEqual(inst.group.group[0].group[1].question[2].answer[0].group[0].question[1].text, "2nd dose") + self.assertEqual(inst.group.group[0].group[1].question[2].answer[0].valueCoding.code, "INJECTION") + self.assertEqual(inst.group.group[0].group[1].question[2].linkId, "vitaminKgiven") + self.assertEqual(inst.group.group[0].group[1].question[2].text, "Vitamin K given") + self.assertEqual(inst.group.group[0].group[1].question[3].answer[0].group[0].linkId, "hepBgivenDate") + self.assertEqual(inst.group.group[0].group[1].question[3].answer[0].group[0].question[0].answer[0].valueDate.date, FHIRDate("1972-12-04").date) + self.assertEqual(inst.group.group[0].group[1].question[3].answer[0].group[0].question[0].answer[0].valueDate.as_json(), "1972-12-04") + self.assertEqual(inst.group.group[0].group[1].question[3].answer[0].group[0].question[0].text, "Date given") + self.assertTrue(inst.group.group[0].group[1].question[3].answer[0].valueBoolean) + self.assertEqual(inst.group.group[0].group[1].question[3].linkId, "hepBgiven") + self.assertEqual(inst.group.group[0].group[1].question[3].text, "Hep B given y / n") + self.assertEqual(inst.group.group[0].group[1].question[4].answer[0].valueString, "Already able to speak Chinese") + self.assertEqual(inst.group.group[0].group[1].question[4].linkId, "abnormalitiesAtBirth") + self.assertEqual(inst.group.group[0].group[1].question[4].text, "Abnormalities noted at birth") + self.assertEqual(inst.group.group[0].group[1].title, "Neonatal Information") + self.assertEqual(inst.group.group[0].linkId, "birthDetails") + self.assertEqual(inst.group.group[0].title, "Birth details - To be completed by health professional") + self.assertEqual(inst.group.linkId, "PHR") + self.assertEqual(inst.group.title, "NSW Government My Personal Health Record, january 2013") + self.assertEqual(inst.id, "bb") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.status, "generated") + + def testQuestionnaireResponse4(self): + inst = self.instantiate_from("questionnaireresponse-example-gcs.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("2014-12-11T04:44:16Z").date) + self.assertEqual(inst.authored.as_json(), "2014-12-11T04:44:16Z") + self.assertEqual(inst.group.linkId, "1") + self.assertEqual(inst.group.question[0].answer[0].valueCoding.code, "LA6560-2") + self.assertEqual(inst.group.question[0].answer[0].valueCoding.display, "Confused") + self.assertEqual(inst.group.question[0].answer[0].valueCoding.extension[0].url, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") + self.assertEqual(inst.group.question[0].answer[0].valueCoding.extension[0].valueDecimal, 4) + self.assertEqual(inst.group.question[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.group.question[0].linkId, "1.1") + self.assertEqual(inst.group.question[1].answer[0].valueCoding.code, "LA6566-9") + self.assertEqual(inst.group.question[1].answer[0].valueCoding.display, "Localizing pain") + self.assertEqual(inst.group.question[1].answer[0].valueCoding.extension[0].url, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") + self.assertEqual(inst.group.question[1].answer[0].valueCoding.extension[0].valueDecimal, 5) + self.assertEqual(inst.group.question[1].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.group.question[1].linkId, "1.2") + self.assertEqual(inst.group.question[2].answer[0].valueCoding.code, "LA6556-0") + self.assertEqual(inst.group.question[2].answer[0].valueCoding.display, "Eyes open spontaneously") + self.assertEqual(inst.group.question[2].answer[0].valueCoding.extension[0].url, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") + self.assertEqual(inst.group.question[2].answer[0].valueCoding.extension[0].valueDecimal, 4) + self.assertEqual(inst.group.question[2].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.group.question[2].linkId, "1.3") + self.assertEqual(inst.group.title, "Glasgow Coma Score") + self.assertEqual(inst.id, "gcs") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/range.py b/fhirclient/models/DSTU2/range.py new file mode 100644 index 000000000..45b71b38d --- /dev/null +++ b/fhirclient/models/DSTU2/range.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Range) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Range(element.Element): + """ Set of values bounded by low and high. + + A set of ordered Quantities defined by a low and high limit. + """ + + resource_name = "Range" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.high = None + """ High limit. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + self.low = None + """ Low limit. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + super(Range, self).__init__(jsondict) + + def elementProperties(self): + js = super(Range, self).elementProperties() + js.extend([ + ("high", "high", quantity.Quantity, False, None, False), + ("low", "low", quantity.Quantity, False, None, False), + ]) + return js + + +from . import quantity diff --git a/fhirclient/models/DSTU2/ratio.py b/fhirclient/models/DSTU2/ratio.py new file mode 100644 index 000000000..23039d49f --- /dev/null +++ b/fhirclient/models/DSTU2/ratio.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Ratio) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Ratio(element.Element): + """ A ratio of two Quantity values - a numerator and a denominator. + + A relationship of two Quantity values - expressed as a numerator and a + denominator. + """ + + resource_name = "Ratio" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.denominator = None + """ Denominator value. + Type `Quantity` (represented as `dict` in JSON). """ + + self.numerator = None + """ Numerator value. + Type `Quantity` (represented as `dict` in JSON). """ + + super(Ratio, self).__init__(jsondict) + + def elementProperties(self): + js = super(Ratio, self).elementProperties() + js.extend([ + ("denominator", "denominator", quantity.Quantity, False, None, False), + ("numerator", "numerator", quantity.Quantity, False, None, False), + ]) + return js + + +from . import quantity diff --git a/fhirclient/models/DSTU2/reference.py b/fhirclient/models/DSTU2/reference.py new file mode 100644 index 000000000..23dbdd13b --- /dev/null +++ b/fhirclient/models/DSTU2/reference.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Reference) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Reference(element.Element): + """ A reference from one resource to another. + """ + + resource_name = "Reference" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.display = None + """ Text alternative for the resource. + Type `str`. """ + + self.reference = None + """ Relative, internal or absolute URL reference. + Type `str`. """ + + super(Reference, self).__init__(jsondict) + + def elementProperties(self): + js = super(Reference, self).elementProperties() + js.extend([ + ("display", "display", str, False, None, False), + ("reference", "reference", str, False, None, False), + ]) + return js + + diff --git a/fhirclient/models/DSTU2/referralrequest.py b/fhirclient/models/DSTU2/referralrequest.py new file mode 100644 index 000000000..07e5a2bfc --- /dev/null +++ b/fhirclient/models/DSTU2/referralrequest.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ReferralRequest) on 2019-10-12. +# 2019, 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_name = "ReferralRequest" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.date = None + """ Date of creation/activation. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.dateSent = None + """ Date referral/transfer of care request is sent. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ A textual description of the referral. + Type `str`. """ + + self.encounter = None + """ Originating encounter. + Type `FHIRReference` referencing `Encounter` (represented as `dict` in JSON). """ + + self.fulfillmentTime = None + """ Requested service(s) fulfillment time. + Type `Period` (represented as `dict` in JSON). """ + + self.identifier = None + """ Business identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.patient = None + """ Patient referred to care or transfer. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.priority = None + """ Urgency of referral / transfer of care request. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.reason = None + """ Reason for referral / transfer of care request. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.recipient = None + """ Receiver of referral / transfer of care request. + List of `FHIRReference` items referencing `Practitioner, Organization` (represented as `dict` in JSON). """ + + self.requester = None + """ Requester of referral / transfer of care. + Type `FHIRReference` referencing `Practitioner, Organization, Patient` (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 | requested | active | cancelled | accepted | rejected | + completed. + Type `str`. """ + + self.supportingInformation = 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) + + def elementProperties(self): + js = super(ReferralRequest, self).elementProperties() + js.extend([ + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("dateSent", "dateSent", fhirdate.FHIRDate, False, None, False), + ("description", "description", str, False, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), + ("fulfillmentTime", "fulfillmentTime", period.Period, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("patient", "patient", fhirreference.FHIRReference, False, None, False), + ("priority", "priority", codeableconcept.CodeableConcept, False, None, False), + ("reason", "reason", codeableconcept.CodeableConcept, False, None, False), + ("recipient", "recipient", fhirreference.FHIRReference, True, None, False), + ("requester", "requester", fhirreference.FHIRReference, False, None, False), + ("serviceRequested", "serviceRequested", codeableconcept.CodeableConcept, True, None, False), + ("specialty", "specialty", codeableconcept.CodeableConcept, False, None, False), + ("status", "status", str, False, None, True), + ("supportingInformation", "supportingInformation", fhirreference.FHIRReference, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier +from . import period diff --git a/fhirclient/models/DSTU2/referralrequest_tests.py b/fhirclient/models/DSTU2/referralrequest_tests.py new file mode 100644 index 000000000..99369d1f6 --- /dev/null +++ b/fhirclient/models/DSTU2/referralrequest_tests.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +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.dateSent.date, FHIRDate("2014-02-14").date) + self.assertEqual(inst.dateSent.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.id, "example") + self.assertEqual(inst.identifier[0].system, "http://orionhealth.com/fhir/apps/referralids") + self.assertEqual(inst.identifier[0].value, "ret4421") + self.assertEqual(inst.priority.coding[0].code, "med") + self.assertEqual(inst.priority.coding[0].display, "Medium") + self.assertEqual(inst.priority.coding[0].system, "http://orionhealth.com/fhir/apps/prioritycodes") + self.assertEqual(inst.reason.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, "requested") + 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, "rfs") + self.assertEqual(inst.type.coding[0].display, "Referral for service") + self.assertEqual(inst.type.coding[0].system, "http://orionhealth.com/fhir/apps/referraltypes") + diff --git a/fhirclient/models/DSTU2/relatedperson.py b/fhirclient/models/DSTU2/relatedperson.py new file mode 100644 index 000000000..03da71325 --- /dev/null +++ b/fhirclient/models/DSTU2/relatedperson.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/RelatedPerson) on 2019-10-12. +# 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 + care. + + Information about a person that is involved in the care for a patient, but + who is not the target of healthcare, nor has a formal responsibility in the + care process. + """ + + resource_name = "RelatedPerson" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.address = None + """ Address where the related person can be contacted or visited. + List of `Address` items (represented as `dict` in JSON). """ + + self.birthDate = None + """ The date on which the related person was born. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.gender = None + """ male | female | other | unknown. + Type `str`. """ + + self.identifier = None + """ A human identifier for this person. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.name = None + """ A name associated with the person. + Type `HumanName` (represented as `dict` in JSON). """ + + self.patient = None + """ The patient this person is related to. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.period = None + """ Period of time that this relationship is considered valid. + Type `Period` (represented as `dict` in JSON). """ + + self.photo = None + """ Image of the person. + List of `Attachment` items (represented as `dict` in JSON). """ + + self.relationship = None + """ The nature of the relationship. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.telecom = None + """ A contact detail for the person. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(RelatedPerson, self).__init__(jsondict) + + def elementProperties(self): + js = super(RelatedPerson, self).elementProperties() + js.extend([ + ("address", "address", address.Address, True, None, False), + ("birthDate", "birthDate", fhirdate.FHIRDate, False, None, False), + ("gender", "gender", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("name", "name", humanname.HumanName, False, 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), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ]) + return js + + +from . import address +from . import attachment +from . import codeableconcept +from . import contactpoint +from . import fhirdate +from . import fhirreference +from . import humanname +from . import identifier +from . import period diff --git a/fhirclient/models/DSTU2/relatedperson_tests.py b/fhirclient/models/DSTU2/relatedperson_tests.py new file mode 100644 index 000000000..f27ce56ad --- /dev/null +++ b/fhirclient/models/DSTU2/relatedperson_tests.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import relatedperson +from .fhirdate import FHIRDate + + +class RelatedPersonTests(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("RelatedPerson", js["resourceType"]) + return relatedperson.RelatedPerson(js) + + def testRelatedPerson1(self): + inst = self.instantiate_from("relatedperson-example-peter.json") + self.assertIsNotNone(inst, "Must have instantiated a RelatedPerson instance") + self.implRelatedPerson1(inst) + + js = inst.as_json() + self.assertEqual("RelatedPerson", js["resourceType"]) + inst2 = relatedperson.RelatedPerson(js) + self.implRelatedPerson1(inst2) + + def implRelatedPerson1(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.assertEqual(inst.address[0].use, "home") + self.assertEqual(inst.gender, "male") + self.assertEqual(inst.id, "peter") + self.assertEqual(inst.name.family[0], "Chalmers") + self.assertEqual(inst.name.given[0], "Peter") + self.assertEqual(inst.name.given[1], "James") + self.assertEqual(inst.name.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, "owner") + self.assertEqual(inst.relationship.coding[0].system, "http://hl7.org/fhir/patient-contact-relationship") + 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.text.status, "generated") + + def testRelatedPerson2(self): + inst = self.instantiate_from("relatedperson-example-f001-sarah.json") + self.assertIsNotNone(inst, "Must have instantiated a RelatedPerson instance") + self.implRelatedPerson2(inst) + + js = inst.as_json() + self.assertEqual("RelatedPerson", js["resourceType"]) + inst2 = relatedperson.RelatedPerson(js) + self.implRelatedPerson2(inst2) + + def implRelatedPerson2(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.family[0], "Abels") + self.assertEqual(inst.name.given[0], "Sarah") + self.assertEqual(inst.name.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.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.text.status, "generated") + + def testRelatedPerson3(self): + inst = self.instantiate_from("relatedperson-example.json") + self.assertIsNotNone(inst, "Must have instantiated a RelatedPerson instance") + self.implRelatedPerson3(inst) + + js = inst.as_json() + self.assertEqual("RelatedPerson", js["resourceType"]) + inst2 = relatedperson.RelatedPerson(js) + self.implRelatedPerson3(inst2) + + def implRelatedPerson3(self, inst): + self.assertEqual(inst.address[0].city, "Paris") + self.assertEqual(inst.address[0].country, "FRA") + self.assertEqual(inst.address[0].line[0], "43, Place du Marché Sainte Catherine") + self.assertEqual(inst.address[0].postalCode, "75004") + self.assertEqual(inst.gender, "female") + self.assertEqual(inst.id, "benedicte") + self.assertEqual(inst.identifier[0].system, "urn:oid:1.2.250.1.61") + 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.name.family[0], "du") + self.assertEqual(inst.name.family[1], "Marché") + self.assertEqual(inst.name.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, "partner") + self.assertEqual(inst.relationship.coding[0].system, "http://hl7.org/fhir/patient-contact-relationship") + self.assertEqual(inst.relationship.coding[1].code, "WIFE") + self.assertEqual(inst.relationship.coding[1].system, "http://hl7.org/fhir/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 testRelatedPerson4(self): + inst = self.instantiate_from("relatedperson-example-f002-ariadne.json") + self.assertIsNotNone(inst, "Must have instantiated a RelatedPerson instance") + self.implRelatedPerson4(inst) + + js = inst.as_json() + self.assertEqual("RelatedPerson", js["resourceType"]) + inst2 = relatedperson.RelatedPerson(js) + self.implRelatedPerson4(inst2) + + def implRelatedPerson4(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.text, "Ariadne Bor-Jansma") + self.assertEqual(inst.name.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.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/DSTU2/resource.py b/fhirclient/models/DSTU2/resource.py new file mode 100644 index 000000000..9598601cb --- /dev/null +++ b/fhirclient/models/DSTU2/resource.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Resource) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import fhirabstractresource + +class Resource(fhirabstractresource.FHIRAbstractResource): + """ Base Resource. + + This is the base resource type for everything. + """ + + resource_name = "Resource" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.id = None + """ Logical id of this artifact. + Type `str`. """ + + self.implicitRules = None + """ A set of rules under which this content was created. + Type `str`. """ + + self.language = None + """ Language of the resource content. + Type `str`. """ + + self.meta = None + """ Metadata about the resource. + Type `Meta` (represented as `dict` in JSON). """ + + super(Resource, self).__init__(jsondict) + + def elementProperties(self): + js = super(Resource, self).elementProperties() + js.extend([ + ("id", "id", str, False, None, False), + ("implicitRules", "implicitRules", str, False, None, False), + ("language", "language", str, False, None, False), + ("meta", "meta", meta.Meta, False, None, False), + ]) + return js + + +from . import meta diff --git a/fhirclient/models/DSTU2/riskassessment.py b/fhirclient/models/DSTU2/riskassessment.py new file mode 100644 index 000000000..f83824f92 --- /dev/null +++ b/fhirclient/models/DSTU2/riskassessment.py @@ -0,0 +1,150 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/RiskAssessment) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class RiskAssessment(domainresource.DomainResource): + """ Potential outcomes for a subject with likelihood. + + An assessment of the likely outcome(s) for a patient or other subject as + well as the likelihood of each outcome. + """ + + resource_name = "RiskAssessment" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.basis = None + """ Information used in assessment. + List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + + self.condition = None + """ Condition assessed. + Type `FHIRReference` referencing `Condition` (represented as `dict` in JSON). """ + + self.date = None + """ When was assessment made?. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.encounter = None + """ Where was assessment performed?. + Type `FHIRReference` referencing `Encounter` (represented as `dict` in JSON). """ + + self.identifier = None + """ Unique identifier for the assessment. + Type `Identifier` (represented as `dict` in JSON). """ + + self.method = None + """ Evaluation mechanism. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.mitigation = None + """ How to reduce risk. + Type `str`. """ + + self.performer = None + """ Who did assessment?. + Type `FHIRReference` referencing `Practitioner, Device` (represented as `dict` in JSON). """ + + self.prediction = None + """ Outcome predicted. + List of `RiskAssessmentPrediction` items (represented as `dict` in JSON). """ + + self.subject = None + """ Who/what does assessment apply to?. + Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ + + super(RiskAssessment, self).__init__(jsondict) + + def elementProperties(self): + js = super(RiskAssessment, self).elementProperties() + js.extend([ + ("basis", "basis", fhirreference.FHIRReference, True, None, False), + ("condition", "condition", fhirreference.FHIRReference, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("method", "method", codeableconcept.CodeableConcept, False, None, False), + ("mitigation", "mitigation", str, False, None, False), + ("performer", "performer", fhirreference.FHIRReference, False, None, False), + ("prediction", "prediction", RiskAssessmentPrediction, True, None, False), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +from . import backboneelement + +class RiskAssessmentPrediction(backboneelement.BackboneElement): + """ Outcome predicted. + + Describes the expected outcome for the subject. + """ + + resource_name = "RiskAssessmentPrediction" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.outcome = None + """ Possible outcome for the subject. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.probabilityCodeableConcept = None + """ Likelihood of specified outcome. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.probabilityDecimal = None + """ Likelihood of specified outcome. + Type `float`. """ + + self.probabilityRange = None + """ Likelihood of specified outcome. + Type `Range` (represented as `dict` in JSON). """ + + self.rationale = None + """ Explanation of prediction. + Type `str`. """ + + self.relativeRisk = None + """ Relative likelihood. + Type `float`. """ + + self.whenPeriod = None + """ Timeframe or age range. + Type `Period` (represented as `dict` in JSON). """ + + self.whenRange = None + """ Timeframe or age range. + Type `Range` (represented as `dict` in JSON). """ + + super(RiskAssessmentPrediction, self).__init__(jsondict) + + def elementProperties(self): + js = super(RiskAssessmentPrediction, self).elementProperties() + js.extend([ + ("outcome", "outcome", codeableconcept.CodeableConcept, False, None, True), + ("probabilityCodeableConcept", "probabilityCodeableConcept", codeableconcept.CodeableConcept, False, "probability", False), + ("probabilityDecimal", "probabilityDecimal", float, False, "probability", False), + ("probabilityRange", "probabilityRange", range.Range, False, "probability", False), + ("rationale", "rationale", str, False, None, False), + ("relativeRisk", "relativeRisk", float, False, None, False), + ("whenPeriod", "whenPeriod", period.Period, False, "when", False), + ("whenRange", "whenRange", range.Range, False, "when", False), + ]) + return js + + +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier +from . import period +from . import range diff --git a/fhirclient/models/DSTU2/riskassessment_tests.py b/fhirclient/models/DSTU2/riskassessment_tests.py new file mode 100644 index 000000000..6860130a4 --- /dev/null +++ b/fhirclient/models/DSTU2/riskassessment_tests.py @@ -0,0 +1,178 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import riskassessment +from .fhirdate import FHIRDate + + +class RiskAssessmentTests(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("RiskAssessment", js["resourceType"]) + return riskassessment.RiskAssessment(js) + + def testRiskAssessment1(self): + inst = self.instantiate_from("riskassessment-example-population.json") + self.assertIsNotNone(inst, "Must have instantiated a RiskAssessment instance") + self.implRiskAssessment1(inst) + + js = inst.as_json() + self.assertEqual("RiskAssessment", js["resourceType"]) + inst2 = riskassessment.RiskAssessment(js) + self.implRiskAssessment1(inst2) + + def implRiskAssessment1(self, inst): + self.assertEqual(inst.id, "population") + 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.date.date, FHIRDate("2014-07-19T16:04:00Z").date) + self.assertEqual(inst.date.as_json(), "2014-07-19T16:04:00Z") + self.assertEqual(inst.id, "cardiac") + self.assertEqual(inst.prediction[0].outcome.text, "Heart Attack") + self.assertEqual(inst.prediction[0].probabilityDecimal, 0.02) + self.assertEqual(inst.prediction[0].whenRange.high.code, "a") + self.assertEqual(inst.prediction[0].whenRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[0].whenRange.high.unit, "years") + self.assertEqual(inst.prediction[0].whenRange.high.value, 49) + self.assertEqual(inst.prediction[0].whenRange.low.code, "a") + self.assertEqual(inst.prediction[0].whenRange.low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[0].whenRange.low.unit, "years") + self.assertEqual(inst.prediction[0].whenRange.low.value, 39) + self.assertEqual(inst.text.status, "additional") + + def testRiskAssessment3(self): + inst = self.instantiate_from("riskassessment-example.json") + self.assertIsNotNone(inst, "Must have instantiated a RiskAssessment instance") + self.implRiskAssessment3(inst) + + js = inst.as_json() + self.assertEqual("RiskAssessment", js["resourceType"]) + inst2 = riskassessment.RiskAssessment(js) + self.implRiskAssessment3(inst2) + + def implRiskAssessment3(self, inst): + self.assertEqual(inst.date.date, FHIRDate("2006-01-13T23:01:00Z").date) + self.assertEqual(inst.date.as_json(), "2006-01-13T23:01:00Z") + self.assertEqual(inst.id, "genetic") + self.assertEqual(inst.method.coding[0].code, "BRCAPRO") + self.assertEqual(inst.prediction[0].outcome.text, "Breast Cancer") + self.assertEqual(inst.prediction[0].probabilityDecimal, 0.000168) + self.assertEqual(inst.prediction[0].whenRange.high.code, "a") + self.assertEqual(inst.prediction[0].whenRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[0].whenRange.high.unit, "years") + self.assertEqual(inst.prediction[0].whenRange.high.value, 53) + self.assertEqual(inst.prediction[1].outcome.text, "Breast Cancer") + self.assertEqual(inst.prediction[1].probabilityDecimal, 0.000368) + self.assertEqual(inst.prediction[1].whenRange.high.code, "a") + self.assertEqual(inst.prediction[1].whenRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[1].whenRange.high.unit, "years") + self.assertEqual(inst.prediction[1].whenRange.high.value, 57) + self.assertEqual(inst.prediction[1].whenRange.low.code, "a") + self.assertEqual(inst.prediction[1].whenRange.low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[1].whenRange.low.unit, "years") + self.assertEqual(inst.prediction[1].whenRange.low.value, 54) + self.assertEqual(inst.prediction[2].outcome.text, "Breast Cancer") + self.assertEqual(inst.prediction[2].probabilityDecimal, 0.000594) + self.assertEqual(inst.prediction[2].whenRange.high.code, "a") + self.assertEqual(inst.prediction[2].whenRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[2].whenRange.high.unit, "years") + self.assertEqual(inst.prediction[2].whenRange.high.value, 62) + self.assertEqual(inst.prediction[2].whenRange.low.code, "a") + self.assertEqual(inst.prediction[2].whenRange.low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[2].whenRange.low.unit, "years") + self.assertEqual(inst.prediction[2].whenRange.low.value, 58) + self.assertEqual(inst.prediction[3].outcome.text, "Breast Cancer") + self.assertEqual(inst.prediction[3].probabilityDecimal, 0.000838) + self.assertEqual(inst.prediction[3].whenRange.high.code, "a") + self.assertEqual(inst.prediction[3].whenRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[3].whenRange.high.unit, "years") + self.assertEqual(inst.prediction[3].whenRange.high.value, 67) + self.assertEqual(inst.prediction[3].whenRange.low.code, "a") + self.assertEqual(inst.prediction[3].whenRange.low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[3].whenRange.low.unit, "years") + self.assertEqual(inst.prediction[3].whenRange.low.value, 63) + self.assertEqual(inst.prediction[4].outcome.text, "Breast Cancer") + self.assertEqual(inst.prediction[4].probabilityDecimal, 0.001089) + self.assertEqual(inst.prediction[4].whenRange.high.code, "a") + self.assertEqual(inst.prediction[4].whenRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[4].whenRange.high.unit, "years") + self.assertEqual(inst.prediction[4].whenRange.high.value, 72) + self.assertEqual(inst.prediction[4].whenRange.low.code, "a") + self.assertEqual(inst.prediction[4].whenRange.low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[4].whenRange.low.unit, "years") + self.assertEqual(inst.prediction[4].whenRange.low.value, 68) + self.assertEqual(inst.prediction[5].outcome.text, "Breast Cancer") + self.assertEqual(inst.prediction[5].probabilityDecimal, 0.001327) + self.assertEqual(inst.prediction[5].whenRange.high.code, "a") + self.assertEqual(inst.prediction[5].whenRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[5].whenRange.high.unit, "years") + self.assertEqual(inst.prediction[5].whenRange.high.value, 77) + self.assertEqual(inst.prediction[5].whenRange.low.code, "a") + self.assertEqual(inst.prediction[5].whenRange.low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[5].whenRange.low.unit, "years") + self.assertEqual(inst.prediction[5].whenRange.low.value, 73) + self.assertEqual(inst.prediction[6].outcome.text, "Breast Cancer") + self.assertEqual(inst.prediction[6].probabilityDecimal, 0.00153) + self.assertEqual(inst.prediction[6].whenRange.high.code, "a") + self.assertEqual(inst.prediction[6].whenRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[6].whenRange.high.unit, "years") + self.assertEqual(inst.prediction[6].whenRange.high.value, 82) + self.assertEqual(inst.prediction[6].whenRange.low.code, "a") + self.assertEqual(inst.prediction[6].whenRange.low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[6].whenRange.low.unit, "years") + self.assertEqual(inst.prediction[6].whenRange.low.value, 78) + self.assertEqual(inst.prediction[7].outcome.text, "Breast Cancer") + self.assertEqual(inst.prediction[7].probabilityDecimal, 0.001663) + self.assertEqual(inst.prediction[7].whenRange.high.code, "a") + self.assertEqual(inst.prediction[7].whenRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[7].whenRange.high.unit, "years") + self.assertEqual(inst.prediction[7].whenRange.high.value, 88) + self.assertEqual(inst.prediction[7].whenRange.low.code, "a") + self.assertEqual(inst.prediction[7].whenRange.low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[7].whenRange.low.unit, "years") + self.assertEqual(inst.prediction[7].whenRange.low.value, 83) + self.assertEqual(inst.text.status, "generated") + + def testRiskAssessment4(self): + inst = self.instantiate_from("riskassessment-example-prognosis.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.date.date, FHIRDate("2010-11-22").date) + self.assertEqual(inst.date.as_json(), "2010-11-22") + self.assertEqual(inst.id, "prognosis") + 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].probabilityCodeableConcept.coding[0].code, "moderate") + self.assertEqual(inst.prediction[0].probabilityCodeableConcept.coding[0].display, "moderate likelihood") + self.assertEqual(inst.prediction[0].probabilityCodeableConcept.coding[0].system, "http://hl7.org/fhir/risk-probability") + self.assertEqual(inst.text.status, "additional") + diff --git a/fhirclient/models/DSTU2/sampleddata.py b/fhirclient/models/DSTU2/sampleddata.py new file mode 100644 index 000000000..26b43cfcf --- /dev/null +++ b/fhirclient/models/DSTU2/sampleddata.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/SampledData) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class SampledData(element.Element): + """ A series of measurements taken by a device. + + A series of measurements taken by a device, with upper and lower limits. + There may be more than one dimension in the data. + """ + + resource_name = "SampledData" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.data = None + """ Decimal values with spaces, or "E" | "U" | "L". + Type `str`. """ + + self.dimensions = None + """ Number of sample points at each time point. + Type `int`. """ + + self.factor = None + """ Multiply data by this before adding to origin. + Type `float`. """ + + self.lowerLimit = None + """ Lower limit of detection. + Type `float`. """ + + self.origin = None + """ Zero value and units. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + self.period = None + """ Number of milliseconds between samples. + Type `float`. """ + + self.upperLimit = None + """ Upper limit of detection. + Type `float`. """ + + super(SampledData, self).__init__(jsondict) + + def elementProperties(self): + js = super(SampledData, self).elementProperties() + js.extend([ + ("data", "data", str, False, None, True), + ("dimensions", "dimensions", int, False, None, True), + ("factor", "factor", float, False, None, False), + ("lowerLimit", "lowerLimit", float, False, None, False), + ("origin", "origin", quantity.Quantity, False, None, True), + ("period", "period", float, False, None, True), + ("upperLimit", "upperLimit", float, False, None, False), + ]) + return js + + +from . import quantity diff --git a/fhirclient/models/DSTU2/schedule.py b/fhirclient/models/DSTU2/schedule.py new file mode 100644 index 000000000..23e7e9d4e --- /dev/null +++ b/fhirclient/models/DSTU2/schedule.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Schedule) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Schedule(domainresource.DomainResource): + """ A container for slot(s) of time that may be available for booking + appointments. + """ + + resource_name = "Schedule" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.actor = None + """ The resource this Schedule resource is providing availability + information for. These are expected to usually be one of + HealthcareService, Location, Practitioner, Device, Patient or + RelatedPerson. + Type `FHIRReference` referencing `Patient, Practitioner, RelatedPerson, Device, HealthcareService, Location` (represented as `dict` in JSON). """ + + self.comment = None + """ Comments on the availability to describe any extended information. + Such as custom constraints on the slot(s) that may be associated. + Type `str`. """ + + self.identifier = None + """ External Ids for this item. + 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. + Type `Period` (represented as `dict` in JSON). """ + + self.type = None + """ The schedule type can be used for the categorization of healthcare + services or other appointment types. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(Schedule, self).__init__(jsondict) + + def elementProperties(self): + js = super(Schedule, self).elementProperties() + js.extend([ + ("actor", "actor", fhirreference.FHIRReference, False, None, True), + ("comment", "comment", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("planningHorizon", "planningHorizon", period.Period, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +from . import codeableconcept +from . import fhirreference +from . import identifier +from . import period diff --git a/fhirclient/models/DSTU2/schedule_tests.py b/fhirclient/models/DSTU2/schedule_tests.py new file mode 100644 index 000000000..3d21b8461 --- /dev/null +++ b/fhirclient/models/DSTU2/schedule_tests.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import schedule +from .fhirdate import FHIRDate + + +class ScheduleTests(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("Schedule", js["resourceType"]) + return schedule.Schedule(js) + + def testSchedule1(self): + inst = self.instantiate_from("schedule-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Schedule instance") + self.implSchedule1(inst) + + js = inst.as_json() + self.assertEqual("Schedule", js["resourceType"]) + inst2 = schedule.Schedule(js) + self.implSchedule1(inst2) + + def implSchedule1(self, inst): + self.assertEqual(inst.comment, "Assessments should be performed before requesting appointments in this slot.") + 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, "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.text.status, "generated") + self.assertEqual(inst.type[0].coding[0].code, "45") + self.assertEqual(inst.type[0].coding[0].display, "Physiotherapy") + diff --git a/fhirclient/models/DSTU2/searchparameter.py b/fhirclient/models/DSTU2/searchparameter.py new file mode 100644 index 000000000..666d73500 --- /dev/null +++ b/fhirclient/models/DSTU2/searchparameter.py @@ -0,0 +1,142 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/SearchParameter) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class SearchParameter(domainresource.DomainResource): + """ Search Parameter for a resource. + + A search parameter that defines a named search item that can be used to + search/filter on a resource. + """ + + resource_name = "SearchParameter" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.base = None + """ The resource type this search parameter applies to. + Type `str`. """ + + self.code = None + """ Code used in URL. + Type `str`. """ + + self.contact = None + """ Contact details of the publisher. + List of `SearchParameterContact` items (represented as `dict` in JSON). """ + + self.date = None + """ Publication Date(/time). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Documentation for search parameter. + Type `str`. """ + + self.experimental = None + """ If for testing purposes, not real usage. + Type `bool`. """ + + self.name = None + """ Informal name for this search parameter. + Type `str`. """ + + self.publisher = None + """ Name of the publisher (Organization or individual). + Type `str`. """ + + self.requirements = None + """ Why this search parameter is defined. + Type `str`. """ + + self.status = None + """ draft | active | retired. + Type `str`. """ + + self.target = None + """ Types of resource (if a resource reference). + List of `str` items. """ + + self.type = None + """ number | date | string | token | reference | composite | quantity | + uri. + Type `str`. """ + + self.url = None + """ Absolute URL used to reference this search parameter. + Type `str`. """ + + self.xpath = None + """ XPath that extracts the values. + Type `str`. """ + + self.xpathUsage = None + """ normal | phonetic | nearby | distance | other. + Type `str`. """ + + super(SearchParameter, self).__init__(jsondict) + + def elementProperties(self): + js = super(SearchParameter, self).elementProperties() + js.extend([ + ("base", "base", str, False, None, True), + ("code", "code", str, False, None, True), + ("contact", "contact", SearchParameterContact, True, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("description", "description", str, False, None, True), + ("experimental", "experimental", bool, False, None, False), + ("name", "name", str, False, None, True), + ("publisher", "publisher", str, False, None, False), + ("requirements", "requirements", str, False, None, False), + ("status", "status", str, False, None, False), + ("target", "target", str, True, None, False), + ("type", "type", str, False, None, True), + ("url", "url", str, False, None, True), + ("xpath", "xpath", str, False, None, False), + ("xpathUsage", "xpathUsage", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class SearchParameterContact(backboneelement.BackboneElement): + """ Contact details of the publisher. + + Contacts to assist a user in finding and communicating with the publisher. + """ + + resource_name = "SearchParameterContact" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.name = None + """ Name of a individual to contact. + Type `str`. """ + + self.telecom = None + """ Contact details for individual or publisher. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(SearchParameterContact, self).__init__(jsondict) + + def elementProperties(self): + js = super(SearchParameterContact, self).elementProperties() + js.extend([ + ("name", "name", str, False, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ]) + return js + + +from . import contactpoint +from . import fhirdate diff --git a/fhirclient/models/DSTU2/searchparameter_tests.py b/fhirclient/models/DSTU2/searchparameter_tests.py new file mode 100644 index 000000000..c0befeb89 --- /dev/null +++ b/fhirclient/models/DSTU2/searchparameter_tests.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import searchparameter +from .fhirdate import FHIRDate + + +class SearchParameterTests(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("SearchParameter", js["resourceType"]) + return searchparameter.SearchParameter(js) + + def testSearchParameter1(self): + inst = self.instantiate_from("searchparameter-example-extension.json") + self.assertIsNotNone(inst, "Must have instantiated a SearchParameter instance") + self.implSearchParameter1(inst) + + js = inst.as_json() + self.assertEqual("SearchParameter", js["resourceType"]) + inst2 = searchparameter.SearchParameter(js) + self.implSearchParameter1(inst2) + + def implSearchParameter1(self, inst): + self.assertEqual(inst.base, "Patient") + self.assertEqual(inst.code, "part-agree") + self.assertEqual(inst.contact[0].telecom[0].system, "other") + self.assertEqual(inst.contact[0].telecom[0].value, "http://hl7.org/fhir") + self.assertEqual(inst.description, "Search by url for a participation agreement, which is stored in a DocumentReference") + self.assertEqual(inst.id, "example-extension") + self.assertEqual(inst.name, "Example Search Parameter on an extension") + self.assertEqual(inst.publisher, "Health Level Seven International (FHIR Infrastructure)") + self.assertEqual(inst.target[0], "DocumentReference") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type, "reference") + self.assertEqual(inst.url, "http://hl7.org/fhir/SearchParameter/example-extension") + self.assertEqual(inst.xpath, "f:DocumentReference/f:extension[@url='http://example.org/fhir/StructureDefinition/participation-agreement']") + self.assertEqual(inst.xpathUsage, "normal") + + def testSearchParameter2(self): + inst = self.instantiate_from("searchparameter-example.json") + self.assertIsNotNone(inst, "Must have instantiated a SearchParameter instance") + self.implSearchParameter2(inst) + + js = inst.as_json() + self.assertEqual("SearchParameter", js["resourceType"]) + inst2 = searchparameter.SearchParameter(js) + self.implSearchParameter2(inst2) + + def implSearchParameter2(self, inst): + self.assertEqual(inst.base, "Resource") + self.assertEqual(inst.code, "_id") + self.assertEqual(inst.contact[0].name, "[string]") + self.assertEqual(inst.contact[0].telecom[0].system, "other") + self.assertEqual(inst.contact[0].telecom[0].value, "http://hl7.org/fhir") + self.assertEqual(inst.date.date, FHIRDate("2013-10-23").date) + self.assertEqual(inst.date.as_json(), "2013-10-23") + self.assertEqual(inst.description, "Search by resource identifier - e.g. same as the read interaction, but can return included resources") + self.assertFalse(inst.experimental) + self.assertEqual(inst.id, "example") + self.assertEqual(inst.name, "Example Search Parameter") + self.assertEqual(inst.publisher, "Health Level Seven International (FHIR Infrastructure)") + self.assertEqual(inst.requirements, "Need to search by identifier for various infrastructural cases - mainly retrieving packages, and matching as part of a chain") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type, "token") + self.assertEqual(inst.url, "http://hl7.org/fhir/SearchParameter/example") + self.assertEqual(inst.xpath, "f:*/f:id") + self.assertEqual(inst.xpathUsage, "normal") + diff --git a/fhirclient/models/DSTU2/signature.py b/fhirclient/models/DSTU2/signature.py new file mode 100644 index 000000000..77ed8f4bb --- /dev/null +++ b/fhirclient/models/DSTU2/signature.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Signature) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Signature(element.Element): + """ A digital Signature - XML DigSig, JWT, 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. + """ + + resource_name = "Signature" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.blob = None + """ The actual signature content (XML DigSig. JWT, picture, etc.). + Type `str`. """ + + self.contentType = None + """ The technical format of the signature. + Type `str`. """ + + self.type = None + """ Indication of the reason the entity signed the object(s). + List of `Coding` items (represented as `dict` in JSON). """ + + self.when = None + """ When the signature was created. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.whoReference = None + """ Who signed the signature. + Type `FHIRReference` referencing `Practitioner, RelatedPerson, Patient, Device, Organization` (represented as `dict` in JSON). """ + + self.whoUri = None + """ Who signed the signature. + Type `str`. """ + + super(Signature, self).__init__(jsondict) + + def elementProperties(self): + js = super(Signature, self).elementProperties() + js.extend([ + ("blob", "blob", str, False, None, True), + ("contentType", "contentType", str, False, None, True), + ("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), + ]) + return js + + +from . import coding +from . import fhirdate +from . import fhirreference diff --git a/fhirclient/models/DSTU2/slot.py b/fhirclient/models/DSTU2/slot.py new file mode 100644 index 000000000..95570fe9e --- /dev/null +++ b/fhirclient/models/DSTU2/slot.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Slot) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Slot(domainresource.DomainResource): + """ A slot of time on a schedule that may be available for booking appointments. + """ + + resource_name = "Slot" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.comment = None + """ Comments on the slot to describe any extended information. Such as + custom constraints on the slot. + Type `str`. """ + + self.end = None + """ Date/Time that the slot is to conclude. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.freeBusyType = None + """ busy | free | busy-unavailable | busy-tentative. + Type `str`. """ + + self.identifier = None + """ External Ids for this item. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.overbooked = None + """ This slot has already been overbooked, appointments are unlikely to + be accepted for this time. + Type `bool`. """ + + self.schedule = None + """ The schedule resource that this slot defines an interval of status + information. + Type `FHIRReference` referencing `Schedule` (represented as `dict` in JSON). """ + + self.start = None + """ Date/Time that the slot is to begin. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.type = None + """ The type of appointments that can be booked into this slot (ideally + this would be an identifiable service - which is at a location, + rather than the location itself). If provided then this overrides + the value provided on the availability resource. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(Slot, self).__init__(jsondict) + + def elementProperties(self): + js = super(Slot, self).elementProperties() + js.extend([ + ("comment", "comment", str, False, None, False), + ("end", "end", fhirdate.FHIRDate, False, None, True), + ("freeBusyType", "freeBusyType", str, False, None, True), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("overbooked", "overbooked", bool, False, None, False), + ("schedule", "schedule", fhirreference.FHIRReference, False, None, True), + ("start", "start", fhirdate.FHIRDate, False, None, True), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier diff --git a/fhirclient/models/DSTU2/slot_tests.py b/fhirclient/models/DSTU2/slot_tests.py new file mode 100644 index 000000000..e0faaae70 --- /dev/null +++ b/fhirclient/models/DSTU2/slot_tests.py @@ -0,0 +1,114 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import slot +from .fhirdate import FHIRDate + + +class SlotTests(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("Slot", js["resourceType"]) + return slot.Slot(js) + + def testSlot1(self): + inst = self.instantiate_from("slot-example-busy.json") + self.assertIsNotNone(inst, "Must have instantiated a Slot instance") + self.implSlot1(inst) + + js = inst.as_json() + self.assertEqual("Slot", js["resourceType"]) + inst2 = slot.Slot(js) + self.implSlot1(inst2) + + def implSlot1(self, inst): + self.assertEqual(inst.comment, "Assessments should be performed before requesting appointments in this slot.") + self.assertEqual(inst.end.date, FHIRDate("2013-12-25T09:15:00Z").date) + self.assertEqual(inst.end.as_json(), "2013-12-25T09:15:00Z") + self.assertEqual(inst.freeBusyType, "busy") + self.assertEqual(inst.id, "1") + self.assertEqual(inst.identifier[0].system, "http://example.org/identifiers/slots") + self.assertEqual(inst.identifier[0].value, "123132") + self.assertTrue(inst.overbooked) + 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.text.status, "generated") + self.assertEqual(inst.type.coding[0].code, "45") + self.assertEqual(inst.type.coding[0].display, "Physiotherapy") + + def testSlot2(self): + inst = self.instantiate_from("slot-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Slot instance") + self.implSlot2(inst) + + js = inst.as_json() + self.assertEqual("Slot", js["resourceType"]) + inst2 = slot.Slot(js) + self.implSlot2(inst2) + + def implSlot2(self, inst): + 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.freeBusyType, "free") + self.assertEqual(inst.id, "example") + 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.text.status, "generated") + self.assertEqual(inst.type.coding[0].code, "45") + self.assertEqual(inst.type.coding[0].display, "Physiotherapy") + + def testSlot3(self): + inst = self.instantiate_from("slot-example-unavailable.json") + self.assertIsNotNone(inst, "Must have instantiated a Slot instance") + self.implSlot3(inst) + + js = inst.as_json() + self.assertEqual("Slot", js["resourceType"]) + inst2 = slot.Slot(js) + self.implSlot3(inst2) + + def implSlot3(self, inst): + self.assertEqual(inst.comment, "Dr Careful is out of the office") + 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.freeBusyType, "busy-unavailable") + self.assertEqual(inst.id, "3") + 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.text.status, "generated") + self.assertEqual(inst.type.coding[0].code, "45") + self.assertEqual(inst.type.coding[0].display, "Physiotherapy") + + def testSlot4(self): + inst = self.instantiate_from("slot-example-tentative.json") + self.assertIsNotNone(inst, "Must have instantiated a Slot instance") + self.implSlot4(inst) + + js = inst.as_json() + self.assertEqual("Slot", js["resourceType"]) + inst2 = slot.Slot(js) + self.implSlot4(inst2) + + def implSlot4(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.freeBusyType, "busy-tentative") + self.assertEqual(inst.id, "2") + 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.text.status, "generated") + self.assertEqual(inst.type.coding[0].code, "45") + self.assertEqual(inst.type.coding[0].display, "Physiotherapy") + diff --git a/fhirclient/models/DSTU2/specimen.py b/fhirclient/models/DSTU2/specimen.py new file mode 100644 index 000000000..0e154bda1 --- /dev/null +++ b/fhirclient/models/DSTU2/specimen.py @@ -0,0 +1,238 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Specimen) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Specimen(domainresource.DomainResource): + """ Sample for analysis. + + A sample to be used for analysis. + """ + + resource_name = "Specimen" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.accessionIdentifier = None + """ Identifier assigned by the lab. + Type `Identifier` (represented as `dict` in JSON). """ + + self.collection = None + """ Collection details. + Type `SpecimenCollection` (represented as `dict` in JSON). """ + + self.container = None + """ Direct container of specimen (tube/slide, etc.). + List of `SpecimenContainer` items (represented as `dict` in JSON). """ + + self.identifier = None + """ External Identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.parent = None + """ Specimen from which this specimen originated. + List of `FHIRReference` items referencing `Specimen` (represented as `dict` in JSON). """ + + self.receivedTime = None + """ The time when specimen was received for processing. + Type `FHIRDate` (represented as `str` 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). """ + + self.treatment = None + """ Treatment and processing step details. + List of `SpecimenTreatment` items (represented as `dict` in JSON). """ + + self.type = None + """ Kind of material that forms the specimen. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(Specimen, self).__init__(jsondict) + + def elementProperties(self): + js = super(Specimen, self).elementProperties() + js.extend([ + ("accessionIdentifier", "accessionIdentifier", identifier.Identifier, False, None, False), + ("collection", "collection", SpecimenCollection, False, None, False), + ("container", "container", SpecimenContainer, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("parent", "parent", fhirreference.FHIRReference, True, None, False), + ("receivedTime", "receivedTime", fhirdate.FHIRDate, False, None, False), + ("status", "status", str, False, None, False), + ("subject", "subject", fhirreference.FHIRReference, False, None, True), + ("treatment", "treatment", SpecimenTreatment, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import backboneelement + +class SpecimenCollection(backboneelement.BackboneElement): + """ Collection details. + + Details concerning the specimen collection. + """ + + resource_name = "SpecimenCollection" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.bodySite = None + """ Anatomical collection site. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.collectedDateTime = None + """ Collection time. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.collectedPeriod = None + """ Collection time. + Type `Period` (represented as `dict` in JSON). """ + + self.collector = None + """ Who collected the specimen. + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + self.comment = None + """ Collector comments. + List of `str` items. """ + + self.method = None + """ Technique used to perform collection. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.quantity = None + """ The quantity of specimen collected. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + super(SpecimenCollection, self).__init__(jsondict) + + def elementProperties(self): + js = super(SpecimenCollection, self).elementProperties() + js.extend([ + ("bodySite", "bodySite", codeableconcept.CodeableConcept, False, None, False), + ("collectedDateTime", "collectedDateTime", fhirdate.FHIRDate, False, "collected", False), + ("collectedPeriod", "collectedPeriod", period.Period, False, "collected", False), + ("collector", "collector", fhirreference.FHIRReference, False, None, False), + ("comment", "comment", str, True, None, False), + ("method", "method", codeableconcept.CodeableConcept, False, None, False), + ("quantity", "quantity", quantity.Quantity, False, None, False), + ]) + return js + + +class SpecimenContainer(backboneelement.BackboneElement): + """ Direct container of specimen (tube/slide, etc.). + + The container holding the specimen. The recursive nature of containers; + i.e. blood in tube in tray in rack is not addressed here. + """ + + resource_name = "SpecimenContainer" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.additiveCodeableConcept = None + """ Additive associated with container. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.additiveReference = None + """ Additive associated with container. + Type `FHIRReference` referencing `Substance` (represented as `dict` in JSON). """ + + self.capacity = None + """ Container volume or size. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + self.description = None + """ Textual description of the container. + Type `str`. """ + + self.identifier = None + """ Id for the container. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.specimenQuantity = None + """ Quantity of specimen within container. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + self.type = None + """ Kind of container directly associated with specimen. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(SpecimenContainer, self).__init__(jsondict) + + def elementProperties(self): + js = super(SpecimenContainer, self).elementProperties() + js.extend([ + ("additiveCodeableConcept", "additiveCodeableConcept", codeableconcept.CodeableConcept, False, "additive", False), + ("additiveReference", "additiveReference", fhirreference.FHIRReference, False, "additive", False), + ("capacity", "capacity", quantity.Quantity, False, None, False), + ("description", "description", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("specimenQuantity", "specimenQuantity", quantity.Quantity, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class SpecimenTreatment(backboneelement.BackboneElement): + """ Treatment and processing step details. + + Details concerning treatment and processing steps for the specimen. + """ + + resource_name = "SpecimenTreatment" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.additive = None + """ Material used in the processing step. + List of `FHIRReference` items referencing `Substance` (represented as `dict` in JSON). """ + + self.description = None + """ Textual description of procedure. + Type `str`. """ + + self.procedure = None + """ Indicates the treatment or processing step applied to the specimen. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(SpecimenTreatment, self).__init__(jsondict) + + def elementProperties(self): + js = super(SpecimenTreatment, self).elementProperties() + js.extend([ + ("additive", "additive", fhirreference.FHIRReference, True, None, False), + ("description", "description", str, False, None, False), + ("procedure", "procedure", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier +from . import period +from . import quantity diff --git a/fhirclient/models/DSTU2/specimen_tests.py b/fhirclient/models/DSTU2/specimen_tests.py new file mode 100644 index 000000000..a5d259eac --- /dev/null +++ b/fhirclient/models/DSTU2/specimen_tests.py @@ -0,0 +1,121 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import specimen +from .fhirdate import FHIRDate + + +class SpecimenTests(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("Specimen", js["resourceType"]) + return specimen.Specimen(js) + + def testSpecimen1(self): + inst = self.instantiate_from("specimen-example-isolate.json") + self.assertIsNotNone(inst, "Must have instantiated a Specimen instance") + self.implSpecimen1(inst) + + js = inst.as_json() + self.assertEqual("Specimen", js["resourceType"]) + inst2 = specimen.Specimen(js) + self.implSpecimen1(inst2) + + def implSpecimen1(self, inst): + self.assertEqual(inst.accessionIdentifier.system, "http://lab.acme.org/specimens/2011") + self.assertEqual(inst.accessionIdentifier.value, "X352356-ISO1") + 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.contained[0].id, "stool") + self.assertEqual(inst.id, "isolate") + self.assertEqual(inst.receivedTime.date, FHIRDate("2015-08-18T07:03:00Z").date) + self.assertEqual(inst.receivedTime.as_json(), "2015-08-18T07:03:00Z") + self.assertEqual(inst.status, "available") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.coding[0].code, "429951000124103") + self.assertEqual(inst.type.coding[0].display, "Bacterial isolate specimen") + self.assertEqual(inst.type.coding[0].system, "http://snomed.info/sct") + + def testSpecimen2(self): + inst = self.instantiate_from("specimen-example-urine.json") + self.assertIsNotNone(inst, "Must have instantiated a Specimen instance") + self.implSpecimen2(inst) + + js = inst.as_json() + self.assertEqual("Specimen", js["resourceType"]) + inst2 = specimen.Specimen(js) + self.implSpecimen2(inst2) + + def implSpecimen2(self, inst): + self.assertEqual(inst.accessionIdentifier.system, "http://lab.acme.org/specimens/2015") + self.assertEqual(inst.accessionIdentifier.value, "X352356") + self.assertEqual(inst.collection.collectedDateTime.date, FHIRDate("2015-08-18T07:03:00Z").date) + self.assertEqual(inst.collection.collectedDateTime.as_json(), "2015-08-18T07:03:00Z") + self.assertEqual(inst.container[0].capacity.unit, "mls") + self.assertEqual(inst.container[0].capacity.value, 50) + self.assertEqual(inst.container[0].specimenQuantity.unit, "mls") + 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.receivedTime.date, FHIRDate("2015-08-18T07:03:00Z").date) + self.assertEqual(inst.receivedTime.as_json(), "2015-08-18T07:03:00Z") + self.assertEqual(inst.status, "available") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.treatment[0].description, "Acidify to pH < 3.0 with 6 N HCl.") + self.assertEqual(inst.treatment[0].procedure.coding[0].code, "ACID") + self.assertEqual(inst.treatment[0].procedure.coding[0].system, "http://hl7.org/fhir/v2/0373") + 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") + + def testSpecimen3(self): + inst = self.instantiate_from("specimen-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Specimen instance") + self.implSpecimen3(inst) + + js = inst.as_json() + self.assertEqual("Specimen", js["resourceType"]) + inst2 = specimen.Specimen(js) + self.implSpecimen3(inst2) + + def implSpecimen3(self, inst): + self.assertEqual(inst.accessionIdentifier.system, "http://lab.acme.org/specimens/2011") + self.assertEqual(inst.accessionIdentifier.value, "X352356") + 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.comment[0], "Specimen is grossly lipemic") + 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.quantity.unit, "mL") + self.assertEqual(inst.collection.quantity.value, 6) + self.assertEqual(inst.contained[0].id, "hep") + self.assertEqual(inst.container[0].capacity.unit, "mL") + self.assertEqual(inst.container[0].capacity.value, 10) + self.assertEqual(inst.container[0].description, "Green Gel tube") + self.assertEqual(inst.container[0].identifier[0].value, "48736-15394-75465") + self.assertEqual(inst.container[0].specimenQuantity.unit, "mL") + self.assertEqual(inst.container[0].specimenQuantity.value, 6) + self.assertEqual(inst.container[0].type.text, "Vacutainer") + 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.receivedTime.date, FHIRDate("2011-03-04T07:03:00Z").date) + self.assertEqual(inst.receivedTime.as_json(), "2011-03-04T07:03:00Z") + self.assertEqual(inst.status, "available") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.coding[0].code, "122555007") + self.assertEqual(inst.type.coding[0].display, "Venous blood specimen") + self.assertEqual(inst.type.coding[0].system, "http://snomed.info/sct") + diff --git a/fhirclient/models/DSTU2/structuredefinition.py b/fhirclient/models/DSTU2/structuredefinition.py new file mode 100644 index 000000000..1b9c83a05 --- /dev/null +++ b/fhirclient/models/DSTU2/structuredefinition.py @@ -0,0 +1,291 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/StructureDefinition) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class StructureDefinition(domainresource.DomainResource): + """ Structural Definition. + + A definition of a FHIR structure. This resource is used to describe the + underlying resources, data types defined in FHIR, and also for describing + extensions, and constraints on resources and data types. + """ + + resource_name = "StructureDefinition" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.abstract = None + """ Whether the structure is abstract. + Type `bool`. """ + + self.base = None + """ Structure that this set of constraints applies to. + Type `str`. """ + + self.code = None + """ Assist with indexing and finding. + List of `Coding` items (represented as `dict` in JSON). """ + + self.constrainedType = None + """ Any datatype or resource, including abstract ones. + Type `str`. """ + + self.contact = None + """ Contact details of the publisher. + List of `StructureDefinitionContact` items (represented as `dict` in JSON). """ + + self.context = None + """ Where the extension can be used in instances. + List of `str` items. """ + + self.contextType = None + """ resource | datatype | mapping | extension. + Type `str`. """ + + self.copyright = None + """ Use and/or publishing restrictions. + Type `str`. """ + + self.date = None + """ Date for this version of the StructureDefinition. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Natural language description of the StructureDefinition. + Type `str`. """ + + self.differential = None + """ Differential view of the structure. + Type `StructureDefinitionDifferential` (represented as `dict` in JSON). """ + + self.display = None + """ Use this name when displaying the value. + Type `str`. """ + + self.experimental = None + """ If for testing purposes, not real usage. + Type `bool`. """ + + self.fhirVersion = None + """ FHIR Version this StructureDefinition targets. + Type `str`. """ + + self.identifier = None + """ Other identifiers for the StructureDefinition. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.kind = None + """ datatype | resource | logical. + Type `str`. """ + + self.mapping = None + """ External specification that the content is mapped to. + List of `StructureDefinitionMapping` items (represented as `dict` in JSON). """ + + self.name = None + """ Informal name for this StructureDefinition. + Type `str`. """ + + self.publisher = None + """ Name of the publisher (Organization or individual). + Type `str`. """ + + self.requirements = None + """ Scope and Usage this structure definition is for. + Type `str`. """ + + self.snapshot = None + """ Snapshot view of the structure. + Type `StructureDefinitionSnapshot` (represented as `dict` in JSON). """ + + self.status = None + """ draft | active | retired. + Type `str`. """ + + self.url = None + """ Absolute URL used to reference this StructureDefinition. + Type `str`. """ + + self.useContext = None + """ Content intends to support these contexts. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.version = None + """ Logical id for this version of the StructureDefinition. + Type `str`. """ + + super(StructureDefinition, self).__init__(jsondict) + + def elementProperties(self): + js = super(StructureDefinition, self).elementProperties() + js.extend([ + ("abstract", "abstract", bool, False, None, True), + ("base", "base", str, False, None, False), + ("code", "code", coding.Coding, True, None, False), + ("constrainedType", "constrainedType", str, False, None, False), + ("contact", "contact", StructureDefinitionContact, True, None, False), + ("context", "context", str, True, None, False), + ("contextType", "contextType", str, False, None, False), + ("copyright", "copyright", str, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("description", "description", str, False, None, False), + ("differential", "differential", StructureDefinitionDifferential, False, None, False), + ("display", "display", str, False, None, False), + ("experimental", "experimental", bool, False, None, False), + ("fhirVersion", "fhirVersion", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("kind", "kind", str, False, None, True), + ("mapping", "mapping", StructureDefinitionMapping, True, None, False), + ("name", "name", str, False, None, True), + ("publisher", "publisher", str, False, None, False), + ("requirements", "requirements", str, False, None, False), + ("snapshot", "snapshot", StructureDefinitionSnapshot, False, None, False), + ("status", "status", str, False, None, True), + ("url", "url", str, False, None, True), + ("useContext", "useContext", codeableconcept.CodeableConcept, True, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class StructureDefinitionContact(backboneelement.BackboneElement): + """ Contact details of the publisher. + + Contacts to assist a user in finding and communicating with the publisher. + """ + + resource_name = "StructureDefinitionContact" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.name = None + """ Name of a individual to contact. + Type `str`. """ + + self.telecom = None + """ Contact details for individual or publisher. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(StructureDefinitionContact, self).__init__(jsondict) + + def elementProperties(self): + js = super(StructureDefinitionContact, self).elementProperties() + js.extend([ + ("name", "name", str, False, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ]) + return js + + +class StructureDefinitionDifferential(backboneelement.BackboneElement): + """ Differential view of the structure. + + A differential view is expressed relative to the base StructureDefinition - + a statement of differences that it applies. + """ + + resource_name = "StructureDefinitionDifferential" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.element = None + """ Definition of elements in the resource (if no StructureDefinition). + List of `ElementDefinition` items (represented as `dict` in JSON). """ + + super(StructureDefinitionDifferential, self).__init__(jsondict) + + def elementProperties(self): + js = super(StructureDefinitionDifferential, self).elementProperties() + js.extend([ + ("element", "element", elementdefinition.ElementDefinition, True, None, True), + ]) + return js + + +class StructureDefinitionMapping(backboneelement.BackboneElement): + """ External specification that the content is mapped to. + + An external specification that the content is mapped to. + """ + + resource_name = "StructureDefinitionMapping" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.comments = 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(StructureDefinitionMapping, self).__init__(jsondict) + + def elementProperties(self): + js = super(StructureDefinitionMapping, self).elementProperties() + js.extend([ + ("comments", "comments", str, False, None, False), + ("identity", "identity", str, False, None, True), + ("name", "name", str, False, None, False), + ("uri", "uri", str, False, None, False), + ]) + return js + + +class StructureDefinitionSnapshot(backboneelement.BackboneElement): + """ Snapshot view of the structure. + + A snapshot view is expressed in a stand alone form that can be used and + interpreted without considering the base StructureDefinition. + """ + + resource_name = "StructureDefinitionSnapshot" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.element = None + """ Definition of elements in the resource (if no StructureDefinition). + List of `ElementDefinition` items (represented as `dict` in JSON). """ + + super(StructureDefinitionSnapshot, self).__init__(jsondict) + + def elementProperties(self): + js = super(StructureDefinitionSnapshot, self).elementProperties() + js.extend([ + ("element", "element", elementdefinition.ElementDefinition, True, None, True), + ]) + return js + + +from . import codeableconcept +from . import coding +from . import contactpoint +from . import elementdefinition +from . import fhirdate +from . import identifier diff --git a/fhirclient/models/DSTU2/structuredefinition_tests.py b/fhirclient/models/DSTU2/structuredefinition_tests.py new file mode 100644 index 000000000..124a93de4 --- /dev/null +++ b/fhirclient/models/DSTU2/structuredefinition_tests.py @@ -0,0 +1,189 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import structuredefinition +from .fhirdate import FHIRDate + + +class StructureDefinitionTests(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("StructureDefinition", js["resourceType"]) + return structuredefinition.StructureDefinition(js) + + def testStructureDefinition1(self): + inst = self.instantiate_from("structuredefinition-example.json") + self.assertIsNotNone(inst, "Must have instantiated a StructureDefinition instance") + self.implStructureDefinition1(inst) + + js = inst.as_json() + self.assertEqual("StructureDefinition", js["resourceType"]) + inst2 = structuredefinition.StructureDefinition(js) + self.implStructureDefinition1(inst2) + + def implStructureDefinition1(self, inst): + self.assertFalse(inst.abstract) + self.assertEqual(inst.base, "http://hl7.org/fhir/StructureDefinition/DiagnosticReport") + self.assertEqual(inst.code[0].code, "314079002") + self.assertEqual(inst.code[0].display, "314079002") + self.assertEqual(inst.code[0].system, "http://snomed.info/sct") + self.assertEqual(inst.constrainedType, "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, "Createive 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.description, "Describes how the lab report is used for a standard Lipid Profile - Cholesterol, Triglyceride and Cholesterol fractions. Uses LOINC codes") + self.assertEqual(inst.display, "Example Lipid Profile") + 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.kind, "resource") + self.assertEqual(inst.mapping[0].comments, "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, "Example Lipid Profile") + self.assertEqual(inst.publisher, "Health Intersections Pty Ltd") + self.assertEqual(inst.requirements, "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.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].name, "LipidProfile") + self.assertEqual(inst.snapshot.element[0].path, "DiagnosticReport") + self.assertEqual(inst.snapshot.element[0].short, "Lipid Lab Report") + self.assertEqual(inst.snapshot.element[0].type[0].code, "Resource") + 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.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], "url") + 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].comments, "Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative.") + 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].comments, "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.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].comments, "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.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].comments, "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.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.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].code, "Reference") + self.assertEqual(inst.snapshot.element[6].type[0].profile[0], "http://hl7.org/fhir/StructureDefinition/Patient") + self.assertEqual(inst.snapshot.element[6].type[1].code, "Reference") + self.assertEqual(inst.snapshot.element[6].type[1].profile[0], "http://hl7.org/fhir/StructureDefinition/Group") + self.assertEqual(inst.snapshot.element[6].type[2].code, "Reference") + self.assertEqual(inst.snapshot.element[6].type[2].profile[0], "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].comments, "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.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].profile[0], "http://hl7.org/fhir/StructureDefinition/Observation") + 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.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.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].code, "Reference") + self.assertEqual(inst.snapshot.element[9].type[0].profile[0], "http://hl7.org/fhir/StructureDefinition/DiagnosticOrder") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.url, "http://hl7.org/fhir/StructureDefinition/example") + self.assertEqual(inst.useContext[0].coding[0].code, "AU") + self.assertEqual(inst.useContext[0].coding[0].system, "urn:iso:std:iso:3166") + self.assertEqual(inst.version, "2") + diff --git a/fhirclient/models/DSTU2/subscription.py b/fhirclient/models/DSTU2/subscription.py new file mode 100644 index 000000000..2cb062a84 --- /dev/null +++ b/fhirclient/models/DSTU2/subscription.py @@ -0,0 +1,121 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Subscription) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Subscription(domainresource.DomainResource): + """ A server push subscription criteria. + + 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. + """ + + resource_name = "Subscription" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.channel = None + """ The channel on which to report matches to the criteria. + Type `SubscriptionChannel` (represented as `dict` in JSON). """ + + self.contact = None + """ Contact details for source (e.g. troubleshooting). + List of `ContactPoint` items (represented as `dict` in JSON). """ + + self.criteria = None + """ Rule for server push criteria. + Type `str`. """ + + self.end = None + """ When to automatically delete the subscription. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.error = None + """ Latest error note. + Type `str`. """ + + self.reason = None + """ Description of why this subscription was created. + Type `str`. """ + + self.status = None + """ 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) + + def elementProperties(self): + js = super(Subscription, self).elementProperties() + js.extend([ + ("channel", "channel", SubscriptionChannel, False, None, True), + ("contact", "contact", contactpoint.ContactPoint, True, None, False), + ("criteria", "criteria", str, False, None, True), + ("end", "end", fhirdate.FHIRDate, False, None, False), + ("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 + + +from . import backboneelement + +class SubscriptionChannel(backboneelement.BackboneElement): + """ The channel on which to report matches to the criteria. + + Details where to send notifications when resources are received that meet + the criteria. + """ + + resource_name = "SubscriptionChannel" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.endpoint = None + """ Where the channel points to. + Type `str`. """ + + self.header = None + """ Usage depends on the channel type. + Type `str`. """ + + self.payload = None + """ Mimetype to send, or blank for no payload. + Type `str`. """ + + self.type = None + """ rest-hook | websocket | email | sms | message. + Type `str`. """ + + super(SubscriptionChannel, self).__init__(jsondict) + + def elementProperties(self): + js = super(SubscriptionChannel, self).elementProperties() + js.extend([ + ("endpoint", "endpoint", str, False, None, False), + ("header", "header", str, False, None, False), + ("payload", "payload", str, False, None, True), + ("type", "type", str, False, None, True), + ]) + return js + + +from . import coding +from . import contactpoint +from . import fhirdate diff --git a/fhirclient/models/DSTU2/subscription_tests.py b/fhirclient/models/DSTU2/subscription_tests.py new file mode 100644 index 000000000..0190b2bf4 --- /dev/null +++ b/fhirclient/models/DSTU2/subscription_tests.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import subscription +from .fhirdate import FHIRDate + + +class SubscriptionTests(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("Subscription", js["resourceType"]) + return subscription.Subscription(js) + + def testSubscription1(self): + inst = self.instantiate_from("subscription-example-error.json") + self.assertIsNotNone(inst, "Must have instantiated a Subscription instance") + self.implSubscription1(inst) + + js = inst.as_json() + self.assertEqual("Subscription", js["resourceType"]) + inst2 = subscription.Subscription(js) + self.implSubscription1(inst2) + + def implSubscription1(self, inst): + self.assertEqual(inst.channel.endpoint, "https://biliwatch.com/customers/mount-auburn-miu/on-result") + self.assertEqual(inst.channel.header, "Authorization: Bearer secret-token-abc-123") + self.assertEqual(inst.channel.payload, "application/json") + self.assertEqual(inst.channel.type, "rest-hook") + self.assertEqual(inst.contact[0].system, "phone") + self.assertEqual(inst.contact[0].value, "ext 4123") + self.assertEqual(inst.criteria, "Observation?code=http://loinc.org|1975-2") + 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.error, "Socket Error 10060 - can't connect to host") + self.assertEqual(inst.id, "example-error") + 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") + + def testSubscription2(self): + inst = self.instantiate_from("subscription-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Subscription instance") + self.implSubscription2(inst) + + js = inst.as_json() + self.assertEqual("Subscription", js["resourceType"]) + inst2 = subscription.Subscription(js) + self.implSubscription2(inst2) + + def implSubscription2(self, inst): + self.assertEqual(inst.channel.endpoint, "https://biliwatch.com/customers/mount-auburn-miu/on-result") + self.assertEqual(inst.channel.header, "Authorization: Bearer secret-token-abc-123") + self.assertEqual(inst.channel.payload, "application/json") + self.assertEqual(inst.channel.type, "rest-hook") + self.assertEqual(inst.contact[0].system, "phone") + self.assertEqual(inst.contact[0].value, "ext 4123") + self.assertEqual(inst.criteria, "Observation?code=http://loinc.org|1975-2") + 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.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/DSTU2/substance.py b/fhirclient/models/DSTU2/substance.py new file mode 100644 index 000000000..504a50343 --- /dev/null +++ b/fhirclient/models/DSTU2/substance.py @@ -0,0 +1,134 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Substance) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Substance(domainresource.DomainResource): + """ A homogeneous material with a definite composition. + """ + + resource_name = "Substance" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.category = None + """ What class/type of substance this is. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.code = None + """ What substance this is. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.description = None + """ Textual description of the substance, comments. + Type `str`. """ + + self.identifier = None + """ Unique identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.ingredient = None + """ Composition information about the substance. + List of `SubstanceIngredient` items (represented as `dict` in JSON). """ + + self.instance = None + """ If this describes a specific package/container of the substance. + List of `SubstanceInstance` items (represented as `dict` in JSON). """ + + super(Substance, self).__init__(jsondict) + + def elementProperties(self): + js = super(Substance, self).elementProperties() + js.extend([ + ("category", "category", codeableconcept.CodeableConcept, True, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("description", "description", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("ingredient", "ingredient", SubstanceIngredient, True, None, False), + ("instance", "instance", SubstanceInstance, True, None, False), + ]) + return js + + +from . import backboneelement + +class SubstanceIngredient(backboneelement.BackboneElement): + """ Composition information about the substance. + + A substance can be composed of other substances. + """ + + resource_name = "SubstanceIngredient" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.quantity = None + """ Optional amount (concentration). + Type `Ratio` (represented as `dict` in JSON). """ + + self.substance = None + """ A component of the substance. + Type `FHIRReference` referencing `Substance` (represented as `dict` in JSON). """ + + super(SubstanceIngredient, self).__init__(jsondict) + + def elementProperties(self): + js = super(SubstanceIngredient, self).elementProperties() + js.extend([ + ("quantity", "quantity", ratio.Ratio, False, None, False), + ("substance", "substance", fhirreference.FHIRReference, False, None, True), + ]) + return js + + +class SubstanceInstance(backboneelement.BackboneElement): + """ If this describes a specific package/container of the substance. + + Substance may be used to describe a kind of substance, or a specific + package/container of the substance: an instance. + """ + + resource_name = "SubstanceInstance" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.expiry = None + """ When no longer valid to use. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.identifier = None + """ Identifier of the package/container. + Type `Identifier` (represented as `dict` in JSON). """ + + self.quantity = None + """ Amount of substance in the package. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + super(SubstanceInstance, self).__init__(jsondict) + + def elementProperties(self): + js = super(SubstanceInstance, self).elementProperties() + js.extend([ + ("expiry", "expiry", fhirdate.FHIRDate, False, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("quantity", "quantity", quantity.Quantity, False, None, False), + ]) + return js + + +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier +from . import quantity +from . import ratio diff --git a/fhirclient/models/DSTU2/substance_tests.py b/fhirclient/models/DSTU2/substance_tests.py new file mode 100644 index 000000000..5391cf037 --- /dev/null +++ b/fhirclient/models/DSTU2/substance_tests.py @@ -0,0 +1,169 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import substance +from .fhirdate import FHIRDate + + +class SubstanceTests(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("Substance", js["resourceType"]) + return substance.Substance(js) + + def testSubstance1(self): + inst = self.instantiate_from("substance-example-silver-nitrate-product.json") + self.assertIsNotNone(inst, "Must have instantiated a Substance instance") + self.implSubstance1(inst) + + js = inst.as_json() + self.assertEqual("Substance", js["resourceType"]) + inst2 = substance.Substance(js) + 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://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.identifier[0].system, "http://acme.org/indentifiers/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/indentifiers/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.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.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") + self.assertEqual(inst.contained[0].id, "ingr1") + self.assertEqual(inst.contained[1].id, "ingr2") + self.assertEqual(inst.description, "Augmentin 875") + self.assertEqual(inst.id, "f205") + self.assertEqual(inst.ingredient[0].quantity.denominator.code, "mg") + self.assertEqual(inst.ingredient[0].quantity.denominator.system, "http://unitsofmeasure.org") + self.assertEqual(inst.ingredient[0].quantity.denominator.unit, "mg") + self.assertEqual(inst.ingredient[0].quantity.denominator.value, 1000) + self.assertEqual(inst.ingredient[0].quantity.numerator.code, "mg") + self.assertEqual(inst.ingredient[0].quantity.numerator.system, "http://unitsofmeasure.org") + self.assertEqual(inst.ingredient[0].quantity.numerator.unit, "mg") + self.assertEqual(inst.ingredient[0].quantity.numerator.value, 875) + self.assertEqual(inst.ingredient[1].quantity.denominator.code, "mg") + self.assertEqual(inst.ingredient[1].quantity.denominator.system, "http://unitsofmeasure.org") + self.assertEqual(inst.ingredient[1].quantity.denominator.unit, "mg") + self.assertEqual(inst.ingredient[1].quantity.denominator.value, 1000) + self.assertEqual(inst.ingredient[1].quantity.numerator.code, "mg") + 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 testSubstance3(self): + inst = self.instantiate_from("substance-example-f203-potassium.json") + self.assertIsNotNone(inst, "Must have instantiated a Substance instance") + self.implSubstance3(inst) + + js = inst.as_json() + self.assertEqual("Substance", js["resourceType"]) + inst2 = substance.Substance(js) + self.implSubstance3(inst2) + + def implSubstance3(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].system, "http://snomed.info/sct") + self.assertEqual(inst.id, "f203") + self.assertEqual(inst.identifier[0].system, "http://acme.org/indentifiers/substances") + self.assertEqual(inst.identifier[0].value, "1234") + self.assertEqual(inst.text.status, "generated") + + def testSubstance4(self): + inst = self.instantiate_from("substance-example-f201-dust.json") + self.assertIsNotNone(inst, "Must have instantiated a Substance instance") + self.implSubstance4(inst) + + js = inst.as_json() + self.assertEqual("Substance", js["resourceType"]) + inst2 = substance.Substance(js) + self.implSubstance4(inst2) + + def implSubstance4(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.text.status, "generated") + + def testSubstance5(self): + inst = self.instantiate_from("substance-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Substance instance") + self.implSubstance5(inst) + + js = inst.as_json() + self.assertEqual("Substance", js["resourceType"]) + inst2 = substance.Substance(js) + self.implSubstance5(inst2) + + def implSubstance5(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/indentifiers/substances") + self.assertEqual(inst.identifier[0].value, "1463") + self.assertEqual(inst.text.status, "generated") + + def testSubstance6(self): + inst = self.instantiate_from("substance-example-f202-staphylococcus.json") + self.assertIsNotNone(inst, "Must have instantiated a Substance instance") + self.implSubstance6(inst) + + js = inst.as_json() + self.assertEqual("Substance", js["resourceType"]) + inst2 = substance.Substance(js) + self.implSubstance6(inst2) + + def implSubstance6(self, inst): + 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.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/supplydelivery.py b/fhirclient/models/DSTU2/supplydelivery.py new file mode 100644 index 000000000..216c4eb6e --- /dev/null +++ b/fhirclient/models/DSTU2/supplydelivery.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/SupplyDelivery) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class SupplyDelivery(domainresource.DomainResource): + """ Delivery of Supply. + + Record of delivery of what is supplied. + """ + + resource_name = "SupplyDelivery" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.destination = None + """ Where the Supply was sent. + Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + + self.identifier = None + """ External identifier. + Type `Identifier` (represented as `dict` in JSON). """ + + self.patient = None + """ Patient for whom the item is supplied. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.quantity = None + """ Amount dispensed. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + self.receiver = None + """ Who collected the Supply. + List of `FHIRReference` items referencing `Practitioner` (represented as `dict` in JSON). """ + + self.status = None + """ in-progress | completed | abandoned. + Type `str`. """ + + self.suppliedItem = None + """ Medication, Substance, or Device supplied. + Type `FHIRReference` referencing `Medication, Substance, Device` (represented as `dict` in JSON). """ + + self.supplier = None + """ Dispenser. + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + self.time = None + """ Handover time. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.type = None + """ Category of dispense event. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.whenPrepared = None + """ Dispensing time. + Type `Period` (represented as `dict` in JSON). """ + + super(SupplyDelivery, self).__init__(jsondict) + + def elementProperties(self): + js = super(SupplyDelivery, self).elementProperties() + js.extend([ + ("destination", "destination", fhirreference.FHIRReference, False, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("patient", "patient", fhirreference.FHIRReference, False, None, False), + ("quantity", "quantity", quantity.Quantity, False, None, False), + ("receiver", "receiver", fhirreference.FHIRReference, True, None, False), + ("status", "status", str, False, None, False), + ("suppliedItem", "suppliedItem", fhirreference.FHIRReference, False, None, False), + ("supplier", "supplier", fhirreference.FHIRReference, False, None, False), + ("time", "time", fhirdate.FHIRDate, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("whenPrepared", "whenPrepared", period.Period, False, None, False), + ]) + return js + + +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier +from . import period +from . import quantity diff --git a/fhirclient/models/DSTU2/supplydelivery_tests.py b/fhirclient/models/DSTU2/supplydelivery_tests.py new file mode 100644 index 000000000..ccafc57e4 --- /dev/null +++ b/fhirclient/models/DSTU2/supplydelivery_tests.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import supplydelivery +from .fhirdate import FHIRDate + + +class SupplyDeliveryTests(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("SupplyDelivery", js["resourceType"]) + return supplydelivery.SupplyDelivery(js) + + def testSupplyDelivery1(self): + inst = self.instantiate_from("supplydelivery-example.json") + self.assertIsNotNone(inst, "Must have instantiated a SupplyDelivery instance") + self.implSupplyDelivery1(inst) + + js = inst.as_json() + self.assertEqual("SupplyDelivery", js["resourceType"]) + inst2 = supplydelivery.SupplyDelivery(js) + self.implSupplyDelivery1(inst2) + + def implSupplyDelivery1(self, inst): + self.assertEqual(inst.id, "example") + self.assertEqual(inst.text.div, "
[Put rendering here]
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/supplyrequest.py b/fhirclient/models/DSTU2/supplyrequest.py new file mode 100644 index 000000000..29d50ccb9 --- /dev/null +++ b/fhirclient/models/DSTU2/supplyrequest.py @@ -0,0 +1,122 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/SupplyRequest) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class SupplyRequest(domainresource.DomainResource): + """ Request for a medication, substance or device. + + A record of a request for a medication, substance or device used in the + healthcare setting. + """ + + resource_name = "SupplyRequest" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.date = None + """ When the request was made. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.identifier = None + """ Unique identifier. + Type `Identifier` (represented as `dict` in JSON). """ + + self.kind = None + """ The kind of supply (central, non-stock, etc.). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.orderedItem = None + """ Medication, Substance, or Device requested to be supplied. + Type `FHIRReference` referencing `Medication, Substance, Device` (represented as `dict` in JSON). """ + + self.patient = None + """ Patient for whom the item is supplied. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.reasonCodeableConcept = None + """ Why the supply item was requested. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.reasonReference = None + """ Why the supply item was requested. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.source = None + """ Who initiated this order. + Type `FHIRReference` referencing `Practitioner, Organization, Patient` (represented as `dict` in JSON). """ + + self.status = None + """ requested | completed | failed | cancelled. + Type `str`. """ + + self.supplier = None + """ Who is intended to fulfill the request. + List of `FHIRReference` items referencing `Organization` (represented as `dict` in JSON). """ + + self.when = None + """ When the request should be fulfilled. + Type `SupplyRequestWhen` (represented as `dict` in JSON). """ + + super(SupplyRequest, self).__init__(jsondict) + + def elementProperties(self): + js = super(SupplyRequest, self).elementProperties() + js.extend([ + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("kind", "kind", codeableconcept.CodeableConcept, False, None, False), + ("orderedItem", "orderedItem", fhirreference.FHIRReference, False, None, False), + ("patient", "patient", fhirreference.FHIRReference, False, None, False), + ("reasonCodeableConcept", "reasonCodeableConcept", codeableconcept.CodeableConcept, False, "reason", False), + ("reasonReference", "reasonReference", fhirreference.FHIRReference, False, "reason", False), + ("source", "source", fhirreference.FHIRReference, False, None, False), + ("status", "status", str, False, None, False), + ("supplier", "supplier", fhirreference.FHIRReference, True, None, False), + ("when", "when", SupplyRequestWhen, False, None, False), + ]) + return js + + +from . import backboneelement + +class SupplyRequestWhen(backboneelement.BackboneElement): + """ When the request should be fulfilled. + """ + + resource_name = "SupplyRequestWhen" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.code = None + """ Fulfilment code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.schedule = None + """ Formal fulfillment schedule. + Type `Timing` (represented as `dict` in JSON). """ + + super(SupplyRequestWhen, self).__init__(jsondict) + + def elementProperties(self): + js = super(SupplyRequestWhen, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("schedule", "schedule", timing.Timing, False, None, False), + ]) + return js + + +from . import codeableconcept +from . import fhirdate +from . import fhirreference +from . import identifier +from . import timing diff --git a/fhirclient/models/DSTU2/supplyrequest_tests.py b/fhirclient/models/DSTU2/supplyrequest_tests.py new file mode 100644 index 000000000..c698e15f4 --- /dev/null +++ b/fhirclient/models/DSTU2/supplyrequest_tests.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import supplyrequest +from .fhirdate import FHIRDate + + +class SupplyRequestTests(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("SupplyRequest", js["resourceType"]) + return supplyrequest.SupplyRequest(js) + + def testSupplyRequest1(self): + inst = self.instantiate_from("supplyrequest-example.json") + self.assertIsNotNone(inst, "Must have instantiated a SupplyRequest instance") + self.implSupplyRequest1(inst) + + js = inst.as_json() + self.assertEqual("SupplyRequest", js["resourceType"]) + inst2 = supplyrequest.SupplyRequest(js) + self.implSupplyRequest1(inst2) + + def implSupplyRequest1(self, inst): + self.assertEqual(inst.id, "example") + self.assertEqual(inst.text.div, "
[Put rendering here]
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/DSTU2/testscript.py b/fhirclient/models/DSTU2/testscript.py new file mode 100644 index 000000000..76433b0c5 --- /dev/null +++ b/fhirclient/models/DSTU2/testscript.py @@ -0,0 +1,798 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/TestScript) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class TestScript(domainresource.DomainResource): + """ Describes a set of tests. + + TestScript is a resource that specifies a suite of tests against a FHIR + server implementation to determine compliance against the FHIR + specification. + """ + + resource_name = "TestScript" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.contact = None + """ Contact details of the publisher. + List of `TestScriptContact` items (represented as `dict` in JSON). """ + + self.copyright = None + """ Use and/or publishing restrictions. + Type `str`. """ + + self.date = None + """ Date for this version of the TestScript. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Natural language description of the TestScript. + Type `str`. """ + + self.experimental = None + """ If for testing purposes, not real usage. + Type `bool`. """ + + self.fixture = None + """ Fixture in the test script - by reference (uri). + List of `TestScriptFixture` items (represented as `dict` in JSON). """ + + self.identifier = None + """ External identifier. + Type `Identifier` (represented as `dict` in JSON). """ + + self.metadata = None + """ Required capability that is assumed to function correctly on the + FHIR server being tested. + Type `TestScriptMetadata` (represented as `dict` in JSON). """ + + self.multiserver = None + """ Whether or not the tests apply to more than one FHIR server. + Type `bool`. """ + + self.name = None + """ Informal name for this TestScript. + Type `str`. """ + + self.profile = None + """ Reference of the validation profile. + List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + + self.publisher = None + """ Name of the publisher (Organization or individual). + Type `str`. """ + + self.requirements = None + """ Scope and Usage this Test Script is for. + Type `str`. """ + + self.setup = None + """ A series of required setup operations before tests are executed. + Type `TestScriptSetup` (represented as `dict` in JSON). """ + + self.status = None + """ draft | active | retired. + Type `str`. """ + + self.teardown = None + """ A series of required clean up steps. + Type `TestScriptTeardown` (represented as `dict` in JSON). """ + + self.test = None + """ A test in this script. + List of `TestScriptTest` items (represented as `dict` in JSON). """ + + self.url = None + """ Absolute URL used to reference this TestScript. + Type `str`. """ + + self.useContext = None + """ Content intends to support these contexts. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.variable = None + """ Placeholder for evaluated elements. + List of `TestScriptVariable` items (represented as `dict` in JSON). """ + + self.version = None + """ Logical id for this version of the TestScript. + Type `str`. """ + + super(TestScript, self).__init__(jsondict) + + def elementProperties(self): + js = super(TestScript, self).elementProperties() + js.extend([ + ("contact", "contact", TestScriptContact, True, None, False), + ("copyright", "copyright", str, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("description", "description", str, False, None, False), + ("experimental", "experimental", bool, False, None, False), + ("fixture", "fixture", TestScriptFixture, True, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("metadata", "metadata", TestScriptMetadata, False, None, False), + ("multiserver", "multiserver", bool, False, None, False), + ("name", "name", str, False, None, True), + ("profile", "profile", fhirreference.FHIRReference, True, None, False), + ("publisher", "publisher", str, False, None, False), + ("requirements", "requirements", str, False, None, False), + ("setup", "setup", TestScriptSetup, False, None, False), + ("status", "status", str, False, None, True), + ("teardown", "teardown", TestScriptTeardown, False, None, False), + ("test", "test", TestScriptTest, True, None, False), + ("url", "url", str, False, None, True), + ("useContext", "useContext", codeableconcept.CodeableConcept, True, None, False), + ("variable", "variable", TestScriptVariable, True, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class TestScriptContact(backboneelement.BackboneElement): + """ Contact details of the publisher. + + Contacts to assist a user in finding and communicating with the publisher. + """ + + resource_name = "TestScriptContact" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.name = None + """ Name of a individual to contact. + Type `str`. """ + + self.telecom = None + """ Contact details for individual or publisher. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(TestScriptContact, self).__init__(jsondict) + + def elementProperties(self): + js = super(TestScriptContact, self).elementProperties() + js.extend([ + ("name", "name", str, False, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ]) + return js + + +class TestScriptFixture(backboneelement.BackboneElement): + """ Fixture in the test script - by reference (uri). + + Fixture in the test script - by reference (uri). All fixtures are required + for the test script to execute. + """ + + resource_name = "TestScriptFixture" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.autocreate = None + """ Whether or not to implicitly create the fixture during setup. + Type `bool`. """ + + self.autodelete = None + """ Whether or not to implicitly delete the fixture during teardown. + Type `bool`. """ + + self.resource = None + """ Reference of the resource. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + super(TestScriptFixture, self).__init__(jsondict) + + def elementProperties(self): + js = super(TestScriptFixture, self).elementProperties() + js.extend([ + ("autocreate", "autocreate", bool, False, None, False), + ("autodelete", "autodelete", bool, False, None, False), + ("resource", "resource", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +class TestScriptMetadata(backboneelement.BackboneElement): + """ Required capability that is assumed to function correctly on the FHIR + server being tested. + + The required capability must exist and are assumed to function correctly on + the FHIR server being tested. + """ + + resource_name = "TestScriptMetadata" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.capability = None + """ Capabilities that are assumed to function correctly on the FHIR + server being tested. + List of `TestScriptMetadataCapability` items (represented as `dict` in JSON). """ + + self.link = None + """ Links to the FHIR specification. + List of `TestScriptMetadataLink` items (represented as `dict` in JSON). """ + + super(TestScriptMetadata, self).__init__(jsondict) + + def elementProperties(self): + js = super(TestScriptMetadata, self).elementProperties() + js.extend([ + ("capability", "capability", TestScriptMetadataCapability, True, None, True), + ("link", "link", TestScriptMetadataLink, True, None, False), + ]) + return js + + +class TestScriptMetadataCapability(backboneelement.BackboneElement): + """ Capabilities that are assumed to function correctly on the FHIR server + being tested. + + Capabilities that must exist and are assumed to function correctly on the + FHIR server being tested. + """ + + resource_name = "TestScriptMetadataCapability" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.conformance = None + """ Required Conformance. + Type `FHIRReference` referencing `Conformance` (represented as `dict` in JSON). """ + + self.description = None + """ The expected capabilities of the server. + Type `str`. """ + + self.destination = None + """ Which server these requirements apply to. + Type `int`. """ + + self.link = None + """ Links to the FHIR specification. + List of `str` items. """ + + self.required = None + """ Are the capabilities required?. + Type `bool`. """ + + self.validated = None + """ Are the capabilities validated?. + Type `bool`. """ + + super(TestScriptMetadataCapability, self).__init__(jsondict) + + def elementProperties(self): + js = super(TestScriptMetadataCapability, self).elementProperties() + js.extend([ + ("conformance", "conformance", fhirreference.FHIRReference, False, None, True), + ("description", "description", str, False, None, False), + ("destination", "destination", int, False, None, False), + ("link", "link", str, True, None, False), + ("required", "required", bool, False, None, False), + ("validated", "validated", bool, False, None, False), + ]) + return js + + +class TestScriptMetadataLink(backboneelement.BackboneElement): + """ Links to the FHIR specification. + + A link to the FHIR specification that this test is covering. + """ + + resource_name = "TestScriptMetadataLink" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.description = None + """ Short description. + Type `str`. """ + + self.url = None + """ URL to the specification. + Type `str`. """ + + super(TestScriptMetadataLink, self).__init__(jsondict) + + def elementProperties(self): + js = super(TestScriptMetadataLink, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, False), + ("url", "url", str, False, None, True), + ]) + return js + + +class TestScriptSetup(backboneelement.BackboneElement): + """ A series of required setup operations before tests are executed. + """ + + resource_name = "TestScriptSetup" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.action = None + """ A setup operation or assert to perform. + List of `TestScriptSetupAction` items (represented as `dict` in JSON). """ + + self.metadata = None + """ Capabilities that are assumed to function correctly on the FHIR + server being tested. + Type `TestScriptMetadata` (represented as `dict` in JSON). """ + + super(TestScriptSetup, self).__init__(jsondict) + + def elementProperties(self): + js = super(TestScriptSetup, self).elementProperties() + js.extend([ + ("action", "action", TestScriptSetupAction, True, None, True), + ("metadata", "metadata", TestScriptMetadata, False, None, False), + ]) + return js + + +class TestScriptSetupAction(backboneelement.BackboneElement): + """ A setup operation or assert to perform. + + Action would contain either an operation or an assertion. + """ + + resource_name = "TestScriptSetupAction" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.assert_fhir = None + """ The assertion to perform. + Type `TestScriptSetupActionAssert` (represented as `dict` in JSON). """ + + self.operation = None + """ The setup operation to perform. + Type `TestScriptSetupActionOperation` (represented as `dict` in JSON). """ + + super(TestScriptSetupAction, self).__init__(jsondict) + + def elementProperties(self): + js = super(TestScriptSetupAction, self).elementProperties() + js.extend([ + ("assert_fhir", "assert", TestScriptSetupActionAssert, False, None, False), + ("operation", "operation", TestScriptSetupActionOperation, False, None, False), + ]) + return js + + +class TestScriptSetupActionAssert(backboneelement.BackboneElement): + """ The assertion to perform. + + Evaluates the results of previous operations to determine if the server + under test behaves appropriately. + """ + + resource_name = "TestScriptSetupActionAssert" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.compareToSourceId = None + """ Id of fixture used to compare the "sourceId/path" evaluations to. + Type `str`. """ + + self.compareToSourcePath = None + """ XPath or JSONPath expression against fixture used to compare the + "sourceId/path" evaluations to. + Type `str`. """ + + self.contentType = None + """ xml | json. + Type `str`. """ + + self.description = None + """ Tracking/reporting assertion description. + Type `str`. """ + + self.direction = None + """ response | request. + Type `str`. """ + + self.headerField = None + """ HTTP header field name. + Type `str`. """ + + self.label = None + """ Tracking/logging assertion label. + Type `str`. """ + + self.minimumId = None + """ Fixture Id of minimum content resource. + Type `str`. """ + + self.navigationLinks = None + """ Perform validation on navigation links?. + Type `bool`. """ + + self.operator = None + """ equals | notEquals | in | notIn | greaterThan | lessThan | empty | + notEmpty | contains | notContains. + Type `str`. """ + + self.path = None + """ XPath or JSONPath expression. + Type `str`. """ + + self.resource = None + """ Resource type. + Type `str`. """ + + self.response = None + """ okay | created | noContent | notModified | bad | forbidden | + notFound | methodNotAllowed | conflict | gone | preconditionFailed + | unprocessable. + Type `str`. """ + + self.responseCode = None + """ HTTP response code to test. + Type `str`. """ + + self.sourceId = None + """ Fixture Id of source expression or headerField. + Type `str`. """ + + self.validateProfileId = None + """ Profile Id of validation profile reference. + Type `str`. """ + + self.value = None + """ The value to compare to. + Type `str`. """ + + self.warningOnly = None + """ Will this assert produce a warning only on error?. + Type `bool`. """ + + super(TestScriptSetupActionAssert, self).__init__(jsondict) + + def elementProperties(self): + js = super(TestScriptSetupActionAssert, self).elementProperties() + js.extend([ + ("compareToSourceId", "compareToSourceId", str, False, None, False), + ("compareToSourcePath", "compareToSourcePath", str, False, None, False), + ("contentType", "contentType", str, False, None, False), + ("description", "description", str, False, None, False), + ("direction", "direction", str, False, None, False), + ("headerField", "headerField", str, False, None, False), + ("label", "label", str, False, None, False), + ("minimumId", "minimumId", str, False, None, False), + ("navigationLinks", "navigationLinks", bool, False, None, False), + ("operator", "operator", str, False, None, False), + ("path", "path", str, False, None, False), + ("resource", "resource", str, False, None, False), + ("response", "response", str, False, None, False), + ("responseCode", "responseCode", str, 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 TestScriptSetupActionOperation(backboneelement.BackboneElement): + """ The setup operation to perform. + + The operation to perform. + """ + + resource_name = "TestScriptSetupActionOperation" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.accept = None + """ xml | json. + Type `str`. """ + + self.contentType = None + """ xml | json. + Type `str`. """ + + self.description = None + """ Tracking/reporting operation description. + Type `str`. """ + + self.destination = None + """ Which server to perform the operation on. + Type `int`. """ + + self.encodeRequestUrl = None + """ Whether or not to send the request url in encoded format. + Type `bool`. """ + + self.label = None + """ Tracking/logging operation label. + Type `str`. """ + + self.params = None + """ Explicitly defined path parameters. + Type `str`. """ + + self.requestHeader = None + """ Each operation can have one ore more header elements. + List of `TestScriptSetupActionOperationRequestHeader` items (represented as `dict` in JSON). """ + + self.resource = None + """ Resource type. + Type `str`. """ + + self.responseId = None + """ Fixture Id of mapped response. + Type `str`. """ + + self.sourceId = None + """ Fixture Id of body for PUT and POST requests. + Type `str`. """ + + self.targetId = None + """ Id of fixture used for extracting the [id], [type], and [vid] for + GET requests. + Type `str`. """ + + self.type = None + """ The setup operation type that will be executed. + Type `Coding` (represented as `dict` in JSON). """ + + self.url = None + """ Request URL. + Type `str`. """ + + super(TestScriptSetupActionOperation, self).__init__(jsondict) + + def elementProperties(self): + js = super(TestScriptSetupActionOperation, self).elementProperties() + js.extend([ + ("accept", "accept", str, False, None, False), + ("contentType", "contentType", str, False, None, False), + ("description", "description", str, False, None, False), + ("destination", "destination", int, False, None, False), + ("encodeRequestUrl", "encodeRequestUrl", bool, False, None, False), + ("label", "label", str, False, None, False), + ("params", "params", str, False, None, False), + ("requestHeader", "requestHeader", TestScriptSetupActionOperationRequestHeader, True, None, False), + ("resource", "resource", str, False, None, False), + ("responseId", "responseId", str, False, None, False), + ("sourceId", "sourceId", str, False, None, False), + ("targetId", "targetId", str, False, None, False), + ("type", "type", coding.Coding, False, None, False), + ("url", "url", str, False, None, False), + ]) + return js + + +class TestScriptSetupActionOperationRequestHeader(backboneelement.BackboneElement): + """ Each operation can have one ore more header elements. + + Header elements would be used to set HTTP headers. + """ + + resource_name = "TestScriptSetupActionOperationRequestHeader" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.field = None + """ HTTP header field name. + Type `str`. """ + + self.value = None + """ HTTP headerfield value. + Type `str`. """ + + super(TestScriptSetupActionOperationRequestHeader, self).__init__(jsondict) + + def elementProperties(self): + js = super(TestScriptSetupActionOperationRequestHeader, self).elementProperties() + js.extend([ + ("field", "field", str, False, None, True), + ("value", "value", str, False, None, True), + ]) + return js + + +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 + executed (successfully or otherwise). + """ + + resource_name = "TestScriptTeardown" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.action = None + """ One or more teardown operations to perform. + List of `TestScriptTeardownAction` items (represented as `dict` in JSON). """ + + super(TestScriptTeardown, self).__init__(jsondict) + + def elementProperties(self): + js = super(TestScriptTeardown, self).elementProperties() + js.extend([ + ("action", "action", TestScriptTeardownAction, True, None, True), + ]) + return js + + +class TestScriptTeardownAction(backboneelement.BackboneElement): + """ One or more teardown operations to perform. + + The teardown action will only contain an operation. + """ + + resource_name = "TestScriptTeardownAction" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.operation = None + """ The teardown operation to perform. + Type `TestScriptSetupActionOperation` (represented as `dict` in JSON). """ + + super(TestScriptTeardownAction, self).__init__(jsondict) + + def elementProperties(self): + js = super(TestScriptTeardownAction, self).elementProperties() + js.extend([ + ("operation", "operation", TestScriptSetupActionOperation, False, None, False), + ]) + return js + + +class TestScriptTest(backboneelement.BackboneElement): + """ A test in this script. + """ + + resource_name = "TestScriptTest" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.action = None + """ A test operation or assert to perform. + List of `TestScriptTestAction` items (represented as `dict` in JSON). """ + + self.description = None + """ Tracking/reporting short description of the test. + Type `str`. """ + + self.metadata = None + """ Capabilities that are expected to function correctly on the FHIR + server being tested. + Type `TestScriptMetadata` (represented as `dict` in JSON). """ + + self.name = None + """ Tracking/logging name of this test. + Type `str`. """ + + super(TestScriptTest, self).__init__(jsondict) + + def elementProperties(self): + js = super(TestScriptTest, self).elementProperties() + js.extend([ + ("action", "action", TestScriptTestAction, True, None, True), + ("description", "description", str, False, None, False), + ("metadata", "metadata", TestScriptMetadata, False, None, False), + ("name", "name", str, False, None, False), + ]) + return js + + +class TestScriptTestAction(backboneelement.BackboneElement): + """ A test operation or assert to perform. + + Action would contain either an operation or an assertion. + """ + + resource_name = "TestScriptTestAction" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.assert_fhir = None + """ The setup assertion to perform. + Type `TestScriptSetupActionAssert` (represented as `dict` in JSON). """ + + self.operation = None + """ The setup operation to perform. + Type `TestScriptSetupActionOperation` (represented as `dict` in JSON). """ + + super(TestScriptTestAction, self).__init__(jsondict) + + def elementProperties(self): + js = super(TestScriptTestAction, self).elementProperties() + js.extend([ + ("assert_fhir", "assert", TestScriptSetupActionAssert, False, None, False), + ("operation", "operation", TestScriptSetupActionOperation, False, None, False), + ]) + return js + + +class TestScriptVariable(backboneelement.BackboneElement): + """ Placeholder for evaluated elements. + + Variable is set based either on element value in response body or on header + field value in the response headers. + """ + + resource_name = "TestScriptVariable" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.headerField = None + """ HTTP header field name for source. + Type `str`. """ + + self.name = None + """ Descriptive name for this variable. + Type `str`. """ + + self.path = None + """ XPath or JSONPath against the fixture body. + Type `str`. """ + + self.sourceId = None + """ Fixture Id of source expression or headerField within this variable. + Type `str`. """ + + super(TestScriptVariable, self).__init__(jsondict) + + def elementProperties(self): + js = super(TestScriptVariable, self).elementProperties() + js.extend([ + ("headerField", "headerField", str, False, None, False), + ("name", "name", str, False, None, True), + ("path", "path", str, False, None, False), + ("sourceId", "sourceId", str, False, None, False), + ]) + return js + + +from . import codeableconcept +from . import coding +from . import contactpoint +from . import fhirdate +from . import fhirreference +from . import identifier diff --git a/fhirclient/models/DSTU2/testscript_tests.py b/fhirclient/models/DSTU2/testscript_tests.py new file mode 100644 index 000000000..3091ccfac --- /dev/null +++ b/fhirclient/models/DSTU2/testscript_tests.py @@ -0,0 +1,201 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import testscript +from .fhirdate import FHIRDate + + +class TestScriptTests(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("TestScript", js["resourceType"]) + return testscript.TestScript(js) + + def testTestScript1(self): + inst = self.instantiate_from("testscript-example.json") + self.assertIsNotNone(inst, "Must have instantiated a TestScript instance") + self.implTestScript1(inst) + + js = inst.as_json() + self.assertEqual("TestScript", js["resourceType"]) + inst2 = testscript.TestScript(js) + 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, "temp") + self.assertEqual(inst.contact[0].telecom[0].value, "support@gmail.com") + self.assertEqual(inst.copyright, "© HL7.org 2011+") + self.assertEqual(inst.date.date, FHIRDate("2015-08-31").date) + self.assertEqual(inst.date.as_json(), "2015-08-31") + self.assertEqual(inst.description, "Example Test Script") + self.assertTrue(inst.experimental) + self.assertFalse(inst.fixture[0].autocreate) + self.assertFalse(inst.fixture[0].autodelete) + self.assertEqual(inst.fixture[0].id, "F1") + self.assertEqual(inst.id, "example") + 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.9876") + self.assertEqual(inst.metadata.capability[0].description, "Patient Create, Read, and Update Operations") + self.assertEqual(inst.metadata.capability[0].destination, 1) + self.assertEqual(inst.metadata.capability[0].link[0], "http://hl7.org/implement/standards/FHIR-Develop/http.html#create") + self.assertEqual(inst.metadata.capability[0].link[1], "http://hl7.org/implement/standards/FHIR-Develop/http.html#read") + self.assertEqual(inst.metadata.capability[0].link[2], "http://hl7.org/implement/standards/FHIR-Develop/http.html#update") + self.assertTrue(inst.metadata.capability[0].required) + self.assertEqual(inst.name, "Test Script 1") + self.assertEqual(inst.publisher, "HL7") + self.assertEqual(inst.requirements, "Patient Create, Read, and Update Operations") + self.assertEqual(inst.setup.action[0].operation.accept, "json") + self.assertEqual(inst.setup.action[0].operation.description, "Create patient resource on test server") + self.assertEqual(inst.setup.action[0].operation.label, "SetupPatient") + self.assertEqual(inst.setup.action[0].operation.responseId, "create-response") + self.assertEqual(inst.setup.action[0].operation.sourceId, "F1") + self.assertEqual(inst.setup.action[0].operation.type.code, "create") + self.assertEqual(inst.setup.action[1].assert_fhir.direction, "request") + self.assertEqual(inst.setup.action[1].assert_fhir.responseCode, "201") + self.assertEqual(inst.status, "draft") + self.assertFalse(inst.test[0].action[0].operation.encodeRequestUrl) + self.assertEqual(inst.test[0].action[0].operation.responseId, "F1-read") + self.assertEqual(inst.test[0].action[0].operation.targetId, "F1") + self.assertEqual(inst.test[0].action[0].operation.type.code, "read") + self.assertEqual(inst.test[0].action[1].assert_fhir.description, "Test for OK response") + self.assertEqual(inst.test[0].action[1].assert_fhir.direction, "request") + self.assertEqual(inst.test[0].action[1].assert_fhir.label, "ReadOK") + self.assertEqual(inst.test[0].action[1].assert_fhir.response, "okay") + 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.resource, "Patient") + self.assertEqual(inst.test[0].action[4].assert_fhir.validateProfileId, "patient-profile") + 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.value, "Chalmers") + 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, "F1") + self.assertEqual(inst.test[0].action[6].assert_fhir.value, "Chalmers") + self.assertEqual(inst.test[0].action[7].assert_fhir.compareToSourceId, "F1-read") + 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.assertEqual(inst.test[0].action[8].assert_fhir.compareToSourceId, "F1-read") + 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.path, "fhir:Patient/fhir:name/fhir:family/@value") + self.assertEqual(inst.test[0].action[8].assert_fhir.sourceId, "F1") + self.assertEqual(inst.test[0].action[9].assert_fhir.minimumId, "F1-min") + self.assertEqual(inst.test[0].description, "Read a patient and validate response.") + self.assertEqual(inst.test[0].id, "READ01") + self.assertEqual(inst.test[0].name, "Read Patient") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.url, "http://hl7.org/fhir/TestScript/example") + self.assertEqual(inst.useContext[0].coding[0].code, "US") + self.assertEqual(inst.useContext[0].coding[0].display, "United States of America (the)") + self.assertEqual(inst.useContext[0].coding[0].system, "urn:iso:std:iso:3166") + self.assertEqual(inst.version, "1.0") + + def testTestScript2(self): + inst = self.instantiate_from("testscript-example-multiserver.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.description, "Multiserver Test Script") + self.assertEqual(inst.fixture[0].id, "F1") + self.assertEqual(inst.id, "multiserver") + self.assertTrue(inst.multiserver) + self.assertEqual(inst.name, "Multiserver Test Script") + self.assertEqual(inst.setup.action[0].operation.contentType, "xml") + self.assertEqual(inst.setup.action[0].operation.destination, 0) + self.assertEqual(inst.setup.action[0].operation.sourceId, "F1") + self.assertEqual(inst.setup.action[0].operation.type.code, "create") + self.assertEqual(inst.setup.metadata.capability[0].description, "Patient Create Operation") + self.assertEqual(inst.setup.metadata.capability[0].link[0], "http://hl7.org/implement/standards/FHIR-Develop/http.html#create") + self.assertTrue(inst.setup.metadata.capability[0].required) + self.assertEqual(inst.setup.metadata.link[0].description, "FHIR Patient") + self.assertEqual(inst.setup.metadata.link[0].url, "http://hl7.org/implement/standards/FHIR-Develop/patient.html") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.teardown.action[0].operation.destination, 0) + self.assertEqual(inst.teardown.action[0].operation.targetId, "F1") + self.assertEqual(inst.teardown.action[0].operation.type.code, "delete") + self.assertEqual(inst.teardown.action[1].operation.destination, 1) + self.assertEqual(inst.teardown.action[1].operation.targetId, "F1") + self.assertEqual(inst.teardown.action[1].operation.type.code, "delete") + self.assertEqual(inst.test[0].action[0].operation.destination, 0) + self.assertEqual(inst.test[0].action[0].operation.responseId, "R1") + self.assertEqual(inst.test[0].action[0].operation.targetId, "F1") + self.assertEqual(inst.test[0].action[0].operation.type.code, "read") + self.assertEqual(inst.test[0].action[1].assert_fhir.response, "okay") + self.assertEqual(inst.test[0].action[2].assert_fhir.headerField, "Last-Modified") + self.assertEqual(inst.test[0].action[2].assert_fhir.operator, "notEmpty") + self.assertEqual(inst.test[0].action[3].assert_fhir.resource, "Patient") + self.assertEqual(inst.test[0].action[4].assert_fhir.minimumId, "F1") + self.assertEqual(inst.test[0].description, "Read the patient from server 0.") + self.assertEqual(inst.test[0].id, "READ01") + self.assertEqual(inst.test[0].metadata.capability[0].description, "Patient Read Operation") + self.assertEqual(inst.test[0].metadata.capability[0].link[0], "http://hl7.org/implement/standards/FHIR-Develop/http.html#read") + self.assertTrue(inst.test[0].metadata.capability[0].validated) + self.assertEqual(inst.test[0].name, "Read Patient") + self.assertEqual(inst.test[1].action[0].operation.destination, 1) + self.assertEqual(inst.test[1].action[0].operation.sourceId, "R1") + self.assertEqual(inst.test[1].action[0].operation.type.code, "create") + self.assertEqual(inst.test[1].action[1].assert_fhir.response, "okay") + self.assertEqual(inst.test[1].action[2].operation.destination, 1) + self.assertEqual(inst.test[1].action[2].operation.responseId, "R2") + self.assertEqual(inst.test[1].action[2].operation.targetId, "R1") + self.assertEqual(inst.test[1].action[2].operation.type.code, "read") + self.assertEqual(inst.test[1].action[3].assert_fhir.response, "okay") + self.assertEqual(inst.test[1].action[4].assert_fhir.headerField, "Last-Modified") + self.assertEqual(inst.test[1].action[4].assert_fhir.operator, "notEmpty") + self.assertEqual(inst.test[1].action[5].assert_fhir.resource, "Patient") + self.assertEqual(inst.test[1].action[6].assert_fhir.minimumId, "F1") + self.assertEqual(inst.test[1].action[7].assert_fhir.minimumId, "R1") + self.assertEqual(inst.test[1].description, "Write the patient read from server 0 to server 1.") + self.assertEqual(inst.test[1].id, "WRITE01") + self.assertEqual(inst.test[1].metadata.capability[0].description, "Patient Create Operation") + self.assertEqual(inst.test[1].metadata.capability[0].link[0], "http://hl7.org/implement/standards/FHIR-Develop/http.html#create") + self.assertTrue(inst.test[1].metadata.capability[0].validated) + self.assertEqual(inst.test[1].metadata.capability[1].description, "Patient Read Operation") + self.assertEqual(inst.test[1].metadata.capability[1].link[0], "http://hl7.org/implement/standards/FHIR-Develop/http.html#read") + self.assertTrue(inst.test[1].metadata.capability[1].validated) + self.assertEqual(inst.test[1].name, "Write Patient") + self.assertEqual(inst.test[2].action[0].operation.destination, 0) + self.assertEqual(inst.test[2].action[0].operation.sourceId, "R2") + self.assertEqual(inst.test[2].action[0].operation.targetId, "R1") + self.assertEqual(inst.test[2].action[0].operation.type.code, "update") + self.assertEqual(inst.test[2].action[1].assert_fhir.response, "okay") + self.assertEqual(inst.test[2].action[2].operation.destination, 0) + self.assertEqual(inst.test[2].action[2].operation.responseId, "R3") + self.assertEqual(inst.test[2].action[2].operation.targetId, "R1") + self.assertEqual(inst.test[2].action[2].operation.type.code, "read") + self.assertEqual(inst.test[2].action[3].assert_fhir.response, "okay") + self.assertEqual(inst.test[2].action[4].assert_fhir.headerField, "Last-Modified") + self.assertEqual(inst.test[2].action[4].assert_fhir.operator, "notEmpty") + self.assertEqual(inst.test[2].action[5].assert_fhir.resource, "Patient") + self.assertEqual(inst.test[2].action[6].assert_fhir.minimumId, "F1") + self.assertEqual(inst.test[2].action[7].assert_fhir.minimumId, "R1") + self.assertEqual(inst.test[2].action[8].assert_fhir.minimumId, "R2") + self.assertEqual(inst.test[2].description, "Update the patient on server 0 with the one read from server 1.") + self.assertEqual(inst.test[2].id, "UPDATE01") + self.assertEqual(inst.test[2].metadata.capability[0].description, "Patient Update Operation") + self.assertEqual(inst.test[2].metadata.capability[0].link[0], "http://hl7.org/implement/standards/FHIR-Develop/http.html#update") + self.assertTrue(inst.test[2].metadata.capability[0].validated) + self.assertEqual(inst.test[2].name, "Update Patient") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.url, "http://hl7.org/fhir/TestScript/multiserver") + diff --git a/fhirclient/models/DSTU2/timing.py b/fhirclient/models/DSTU2/timing.py new file mode 100644 index 000000000..75c79232c --- /dev/null +++ b/fhirclient/models/DSTU2/timing.py @@ -0,0 +1,139 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Timing) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Timing(element.Element): + """ A timing schedule that specifies an event that may occur multiple times. + + Specifies an event that may occur multiple times. Timing schedules are used + to record when things are expected or requested to occur. The most common + usage is in dosage instructions for medications. They are also used when + planning care of various kinds. + """ + + resource_name = "Timing" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.code = None + """ QD | QOD | Q4H | Q6H | BID | TID | QID | AM | PM +. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.event = None + """ When the event occurs. + List of `FHIRDate` items (represented as `str` in JSON). """ + + self.repeat = None + """ When the event is to occur. + Type `TimingRepeat` (represented as `dict` in JSON). """ + + super(Timing, self).__init__(jsondict) + + def elementProperties(self): + js = super(Timing, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("event", "event", fhirdate.FHIRDate, True, None, False), + ("repeat", "repeat", TimingRepeat, False, None, False), + ]) + return js + + +class TimingRepeat(element.Element): + """ When the event is to occur. + + A set of rules that describe when the event should occur. + """ + + resource_name = "TimingRepeat" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.boundsPeriod = None + """ Length/Range of lengths, or (Start and/or end) limits. + Type `Period` (represented as `dict` in JSON). """ + + self.boundsQuantity = None + """ Length/Range of lengths, or (Start and/or end) limits. + Type `Quantity` referencing `Duration` (represented as `dict` in JSON). """ + + self.boundsRange = None + """ Length/Range of lengths, or (Start and/or end) limits. + Type `Range` (represented as `dict` in JSON). """ + + self.count = None + """ Number of times to repeat. + Type `int`. """ + + self.duration = None + """ How long when it happens. + Type `float`. """ + + self.durationMax = None + """ How long when it happens (Max). + Type `float`. """ + + self.durationUnits = None + """ s | min | h | d | wk | mo | a - unit of time (UCUM). + Type `str`. """ + + self.frequency = None + """ Event occurs frequency times per period. + Type `int`. """ + + self.frequencyMax = None + """ Event occurs up to frequencyMax times per period. + Type `int`. """ + + self.period = None + """ Event occurs frequency times per period. + Type `float`. """ + + self.periodMax = None + """ Upper limit of period (3-4 hours). + Type `float`. """ + + self.periodUnits = None + """ s | min | h | d | wk | mo | a - unit of time (UCUM). + Type `str`. """ + + self.when = None + """ Regular life events the event is tied to. + Type `str`. """ + + super(TimingRepeat, self).__init__(jsondict) + + def elementProperties(self): + js = super(TimingRepeat, self).elementProperties() + js.extend([ + ("boundsPeriod", "boundsPeriod", period.Period, False, "bounds", False), + ("boundsQuantity", "boundsQuantity", quantity.Quantity, False, "bounds", False), + ("boundsRange", "boundsRange", range.Range, False, "bounds", False), + ("count", "count", int, False, None, False), + ("duration", "duration", float, False, None, False), + ("durationMax", "durationMax", float, False, None, False), + ("durationUnits", "durationUnits", str, False, None, False), + ("frequency", "frequency", int, False, None, False), + ("frequencyMax", "frequencyMax", int, False, None, False), + ("period", "period", float, False, None, False), + ("periodMax", "periodMax", float, False, None, False), + ("periodUnits", "periodUnits", str, False, None, False), + ("when", "when", str, False, None, False), + ]) + return js + + +from . import codeableconcept +from . import fhirdate +from . import period +from . import quantity +from . import range diff --git a/fhirclient/models/DSTU2/valueset.py b/fhirclient/models/DSTU2/valueset.py new file mode 100644 index 000000000..e6e991c68 --- /dev/null +++ b/fhirclient/models/DSTU2/valueset.py @@ -0,0 +1,609 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ValueSet) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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. + """ + + resource_name = "ValueSet" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.codeSystem = None + """ An inline code system, which is part of this value set. + Type `ValueSetCodeSystem` (represented as `dict` in JSON). """ + + self.compose = None + """ When value set includes codes from elsewhere. + Type `ValueSetCompose` (represented as `dict` in JSON). """ + + self.contact = None + """ Contact details of the publisher. + List of `ValueSetContact` items (represented as `dict` in JSON). """ + + self.copyright = None + """ Use and/or publishing restrictions. + Type `str`. """ + + self.date = None + """ Date for given status. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Human language description of the value set. + Type `str`. """ + + self.expansion = None + """ Used when the value set is "expanded". + Type `ValueSetExpansion` (represented as `dict` in JSON). """ + + self.experimental = None + """ If 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 (e.g. HL7 v2 / CDA). + Type `Identifier` (represented as `dict` in JSON). """ + + self.immutable = None + """ Indicates whether or not any change to the content logical + definition may occur. + Type `bool`. """ + + self.lockedDate = None + """ Fixed date for all referenced code systems and value sets. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.name = None + """ Informal name for this value set. + Type `str`. """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.requirements = None + """ Why needed. + Type `str`. """ + + self.status = None + """ draft | active | retired. + Type `str`. """ + + self.url = None + """ Globally unique logical identifier for value set. + Type `str`. """ + + self.useContext = None + """ Content intends to support these contexts. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.version = None + """ Logical identifier for this version of the value set. + Type `str`. """ + + super(ValueSet, self).__init__(jsondict) + + def elementProperties(self): + js = super(ValueSet, self).elementProperties() + js.extend([ + ("codeSystem", "codeSystem", ValueSetCodeSystem, False, None, False), + ("compose", "compose", ValueSetCompose, False, None, False), + ("contact", "contact", ValueSetContact, True, None, False), + ("copyright", "copyright", str, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("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, False, None, False), + ("immutable", "immutable", bool, False, None, False), + ("lockedDate", "lockedDate", fhirdate.FHIRDate, False, None, False), + ("name", "name", str, False, None, False), + ("publisher", "publisher", str, False, None, False), + ("requirements", "requirements", str, False, None, False), + ("status", "status", str, False, None, True), + ("url", "url", str, False, None, False), + ("useContext", "useContext", codeableconcept.CodeableConcept, True, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class ValueSetCodeSystem(backboneelement.BackboneElement): + """ An inline code system, which is part of this value set. + + A definition of a code system, inlined into the value set (as a packaging + convenience). Note that the inline code system may be used from other value + sets by referring to its (codeSystem.system) directly. + """ + + resource_name = "ValueSetCodeSystem" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.caseSensitive = None + """ If code comparison is case sensitive. + Type `bool`. """ + + self.concept = None + """ Concepts in the code system. + List of `ValueSetCodeSystemConcept` items (represented as `dict` in JSON). """ + + self.system = None + """ URI to identify the code system (e.g. in Coding.system). + Type `str`. """ + + self.version = None + """ Version (for use in Coding.version). + Type `str`. """ + + super(ValueSetCodeSystem, self).__init__(jsondict) + + def elementProperties(self): + js = super(ValueSetCodeSystem, self).elementProperties() + js.extend([ + ("caseSensitive", "caseSensitive", bool, False, None, False), + ("concept", "concept", ValueSetCodeSystemConcept, True, None, True), + ("system", "system", str, False, None, True), + ("version", "version", str, False, None, False), + ]) + return js + + +class ValueSetCodeSystemConcept(backboneelement.BackboneElement): + """ Concepts in the code system. + + 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. + """ + + resource_name = "ValueSetCodeSystemConcept" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.abstract = None + """ If this code is not for use as a real concept. + Type `bool`. """ + + self.code = None + """ Code that identifies concept. + Type `str`. """ + + self.concept = None + """ Child Concepts (is-a/contains/categorizes). + List of `ValueSetCodeSystemConcept` items (represented as `dict` in JSON). """ + + self.definition = None + """ Formal definition. + Type `str`. """ + + self.designation = None + """ Additional representations for the concept. + List of `ValueSetCodeSystemConceptDesignation` items (represented as `dict` in JSON). """ + + self.display = None + """ Text to display to the user. + Type `str`. """ + + super(ValueSetCodeSystemConcept, self).__init__(jsondict) + + def elementProperties(self): + js = super(ValueSetCodeSystemConcept, self).elementProperties() + js.extend([ + ("abstract", "abstract", bool, False, None, False), + ("code", "code", str, False, None, True), + ("concept", "concept", ValueSetCodeSystemConcept, True, None, False), + ("definition", "definition", str, False, None, False), + ("designation", "designation", ValueSetCodeSystemConceptDesignation, True, None, False), + ("display", "display", str, False, None, False), + ]) + return js + + +class ValueSetCodeSystemConceptDesignation(backboneelement.BackboneElement): + """ Additional representations for the concept. + + Additional representations for the concept - other languages, aliases, + specialized purposes, used for particular purposes, etc. + """ + + resource_name = "ValueSetCodeSystemConceptDesignation" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.language = None + """ Human language of the designation. + Type `str`. """ + + self.use = None + """ Details how this designation would be used. + Type `Coding` (represented as `dict` in JSON). """ + + self.value = None + """ The text value for this designation. + Type `str`. """ + + super(ValueSetCodeSystemConceptDesignation, self).__init__(jsondict) + + def elementProperties(self): + js = super(ValueSetCodeSystemConceptDesignation, self).elementProperties() + js.extend([ + ("language", "language", str, False, None, False), + ("use", "use", coding.Coding, False, None, False), + ("value", "value", str, False, None, True), + ]) + return js + + +class ValueSetCompose(backboneelement.BackboneElement): + """ When value set includes codes from elsewhere. + + A set of criteria that provide the content logical definition of the value + set by including or excluding codes from outside this value set. + """ + + resource_name = "ValueSetCompose" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.exclude = None + """ Explicitly exclude codes. + List of `ValueSetComposeInclude` items (represented as `dict` in JSON). """ + + self.import_fhir = None + """ Import the contents of another value set. + List of `str` items. """ + + self.include = None + """ Include one or more codes from a code system. + List of `ValueSetComposeInclude` items (represented as `dict` in JSON). """ + + super(ValueSetCompose, self).__init__(jsondict) + + def elementProperties(self): + js = super(ValueSetCompose, self).elementProperties() + js.extend([ + ("exclude", "exclude", ValueSetComposeInclude, True, None, False), + ("import_fhir", "import", str, True, None, False), + ("include", "include", ValueSetComposeInclude, True, None, False), + ]) + return js + + +class ValueSetComposeInclude(backboneelement.BackboneElement): + """ Include one or more codes from a code system. + """ + + resource_name = "ValueSetComposeInclude" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.concept = None + """ A concept defined in the system. + List of `ValueSetComposeIncludeConcept` items (represented as `dict` in JSON). """ + + self.filter = None + """ Select codes/concepts by their properties (including relationships). + List of `ValueSetComposeIncludeFilter` items (represented as `dict` in JSON). """ + + self.system = None + """ The system the codes come from. + Type `str`. """ + + self.version = None + """ Specific version of the code system referred to. + Type `str`. """ + + super(ValueSetComposeInclude, self).__init__(jsondict) + + def elementProperties(self): + js = super(ValueSetComposeInclude, self).elementProperties() + js.extend([ + ("concept", "concept", ValueSetComposeIncludeConcept, True, None, False), + ("filter", "filter", ValueSetComposeIncludeFilter, True, None, False), + ("system", "system", str, False, None, True), + ("version", "version", str, False, None, False), + ]) + return js + + +class ValueSetComposeIncludeConcept(backboneelement.BackboneElement): + """ A concept defined in the system. + + Specifies a concept to be included or excluded. + """ + + resource_name = "ValueSetComposeIncludeConcept" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.code = None + """ Code or expression from system. + Type `str`. """ + + self.designation = None + """ Additional representations for this valueset. + List of `ValueSetCodeSystemConceptDesignation` items (represented as `dict` in JSON). """ + + self.display = None + """ Test to display for this code for this value set. + Type `str`. """ + + super(ValueSetComposeIncludeConcept, self).__init__(jsondict) + + def elementProperties(self): + js = super(ValueSetComposeIncludeConcept, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("designation", "designation", ValueSetCodeSystemConceptDesignation, True, None, False), + ("display", "display", str, False, None, False), + ]) + return js + + +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. + """ + + resource_name = "ValueSetComposeIncludeFilter" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.op = None + """ = | is-a | is-not-a | regex | in | not-in. + Type `str`. """ + + self.property = None + """ A property defined by the code system. + Type `str`. """ + + self.value = None + """ Code from the system, or regex criteria. + Type `str`. """ + + super(ValueSetComposeIncludeFilter, self).__init__(jsondict) + + def elementProperties(self): + js = super(ValueSetComposeIncludeFilter, self).elementProperties() + js.extend([ + ("op", "op", str, False, None, True), + ("property", "property", str, False, None, True), + ("value", "value", str, False, None, True), + ]) + return js + + +class ValueSetContact(backboneelement.BackboneElement): + """ Contact details of the publisher. + + Contacts to assist a user in finding and communicating with the publisher. + """ + + resource_name = "ValueSetContact" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.name = None + """ Name of an individual to contact. + Type `str`. """ + + self.telecom = None + """ Contact details for individual or publisher. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(ValueSetContact, self).__init__(jsondict) + + def elementProperties(self): + js = super(ValueSetContact, self).elementProperties() + js.extend([ + ("name", "name", str, False, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ]) + return js + + +class ValueSetExpansion(backboneelement.BackboneElement): + """ Used when the value set is "expanded". + + A value set can also be "expanded", where the value set is turned into a + simple collection of enumerated codes. This element holds the expansion, if + it has been performed. + """ + + resource_name = "ValueSetExpansion" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.contains = None + """ Codes in the value set. + List of `ValueSetExpansionContains` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Uniquely identifies this expansion. + Type `str`. """ + + self.offset = None + """ Offset at which this resource starts. + Type `int`. """ + + self.parameter = None + """ Parameter that controlled the expansion process. + List of `ValueSetExpansionParameter` items (represented as `dict` in JSON). """ + + self.timestamp = None + """ Time ValueSet expansion happened. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.total = None + """ Total number of codes in the expansion. + Type `int`. """ + + super(ValueSetExpansion, self).__init__(jsondict) + + def elementProperties(self): + js = super(ValueSetExpansion, self).elementProperties() + js.extend([ + ("contains", "contains", ValueSetExpansionContains, True, None, False), + ("identifier", "identifier", str, False, None, True), + ("offset", "offset", int, False, None, False), + ("parameter", "parameter", ValueSetExpansionParameter, True, None, False), + ("timestamp", "timestamp", fhirdate.FHIRDate, False, None, True), + ("total", "total", int, False, None, False), + ]) + return js + + +class ValueSetExpansionContains(backboneelement.BackboneElement): + """ Codes in the value set. + + The codes that are contained in the value set expansion. + """ + + resource_name = "ValueSetExpansionContains" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.abstract = None + """ If user cannot select this entry. + Type `bool`. """ + + self.code = None + """ Code - if blank, this is not a selectable code. + Type `str`. """ + + self.contains = None + """ Codes contained under this entry. + List of `ValueSetExpansionContains` items (represented as `dict` in JSON). """ + + self.display = None + """ User display for the concept. + Type `str`. """ + + self.system = None + """ System value for the code. + Type `str`. """ + + self.version = None + """ Version in which this code/display is defined. + Type `str`. """ + + super(ValueSetExpansionContains, self).__init__(jsondict) + + def elementProperties(self): + js = super(ValueSetExpansionContains, self).elementProperties() + js.extend([ + ("abstract", "abstract", bool, False, None, False), + ("code", "code", str, False, None, False), + ("contains", "contains", ValueSetExpansionContains, True, None, False), + ("display", "display", str, False, None, False), + ("system", "system", str, False, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + +class ValueSetExpansionParameter(backboneelement.BackboneElement): + """ Parameter that controlled the expansion process. + + A parameter that controlled the expansion process. These parameters may be + used by users of expanded value sets to check whether the expansion is + suitable for a particular purpose, or to pick the correct expansion. + """ + + resource_name = "ValueSetExpansionParameter" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.name = None + """ Name as assigned by the server. + Type `str`. """ + + self.valueBoolean = None + """ Value of the named parameter. + Type `bool`. """ + + self.valueCode = None + """ Value of the named parameter. + Type `str`. """ + + self.valueDecimal = None + """ Value of the named parameter. + Type `float`. """ + + self.valueInteger = None + """ Value of the named parameter. + Type `int`. """ + + self.valueString = None + """ Value of the named parameter. + Type `str`. """ + + self.valueUri = None + """ Value of the named parameter. + Type `str`. """ + + super(ValueSetExpansionParameter, self).__init__(jsondict) + + def elementProperties(self): + js = super(ValueSetExpansionParameter, self).elementProperties() + js.extend([ + ("name", "name", str, False, None, True), + ("valueBoolean", "valueBoolean", bool, False, "value", False), + ("valueCode", "valueCode", str, False, "value", False), + ("valueDecimal", "valueDecimal", float, False, "value", False), + ("valueInteger", "valueInteger", int, False, "value", False), + ("valueString", "valueString", str, False, "value", False), + ("valueUri", "valueUri", str, False, "value", False), + ]) + return js + + +from . import codeableconcept +from . import coding +from . import contactpoint +from . import fhirdate +from . import identifier diff --git a/fhirclient/models/DSTU2/valueset_tests.py b/fhirclient/models/DSTU2/valueset_tests.py new file mode 100644 index 000000000..88e55d528 --- /dev/null +++ b/fhirclient/models/DSTU2/valueset_tests.py @@ -0,0 +1,323 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import valueset +from .fhirdate import FHIRDate + + +class ValueSetTests(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("ValueSet", js["resourceType"]) + return valueset.ValueSet(js) + + def testValueSet1(self): + inst = self.instantiate_from("valueset-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ValueSet instance") + self.implValueSet1(inst) + + js = inst.as_json() + self.assertEqual("ValueSet", js["resourceType"]) + inst2 = valueset.ValueSet(js) + self.implValueSet1(inst2) + + def implValueSet1(self, inst): + 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.contact[0].name, "FHIR project team") + self.assertEqual(inst.contact[0].telecom[0].system, "other") + 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.system, "http://acme.com/identifiers/valuesets") + self.assertEqual(inst.identifier.value, "loinc-cholesterol-int") + self.assertEqual(inst.lockedDate.date, FHIRDate("2012-06-13").date) + self.assertEqual(inst.lockedDate.as_json(), "2012-06-13") + self.assertEqual(inst.meta.profile[0], "http://hl7.org/fhir/StructureDefinition/valueset-shareable-definition") + 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-extensional") + self.assertEqual(inst.version, "20150622") + + def testValueSet2(self): + inst = self.instantiate_from("valueset-example-expansion.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].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].telecom[0].system, "other") + 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.expansion.contains[0].code, "14647-2") + self.assertEqual(inst.expansion.contains[0].display, "Cholesterol [Moles/volume] in Serum or Plasma") + self.assertEqual(inst.expansion.contains[0].system, "http://loinc.org") + self.assertEqual(inst.expansion.contains[0].version, "2.50") + self.assertTrue(inst.expansion.contains[1].abstract) + self.assertEqual(inst.expansion.contains[1].contains[0].code, "2093-3") + self.assertEqual(inst.expansion.contains[1].contains[0].display, "Cholesterol [Mass/volume] in Serum or Plasma") + self.assertEqual(inst.expansion.contains[1].contains[0].system, "http://loinc.org") + self.assertEqual(inst.expansion.contains[1].contains[0].version, "2.50") + self.assertEqual(inst.expansion.contains[1].contains[1].code, "48620-9") + self.assertEqual(inst.expansion.contains[1].contains[1].display, "Cholesterol [Mass/volume] in Serum or Plasma ultracentrifugate") + self.assertEqual(inst.expansion.contains[1].contains[1].system, "http://loinc.org") + self.assertEqual(inst.expansion.contains[1].contains[1].version, "2.50") + self.assertEqual(inst.expansion.contains[1].contains[2].code, "9342-7") + self.assertEqual(inst.expansion.contains[1].contains[2].display, "Cholesterol [Percentile]") + self.assertEqual(inst.expansion.contains[1].contains[2].system, "http://loinc.org") + self.assertEqual(inst.expansion.contains[1].contains[2].version, "2.50") + self.assertEqual(inst.expansion.contains[1].display, "Cholesterol codes") + self.assertTrue(inst.expansion.contains[2].abstract) + self.assertEqual(inst.expansion.contains[2].contains[0].code, "2096-6") + self.assertEqual(inst.expansion.contains[2].contains[0].display, "Cholesterol/Triglyceride [Mass Ratio] in Serum or Plasma") + self.assertEqual(inst.expansion.contains[2].contains[0].system, "http://loinc.org") + self.assertEqual(inst.expansion.contains[2].contains[0].version, "2.50") + self.assertEqual(inst.expansion.contains[2].contains[1].code, "35200-5") + self.assertEqual(inst.expansion.contains[2].contains[1].display, "Cholesterol/Triglyceride [Mass Ratio] in Serum or Plasma") + self.assertEqual(inst.expansion.contains[2].contains[1].system, "http://loinc.org") + self.assertEqual(inst.expansion.contains[2].contains[1].version, "2.50") + self.assertEqual(inst.expansion.contains[2].contains[2].code, "48089-7") + self.assertEqual(inst.expansion.contains[2].contains[2].display, "Cholesterol/Apolipoprotein B [Molar ratio] in Serum or Plasma") + self.assertEqual(inst.expansion.contains[2].contains[2].system, "http://loinc.org") + self.assertEqual(inst.expansion.contains[2].contains[2].version, "2.50") + self.assertEqual(inst.expansion.contains[2].contains[3].code, "55838-7") + self.assertEqual(inst.expansion.contains[2].contains[3].display, "Cholesterol/Phospholipid [Molar ratio] in Serum or Plasma") + self.assertEqual(inst.expansion.contains[2].contains[3].system, "http://loinc.org") + self.assertEqual(inst.expansion.contains[2].contains[3].version, "2.50") + self.assertEqual(inst.expansion.contains[2].display, "Cholesterol Ratios") + self.assertEqual(inst.expansion.extension[0].url, "http://hl7.org/fhir/StructureDefinition/valueset-expansionSource") + self.assertEqual(inst.expansion.extension[0].valueUri, "http://hl7.org/fhir/ValueSet/example-extensional") + self.assertEqual(inst.expansion.identifier, "urn:uuid:42316ff8-2714-4680-9980-f37a6d1a71bc") + self.assertEqual(inst.expansion.offset, 0) + self.assertEqual(inst.expansion.parameter[0].name, "version") + self.assertEqual(inst.expansion.parameter[0].valueString, "2.50") + self.assertEqual(inst.expansion.timestamp.date, FHIRDate("2015-06-22T13:56:07Z").date) + self.assertEqual(inst.expansion.timestamp.as_json(), "2015-06-22T13:56:07Z") + self.assertEqual(inst.expansion.total, 8) + self.assertTrue(inst.experimental) + self.assertEqual(inst.id, "example-expansion") + self.assertEqual(inst.meta.profile[0], "http://hl7.org/fhir/StructureDefinition/valueset-shareable-definition") + self.assertEqual(inst.name, "LOINC Codes for Cholesterol in Serum/Plasma") + 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-expansion") + self.assertEqual(inst.version, "20150622") + + def testValueSet3(self): + inst = self.instantiate_from("valueset-example-yesnodontknow.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.import_fhir[0], "http://hl7.org/fhir/ValueSet/v2-0136") + self.assertEqual(inst.compose.include[0].concept[0].code, "asked") + self.assertEqual(inst.compose.include[0].concept[0].display, "Don't know") + self.assertEqual(inst.compose.include[0].system, "http://hl7.org/fhir/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[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[2].display, "Don't know") + self.assertEqual(inst.expansion.contains[2].system, "http://hl7.org/fhir/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") + self.assertEqual(inst.id, "yesnodontknow") + self.assertEqual(inst.name, "Yes/No/Don't Know") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.url, "http://hl7.org/fhir/ValueSet/yesnodontknow") + + def testValueSet4(self): + inst = self.instantiate_from("valueset-example-inline.json") + self.assertIsNotNone(inst, "Must have instantiated a ValueSet instance") + self.implValueSet4(inst) + + js = inst.as_json() + self.assertEqual("ValueSet", js["resourceType"]) + inst2 = valueset.ValueSet(js) + self.implValueSet4(inst2) + + def implValueSet4(self, inst): + self.assertTrue(inst.codeSystem.caseSensitive) + self.assertEqual(inst.codeSystem.concept[0].code, "chol-mmol") + self.assertEqual(inst.codeSystem.concept[0].definition, "Serum Cholesterol, in mmol/L") + self.assertEqual(inst.codeSystem.concept[0].designation[0].use.code, "internal-label") + self.assertEqual(inst.codeSystem.concept[0].designation[0].use.system, "http://acme.com/config/fhir/codesystems/internal") + self.assertEqual(inst.codeSystem.concept[0].designation[0].value, "From ACME POC Testing") + self.assertEqual(inst.codeSystem.concept[0].display, "SChol (mmol/L)") + self.assertEqual(inst.codeSystem.concept[1].code, "chol-mass") + self.assertEqual(inst.codeSystem.concept[1].definition, "Serum Cholesterol, in mg/L") + self.assertEqual(inst.codeSystem.concept[1].designation[0].use.code, "internal-label") + self.assertEqual(inst.codeSystem.concept[1].designation[0].use.system, "http://acme.com/config/fhir/codesystems/internal") + self.assertEqual(inst.codeSystem.concept[1].designation[0].value, "From Paragon Labs") + self.assertEqual(inst.codeSystem.concept[1].display, "SChol (mg/L)") + self.assertEqual(inst.codeSystem.concept[2].code, "chol") + self.assertEqual(inst.codeSystem.concept[2].definition, "Serum Cholesterol") + self.assertEqual(inst.codeSystem.concept[2].designation[0].use.code, "internal-label") + self.assertEqual(inst.codeSystem.concept[2].designation[0].use.system, "http://acme.com/config/fhir/codesystems/internal") + self.assertEqual(inst.codeSystem.concept[2].designation[0].value, "Obdurate Labs uses this with both kinds of units...") + self.assertEqual(inst.codeSystem.concept[2].display, "SChol") + self.assertEqual(inst.codeSystem.system, "http://acme.com/config/fhir/codesystems/cholesterol") + self.assertEqual(inst.codeSystem.version, "4.2.3") + self.assertEqual(inst.contact[0].name, "FHIR project team") + self.assertEqual(inst.contact[0].telecom[0].system, "other") + self.assertEqual(inst.contact[0].telecom[0].value, "http://hl7.org/fhir") + 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 ACME codes for serum/plasma cholesterol from v2.36.") + self.assertTrue(inst.experimental) + self.assertEqual(inst.id, "example-inline") + self.assertEqual(inst.identifier.system, "http://acme.com/identifiers/valuesets") + self.assertEqual(inst.identifier.value, "loinc-cholesterol-inl") + self.assertEqual(inst.meta.profile[0], "http://hl7.org/fhir/StructureDefinition/valueset-shareable-definition") + self.assertEqual(inst.name, "ACME 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-inline") + self.assertEqual(inst.version, "20150622") + + def testValueSet5(self): + inst = self.instantiate_from("valueset-list-example-codes.json") + self.assertIsNotNone(inst, "Must have instantiated a ValueSet instance") + self.implValueSet5(inst) + + js = inst.as_json() + self.assertEqual("ValueSet", js["resourceType"]) + inst2 = valueset.ValueSet(js) + self.implValueSet5(inst2) + + def implValueSet5(self, inst): + self.assertTrue(inst.codeSystem.caseSensitive) + self.assertEqual(inst.codeSystem.concept[0].code, "alerts") + self.assertEqual(inst.codeSystem.concept[0].definition, "A list of alerts for the patient.") + self.assertEqual(inst.codeSystem.concept[0].display, "Alerts") + self.assertEqual(inst.codeSystem.concept[1].code, "adverserxns") + self.assertEqual(inst.codeSystem.concept[1].definition, "A list of part adverse reactions.") + self.assertEqual(inst.codeSystem.concept[1].display, "Adverse Reactions") + self.assertEqual(inst.codeSystem.concept[2].code, "allergies") + self.assertEqual(inst.codeSystem.concept[2].definition, "A list of Allergies for the patient.") + self.assertEqual(inst.codeSystem.concept[2].display, "Allergies") + self.assertEqual(inst.codeSystem.concept[3].code, "medications") + self.assertEqual(inst.codeSystem.concept[3].definition, "A list of medication statements for the patient.") + self.assertEqual(inst.codeSystem.concept[3].display, "Medication List") + self.assertEqual(inst.codeSystem.concept[4].code, "problems") + self.assertEqual(inst.codeSystem.concept[4].definition, "A list of problems that the patient is known of have (or have had in the past).") + self.assertEqual(inst.codeSystem.concept[4].display, "Problem List") + self.assertEqual(inst.codeSystem.concept[5].code, "worklist") + self.assertEqual(inst.codeSystem.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.codeSystem.concept[5].display, "Worklist") + self.assertEqual(inst.codeSystem.concept[6].code, "waiting") + self.assertEqual(inst.codeSystem.concept[6].definition, "A list of items waiting for an event (perhaps a surgical patient waiting list).") + self.assertEqual(inst.codeSystem.concept[6].display, "Waiting List") + self.assertEqual(inst.codeSystem.concept[7].code, "protocols") + self.assertEqual(inst.codeSystem.concept[7].definition, "A set of protocols to be followed.") + self.assertEqual(inst.codeSystem.concept[7].display, "Protocols") + self.assertEqual(inst.codeSystem.concept[8].code, "plans") + self.assertEqual(inst.codeSystem.concept[8].definition, "A set of care plans that apply in a particular context of care.") + self.assertEqual(inst.codeSystem.concept[8].display, "Care Plans") + self.assertEqual(inst.codeSystem.extension[0].url, "http://hl7.org/fhir/StructureDefinition/valueset-oid") + self.assertEqual(inst.codeSystem.extension[0].valueUri, "urn:oid:2.16.840.1.113883.4.642.1.173") + self.assertEqual(inst.codeSystem.system, "http://hl7.org/fhir/list-example-use-codes") + self.assertEqual(inst.contact[0].telecom[0].system, "other") + self.assertEqual(inst.contact[0].telecom[0].value, "http://hl7.org/fhir") + self.assertEqual(inst.date.date, FHIRDate("2015-10-24T07:41:03+11:00").date) + self.assertEqual(inst.date.as_json(), "2015-10-24T07:41:03+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/valueset-oid") + self.assertEqual(inst.extension[0].valueUri, "urn:oid:2.16.840.1.113883.4.642.2.173") + self.assertEqual(inst.id, "list-example-codes") + self.assertEqual(inst.meta.lastUpdated.date, FHIRDate("2015-10-24T07:41:03.495+11:00").date) + self.assertEqual(inst.meta.lastUpdated.as_json(), "2015-10-24T07:41:03.495+11:00") + self.assertEqual(inst.meta.profile[0], "http://hl7.org/fhir/StructureDefinition/valueset-shareable-definition") + 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/ValueSet/list-example-codes") + self.assertEqual(inst.version, "1.0.2") + + def testValueSet6(self): + inst = self.instantiate_from("valueset-example-intensional.json") + self.assertIsNotNone(inst, "Must have instantiated a ValueSet instance") + self.implValueSet6(inst) + + js = inst.as_json() + self.assertEqual("ValueSet", js["resourceType"]) + inst2 = valueset.ValueSet(js) + self.implValueSet6(inst2) + + def implValueSet6(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, "other") + 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.system, "http://acme.com/identifiers/valuesets") + self.assertEqual(inst.identifier.value, "loinc-cholesterol-ext") + self.assertEqual(inst.meta.profile[0], "http://hl7.org/fhir/StructureDefinition/valueset-shareable-definition") + 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/DSTU2/visionprescription.py b/fhirclient/models/DSTU2/visionprescription.py new file mode 100644 index 000000000..f27293c96 --- /dev/null +++ b/fhirclient/models/DSTU2/visionprescription.py @@ -0,0 +1,175 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/VisionPrescription) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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 + patient. + """ + + resource_name = "VisionPrescription" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + 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). """ + + self.identifier = None + """ Business identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.patient = None + """ Who prescription is for. + Type `FHIRReference` referencing `Patient` (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). """ + + super(VisionPrescription, self).__init__(jsondict) + + def elementProperties(self): + js = super(VisionPrescription, self).elementProperties() + js.extend([ + ("dateWritten", "dateWritten", fhirdate.FHIRDate, False, None, False), + ("dispense", "dispense", VisionPrescriptionDispense, True, None, False), + ("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), + ]) + return js + + +from . import backboneelement + +class VisionPrescriptionDispense(backboneelement.BackboneElement): + """ Vision supply authorization. + + Deals with details of the dispense part of the supply specification. + """ + + resource_name = "VisionPrescriptionDispense" + + def __init__(self, jsondict=None): + """ Initialize all valid properties. + """ + + self.add = None + """ Lens add. + Type `float`. """ + + self.axis = None + """ Lens axis. + Type `int`. """ + + self.backCurve = None + """ Contact lens back curvature. + Type `float`. """ + + self.base = None + """ up | down | in | out. + Type `str`. """ + + self.brand = None + """ Lens add. + Type `str`. """ + + self.color = None + """ Lens add. + Type `str`. """ + + self.cylinder = None + """ Lens cylinder. + Type `float`. """ + + self.diameter = None + """ Contact lens diameter. + Type `float`. """ + + self.duration = None + """ Lens wear duration. + Type `Quantity` referencing `SimpleQuantity` (represented as `dict` in JSON). """ + + self.eye = None + """ right | left. + Type `str`. """ + + self.notes = None + """ Notes for coatings. + Type `str`. """ + + self.power = None + """ Contact lens power. + Type `float`. """ + + self.prism = None + """ Lens prism. + Type `float`. """ + + self.product = None + """ Product to be supplied. + Type `Coding` (represented as `dict` in JSON). """ + + self.sphere = None + """ Lens sphere. + Type `float`. """ + + super(VisionPrescriptionDispense, self).__init__(jsondict) + + def elementProperties(self): + js = super(VisionPrescriptionDispense, 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), + ("notes", "notes", str, False, None, False), + ("power", "power", float, False, None, False), + ("prism", "prism", float, False, None, False), + ("product", "product", coding.Coding, False, None, True), + ("sphere", "sphere", float, False, None, False), + ]) + return js + + +from . import codeableconcept +from . import coding +from . import fhirdate +from . import fhirreference +from . import identifier +from . import quantity diff --git a/fhirclient/models/DSTU2/visionprescription_tests.py b/fhirclient/models/DSTU2/visionprescription_tests.py new file mode 100644 index 000000000..ac131cd54 --- /dev/null +++ b/fhirclient/models/DSTU2/visionprescription_tests.py @@ -0,0 +1,106 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 1.0.2.7202 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import visionprescription +from .fhirdate import FHIRDate + + +class VisionPrescriptionTests(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("VisionPrescription", js["resourceType"]) + return visionprescription.VisionPrescription(js) + + def testVisionPrescription1(self): + inst = self.instantiate_from("visionprescription-example-1.json") + self.assertIsNotNone(inst, "Must have instantiated a VisionPrescription instance") + self.implVisionPrescription1(inst) + + js = inst.as_json() + self.assertEqual("VisionPrescription", js["resourceType"]) + inst2 = visionprescription.VisionPrescription(js) + self.implVisionPrescription1(inst2) + + def implVisionPrescription1(self, inst): + 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].power, -2.75) + self.assertEqual(inst.dispense[0].product.code, "contact") + self.assertEqual(inst.dispense[0].product.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].power, -2.75) + self.assertEqual(inst.dispense[1].product.code, "contact") + self.assertEqual(inst.dispense[1].product.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.text.div, "
Sample Contract Lens prescription
") + self.assertEqual(inst.text.status, "generated") + + def testVisionPrescription2(self): + inst = self.instantiate_from("visionprescription-example.json") + self.assertIsNotNone(inst, "Must have instantiated a VisionPrescription instance") + self.implVisionPrescription2(inst) + + js = inst.as_json() + self.assertEqual("VisionPrescription", js["resourceType"]) + inst2 = visionprescription.VisionPrescription(js) + self.implVisionPrescription2(inst2) + + def implVisionPrescription2(self, inst): + 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.code, "lens") + self.assertEqual(inst.dispense[0].product.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.code, "lens") + self.assertEqual(inst.dispense[1].product.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.text.status, "generated") + diff --git a/fhirclient/models/R4/__init__.py b/fhirclient/models/R4/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/fhirclient/models/R4/account.py b/fhirclient/models/R4/account.py new file mode 100644 index 000000000..3008fb715 --- /dev/null +++ b/fhirclient/models/R4/account.py @@ -0,0 +1,187 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Account) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Account(domainresource.DomainResource): + """ Tracks balance, charges, for patient or cost center. + + A financial tool for tracking value accrued for a particular purpose. In + the healthcare field, used to track charges for a patient, cost centers, + etc. + """ + + resource_type = "Account" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + 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. + List of `AccountCoverage` items (represented as `dict` in JSON). """ + + self.description = None + """ Explanation of purpose/use. + Type `str`. """ + + self.guarantor = None + """ The parties ultimately responsible for balancing the Account. + List of `AccountGuarantor` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Account number. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.name = None + """ Human-readable label. + Type `str`. """ + + self.owner = None + """ Entity managing the Account. + Type `FHIRReference` (represented as `dict` in JSON). """ + + 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 | on-hold | unknown. + Type `str`. """ + + self.subject = None + """ The entity that caused the expenses. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.type = None + """ E.g. patient, expense, depreciation. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(Account, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Account, self).elementProperties() + js.extend([ + ("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), + ("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 + + +from . import backboneelement + +class AccountCoverage(backboneelement.BackboneElement): + """ The party(s) that are responsible for covering the payment of this account, + and what order should they be applied to the account. + """ + + resource_type = "AccountCoverage" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.coverage = None + """ 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. + Type `int`. """ + + super(AccountCoverage, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(AccountCoverage, self).elementProperties() + js.extend([ + ("coverage", "coverage", fhirreference.FHIRReference, False, None, True), + ("priority", "priority", int, False, None, False), + ]) + return js + + +class AccountGuarantor(backboneelement.BackboneElement): + """ The parties ultimately responsible for balancing the Account. + + The parties responsible for balancing the account if other payment options + fall short. + """ + + resource_type = "AccountGuarantor" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.onHold = None + """ Credit or other hold applied. + Type `bool`. """ + + self.party = None + """ Responsible entity. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.period = None + """ Guarantee account during. + Type `Period` (represented as `dict` in JSON). """ + + super(AccountGuarantor, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(AccountGuarantor, self).elementProperties() + js.extend([ + ("onHold", "onHold", bool, False, None, False), + ("party", "party", fhirreference.FHIRReference, False, None, True), + ("period", "period", period.Period, 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 period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/R4/account_tests.py b/fhirclient/models/R4/account_tests.py new file mode 100644 index 000000000..1540f9d0a --- /dev/null +++ b/fhirclient/models/R4/account_tests.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import account +from .fhirdate import FHIRDate + + +class AccountTests(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("Account", js["resourceType"]) + return account.Account(js) + + def testAccount1(self): + inst = self.instantiate_from("account-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Account instance") + self.implAccount1(inst) + + js = inst.as_json() + self.assertEqual("Account", js["resourceType"]) + inst2 = account.Account(js) + self.implAccount1(inst2) + + def implAccount1(self, inst): + self.assertEqual(inst.coverage[0].priority, 1) + self.assertEqual(inst.description, "Hospital charges") + 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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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, "
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://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.type.text, "patient") + + def testAccount2(self): + inst = self.instantiate_from("account-example-with-guarantor.json") + self.assertIsNotNone(inst, "Must have instantiated a Account instance") + self.implAccount2(inst) + + js = inst.as_json() + self.assertEqual("Account", js["resourceType"]) + inst2 = account.Account(js) + self.implAccount2(inst2) + + def implAccount2(self, inst): + 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.identifier[0].system, "urn:oid:0.1.2.3.4.5.6.7") + 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.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, "
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://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.type.text, "patient") + diff --git a/fhirclient/models/R4/activitydefinition.py b/fhirclient/models/R4/activitydefinition.py new file mode 100644 index 000000000..32fd99199 --- /dev/null +++ b/fhirclient/models/R4/activitydefinition.py @@ -0,0 +1,440 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ActivityDefinition) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class ActivityDefinition(domainresource.DomainResource): + """ The definition of a specific activity to be taken, independent of any + particular patient or context. + + This resource allows for the definition of some activity to be performed, + independent of a particular patient, practitioner, or other performance + context. + """ + + resource_type = "ActivityDefinition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 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). """ + + self.code = None + """ Detail type of activity. + 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.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). """ + + self.dynamicValue = None + """ 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`. """ + + self.identifier = None + """ 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). """ + + self.kind = None + """ Kind of resource. + Type `str`. """ + + self.lastReviewDate = None + """ When the activity definition was last reviewed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.library = None + """ Logic used by the activity definition. + List of `str` items. """ + + self.location = None + """ Where it should happen. + 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` (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). + Type `str`. """ + + self.purpose = None + """ Why this activity definition is defined. + Type `str`. """ + + self.quantity = None + """ How much is administered/consumed/supplied. + Type `Quantity` (represented as `dict` in JSON). """ + + 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.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). """ + + self.timingRange = None + """ When activity is to occur. + Type `Range` (represented as `dict` in JSON). """ + + self.timingTiming = None + """ When activity is to occur. + Type `Timing` (represented as `dict` in JSON). """ + + self.title = None + """ Name for this activity definition (human friendly). + Type `str`. """ + + self.topic = None + """ E.g. Education, Treatment, Assessment, etc.. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.transform = None + """ Transform to apply the template. + Type `str`. """ + + self.url = None + """ Canonical identifier for this activity definition, represented as a + URI (globally unique). + Type `str`. """ + + self.usage = None + """ Describes the clinical usage of the activity definition. + 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 activity definition. + Type `str`. """ + + super(ActivityDefinition, self).__init__(jsondict=jsondict, strict=strict) + + 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), + ("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", 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", str, False, 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 + + +from . import backboneelement + +class ActivityDefinitionDynamicValue(backboneelement.BackboneElement): + """ Dynamic aspects of the definition. + + Dynamic values that will be evaluated to produce values for elements of the + 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 + request resource that would contain the result. + """ + + resource_type = "ActivityDefinitionDynamicValue" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ An expression that provides the dynamic value for the customization. + Type `Expression` (represented as `dict` in JSON). """ + + self.path = None + """ The path to the element to be set dynamically. + Type `str`. """ + + super(ActivityDefinitionDynamicValue, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ActivityDefinitionDynamicValue, self).elementProperties() + js.extend([ + ("expression", "expression", expression.Expression, False, None, True), + ("path", "path", str, False, None, True), + ]) + return js + + +class ActivityDefinitionParticipant(backboneelement.BackboneElement): + """ Who should participate in the action. + + Indicates who should participate in performing the action described. + """ + + resource_type = "ActivityDefinitionParticipant" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.role = None + """ E.g. Nurse, Surgeon, Parent, etc.. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.type = None + """ patient | practitioner | related-person | device. + Type `str`. """ + + super(ActivityDefinitionParticipant, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ActivityDefinitionParticipant, self).elementProperties() + js.extend([ + ("role", "role", codeableconcept.CodeableConcept, False, None, False), + ("type", "type", str, False, None, True), + ]) + return js + + +import sys +try: + from . import age +except ImportError: + age = sys.modules[__package__ + '.age'] +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 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: + 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 quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] +try: + from . import range +except ImportError: + range = sys.modules[__package__ + '.range'] +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/R4/activitydefinition_tests.py b/fhirclient/models/R4/activitydefinition_tests.py new file mode 100644 index 000000000..a45f6cc33 --- /dev/null +++ b/fhirclient/models/R4/activitydefinition_tests.py @@ -0,0 +1,404 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import activitydefinition +from .fhirdate import FHIRDate + + +class ActivityDefinitionTests(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("ActivityDefinition", js["resourceType"]) + return activitydefinition.ActivityDefinition(js) + + def testActivityDefinition1(self): + inst = self.instantiate_from("activitydefinition-predecessor-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ActivityDefinition instance") + self.implActivityDefinition1(inst) + + js = inst.as_json() + self.assertEqual("ActivityDefinition", js["resourceType"]) + inst2 = activitydefinition.ActivityDefinition(js) + self.implActivityDefinition1(inst2) + + def implActivityDefinition1(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.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)") + 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") + 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.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.assertTrue(inst.experimental) + 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, "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].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://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://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://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://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://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://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://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 testActivityDefinition2(self): + inst = self.instantiate_from("activitydefinition-medicationorder-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ActivityDefinition instance") + self.implActivityDefinition2(inst) + + js = inst.as_json() + self.assertEqual("ActivityDefinition", js["resourceType"]) + inst2 = activitydefinition.ActivityDefinition(js) + self.implActivityDefinition2(inst2) + + 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") + 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.contained[0].id, "citalopramMedication") + self.assertEqual(inst.contained[1].id, "citalopramSubstance") + 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].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)") + self.assertEqual(inst.dosage[0].text, "1 tablet oral 1 time daily") + 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].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].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") + 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, "citalopramPrescription") + self.assertEqual(inst.identifier[0].system, "http://motivemi.com") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "citalopramPrescription") + 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, "MedicationRequest") + self.assertEqual(inst.lastReviewDate.date, FHIRDate("2016-08-15").date) + self.assertEqual(inst.lastReviewDate.as_json(), "2016-08-15") + self.assertEqual(inst.name, "CitalopramPrescription") + self.assertEqual(inst.publisher, "Motive Medical Intelligence") + self.assertEqual(inst.purpose, "Defines a guideline supported prescription for the treatment of depressive disorders") + 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") + self.assertEqual(inst.title, "Citalopram Prescription") + self.assertEqual(inst.topic[0].text, "Mental Health Treatment") + 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://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://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://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://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://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://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://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-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ActivityDefinition instance") + self.implActivityDefinition3(inst) + + js = inst.as_json() + self.assertEqual("ActivityDefinition", js["resourceType"]) + inst2 = activitydefinition.ActivityDefinition(js) + self.implActivityDefinition3(inst2) + + def implActivityDefinition3(self, inst): + 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)") + 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") + 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.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.assertTrue(inst.experimental) + 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, "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].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://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://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://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://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://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://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://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") + + def testActivityDefinition4(self): + inst = self.instantiate_from("activitydefinition-servicerequest-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ActivityDefinition instance") + self.implActivityDefinition4(inst) + + js = inst.as_json() + self.assertEqual("ActivityDefinition", js["resourceType"]) + inst2 = activitydefinition.ActivityDefinition(js) + self.implActivityDefinition4(inst2) + + def implActivityDefinition4(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].system, "http://snomed.info/sct") + self.assertEqual(inst.description, "Heart valve replacement") + self.assertEqual(inst.id, "heart-valve-replacement") + 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") + self.assertEqual(inst.participant[0].role.text, "Interventional Cardiology") + self.assertEqual(inst.participant[0].type, "practitioner") + self.assertEqual(inst.purpose, "Describes the proposal to perform a Heart Valve replacement.") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.topic[0].coding[0].code, "34068001") + 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://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://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") + + def testActivityDefinition5(self): + inst = self.instantiate_from("activitydefinition-supplyrequest-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ActivityDefinition instance") + self.implActivityDefinition5(inst) + + js = inst.as_json() + self.assertEqual("ActivityDefinition", js["resourceType"]) + inst2 = activitydefinition.ActivityDefinition(js) + self.implActivityDefinition5(inst2) + + def implActivityDefinition5(self, inst): + self.assertEqual(inst.code.coding[0].code, "BlueTubes") + self.assertEqual(inst.code.coding[0].display, "Blood collect tubes blue cap") + 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/R4/address.py b/fhirclient/models/R4/address.py new file mode 100644 index 000000000..311fb0fd2 --- /dev/null +++ b/fhirclient/models/R4/address.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Address) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Address(element.Element): + """ An address expressed using postal conventions (as opposed to GPS or other + location definition formats). + + An address expressed using postal conventions (as opposed to GPS or other + location definition formats). This data type may be used to convey + addresses for use in delivering mail as well as for visiting locations + which might not be valid for mail delivery. There are a variety of postal + address formats defined around the world. + """ + + resource_type = "Address" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.city = None + """ Name of city, town etc.. + Type `str`. """ + + self.country = None + """ Country (e.g. can be ISO 3166 2 or 3 letter code). + Type `str`. """ + + self.district = None + """ District name (aka county). + Type `str`. """ + + self.line = None + """ Street name, number, direction & P.O. Box etc.. + List of `str` items. """ + + self.period = None + """ Time period when address was/is in use. + Type `Period` (represented as `dict` in JSON). """ + + self.postalCode = None + """ Postal code for area. + Type `str`. """ + + self.state = None + """ Sub-unit of country (abbreviations ok). + Type `str`. """ + + self.text = None + """ Text representation of the address. + Type `str`. """ + + self.type = None + """ postal | physical | both. + Type `str`. """ + + self.use = None + """ home | work | temp | old | billing - purpose of this address. + Type `str`. """ + + super(Address, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Address, self).elementProperties() + js.extend([ + ("city", "city", str, False, None, False), + ("country", "country", str, False, None, False), + ("district", "district", str, False, None, False), + ("line", "line", str, True, None, False), + ("period", "period", period.Period, False, None, False), + ("postalCode", "postalCode", str, False, None, False), + ("state", "state", str, False, None, False), + ("text", "text", str, False, None, False), + ("type", "type", str, False, None, False), + ("use", "use", str, False, None, False), + ]) + return js + + +import sys +try: + from . import period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/R4/adverseevent.py b/fhirclient/models/R4/adverseevent.py new file mode 100644 index 000000000..546a5c4f2 --- /dev/null +++ b/fhirclient/models/R4/adverseevent.py @@ -0,0 +1,241 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/AdverseEvent) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class AdverseEvent(domainresource.DomainResource): + """ Medical care, research study or other healthcare event causing physical + injury. + + Actual or potential/avoided event causing unintended physical injury + resulting from or contributed to by medical care, a research study or other + healthcare setting factors that requires additional monitoring, treatment, + or hospitalization, or that results in death. + """ + + resource_type = "AdverseEvent" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + 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.detected = None + """ When the event was detected. + Type `FHIRDate` (represented as `str` 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. + Type `Identifier` (represented as `dict` in JSON). """ + + self.location = None + """ Location where adverse event occurred. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.outcome = None + """ resolved | recovering | ongoing | resolvedWithSequelae | fatal | + unknown. + Type `CodeableConcept` (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` (represented as `dict` in JSON). """ + + self.referenceDocument = None + """ AdverseEvent.referenceDocument. + 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 + """ 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 (represented as `dict` in JSON). """ + + self.subject = None + """ Subject impacted by event. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.subjectMedicalHistory = None + """ AdverseEvent.subjectMedicalHistory. + 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). """ + + super(AdverseEvent, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(AdverseEvent, self).elementProperties() + js.extend([ + ("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), + ("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), + ("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, True), + ("subjectMedicalHistory", "subjectMedicalHistory", fhirreference.FHIRReference, True, None, False), + ("suspectEntity", "suspectEntity", AdverseEventSuspectEntity, True, None, False), + ]) + return js + + +from . import backboneelement + +class AdverseEventSuspectEntity(backboneelement.BackboneElement): + """ The suspected agent causing the adverse event. + + Describes the entity that is suspected to have caused the adverse event. + """ + + resource_type = "AdverseEventSuspectEntity" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.causality = None + """ 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. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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.author = None + """ AdverseEvent.suspectEntity.causalityAuthor. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.method = None + """ ProbabilityScale | Bayesian | Checklist. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.productRelatedness = None + """ AdverseEvent.suspectEntity.causalityProductRelatedness. + Type `str`. """ + + super(AdverseEventSuspectEntityCausality, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(AdverseEventSuspectEntityCausality, self).elementProperties() + js.extend([ + ("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 + + +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/R4/adverseevent_tests.py b/fhirclient/models/R4/adverseevent_tests.py new file mode 100644 index 000000000..f31dd4524 --- /dev/null +++ b/fhirclient/models/R4/adverseevent_tests.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import adverseevent +from .fhirdate import FHIRDate + + +class AdverseEventTests(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("AdverseEvent", js["resourceType"]) + return adverseevent.AdverseEvent(js) + + def testAdverseEvent1(self): + inst = self.instantiate_from("adverseevent-example.json") + self.assertIsNotNone(inst, "Must have instantiated a AdverseEvent instance") + self.implAdverseEvent1(inst) + + js = inst.as_json() + self.assertEqual("AdverseEvent", js["resourceType"]) + inst2 = adverseevent.AdverseEvent(js) + self.implAdverseEvent1(inst2) + + def implAdverseEvent1(self, inst): + 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.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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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") + diff --git a/fhirclient/models/R4/age.py b/fhirclient/models/R4/age.py new file mode 100644 index 000000000..1b74c9739 --- /dev/null +++ b/fhirclient/models/R4/age.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Age) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import quantity + +class Age(quantity.Quantity): + """ A duration of time during which an organism (or a process) has existed. + """ + + resource_type = "Age" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + super(Age, self).__init__(jsondict=jsondict, strict=strict) + + diff --git a/fhirclient/models/R4/allergyintolerance.py b/fhirclient/models/R4/allergyintolerance.py new file mode 100644 index 000000000..dc23e0f38 --- /dev/null +++ b/fhirclient/models/R4/allergyintolerance.py @@ -0,0 +1,232 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/AllergyIntolerance) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class AllergyIntolerance(domainresource.DomainResource): + """ Allergy or Intolerance (generally: Risk of adverse reaction to a substance). + + Risk of harmful or undesirable, physiological response which is unique to + an individual and associated with exposure to a substance. + """ + + resource_type = "AllergyIntolerance" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.asserter = None + """ Source of the information about the allergy. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.category = None + """ food | medication | environment | biologic. + List of `str` items. """ + + self.clinicalStatus = None + """ active | inactive | resolved. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.code = None + """ Code that identifies the allergy or intolerance. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.criticality = None + """ 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). """ + + self.lastOccurrence = None + """ Date(/time) of last known occurrence of a reaction. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.note = None + """ Additional text not captured in other fields. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.onsetAge = None + """ When allergy or intolerance was identified. + Type `Age` (represented as `dict` in JSON). """ + + self.onsetDateTime = None + """ When allergy or intolerance was identified. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.onsetPeriod = None + """ When allergy or intolerance was identified. + Type `Period` (represented as `dict` in JSON). """ + + self.onsetRange = None + """ When allergy or intolerance was identified. + Type `Range` (represented as `dict` in JSON). """ + + self.onsetString = None + """ When allergy or intolerance was identified. + Type `str`. """ + + self.patient = None + """ Who the sensitivity is for. + 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` (represented as `dict` in JSON). """ + + self.type = None + """ allergy | intolerance - Underlying mechanism (if known). + Type `str`. """ + + self.verificationStatus = None + """ unconfirmed | confirmed | refuted | entered-in-error. + 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([ + ("asserter", "asserter", fhirreference.FHIRReference, False, None, False), + ("category", "category", str, True, 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), + ("onsetAge", "onsetAge", age.Age, False, "onset", False), + ("onsetDateTime", "onsetDateTime", fhirdate.FHIRDate, False, "onset", False), + ("onsetPeriod", "onsetPeriod", period.Period, False, "onset", False), + ("onsetRange", "onsetRange", range.Range, False, "onset", False), + ("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", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import backboneelement + +class AllergyIntoleranceReaction(backboneelement.BackboneElement): + """ Adverse Reaction Events linked to exposure to substance. + + Details about each adverse reaction event linked to exposure to the + identified substance. + """ + + resource_type = "AllergyIntoleranceReaction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 the event as a whole. + Type `str`. """ + + self.exposureRoute = None + """ How the subject was exposed to the substance. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.manifestation = None + """ Clinical symptoms/signs associated with the Event. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.note = None + """ Text about event not captured in other fields. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.onset = None + """ Date(/time) when manifestations showed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.severity = None + """ mild | moderate | severe (of event as a whole). + Type `str`. """ + + self.substance = None + """ Specific substance or pharmaceutical product considered to be + responsible for event. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(AllergyIntoleranceReaction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(AllergyIntoleranceReaction, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, False), + ("exposureRoute", "exposureRoute", codeableconcept.CodeableConcept, False, None, False), + ("manifestation", "manifestation", codeableconcept.CodeableConcept, True, None, True), + ("note", "note", annotation.Annotation, True, None, False), + ("onset", "onset", fhirdate.FHIRDate, False, None, False), + ("severity", "severity", str, False, None, False), + ("substance", "substance", 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: + 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'] +try: + from . import range +except ImportError: + range = sys.modules[__package__ + '.range'] diff --git a/fhirclient/models/R4/allergyintolerance_tests.py b/fhirclient/models/R4/allergyintolerance_tests.py new file mode 100644 index 000000000..8fae5eef1 --- /dev/null +++ b/fhirclient/models/R4/allergyintolerance_tests.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import allergyintolerance +from .fhirdate import FHIRDate + + +class AllergyIntoleranceTests(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("AllergyIntolerance", js["resourceType"]) + return allergyintolerance.AllergyIntolerance(js) + + def testAllergyIntolerance1(self): + inst = self.instantiate_from("allergyintolerance-example.json") + self.assertIsNotNone(inst, "Must have instantiated a AllergyIntolerance instance") + self.implAllergyIntolerance1(inst) + + js = inst.as_json() + self.assertEqual("AllergyIntolerance", js["resourceType"]) + inst2 = allergyintolerance.AllergyIntolerance(js) + self.implAllergyIntolerance1(inst2) + + def implAllergyIntolerance1(self, inst): + self.assertEqual(inst.category[0], "food") + 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") + self.assertEqual(inst.criticality, "high") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier[0].system, "http://acme.com/ids/patients/risks") + 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") + self.assertEqual(inst.reaction[0].description, "Challenge Protocol. Severe reaction to subcutaneous cashew extract. Epinephrine administered") + self.assertEqual(inst.reaction[0].exposureRoute.coding[0].code, "34206005") + self.assertEqual(inst.reaction[0].exposureRoute.coding[0].display, "Subcutaneous route") + self.assertEqual(inst.reaction[0].exposureRoute.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.reaction[0].manifestation[0].coding[0].code, "39579001") + self.assertEqual(inst.reaction[0].manifestation[0].coding[0].display, "Anaphylactic reaction") + self.assertEqual(inst.reaction[0].manifestation[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.reaction[0].onset.date, FHIRDate("2012-06-12").date) + self.assertEqual(inst.reaction[0].onset.as_json(), "2012-06-12") + self.assertEqual(inst.reaction[0].severity, "severe") + self.assertEqual(inst.reaction[0].substance.coding[0].code, "1160593") + self.assertEqual(inst.reaction[0].substance.coding[0].display, "cashew nut allergenic extract Injectable Product") + self.assertEqual(inst.reaction[0].substance.coding[0].system, "http://www.nlm.nih.gov/research/umls/rxnorm") + self.assertEqual(inst.reaction[1].manifestation[0].coding[0].code, "64305001") + self.assertEqual(inst.reaction[1].manifestation[0].coding[0].display, "Urticaria") + self.assertEqual(inst.reaction[1].manifestation[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.reaction[1].note[0].text, "The patient reports that the onset of urticaria was within 15 minutes of eating cashews.") + 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.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/R4/annotation.py b/fhirclient/models/R4/annotation.py new file mode 100644 index 000000000..8e2992e18 --- /dev/null +++ b/fhirclient/models/R4/annotation.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Annotation) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Annotation(element.Element): + """ Text node with attribution. + + A text note which also contains information about who made the statement + and when. + """ + + resource_type = "Annotation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.authorReference = None + """ Individual responsible for the annotation. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.authorString = None + """ Individual responsible for the annotation. + Type `str`. """ + + self.text = None + """ The annotation - text content (as markdown). + Type `str`. """ + + self.time = None + """ When the annotation was made. + Type `FHIRDate` (represented as `str` in JSON). """ + + super(Annotation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Annotation, self).elementProperties() + js.extend([ + ("authorReference", "authorReference", fhirreference.FHIRReference, False, "author", False), + ("authorString", "authorString", str, False, "author", False), + ("text", "text", str, False, None, True), + ("time", "time", fhirdate.FHIRDate, False, None, False), + ]) + 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'] diff --git a/fhirclient/models/R4/appointment.py b/fhirclient/models/R4/appointment.py new file mode 100644 index 000000000..6ed778ebc --- /dev/null +++ b/fhirclient/models/R4/appointment.py @@ -0,0 +1,223 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Appointment) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Appointment(domainresource.DomainResource): + """ A booking of a healthcare event among patient(s), practitioner(s), related + person(s) and/or device(s) for a specific date/time. This may result in one + or more Encounter(s). + """ + + resource_type = "Appointment" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.appointmentType = None + """ The style of appointment or patient that has been booked in the + 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`. """ + + self.created = None + """ The date that this appointment was initially created. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Shown on a subject line in a meeting request, or appointment list. + Type `str`. """ + + self.end = None + """ When appointment is to conclude. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.identifier = None + """ External Ids for this item. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.minutesDuration = None + """ Can be less than start/end (e.g. estimate). + Type `int`. """ + + self.participant = None + """ 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.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 categorization of the service that is to be performed + during this appointment. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.serviceType = None + """ The specific service that is to be performed during this + appointment. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.slot = None + """ The slots that this appointment is filling. + List of `FHIRReference` 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. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.start = None + """ When appointment is to take place. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.status = None + """ proposed | pending | booked | arrived | fulfilled | cancelled | + noshow | entered-in-error | checked-in | waitlist. + Type `str`. """ + + self.supportingInformation = None + """ Additional information to support the appointment. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + super(Appointment, self).__init__(jsondict=jsondict, strict=strict) + + 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), + ("minutesDuration", "minutesDuration", int, False, None, False), + ("participant", "participant", AppointmentParticipant, True, None, True), + ("patientInstruction", "patientInstruction", str, False, None, False), + ("priority", "priority", int, False, 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, True, None, False), + ("serviceType", "serviceType", codeableconcept.CodeableConcept, True, None, False), + ("slot", "slot", fhirreference.FHIRReference, True, None, False), + ("specialty", "specialty", codeableconcept.CodeableConcept, True, None, False), + ("start", "start", fhirdate.FHIRDate, False, None, False), + ("status", "status", str, False, None, True), + ("supportingInformation", "supportingInformation", fhirreference.FHIRReference, True, None, False), + ]) + return js + + +from . import backboneelement + +class AppointmentParticipant(backboneelement.BackboneElement): + """ Participants involved in appointment. + + List of participants involved in the appointment. + """ + + resource_type = "AppointmentParticipant" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Person, Location/HealthcareService or Device. + 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. + Type `str`. """ + + self.status = None + """ accepted | declined | tentative | needs-action. + Type `str`. """ + + self.type = None + """ Role of participant in the appointment. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(AppointmentParticipant, self).__init__(jsondict=jsondict, strict=strict) + + 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), + ]) + 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/R4/appointment_tests.py b/fhirclient/models/R4/appointment_tests.py new file mode 100644 index 000000000..d75c60c92 --- /dev/null +++ b/fhirclient/models/R4/appointment_tests.py @@ -0,0 +1,166 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import appointment +from .fhirdate import FHIRDate + + +class AppointmentTests(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("Appointment", js["resourceType"]) + return appointment.Appointment(js) + + def testAppointment1(self): + inst = self.instantiate_from("appointment-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Appointment instance") + self.implAppointment1(inst) + + js = inst.as_json() + self.assertEqual("Appointment", js["resourceType"]) + inst2 = appointment.Appointment(js) + self.implAppointment1(inst2) + + def implAppointment1(self, inst): + 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("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.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, "accepted") + self.assertEqual(inst.participant[1].required, "required") + 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://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[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-request.json") + self.assertIsNotNone(inst, "Must have instantiated a Appointment instance") + self.implAppointment2(inst) + + js = inst.as_json() + self.assertEqual("Appointment", js["resourceType"]) + inst2 = appointment.Appointment(js) + self.implAppointment2(inst2) + + def implAppointment2(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://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.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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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, "needs-action") + self.assertEqual(inst.participant[1].required, "required") + 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://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.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") + + def testAppointment3(self): + inst = self.instantiate_from("appointment-example2doctors.json") + self.assertIsNotNone(inst, "Must have instantiated a Appointment instance") + self.implAppointment3(inst) + + js = inst.as_json() + self.assertEqual("Appointment", js["resourceType"]) + inst2 = appointment.Appointment(js) + self.implAppointment3(inst2) + + def implAppointment3(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://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") + self.assertEqual(inst.participant[1].status, "accepted") + self.assertEqual(inst.participant[2].required, "required") + self.assertEqual(inst.participant[2].status, "accepted") + self.assertEqual(inst.participant[3].required, "information-only") + self.assertEqual(inst.participant[3].status, "accepted") + self.assertEqual(inst.priority, 5) + 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-09T09:00:00Z").date) + self.assertEqual(inst.start.as_json(), "2013-12-09T09:00:00Z") + self.assertEqual(inst.status, "booked") + self.assertEqual(inst.text.div, "
Brian MRI results discussion
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/R4/appointmentresponse.py b/fhirclient/models/R4/appointmentresponse.py new file mode 100644 index 000000000..9e197a1e9 --- /dev/null +++ b/fhirclient/models/R4/appointmentresponse.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/AppointmentResponse) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class AppointmentResponse(domainresource.DomainResource): + """ A reply to an appointment request for a patient and/or practitioner(s), + such as a confirmation or rejection. + """ + + resource_type = "AppointmentResponse" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Person, Location, HealthcareService, or Device. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.appointment = None + """ Appointment this response relates to. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.comment = None + """ Additional comments. + Type `str`. """ + + self.end = None + """ Time from appointment, or requested new end time. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.identifier = None + """ External Ids for this item. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.participantStatus = None + """ accepted | declined | tentative | in-process | completed | needs- + action | entered-in-error. + Type `str`. """ + + self.participantType = None + """ Role of participant in the appointment. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.start = None + """ Time from appointment, or requested new start time. + Type `FHIRDate` (represented as `str` in JSON). """ + + super(AppointmentResponse, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(AppointmentResponse, self).elementProperties() + js.extend([ + ("actor", "actor", fhirreference.FHIRReference, False, None, False), + ("appointment", "appointment", fhirreference.FHIRReference, False, None, True), + ("comment", "comment", str, False, None, False), + ("end", "end", fhirdate.FHIRDate, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("participantStatus", "participantStatus", str, False, None, True), + ("participantType", "participantType", codeableconcept.CodeableConcept, True, None, False), + ("start", "start", fhirdate.FHIRDate, 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/R4/appointmentresponse_tests.py b/fhirclient/models/R4/appointmentresponse_tests.py new file mode 100644 index 000000000..3da650c29 --- /dev/null +++ b/fhirclient/models/R4/appointmentresponse_tests.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import appointmentresponse +from .fhirdate import FHIRDate + + +class AppointmentResponseTests(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("AppointmentResponse", js["resourceType"]) + return appointmentresponse.AppointmentResponse(js) + + def testAppointmentResponse1(self): + inst = self.instantiate_from("appointmentresponse-example-req.json") + self.assertIsNotNone(inst, "Must have instantiated a AppointmentResponse instance") + self.implAppointmentResponse1(inst) + + js = inst.as_json() + self.assertEqual("AppointmentResponse", js["resourceType"]) + inst2 = appointmentresponse.AppointmentResponse(js) + self.implAppointmentResponse1(inst2) + + def implAppointmentResponse1(self, inst): + self.assertEqual(inst.comment, "can't we try for this time, can't do mornings") + self.assertEqual(inst.end.date, FHIRDate("2013-12-25T13:30:00Z").date) + self.assertEqual(inst.end.as_json(), "2013-12-25T13:30:00Z") + 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://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
") + self.assertEqual(inst.text.status, "generated") + + def testAppointmentResponse2(self): + inst = self.instantiate_from("appointmentresponse-example.json") + self.assertIsNotNone(inst, "Must have instantiated a AppointmentResponse instance") + self.implAppointmentResponse2(inst) + + js = inst.as_json() + self.assertEqual("AppointmentResponse", js["resourceType"]) + inst2 = appointmentresponse.AppointmentResponse(js) + self.implAppointmentResponse2(inst2) + + 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/R4/attachment.py b/fhirclient/models/R4/attachment.py new file mode 100644 index 000000000..7aa76fed0 --- /dev/null +++ b/fhirclient/models/R4/attachment.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Attachment) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Attachment(element.Element): + """ Content in a format defined elsewhere. + + For referring to data content defined in other formats. + """ + + resource_type = "Attachment" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.contentType = None + """ Mime type of the content, with charset etc.. + Type `str`. """ + + self.creation = None + """ Date attachment was first created. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.data = None + """ Data inline, base64ed. + Type `str`. """ + + self.hash = None + """ Hash of the data (sha-1, base64ed). + Type `str`. """ + + self.language = None + """ Human language of the content (BCP-47). + Type `str`. """ + + self.size = None + """ Number of bytes of content (if url provided). + Type `int`. """ + + self.title = None + """ Label to display in place of the data. + Type `str`. """ + + self.url = None + """ Uri where the data can be found. + Type `str`. """ + + super(Attachment, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Attachment, self).elementProperties() + js.extend([ + ("contentType", "contentType", str, False, None, False), + ("creation", "creation", fhirdate.FHIRDate, False, None, False), + ("data", "data", str, False, None, False), + ("hash", "hash", str, False, None, False), + ("language", "language", str, False, None, False), + ("size", "size", int, False, None, False), + ("title", "title", str, False, None, False), + ("url", "url", str, False, None, False), + ]) + return js + + +import sys +try: + from . import fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] diff --git a/fhirclient/models/R4/auditevent.py b/fhirclient/models/R4/auditevent.py new file mode 100644 index 000000000..611a1002c --- /dev/null +++ b/fhirclient/models/R4/auditevent.py @@ -0,0 +1,380 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/AuditEvent) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class AuditEvent(domainresource.DomainResource): + """ Event record kept for security purposes. + + A record of an event made for purposes of maintaining a security log. + Typical uses include detection of intrusion attempts and monitoring for + inappropriate usage. + """ + + resource_type = "AuditEvent" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Type of action performed during the event. + Type `str`. """ + + self.agent = None + """ Actor involved in the event. + List of `AuditEventAgent` items (represented as `dict` in JSON). """ + + self.entity = None + """ Data or objects used. + List of `AuditEventEntity` items (represented as `dict` in JSON). """ + + self.outcome = None + """ Whether the event succeeded or failed. + Type `str`. """ + + self.outcomeDesc = None + """ 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 was recorded. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.source = None + """ Audit Event Reporter. + Type `AuditEventSource` (represented as `dict` in JSON). """ + + self.subtype = None + """ More specific type/id for the event. + List of `Coding` items (represented as `dict` in JSON). """ + + self.type = None + """ Type/identifier of event. + Type `Coding` (represented as `dict` in JSON). """ + + super(AuditEvent, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(AuditEvent, self).elementProperties() + js.extend([ + ("action", "action", str, False, None, False), + ("agent", "agent", AuditEventAgent, True, None, True), + ("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), + ("subtype", "subtype", coding.Coding, True, None, False), + ("type", "type", coding.Coding, False, None, True), + ]) + return js + + +from . import backboneelement + +class AuditEventAgent(backboneelement.BackboneElement): + """ Actor involved in the event. + + An actor taking an active role in the event or activity that is logged. + """ + + resource_type = "AuditEventAgent" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.altId = None + """ Alternative User identity. + Type `str`. """ + + self.location = None + """ Where. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.media = None + """ Type of media. + Type `Coding` (represented as `dict` in JSON). """ + + self.name = None + """ Human friendly name for the agent. + Type `str`. """ + + self.network = None + """ Logical network location for application activity. + Type `AuditEventAgentNetwork` (represented as `dict` in JSON). """ + + self.policy = None + """ Policy that authorized event. + List of `str` items. """ + + self.purposeOfUse = None + """ Reason given for this user. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.requestor = None + """ Whether user is initiator. + Type `bool`. """ + + self.role = None + """ Agent role in the event. + List of `CodeableConcept` items (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) + + def elementProperties(self): + js = super(AuditEventAgent, self).elementProperties() + js.extend([ + ("altId", "altId", str, False, None, False), + ("location", "location", fhirreference.FHIRReference, False, None, False), + ("media", "media", coding.Coding, False, None, False), + ("name", "name", str, False, None, False), + ("network", "network", AuditEventAgentNetwork, False, None, False), + ("policy", "policy", str, True, None, False), + ("purposeOfUse", "purposeOfUse", codeableconcept.CodeableConcept, True, None, False), + ("requestor", "requestor", bool, False, None, True), + ("role", "role", codeableconcept.CodeableConcept, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("who", "who", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +class AuditEventAgentNetwork(backboneelement.BackboneElement): + """ Logical network location for application activity. + + Logical network location for application activity, if the activity has a + network location. + """ + + resource_type = "AuditEventAgentNetwork" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Identifier for the network access point of the user device. + Type `str`. """ + + self.type = None + """ The type of network access point. + Type `str`. """ + + super(AuditEventAgentNetwork, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(AuditEventAgentNetwork, self).elementProperties() + js.extend([ + ("address", "address", str, False, None, False), + ("type", "type", str, False, None, False), + ]) + return js + + +class AuditEventEntity(backboneelement.BackboneElement): + """ Data or objects used. + + Specific instances of data or objects that have been accessed. + """ + + resource_type = "AuditEventEntity" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Descriptive text. + Type `str`. """ + + self.detail = None + """ Additional Information about the entity. + List of `AuditEventEntityDetail` items (represented as `dict` in JSON). """ + + self.lifecycle = None + """ Life-cycle stage for the entity. + Type `Coding` (represented as `dict` in JSON). """ + + self.name = None + """ Descriptor for entity. + Type `str`. """ + + self.query = None + """ Query parameters. + Type `str`. """ + + self.role = None + """ What role the entity played. + Type `Coding` (represented as `dict` in JSON). """ + + self.securityLabel = None + """ Security labels on the entity. + List of `Coding` items (represented as `dict` in JSON). """ + + self.type = None + """ 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): + js = super(AuditEventEntity, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, False), + ("detail", "detail", AuditEventEntityDetail, True, None, False), + ("lifecycle", "lifecycle", coding.Coding, False, None, False), + ("name", "name", str, False, None, False), + ("query", "query", str, 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 + + +class AuditEventEntityDetail(backboneelement.BackboneElement): + """ Additional Information about the entity. + + Tagged value pairs for conveying additional information about the entity. + """ + + resource_type = "AuditEventEntityDetail" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Name of the property. + Type `str`. """ + + self.valueBase64Binary = None + """ Property value. + Type `str`. """ + + self.valueString = None + """ Property value. + Type `str`. """ + + super(AuditEventEntityDetail, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(AuditEventEntityDetail, self).elementProperties() + js.extend([ + ("type", "type", str, False, None, True), + ("valueBase64Binary", "valueBase64Binary", str, False, "value", True), + ("valueString", "valueString", str, False, "value", True), + ]) + return js + + +class AuditEventSource(backboneelement.BackboneElement): + """ Audit Event Reporter. + + The system that is reporting the event. + """ + + resource_type = "AuditEventSource" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.observer = None + """ The identity of source detecting the event. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.site = None + """ Logical source location within the enterprise. + Type `str`. """ + + self.type = None + """ The type of source where event originated. + List of `Coding` items (represented as `dict` in JSON). """ + + super(AuditEventSource, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(AuditEventSource, self).elementProperties() + js.extend([ + ("observer", "observer", fhirreference.FHIRReference, False, None, True), + ("site", "site", str, False, None, False), + ("type", "type", coding.Coding, True, 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 period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/R4/auditevent_tests.py b/fhirclient/models/R4/auditevent_tests.py new file mode 100644 index 000000000..1426b2ec3 --- /dev/null +++ b/fhirclient/models/R4/auditevent_tests.py @@ -0,0 +1,520 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import auditevent +from .fhirdate import FHIRDate + + +class AuditEventTests(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("AuditEvent", js["resourceType"]) + return auditevent.AuditEvent(js) + + def testAuditEvent1(self): + inst = self.instantiate_from("audit-event-example-search.json") + self.assertIsNotNone(inst, "Must have instantiated a AuditEvent instance") + self.implAuditEvent1(inst) + + js = inst.as_json() + self.assertEqual("AuditEvent", js["resourceType"]) + inst2 = auditevent.AuditEvent(js) + self.implAuditEvent1(inst2) + + 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.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].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("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://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, "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") + self.assertIsNotNone(inst, "Must have instantiated a AuditEvent instance") + self.implAuditEvent2(inst) + + js = inst.as_json() + self.assertEqual("AuditEvent", js["resourceType"]) + inst2 = auditevent.AuditEvent(js) + self.implAuditEvent2(inst2) + + def implAuditEvent2(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-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.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, "110123") + self.assertEqual(inst.subtype[0].display, "Logout") + 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 testAuditEvent3(self): + inst = self.instantiate_from("audit-event-example-vread.json") + self.assertIsNotNone(inst, "Must have instantiated a AuditEvent instance") + self.implAuditEvent3(inst) + + js = inst.as_json() + self.assertEqual("AuditEvent", js["resourceType"]) + inst2 = auditevent.AuditEvent(js) + 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].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].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.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://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://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://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://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://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.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") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.code, "110106") + self.assertEqual(inst.type.display, "Export") + self.assertEqual(inst.type.system, "http://dicom.nema.org/resources/ontology/DCM") + + 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.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, "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].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].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://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://terminology.hl7.org/CodeSystem/audit-entity-type") + self.assertEqual(inst.entity[1].detail[0].type, "MSH-10") + 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://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://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.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") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.code, "110112") + self.assertEqual(inst.type.display, "Query") + self.assertEqual(inst.type.system, "http://dicom.nema.org/resources/ontology/DCM") + + def testAuditEvent7(self): + inst = self.instantiate_from("auditevent-example.json") + self.assertIsNotNone(inst, "Must have instantiated a AuditEvent instance") + self.implAuditEvent7(inst) + + js = inst.as_json() + self.assertEqual("AuditEvent", js["resourceType"]) + inst2 = auditevent.AuditEvent(js) + self.implAuditEvent7(inst2) + + def implAuditEvent7(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].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].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("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, "110100") + self.assertEqual(inst.type.display, "Application Activity") + self.assertEqual(inst.type.system, "http://dicom.nema.org/resources/ontology/DCM") + + def testAuditEvent8(self): + inst = self.instantiate_from("auditevent-example-disclosure.json") + self.assertIsNotNone(inst, "Must have instantiated a AuditEvent instance") + self.implAuditEvent8(inst) + + js = inst.as_json() + self.assertEqual("AuditEvent", js["resourceType"]) + inst2 = auditevent.AuditEvent(js) + self.implAuditEvent8(inst2) + + 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") + self.assertEqual(inst.agent[0].network.address, "custodian.net") + 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].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://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertFalse(inst.agent[1].requestor) + 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://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://terminology.hl7.org/CodeSystem/audit-entity-type") + self.assertEqual(inst.entity[1].description, "data about Everthing important") + self.assertEqual(inst.entity[1].lifecycle.code, "11") + self.assertEqual(inst.entity[1].lifecycle.display, "Disclosure") + 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://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://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://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://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://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://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.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://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.
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.code, "110106") + self.assertEqual(inst.type.display, "Export") + self.assertEqual(inst.type.system, "http://dicom.nema.org/resources/ontology/DCM") + + def testAuditEvent9(self): + inst = self.instantiate_from("auditevent-example-error.json") + self.assertIsNotNone(inst, "Must have instantiated a AuditEvent instance") + self.implAuditEvent9(inst) + + js = inst.as_json() + self.assertEqual("AuditEvent", js["resourceType"]) + inst2 = auditevent.AuditEvent(js) + self.implAuditEvent9(inst2) + + 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].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, "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/R4/backboneelement.py b/fhirclient/models/R4/backboneelement.py new file mode 100644 index 000000000..cd05b2987 --- /dev/null +++ b/fhirclient/models/R4/backboneelement.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/BackboneElement) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class BackboneElement(element.Element): + """ Base for elements defined inside a resource. + + Base definition for all elements that are defined inside a resource - but + not those in a data type. + """ + + resource_type = "BackboneElement" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.modifierExtension = None + """ 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) + + def elementProperties(self): + js = super(BackboneElement, self).elementProperties() + js.extend([ + ("modifierExtension", "modifierExtension", extension.Extension, True, None, False), + ]) + return js + + +import sys +try: + from . import extension +except ImportError: + extension = sys.modules[__package__ + '.extension'] diff --git a/fhirclient/models/R4/basic.py b/fhirclient/models/R4/basic.py new file mode 100644 index 000000000..6ea46932a --- /dev/null +++ b/fhirclient/models/R4/basic.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Basic) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Basic(domainresource.DomainResource): + """ Resource for non-supported content. + + Basic is used for handling concepts not yet defined in FHIR, narrative-only + resources that don't map to an existing resource, and custom resources not + appropriate for inclusion in the FHIR specification. + """ + + resource_type = "Basic" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Who created. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.code = None + """ Kind of Resource. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.created = None + """ When created. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.identifier = None + """ Business identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.subject = None + """ Identifies the focus of this resource. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(Basic, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Basic, self).elementProperties() + js.extend([ + ("author", "author", fhirreference.FHIRReference, False, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("created", "created", fhirdate.FHIRDate, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("subject", "subject", fhirreference.FHIRReference, 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/R4/basic_tests.py b/fhirclient/models/R4/basic_tests.py new file mode 100644 index 000000000..eb3138f4e --- /dev/null +++ b/fhirclient/models/R4/basic_tests.py @@ -0,0 +1,115 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import basic +from .fhirdate import FHIRDate + + +class BasicTests(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("Basic", js["resourceType"]) + return basic.Basic(js) + + def testBasic1(self): + inst = self.instantiate_from("basic-example2.json") + self.assertIsNotNone(inst, "Must have instantiated a Basic instance") + self.implBasic1(inst) + + js = inst.as_json() + self.assertEqual("Basic", js["resourceType"]) + inst2 = basic.Basic(js) + self.implBasic1(inst2) + + def implBasic1(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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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-narrative.json") + self.assertIsNotNone(inst, "Must have instantiated a Basic instance") + self.implBasic2(inst) + + js = inst.as_json() + self.assertEqual("Basic", js["resourceType"]) + inst2 = basic.Basic(js) + 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://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") + self.assertEqual(inst.extension[1].url, "http://example.org/do-not-use/fhir-extensions/referral#notes") + self.assertEqual(inst.extension[1].valueString, "The patient had fever peaks over the last couple of days. He is worried about these peaks.") + self.assertEqual(inst.extension[2].url, "http://example.org/do-not-use/fhir-extensions/referral#fulfillingEncounter") + 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") + self.assertEqual(inst.modifierExtension[0].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.modifierExtension[1].url, "http://example.org/do-not-use/fhir-extensions/referral#targetDate") + self.assertEqual(inst.modifierExtension[1].valuePeriod.end.date, FHIRDate("2013-04-15").date) + self.assertEqual(inst.modifierExtension[1].valuePeriod.end.as_json(), "2013-04-15") + self.assertEqual(inst.modifierExtension[1].valuePeriod.start.date, FHIRDate("2013-04-01").date) + self.assertEqual(inst.modifierExtension[1].valuePeriod.start.as_json(), "2013-04-01") + 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") + diff --git a/fhirclient/models/R4/binary.py b/fhirclient/models/R4/binary.py new file mode 100644 index 000000000..e7b744e25 --- /dev/null +++ b/fhirclient/models/R4/binary.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Binary) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import resource + +class Binary(resource.Resource): + """ Pure binary content defined by a format other than FHIR. + + 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.contentType = None + """ MimeType of the binary content. + Type `str`. """ + + self.data = None + """ The actual content. + Type `str`. """ + + self.securityContext = None + """ 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([ + ("contentType", "contentType", str, False, None, True), + ("data", "data", str, False, None, False), + ("securityContext", "securityContext", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +import sys +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] diff --git a/fhirclient/models/R4/binary_tests.py b/fhirclient/models/R4/binary_tests.py new file mode 100644 index 000000000..96b4a5240 --- /dev/null +++ b/fhirclient/models/R4/binary_tests.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import binary +from .fhirdate import FHIRDate + + +class BinaryTests(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("Binary", js["resourceType"]) + return binary.Binary(js) + + def testBinary1(self): + inst = self.instantiate_from("binary-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Binary instance") + self.implBinary1(inst) + + js = inst.as_json() + self.assertEqual("Binary", js["resourceType"]) + inst2 = binary.Binary(js) + self.implBinary1(inst2) + + 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/R4/biologicallyderivedproduct.py similarity index 99% rename from fhirclient/models/biologicallyderivedproduct.py rename to fhirclient/models/R4/biologicallyderivedproduct.py index eb1197294..23653fefe 100644 --- a/fhirclient/models/biologicallyderivedproduct.py +++ b/fhirclient/models/R4/biologicallyderivedproduct.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/BiologicallyDerivedProduct) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/BiologicallyDerivedProduct) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/biologicallyderivedproduct_tests.py b/fhirclient/models/R4/biologicallyderivedproduct_tests.py similarity index 94% rename from fhirclient/models/biologicallyderivedproduct_tests.py rename to fhirclient/models/R4/biologicallyderivedproduct_tests.py index 40d478ac1..c3aa5cca7 100644 --- a/fhirclient/models/biologicallyderivedproduct_tests.py +++ b/fhirclient/models/R4/biologicallyderivedproduct_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/bodystructure.py b/fhirclient/models/R4/bodystructure.py similarity index 98% rename from fhirclient/models/bodystructure.py rename to fhirclient/models/R4/bodystructure.py index 5c258c5a7..eea3e3b6d 100644 --- a/fhirclient/models/bodystructure.py +++ b/fhirclient/models/R4/bodystructure.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/BodyStructure) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/BodyStructure) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/bodystructure_tests.py b/fhirclient/models/R4/bodystructure_tests.py similarity index 98% rename from fhirclient/models/bodystructure_tests.py rename to fhirclient/models/R4/bodystructure_tests.py index 9966e4ea6..612b9ade5 100644 --- a/fhirclient/models/bodystructure_tests.py +++ b/fhirclient/models/R4/bodystructure_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/R4/bundle.py b/fhirclient/models/R4/bundle.py new file mode 100644 index 000000000..0ac56d46c --- /dev/null +++ b/fhirclient/models/R4/bundle.py @@ -0,0 +1,322 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Bundle) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import resource + +class Bundle(resource.Resource): + """ Contains a collection of resources. + + A container for a collection of resources. + """ + + resource_type = "Bundle" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.entry = None + """ Entry in the bundle - will have a resource or information. + List of `BundleEntry` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Persistent identifier for the bundle. + Type `Identifier` (represented as `dict` in JSON). """ + + self.link = None + """ Links related to this Bundle. + List of `BundleLink` items (represented as `dict` in JSON). """ + + self.signature = None + """ 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`. """ + + self.type = None + """ document | message | transaction | transaction-response | batch | + batch-response | history | searchset | collection. + Type `str`. """ + + super(Bundle, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Bundle, self).elementProperties() + js.extend([ + ("entry", "entry", BundleEntry, True, None, False), + ("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), + ]) + return js + + +from . import backboneelement + +class BundleEntry(backboneelement.BackboneElement): + """ Entry in the bundle - will have a resource or information. + + An entry in a bundle resource - will either contain a resource or + information about a resource (transactions and history only). + """ + + resource_type = "BundleEntry" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.fullUrl = None + """ URI for resource (Absolute URL server address or URI for UUID/OID). + Type `str`. """ + + self.link = None + """ Links related to this entry. + List of `BundleLink` items (represented as `dict` in JSON). """ + + self.request = None + """ Additional execution information (transaction/batch/history). + Type `BundleEntryRequest` (represented as `dict` in JSON). """ + + self.resource = None + """ A resource in the bundle. + Type `Resource` (represented as `dict` in JSON). """ + + self.response = None + """ Results of execution (transaction/batch/history). + Type `BundleEntryResponse` (represented as `dict` in JSON). """ + + self.search = None + """ Search related information. + Type `BundleEntrySearch` (represented as `dict` in JSON). """ + + super(BundleEntry, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(BundleEntry, self).elementProperties() + js.extend([ + ("fullUrl", "fullUrl", str, False, None, False), + ("link", "link", BundleLink, True, None, False), + ("request", "request", BundleEntryRequest, False, None, False), + ("resource", "resource", resource.Resource, False, None, False), + ("response", "response", BundleEntryResponse, False, None, False), + ("search", "search", BundleEntrySearch, False, None, False), + ]) + return js + + +class BundleEntryRequest(backboneelement.BackboneElement): + """ Additional execution information (transaction/batch/history). + + Additional information about how this entry should be processed as part of + a transaction or batch. For history, it shows how the entry was processed + to create the version contained in the entry. + """ + + resource_type = "BundleEntryRequest" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.ifMatch = None + """ For managing update contention. + Type `str`. """ + + self.ifModifiedSince = None + """ For managing cache currency. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.ifNoneExist = None + """ For conditional creates. + Type `str`. """ + + self.ifNoneMatch = None + """ For managing cache currency. + Type `str`. """ + + self.method = None + """ GET | HEAD | POST | PUT | DELETE | PATCH. + Type `str`. """ + + self.url = None + """ URL for HTTP equivalent of this entry. + Type `str`. """ + + super(BundleEntryRequest, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(BundleEntryRequest, self).elementProperties() + js.extend([ + ("ifMatch", "ifMatch", str, False, None, False), + ("ifModifiedSince", "ifModifiedSince", fhirdate.FHIRDate, False, None, False), + ("ifNoneExist", "ifNoneExist", str, False, None, False), + ("ifNoneMatch", "ifNoneMatch", str, False, None, False), + ("method", "method", str, False, None, True), + ("url", "url", str, False, None, True), + ]) + return js + + +class BundleEntryResponse(backboneelement.BackboneElement): + """ Results of execution (transaction/batch/history). + + 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.etag = None + """ The Etag for the resource (if relevant). + Type `str`. """ + + self.lastModified = None + """ Server's date time modified. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.location = None + """ The location (if the operation returns a location). + Type `str`. """ + + self.outcome = None + """ OperationOutcome with hints and warnings (for batch/transaction). + Type `Resource` (represented as `dict` in JSON). """ + + self.status = None + """ Status response code (text optional). + Type `str`. """ + + super(BundleEntryResponse, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(BundleEntryResponse, self).elementProperties() + js.extend([ + ("etag", "etag", str, False, None, False), + ("lastModified", "lastModified", fhirdate.FHIRDate, False, None, False), + ("location", "location", str, False, None, False), + ("outcome", "outcome", resource.Resource, False, None, False), + ("status", "status", str, False, None, True), + ]) + return js + + +class BundleEntrySearch(backboneelement.BackboneElement): + """ Search related information. + + Information about the search process that lead to the creation of this + entry. + """ + + resource_type = "BundleEntrySearch" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ match | include | outcome - why this is in the result set. + Type `str`. """ + + self.score = None + """ Search ranking (between 0 and 1). + Type `float`. """ + + super(BundleEntrySearch, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(BundleEntrySearch, self).elementProperties() + js.extend([ + ("mode", "mode", str, False, None, False), + ("score", "score", float, False, None, False), + ]) + return js + + +class BundleLink(backboneelement.BackboneElement): + """ Links related to this Bundle. + + A series of links that provide context to this bundle. + """ + + resource_type = "BundleLink" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.relation = None + """ See http://www.iana.org/assignments/link-relations/link- + relations.xhtml#link-relations-1. + Type `str`. """ + + self.url = None + """ Reference details for the link. + Type `str`. """ + + super(BundleLink, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(BundleLink, self).elementProperties() + js.extend([ + ("relation", "relation", str, False, None, True), + ("url", "url", str, False, None, True), + ]) + return js + + +import sys +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 signature +except ImportError: + signature = sys.modules[__package__ + '.signature'] diff --git a/fhirclient/models/R4/bundle_tests.py b/fhirclient/models/R4/bundle_tests.py new file mode 100644 index 000000000..43e8a6772 --- /dev/null +++ b/fhirclient/models/R4/bundle_tests.py @@ -0,0 +1,393 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import bundle +from .fhirdate import FHIRDate + + +class BundleTests(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("Bundle", js["resourceType"]) + return bundle.Bundle(js) + + def testBundle1(self): + inst = self.instantiate_from("diagnosticreport-example-f202-bloodculture.json") + self.assertIsNotNone(inst, "Must have instantiated a Bundle instance") + self.implBundle1(inst) + + js = inst.as_json() + self.assertEqual("Bundle", js["resourceType"]) + inst2 = bundle.Bundle(js) + self.implBundle1(inst2) + + def implBundle1(self, inst): + 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("xds-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Bundle instance") + self.implBundle2(inst) + + js = inst.as_json() + self.assertEqual("Bundle", js["resourceType"]) + inst2 = bundle.Bundle(js) + self.implBundle2(inst2) + + def implBundle2(self, inst): + 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, "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, "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, "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, "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, "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 testBundle3(self): + inst = self.instantiate_from("diagnosticreport-example-ghp.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, "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 testBundle4(self): + inst = self.instantiate_from("practitioner-examples-general.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://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") + self.assertEqual(inst.entry[1].resource.id, "13") + 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/Practitioner/14") + self.assertEqual(inst.entry[2].resource.id, "14") + 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/Practitioner/15") + self.assertEqual(inst.entry[3].resource.id, "15") + 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/Practitioner/16") + self.assertEqual(inst.entry[4].resource.id, "16") + 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/Practitioner/17") + self.assertEqual(inst.entry[5].resource.id, "17") + 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/Practitioner/18") + self.assertEqual(inst.entry[6].resource.id, "18") + 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/Practitioner/19") + self.assertEqual(inst.entry[7].resource.id, "19") + 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/Practitioner/20") + self.assertEqual(inst.entry[8].resource.id, "20") + 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/Practitioner/21") + self.assertEqual(inst.entry[9].resource.id, "21") + 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, "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 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.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/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") + self.assertEqual(inst.entry[1].resource.id, "example-0") + self.assertEqual(inst.entry[2].fullUrl, "http://hl7.org/fhir/PractitionerRole/example-1") + self.assertEqual(inst.entry[2].resource.id, "example-1") + self.assertEqual(inst.entry[3].fullUrl, "http://hl7.org/fhir/PractitionerRole/example-2") + self.assertEqual(inst.entry[3].resource.id, "example-2") + self.assertEqual(inst.entry[4].fullUrl, "http://hl7.org/fhir/PractitionerRole/f007-0") + self.assertEqual(inst.entry[4].resource.id, "f007-0") + self.assertEqual(inst.entry[5].fullUrl, "http://hl7.org/fhir/PractitionerRole/f004-0") + self.assertEqual(inst.entry[5].resource.id, "f004-0") + self.assertEqual(inst.entry[6].fullUrl, "http://hl7.org/fhir/PractitionerRole/xcda1-0") + self.assertEqual(inst.entry[6].resource.id, "xcda1-0") + self.assertEqual(inst.entry[7].fullUrl, "http://hl7.org/fhir/PractitionerRole/f202-0") + self.assertEqual(inst.entry[7].resource.id, "f202-0") + self.assertEqual(inst.entry[8].fullUrl, "http://hl7.org/fhir/PractitionerRole/f201-0") + self.assertEqual(inst.entry[8].resource.id, "f201-0") + 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/R4/capabilitystatement.py b/fhirclient/models/R4/capabilitystatement.py new file mode 100644 index 000000000..b35aaa6bf --- /dev/null +++ b/fhirclient/models/R4/capabilitystatement.py @@ -0,0 +1,815 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/CapabilityStatement) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class CapabilityStatement(domainresource.DomainResource): + """ A statement of system capabilities. + + A Capability Statement documents a set of capabilities (behaviors) of a + 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 last changed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Natural language description of the capability statement. + Type `str`. """ + + self.document = None + """ Document definition. + List of `CapabilityStatementDocument` items (represented as `dict` in JSON). """ + + self.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.fhirVersion = None + """ FHIR Version the system supports. + Type `str`. """ + + self.format = None + """ formats supported (xml | json | ttl | mime type). + List of `str` items. """ + + self.implementation = None + """ If this describes a specific instance. + Type `CapabilityStatementImplementation` (represented as `dict` in JSON). """ + + self.implementationGuide = None + """ 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. """ + + self.jurisdiction = None + """ Intended jurisdiction for capability statement (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.kind = None + """ instance | capability | requirements. + Type `str`. """ + + self.messaging = None + """ If messaging is supported. + List of `CapabilityStatementMessaging` items (represented as `dict` in JSON). """ + + self.name = None + """ Name for this capability statement (computer friendly). + Type `str`. """ + + self.patchFormat = None + """ Patch formats supported. + List of `str` items. """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this capability statement is defined. + Type `str`. """ + + self.rest = None + """ If the endpoint is a RESTful one. + List of `CapabilityStatementRest` items (represented as `dict` in JSON). """ + + self.software = None + """ Software that is covered by this capability statement. + Type `CapabilityStatementSoftware` (represented as `dict` in JSON). """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.title = None + """ Name for this capability statement (human friendly). + Type `str`. """ + + self.url = None + """ Canonical identifier for this capability statement, 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 capability statement. + Type `str`. """ + + super(CapabilityStatement, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CapabilityStatement, self).elementProperties() + js.extend([ + ("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), + ("document", "document", CapabilityStatementDocument, True, None, False), + ("experimental", "experimental", bool, False, None, False), + ("fhirVersion", "fhirVersion", str, False, None, True), + ("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), + ("publisher", "publisher", str, False, None, False), + ("purpose", "purpose", str, False, None, False), + ("rest", "rest", CapabilityStatementRest, True, None, False), + ("software", "software", CapabilityStatementSoftware, False, None, False), + ("status", "status", str, False, None, True), + ("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 CapabilityStatementDocument(backboneelement.BackboneElement): + """ Document definition. + + A document definition. + """ + + resource_type = "CapabilityStatementDocument" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 document support. + Type `str`. """ + + self.mode = None + """ producer | consumer. + Type `str`. """ + + self.profile = None + """ Constraint on the resources used in the document. + Type `str`. """ + + super(CapabilityStatementDocument, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CapabilityStatementDocument, self).elementProperties() + js.extend([ + ("documentation", "documentation", str, False, None, False), + ("mode", "mode", str, False, None, True), + ("profile", "profile", str, False, None, True), + ]) + return js + + +class CapabilityStatementImplementation(backboneelement.BackboneElement): + """ If this describes a specific instance. + + Identifies a specific implementation instance that is described by the + capability statement - i.e. a particular installation, rather than the + capabilities of a software program. + """ + + resource_type = "CapabilityStatementImplementation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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`. """ + + self.url = None + """ Base URL for the installation. + Type `str`. """ + + super(CapabilityStatementImplementation, self).__init__(jsondict=jsondict, strict=strict) + + 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), + ]) + return js + + +class CapabilityStatementMessaging(backboneelement.BackboneElement): + """ If messaging is supported. + + A description of the messaging capabilities of the solution. + """ + + resource_type = "CapabilityStatementMessaging" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Messaging interface behavior details. + Type `str`. """ + + self.endpoint = None + """ Where messages should be sent. + List of `CapabilityStatementMessagingEndpoint` items (represented as `dict` in JSON). """ + + self.reliableCache = None + """ Reliable Message Cache Length (min). + Type `int`. """ + + self.supportedMessage = None + """ Messages supported by this system. + List of `CapabilityStatementMessagingSupportedMessage` items (represented as `dict` in JSON). """ + + super(CapabilityStatementMessaging, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CapabilityStatementMessaging, self).elementProperties() + js.extend([ + ("documentation", "documentation", str, False, None, False), + ("endpoint", "endpoint", CapabilityStatementMessagingEndpoint, True, None, False), + ("reliableCache", "reliableCache", int, False, None, False), + ("supportedMessage", "supportedMessage", CapabilityStatementMessagingSupportedMessage, True, None, False), + ]) + return js + + +class CapabilityStatementMessagingEndpoint(backboneelement.BackboneElement): + """ Where messages should be sent. + + An endpoint (network accessible address) to which messages and/or replies + are to be sent. + """ + + resource_type = "CapabilityStatementMessagingEndpoint" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Network address or identifier of the end-point. + Type `str`. """ + + self.protocol = None + """ http | ftp | mllp +. + Type `Coding` (represented as `dict` in JSON). """ + + super(CapabilityStatementMessagingEndpoint, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CapabilityStatementMessagingEndpoint, self).elementProperties() + js.extend([ + ("address", "address", str, False, None, True), + ("protocol", "protocol", coding.Coding, False, None, True), + ]) + return js + + +class CapabilityStatementMessagingSupportedMessage(backboneelement.BackboneElement): + """ Messages supported by this system. + + References to message definitions for messages this system can send or + receive. + """ + + resource_type = "CapabilityStatementMessagingSupportedMessage" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Message supported by this system. + Type `str`. """ + + self.mode = None + """ sender | receiver. + Type `str`. """ + + super(CapabilityStatementMessagingSupportedMessage, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CapabilityStatementMessagingSupportedMessage, self).elementProperties() + js.extend([ + ("definition", "definition", str, False, None, True), + ("mode", "mode", str, False, None, True), + ]) + return js + + +class CapabilityStatementRest(backboneelement.BackboneElement): + """ If the endpoint is a RESTful one. + + A definition of the restful capabilities of the solution, if any. + """ + + resource_type = "CapabilityStatementRest" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.compartment = None + """ Compartments served/used by system. + List of `str` items. """ + + self.documentation = None + """ General description of implementation. + Type `str`. """ + + self.interaction = None + """ What operations are supported?. + List of `CapabilityStatementRestInteraction` items (represented as `dict` in JSON). """ + + self.mode = None + """ client | server. + Type `str`. """ + + self.operation = None + """ Definition of a system level operation. + List of `CapabilityStatementRestResourceOperation` items (represented as `dict` in JSON). """ + + self.resource = None + """ Resource served on the REST interface. + List of `CapabilityStatementRestResource` items (represented as `dict` in JSON). """ + + self.searchParam = None + """ Search parameters for searching all resources. + List of `CapabilityStatementRestResourceSearchParam` items (represented as `dict` in JSON). """ + + self.security = None + """ Information about security of implementation. + Type `CapabilityStatementRestSecurity` (represented as `dict` in JSON). """ + + super(CapabilityStatementRest, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CapabilityStatementRest, self).elementProperties() + js.extend([ + ("compartment", "compartment", str, True, None, False), + ("documentation", "documentation", str, False, None, False), + ("interaction", "interaction", CapabilityStatementRestInteraction, True, None, False), + ("mode", "mode", str, False, None, True), + ("operation", "operation", CapabilityStatementRestResourceOperation, True, None, False), + ("resource", "resource", CapabilityStatementRestResource, True, None, False), + ("searchParam", "searchParam", CapabilityStatementRestResourceSearchParam, True, None, False), + ("security", "security", CapabilityStatementRestSecurity, False, None, False), + ]) + return js + + +class CapabilityStatementRestInteraction(backboneelement.BackboneElement): + """ What operations are supported?. + + A specification of restful operations supported by the system. + """ + + resource_type = "CapabilityStatementRestInteraction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ transaction | batch | search-system | history-system. + Type `str`. """ + + self.documentation = None + """ Anything special about operation behavior. + Type `str`. """ + + super(CapabilityStatementRestInteraction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CapabilityStatementRestInteraction, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("documentation", "documentation", str, False, None, False), + ]) + return js + + +class CapabilityStatementRestResource(backboneelement.BackboneElement): + """ Resource served on the REST interface. + + A specification of the restful capabilities of the solution for a specific + resource type. + """ + + resource_type = "CapabilityStatementRestResource" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.conditionalCreate = None + """ If allows/uses conditional create. + Type `bool`. """ + + self.conditionalDelete = None + """ not-supported | single | multiple - how conditional delete is + supported. + Type `str`. """ + + self.conditionalRead = None + """ not-supported | modified-since | not-match | full-support. + Type `str`. """ + + self.conditionalUpdate = None + """ If allows/uses conditional update. + Type `bool`. """ + + self.documentation = None + """ Additional information about the use of the resource type. + Type `str`. """ + + self.interaction = None + """ 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 `str`. """ + + self.readHistory = None + """ Whether vRead can return past versions. + Type `bool`. """ + + self.referencePolicy = None + """ literal | logical | resolves | enforced | local. + List of `str` items. """ + + self.searchInclude = None + """ _include values supported by the server. + List of `str` items. """ + + self.searchParam = None + """ Search parameters supported by implementation. + List of `CapabilityStatementRestResourceSearchParam` items (represented as `dict` in JSON). """ + + self.searchRevInclude = None + """ _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`. """ + + self.updateCreate = None + """ If update can commit to a new identity. + Type `bool`. """ + + self.versioning = None + """ no-version | versioned | versioned-update. + Type `str`. """ + + super(CapabilityStatementRestResource, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CapabilityStatementRestResource, self).elementProperties() + js.extend([ + ("conditionalCreate", "conditionalCreate", bool, False, None, False), + ("conditionalDelete", "conditionalDelete", str, False, None, False), + ("conditionalRead", "conditionalRead", str, False, None, False), + ("conditionalUpdate", "conditionalUpdate", bool, False, None, False), + ("documentation", "documentation", str, 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), + ]) + return js + + +class CapabilityStatementRestResourceInteraction(backboneelement.BackboneElement): + """ What operations are supported?. + + Identifies a restful operation supported by the solution. + """ + + resource_type = "CapabilityStatementRestResourceInteraction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ read | vread | update | patch | delete | history-instance | + history-type | create | search-type. + Type `str`. """ + + self.documentation = None + """ Anything special about operation behavior. + Type `str`. """ + + super(CapabilityStatementRestResourceInteraction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CapabilityStatementRestResourceInteraction, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("documentation", "documentation", str, False, None, False), + ]) + 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. + + Search parameters for implementations to support and/or make use of - + either references to ones defined in the specification, or additional ones + defined for/by the implementation. + """ + + resource_type = "CapabilityStatementRestResourceSearchParam" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Source of definition for parameter. + Type `str`. """ + + self.documentation = None + """ Server-specific usage. + Type `str`. """ + + self.name = None + """ Name of search parameter. + Type `str`. """ + + self.type = None + """ number | date | string | token | reference | composite | quantity | + uri | special. + Type `str`. """ + + super(CapabilityStatementRestResourceSearchParam, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CapabilityStatementRestResourceSearchParam, self).elementProperties() + js.extend([ + ("definition", "definition", str, False, None, False), + ("documentation", "documentation", str, False, None, False), + ("name", "name", str, False, None, True), + ("type", "type", str, False, None, True), + ]) + return js + + +class CapabilityStatementRestSecurity(backboneelement.BackboneElement): + """ Information about security of implementation. + + Information about security implementation from an interface perspective - + what a client needs to know. + """ + + resource_type = "CapabilityStatementRestSecurity" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.cors = None + """ Adds CORS Headers (http://enable-cors.org/). + Type `bool`. """ + + self.description = None + """ General description of how security works. + Type `str`. """ + + self.service = None + """ OAuth | SMART-on-FHIR | NTLM | Basic | Kerberos | Certificates. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(CapabilityStatementRestSecurity, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CapabilityStatementRestSecurity, self).elementProperties() + js.extend([ + ("cors", "cors", bool, False, None, False), + ("description", "description", str, False, None, False), + ("service", "service", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +class CapabilityStatementSoftware(backboneelement.BackboneElement): + """ Software that is covered by this capability statement. + + Software that is covered by this capability statement. It is used when the + capability statement describes the capabilities of a particular software + version, independent of an installation. + """ + + resource_type = "CapabilityStatementSoftware" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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.releaseDate = None + """ Date this version was released. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.version = None + """ Version covered by this statement. + Type `str`. """ + + super(CapabilityStatementSoftware, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CapabilityStatementSoftware, self).elementProperties() + js.extend([ + ("name", "name", str, False, None, True), + ("releaseDate", "releaseDate", fhirdate.FHIRDate, False, 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 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 fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import usagecontext +except ImportError: + usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/R4/capabilitystatement_tests.py b/fhirclient/models/R4/capabilitystatement_tests.py new file mode 100644 index 000000000..f5dfce50d --- /dev/null +++ b/fhirclient/models/R4/capabilitystatement_tests.py @@ -0,0 +1,177 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import capabilitystatement +from .fhirdate import FHIRDate + + +class CapabilityStatementTests(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("CapabilityStatement", js["resourceType"]) + return capabilitystatement.CapabilityStatement(js) + + def testCapabilityStatement1(self): + inst = self.instantiate_from("capabilitystatement-example.json") + self.assertIsNotNone(inst, "Must have instantiated a CapabilityStatement instance") + self.implCapabilityStatement1(inst) + + js = inst.as_json() + self.assertEqual("CapabilityStatement", js["resourceType"]) + inst2 = capabilitystatement.CapabilityStatement(js) + self.implCapabilityStatement1(inst2) + + def implCapabilityStatement1(self, inst): + 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.copyright, "Copyright © Acme Healthcare and GoodCorp EHR Systems") + 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.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, "4.0.0") + self.assertEqual(inst.format[0], "xml") + self.assertEqual(inst.format[1], "json") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.implementation.description, "main EHR at ACME") + self.assertEqual(inst.implementation.url, "http://10.2.3.4/fhir") + self.assertEqual(inst.implementationGuide[0], "http://hl7.org/fhir/us/lab") + self.assertEqual(inst.instantiates[0], "http://ihe.org/fhir/CapabilityStatement/pixm-client") + 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.kind, "instance") + 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://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") + self.assertEqual(inst.publisher, "ACME Corporation") + self.assertEqual(inst.purpose, "Main EHR capability statement, published for contracting and operational support") + self.assertEqual(inst.rest[0].compartment[0], "http://hl7.org/fhir/CompartmentDefinition/patient") + self.assertEqual(inst.rest[0].documentation, "Main FHIR endpoint for acem health") + self.assertEqual(inst.rest[0].interaction[0].code, "transaction") + self.assertEqual(inst.rest[0].interaction[1].code, "history-system") + self.assertEqual(inst.rest[0].mode, "server") + self.assertTrue(inst.rest[0].resource[0].conditionalCreate) + self.assertEqual(inst.rest[0].resource[0].conditionalDelete, "not-supported") + self.assertEqual(inst.rest[0].resource[0].conditionalRead, "full-support") + self.assertFalse(inst.rest[0].resource[0].conditionalUpdate) + self.assertEqual(inst.rest[0].resource[0].documentation, "This server does not let the clients create identities.") + self.assertEqual(inst.rest[0].resource[0].interaction[0].code, "read") + self.assertEqual(inst.rest[0].resource[0].interaction[1].code, "vread") + self.assertEqual(inst.rest[0].resource[0].interaction[1].documentation, "Only supported for patient records since 12-Dec 2012") + self.assertEqual(inst.rest[0].resource[0].interaction[2].code, "update") + 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") + self.assertEqual(inst.rest[0].resource[0].searchParam[0].documentation, "Only supports search by institution MRN") + self.assertEqual(inst.rest[0].resource[0].searchParam[0].name, "identifier") + self.assertEqual(inst.rest[0].resource[0].searchParam[0].type, "token") + self.assertEqual(inst.rest[0].resource[0].searchParam[1].definition, "http://hl7.org/fhir/SearchParameter/Patient-general-practitioner") + 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.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://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") + self.assertEqual(inst.software.version, "0.00.020.2134") + 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.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, "positive") + self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].system, "http://terminology.hl7.org/CodeSystem/variant-state") + self.assertEqual(inst.version, "20130510") + + def testCapabilityStatement2(self): + inst = self.instantiate_from("capabilitystatement-phr-example.json") + self.assertIsNotNone(inst, "Must have instantiated a CapabilityStatement instance") + self.implCapabilityStatement2(inst) + + js = inst.as_json() + self.assertEqual("CapabilityStatement", js["resourceType"]) + inst2 = capabilitystatement.CapabilityStatement(js) + self.implCapabilityStatement2(inst2) + + def implCapabilityStatement2(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.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, "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") + self.assertEqual(inst.rest[0].mode, "server") + self.assertEqual(inst.rest[0].resource[0].interaction[0].code, "read") + self.assertEqual(inst.rest[0].resource[0].interaction[1].code, "search-type") + self.assertEqual(inst.rest[0].resource[0].interaction[1].documentation, "When a client searches patients with no search criteria, they get a list of all patients they have access too. Servers may elect to offer additional search parameters, but this is not required") + self.assertEqual(inst.rest[0].resource[0].type, "Patient") + self.assertEqual(inst.rest[0].resource[1].interaction[0].code, "read") + self.assertEqual(inst.rest[0].resource[1].interaction[1].code, "search-type") + self.assertEqual(inst.rest[0].resource[1].searchParam[0].documentation, "_id parameter always supported. For the connectathon, servers may elect which search parameters are supported") + self.assertEqual(inst.rest[0].resource[1].searchParam[0].name, "_id") + self.assertEqual(inst.rest[0].resource[1].searchParam[0].type, "token") + self.assertEqual(inst.rest[0].resource[1].type, "DocumentReference") + self.assertEqual(inst.rest[0].resource[2].interaction[0].code, "read") + self.assertEqual(inst.rest[0].resource[2].interaction[1].code, "search-type") + self.assertEqual(inst.rest[0].resource[2].searchParam[0].documentation, "Standard _id parameter") + self.assertEqual(inst.rest[0].resource[2].searchParam[0].name, "_id") + self.assertEqual(inst.rest[0].resource[2].searchParam[0].type, "token") + self.assertEqual(inst.rest[0].resource[2].type, "Condition") + self.assertEqual(inst.rest[0].resource[3].interaction[0].code, "read") + self.assertEqual(inst.rest[0].resource[3].interaction[1].code, "search-type") + self.assertEqual(inst.rest[0].resource[3].searchParam[0].documentation, "Standard _id parameter") + self.assertEqual(inst.rest[0].resource[3].searchParam[0].name, "_id") + self.assertEqual(inst.rest[0].resource[3].searchParam[0].type, "token") + self.assertEqual(inst.rest[0].resource[3].searchParam[1].documentation, "which diagnostic discipline/department created the report") + self.assertEqual(inst.rest[0].resource[3].searchParam[1].name, "service") + self.assertEqual(inst.rest[0].resource[3].searchParam[1].type, "token") + self.assertEqual(inst.rest[0].resource[3].type, "DiagnosticReport") + self.assertEqual(inst.rest[0].security.service[0].text, "OAuth") + self.assertEqual(inst.software.name, "ACME PHR Server") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/R4/careplan.py b/fhirclient/models/R4/careplan.py new file mode 100644 index 000000000..7573a5a0f --- /dev/null +++ b/fhirclient/models/R4/careplan.py @@ -0,0 +1,367 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/CarePlan) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class CarePlan(domainresource.DomainResource): + """ Healthcare plan for patient or group. + + Describes the intention of how one or more practitioners intend to deliver + care for a particular patient, group or community for a period of time, + possibly limited to care for a specific condition or set of conditions. + """ + + resource_type = "CarePlan" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.activity = None + """ Action to occur as part of plan. + List of `CarePlanActivity` items (represented as `dict` in JSON). """ + + self.addresses = None + """ Health issues this plan addresses. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.author = None + """ Who is the designated responsible party. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.basedOn = None + """ Fulfills CarePlan. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.careTeam = None + """ Who's involved in plan?. + 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.contributor = None + """ Who provided the content of the care plan. + List of `FHIRReference` items (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 (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`. """ + + self.note = None + """ Comments about the plan. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.partOf = None + """ Part of referenced CarePlan. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.period = None + """ Time period plan covers. + Type `Period` (represented as `dict` in JSON). """ + + self.replaces = None + """ CarePlan replaced by this CarePlan. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.status = None + """ draft | active | suspended | completed | entered-in-error | + cancelled | unknown. + Type `str`. """ + + self.subject = None + """ 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 (represented as `dict` in JSON). """ + + self.title = None + """ Human-friendly name for the care plan. + Type `str`. """ + + super(CarePlan, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CarePlan, self).elementProperties() + js.extend([ + ("activity", "activity", CarePlanActivity, True, None, False), + ("addresses", "addresses", 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), + ("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), + ("period", "period", period.Period, False, None, False), + ("replaces", "replaces", fhirreference.FHIRReference, True, None, False), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, True), + ("supportingInfo", "supportingInfo", fhirreference.FHIRReference, True, None, False), + ("title", "title", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class CarePlanActivity(backboneelement.BackboneElement): + """ Action to occur as part of plan. + + Identifies a planned action to occur as part of the plan. For example, a + medication to be used, lab tests to perform, self-monitoring, education, + etc. + """ + + resource_type = "CarePlanActivity" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.detail = None + """ In-line definition of activity. + Type `CarePlanActivityDetail` (represented as `dict` in JSON). """ + + self.outcomeCodeableConcept = None + """ Results of the activity. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.outcomeReference = None + """ Appointment, Encounter, Procedure, etc.. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.progress = None + """ Comments about the activity status/progress. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.reference = None + """ Activity details defined in specific resource. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(CarePlanActivity, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CarePlanActivity, self).elementProperties() + js.extend([ + ("detail", "detail", CarePlanActivityDetail, False, None, False), + ("outcomeCodeableConcept", "outcomeCodeableConcept", codeableconcept.CodeableConcept, True, None, False), + ("outcomeReference", "outcomeReference", fhirreference.FHIRReference, True, None, False), + ("progress", "progress", annotation.Annotation, True, None, False), + ("reference", "reference", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +class CarePlanActivityDetail(backboneelement.BackboneElement): + """ In-line definition of activity. + + A simple summary of a planned activity suitable for a general care plan + system (e.g. form driven) that doesn't know about specific resources such + as procedure etc. + """ + + resource_type = "CarePlanActivityDetail" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Detail type of activity. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.dailyAmount = None + """ How to consume/day?. + Type `Quantity` (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 (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` (represented as `dict` in JSON). """ + + self.performer = None + """ Who will be responsible?. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.productCodeableConcept = None + """ What is to be administered/supplied. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.productReference = None + """ What is to be administered/supplied. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.quantity = None + """ How much to administer/supply/consume. + Type `Quantity` (represented as `dict` in JSON). """ + + self.reasonCode = None + """ Why activity should be done or why activity was prohibited. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.reasonReference = None + """ Why activity is needed. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.scheduledPeriod = None + """ When activity is to occur. + Type `Period` (represented as `dict` in JSON). """ + + self.scheduledString = None + """ When activity is to occur. + Type `str`. """ + + self.scheduledTiming = None + """ When activity is to occur. + Type `Timing` (represented as `dict` in JSON). """ + + self.status = None + """ not-started | scheduled | in-progress | on-hold | completed | + cancelled | stopped | unknown | entered-in-error. + Type `str`. """ + + self.statusReason = None + """ Reason for current status. + 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([ + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("dailyAmount", "dailyAmount", quantity.Quantity, 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), + ("quantity", "quantity", quantity.Quantity, False, None, False), + ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), + ("reasonReference", "reasonReference", fhirreference.FHIRReference, True, None, False), + ("scheduledPeriod", "scheduledPeriod", period.Period, False, "scheduled", False), + ("scheduledString", "scheduledString", str, False, "scheduled", False), + ("scheduledTiming", "scheduledTiming", timing.Timing, False, "scheduled", False), + ("status", "status", str, False, None, True), + ("statusReason", "statusReason", 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 period +except ImportError: + period = sys.modules[__package__ + '.period'] +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] +try: + from . import timing +except ImportError: + timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/R4/careplan_tests.py b/fhirclient/models/R4/careplan_tests.py new file mode 100644 index 000000000..14988bab6 --- /dev/null +++ b/fhirclient/models/R4/careplan_tests.py @@ -0,0 +1,511 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import careplan +from .fhirdate import FHIRDate + + +class CarePlanTests(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("CarePlan", js["resourceType"]) + return careplan.CarePlan(js) + + def testCarePlan1(self): + inst = self.instantiate_from("careplan-example-f002-lung.json") + self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") + self.implCarePlan1(inst) + + js = inst.as_json() + self.assertEqual("CarePlan", js["resourceType"]) + inst2 = careplan.CarePlan(js) + self.implCarePlan1(inst2) + + def implCarePlan1(self, inst): + 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.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, "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.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-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-f202-malignancy.json") + self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") + self.implCarePlan2(inst) + + js = inst.as_json() + self.assertEqual("CarePlan", js["resourceType"]) + inst2 = careplan.CarePlan(js) + self.implCarePlan2(inst2) + + def implCarePlan2(self, inst): + 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.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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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-obesity-narrative.json") + self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") + self.implCarePlan3(inst) + + js = inst.as_json() + self.assertEqual("CarePlan", js["resourceType"]) + inst2 = careplan.CarePlan(js) + self.implCarePlan3(inst2) + + def implCarePlan3(self, inst): + self.assertEqual(inst.id, "obesity-narrative") + 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.status, "active") + self.assertEqual(inst.text.status, "additional") + + def testCarePlan4(self): + inst = self.instantiate_from("careplan-example.json") + self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") + self.implCarePlan4(inst) + + js = inst.as_json() + self.assertEqual("CarePlan", js["resourceType"]) + inst2 = careplan.CarePlan(js) + self.implCarePlan4(inst2) + + def implCarePlan4(self, inst): + 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") + self.assertEqual(inst.activity[0].detail.dailyAmount.code, "258718000") + 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.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.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.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) + self.assertEqual(inst.period.start.as_json(), "2013-03-11") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + + def testCarePlan6(self): + inst = self.instantiate_from("careplan-example-GPVisit.json") + self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") + self.implCarePlan6(inst) + + js = inst.as_json() + self.assertEqual("CarePlan", js["resourceType"]) + inst2 = careplan.CarePlan(js) + self.implCarePlan6(inst2) + + def implCarePlan6(self, inst): + 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.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.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.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 testCarePlan7(self): + inst = self.instantiate_from("careplan-example-integrated.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.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.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.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.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.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.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.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.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") + self.assertEqual(inst.activity[3].progress[0].text, "Eve would like to try for 5 days a week.") + self.assertEqual(inst.activity[3].progress[0].time.date, FHIRDate("2012-08-27").date) + self.assertEqual(inst.activity[3].progress[0].time.as_json(), "2012-08-27") + 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.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.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") + self.assertEqual(inst.activity[4].progress[0].text, "Eve walked 4 times the last week.") + self.assertEqual(inst.activity[4].progress[0].time.date, FHIRDate("2012-08-13").date) + self.assertEqual(inst.activity[4].progress[0].time.as_json(), "2012-08-13") + 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.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.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.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.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") + self.assertEqual(inst.activity[6].progress[0].text, "After restarting the vinegar soaks the psoriasis is improved and Eve plans to treat the remainder with light treatments. She plans to start this week.") + self.assertEqual(inst.activity[6].progress[0].time.date, FHIRDate("2012-08-13").date) + self.assertEqual(inst.activity[6].progress[0].time.as_json(), "2012-08-13") + 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.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.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.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.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") + self.assertEqual(inst.activity[8].progress[0].text, "Will be able to esume exercise.") + self.assertEqual(inst.activity[8].progress[0].time.date, FHIRDate("2012-07-30").date) + self.assertEqual(inst.activity[8].progress[0].time.as_json(), "2012-07-30") + 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.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.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") + self.assertEqual(inst.contained[0].id, "p1") + self.assertEqual(inst.contained[1].id, "p2") + self.assertEqual(inst.contained[2].id, "p3") + self.assertEqual(inst.contained[3].id, "g1") + self.assertEqual(inst.contained[4].id, "g2") + self.assertEqual(inst.contained[5].id, "g3") + self.assertEqual(inst.contained[6].id, "g4") + 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-f001-heart.json") + self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") + self.implCarePlan9(inst) + + js = inst.as_json() + self.assertEqual("CarePlan", js["resourceType"]) + inst2 = careplan.CarePlan(js) + self.implCarePlan9(inst2) + + def implCarePlan9(self, inst): + 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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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") + self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") + self.implCarePlan10(inst) + + js = inst.as_json() + self.assertEqual("CarePlan", js["resourceType"]) + inst2 = careplan.CarePlan(js) + self.implCarePlan10(inst2) + + def implCarePlan10(self, inst): + 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.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) + self.assertEqual(inst.activity[1].detail.scheduledTiming.repeat.boundsPeriod.start.as_json(), "2013-02-14") + 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.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.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.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.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) + self.assertEqual(inst.activity[3].detail.scheduledTiming.repeat.boundsPeriod.start.as_json(), "2013-09-01") + self.assertEqual(inst.activity[3].detail.status, "not-started") + self.assertEqual(inst.contained[0].id, "p1") + self.assertEqual(inst.contained[1].id, "pr1") + self.assertEqual(inst.contained[2].id, "pr2") + self.assertEqual(inst.contained[3].id, "careteam") + self.assertEqual(inst.contained[4].id, "goal") + self.assertEqual(inst.extension[0].url, "http://example.org/fhir/StructureDefinition/careplan#lmp") + self.assertEqual(inst.extension[0].valueDateTime.date, FHIRDate("2013-01-01").date) + 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) + self.assertEqual(inst.period.start.as_json(), "2013-01-01") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "additional") + diff --git a/fhirclient/models/R4/careteam.py b/fhirclient/models/R4/careteam.py new file mode 100644 index 000000000..420643975 --- /dev/null +++ b/fhirclient/models/R4/careteam.py @@ -0,0 +1,174 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/CareTeam) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class CareTeam(domainresource.DomainResource): + """ Planned participants in the coordination and delivery of care for a patient + or group. + + The Care Team includes all the people and organizations who plan to + participate in the coordination and delivery of care for a patient. + """ + + resource_type = "CareTeam" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Type of team. + List of `CodeableConcept` items (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. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.managingOrganization = None + """ Organization responsible for the care team. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.name = None + """ Name of the team, such as crisis assessment team. + Type `str`. """ + + self.note = None + """ Comments made about the CareTeam. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.participant = None + """ Members of the team. + List of `CareTeamParticipant` items (represented as `dict` in JSON). """ + + self.period = None + """ Time period team covers. + Type `Period` (represented as `dict` in JSON). """ + + self.reasonCode = None + """ Why the care team exists. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.reasonReference = None + """ Why the care team exists. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.status = None + """ proposed | active | suspended | inactive | entered-in-error. + Type `str`. """ + + self.subject = None + """ Who care team is for. + 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) + + def elementProperties(self): + js = super(CareTeam, self).elementProperties() + js.extend([ + ("category", "category", codeableconcept.CodeableConcept, True, 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), + ("note", "note", annotation.Annotation, True, None, False), + ("participant", "participant", CareTeamParticipant, True, None, False), + ("period", "period", period.Period, False, None, False), + ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), + ("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 + + +from . import backboneelement + +class CareTeamParticipant(backboneelement.BackboneElement): + """ Members of the team. + + Identifies all people and organizations who are expected to be involved in + the care team. + """ + + resource_type = "CareTeamParticipant" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.member = None + """ Who is involved. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.onBehalfOf = None + """ Organization of the practitioner. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.period = None + """ Time period of participant. + Type `Period` (represented as `dict` in JSON). """ + + self.role = None + """ Type of involvement. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(CareTeamParticipant, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CareTeamParticipant, self).elementProperties() + js.extend([ + ("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, 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 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/R4/careteam_tests.py b/fhirclient/models/R4/careteam_tests.py new file mode 100644 index 000000000..1cdbd051b --- /dev/null +++ b/fhirclient/models/R4/careteam_tests.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import careteam +from .fhirdate import FHIRDate + + +class CareTeamTests(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("CareTeam", js["resourceType"]) + return careteam.CareTeam(js) + + def testCareTeam1(self): + inst = self.instantiate_from("careteam-example.json") + self.assertIsNotNone(inst, "Must have instantiated a CareTeam instance") + self.implCareTeam1(inst) + + js = inst.as_json() + self.assertEqual("CareTeam", js["resourceType"]) + inst2 = careteam.CareTeam(js) + self.implCareTeam1(inst2) + + def implCareTeam1(self, inst): + 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[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[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") + self.assertEqual(inst.text.div, "
Care Team
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/catalogentry.py b/fhirclient/models/R4/catalogentry.py similarity index 99% rename from fhirclient/models/catalogentry.py rename to fhirclient/models/R4/catalogentry.py index 78e7d56bd..ad27c0b32 100644 --- a/fhirclient/models/catalogentry.py +++ b/fhirclient/models/R4/catalogentry.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/CatalogEntry) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/CatalogEntry) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/catalogentry_tests.py b/fhirclient/models/R4/catalogentry_tests.py similarity index 94% rename from fhirclient/models/catalogentry_tests.py rename to fhirclient/models/R4/catalogentry_tests.py index dc949504f..e1239b15e 100644 --- a/fhirclient/models/catalogentry_tests.py +++ b/fhirclient/models/R4/catalogentry_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/R4/chargeitem.py b/fhirclient/models/R4/chargeitem.py new file mode 100644 index 000000000..cddd49c35 --- /dev/null +++ b/fhirclient/models/R4/chargeitem.py @@ -0,0 +1,260 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ChargeItem) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class ChargeItem(domainresource.DomainResource): + """ Item containing charge code(s) associated with the provision of healthcare + provider products. + + The resource ChargeItem describes the provision of healthcare provider + products for a certain patient, therefore referring not only to the + product, but containing in addition details of the provision, like date, + time, amounts and participating organizations and persons. Main Usage of + the ChargeItem is to enable the billing process and internal cost + allocation. + """ + + resource_type = "ChargeItem" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 to place this charge. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.bodysite = None + """ Anatomical location, if relevant. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.code = None + """ A code that identifies the charge, like a billing code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.context = None + """ Encounter / Episode associated with event. + Type `FHIRReference` (represented as `dict` in JSON). """ + + 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. """ + + self.enteredDate = None + """ Date the charge item was entered. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.enterer = None + """ Individual who was entering. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.factorOverride = None + """ Factor overriding the associated rules. + Type `float`. """ + + self.identifier = None + """ Business Identifier for item. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.note = None + """ Comments made about the ChargeItem. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.occurrenceDateTime = None + """ When the charged service was applied. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.occurrencePeriod = None + """ When the charged service was applied. + Type `Period` (represented as `dict` in JSON). """ + + self.occurrenceTiming = None + """ When the charged service was applied. + Type `Timing` (represented as `dict` in JSON). """ + + self.overrideReason = None + """ Reason for overriding the list price/factor. + Type `str`. """ + + self.partOf = None + """ Part of referenced ChargeItem. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.performer = None + """ Who performed charged service. + List of `ChargeItemPerformer` items (represented as `dict` in JSON). """ + + self.performingOrganization = None + """ 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). """ + + self.reason = None + """ Why was the charged service rendered?. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.requestingOrganization = None + """ Organization requesting the charged service. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.service = None + """ Which rendered service is being charged?. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.status = None + """ planned | billable | not-billable | aborted | billed | entered-in- + error | unknown. + Type `str`. """ + + self.subject = None + """ Individual service was done for/to. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.supportingInformation = None + """ Further information supporting this charge. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + super(ChargeItem, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ChargeItem, self).elementProperties() + js.extend([ + ("account", "account", fhirreference.FHIRReference, True, None, False), + ("bodysite", "bodysite", codeableconcept.CodeableConcept, True, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("context", "context", fhirreference.FHIRReference, False, 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, 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), + ("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), + ("service", "service", fhirreference.FHIRReference, True, None, False), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, True), + ("supportingInformation", "supportingInformation", fhirreference.FHIRReference, True, None, False), + ]) + return js + + +from . import backboneelement + +class ChargeItemPerformer(backboneelement.BackboneElement): + """ Who performed charged service. + + Indicates who or what performed or participated in the charged service. + """ + + resource_type = "ChargeItemPerformer" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 performing. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.function = None + """ What type of performance was done. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ChargeItemPerformer, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ChargeItemPerformer, 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: + 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'] +try: + from . import timing +except ImportError: + timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/R4/chargeitem_tests.py b/fhirclient/models/R4/chargeitem_tests.py new file mode 100644 index 000000000..7ab2efe70 --- /dev/null +++ b/fhirclient/models/R4/chargeitem_tests.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import chargeitem +from .fhirdate import FHIRDate + + +class ChargeItemTests(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("ChargeItem", js["resourceType"]) + return chargeitem.ChargeItem(js) + + def testChargeItem1(self): + inst = self.instantiate_from("chargeitem-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ChargeItem instance") + self.implChargeItem1(inst) + + js = inst.as_json() + self.assertEqual("ChargeItem", js["resourceType"]) + inst2 = chargeitem.ChargeItem(js) + self.implChargeItem1(inst2) + + 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.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[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") + self.assertEqual(inst.occurrencePeriod.end.date, FHIRDate("2017-01-25T12:35:00+01:00").date) + self.assertEqual(inst.occurrencePeriod.end.as_json(), "2017-01-25T12:35:00+01:00") + 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.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") + self.assertEqual(inst.reason[0].coding[0].display, "DIAG-1") + self.assertEqual(inst.reason[0].coding[0].system, "http://hl7.org/fhir/sid/icd-10") + self.assertEqual(inst.status, "billable") + self.assertEqual(inst.text.div, "
Example of ChargeItem Usage in Context of the German EBM Billing code system
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/chargeitemdefinition.py b/fhirclient/models/R4/chargeitemdefinition.py similarity index 99% rename from fhirclient/models/chargeitemdefinition.py rename to fhirclient/models/R4/chargeitemdefinition.py index 9385db328..565a036b7 100644 --- a/fhirclient/models/chargeitemdefinition.py +++ b/fhirclient/models/R4/chargeitemdefinition.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ChargeItemDefinition) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ChargeItemDefinition) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/chargeitemdefinition_tests.py b/fhirclient/models/R4/chargeitemdefinition_tests.py similarity index 98% rename from fhirclient/models/chargeitemdefinition_tests.py rename to fhirclient/models/R4/chargeitemdefinition_tests.py index 79ef9a423..822bf76a7 100644 --- a/fhirclient/models/chargeitemdefinition_tests.py +++ b/fhirclient/models/R4/chargeitemdefinition_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/R4/claim.py b/fhirclient/models/R4/claim.py new file mode 100644 index 000000000..b20e6d6db --- /dev/null +++ b/fhirclient/models/R4/claim.py @@ -0,0 +1,949 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Claim) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Claim(domainresource.DomainResource): + """ Claim, Pre-determination or Pre-authorization. + + 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.accident = None + """ Details of the event. + Type `ClaimAccident` (represented as `dict` in JSON). """ + + self.billablePeriod = None + """ Relevant time frame for the claim. + Type `Period` (represented as `dict` in JSON). """ + + self.careTeam = None + """ Members of the care team. + List of `ClaimCareTeam` items (represented as `dict` in JSON). """ + + self.created = None + """ Resource creation date. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.diagnosis = None + """ Pertinent diagnosis information. + List of `ClaimDiagnosis` items (represented as `dict` in JSON). """ + + self.enterer = None + """ Author of the claim. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.facility = None + """ Servicing facility. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.fundsReserve = None + """ For whom to reserve funds. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.identifier = None + """ Business Identifier for claim. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.insurance = None + """ Patient insurance information. + List of `ClaimInsurance` items (represented as `dict` in JSON). """ + + self.insurer = None + """ Target. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.item = None + """ Product or service provided. + List of `ClaimItem` items (represented as `dict` in JSON). """ + + self.originalPrescription = None + """ Original prescription if superseded by fulfiller. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.patient = None + """ The recipient of the products and services. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.payee = None + """ Recipient of benefits payable. + Type `ClaimPayee` (represented as `dict` in JSON). """ + + self.prescription = None + """ Prescription authorizing services and products. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.priority = None + """ Desired processing ugency. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.procedure = None + """ Clinical procedures performed. + List of `ClaimProcedure` items (represented as `dict` in JSON). """ + + self.provider = None + """ Party responsible for the claim. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.referral = None + """ Treatment referral. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.related = None + """ Prior or corollary claims. + List of `ClaimRelated` items (represented as `dict` in JSON). """ + + self.status = None + """ active | cancelled | draft | entered-in-error. + Type `str`. """ + + self.subType = None + """ 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 + """ Category or discipline. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.use = None + """ claim | preauthorization | predetermination. + Type `str`. """ + + super(Claim, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Claim, self).elementProperties() + js.extend([ + ("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, True), + ("diagnosis", "diagnosis", ClaimDiagnosis, True, None, False), + ("enterer", "enterer", fhirreference.FHIRReference, False, None, False), + ("facility", "facility", fhirreference.FHIRReference, False, None, False), + ("fundsReserve", "fundsReserve", codeableconcept.CodeableConcept, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("insurance", "insurance", ClaimInsurance, True, None, True), + ("insurer", "insurer", fhirreference.FHIRReference, False, None, False), + ("item", "item", ClaimItem, True, None, False), + ("originalPrescription", "originalPrescription", 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, True), + ("procedure", "procedure", ClaimProcedure, True, 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, 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, True), + ("use", "use", str, False, None, True), + ]) + return js + + +from . import backboneelement + +class ClaimAccident(backboneelement.BackboneElement): + """ Details of the event. + + Details of an accident which resulted in injuries which required the + products and services listed in the claim. + """ + + resource_type = "ClaimAccident" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ When the incident occurred. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.locationAddress = None + """ Where the event occurred. + Type `Address` (represented as `dict` in JSON). """ + + self.locationReference = None + """ Where the event occurred. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.type = None + """ The nature of the accident. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ClaimAccident, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimAccident, self).elementProperties() + js.extend([ + ("date", "date", fhirdate.FHIRDate, False, None, True), + ("locationAddress", "locationAddress", address.Address, False, "location", False), + ("locationReference", "locationReference", fhirreference.FHIRReference, False, "location", False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class ClaimCareTeam(backboneelement.BackboneElement): + """ Members of the care team. + + The members of the team who provided the products and services. + """ + + resource_type = "ClaimCareTeam" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.provider = None + """ Practitioner or organization. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.qualification = None + """ Practitioner credential or specialization. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.responsible = None + """ Indicator of the lead practitioner. + Type `bool`. """ + + self.role = None + """ Function within the team. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.sequence = None + """ Order of care team. + Type `int`. """ + + super(ClaimCareTeam, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimCareTeam, self).elementProperties() + js.extend([ + ("provider", "provider", fhirreference.FHIRReference, False, None, True), + ("qualification", "qualification", codeableconcept.CodeableConcept, False, None, False), + ("responsible", "responsible", bool, False, None, False), + ("role", "role", codeableconcept.CodeableConcept, False, None, False), + ("sequence", "sequence", int, False, None, True), + ]) + return js + + +class ClaimDiagnosis(backboneelement.BackboneElement): + """ Pertinent diagnosis information. + + Information about diagnoses relevant to the claim items. + """ + + resource_type = "ClaimDiagnosis" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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). """ + + 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 + """ Diagnosis instance identifier. + Type `int`. """ + + self.type = None + """ Timing or nature of the diagnosis. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(ClaimDiagnosis, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimDiagnosis, self).elementProperties() + 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), + ]) + return js + + +class ClaimInsurance(backboneelement.BackboneElement): + """ Patient insurance information. + + Financial instruments for reimbursement for the health care products and + services specified on the claim. + """ + + resource_type = "ClaimInsurance" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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.claimResponse = None + """ Adjudication results. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.coverage = None + """ Insurance information. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.focal = None + """ 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 + """ Prior authorization reference number. + List of `str` items. """ + + self.sequence = None + """ Insurance instance identifier. + Type `int`. """ + + super(ClaimInsurance, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimInsurance, self).elementProperties() + js.extend([ + ("businessArrangement", "businessArrangement", str, False, None, False), + ("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), + ]) + return js + + +class ClaimItem(backboneelement.BackboneElement): + """ Product or service provided. + + 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.bodySite = None + """ Anatomical location. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.careTeamSequence = None + """ Applicable careTeam members. + List of `int` items. """ + + self.category = None + """ Benefit classification. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.detail = None + """ Product or service provided. + List of `ClaimItemDetail` items (represented as `dict` in JSON). """ + + self.diagnosisSequence = None + """ Applicable diagnoses. + List of `int` items. """ + + self.encounter = None + """ Encounters related to this billed item. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.factor = None + """ Price scaling factor. + Type `float`. """ + + self.informationSequence = None + """ Applicable exception and supporting information. + 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 + """ 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.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 the product or service is provided under. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.quantity = None + """ Count of products or services. + Type `Quantity` (represented as `dict` in JSON). """ + + self.revenue = None + """ Revenue or cost center code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.sequence = None + """ Item instance identifier. + Type `int`. """ + + 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.udi = None + """ Unique device identifier. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.unitPrice = None + """ Fee, charge or cost per item. + Type `Money` (represented as `dict` in JSON). """ + + super(ClaimItem, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimItem, self).elementProperties() + js.extend([ + ("bodySite", "bodySite", codeableconcept.CodeableConcept, False, None, False), + ("careTeamSequence", "careTeamSequence", int, True, None, False), + ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("detail", "detail", ClaimItemDetail, True, None, False), + ("diagnosisSequence", "diagnosisSequence", int, True, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, True, None, False), + ("factor", "factor", float, False, 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), + ("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), + ("servicedDate", "servicedDate", fhirdate.FHIRDate, False, "serviced", False), + ("servicedPeriod", "servicedPeriod", period.Period, False, "serviced", False), + ("subSite", "subSite", codeableconcept.CodeableConcept, True, None, False), + ("udi", "udi", fhirreference.FHIRReference, True, None, False), + ("unitPrice", "unitPrice", money.Money, False, None, False), + ]) + return js + + +class ClaimItemDetail(backboneelement.BackboneElement): + """ Product or service provided. + + A claim detail line. Either a simple (a product or service) or a 'group' of + sub-details which are simple items. + """ + + resource_type = "ClaimItemDetail" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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.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.productOrService = None + """ Billing, service, product, or drug code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.programCode = None + """ 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. + Type `Quantity` (represented as `dict` in JSON). """ + + self.revenue = None + """ Revenue or cost center code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.sequence = None + """ Item instance identifier. + Type `int`. """ + + self.subDetail = None + """ Product or service provided. + List of `ClaimItemDetailSubDetail` items (represented as `dict` in JSON). """ + + self.udi = None + """ Unique device identifier. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.unitPrice = None + """ Fee, charge or cost per item. + Type `Money` (represented as `dict` in JSON). """ + + super(ClaimItemDetail, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimItemDetail, self).elementProperties() + js.extend([ + ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("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), + ("subDetail", "subDetail", ClaimItemDetailSubDetail, True, None, False), + ("udi", "udi", fhirreference.FHIRReference, True, None, False), + ("unitPrice", "unitPrice", money.Money, False, None, False), + ]) + return js + + +class ClaimItemDetailSubDetail(backboneelement.BackboneElement): + """ Product or service provided. + + A claim detail line. Either a simple (a product or service) or a 'group' of + sub-details which are simple items. + """ + + resource_type = "ClaimItemDetailSubDetail" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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.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.productOrService = None + """ Billing, service, product, or drug code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.programCode = None + """ 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. + Type `Quantity` (represented as `dict` in JSON). """ + + self.revenue = None + """ Revenue or cost center code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.sequence = None + """ Item instance identifier. + Type `int`. """ + + self.udi = None + """ Unique device identifier. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.unitPrice = None + """ Fee, charge or cost per item. + Type `Money` (represented as `dict` in JSON). """ + + super(ClaimItemDetailSubDetail, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimItemDetailSubDetail, self).elementProperties() + js.extend([ + ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("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), + ("udi", "udi", fhirreference.FHIRReference, True, None, False), + ("unitPrice", "unitPrice", money.Money, False, None, False), + ]) + return js + + +class ClaimPayee(backboneelement.BackboneElement): + """ Recipient of benefits payable. + + The party to be reimbursed for cost of the products and services according + to the terms of the policy. + """ + + resource_type = "ClaimPayee" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.party = None + """ Recipient reference. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.type = None + """ Category of recipient. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ClaimPayee, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimPayee, self).elementProperties() + js.extend([ + ("party", "party", fhirreference.FHIRReference, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +class ClaimProcedure(backboneelement.BackboneElement): + """ Clinical procedures performed. + + Procedures performed on the patient relevant to the billing items with the + claim. + """ + + resource_type = "ClaimProcedure" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ When the procedure was performed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.procedureCodeableConcept = None + """ Specific clinical procedure. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.procedureReference = None + """ Specific clinical procedure. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.sequence = None + """ 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): + js = super(ClaimProcedure, self).elementProperties() + js.extend([ + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("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): + """ Prior or corollary claims. + + 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.claim = None + """ Reference to the related claim. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.reference = None + """ File or case reference. + Type `Identifier` (represented as `dict` in JSON). """ + + self.relationship = None + """ How the reference claim is related. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ClaimRelated, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimRelated, self).elementProperties() + js.extend([ + ("claim", "claim", fhirreference.FHIRReference, False, None, False), + ("reference", "reference", identifier.Identifier, False, None, False), + ("relationship", "relationship", codeableconcept.CodeableConcept, False, None, False), + ]) + 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 +except ImportError: + address = sys.modules[__package__ + '.address'] +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 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/R4/claim_tests.py b/fhirclient/models/R4/claim_tests.py new file mode 100644 index 000000000..c81c27aaf --- /dev/null +++ b/fhirclient/models/R4/claim_tests.py @@ -0,0 +1,777 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import claim +from .fhirdate import FHIRDate + + +class ClaimTests(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("Claim", js["resourceType"]) + return claim.Claim(js) + + def testClaim1(self): + inst = self.instantiate_from("claim-example-institutional-rich.json") + self.assertIsNotNone(inst, "Must have instantiated a Claim instance") + self.implClaim1(inst) + + js = inst.as_json() + self.assertEqual("Claim", js["resourceType"]) + inst2 = claim.Claim(js) + self.implClaim1(inst2) + + def implClaim1(self, inst): + self.assertEqual(inst.accident.date.date, FHIRDate("2014-07-09").date) + self.assertEqual(inst.accident.date.as_json(), "2014-07-09") + 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://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://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://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://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://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") + self.assertEqual(inst.insurance[0].businessArrangement, "BA987123") + 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].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].servicedDate.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.item[0].servicedDate.as_json(), "2014-08-16") + 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.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 testClaim2(self): + inst = self.instantiate_from("claim-example-professional.json") + self.assertIsNotNone(inst, "Must have instantiated a Claim instance") + self.implClaim2(inst) + + js = inst.as_json() + self.assertEqual("Claim", js["resourceType"]) + inst2 = claim.Claim(js) + self.implClaim2(inst2) + + def implClaim2(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, "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].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].servicedDate.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.item[0].servicedDate.as_json(), "2014-08-16") + 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.text.div, "
A human-readable rendering of the Claim
") + self.assertEqual(inst.text.status, "generated") + 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.json") + self.assertIsNotNone(inst, "Must have instantiated a Claim instance") + self.implClaim3(inst) + + js = inst.as_json() + self.assertEqual("Claim", js["resourceType"]) + inst2 = claim.Claim(js) + self.implClaim3(inst2) + + def implClaim3(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, "123456") + self.assertEqual(inst.diagnosis[0].sequence, 1) + self.assertEqual(inst.id, "100150") + self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/claim") + 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].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].servicedDate.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.item[0].servicedDate.as_json(), "2014-08-16") + 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, "
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://terminology.hl7.org/CodeSystem/claim-type") + self.assertEqual(inst.use, "claim") + + def testClaim4(self): + inst = self.instantiate_from("claim-example-vision.json") + self.assertIsNotNone(inst, "Must have instantiated a Claim instance") + self.implClaim4(inst) + + js = inst.as_json() + self.assertEqual("Claim", js["resourceType"]) + inst2 = claim.Claim(js) + self.implClaim4(inst2) + + def implClaim4(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, "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].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].servicedDate.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.item[0].servicedDate.as_json(), "2014-08-16") + 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.status, "active") + self.assertEqual(inst.text.div, "
A human-readable rendering of the Vision Claim
") + self.assertEqual(inst.text.status, "generated") + 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-vision-glasses-3tier.json") + self.assertIsNotNone(inst, "Must have instantiated a Claim instance") + self.implClaim5(inst) + + js = inst.as_json() + self.assertEqual("Claim", js["resourceType"]) + inst2 = claim.Claim(js) + self.implClaim5(inst2) + + def implClaim5(self, inst): + self.assertEqual(inst.careTeam[0].sequence, 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, "654321") + self.assertEqual(inst.diagnosis[0].sequence, 1) + 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.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].servicedDate.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.item[0].servicedDate.as_json(), "2014-08-16") + 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, "
A human-readable rendering of the Vision Claim for Glasses
") + self.assertEqual(inst.text.status, "generated") + 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-institutional.json") + self.assertIsNotNone(inst, "Must have instantiated a Claim instance") + self.implClaim6(inst) + + js = inst.as_json() + self.assertEqual("Claim", js["resourceType"]) + inst2 = claim.Claim(js) + self.implClaim6(inst2) + + def implClaim6(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, "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].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].servicedDate.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.item[0].servicedDate.as_json(), "2014-08-16") + 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.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.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-contained.json") + self.assertIsNotNone(inst, "Must have instantiated a Claim instance") + self.implClaim7(inst) + + js = inst.as_json() + self.assertEqual("Claim", js["resourceType"]) + inst2 = claim.Claim(js) + self.implClaim7(inst2) + + 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, "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].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].servicedDate.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.item[0].servicedDate.as_json(), "2014-08-16") + 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, "
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://terminology.hl7.org/CodeSystem/claim-type") + self.assertEqual(inst.use, "claim") + + def testClaim8(self): + inst = self.instantiate_from("claim-example-pharmacy-medication.json") + self.assertIsNotNone(inst, "Must have instantiated a Claim instance") + self.implClaim8(inst) + + js = inst.as_json() + self.assertEqual("Claim", js["resourceType"]) + inst2 = claim.Claim(js) + 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") + self.assertEqual(inst.diagnosis[0].diagnosisCodeableConcept.coding[0].code, "123457") + 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.fundsReserve.coding[0].code, "provider") + self.assertEqual(inst.id, "100153") + self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/claim") + 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].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].unitPrice.currency, "USD") + self.assertEqual(inst.item[0].detail[0].unitPrice.value, 1000.0) + 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].unitPrice.currency, "USD") + self.assertEqual(inst.item[0].detail[1].unitPrice.value, 1500.0) + 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].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[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].unitPrice.currency, "USD") + self.assertEqual(inst.item[0].detail[4].unitPrice.value, 250.0) + 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].servicedDate.date, FHIRDate("2015-05-16").date) + self.assertEqual(inst.item[0].servicedDate.as_json(), "2015-05-16") + 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].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].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.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].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].unitPrice.currency, "USD") + self.assertEqual(inst.item[2].detail[0].unitPrice.value, 750.0) + 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].unitPrice.currency, "USD") + self.assertEqual(inst.item[2].detail[1].unitPrice.value, 350.0) + 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].servicedDate.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.item[2].servicedDate.as_json(), "2014-08-16") + 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://terminology.hl7.org/CodeSystem/claim-type") + self.assertEqual(inst.use, "preauthorization") + + def testClaim10(self): + inst = self.instantiate_from("claim-example-cms1500-medical.json") + self.assertIsNotNone(inst, "Must have instantiated a Claim instance") + self.implClaim10(inst) + + js = inst.as_json() + self.assertEqual("Claim", js["resourceType"]) + inst2 = claim.Claim(js) + self.implClaim10(inst2) + + def implClaim10(self, inst): + self.assertEqual(inst.careTeam[0].sequence, 1) + 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.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].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].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.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.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.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/R4/claimresponse.py b/fhirclient/models/R4/claimresponse.py new file mode 100644 index 000000000..2492b14a4 --- /dev/null +++ b/fhirclient/models/R4/claimresponse.py @@ -0,0 +1,886 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ClaimResponse) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class ClaimResponse(domainresource.DomainResource): + """ Response to a claim predetermination or preauthorization. + + This resource provides the adjudication details from the processing of a + Claim resource. + """ + + resource_type = "ClaimResponse" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.addItem = None + """ 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 (represented as `dict` in JSON). """ + + self.created = None + """ Response creation date. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.disposition = None + """ Disposition Message. + Type `str`. """ + + self.error = None + """ Processing errors. + List of `ClaimResponseError` items (represented as `dict` in JSON). """ + + self.form = None + """ 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 + """ Business Identifier for a claim response. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.insurance = None + """ Patient insurance information. + List of `ClaimResponseInsurance` items (represented as `dict` in JSON). """ + + self.insurer = None + """ Party responsible for reimbursement. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.item = None + """ Adjudication for claim line items. + List of `ClaimResponseItem` items (represented as `dict` in JSON). """ + + self.outcome = None + """ queued | complete | error | partial. + Type `str`. """ + + self.patient = None + """ 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. + 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 + """ Note concerning adjudication. + List of `ClaimResponseProcessNote` items (represented as `dict` in JSON). """ + + self.request = None + """ Id of resource triggering adjudication. + Type `FHIRReference` (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.subType = None + """ More granular claim type. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.total = None + """ Adjudication totals. + List of `ClaimResponseTotal` items (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) + + 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, True), + ("disposition", "disposition", str, False, None, False), + ("error", "error", ClaimResponseError, True, 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, True), + ("item", "item", ClaimResponseItem, True, 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), + ("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 + + +from . import backboneelement + +class ClaimResponseAddItem(backboneelement.BackboneElement): + """ Insurer added line items. + + The first-tier service adjudications for payor added product or service + lines. + """ + + resource_type = "ClaimResponseAddItem" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 `ClaimResponseItemAdjudication` items (represented as `dict` in JSON). """ + + self.bodySite = None + """ Anatomical location. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.detail = None + """ Insurer added line details. + List of `ClaimResponseAddItemDetail` items (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 + """ 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 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.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, True), + ("bodySite", "bodySite", codeableconcept.CodeableConcept, False, None, False), + ("detail", "detail", ClaimResponseAddItemDetail, True, 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), + ("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): + """ Insurer added line details. + + The second-tier service adjudications for payor added services. + """ + + resource_type = "ClaimResponseAddItemDetail" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Applicable note numbers. + List of `int` items. """ + + self.productOrService = None + """ Billing, service, product, or drug code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + 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 + """ Applicable note numbers. + List of `int` items. """ + + self.productOrService = None + """ Billing, service, product, or drug code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.quantity = None + """ Count of products or services. + Type `Quantity` (represented as `dict` in JSON). """ + + 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(ClaimResponseAddItemDetailSubDetail, 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), + ("unitPrice", "unitPrice", money.Money, False, None, False), + ]) + return js + + +class ClaimResponseError(backboneelement.BackboneElement): + """ Processing errors. + + Errors encountered during the processing of the adjudication. + """ + + resource_type = "ClaimResponseError" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Error code detailing processing issues. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.detailSequence = None + """ Detail sequence number. + Type `int`. """ + + self.itemSequence = None + """ Item sequence number. + Type `int`. """ + + self.subDetailSequence = None + """ Subdetail sequence number. + Type `int`. """ + + super(ClaimResponseError, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimResponseError, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("detailSequence", "detailSequence", int, False, None, False), + ("itemSequence", "itemSequence", int, False, None, False), + ("subDetailSequence", "subDetailSequence", int, False, None, False), + ]) + return js + + +class ClaimResponseInsurance(backboneelement.BackboneElement): + """ Patient insurance information. + + Financial instruments for reimbursement for the health care products and + services specified on the claim. + """ + + resource_type = "ClaimResponseInsurance" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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.claimResponse = None + """ Adjudication results. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.coverage = None + """ Insurance information. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.focal = None + """ Coverage to be used for adjudication. + Type `bool`. """ + + self.sequence = None + """ Insurance instance identifier. + Type `int`. """ + + super(ClaimResponseInsurance, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimResponseInsurance, self).elementProperties() + js.extend([ + ("businessArrangement", "businessArrangement", str, False, None, False), + ("claimResponse", "claimResponse", fhirreference.FHIRReference, False, None, False), + ("coverage", "coverage", fhirreference.FHIRReference, False, None, True), + ("focal", "focal", bool, False, None, True), + ("sequence", "sequence", int, False, None, True), + ]) + return js + + +class ClaimResponseItem(backboneelement.BackboneElement): + """ Adjudication for claim line items. + + 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Adjudication details. + List of `ClaimResponseItemAdjudication` items (represented as `dict` in JSON). """ + + self.detail = None + """ 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 + """ Applicable note numbers. + List of `int` items. """ + + super(ClaimResponseItem, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimResponseItem, self).elementProperties() + js.extend([ + ("adjudication", "adjudication", ClaimResponseItemAdjudication, True, None, True), + ("detail", "detail", ClaimResponseItemDetail, True, None, False), + ("itemSequence", "itemSequence", int, False, None, True), + ("noteNumber", "noteNumber", int, True, None, False), + ]) + return js + + +class ClaimResponseItemAdjudication(backboneelement.BackboneElement): + """ Adjudication details. + + 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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. + Type `Money` (represented as `dict` in JSON). """ + + self.category = None + """ Type of adjudication information. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.reason = None + """ Explanation of adjudication outcome. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.value = None + """ Non-monetary value. + Type `float`. """ + + super(ClaimResponseItemAdjudication, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimResponseItemAdjudication, self).elementProperties() + js.extend([ + ("amount", "amount", money.Money, False, None, False), + ("category", "category", codeableconcept.CodeableConcept, False, None, True), + ("reason", "reason", codeableconcept.CodeableConcept, False, None, False), + ("value", "value", float, False, None, False), + ]) + return js + + +class ClaimResponseItemDetail(backboneelement.BackboneElement): + """ Adjudication for claim details. + + A claim detail. Either a simple (a product or service) or a 'group' of sub- + details which are simple items. + """ + + resource_type = "ClaimResponseItemDetail" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ 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 + """ Applicable note numbers. + List of `int` items. """ + + self.subDetail = None + """ Adjudication for claim sub-details. + List of `ClaimResponseItemDetailSubDetail` items (represented as `dict` in JSON). """ + + super(ClaimResponseItemDetail, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimResponseItemDetail, self).elementProperties() + js.extend([ + ("adjudication", "adjudication", ClaimResponseItemAdjudication, True, None, True), + ("detailSequence", "detailSequence", int, False, None, True), + ("noteNumber", "noteNumber", int, True, None, False), + ("subDetail", "subDetail", ClaimResponseItemDetailSubDetail, True, None, False), + ]) + return js + + +class ClaimResponseItemDetailSubDetail(backboneelement.BackboneElement): + """ Adjudication for claim sub-details. + + A sub-detail adjudication of a simple product or service. + """ + + resource_type = "ClaimResponseItemDetailSubDetail" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Subdetail level adjudication details. + List of `ClaimResponseItemAdjudication` items (represented as `dict` in JSON). """ + + self.noteNumber = None + """ Applicable note numbers. + List of `int` items. """ + + self.subDetailSequence = None + """ Claim sub-detail instance identifier. + Type `int`. """ + + super(ClaimResponseItemDetailSubDetail, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimResponseItemDetailSubDetail, self).elementProperties() + js.extend([ + ("adjudication", "adjudication", ClaimResponseItemAdjudication, True, None, False), + ("noteNumber", "noteNumber", int, True, None, False), + ("subDetailSequence", "subDetailSequence", int, False, None, True), + ]) + return js + + +class ClaimResponsePayment(backboneelement.BackboneElement): + """ Payment Details. + + Payment details for the adjudication of the claim. + """ + + resource_type = "ClaimResponsePayment" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.adjustment = None + """ Payment adjustment for non-claim issues. + Type `Money` (represented as `dict` in JSON). """ + + self.adjustmentReason = None + """ Explanation for the adjustment. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.amount = None + """ Payable amount after adjustment. + Type `Money` (represented as `dict` in JSON). """ + + self.date = None + """ Expected date of payment. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.identifier = None + """ Business identifier for the payment. + Type `Identifier` (represented as `dict` in JSON). """ + + self.type = None + """ Partial or complete payment. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ClaimResponsePayment, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimResponsePayment, self).elementProperties() + js.extend([ + ("adjustment", "adjustment", money.Money, False, None, False), + ("adjustmentReason", "adjustmentReason", codeableconcept.CodeableConcept, 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, True), + ]) + return js + + +class ClaimResponseProcessNote(backboneelement.BackboneElement): + """ Note concerning adjudication. + + A note that describes or explains adjudication results in a human readable + form. + """ + + resource_type = "ClaimResponseProcessNote" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Language of the text. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.number = None + """ Note instance identifier. + Type `int`. """ + + self.text = None + """ Note explanatory text. + Type `str`. """ + + self.type = None + """ display | print | printoper. + Type `str`. """ + + super(ClaimResponseProcessNote, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimResponseProcessNote, self).elementProperties() + js.extend([ + ("language", "language", codeableconcept.CodeableConcept, False, None, False), + ("number", "number", int, 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 address +except ImportError: + address = sys.modules[__package__ + '.address'] +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 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/R4/claimresponse_tests.py b/fhirclient/models/R4/claimresponse_tests.py new file mode 100644 index 000000000..158f06cfc --- /dev/null +++ b/fhirclient/models/R4/claimresponse_tests.py @@ -0,0 +1,474 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import claimresponse +from .fhirdate import FHIRDate + + +class ClaimResponseTests(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("ClaimResponse", js["resourceType"]) + return claimresponse.ClaimResponse(js) + + def testClaimResponse1(self): + inst = self.instantiate_from("claimresponse-example-unsolicited-preauth.json") + self.assertIsNotNone(inst, "Must have instantiated a ClaimResponse instance") + self.implClaimResponse1(inst) + + js = inst.as_json() + self.assertEqual("ClaimResponse", js["resourceType"]) + inst2 = claimresponse.ClaimResponse(js) + 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.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.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.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].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://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://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.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/R4/clinicalimpression.py b/fhirclient/models/R4/clinicalimpression.py new file mode 100644 index 000000000..e787d52ff --- /dev/null +++ b/fhirclient/models/R4/clinicalimpression.py @@ -0,0 +1,253 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ClinicalImpression) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class ClinicalImpression(domainresource.DomainResource): + """ A clinical assessment performed when planning treatments and management + strategies for a patient. + + A record of a clinical assessment performed to determine what problem(s) + may affect the patient and before planning the treatments or management + strategies that are best to manage a patient's condition. Assessments are + often 1:1 with a clinical consultation / encounter, but this varies + greatly depending on the clinical workflow. This resource is called + "ClinicalImpression" rather than "ClinicalAssessment" to avoid confusion + with the recording of assessment tools such as Apgar score. + """ + + resource_type = "ClinicalImpression" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.assessor = None + """ The clinician performing the assessment. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.code = None + """ Kind of assessment performed. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.date = None + """ When the assessment was documented. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Why/how the assessment was performed. + Type `str`. """ + + self.effectiveDateTime = None + """ Time of assessment. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.effectivePeriod = None + """ 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). """ + + self.identifier = None + """ Business identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.investigation = None + """ One or more sets of investigations (signs, symptoms, etc.). + List of `ClinicalImpressionInvestigation` items (represented as `dict` in JSON). """ + + self.note = None + """ Comments made about the ClinicalImpression. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.previous = None + """ Reference to last assessment. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.problem = None + """ Relevant impressions of patient state. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.prognosisCodeableConcept = None + """ Estimate of likely outcome. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.prognosisReference = None + """ RiskAssessment expressing likely outcome. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.protocol = None + """ Clinical Protocol followed. + List of `str` items. """ + + self.status = None + """ 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` (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([ + ("assessor", "assessor", fhirreference.FHIRReference, False, None, False), + ("code", "code", codeableconcept.CodeableConcept, 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), + ("note", "note", annotation.Annotation, True, None, False), + ("previous", "previous", fhirreference.FHIRReference, False, None, False), + ("problem", "problem", fhirreference.FHIRReference, True, None, False), + ("prognosisCodeableConcept", "prognosisCodeableConcept", codeableconcept.CodeableConcept, True, None, False), + ("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 + + +from . import backboneelement + +class ClinicalImpressionFinding(backboneelement.BackboneElement): + """ Possible or likely findings and diagnoses. + + Specific findings or diagnoses that were considered likely or relevant to + ongoing treatment. + """ + + resource_type = "ClinicalImpressionFinding" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.basis = None + """ Which investigations support finding. + Type `str`. """ + + self.itemCodeableConcept = None + """ What was found. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.itemReference = None + """ What was found. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(ClinicalImpressionFinding, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClinicalImpressionFinding, self).elementProperties() + js.extend([ + ("basis", "basis", str, False, None, False), + ("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, symptoms, etc.). + + 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. + """ + + resource_type = "ClinicalImpressionInvestigation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 name/code for the set. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.item = None + """ Record of a specific investigation. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + super(ClinicalImpressionInvestigation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClinicalImpressionInvestigation, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("item", "item", fhirreference.FHIRReference, 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 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/R4/clinicalimpression_tests.py b/fhirclient/models/R4/clinicalimpression_tests.py new file mode 100644 index 000000000..0f0db644b --- /dev/null +++ b/fhirclient/models/R4/clinicalimpression_tests.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import clinicalimpression +from .fhirdate import FHIRDate + + +class ClinicalImpressionTests(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("ClinicalImpression", js["resourceType"]) + return clinicalimpression.ClinicalImpression(js) + + def testClinicalImpression1(self): + inst = self.instantiate_from("clinicalimpression-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ClinicalImpression instance") + self.implClinicalImpression1(inst) + + js = inst.as_json() + self.assertEqual("ClinicalImpression", js["resourceType"]) + inst2 = clinicalimpression.ClinicalImpression(js) + self.implClinicalImpression1(inst2) + + def implClinicalImpression1(self, inst): + self.assertEqual(inst.date.date, FHIRDate("2014-12-06T22:33:00+11:00").date) + self.assertEqual(inst.date.as_json(), "2014-12-06T22:33:00+11:00") + self.assertEqual(inst.description, "This 26 yo male patient is brought into ER by ambulance after being involved in a motor vehicle accident") + self.assertEqual(inst.effectivePeriod.end.date, FHIRDate("2014-12-06T22:33:00+11:00").date) + self.assertEqual(inst.effectivePeriod.end.as_json(), "2014-12-06T22:33:00+11:00") + self.assertEqual(inst.effectivePeriod.start.date, FHIRDate("2014-12-06T20:00:00+11:00").date) + self.assertEqual(inst.effectivePeriod.start.as_json(), "2014-12-06T20:00:00+11:00") + self.assertEqual(inst.finding[0].itemCodeableConcept.coding[0].code, "850.0") + self.assertEqual(inst.finding[0].itemCodeableConcept.coding[0].system, "http://hl7.org/fhir/sid/icd-9") + 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/R4/codeableconcept.py b/fhirclient/models/R4/codeableconcept.py new file mode 100644 index 000000000..b30235a28 --- /dev/null +++ b/fhirclient/models/R4/codeableconcept.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/CodeableConcept) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class CodeableConcept(element.Element): + """ Concept - reference to a terminology or just text. + + A concept that may be defined by a formal reference to a terminology or + ontology or may be provided by text. + """ + + resource_type = "CodeableConcept" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.coding = None + """ Code defined by a terminology system. + List of `Coding` items (represented as `dict` in JSON). """ + + self.text = None + """ Plain text representation of the concept. + Type `str`. """ + + super(CodeableConcept, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CodeableConcept, self).elementProperties() + js.extend([ + ("coding", "coding", coding.Coding, True, None, False), + ("text", "text", str, False, None, False), + ]) + return js + + +import sys +try: + from . import coding +except ImportError: + coding = sys.modules[__package__ + '.coding'] diff --git a/fhirclient/models/R4/codesystem.py b/fhirclient/models/R4/codesystem.py new file mode 100644 index 000000000..464c373f1 --- /dev/null +++ b/fhirclient/models/R4/codesystem.py @@ -0,0 +1,452 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/CodeSystem) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class CodeSystem(domainresource.DomainResource): + """ Declares the existence of and describes a code system or code system + supplement. + + 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.caseSensitive = None + """ If code comparison is case sensitive. + Type `bool`. """ + + self.compositional = None + """ If code system defines a compositional grammar. + Type `bool`. """ + + self.concept = None + """ Concepts in the code system. + List of `CodeSystemConcept` items (represented as `dict` in JSON). """ + + self.contact = None + """ Contact details for the publisher. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.content = None + """ not-present | example | fragment | complete | supplement. + Type `str`. """ + + self.copyright = None + """ Use and/or publishing restrictions. + Type `str`. """ + + self.count = None + """ Total concepts in the code system. + Type `int`. """ + + self.date = None + """ Date last changed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Natural language description of the code system. + Type `str`. """ + + self.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.filter = None + """ Filter that can be used in a value set. + List of `CodeSystemFilter` items (represented as `dict` in JSON). """ + + self.hierarchyMeaning = None + """ grouped-by | is-a | part-of | classified-with. + Type `str`. """ + + self.identifier = None + """ 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). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.name = None + """ Name for this code system (computer friendly). + Type `str`. """ + + self.property = None + """ Additional information supplied about each concept. + List of `CodeSystemProperty` items (represented as `dict` in JSON). """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this code system is defined. + Type `str`. """ + + self.status = None + """ 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 + """ Canonical identifier for this code system, represented as a URI + (globally unique) (Coding.system). + Type `str`. """ + + self.useContext = None + """ The context that the content is intended to support. + List of `UsageContext` items (represented as `dict` in JSON). """ + + self.valueSet = None + """ Canonical reference to the value set with entire code system. + Type `str`. """ + + self.version = None + """ Business version of the code system (Coding.version). + Type `str`. """ + + self.versionNeeded = None + """ If definitions are not stable. + Type `bool`. """ + + super(CodeSystem, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CodeSystem, self).elementProperties() + js.extend([ + ("caseSensitive", "caseSensitive", bool, False, None, False), + ("compositional", "compositional", bool, False, None, False), + ("concept", "concept", CodeSystemConcept, True, None, False), + ("contact", "contact", contactdetail.ContactDetail, True, None, False), + ("content", "content", str, False, None, True), + ("copyright", "copyright", str, False, None, False), + ("count", "count", int, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("description", "description", str, False, None, False), + ("experimental", "experimental", bool, False, None, False), + ("filter", "filter", CodeSystemFilter, True, None, False), + ("hierarchyMeaning", "hierarchyMeaning", str, 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), + ("valueSet", "valueSet", str, False, None, False), + ("version", "version", str, False, None, False), + ("versionNeeded", "versionNeeded", bool, False, None, False), + ]) + return js + + +from . import backboneelement + +class CodeSystemConcept(backboneelement.BackboneElement): + """ Concepts in the code system. + + Concepts that are in the code system. The concept definitions are + inherently hierarchical, but the definitions must be consulted to determine + what the meanings of the hierarchical relationships are. + """ + + resource_type = "CodeSystemConcept" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 that identifies concept. + Type `str`. """ + + self.concept = None + """ Child Concepts (is-a/contains/categorizes). + List of `CodeSystemConcept` items (represented as `dict` in JSON). """ + + self.definition = None + """ Formal definition. + Type `str`. """ + + self.designation = None + """ Additional representations for the concept. + List of `CodeSystemConceptDesignation` items (represented as `dict` in JSON). """ + + self.display = None + """ Text to display to the user. + Type `str`. """ + + self.property = None + """ Property value for the concept. + List of `CodeSystemConceptProperty` items (represented as `dict` in JSON). """ + + super(CodeSystemConcept, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CodeSystemConcept, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("concept", "concept", CodeSystemConcept, True, None, False), + ("definition", "definition", str, False, None, False), + ("designation", "designation", CodeSystemConceptDesignation, True, None, False), + ("display", "display", str, False, None, False), + ("property", "property", CodeSystemConceptProperty, True, None, False), + ]) + return js + + +class CodeSystemConceptDesignation(backboneelement.BackboneElement): + """ Additional representations for the concept. + + Additional representations for the concept - other languages, aliases, + specialized purposes, used for particular purposes, etc. + """ + + resource_type = "CodeSystemConceptDesignation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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. + Type `str`. """ + + self.use = None + """ Details how this designation would be used. + Type `Coding` (represented as `dict` in JSON). """ + + self.value = None + """ The text value for this designation. + Type `str`. """ + + super(CodeSystemConceptDesignation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CodeSystemConceptDesignation, self).elementProperties() + js.extend([ + ("language", "language", str, False, None, False), + ("use", "use", coding.Coding, False, None, False), + ("value", "value", str, False, None, True), + ]) + return js + + +class CodeSystemConceptProperty(backboneelement.BackboneElement): + """ Property value for the concept. + + A property value for this concept. + """ + + resource_type = "CodeSystemConceptProperty" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Reference to CodeSystem.property.code. + Type `str`. """ + + self.valueBoolean = None + """ Value of the property for this concept. + Type `bool`. """ + + self.valueCode = None + """ Value of the property for this concept. + Type `str`. """ + + self.valueCoding = None + """ Value of the property for this concept. + Type `Coding` (represented as `dict` in JSON). """ + + self.valueDateTime = None + """ 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`. """ + + self.valueString = None + """ Value of the property for this concept. + Type `str`. """ + + super(CodeSystemConceptProperty, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CodeSystemConceptProperty, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("valueBoolean", "valueBoolean", bool, False, "value", True), + ("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), + ]) + return js + + +class CodeSystemFilter(backboneelement.BackboneElement): + """ Filter that can be used in a value set. + + A filter that can be used in a value set compose statement when selecting + concepts using a filter. + """ + + resource_type = "CodeSystemFilter" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 that identifies the filter. + Type `str`. """ + + self.description = None + """ How or why the filter is used. + Type `str`. """ + + self.operator = None + """ Operators that can be used with filter. + List of `str` items. """ + + self.value = None + """ What to use for the value. + Type `str`. """ + + super(CodeSystemFilter, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CodeSystemFilter, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("description", "description", str, False, None, False), + ("operator", "operator", str, True, None, True), + ("value", "value", str, False, None, True), + ]) + return js + + +class CodeSystemProperty(backboneelement.BackboneElement): + """ Additional information supplied about each concept. + + A property defines an additional slot through which additional information + can be provided about a concept. + """ + + resource_type = "CodeSystemProperty" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Identifies the property on the concepts, and when referred to in + operations. + Type `str`. """ + + self.description = None + """ Why the property is defined, and/or what it conveys. + Type `str`. """ + + self.type = None + """ code | Coding | string | integer | boolean | dateTime | decimal. + Type `str`. """ + + self.uri = None + """ Formal identifier for the property. + Type `str`. """ + + super(CodeSystemProperty, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CodeSystemProperty, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("description", "description", str, False, None, False), + ("type", "type", str, False, None, True), + ("uri", "uri", str, 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 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/R4/codesystem_tests.py b/fhirclient/models/R4/codesystem_tests.py new file mode 100644 index 000000000..5921fb67c --- /dev/null +++ b/fhirclient/models/R4/codesystem_tests.py @@ -0,0 +1,262 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import codesystem +from .fhirdate import FHIRDate + + +class CodeSystemTests(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("CodeSystem", js["resourceType"]) + return codesystem.CodeSystem(js) + + def testCodeSystem1(self): + inst = self.instantiate_from("codesystem-example-supplement.json") + self.assertIsNotNone(inst, "Must have instantiated a CodeSystem instance") + self.implCodeSystem1(inst) + + js = inst.as_json() + self.assertEqual("CodeSystem", js["resourceType"]) + inst2 = codesystem.CodeSystem(js) + 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") + self.assertEqual(inst.contact[0].telecom[0].value, "http://hl7.org/fhir") + self.assertEqual(inst.content, "not-present") + self.assertEqual(inst.count, 92) + self.assertEqual(inst.description, "This is an example code system summary for the ACME codes for body site.") + self.assertTrue(inst.experimental) + self.assertEqual(inst.id, "summary") + self.assertEqual(inst.jurisdiction[0].coding[0].code, "CA") + self.assertEqual(inst.jurisdiction[0].coding[0].system, "urn:iso:std:iso:3166") + self.assertEqual(inst.name, "Code system summary example for ACME body sites") + 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/CodeSystem/summary") + self.assertEqual(inst.useContext[0].code.code, "species") + self.assertEqual(inst.useContext[0].code.system, "http://example.org/CodeSystem/contexttype") + 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 testCodeSystem5(self): + inst = self.instantiate_from("codesystem-example.json") + self.assertIsNotNone(inst, "Must have instantiated a CodeSystem instance") + self.implCodeSystem5(inst) + + js = inst.as_json() + self.assertEqual("CodeSystem", js["resourceType"]) + inst2 = codesystem.CodeSystem(js) + self.implCodeSystem5(inst2) + + 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") + self.assertEqual(inst.concept[0].designation[0].use.code, "internal-label") + self.assertEqual(inst.concept[0].designation[0].use.system, "http://acme.com/config/fhir/codesystems/internal") + self.assertEqual(inst.concept[0].designation[0].value, "From ACME POC Testing") + self.assertEqual(inst.concept[0].display, "SChol (mmol/L)") + self.assertEqual(inst.concept[1].code, "chol-mass") + self.assertEqual(inst.concept[1].definition, "Serum Cholesterol, in mg/L") + self.assertEqual(inst.concept[1].designation[0].use.code, "internal-label") + self.assertEqual(inst.concept[1].designation[0].use.system, "http://acme.com/config/fhir/codesystems/internal") + self.assertEqual(inst.concept[1].designation[0].value, "From Paragon Labs") + self.assertEqual(inst.concept[1].display, "SChol (mg/L)") + self.assertEqual(inst.concept[2].code, "chol") + self.assertEqual(inst.concept[2].definition, "Serum Cholesterol") + self.assertEqual(inst.concept[2].designation[0].use.code, "internal-label") + self.assertEqual(inst.concept[2].designation[0].use.system, "http://acme.com/config/fhir/codesystems/internal") + self.assertEqual(inst.concept[2].designation[0].value, "Obdurate Labs uses this with both kinds of units...") + self.assertEqual(inst.concept[2].display, "SChol") + 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, "complete") + self.assertEqual(inst.date.date, FHIRDate("2016-01-28").date) + 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[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, "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") + diff --git a/fhirclient/models/R4/coding.py b/fhirclient/models/R4/coding.py new file mode 100644 index 000000000..878835ba8 --- /dev/null +++ b/fhirclient/models/R4/coding.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Coding) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Coding(element.Element): + """ A reference to a code defined by a terminology system. + """ + + resource_type = "Coding" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Symbol in syntax defined by the system. + Type `str`. """ + + self.display = None + """ Representation defined by the system. + Type `str`. """ + + self.system = None + """ Identity of the terminology system. + Type `str`. """ + + self.userSelected = None + """ If this coding was chosen directly by the user. + Type `bool`. """ + + self.version = None + """ Version of the system - if relevant. + Type `str`. """ + + super(Coding, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Coding, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, False), + ("display", "display", str, False, None, False), + ("system", "system", str, False, None, False), + ("userSelected", "userSelected", bool, False, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + diff --git a/fhirclient/models/R4/communication.py b/fhirclient/models/R4/communication.py new file mode 100644 index 000000000..1d293a438 --- /dev/null +++ b/fhirclient/models/R4/communication.py @@ -0,0 +1,219 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Communication) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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 that was notified about a + reportable condition. + """ + + resource_type = "Communication" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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 (represented as `dict` in JSON). """ + + self.category = None + """ Message category. + List of `CodeableConcept` items (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.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 (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 (represented as `dict` in JSON). """ + + self.received = None + """ When received. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.recipient = None + """ Message recipient. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.sender = None + """ Message sender. + 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 | 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` (represented as `dict` in JSON). """ + + self.topic = None + """ 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), + ("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), + ("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), + ("recipient", "recipient", fhirreference.FHIRReference, True, None, False), + ("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", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import backboneelement + +class CommunicationPayload(backboneelement.BackboneElement): + """ Message payload. + + Text, attachment(s), or resource(s) that was communicated to the recipient. + """ + + resource_type = "CommunicationPayload" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.contentAttachment = None + """ Message part content. + Type `Attachment` (represented as `dict` in JSON). """ + + self.contentReference = None + """ Message part content. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.contentString = None + """ Message part content. + Type `str`. """ + + super(CommunicationPayload, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CommunicationPayload, self).elementProperties() + js.extend([ + ("contentAttachment", "contentAttachment", attachment.Attachment, False, "content", True), + ("contentReference", "contentReference", fhirreference.FHIRReference, False, "content", True), + ("contentString", "contentString", str, False, "content", True), + ]) + return js + + +import sys +try: + from . import annotation +except ImportError: + annotation = sys.modules[__package__ + '.annotation'] +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'] diff --git a/fhirclient/models/R4/communication_tests.py b/fhirclient/models/R4/communication_tests.py new file mode 100644 index 000000000..67de2ac5c --- /dev/null +++ b/fhirclient/models/R4/communication_tests.py @@ -0,0 +1,133 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import communication +from .fhirdate import FHIRDate + + +class CommunicationTests(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("Communication", js["resourceType"]) + return communication.Communication(js) + + def testCommunication1(self): + inst = self.instantiate_from("communication-example-fm-attachment.json") + self.assertIsNotNone(inst, "Must have instantiated a Communication instance") + self.implCommunication1(inst) + + js = inst.as_json() + self.assertEqual("Communication", js["resourceType"]) + inst2 = communication.Communication(js) + self.implCommunication1(inst2) + + def implCommunication1(self, inst): + self.assertEqual(inst.category[0].coding[0].code, "SolicitedAttachment") + self.assertEqual(inst.category[0].coding[0].system, "http://acme.org/messagetypes") + 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") + self.assertEqual(inst.payload[0].contentAttachment.data, "SGVsbG8=") + self.assertEqual(inst.payload[0].contentAttachment.title, "accident notes 20100201.pdf") + self.assertEqual(inst.payload[1].contentAttachment.contentType, "application/pdf") + self.assertEqual(inst.payload[1].contentAttachment.creation.date, FHIRDate("2010-02-01T10:57:34+01:00").date) + 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://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") + self.assertEqual(inst.text.div, "
Attachment which is unsolicited
") + self.assertEqual(inst.text.status, "generated") + + def testCommunication2(self): + inst = self.instantiate_from("communication-example-fm-solicited-attachment.json") + self.assertIsNotNone(inst, "Must have instantiated a Communication instance") + self.implCommunication2(inst) + + js = inst.as_json() + self.assertEqual("Communication", js["resourceType"]) + inst2 = communication.Communication(js) + self.implCommunication2(inst2) + + def implCommunication2(self, inst): + self.assertEqual(inst.category[0].coding[0].code, "SolicitedAttachment") + self.assertEqual(inst.category[0].coding[0].system, "http://acme.org/messagetypes") + self.assertEqual(inst.contained[0].id, "provider") + self.assertEqual(inst.contained[1].id, "payor") + self.assertEqual(inst.contained[2].id, "request") + 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") + self.assertEqual(inst.payload[0].contentAttachment.data, "SGVsbG8=") + self.assertEqual(inst.payload[0].contentAttachment.title, "accident notes 20100201.pdf") + self.assertEqual(inst.payload[1].contentAttachment.contentType, "application/pdf") + self.assertEqual(inst.payload[1].contentAttachment.creation.date, FHIRDate("2010-02-01T10:57:34+01:00").date) + 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.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") + self.assertEqual(inst.text.div, "
Attachment in response to a Request
") + self.assertEqual(inst.text.status, "generated") + + def testCommunication3(self): + inst = self.instantiate_from("communication-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Communication instance") + self.implCommunication3(inst) + + js = inst.as_json() + self.assertEqual("Communication", js["resourceType"]) + inst2 = communication.Communication(js) + self.implCommunication3(inst2) + + def implCommunication3(self, inst): + self.assertEqual(inst.category[0].coding[0].code, "Alert") + self.assertEqual(inst.category[0].coding[0].system, "http://acme.org/messagetypes") + self.assertEqual(inst.category[0].text, "Alert") + self.assertEqual(inst.id, "example") + 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://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") + self.assertEqual(inst.sent.date, FHIRDate("2014-12-12T18:01:10-08:00").date) + self.assertEqual(inst.sent.as_json(), "2014-12-12T18:01:10-08:00") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.div, "
Patient has very high serum potassium
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/R4/communicationrequest.py b/fhirclient/models/R4/communicationrequest.py new file mode 100644 index 000000000..bdc3d544f --- /dev/null +++ b/fhirclient/models/R4/communicationrequest.py @@ -0,0 +1,223 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/CommunicationRequest) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class CommunicationRequest(domainresource.DomainResource): + """ A request for information to be sent to a receiver. + + A request to convey information; e.g. the CDS system proposes that an alert + be sent to a responsible provider, the CDS system proposes that the public + health agency be notified about a reportable condition. + """ + + resource_type = "CommunicationRequest" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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 (represented as `dict` in JSON). """ + + self.category = None + """ Message category. + List of `CodeableConcept` items (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. + Type `Identifier` (represented as `dict` in JSON). """ + + self.identifier = None + """ Unique identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.medium = None + """ A channel of communication. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.note = None + """ Comments made about communication request. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.occurrenceDateTime = None + """ When scheduled. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.occurrencePeriod = None + """ When scheduled. + Type `Period` (represented as `dict` in JSON). """ + + self.payload = None + """ Message payload. + List of `CommunicationRequestPayload` items (represented as `dict` in JSON). """ + + self.priority = None + """ Message urgency. + Type `str`. """ + + self.reasonCode = None + """ Why is communication needed?. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.reasonReference = None + """ Why is communication needed?. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.recipient = None + """ Message recipient. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.replaces = None + """ Request(s) replaced by this request. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.requester = None + """ Who/what is requesting service. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.sender = None + """ Message sender. + 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` (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), + ("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), + ("note", "note", annotation.Annotation, True, None, False), + ("occurrenceDateTime", "occurrenceDateTime", fhirdate.FHIRDate, False, "occurrence", False), + ("occurrencePeriod", "occurrencePeriod", period.Period, False, "occurrence", False), + ("payload", "payload", CommunicationRequestPayload, True, None, 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), + ("replaces", "replaces", fhirreference.FHIRReference, True, 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), + ]) + return js + + +from . import backboneelement + +class CommunicationRequestPayload(backboneelement.BackboneElement): + """ Message payload. + + Text, attachment(s), or resource(s) to be communicated to the recipient. + """ + + resource_type = "CommunicationRequestPayload" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.contentAttachment = None + """ Message part content. + Type `Attachment` (represented as `dict` in JSON). """ + + self.contentReference = None + """ Message part content. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.contentString = None + """ Message part content. + Type `str`. """ + + super(CommunicationRequestPayload, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CommunicationRequestPayload, self).elementProperties() + js.extend([ + ("contentAttachment", "contentAttachment", attachment.Attachment, False, "content", True), + ("contentReference", "contentReference", fhirreference.FHIRReference, False, "content", True), + ("contentString", "contentString", str, False, "content", True), + ]) + return js + + +import sys +try: + from . import annotation +except ImportError: + annotation = sys.modules[__package__ + '.annotation'] +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 period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/R4/communicationrequest_tests.py b/fhirclient/models/R4/communicationrequest_tests.py new file mode 100644 index 000000000..430fd4053 --- /dev/null +++ b/fhirclient/models/R4/communicationrequest_tests.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import communicationrequest +from .fhirdate import FHIRDate + + +class CommunicationRequestTests(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("CommunicationRequest", js["resourceType"]) + return communicationrequest.CommunicationRequest(js) + + def testCommunicationRequest1(self): + inst = self.instantiate_from("communicationrequest-example.json") + self.assertIsNotNone(inst, "Must have instantiated a CommunicationRequest instance") + self.implCommunicationRequest1(inst) + + js = inst.as_json() + self.assertEqual("CommunicationRequest", js["resourceType"]) + inst2 = communicationrequest.CommunicationRequest(js) + 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") + self.assertEqual(inst.category[0].coding[0].system, "http://acme.org/messagetypes") + self.assertEqual(inst.contained[0].id, "provider") + self.assertEqual(inst.contained[1].id, "payor") + self.assertEqual(inst.contained[2].id, "requester") + self.assertEqual(inst.groupIdentifier.value, "12345") + self.assertEqual(inst.id, "fm-solicit") + self.assertEqual(inst.identifier[0].system, "http://www.jurisdiction.com/insurer/123456") + 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://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.") + self.assertEqual(inst.priority, "routine") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.div, "
Request for Accident Report
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/R4/compartmentdefinition.py b/fhirclient/models/R4/compartmentdefinition.py new file mode 100644 index 000000000..8913f8a63 --- /dev/null +++ b/fhirclient/models/R4/compartmentdefinition.py @@ -0,0 +1,161 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/CompartmentDefinition) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class CompartmentDefinition(domainresource.DomainResource): + """ Compartment Definition for a resource. + + A compartment definition that defines how resources are accessed on a + server. + """ + + resource_type = "CompartmentDefinition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Patient | Encounter | RelatedPerson | Practitioner | Device. + Type `str`. """ + + self.contact = None + """ Contact details for the publisher. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.date = None + """ Date last changed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Natural language description of the compartment definition. + Type `str`. """ + + self.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.name = None + """ Name for this compartment definition (computer friendly). + Type `str`. """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this compartment definition is defined. + Type `str`. """ + + self.resource = None + """ How a resource is related to the compartment. + List of `CompartmentDefinitionResource` items (represented as `dict` in JSON). """ + + self.search = None + """ Whether the search syntax is supported. + Type `bool`. """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.url = None + """ Canonical identifier for this compartment 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 compartment definition. + Type `str`. """ + + super(CompartmentDefinition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CompartmentDefinition, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("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), + ("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), + ("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 CompartmentDefinitionResource(backboneelement.BackboneElement): + """ How a resource is related to the compartment. + + Information about how a resource is related to the compartment. + """ + + resource_type = "CompartmentDefinitionResource" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Name of resource type. + Type `str`. """ + + self.documentation = None + """ Additional documentation about the resource and compartment. + Type `str`. """ + + self.param = None + """ Search Parameter Name, or chained parameters. + List of `str` items. """ + + super(CompartmentDefinitionResource, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CompartmentDefinitionResource, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("documentation", "documentation", str, False, None, False), + ("param", "param", str, True, None, False), + ]) + return js + + +import sys +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/R4/compartmentdefinition_tests.py b/fhirclient/models/R4/compartmentdefinition_tests.py new file mode 100644 index 000000000..af321f47e --- /dev/null +++ b/fhirclient/models/R4/compartmentdefinition_tests.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import compartmentdefinition +from .fhirdate import FHIRDate + + +class CompartmentDefinitionTests(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("CompartmentDefinition", js["resourceType"]) + return compartmentdefinition.CompartmentDefinition(js) + + def testCompartmentDefinition1(self): + inst = self.instantiate_from("compartmentdefinition-example.json") + self.assertIsNotNone(inst, "Must have instantiated a CompartmentDefinition instance") + self.implCompartmentDefinition1(inst) + + js = inst.as_json() + self.assertEqual("CompartmentDefinition", js["resourceType"]) + inst2 = compartmentdefinition.CompartmentDefinition(js) + self.implCompartmentDefinition1(inst2) + + def implCompartmentDefinition1(self, inst): + self.assertEqual(inst.code, "Device") + self.assertEqual(inst.contact[0].name, "[string]") + 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-02-24").date) + self.assertEqual(inst.date.as_json(), "2017-02-24") + 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.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.") + self.assertEqual(inst.resource[0].code, "Communication") + self.assertEqual(inst.resource[0].documentation, "The device used as the message sender and recipient") + self.assertEqual(inst.resource[0].param[0], "sender") + self.assertEqual(inst.resource[0].param[1], "recipient") + self.assertEqual(inst.resource[1].code, "CommunicationRequest") + self.assertEqual(inst.resource[1].documentation, "The device used as the message sender and recipient") + self.assertEqual(inst.resource[1].param[0], "sender") + self.assertEqual(inst.resource[1].param[1], "recipient") + self.assertTrue(inst.search) + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + 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://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/R4/composition.py b/fhirclient/models/R4/composition.py new file mode 100644 index 000000000..c3bc28fdc --- /dev/null +++ b/fhirclient/models/R4/composition.py @@ -0,0 +1,343 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Composition) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Composition(domainresource.DomainResource): + """ A set of resources composed into a single coherent clinical statement with + clinical attestation. + + A set of healthcare-related information that is assembled together into a + 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. 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.attester = None + """ Attests to accuracy of composition. + List of `CompositionAttester` items (represented as `dict` in JSON). """ + + self.author = None + """ Who and/or what authored the composition. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.category = None + """ Categorization of Composition. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.confidentiality = None + """ As defined by affinity domain. + Type `str`. """ + + self.custodian = None + """ Organization which maintains the composition. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.date = None + """ Composition editing time. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.encounter = None + """ Context of the Composition. + 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 + """ Version-independent identifier for the Composition. + Type `Identifier` (represented as `dict` in JSON). """ + + self.relatesTo = None + """ Relationships to other compositions/documents. + List of `CompositionRelatesTo` items (represented as `dict` in JSON). """ + + self.section = None + """ Composition is broken into sections. + List of `CompositionSection` items (represented as `dict` in JSON). """ + + self.status = None + """ preliminary | final | amended | entered-in-error. + Type `str`. """ + + self.subject = None + """ Who and/or what the composition is about. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.title = None + """ Human Readable name/title. + Type `str`. """ + + self.type = None + """ Kind of composition (LOINC if possible). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(Composition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Composition, self).elementProperties() + js.extend([ + ("attester", "attester", CompositionAttester, True, None, False), + ("author", "author", fhirreference.FHIRReference, True, None, True), + ("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), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), + ("event", "event", CompositionEvent, True, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("relatesTo", "relatesTo", CompositionRelatesTo, True, None, False), + ("section", "section", CompositionSection, True, None, False), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ("title", "title", str, False, None, True), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +from . import backboneelement + +class CompositionAttester(backboneelement.BackboneElement): + """ Attests to accuracy of composition. + + A participant who has attested to the accuracy of the composition/document. + """ + + resource_type = "CompositionAttester" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ personal | professional | legal | official. + Type `str`. """ + + self.party = None + """ Who attested the composition. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.time = None + """ When the composition was attested. + Type `FHIRDate` (represented as `str` in JSON). """ + + super(CompositionAttester, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CompositionAttester, self).elementProperties() + js.extend([ + ("mode", "mode", str, False, None, True), + ("party", "party", fhirreference.FHIRReference, False, None, False), + ("time", "time", fhirdate.FHIRDate, False, None, False), + ]) + return js + + +class CompositionEvent(backboneelement.BackboneElement): + """ The clinical service(s) being documented. + + The clinical service, such as a colonoscopy or an appendectomy, being + documented. + """ + + resource_type = "CompositionEvent" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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(s) that apply to the event being documented. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.detail = None + """ The event(s) being documented. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.period = None + """ The period covered by the documentation. + Type `Period` (represented as `dict` in JSON). """ + + super(CompositionEvent, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CompositionEvent, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, True, None, False), + ("detail", "detail", fhirreference.FHIRReference, True, None, False), + ("period", "period", period.Period, False, None, False), + ]) + return js + + +class CompositionRelatesTo(backboneelement.BackboneElement): + """ Relationships to other compositions/documents. + + Relationships that this composition has with other compositions or + documents that already exist. + """ + + resource_type = "CompositionRelatesTo" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ replaces | transforms | signs | appends. + Type `str`. """ + + self.targetIdentifier = None + """ Target of the relationship. + Type `Identifier` (represented as `dict` in JSON). """ + + self.targetReference = None + """ Target of the relationship. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(CompositionRelatesTo, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CompositionRelatesTo, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("targetIdentifier", "targetIdentifier", identifier.Identifier, False, "target", True), + ("targetReference", "targetReference", fhirreference.FHIRReference, False, "target", True), + ]) + return js + + +class CompositionSection(backboneelement.BackboneElement): + """ Composition is broken into sections. + + The root of the sections that make up the composition. + """ + + resource_type = "CompositionSection" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ 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). """ + + self.emptyReason = None + """ Why the section is empty. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.entry = None + """ A reference to data that supports this section. + 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. + Type `str`. """ + + self.orderedBy = None + """ Order of section entries. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.section = None + """ Nested Section. + List of `CompositionSection` items (represented as `dict` in JSON). """ + + self.text = None + """ Text summary of the section, for human interpretation. + Type `Narrative` (represented as `dict` in JSON). """ + + self.title = None + """ Label for section (e.g. for ToC). + Type `str`. """ + + super(CompositionSection, self).__init__(jsondict=jsondict, strict=strict) + + 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), + ("text", "text", narrative.Narrative, False, None, False), + ("title", "title", 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 narrative +except ImportError: + narrative = sys.modules[__package__ + '.narrative'] +try: + from . import period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/R4/composition_tests.py b/fhirclient/models/R4/composition_tests.py new file mode 100644 index 000000000..a526f4461 --- /dev/null +++ b/fhirclient/models/R4/composition_tests.py @@ -0,0 +1,126 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import composition +from .fhirdate import FHIRDate + + +class CompositionTests(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("Composition", js["resourceType"]) + return composition.Composition(js) + + def testComposition1(self): + inst = self.instantiate_from("composition-example-mixed.json") + self.assertIsNotNone(inst, "Must have instantiated a Composition instance") + self.implComposition1(inst) + + js = inst.as_json() + self.assertEqual("Composition", js["resourceType"]) + inst2 = composition.Composition(js) + self.implComposition1(inst2) + + def implComposition1(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.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.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://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) + self.assertEqual(inst.event[0].period.start.as_json(), "2010-07-18") + 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") + self.assertEqual(inst.relatesTo[1].targetIdentifier.value, "ABC123") + self.assertEqual(inst.section[0].code.coding[0].code, "11348-0") + self.assertEqual(inst.section[0].code.coding[0].display, "History of past illness Narrative") + self.assertEqual(inst.section[0].code.coding[0].system, "http://loinc.org") + 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://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") + self.assertEqual(inst.section[1].code.coding[0].display, "History of family member diseases Narrative") + 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://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") + self.assertEqual(inst.status, "final") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "Consultation Note") + self.assertEqual(inst.type.coding[0].code, "11488-4") + self.assertEqual(inst.type.coding[0].display, "Consult note") + self.assertEqual(inst.type.coding[0].system, "http://loinc.org") + diff --git a/fhirclient/models/R4/conceptmap.py b/fhirclient/models/R4/conceptmap.py new file mode 100644 index 000000000..7e3046022 --- /dev/null +++ b/fhirclient/models/R4/conceptmap.py @@ -0,0 +1,409 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ConceptMap) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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 concepts in code systems, or data element/data element + concepts, or classes in class models. + """ + + resource_type = "ConceptMap" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 last changed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Natural language description of the concept map. + Type `str`. """ + + self.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.group = None + """ Same source and target systems. + List of `ConceptMapGroup` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Additional identifier for the concept map. + Type `Identifier` (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ Intended jurisdiction for concept map (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.name = None + """ Name for this concept map (computer friendly). + Type `str`. """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this concept map is defined. + Type `str`. """ + + self.sourceCanonical = None + """ The source value set that contains the concepts that are being + mapped. + Type `str`. """ + + self.sourceUri = None + """ The source value set that contains the concepts that are being + mapped. + Type `str`. """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.targetCanonical = None + """ The target value set which provides context for the mappings. + Type `str`. """ + + self.targetUri = None + """ The target value set which provides context for the mappings. + Type `str`. """ + + self.title = None + """ Name for this concept map (human friendly). + Type `str`. """ + + self.url = None + """ Canonical identifier for this concept map, 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 concept map. + Type `str`. """ + + super(ConceptMap, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ConceptMap, self).elementProperties() + js.extend([ + ("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), + ("experimental", "experimental", bool, False, None, False), + ("group", "group", ConceptMapGroup, True, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("name", "name", str, False, None, False), + ("publisher", "publisher", str, False, None, False), + ("purpose", "purpose", str, False, None, False), + ("sourceCanonical", "sourceCanonical", str, False, "source", False), + ("sourceUri", "sourceUri", str, False, "source", False), + ("status", "status", str, False, None, True), + ("targetCanonical", "targetCanonical", str, False, "target", False), + ("targetUri", "targetUri", str, False, "target", 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 ConceptMapGroup(backboneelement.BackboneElement): + """ Same source and target systems. + + A group of mappings that all have the same source and target system. + """ + + resource_type = "ConceptMapGroup" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Mappings for a concept from the source set. + List of `ConceptMapGroupElement` items (represented as `dict` in JSON). """ + + self.source = None + """ Source system where concepts to be mapped are defined. + Type `str`. """ + + self.sourceVersion = None + """ Specific version of the code system. + Type `str`. """ + + self.target = None + """ Target system that the concepts are to be mapped to. + Type `str`. """ + + self.targetVersion = None + """ Specific version of the code system. + Type `str`. """ + + self.unmapped = None + """ 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) + + def elementProperties(self): + js = super(ConceptMapGroup, self).elementProperties() + js.extend([ + ("element", "element", ConceptMapGroupElement, True, None, True), + ("source", "source", str, False, None, False), + ("sourceVersion", "sourceVersion", str, False, None, False), + ("target", "target", str, False, None, False), + ("targetVersion", "targetVersion", str, False, None, False), + ("unmapped", "unmapped", ConceptMapGroupUnmapped, False, None, False), + ]) + return js + + +class ConceptMapGroupElement(backboneelement.BackboneElement): + """ Mappings for a concept from the source set. + + Mappings for an individual concept in the source to one or more concepts in + the target. + """ + + resource_type = "ConceptMapGroupElement" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Identifies element being mapped. + Type `str`. """ + + self.display = None + """ Display for the code. + Type `str`. """ + + self.target = None + """ Concept in target system for element. + List of `ConceptMapGroupElementTarget` items (represented as `dict` in JSON). """ + + super(ConceptMapGroupElement, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ConceptMapGroupElement, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, False), + ("display", "display", str, False, None, False), + ("target", "target", ConceptMapGroupElementTarget, True, None, False), + ]) + return js + + +class ConceptMapGroupElementTarget(backboneelement.BackboneElement): + """ Concept in target system for element. + + A concept from the target value set that this concept maps to. + """ + + resource_type = "ConceptMapGroupElementTarget" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 that identifies the target element. + Type `str`. """ + + self.comment = None + """ Description of status/issues in mapping. + Type `str`. """ + + self.dependsOn = None + """ Other elements required for this mapping (from context). + List of `ConceptMapGroupElementTargetDependsOn` items (represented as `dict` in JSON). """ + + self.display = None + """ Display for the code. + Type `str`. """ + + self.equivalence = None + """ relatedto | equivalent | equal | wider | subsumes | narrower | + specializes | inexact | unmatched | disjoint. + Type `str`. """ + + self.product = None + """ Other concepts that this mapping also produces. + List of `ConceptMapGroupElementTargetDependsOn` items (represented as `dict` in JSON). """ + + super(ConceptMapGroupElementTarget, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ConceptMapGroupElementTarget, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, False), + ("comment", "comment", str, False, None, False), + ("dependsOn", "dependsOn", ConceptMapGroupElementTargetDependsOn, True, None, False), + ("display", "display", str, False, None, False), + ("equivalence", "equivalence", str, False, None, True), + ("product", "product", ConceptMapGroupElementTargetDependsOn, True, None, False), + ]) + return js + + +class ConceptMapGroupElementTargetDependsOn(backboneelement.BackboneElement): + """ Other elements required for this mapping (from context). + + A set of additional dependencies for this mapping to hold. This mapping is + only applicable if the specified element can be resolved, and it has the + specified value. + """ + + resource_type = "ConceptMapGroupElementTargetDependsOn" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.display = None + """ Display for the code (if value is a code). + Type `str`. """ + + self.property = None + """ Reference to property mapping depends on. + Type `str`. """ + + self.system = None + """ 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([ + ("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): + """ What to do when there is no mapping for the source concept. + + 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Fixed code when mode = fixed. + Type `str`. """ + + self.display = None + """ Display for the code. + Type `str`. """ + + self.mode = None + """ provided | fixed | other-map. + Type `str`. """ + + self.url = None + """ 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) + + def elementProperties(self): + js = super(ConceptMapGroupUnmapped, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, False), + ("display", "display", str, False, None, False), + ("mode", "mode", str, False, None, True), + ("url", "url", 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/R4/conceptmap_tests.py b/fhirclient/models/R4/conceptmap_tests.py new file mode 100644 index 000000000..99fd92be4 --- /dev/null +++ b/fhirclient/models/R4/conceptmap_tests.py @@ -0,0 +1,205 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import conceptmap +from .fhirdate import FHIRDate + + +class ConceptMapTests(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("ConceptMap", js["resourceType"]) + return conceptmap.ConceptMap(js) + + def testConceptMap1(self): + inst = self.instantiate_from("conceptmap-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ConceptMap instance") + self.implConceptMap1(inst) + + js = inst.as_json() + self.assertEqual("ConceptMap", js["resourceType"]) + inst2 = conceptmap.ConceptMap(js) + 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") + self.assertEqual(inst.date.date, FHIRDate("2012-06-13").date) + self.assertEqual(inst.date.as_json(), "2012-06-13") + self.assertEqual(inst.description, "An example mapping") + self.assertTrue(inst.experimental) + 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].display, "Something Coded") + 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") + self.assertEqual(inst.group[0].target, "http://example.org/fhir/example2") + self.assertEqual(inst.group[0].unmapped.mode, "other-map") + self.assertEqual(inst.group[0].unmapped.url, "http://example.org/fhir/ConceptMap/map2") + self.assertEqual(inst.id, "example2") + self.assertEqual(inst.name, "FHIR-exanple-2") + self.assertEqual(inst.publisher, "HL7, Inc") + self.assertEqual(inst.purpose, "To illustrate mapping features") + self.assertEqual(inst.sourceUri, "http://example.org/fhir/example1") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.targetUri, "http://example.org/fhir/example2") + 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 testConceptMap3(self): + inst = self.instantiate_from("conceptmap-example-specimen-type.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].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") + self.assertEqual(inst.contact[1].telecom[0].value, "http://www.phconnect.org/group/laboratorymessagingcommunityofpractice/forum/attachment/download?id=3649725%3AUploadedFile%3A145786") + self.assertEqual(inst.date.date, FHIRDate("2013-07-25").date) + self.assertEqual(inst.date.as_json(), "2013-07-25") + 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].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].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].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].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://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, "4.0.0") + diff --git a/fhirclient/models/R4/condition.py b/fhirclient/models/R4/condition.py new file mode 100644 index 000000000..9ef317778 --- /dev/null +++ b/fhirclient/models/R4/condition.py @@ -0,0 +1,274 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Condition) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Condition(domainresource.DomainResource): + """ Detailed information about conditions, problems or diagnoses. + + A clinical condition, problem, diagnosis, or other event, situation, issue, + or clinical concept that has risen to a level of concern. + """ + + resource_type = "Condition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.abatementAge = None + """ When in resolution/remission. + Type `Age` (represented as `dict` in JSON). """ + + self.abatementDateTime = None + """ When in resolution/remission. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.abatementPeriod = None + """ When in resolution/remission. + Type `Period` (represented as `dict` in JSON). """ + + self.abatementRange = None + """ When in resolution/remission. + Type `Range` (represented as `dict` in JSON). """ + + self.abatementString = None + """ When in resolution/remission. + Type `str`. """ + + self.asserter = None + """ Person who asserts this condition. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.bodySite = None + """ Anatomical location, if relevant. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.category = None + """ problem-list-item | encounter-diagnosis. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.clinicalStatus = None + """ 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.encounter = None + """ Encounter created as part of. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.evidence = None + """ Supporting evidence. + List of `ConditionEvidence` items (represented as `dict` in JSON). """ + + self.identifier = None + """ External Ids for this condition. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.note = None + """ Additional information about the Condition. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.onsetAge = None + """ Estimated or actual date, date-time, or age. + Type `Age` (represented as `dict` in JSON). """ + + self.onsetDateTime = None + """ Estimated or actual date, date-time, or age. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.onsetPeriod = None + """ Estimated or actual date, date-time, or age. + Type `Period` (represented as `dict` in JSON). """ + + self.onsetRange = None + """ Estimated or actual date, date-time, or age. + Type `Range` (represented as `dict` in JSON). """ + + self.onsetString = None + """ 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. + List of `ConditionStage` items (represented as `dict` in JSON). """ + + self.subject = None + """ Who has the condition?. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.verificationStatus = None + """ unconfirmed | provisional | differential | confirmed | refuted | + entered-in-error. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(Condition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Condition, self).elementProperties() + js.extend([ + ("abatementAge", "abatementAge", age.Age, 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), + ("asserter", "asserter", fhirreference.FHIRReference, False, None, False), + ("bodySite", "bodySite", codeableconcept.CodeableConcept, True, None, False), + ("category", "category", codeableconcept.CodeableConcept, True, None, False), + ("clinicalStatus", "clinicalStatus", codeableconcept.CodeableConcept, False, None, False), + ("code", "code", codeableconcept.CodeableConcept, 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), + ("onsetAge", "onsetAge", age.Age, False, "onset", False), + ("onsetDateTime", "onsetDateTime", fhirdate.FHIRDate, False, "onset", False), + ("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, True, None, False), + ("subject", "subject", fhirreference.FHIRReference, False, None, True), + ("verificationStatus", "verificationStatus", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import backboneelement + +class ConditionEvidence(backboneelement.BackboneElement): + """ Supporting evidence. + + 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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/symptom. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.detail = None + """ Supporting information found elsewhere. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + super(ConditionEvidence, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ConditionEvidence, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, True, None, False), + ("detail", "detail", fhirreference.FHIRReference, True, None, False), + ]) + return js + + +class ConditionStage(backboneelement.BackboneElement): + """ Stage/grade, usually assessed formally. + + Clinical stage or grade of a condition. May include formal severity + assessments. + """ + + resource_type = "ConditionStage" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Formal record of assessment. + 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): + js = super(ConditionStage, self).elementProperties() + 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 + + +import sys +try: + from . import age +except ImportError: + age = sys.modules[__package__ + '.age'] +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'] +try: + from . import range +except ImportError: + range = sys.modules[__package__ + '.range'] diff --git a/fhirclient/models/R4/condition_tests.py b/fhirclient/models/R4/condition_tests.py new file mode 100644 index 000000000..d1d457b49 --- /dev/null +++ b/fhirclient/models/R4/condition_tests.py @@ -0,0 +1,395 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import condition +from .fhirdate import FHIRDate + + +class ConditionTests(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("Condition", js["resourceType"]) + return condition.Condition(js) + + def testCondition1(self): + inst = self.instantiate_from("condition-example-f003-abscess.json") + self.assertIsNotNone(inst, "Must have instantiated a Condition instance") + self.implCondition1(inst) + + js = inst.as_json() + self.assertEqual("Condition", js["resourceType"]) + inst2 = condition.Condition(js) + self.implCondition1(inst2) + + def implCondition1(self, inst): + 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.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, "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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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.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-f203-sepsis.json") + self.assertIsNotNone(inst, "Must have instantiated a Condition instance") + self.implCondition2(inst) + + js = inst.as_json() + self.assertEqual("Condition", js["resourceType"]) + inst2 = condition.Condition(js) + self.implCondition2(inst2) + + def implCondition2(self, inst): + 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://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.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.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 testCondition3(self): + inst = self.instantiate_from("condition-example-stroke.json") + self.assertIsNotNone(inst, "Must have instantiated a Condition instance") + self.implCondition3(inst) + + js = inst.as_json() + self.assertEqual("Condition", js["resourceType"]) + inst2 = condition.Condition(js) + self.implCondition3(inst2) + + def implCondition3(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://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.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.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-family-history.json") + self.assertIsNotNone(inst, "Must have instantiated a Condition instance") + self.implCondition4(inst) + + js = inst.as_json() + self.assertEqual("Condition", js["resourceType"]) + inst2 = condition.Condition(js) + self.implCondition4(inst2) + + def implCondition4(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://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.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") + + def testCondition5(self): + inst = self.instantiate_from("condition-example-f002-lung.json") + self.assertIsNotNone(inst, "Must have instantiated a Condition instance") + self.implCondition5(inst) + + js = inst.as_json() + self.assertEqual("Condition", js["resourceType"]) + inst2 = condition.Condition(js) + self.implCondition5(inst2) + + def implCondition5(self, inst): + 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, "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.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.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-f205-infection.json") + self.assertIsNotNone(inst, "Must have instantiated a Condition instance") + self.implCondition6(inst) + + js = inst.as_json() + self.assertEqual("Condition", js["resourceType"]) + inst2 = condition.Condition(js) + self.implCondition6(inst2) + + def implCondition6(self, inst): + 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, "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.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") + self.assertIsNotNone(inst, "Must have instantiated a Condition instance") + self.implCondition7(inst) + + js = inst.as_json() + self.assertEqual("Condition", js["resourceType"]) + inst2 = condition.Condition(js) + self.implCondition7(inst2) + + 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.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") + 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, "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[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.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-example2.json") + self.assertIsNotNone(inst, "Must have instantiated a Condition instance") + self.implCondition8(inst) + + js = inst.as_json() + self.assertEqual("Condition", js["resourceType"]) + inst2 = condition.Condition(js) + self.implCondition8(inst2) + + def implCondition8(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://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.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-f202-malignancy.json") + self.assertIsNotNone(inst, "Must have instantiated a Condition instance") + self.implCondition9(inst) + + js = inst.as_json() + self.assertEqual("Condition", js["resourceType"]) + inst2 = condition.Condition(js) + self.implCondition9(inst2) + + def implCondition9(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.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, "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-f201-fever.json") + self.assertIsNotNone(inst, "Must have instantiated a Condition instance") + self.implCondition10(inst) + + js = inst.as_json() + self.assertEqual("Condition", js["resourceType"]) + inst2 = condition.Condition(js) + self.implCondition10(inst2) + + def implCondition10(self, inst): + 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.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.coding[0].code, "confirmed") + self.assertEqual(inst.verificationStatus.coding[0].system, "http://terminology.hl7.org/CodeSystem/condition-ver-status") + diff --git a/fhirclient/models/R4/consent.py b/fhirclient/models/R4/consent.py new file mode 100644 index 000000000..3cb36525b --- /dev/null +++ b/fhirclient/models/R4/consent.py @@ -0,0 +1,368 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Consent) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Consent(domainresource.DomainResource): + """ 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 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. + """ + + resource_type = "Consent" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 consent statement - for indexing/retrieval. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.dateTime = None + """ When this Consent was created or indexed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.identifier = None + """ Identifier for this record (external references). + List of `Identifier` items (represented as `dict` in JSON). """ + + self.organization = None + """ Custodian of the consent. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.patient = None + """ Who the consent applies to. + Type `FHIRReference` (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 + """ Regulation that this consents to. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.provision = None + """ Constraints to the base Consent.policyRule. + Type `ConsentProvision` (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.sourceReference = None + """ Source from which this consent is taken. + 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([ + ("category", "category", codeableconcept.CodeableConcept, True, None, True), + ("dateTime", "dateTime", fhirdate.FHIRDate, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("organization", "organization", fhirreference.FHIRReference, True, None, False), + ("patient", "patient", fhirreference.FHIRReference, False, None, False), + ("performer", "performer", fhirreference.FHIRReference, True, None, False), + ("policy", "policy", ConsentPolicy, 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), + ("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 ConsentPolicy(backboneelement.BackboneElement): + """ Policies covered by this consent. + + 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 = "ConsentPolicy" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Enforcement source for policy. + Type `str`. """ + + self.uri = None + """ Specific policy covered by this consent. + Type `str`. """ + + super(ConsentPolicy, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ConsentPolicy, self).elementProperties() + js.extend([ + ("authority", "authority", str, False, None, False), + ("uri", "uri", str, False, None, False), + ]) + return js + + +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 = "ConsentProvision" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Actions controlled by this rule. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.actor = None + """ 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, 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 `CodeableConcept` items (represented as `dict` in JSON). """ + + self.data = None + """ Data controlled by this rule. + List of `ConsentProvisionData` items (represented as `dict` in JSON). """ + + self.dataPeriod = None + """ Timeframe for data controlled by this rule. + Type `Period` (represented as `dict` in JSON). """ + + self.period = None + """ 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 rule. + List of `Coding` 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.type = None + """ deny | permit. + Type `str`. """ + + super(ConsentProvision, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ConsentProvision, self).elementProperties() + js.extend([ + ("action", "action", codeableconcept.CodeableConcept, True, None, False), + ("actor", "actor", ConsentProvisionActor, True, None, False), + ("class_fhir", "class", coding.Coding, 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, False), + ]) + return js + + +class ConsentProvisionActor(backboneelement.BackboneElement): + """ Who|what controlled by this rule (or group, by role). + + 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 = "ConsentProvisionActor" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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` (represented as `dict` in JSON). """ + + self.role = None + """ How the actor is involved. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ConsentProvisionActor, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ConsentProvisionActor, self).elementProperties() + js.extend([ + ("reference", "reference", fhirreference.FHIRReference, False, None, True), + ("role", "role", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +class ConsentProvisionData(backboneelement.BackboneElement): + """ Data controlled by this rule. + + The resources controlled by this rule if specific resources are referenced. + """ + + resource_type = "ConsentProvisionData" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.meaning = None + """ instance | related | dependents | authoredby. + Type `str`. """ + + self.reference = None + """ The actual data reference. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(ConsentProvisionData, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ConsentProvisionData, self).elementProperties() + js.extend([ + ("meaning", "meaning", str, False, None, True), + ("reference", "reference", fhirreference.FHIRReference, False, None, True), + ]) + return js + + +class ConsentVerification(backboneelement.BackboneElement): + """ Consent Verified by patient or family. + + 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 = "ConsentVerification" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.verificationDate = None + """ When consent verified. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.verified = None + """ Has been verified. + Type `bool`. """ + + 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(ConsentVerification, self).elementProperties() + js.extend([ + ("verificationDate", "verificationDate", fhirdate.FHIRDate, False, None, False), + ("verified", "verified", bool, False, None, True), + ("verifiedWith", "verifiedWith", fhirreference.FHIRReference, 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 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 period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/R4/consent_tests.py b/fhirclient/models/R4/consent_tests.py new file mode 100644 index 000000000..ceb49e10c --- /dev/null +++ b/fhirclient/models/R4/consent_tests.py @@ -0,0 +1,412 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import consent +from .fhirdate import FHIRDate + + +class ConsentTests(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("Consent", js["resourceType"]) + return consent.Consent(js) + + def testConsent1(self): + inst = self.instantiate_from("consent-example-notThis.json") + self.assertIsNotNone(inst, "Must have instantiated a Consent instance") + self.implConsent1(inst) + + js = inst.as_json() + self.assertEqual("Consent", js["resourceType"]) + inst2 = consent.Consent(js) + 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.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-smartonfhir.json") + self.assertIsNotNone(inst, "Must have instantiated a Consent instance") + self.implConsent2(inst) + + js = inst.as_json() + self.assertEqual("Consent", js["resourceType"]) + inst2 = consent.Consent(js) + self.implConsent2(inst2) + + def implConsent2(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-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") + + def testConsent3(self): + inst = self.instantiate_from("consent-example-notAuthor.json") + self.assertIsNotNone(inst, "Must have instantiated a Consent instance") + self.implConsent3(inst) + + js = inst.as_json() + self.assertEqual("Consent", js["resourceType"]) + inst2 = consent.Consent(js) + 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.id, "consent-example-notAuthor") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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-notTime.json") + self.assertIsNotNone(inst, "Must have instantiated a Consent instance") + self.implConsent4(inst) + + js = inst.as_json() + self.assertEqual("Consent", js["resourceType"]) + inst2 = consent.Consent(js) + 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.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-signature.json") + self.assertIsNotNone(inst, "Must have instantiated a Consent instance") + self.implConsent5(inst) + + js = inst.as_json() + self.assertEqual("Consent", js["resourceType"]) + inst2 = consent.Consent(js) + self.implConsent5(inst2) + + def implConsent5(self, inst): + 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-notThem.json") + self.assertIsNotNone(inst, "Must have instantiated a Consent instance") + self.implConsent6(inst) + + js = inst.as_json() + self.assertEqual("Consent", js["resourceType"]) + inst2 = consent.Consent(js) + 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.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-grantor.json") + self.assertIsNotNone(inst, "Must have instantiated a Consent instance") + self.implConsent7(inst) + + js = inst.as_json() + self.assertEqual("Consent", js["resourceType"]) + inst2 = consent.Consent(js) + 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.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-notOrg.json") + self.assertIsNotNone(inst, "Must have instantiated a Consent instance") + self.implConsent8(inst) + + js = inst.as_json() + self.assertEqual("Consent", js["resourceType"]) + inst2 = consent.Consent(js) + self.implConsent8(inst2) + + def implConsent8(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.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") + + def testConsent9(self): + inst = self.instantiate_from("consent-example-pkb.json") + self.assertIsNotNone(inst, "Must have instantiated a Consent instance") + self.implConsent9(inst) + + js = inst.as_json() + self.assertEqual("Consent", js["resourceType"]) + inst2 = consent.Consent(js) + 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.id, "consent-example-pkb") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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.json") + self.assertIsNotNone(inst, "Must have instantiated a Consent instance") + self.implConsent10(inst) + + js = inst.as_json() + self.assertEqual("Consent", js["resourceType"]) + inst2 = consent.Consent(js) + self.implConsent10(inst2) + + def implConsent10(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-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/R4/contactdetail.py b/fhirclient/models/R4/contactdetail.py new file mode 100644 index 000000000..f28d9cc72 --- /dev/null +++ b/fhirclient/models/R4/contactdetail.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ContactDetail) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class ContactDetail(element.Element): + """ Contact information. + + Specifies contact information for a person or organization. + """ + + resource_type = "ContactDetail" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 an individual to contact. + Type `str`. """ + + self.telecom = None + """ Contact details for individual or organization. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(ContactDetail, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ContactDetail, self).elementProperties() + js.extend([ + ("name", "name", str, False, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ]) + return js + + +import sys +try: + from . import contactpoint +except ImportError: + contactpoint = sys.modules[__package__ + '.contactpoint'] diff --git a/fhirclient/models/R4/contactpoint.py b/fhirclient/models/R4/contactpoint.py new file mode 100644 index 000000000..5d43c83e3 --- /dev/null +++ b/fhirclient/models/R4/contactpoint.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ContactPoint) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class ContactPoint(element.Element): + """ Details of a Technology mediated contact point (phone, fax, email, etc.). + + Details for all kinds of technology mediated contact points for a person or + organization, including telephone, email, etc. + """ + + resource_type = "ContactPoint" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Time period when the contact point was/is in use. + Type `Period` (represented as `dict` in JSON). """ + + self.rank = None + """ Specify preferred order of use (1 = highest). + Type `int`. """ + + self.system = None + """ phone | fax | email | pager | url | sms | other. + Type `str`. """ + + self.use = None + """ home | work | temp | old | mobile - purpose of this contact point. + Type `str`. """ + + self.value = None + """ The actual contact point details. + Type `str`. """ + + super(ContactPoint, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ContactPoint, self).elementProperties() + js.extend([ + ("period", "period", period.Period, False, None, False), + ("rank", "rank", int, False, None, False), + ("system", "system", str, False, None, False), + ("use", "use", str, False, None, False), + ("value", "value", str, False, None, False), + ]) + return js + + +import sys +try: + from . import period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/R4/contract.py b/fhirclient/models/R4/contract.py new file mode 100644 index 000000000..a0bbf3472 --- /dev/null +++ b/fhirclient/models/R4/contract.py @@ -0,0 +1,1210 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Contract) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Contract(domainresource.DomainResource): + """ Legal Agreement. + + Legally enforceable, formally recorded unilateral or bilateral directive + i.e., a policy or agreement. + """ + + resource_type = "Contract" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + 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 (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.domain = None + """ 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. + List of `ContractFriendly` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Contract number. + 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. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.legal = None + """ 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.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 + """ draft | active | suspended | cancelled | completed | entered-in- + error | unknown. + Type `str`. """ + + self.subType = None + """ Subtype within the context of type. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.subject = None + """ Contract Target Entity. + 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.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 + """ Legal instrument category. + Type `CodeableConcept` (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([ + ("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), + ("contentDefinition", "contentDefinition", ContractContentDefinition, False, None, False), + ("contentDerivative", "contentDerivative", 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, 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), + ("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), + ("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), + ("url", "url", str, False, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class ContractContentDefinition(backboneelement.BackboneElement): + """ Contract precursor content. + + 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 = "ContractContentDefinition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.copyright = None + """ Publication Ownership. + Type `str`. """ + + self.publicationDate = None + """ When published. + Type `FHIRDate` (represented as `str` in JSON). """ + + 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(ContractContentDefinition, self).elementProperties() + js.extend([ + ("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 + + +class ContractFriendly(backboneelement.BackboneElement): + """ Contract Friendly Language. + + The "patient friendly language" versionof the Contract in whole or in + parts. "Patient friendly language" means the representation of the Contract + and Contract Provisions in a manner that is readily accessible and + understandable by a layperson in accordance with best practices for + communication styles that ensure that those agreeing to or signing the + Contract understand the roles, actions, obligations, responsibilities, and + implication of the agreement. + """ + + resource_type = "ContractFriendly" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.contentAttachment = None + """ Easily comprehended representation of this Contract. + Type `Attachment` (represented as `dict` in JSON). """ + + self.contentReference = None + """ Easily comprehended representation of this Contract. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(ContractFriendly, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ContractFriendly, self).elementProperties() + js.extend([ + ("contentAttachment", "contentAttachment", attachment.Attachment, False, "content", True), + ("contentReference", "contentReference", fhirreference.FHIRReference, False, "content", True), + ]) + return js + + +class ContractLegal(backboneelement.BackboneElement): + """ Contract Legal Language. + + List of Legal expressions or representations of this Contract. + """ + + resource_type = "ContractLegal" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.contentAttachment = None + """ Contract Legal Text. + Type `Attachment` (represented as `dict` in JSON). """ + + self.contentReference = None + """ Contract Legal Text. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(ContractLegal, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ContractLegal, self).elementProperties() + js.extend([ + ("contentAttachment", "contentAttachment", attachment.Attachment, False, "content", True), + ("contentReference", "contentReference", fhirreference.FHIRReference, False, "content", True), + ]) + return js + + +class ContractRule(backboneelement.BackboneElement): + """ Computable Contract Language. + + List of Computable Policy Rule Language Representations of this Contract. + """ + + resource_type = "ContractRule" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.contentAttachment = None + """ Computable Contract Rules. + Type `Attachment` (represented as `dict` in JSON). """ + + self.contentReference = None + """ Computable Contract Rules. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(ContractRule, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ContractRule, self).elementProperties() + js.extend([ + ("contentAttachment", "contentAttachment", attachment.Attachment, False, "content", True), + ("contentReference", "contentReference", fhirreference.FHIRReference, False, "content", True), + ]) + return js + + +class ContractSigner(backboneelement.BackboneElement): + """ Contract Signatory. + + Parties with legal standing in the Contract, including the principal + parties, the grantor(s) and grantee(s), which are any person or + organization bound by the contract, and any ancillary parties, which + facilitate the execution of the contract such as a notary or witness. + """ + + resource_type = "ContractSigner" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.party = None + """ Contract Signatory Party. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.signature = None + """ Contract Documentation Signature. + List of `Signature` items (represented as `dict` in JSON). """ + + self.type = None + """ Contract Signatory Role. + Type `Coding` (represented as `dict` in JSON). """ + + super(ContractSigner, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ContractSigner, self).elementProperties() + js.extend([ + ("party", "party", fhirreference.FHIRReference, False, None, True), + ("signature", "signature", signature.Signature, True, None, True), + ("type", "type", coding.Coding, False, None, True), + ]) + return js + + +class ContractTerm(backboneelement.BackboneElement): + """ Contract Term List. + + One or more Contract Provisions, which may be related and conveyed as a + group, and may contain nested groups. + """ + + resource_type = "ContractTerm" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ 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). """ + + self.identifier = None + """ Contract Term Number. + Type `Identifier` (represented as `dict` in JSON). """ + + self.issued = None + """ 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 + """ 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 + """ Term Statement. + Type `str`. """ + + 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). """ + + super(ContractTerm, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ContractTerm, self).elementProperties() + js.extend([ + ("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), + ("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), + ("topicCodeableConcept", "topicCodeableConcept", codeableconcept.CodeableConcept, False, "topic", False), + ("topicReference", "topicReference", fhirreference.FHIRReference, False, "topic", False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +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 = "ContractTermAction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.context = None + """ Episode associated with action. + Type `FHIRReference` (represented as `dict` in JSON). """ + + 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). """ + + 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(ContractTermAction, self).elementProperties() + js.extend([ + ("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 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) + + 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 = "ContractTermAsset" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 assets. + List of `ContractTermOfferAnswer` items (represented as `dict` in JSON). """ + + 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.securityLabelNumber = None + """ Asset restriction numbers. + List of `int` items. """ + + self.subtype = None + """ Asset sub-category. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.text = None + """ Asset clause or question text. + Type `str`. """ + + self.type = None + """ Asset category. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.typeReference = None + """ Associated entities. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.usePeriod = None + """ Time period. + List of `Period` items (represented as `dict` in JSON). """ + + self.valuedItem = None + """ Contract Valued Item List. + List of `ContractTermAssetValuedItem` items (represented as `dict` in JSON). """ + + super(ContractTermAsset, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ContractTermAsset, self).elementProperties() + js.extend([ + ("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 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 = "ContractTermAssetValuedItem" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.effectiveTime = None + """ Contract Valued Item Effective Tiem. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.entityCodeableConcept = None + """ Contract Valued Item Type. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.entityReference = None + """ Contract Valued Item Type. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.factor = None + """ Contract Valued Item Price Scaling Factor. + Type `float`. """ + + self.identifier = None + """ 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`. """ + + self.quantity = None + """ 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(ContractTermAssetValuedItem, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + 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: + attachment = sys.modules[__package__ + '.attachment'] +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 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'] +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/R4/contract_tests.py b/fhirclient/models/R4/contract_tests.py new file mode 100644 index 000000000..e9c412264 --- /dev/null +++ b/fhirclient/models/R4/contract_tests.py @@ -0,0 +1,353 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import contract +from .fhirdate import FHIRDate + + +class ContractTests(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("Contract", js["resourceType"]) + return contract.Contract(js) + + def testContract1(self): + inst = self.instantiate_from("pcd-example-notOrg.json") + self.assertIsNotNone(inst, "Must have instantiated a Contract instance") + self.implContract1(inst) + + js = inst.as_json() + self.assertEqual("Contract", js["resourceType"]) + inst2 = contract.Contract(js) + self.implContract1(inst2) + + def implContract1(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.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, "57016-8") + self.assertEqual(inst.type.coding[0].system, "http://loinc.org") + + def testContract2(self): + inst = self.instantiate_from("contract-example-ins-policy.json") + self.assertIsNotNone(inst, "Must have instantiated a Contract instance") + self.implContract2(inst) + + js = inst.as_json() + self.assertEqual("Contract", js["resourceType"]) + inst2 = contract.Contract(js) + self.implContract2(inst2) + + def implContract2(self, inst): + 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("contract-example-42cfr-part2.json") + self.assertIsNotNone(inst, "Must have instantiated a Contract instance") + self.implContract3(inst) + + js = inst.as_json() + self.assertEqual("Contract", js["resourceType"]) + inst2 = contract.Contract(js) + self.implContract3(inst2) + + def implContract3(self, inst): + 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, "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") + self.assertIsNotNone(inst, "Must have instantiated a Contract instance") + self.implContract4(inst) + + js = inst.as_json() + self.assertEqual("Contract", js["resourceType"]) + inst2 = contract.Contract(js) + self.implContract4(inst2) + + def implContract4(self, inst): + self.assertEqual(inst.friendly[0].contentAttachment.title, "The terms of the consent in friendly consumer speak.") + self.assertEqual(inst.id, "pcd-example-notLabs") + 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].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-notThem.json") + self.assertIsNotNone(inst, "Must have instantiated a Contract instance") + self.implContract5(inst) + + js = inst.as_json() + self.assertEqual("Contract", js["resourceType"]) + inst2 = contract.Contract(js) + self.implContract5(inst2) + + 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-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].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") + 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 testContract6(self): + inst = self.instantiate_from("pcd-example-notAuthor.json") + self.assertIsNotNone(inst, "Must have instantiated a Contract instance") + self.implContract6(inst) + + js = inst.as_json() + self.assertEqual("Contract", js["resourceType"]) + inst2 = contract.Contract(js) + self.implContract6(inst2) + + 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-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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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 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("contract-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Contract instance") + self.implContract7(inst) + + js = inst.as_json() + self.assertEqual("Contract", js["resourceType"]) + inst2 = contract.Contract(js) + 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].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") + 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") + diff --git a/fhirclient/models/R4/contributor.py b/fhirclient/models/R4/contributor.py new file mode 100644 index 000000000..395bad55f --- /dev/null +++ b/fhirclient/models/R4/contributor.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Contributor) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Contributor(element.Element): + """ Contributor information. + + A contributor to the content of a knowledge asset, including authors, + editors, reviewers, and endorsers. + """ + + resource_type = "Contributor" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 of the contributor. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.name = None + """ Who contributed the content. + Type `str`. """ + + self.type = None + """ author | editor | reviewer | endorser. + Type `str`. """ + + super(Contributor, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Contributor, self).elementProperties() + js.extend([ + ("contact", "contact", contactdetail.ContactDetail, True, None, False), + ("name", "name", str, False, None, True), + ("type", "type", str, False, None, True), + ]) + return js + + +import sys +try: + from . import contactdetail +except ImportError: + contactdetail = sys.modules[__package__ + '.contactdetail'] diff --git a/fhirclient/models/R4/count.py b/fhirclient/models/R4/count.py new file mode 100644 index 000000000..d4e5ba893 --- /dev/null +++ b/fhirclient/models/R4/count.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Count) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import quantity + +class Count(quantity.Quantity): + """ A measured or measurable amount. + + A measured amount (or an amount that can potentially be measured). Note + that measured amounts include amounts that are not precisely quantified, + including amounts involving arbitrary units and floating currencies. + """ + + resource_type = "Count" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + super(Count, self).__init__(jsondict=jsondict, strict=strict) + + diff --git a/fhirclient/models/R4/coverage.py b/fhirclient/models/R4/coverage.py new file mode 100644 index 000000000..bb85a663a --- /dev/null +++ b/fhirclient/models/R4/coverage.py @@ -0,0 +1,270 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Coverage) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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. Includes both insurance and self-payment. + """ + + resource_type = "Coverage" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.beneficiary = None + """ 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 (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.identifier = None + """ Business Identifier for the coverage. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.network = None + """ Insurer network. + Type `str`. """ + + self.order = None + """ Relative order of the coverage. + Type `int`. """ + + self.payor = None + """ Issuer of the policy. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.period = None + """ Coverage start and end dates. + Type `Period` (represented as `dict` in JSON). """ + + self.policyHolder = None + """ Owner of the policy. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.relationship = None + """ Beneficiary relationship to the subscriber. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + 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` (represented as `dict` in JSON). """ + + self.subscriberId = None + """ ID assigned to the subscriber. + Type `str`. """ + + self.type = None + """ Coverage category such as medical or accident. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(Coverage, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Coverage, self).elementProperties() + js.extend([ + ("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), + ("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, True), + ("period", "period", period.Period, False, None, False), + ("policyHolder", "policyHolder", fhirreference.FHIRReference, False, None, False), + ("relationship", "relationship", codeableconcept.CodeableConcept, 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), + ]) + return js + + +from . import backboneelement + +class CoverageClass(backboneelement.BackboneElement): + """ Additional coverage classifications. + + A suite of underwriter specific classifiers. + """ + + resource_type = "CoverageClass" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Human readable description of the type and value. + Type `str`. """ + + self.type = None + """ Type of class such as 'group' or 'plan'. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.value = None + """ Value associated with the type. + 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. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.exception = None + """ Exceptions for patient payments. + List of `CoverageCostToBeneficiaryException` items (represented as `dict` in JSON). """ + + self.type = None + """ Cost category. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueMoney = None + """ The amount or percentage due from the beneficiary. + Type `Money` (represented as `dict` in JSON). """ + + self.valueQuantity = None + """ The amount or percentage due from the beneficiary. + Type `Quantity` (represented as `dict` in JSON). """ + + 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. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 effective period of the exception. + Type `Period` (represented as `dict` in JSON). """ + + 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(CoverageCostToBeneficiaryException, self).elementProperties() + js.extend([ + ("period", "period", period.Period, 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 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/R4/coverage_tests.py b/fhirclient/models/R4/coverage_tests.py new file mode 100644 index 000000000..6a2e8f73d --- /dev/null +++ b/fhirclient/models/R4/coverage_tests.py @@ -0,0 +1,198 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import coverage +from .fhirdate import FHIRDate + + +class CoverageTests(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("Coverage", js["resourceType"]) + return coverage.Coverage(js) + + def testCoverage1(self): + inst = self.instantiate_from("coverage-example-2.json") + self.assertIsNotNone(inst, "Must have instantiated a Coverage instance") + self.implCoverage1(inst) + + js = inst.as_json() + self.assertEqual("Coverage", js["resourceType"]) + inst2 = coverage.Coverage(js) + 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.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) + self.assertEqual(inst.period.end.as_json(), "2012-03-17") + self.assertEqual(inst.period.start.date, FHIRDate("2011-03-17").date) + self.assertEqual(inst.period.start.as_json(), "2011-03-17") + self.assertEqual(inst.relationship.coding[0].code, "self") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.subscriberId, "AB9876") + 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://terminology.hl7.org/CodeSystem/v3-ActCode") + + def testCoverage2(self): + inst = self.instantiate_from("coverage-example-selfpay.json") + self.assertIsNotNone(inst, "Must have instantiated a Coverage instance") + self.implCoverage2(inst) + + js = inst.as_json() + self.assertEqual("Coverage", js["resourceType"]) + inst2 = coverage.Coverage(js) + self.implCoverage2(inst2) + + def implCoverage2(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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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.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://terminology.hl7.org/CodeSystem/coverage-selfpay") + + def testCoverage3(self): + inst = self.instantiate_from("coverage-example-ehic.json") + self.assertIsNotNone(inst, "Must have instantiated a Coverage instance") + self.implCoverage3(inst) + + js = inst.as_json() + self.assertEqual("Coverage", js["resourceType"]) + inst2 = coverage.Coverage(js) + self.implCoverage3(inst2) + + def implCoverage3(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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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.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://terminology.hl7.org/CodeSystem/v3-ActCode") + + def testCoverage4(self): + inst = self.instantiate_from("coverage-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Coverage instance") + self.implCoverage4(inst) + + js = inst.as_json() + self.assertEqual("Coverage", js["resourceType"]) + inst2 = coverage.Coverage(js) + 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.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.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://terminology.hl7.org/CodeSystem/v3-ActCode") + diff --git a/fhirclient/models/coverageeligibilityrequest.py b/fhirclient/models/R4/coverageeligibilityrequest.py similarity index 99% rename from fhirclient/models/coverageeligibilityrequest.py rename to fhirclient/models/R4/coverageeligibilityrequest.py index f0a0fd213..a864a8626 100644 --- a/fhirclient/models/coverageeligibilityrequest.py +++ b/fhirclient/models/R4/coverageeligibilityrequest.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/CoverageEligibilityRequest) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/CoverageEligibilityRequest) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/coverageeligibilityrequest_tests.py b/fhirclient/models/R4/coverageeligibilityrequest_tests.py similarity index 97% rename from fhirclient/models/coverageeligibilityrequest_tests.py rename to fhirclient/models/R4/coverageeligibilityrequest_tests.py index a5cad2454..2c6f59131 100644 --- a/fhirclient/models/coverageeligibilityrequest_tests.py +++ b/fhirclient/models/R4/coverageeligibilityrequest_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/coverageeligibilityresponse.py b/fhirclient/models/R4/coverageeligibilityresponse.py similarity index 99% rename from fhirclient/models/coverageeligibilityresponse.py rename to fhirclient/models/R4/coverageeligibilityresponse.py index 25d924cd4..c1a25e8fd 100644 --- a/fhirclient/models/coverageeligibilityresponse.py +++ b/fhirclient/models/R4/coverageeligibilityresponse.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/CoverageEligibilityResponse) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/CoverageEligibilityResponse) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/coverageeligibilityresponse_tests.py b/fhirclient/models/R4/coverageeligibilityresponse_tests.py similarity index 99% rename from fhirclient/models/coverageeligibilityresponse_tests.py rename to fhirclient/models/R4/coverageeligibilityresponse_tests.py index 4bf387ecb..0e87a66c9 100644 --- a/fhirclient/models/coverageeligibilityresponse_tests.py +++ b/fhirclient/models/R4/coverageeligibilityresponse_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/R4/datarequirement.py b/fhirclient/models/R4/datarequirement.py new file mode 100644 index 000000000..4f6865055 --- /dev/null +++ b/fhirclient/models/R4/datarequirement.py @@ -0,0 +1,243 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/DataRequirement) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class DataRequirement(element.Element): + """ Describes a required data item. + + Describes a required data item for evaluation in terms of the type of data, + and optional code or date-based filters of the data. + """ + + resource_type = "DataRequirement" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.codeFilter = None + """ What codes are expected. + List of `DataRequirementCodeFilter` items (represented as `dict` in JSON). """ + + self.dateFilter = None + """ 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 specific structure elements that are referenced by the + knowledge module. + List of `str` items. """ + + self.profile = None + """ 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`. """ + + super(DataRequirement, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DataRequirement, self).elementProperties() + 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 + + +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. Each code + filter defines an additional constraint on the data, i.e. code filters are + AND'ed, not OR'ed. + """ + + resource_type = "DataRequirementCodeFilter" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 code is expected. + List of `Coding` items (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.valueSet = None + """ Valueset for the filter. + Type `str`. """ + + super(DataRequirementCodeFilter, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DataRequirementCodeFilter, self).elementProperties() + js.extend([ + ("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 + + +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. Each date filter specifies an + additional constraint on the data, i.e. date filters are AND'ed, not OR'ed. + """ + + resource_type = "DataRequirementDateFilter" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.path = None + """ A date-valued attribute to filter on. + Type `str`. """ + + self.searchParam = None + """ A date valued parameter to search on. + Type `str`. """ + + self.valueDateTime = None + """ The value of the filter, as a Period, DateTime, or Duration value. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueDuration = None + """ The value of the filter, as a Period, DateTime, or Duration value. + Type `Duration` (represented as `dict` in JSON). """ + + self.valuePeriod = None + """ The value of the filter, as a Period, DateTime, or Duration value. + Type `Period` (represented as `dict` in JSON). """ + + super(DataRequirementDateFilter, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DataRequirementDateFilter, self).elementProperties() + js.extend([ + ("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), + ]) + 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 +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 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: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/R4/detectedissue.py b/fhirclient/models/R4/detectedissue.py new file mode 100644 index 000000000..dc40d1954 --- /dev/null +++ b/fhirclient/models/R4/detectedissue.py @@ -0,0 +1,204 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/DetectedIssue) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class DetectedIssue(domainresource.DomainResource): + """ Clinical issue with action. + + Indicates an actual or potential clinical issue with or between one or more + active or proposed clinical actions for a patient; e.g. Drug-drug + interaction, Ineffective treatment frequency, Procedure-condition conflict, + etc. + """ + + resource_type = "DetectedIssue" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ The provider or device that identified the issue. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.code = None + """ Issue Category, e.g. drug-drug, duplicate therapy, etc.. + Type `CodeableConcept` (represented as `dict` 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. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.implicated = None + """ Problem resource. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.mitigation = None + """ Step taken to address. + List of `DetectedIssueMitigation` items (represented as `dict` in JSON). """ + + self.patient = None + """ Associated patient. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.reference = None + """ Authority for issue. + Type `str`. """ + + self.severity = None + """ high | moderate | low. + Type `str`. """ + + self.status = None + """ registered | preliminary | final | amended +. + Type `str`. """ + + super(DetectedIssue, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DetectedIssue, self).elementProperties() + js.extend([ + ("author", "author", fhirreference.FHIRReference, False, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("detail", "detail", str, 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), + ("reference", "reference", str, False, None, False), + ("severity", "severity", str, False, None, False), + ("status", "status", str, False, None, True), + ]) + return js + + +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 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. + """ + + resource_type = "DetectedIssueMitigation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ What mitigation?. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.author = None + """ Who is committing?. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.date = None + """ Date committed. + Type `FHIRDate` (represented as `str` in JSON). """ + + super(DetectedIssueMitigation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DetectedIssueMitigation, self).elementProperties() + js.extend([ + ("action", "action", codeableconcept.CodeableConcept, False, None, True), + ("author", "author", fhirreference.FHIRReference, False, None, False), + ("date", "date", fhirdate.FHIRDate, 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/R4/detectedissue_tests.py b/fhirclient/models/R4/detectedissue_tests.py new file mode 100644 index 000000000..5caf91626 --- /dev/null +++ b/fhirclient/models/R4/detectedissue_tests.py @@ -0,0 +1,119 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import detectedissue +from .fhirdate import FHIRDate + + +class DetectedIssueTests(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("DetectedIssue", js["resourceType"]) + return detectedissue.DetectedIssue(js) + + def testDetectedIssue1(self): + inst = self.instantiate_from("detectedissue-example-allergy.json") + self.assertIsNotNone(inst, "Must have instantiated a DetectedIssue instance") + self.implDetectedIssue1(inst) + + js = inst.as_json() + self.assertEqual("DetectedIssue", js["resourceType"]) + inst2 = detectedissue.DetectedIssue(js) + self.implDetectedIssue1(inst2) + + 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") + + def testDetectedIssue2(self): + inst = self.instantiate_from("detectedissue-example-dup.json") + self.assertIsNotNone(inst, "Must have instantiated a DetectedIssue instance") + self.implDetectedIssue2(inst) + + js = inst.as_json() + self.assertEqual("DetectedIssue", js["resourceType"]) + inst2 = detectedissue.DetectedIssue(js) + self.implDetectedIssue2(inst2) + + def implDetectedIssue2(self, inst): + 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.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.json") + self.assertIsNotNone(inst, "Must have instantiated a DetectedIssue instance") + self.implDetectedIssue3(inst) + + js = inst.as_json() + self.assertEqual("DetectedIssue", js["resourceType"]) + inst2 = detectedissue.DetectedIssue(js) + self.implDetectedIssue3(inst2) + + def implDetectedIssue3(self, inst): + 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.status, "generated") + + def testDetectedIssue4(self): + inst = self.instantiate_from("detectedissue-example-lab.json") + self.assertIsNotNone(inst, "Must have instantiated a DetectedIssue instance") + self.implDetectedIssue4(inst) + + js = inst.as_json() + self.assertEqual("DetectedIssue", js["resourceType"]) + inst2 = detectedissue.DetectedIssue(js) + self.implDetectedIssue4(inst2) + + def implDetectedIssue4(self, inst): + 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/R4/device.py b/fhirclient/models/R4/device.py new file mode 100644 index 000000000..2565500a2 --- /dev/null +++ b/fhirclient/models/R4/device.py @@ -0,0 +1,411 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Device) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Device(domainresource.DomainResource): + """ Item used in healthcare. + + 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ 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). """ + + self.identifier = None + """ Instance identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.location = None + """ Where the device is found. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.lotNumber = None + """ Lot number of manufacture. + Type `str`. """ + + self.manufactureDate = None + """ Date when the device was made. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.manufacturer = None + """ Name of device manufacturer. + Type `str`. """ + + 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.owner = None + """ Organization responsible for device. + 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` (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 + """ The kind or type of device. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.udiCarrier = None + """ Unique Device Identifier (UDI) Barcode string. + List of `DeviceUdiCarrier` items (represented as `dict` in JSON). """ + + self.url = None + """ Network address to contact device. + Type `str`. """ + + self.version = None + """ 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) + + 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), + ("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), + ("udiCarrier", "udiCarrier", DeviceUdiCarrier, True, None, False), + ("url", "url", str, False, None, False), + ("version", "version", DeviceVersion, True, None, False), + ]) + return js + + +from . import 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) 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 = "DeviceUdiCarrier" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.carrierAIDC = None + """ UDI Machine Readable Barcode String. + Type `str`. """ + + self.carrierHRF = None + """ UDI Human Readable Barcode String. + Type `str`. """ + + self.deviceIdentifier = None + """ Mandatory fixed portion of UDI. + Type `str`. """ + + self.entryType = None + """ barcode | rfid | manual +. + Type `str`. """ + + self.issuer = None + """ UDI Issuing Organization. + Type `str`. """ + + self.jurisdiction = None + """ Regional UDI authority. + Type `str`. """ + + super(DeviceUdiCarrier, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DeviceUdiCarrier, self).elementProperties() + js.extend([ + ("carrierAIDC", "carrierAIDC", str, False, None, False), + ("carrierHRF", "carrierHRF", str, False, None, False), + ("deviceIdentifier", "deviceIdentifier", str, False, None, False), + ("entryType", "entryType", str, False, None, False), + ("issuer", "issuer", str, False, None, False), + ("jurisdiction", "jurisdiction", 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 + + +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 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'] diff --git a/fhirclient/models/R4/device_tests.py b/fhirclient/models/R4/device_tests.py new file mode 100644 index 000000000..d295140af --- /dev/null +++ b/fhirclient/models/R4/device_tests.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import device +from .fhirdate import FHIRDate + + +class DeviceTests(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("Device", js["resourceType"]) + return device.Device(js) + + def testDevice1(self): + inst = self.instantiate_from("device-example-f001-feedingtube.json") + self.assertIsNotNone(inst, "Must have instantiated a Device instance") + self.implDevice1(inst) + + js = inst.as_json() + self.assertEqual("Device", js["resourceType"]) + inst2 = device.Device(js) + self.implDevice1(inst2) + + def implDevice1(self, inst): + 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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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") + + def testDevice2(self): + inst = self.instantiate_from("device-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Device instance") + self.implDevice2(inst) + + js = inst.as_json() + self.assertEqual("Device", js["resourceType"]) + inst2 = device.Device(js) + self.implDevice2(inst2) + + def implDevice2(self, inst): + 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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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") + diff --git a/fhirclient/models/devicedefinition.py b/fhirclient/models/R4/devicedefinition.py similarity index 99% rename from fhirclient/models/devicedefinition.py rename to fhirclient/models/R4/devicedefinition.py index 9c645a284..d81bf4a47 100644 --- a/fhirclient/models/devicedefinition.py +++ b/fhirclient/models/R4/devicedefinition.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/DeviceDefinition) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/DeviceDefinition) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/devicedefinition_tests.py b/fhirclient/models/R4/devicedefinition_tests.py similarity index 94% rename from fhirclient/models/devicedefinition_tests.py rename to fhirclient/models/R4/devicedefinition_tests.py index 2d8ec40b6..59389fbc5 100644 --- a/fhirclient/models/devicedefinition_tests.py +++ b/fhirclient/models/R4/devicedefinition_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/R4/devicemetric.py b/fhirclient/models/R4/devicemetric.py new file mode 100644 index 000000000..ad4a1d546 --- /dev/null +++ b/fhirclient/models/R4/devicemetric.py @@ -0,0 +1,148 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/DeviceMetric) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class DeviceMetric(domainresource.DomainResource): + """ Measurement, calculation or setting capability of a medical device. + + Describes a measurement, calculation or setting capability of a medical + device. + """ + + resource_type = "DeviceMetric" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.calibration = None + """ Describes the calibrations that have been performed or that are + required to be performed. + List of `DeviceMetricCalibration` items (represented as `dict` in JSON). """ + + self.category = None + """ measurement | setting | calculation | unspecified. + Type `str`. """ + + self.color = None + """ black | red | green | yellow | blue | magenta | cyan | white. + Type `str`. """ + + self.identifier = None + """ Instance identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.measurementPeriod = None + """ Describes the measurement repetition time. + Type `Timing` (represented as `dict` in JSON). """ + + self.operationalStatus = None + """ on | off | standby | entered-in-error. + Type `str`. """ + + self.parent = None + """ 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` (represented as `dict` in JSON). """ + + self.type = None + """ Identity of metric, for example Heart Rate or PEEP Setting. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.unit = None + """ Unit of Measure for the Metric. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(DeviceMetric, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DeviceMetric, self).elementProperties() + js.extend([ + ("calibration", "calibration", DeviceMetricCalibration, True, None, False), + ("category", "category", str, False, None, True), + ("color", "color", str, False, None, False), + ("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), + ("source", "source", fhirreference.FHIRReference, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ("unit", "unit", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import backboneelement + +class DeviceMetricCalibration(backboneelement.BackboneElement): + """ Describes the calibrations that have been performed or that are required to + be performed. + """ + + resource_type = "DeviceMetricCalibration" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.state = None + """ not-calibrated | calibration-required | calibrated | unspecified. + Type `str`. """ + + self.time = None + """ Describes the time last calibration has been performed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.type = None + """ unspecified | offset | gain | two-point. + Type `str`. """ + + super(DeviceMetricCalibration, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DeviceMetricCalibration, self).elementProperties() + js.extend([ + ("state", "state", str, False, None, False), + ("time", "time", fhirdate.FHIRDate, 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 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 timing +except ImportError: + timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/R4/devicemetric_tests.py b/fhirclient/models/R4/devicemetric_tests.py new file mode 100644 index 000000000..1c89d726c --- /dev/null +++ b/fhirclient/models/R4/devicemetric_tests.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import devicemetric +from .fhirdate import FHIRDate + + +class DeviceMetricTests(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("DeviceMetric", js["resourceType"]) + return devicemetric.DeviceMetric(js) + + def testDeviceMetric1(self): + inst = self.instantiate_from("devicemetric-example.json") + self.assertIsNotNone(inst, "Must have instantiated a DeviceMetric instance") + self.implDeviceMetric1(inst) + + js = inst.as_json() + self.assertEqual("DeviceMetric", js["resourceType"]) + inst2 = devicemetric.DeviceMetric(js) + self.implDeviceMetric1(inst2) + + def implDeviceMetric1(self, inst): + self.assertEqual(inst.calibration[0].state, "calibrated") + self.assertEqual(inst.calibration[0].time.date, FHIRDate("2016-12-28T09:03:04-05:00").date) + self.assertEqual(inst.calibration[0].time.as_json(), "2016-12-28T09:03:04-05:00") + self.assertEqual(inst.calibration[0].type, "two-point") + self.assertEqual(inst.category, "measurement") + self.assertEqual(inst.color, "blue") + self.assertEqual(inst.id, "example") + 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, "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, "urn:iso:std:iso:11073:10101") + diff --git a/fhirclient/models/R4/devicerequest.py b/fhirclient/models/R4/devicerequest.py new file mode 100644 index 000000000..0bb29d0f8 --- /dev/null +++ b/fhirclient/models/R4/devicerequest.py @@ -0,0 +1,263 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/DeviceRequest) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class DeviceRequest(domainresource.DomainResource): + """ Medical device request. + + Represents a request for a patient to employ a medical device. The device + may be an implantable device, or an external assistive device, such as a + walker. + """ + + resource_type = "DeviceRequest" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ When recorded. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.basedOn = None + """ What request fulfills. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.codeCodeableConcept = None + """ Device requested. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.codeReference = None + """ Device requested. + Type `FHIRReference` (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. + Type `Identifier` (represented as `dict` in JSON). """ + + self.identifier = None + """ 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 `str`. """ + + self.note = None + """ Notes or comments. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.occurrenceDateTime = None + """ Desired time or schedule for use. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.occurrencePeriod = None + """ Desired time or schedule for use. + Type `Period` (represented as `dict` in JSON). """ + + self.occurrenceTiming = None + """ 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` (represented as `dict` in JSON). """ + + self.performerType = None + """ Filler role. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.priorRequest = None + """ What request replaces. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.priority = None + """ Indicates how quickly the {{title}} should be addressed with + respect to other requests. + Type `str`. """ + + self.reasonCode = None + """ Coded Reason for request. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.reasonReference = None + """ Linked Reason for request. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.relevantHistory = None + """ Request provenance. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.requester = None + """ Who/what is requesting diagnostics. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.status = None + """ draft | active | suspended | completed | entered-in-error | + cancelled. + Type `str`. """ + + self.subject = None + """ Focus of request. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.supportingInfo = None + """ Additional clinical information. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + super(DeviceRequest, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DeviceRequest, self).elementProperties() + js.extend([ + ("authoredOn", "authoredOn", fhirdate.FHIRDate, False, None, False), + ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), + ("codeCodeableConcept", "codeCodeableConcept", codeableconcept.CodeableConcept, False, "code", True), + ("codeReference", "codeReference", fhirreference.FHIRReference, False, "code", True), + ("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), + ("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), + ("priority", "priority", str, False, None, False), + ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), + ("reasonReference", "reasonReference", fhirreference.FHIRReference, True, None, False), + ("relevantHistory", "relevantHistory", fhirreference.FHIRReference, True, 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), + ]) + return js + + +from . import backboneelement + +class DeviceRequestParameter(backboneelement.BackboneElement): + """ Device details. + + Specific parameters for the ordered item. For example, the prism value for + lenses. + """ + + resource_type = "DeviceRequestParameter" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ 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.valueRange = None + """ Value of detail. + Type `Range` (represented as `dict` in JSON). """ + + super(DeviceRequestParameter, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DeviceRequestParameter, self).elementProperties() + js.extend([ + ("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 + + +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'] +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: + timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/R4/devicerequest_tests.py b/fhirclient/models/R4/devicerequest_tests.py new file mode 100644 index 000000000..2994ada0d --- /dev/null +++ b/fhirclient/models/R4/devicerequest_tests.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import devicerequest +from .fhirdate import FHIRDate + + +class DeviceRequestTests(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("DeviceRequest", js["resourceType"]) + return devicerequest.DeviceRequest(js) + + def testDeviceRequest1(self): + inst = self.instantiate_from("devicerequest-example-insulinpump.json") + self.assertIsNotNone(inst, "Must have instantiated a DeviceRequest instance") + self.implDeviceRequest1(inst) + + js = inst.as_json() + self.assertEqual("DeviceRequest", js["resourceType"]) + inst2 = devicerequest.DeviceRequest(js) + self.implDeviceRequest1(inst2) + + def implDeviceRequest1(self, inst): + self.assertEqual(inst.authoredOn.date, FHIRDate("2013-05-08T09:33:27+07:00").date) + self.assertEqual(inst.authoredOn.as_json(), "2013-05-08T09:33:27+07:00") + self.assertEqual(inst.codeCodeableConcept.coding[0].code, "43148-6") + self.assertEqual(inst.codeCodeableConcept.coding[0].system, "http://loinc.org") + self.assertEqual(inst.codeCodeableConcept.text, "Insulin delivery device panel") + self.assertEqual(inst.groupIdentifier.value, "ip_request1") + self.assertEqual(inst.id, "insulinpump") + self.assertEqual(inst.identifier[0].value, "ip_request1.1") + 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") + self.assertEqual(inst.performerType.coding[0].display, "Qualified nurse") + self.assertEqual(inst.performerType.text, "Nurse") + self.assertEqual(inst.priority, "routine") + self.assertEqual(inst.reasonCode[0].text, "gastroparesis") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + + def testDeviceRequest2(self): + inst = self.instantiate_from("devicerequest-example.json") + self.assertIsNotNone(inst, "Must have instantiated a DeviceRequest instance") + self.implDeviceRequest2(inst) + + js = inst.as_json() + self.assertEqual("DeviceRequest", js["resourceType"]) + inst2 = devicerequest.DeviceRequest(js) + self.implDeviceRequest2(inst2) + + def implDeviceRequest2(self, inst): + self.assertEqual(inst.id, "example") + 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/R4/deviceusestatement.py b/fhirclient/models/R4/deviceusestatement.py new file mode 100644 index 000000000..f563daa93 --- /dev/null +++ b/fhirclient/models/R4/deviceusestatement.py @@ -0,0 +1,139 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/DeviceUseStatement) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class DeviceUseStatement(domainresource.DomainResource): + """ Record of use of a device. + + A record of a device being used by a patient where the record is the result + of a report from the patient or another clinician. + """ + + resource_type = "DeviceUseStatement" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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` (represented as `dict` in JSON). """ + + self.identifier = None + """ External identifier for this record. + List of `Identifier` 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` (represented as `dict` in JSON). """ + + self.status = None + """ active | completed | entered-in-error +. + Type `str`. """ + + self.subject = None + """ Patient using device. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.timingDateTime = None + """ How often the device was used. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.timingPeriod = None + """ How often the device was used. + Type `Period` (represented as `dict` in JSON). """ + + self.timingTiming = None + """ How often the device was used. + Type `Timing` (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), + ("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), + ("subject", "subject", fhirreference.FHIRReference, False, None, True), + ("timingDateTime", "timingDateTime", fhirdate.FHIRDate, False, "timing", False), + ("timingPeriod", "timingPeriod", period.Period, False, "timing", False), + ("timingTiming", "timingTiming", timing.Timing, False, "timing", 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'] +try: + from . import timing +except ImportError: + timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/R4/deviceusestatement_tests.py b/fhirclient/models/R4/deviceusestatement_tests.py new file mode 100644 index 000000000..3fbcfd6cf --- /dev/null +++ b/fhirclient/models/R4/deviceusestatement_tests.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import deviceusestatement +from .fhirdate import FHIRDate + + +class DeviceUseStatementTests(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("DeviceUseStatement", js["resourceType"]) + return deviceusestatement.DeviceUseStatement(js) + + def testDeviceUseStatement1(self): + inst = self.instantiate_from("deviceusestatement-example.json") + self.assertIsNotNone(inst, "Must have instantiated a DeviceUseStatement instance") + self.implDeviceUseStatement1(inst) + + js = inst.as_json() + self.assertEqual("DeviceUseStatement", js["resourceType"]) + inst2 = deviceusestatement.DeviceUseStatement(js) + self.implDeviceUseStatement1(inst2) + + 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/R4/diagnosticreport.py b/fhirclient/models/R4/diagnosticreport.py new file mode 100644 index 000000000..fdcef7089 --- /dev/null +++ b/fhirclient/models/R4/diagnosticreport.py @@ -0,0 +1,199 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/DiagnosticReport) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class DiagnosticReport(domainresource.DomainResource): + """ A Diagnostic report - a combination of request information, atomic results, + images, interpretation, as well as formatted reports. + + The findings and interpretation of diagnostic tests performed on patients, + groups of patients, devices, and locations, and/or specimens derived from + these. The report includes clinical context such as requesting and provider + information, and some mix of atomic results, images, textual and coded + interpretations, and formatted representation of diagnostic reports. + """ + + resource_type = "DiagnosticReport" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.basedOn = None + """ What was requested. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.category = None + """ Service category. + 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.conclusion = None + """ Clinical conclusion (interpretation) of test results. + Type `str`. """ + + 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. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.effectivePeriod = None + """ 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.imagingStudy = None + """ Reference to full details of imaging associated with the diagnostic + report. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.issued = None + """ 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 + """ 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. + 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 (represented as `dict` in JSON). """ + + self.status = None + """ registered | partial | preliminary | final +. + Type `str`. """ + + self.subject = None + """ The subject of the report - usually, but not always, the patient. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(DiagnosticReport, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DiagnosticReport, self).elementProperties() + js.extend([ + ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), + ("category", "category", codeableconcept.CodeableConcept, True, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("conclusion", "conclusion", str, 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), + ("imagingStudy", "imagingStudy", fhirreference.FHIRReference, True, None, False), + ("issued", "issued", fhirdate.FHIRDate, False, 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), + ]) + return js + + +from . import backboneelement + +class DiagnosticReportMedia(backboneelement.BackboneElement): + """ Key images associated with this report. + + A list of key images associated with this report. The images are generally + created during the diagnostic process, and may be directly of the patient, + or of treated specimens (i.e. slides of interest). + """ + + resource_type = "DiagnosticReportMedia" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Comment about the image (e.g. explanation). + Type `str`. """ + + self.link = None + """ Reference to the image source. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(DiagnosticReportMedia, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DiagnosticReportMedia, self).elementProperties() + js.extend([ + ("comment", "comment", str, False, None, False), + ("link", "link", fhirreference.FHIRReference, False, None, True), + ]) + 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 period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/R4/diagnosticreport_tests.py b/fhirclient/models/R4/diagnosticreport_tests.py new file mode 100644 index 000000000..0612c5161 --- /dev/null +++ b/fhirclient/models/R4/diagnosticreport_tests.py @@ -0,0 +1,211 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import diagnosticreport +from .fhirdate import FHIRDate + + +class DiagnosticReportTests(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("DiagnosticReport", js["resourceType"]) + return diagnosticreport.DiagnosticReport(js) + + def testDiagnosticReport1(self): + inst = self.instantiate_from("diagnosticreport-example-ultrasound.json") + self.assertIsNotNone(inst, "Must have instantiated a DiagnosticReport instance") + self.implDiagnosticReport1(inst) + + js = inst.as_json() + self.assertEqual("DiagnosticReport", js["resourceType"]) + inst2 = diagnosticreport.DiagnosticReport(js) + self.implDiagnosticReport1(inst2) + + def implDiagnosticReport1(self, inst): + 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-f201-brainct.json") + self.assertIsNotNone(inst, "Must have instantiated a DiagnosticReport instance") + self.implDiagnosticReport2(inst) + + js = inst.as_json() + self.assertEqual("DiagnosticReport", js["resourceType"]) + inst2 = diagnosticreport.DiagnosticReport(js) + self.implDiagnosticReport2(inst2) + + def implDiagnosticReport2(self, inst): + 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.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 testDiagnosticReport3(self): + inst = self.instantiate_from("diagnosticreport-example-papsmear.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.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, "additional") + + def testDiagnosticReport4(self): + inst = self.instantiate_from("diagnosticreport-example-gingival-mass.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[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") + self.assertEqual(inst.code.text, "Biopsy without Microscopic Description (1 Site/Lesion)-Standard") + self.assertEqual(inst.effectiveDateTime.date, FHIRDate("2017-03-02").date) + self.assertEqual(inst.effectiveDateTime.as_json(), "2017-03-02") + self.assertEqual(inst.id, "gingival-mass") + self.assertEqual(inst.identifier[0].system, "https://www.acmeonline.com") + 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 testDiagnosticReport5(self): + inst = self.instantiate_from("diagnosticreport-example-pgx.json") + self.assertIsNotNone(inst, "Must have instantiated a DiagnosticReport instance") + self.implDiagnosticReport5(inst) + + js = inst.as_json() + self.assertEqual("DiagnosticReport", js["resourceType"]) + inst2 = diagnosticreport.DiagnosticReport(js) + self.implDiagnosticReport5(inst2) + + 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") + self.assertEqual(inst.code.text, "Pharmacogenetics Report") + self.assertEqual(inst.effectiveDateTime.date, FHIRDate("2016-10-15T12:34:56+11:00").date) + self.assertEqual(inst.effectiveDateTime.as_json(), "2016-10-15T12:34:56+11:00") + 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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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=") + self.assertEqual(inst.presentedForm[0].hash, "571ef9c5655840f324e679072ed62b1b95eef8a0") + self.assertEqual(inst.presentedForm[0].language, "en") + self.assertEqual(inst.presentedForm[0].title, "Pharmacogenetics Report") + self.assertEqual(inst.status, "final") + self.assertEqual(inst.text.status, "generated") + + def testDiagnosticReport6(self): + inst = self.instantiate_from("diagnosticreport-example-dxa.json") + self.assertIsNotNone(inst, "Must have instantiated a DiagnosticReport instance") + self.implDiagnosticReport6(inst) + + js = inst.as_json() + self.assertEqual("DiagnosticReport", js["resourceType"]) + inst2 = diagnosticreport.DiagnosticReport(js) + self.implDiagnosticReport6(inst2) + + 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/R4/distance.py b/fhirclient/models/R4/distance.py new file mode 100644 index 000000000..fd25959f9 --- /dev/null +++ b/fhirclient/models/R4/distance.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Distance) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import quantity + +class Distance(quantity.Quantity): + """ A length - a value with a unit that is a physical distance. + """ + + resource_type = "Distance" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + super(Distance, self).__init__(jsondict=jsondict, strict=strict) + + diff --git a/fhirclient/models/R4/documentmanifest.py b/fhirclient/models/R4/documentmanifest.py new file mode 100644 index 000000000..d97a51da4 --- /dev/null +++ b/fhirclient/models/R4/documentmanifest.py @@ -0,0 +1,149 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/DocumentManifest) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class DocumentManifest(domainresource.DomainResource): + """ A list that defines a set of documents. + + A collection of documents compiled for a purpose together with metadata + that applies to the collection. + """ + + resource_type = "DocumentManifest" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Who and/or what authored the DocumentManifest. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.content = None + """ Items in manifest. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.created = None + """ When this document manifest created. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Human-readable description (title). + Type `str`. """ + + self.identifier = None + """ Other identifiers for the manifest. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.masterIdentifier = None + """ Unique Identifier for the set of documents. + Type `Identifier` (represented as `dict` in JSON). """ + + self.recipient = None + """ Intended to get notified about this set of documents. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.related = None + """ Related things. + List of `DocumentManifestRelated` items (represented as `dict` in JSON). """ + + self.source = None + """ The source system/application/software. + Type `str`. """ + + self.status = None + """ current | superseded | entered-in-error. + Type `str`. """ + + self.subject = None + """ The subject of the set of documents. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.type = None + """ Kind of document set. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(DocumentManifest, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DocumentManifest, self).elementProperties() + js.extend([ + ("author", "author", fhirreference.FHIRReference, True, None, False), + ("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), + ("masterIdentifier", "masterIdentifier", identifier.Identifier, False, None, False), + ("recipient", "recipient", fhirreference.FHIRReference, True, None, False), + ("related", "related", DocumentManifestRelated, True, None, False), + ("source", "source", str, False, None, False), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import backboneelement + +class DocumentManifestRelated(backboneelement.BackboneElement): + """ Related things. + + Related identifiers or resources associated with the DocumentManifest. + """ + + resource_type = "DocumentManifestRelated" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Identifiers of things that are related. + Type `Identifier` (represented as `dict` in JSON). """ + + self.ref = None + """ Related Resource. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(DocumentManifestRelated, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DocumentManifestRelated, self).elementProperties() + js.extend([ + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("ref", "ref", fhirreference.FHIRReference, 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/R4/documentmanifest_tests.py b/fhirclient/models/R4/documentmanifest_tests.py new file mode 100644 index 000000000..3e79f6cae --- /dev/null +++ b/fhirclient/models/R4/documentmanifest_tests.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import documentmanifest +from .fhirdate import FHIRDate + + +class DocumentManifestTests(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("DocumentManifest", js["resourceType"]) + return documentmanifest.DocumentManifest(js) + + def testDocumentManifest1(self): + inst = self.instantiate_from("documentmanifest-example.json") + self.assertIsNotNone(inst, "Must have instantiated a DocumentManifest instance") + self.implDocumentManifest1(inst) + + js = inst.as_json() + self.assertEqual("DocumentManifest", js["resourceType"]) + inst2 = documentmanifest.DocumentManifest(js) + self.implDocumentManifest1(inst2) + + def implDocumentManifest1(self, inst): + self.assertEqual(inst.contained[0].id, "a1") + self.assertEqual(inst.created.date, FHIRDate("2004-12-25T23:50:50-05:00").date) + self.assertEqual(inst.created.as_json(), "2004-12-25T23:50:50-05:00") + self.assertEqual(inst.description, "Physical") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier[0].system, "http://example.org/documents") + 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") + self.assertEqual(inst.status, "current") + self.assertEqual(inst.text.div, "
Text
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.text, "History and Physical") + diff --git a/fhirclient/models/R4/documentreference.py b/fhirclient/models/R4/documentreference.py new file mode 100644 index 000000000..de6a1ea06 --- /dev/null +++ b/fhirclient/models/R4/documentreference.py @@ -0,0 +1,282 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/DocumentReference) on 2019-10-12. +# 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.authenticator = None + """ Who/what authenticated the document. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.author = None + """ Who and/or what authored the document. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.category = None + """ Categorization of document. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.content = None + """ Document referenced. + List of `DocumentReferenceContent` items (represented as `dict` in JSON). """ + + self.context = None + """ Clinical context of document. + Type `DocumentReferenceContext` (represented as `dict` in JSON). """ + + self.custodian = None + """ Organization which maintains the document. + 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. + Type `str`. """ + + self.docStatus = None + """ preliminary | final | appended | amended | entered-in-error. + Type `str`. """ + + self.identifier = None + """ Other identifiers for the document. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.masterIdentifier = None + """ Master Version Specific Identifier. + Type `Identifier` (represented as `dict` in JSON). """ + + self.relatesTo = None + """ Relationships to other documents. + List of `DocumentReferenceRelatesTo` items (represented as `dict` in JSON). """ + + self.securityLabel = None + """ Document security-tags. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.status = None + """ current | superseded | entered-in-error. + Type `str`. """ + + self.subject = None + """ Who/what is the subject of the document. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.type = None + """ Kind of document (LOINC if possible). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(DocumentReference, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DocumentReference, self).elementProperties() + js.extend([ + ("authenticator", "authenticator", fhirreference.FHIRReference, False, None, False), + ("author", "author", fhirreference.FHIRReference, True, None, False), + ("category", "category", codeableconcept.CodeableConcept, True, None, False), + ("content", "content", DocumentReferenceContent, True, None, True), + ("context", "context", DocumentReferenceContext, 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), + ("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, False), + ]) + return js + + +from . import backboneelement + +class DocumentReferenceContent(backboneelement.BackboneElement): + """ Document referenced. + + The document and format referenced. There may be multiple content element + repetitions, each with a different format. + """ + + resource_type = "DocumentReferenceContent" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Where to access the document. + Type `Attachment` (represented as `dict` in JSON). """ + + self.format = None + """ Format/content rules for the document. + Type `Coding` (represented as `dict` in JSON). """ + + super(DocumentReferenceContent, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DocumentReferenceContent, self).elementProperties() + js.extend([ + ("attachment", "attachment", attachment.Attachment, False, None, True), + ("format", "format", coding.Coding, False, None, False), + ]) + return js + + +class DocumentReferenceContext(backboneelement.BackboneElement): + """ Clinical context of document. + + The clinical context in which the document was prepared. + """ + + resource_type = "DocumentReferenceContext" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.encounter = None + """ Context of the document content. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.event = None + """ Main clinical acts documented. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.facilityType = None + """ Kind of facility where patient was seen. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.period = None + """ Time of service that is being documented. + Type `Period` (represented as `dict` in JSON). """ + + self.practiceSetting = None + """ Additional details about where the content was created (e.g. + clinical specialty). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.related = None + """ Related identifiers or resources. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.sourcePatientInfo = None + """ Patient demographics from source. + 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, 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", fhirreference.FHIRReference, True, None, False), + ("sourcePatientInfo", "sourcePatientInfo", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +class DocumentReferenceRelatesTo(backboneelement.BackboneElement): + """ Relationships to other documents. + + Relationships that this document has with other document references that + already exist. + """ + + resource_type = "DocumentReferenceRelatesTo" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ replaces | transforms | signs | appends. + Type `str`. """ + + self.target = None + """ Target of the relationship. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(DocumentReferenceRelatesTo, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DocumentReferenceRelatesTo, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("target", "target", fhirreference.FHIRReference, False, None, True), + ]) + 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 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 period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/R4/documentreference_tests.py b/fhirclient/models/R4/documentreference_tests.py new file mode 100644 index 000000000..04ce25206 --- /dev/null +++ b/fhirclient/models/R4/documentreference_tests.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import documentreference +from .fhirdate import FHIRDate + + +class DocumentReferenceTests(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("DocumentReference", js["resourceType"]) + return documentreference.DocumentReference(js) + + def testDocumentReference1(self): + inst = self.instantiate_from("documentreference-example.json") + self.assertIsNotNone(inst, "Must have instantiated a DocumentReference instance") + self.implDocumentReference1(inst) + + js = inst.as_json() + self.assertEqual("DocumentReference", js["resourceType"]) + inst2 = documentreference.DocumentReference(js) + self.implDocumentReference1(inst2) + + def implDocumentReference1(self, inst): + 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") + self.assertEqual(inst.content[0].format.system, "urn:oid:1.3.6.1.4.1.19376.1.2.3") + self.assertEqual(inst.context.event[0].coding[0].code, "T-D8200") + self.assertEqual(inst.context.event[0].coding[0].display, "Arm") + self.assertEqual(inst.context.event[0].coding[0].system, "http://ihe.net/xds/connectathon/eventCodes") + self.assertEqual(inst.context.facilityType.coding[0].code, "Outpatient") + self.assertEqual(inst.context.facilityType.coding[0].display, "Outpatient") + self.assertEqual(inst.context.facilityType.coding[0].system, "http://www.ihe.net/xds/connectathon/healthcareFacilityTypeCodes") + self.assertEqual(inst.context.period.end.date, FHIRDate("2004-12-23T08:01:00+11:00").date) + self.assertEqual(inst.context.period.end.as_json(), "2004-12-23T08:01:00+11:00") + self.assertEqual(inst.context.period.start.date, FHIRDate("2004-12-23T08:00:00+11:00").date) + self.assertEqual(inst.context.period.start.as_json(), "2004-12-23T08:00:00+11:00") + 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.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.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://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") + self.assertEqual(inst.type.coding[0].display, "Outpatient Note") + self.assertEqual(inst.type.coding[0].system, "http://loinc.org") + diff --git a/fhirclient/models/R4/domainresource.py b/fhirclient/models/R4/domainresource.py new file mode 100644 index 000000000..d7ada7366 --- /dev/null +++ b/fhirclient/models/R4/domainresource.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/DomainResource) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import resource + +class DomainResource(resource.Resource): + """ A resource with narrative, extensions, and contained resources. + + A resource that includes narrative, extensions, and contained resources. + """ + + resource_type = "DomainResource" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.contained = None + """ Contained, inline Resources. + List of `Resource` items (represented as `dict` in JSON). """ + + self.extension = None + """ Additional content defined by implementations. + List of `Extension` items (represented as `dict` in JSON). """ + + self.modifierExtension = None + """ Extensions that cannot be ignored. + List of `Extension` items (represented as `dict` in JSON). """ + + self.text = None + """ Text summary of the resource, for human interpretation. + Type `Narrative` (represented as `dict` in JSON). """ + + super(DomainResource, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DomainResource, self).elementProperties() + js.extend([ + ("contained", "contained", resource.Resource, True, None, False), + ("extension", "extension", extension.Extension, True, None, False), + ("modifierExtension", "modifierExtension", extension.Extension, True, None, False), + ("text", "text", narrative.Narrative, False, None, False), + ]) + return js + + +import sys +try: + from . import extension +except ImportError: + extension = sys.modules[__package__ + '.extension'] +try: + from . import narrative +except ImportError: + narrative = sys.modules[__package__ + '.narrative'] diff --git a/fhirclient/models/R4/dosage.py b/fhirclient/models/R4/dosage.py new file mode 100644 index 000000000..35642edfb --- /dev/null +++ b/fhirclient/models/R4/dosage.py @@ -0,0 +1,184 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Dosage) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import backboneelement + +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 + patient. + """ + + resource_type = "Dosage" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.additionalInstruction = None + """ 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 + """ Take "as needed" (for x). + Type `bool`. """ + + self.asNeededCodeableConcept = None + """ Take "as needed" (for x). + Type `CodeableConcept` (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. + Type `Quantity` (represented as `dict` in JSON). """ + + self.maxDosePerLifetime = None + """ Upper limit on medication per lifetime of the patient. + Type `Quantity` (represented as `dict` in JSON). """ + + self.maxDosePerPeriod = None + """ Upper limit on medication per unit of time. + Type `Ratio` (represented as `dict` in JSON). """ + + self.method = None + """ Technique for administering medication. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.patientInstruction = None + """ Patient or consumer oriented instructions. + Type `str`. """ + + self.route = None + """ How drug should enter body. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.sequence = None + """ The order of the dosage instructions. + Type `int`. """ + + self.site = None + """ Body site to administer to. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.text = None + """ Free text dosage instructions e.g. SIG. + Type `str`. """ + + self.timing = None + """ When medication should be administered. + Type `Timing` (represented as `dict` in JSON). """ + + super(Dosage, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Dosage, self).elementProperties() + js.extend([ + ("additionalInstruction", "additionalInstruction", codeableconcept.CodeableConcept, True, None, False), + ("asNeededBoolean", "asNeededBoolean", bool, False, "asNeeded", False), + ("asNeededCodeableConcept", "asNeededCodeableConcept", codeableconcept.CodeableConcept, False, "asNeeded", 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), + ("route", "route", codeableconcept.CodeableConcept, False, None, False), + ("sequence", "sequence", int, False, None, False), + ("site", "site", codeableconcept.CodeableConcept, False, None, False), + ("text", "text", str, False, None, False), + ("timing", "timing", timing.Timing, False, None, False), + ]) + 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 +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'] +try: + from . import ratio +except ImportError: + ratio = sys.modules[__package__ + '.ratio'] +try: + from . import timing +except ImportError: + timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/R4/duration.py b/fhirclient/models/R4/duration.py new file mode 100644 index 000000000..47da3a9cc --- /dev/null +++ b/fhirclient/models/R4/duration.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Duration) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import quantity + +class Duration(quantity.Quantity): + """ A length of time. + """ + + resource_type = "Duration" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + super(Duration, self).__init__(jsondict=jsondict, strict=strict) + + diff --git a/fhirclient/models/effectevidencesynthesis.py b/fhirclient/models/R4/effectevidencesynthesis.py similarity index 99% rename from fhirclient/models/effectevidencesynthesis.py rename to fhirclient/models/R4/effectevidencesynthesis.py index f88a95ae2..c49eca7bd 100644 --- a/fhirclient/models/effectevidencesynthesis.py +++ b/fhirclient/models/R4/effectevidencesynthesis.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/EffectEvidenceSynthesis) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/EffectEvidenceSynthesis) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/effectevidencesynthesis_tests.py b/fhirclient/models/R4/effectevidencesynthesis_tests.py similarity index 94% rename from fhirclient/models/effectevidencesynthesis_tests.py rename to fhirclient/models/R4/effectevidencesynthesis_tests.py index b46814840..bb43cebb9 100644 --- a/fhirclient/models/effectevidencesynthesis_tests.py +++ b/fhirclient/models/R4/effectevidencesynthesis_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/R4/element.py b/fhirclient/models/R4/element.py new file mode 100644 index 000000000..f348ced40 --- /dev/null +++ b/fhirclient/models/R4/element.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Element) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import fhirabstractbase + +class Element(fhirabstractbase.FHIRAbstractBase): + """ Base for all elements. + + Base definition for all elements in a resource. + """ + + resource_type = "Element" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.extension = None + """ Additional content defined by implementations. + List of `Extension` items (represented as `dict` in JSON). """ + + self.id = None + """ Unique id for inter-element referencing. + Type `str`. """ + + super(Element, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Element, self).elementProperties() + from . import extension + js.extend([ + ("extension", "extension", extension.Extension, True, None, False), + ("id", "id", str, False, None, False), + ]) + return js + + diff --git a/fhirclient/models/R4/elementdefinition.py b/fhirclient/models/R4/elementdefinition.py new file mode 100644 index 000000000..3bd2060f7 --- /dev/null +++ b/fhirclient/models/R4/elementdefinition.py @@ -0,0 +1,1746 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ElementDefinition) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import backboneelement + +class ElementDefinition(backboneelement.BackboneElement): + """ Definition of an element in a resource or extension. + + Captures constraints on each element within the resource, profile, or + extension. + """ + + resource_type = "ElementDefinition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.alias = None + """ Other names. + List of `str` items. """ + + self.base = None + """ Base definition information for tools. + Type `ElementDefinitionBase` (represented as `dict` in JSON). """ + + self.binding = None + """ ValueSet details if this is coded. + Type `ElementDefinitionBinding` (represented as `dict` in JSON). """ + + self.code = None + """ Corresponding codes in terminologies. + List of `Coding` items (represented as `dict` in JSON). """ + + self.comment = None + """ Comments about the use of this element. + Type `str`. """ + + self.condition = None + """ Reference to invariant about presence. + List of `str` items. """ + + self.constraint = None + """ Condition that must evaluate to true. + List of `ElementDefinitionConstraint` items (represented as `dict` in JSON). """ + + self.contentReference = None + """ Reference to definition of content for the element. + Type `str`. """ + + self.defaultValueAddress = None + """ Specified value if missing from instance. + Type `Address` (represented as `dict` in JSON). """ + + self.defaultValueAge = None + """ Specified value if missing from instance. + Type `Age` (represented as `dict` in JSON). """ + + self.defaultValueAnnotation = None + """ Specified value if missing from instance. + Type `Annotation` (represented as `dict` in JSON). """ + + self.defaultValueAttachment = None + """ Specified value if missing from instance. + Type `Attachment` (represented as `dict` in JSON). """ + + self.defaultValueBase64Binary = None + """ Specified value if missing from instance. + Type `str`. """ + + self.defaultValueBoolean = None + """ 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`. """ + + self.defaultValueCodeableConcept = None + """ Specified value if missing from instance. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.defaultValueCoding = None + """ 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). """ + + self.defaultValueDateTime = None + """ Specified value if missing from instance. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.defaultValueDecimal = None + """ Specified value if missing from instance. + Type `float`. """ + + self.defaultValueDistance = None + """ 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). """ + + self.defaultValueId = None + """ Specified value if missing from instance. + Type `str`. """ + + self.defaultValueIdentifier = None + """ Specified value if missing from instance. + Type `Identifier` (represented as `dict` in JSON). """ + + self.defaultValueInstant = None + """ Specified value if missing from instance. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.defaultValueInteger = None + """ Specified value if missing from instance. + Type `int`. """ + + self.defaultValueMarkdown = None + """ Specified value if missing from instance. + Type `str`. """ + + self.defaultValueMoney = None + """ Specified value if missing from instance. + Type `Money` (represented as `dict` in JSON). """ + + self.defaultValueOid = None + """ 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). """ + + self.defaultValuePositiveInt = None + """ Specified value if missing from instance. + Type `int`. """ + + self.defaultValueQuantity = None + """ Specified value if missing from instance. + Type `Quantity` (represented as `dict` in JSON). """ + + self.defaultValueRange = None + """ Specified value if missing from instance. + Type `Range` (represented as `dict` in JSON). """ + + self.defaultValueRatio = None + """ Specified value if missing from instance. + Type `Ratio` (represented as `dict` in JSON). """ + + self.defaultValueReference = None + """ 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). """ + + self.defaultValueSignature = None + """ Specified value if missing from instance. + Type `Signature` (represented as `dict` in JSON). """ + + self.defaultValueString = None + """ Specified value if missing from instance. + Type `str`. """ + + self.defaultValueTime = None + """ Specified value if missing from instance. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.defaultValueTiming = None + """ 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`. """ + + self.defaultValueUri = None + """ 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`. """ + + self.example = None + """ Example value (as defined for type). + List of `ElementDefinitionExample` items (represented as `dict` in JSON). """ + + self.fixedAddress = None + """ Value must be exactly this. + Type `Address` (represented as `dict` in JSON). """ + + self.fixedAge = None + """ Value must be exactly this. + Type `Age` (represented as `dict` in JSON). """ + + self.fixedAnnotation = None + """ Value must be exactly this. + Type `Annotation` (represented as `dict` in JSON). """ + + self.fixedAttachment = None + """ Value must be exactly this. + Type `Attachment` (represented as `dict` in JSON). """ + + self.fixedBase64Binary = None + """ Value must be exactly this. + Type `str`. """ + + self.fixedBoolean = None + """ 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`. """ + + self.fixedCodeableConcept = None + """ Value must be exactly this. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.fixedCoding = None + """ 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). """ + + self.fixedDateTime = None + """ Value must be exactly this. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.fixedDecimal = None + """ Value must be exactly this. + Type `float`. """ + + self.fixedDistance = None + """ 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). """ + + self.fixedId = None + """ Value must be exactly this. + Type `str`. """ + + self.fixedIdentifier = None + """ Value must be exactly this. + Type `Identifier` (represented as `dict` in JSON). """ + + self.fixedInstant = None + """ Value must be exactly this. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.fixedInteger = None + """ Value must be exactly this. + Type `int`. """ + + self.fixedMarkdown = None + """ Value must be exactly this. + Type `str`. """ + + self.fixedMoney = None + """ Value must be exactly this. + Type `Money` (represented as `dict` in JSON). """ + + self.fixedOid = None + """ 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). """ + + self.fixedPositiveInt = None + """ Value must be exactly this. + Type `int`. """ + + self.fixedQuantity = None + """ Value must be exactly this. + Type `Quantity` (represented as `dict` in JSON). """ + + self.fixedRange = None + """ Value must be exactly this. + Type `Range` (represented as `dict` in JSON). """ + + self.fixedRatio = None + """ Value must be exactly this. + Type `Ratio` (represented as `dict` in JSON). """ + + self.fixedReference = None + """ 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). """ + + self.fixedSignature = None + """ Value must be exactly this. + Type `Signature` (represented as `dict` in JSON). """ + + self.fixedString = None + """ Value must be exactly this. + Type `str`. """ + + self.fixedTime = None + """ Value must be exactly this. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.fixedTiming = None + """ 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`. """ + + self.fixedUri = None + """ 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`. """ + + self.label = None + """ Name for element to display with or prompt for element. + Type `str`. """ + + self.mapping = None + """ Map element to another set of definitions. + List of `ElementDefinitionMapping` items (represented as `dict` in JSON). """ + + self.max = None + """ Maximum Cardinality (a number or *). + Type `str`. """ + + self.maxLength = None + """ Max length for strings. + Type `int`. """ + + self.maxValueDate = None + """ Maximum Allowed Value (for some types). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.maxValueDateTime = None + """ Maximum Allowed Value (for some types). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.maxValueDecimal = None + """ Maximum Allowed Value (for some types). + Type `float`. """ + + self.maxValueInstant = None + """ Maximum Allowed Value (for some types). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.maxValueInteger = None + """ Maximum Allowed Value (for some types). + Type `int`. """ + + self.maxValuePositiveInt = None + """ Maximum Allowed Value (for some types). + Type `int`. """ + + self.maxValueQuantity = None + """ Maximum Allowed Value (for some types). + Type `Quantity` (represented as `dict` in JSON). """ + + self.maxValueTime = None + """ Maximum Allowed Value (for some types). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.maxValueUnsignedInt = None + """ Maximum Allowed Value (for some types). + Type `int`. """ + + self.meaningWhenMissing = None + """ Implicit meaning when this element is missing. + Type `str`. """ + + self.min = None + """ Minimum Cardinality. + Type `int`. """ + + self.minValueDate = None + """ Minimum Allowed Value (for some types). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.minValueDateTime = None + """ Minimum Allowed Value (for some types). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.minValueDecimal = None + """ Minimum Allowed Value (for some types). + Type `float`. """ + + self.minValueInstant = None + """ Minimum Allowed Value (for some types). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.minValueInteger = None + """ Minimum Allowed Value (for some types). + Type `int`. """ + + self.minValuePositiveInt = None + """ Minimum Allowed Value (for some types). + Type `int`. """ + + self.minValueQuantity = None + """ Minimum Allowed Value (for some types). + Type `Quantity` (represented as `dict` in JSON). """ + + self.minValueTime = None + """ Minimum Allowed Value (for some types). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.minValueUnsignedInt = None + """ Minimum Allowed Value (for some types). + Type `int`. """ + + self.mustSupport = None + """ If the element must be supported. + Type `bool`. """ + + self.orderMeaning = None + """ What the order of the elements means. + Type `str`. """ + + self.path = None + """ Path of the element in the hierarchy of elements. + Type `str`. """ + + self.patternAddress = None + """ Value must have at least these property values. + Type `Address` (represented as `dict` in JSON). """ + + self.patternAge = None + """ Value must have at least these property values. + Type `Age` (represented as `dict` in JSON). """ + + self.patternAnnotation = None + """ Value must have at least these property values. + Type `Annotation` (represented as `dict` in JSON). """ + + self.patternAttachment = None + """ Value must have at least these property values. + Type `Attachment` (represented as `dict` in JSON). """ + + self.patternBase64Binary = None + """ Value must have at least these property values. + Type `str`. """ + + self.patternBoolean = None + """ 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`. """ + + self.patternCodeableConcept = None + """ Value must have at least these property values. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.patternCoding = None + """ 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). """ + + self.patternDateTime = None + """ Value must have at least these property values. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.patternDecimal = None + """ Value must have at least these property values. + Type `float`. """ + + self.patternDistance = None + """ 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). """ + + self.patternId = None + """ Value must have at least these property values. + Type `str`. """ + + self.patternIdentifier = None + """ Value must have at least these property values. + Type `Identifier` (represented as `dict` in JSON). """ + + self.patternInstant = None + """ Value must have at least these property values. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.patternInteger = None + """ Value must have at least these property values. + Type `int`. """ + + self.patternMarkdown = None + """ Value must have at least these property values. + Type `str`. """ + + self.patternMoney = None + """ Value must have at least these property values. + Type `Money` (represented as `dict` in JSON). """ + + self.patternOid = None + """ 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). """ + + self.patternPositiveInt = None + """ Value must have at least these property values. + Type `int`. """ + + self.patternQuantity = None + """ Value must have at least these property values. + Type `Quantity` (represented as `dict` in JSON). """ + + self.patternRange = None + """ Value must have at least these property values. + Type `Range` (represented as `dict` in JSON). """ + + self.patternRatio = None + """ Value must have at least these property values. + Type `Ratio` (represented as `dict` in JSON). """ + + self.patternReference = None + """ 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). """ + + self.patternSignature = None + """ Value must have at least these property values. + Type `Signature` (represented as `dict` in JSON). """ + + self.patternString = None + """ Value must have at least these property values. + Type `str`. """ + + self.patternTime = None + """ Value must have at least these property values. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.patternTiming = None + """ 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`. """ + + self.patternUri = None + """ 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. """ + + self.requirements = None + """ Why this resource has been created. + Type `str`. """ + + self.short = None + """ 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`. """ + + self.slicing = None + """ This element is sliced - slices follow. + Type `ElementDefinitionSlicing` (represented as `dict` in JSON). """ + + self.type = None + """ Data type and Profile for this element. + List of `ElementDefinitionType` items (represented as `dict` in JSON). """ + + super(ElementDefinition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ElementDefinition, self).elementProperties() + js.extend([ + ("alias", "alias", str, True, None, False), + ("base", "base", ElementDefinitionBase, False, None, False), + ("binding", "binding", ElementDefinitionBinding, False, None, False), + ("code", "code", coding.Coding, True, None, False), + ("comment", "comment", str, False, None, False), + ("condition", "condition", str, True, None, False), + ("constraint", "constraint", ElementDefinitionConstraint, True, None, False), + ("contentReference", "contentReference", str, False, None, False), + ("defaultValueAddress", "defaultValueAddress", address.Address, False, "defaultValue", False), + ("defaultValueAge", "defaultValueAge", age.Age, False, "defaultValue", False), + ("defaultValueAnnotation", "defaultValueAnnotation", annotation.Annotation, False, "defaultValue", False), + ("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), + ("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), + ("fixedAge", "fixedAge", age.Age, False, "fixed", False), + ("fixedAnnotation", "fixedAnnotation", annotation.Annotation, False, "fixed", False), + ("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), + ("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), + ("max", "max", str, False, None, False), + ("maxLength", "maxLength", int, False, None, False), + ("maxValueDate", "maxValueDate", fhirdate.FHIRDate, False, "maxValue", False), + ("maxValueDateTime", "maxValueDateTime", fhirdate.FHIRDate, False, "maxValue", False), + ("maxValueDecimal", "maxValueDecimal", float, False, "maxValue", False), + ("maxValueInstant", "maxValueInstant", fhirdate.FHIRDate, False, "maxValue", False), + ("maxValueInteger", "maxValueInteger", int, False, "maxValue", False), + ("maxValuePositiveInt", "maxValuePositiveInt", int, False, "maxValue", False), + ("maxValueQuantity", "maxValueQuantity", quantity.Quantity, False, "maxValue", False), + ("maxValueTime", "maxValueTime", fhirdate.FHIRDate, False, "maxValue", False), + ("maxValueUnsignedInt", "maxValueUnsignedInt", int, False, "maxValue", False), + ("meaningWhenMissing", "meaningWhenMissing", str, False, None, False), + ("min", "min", int, False, None, False), + ("minValueDate", "minValueDate", fhirdate.FHIRDate, False, "minValue", False), + ("minValueDateTime", "minValueDateTime", fhirdate.FHIRDate, False, "minValue", False), + ("minValueDecimal", "minValueDecimal", float, False, "minValue", False), + ("minValueInstant", "minValueInstant", fhirdate.FHIRDate, False, "minValue", False), + ("minValueInteger", "minValueInteger", int, False, "minValue", False), + ("minValuePositiveInt", "minValuePositiveInt", int, False, "minValue", False), + ("minValueQuantity", "minValueQuantity", quantity.Quantity, False, "minValue", False), + ("minValueTime", "minValueTime", fhirdate.FHIRDate, False, "minValue", False), + ("minValueUnsignedInt", "minValueUnsignedInt", int, False, "minValue", False), + ("mustSupport", "mustSupport", bool, False, None, False), + ("orderMeaning", "orderMeaning", str, False, None, False), + ("path", "path", str, False, None, True), + ("patternAddress", "patternAddress", address.Address, False, "pattern", False), + ("patternAge", "patternAge", age.Age, False, "pattern", False), + ("patternAnnotation", "patternAnnotation", annotation.Annotation, False, "pattern", False), + ("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), + ("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), + ]) + 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. 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.max = None + """ Max cardinality of the base element. + Type `str`. """ + + self.min = None + """ Min cardinality of the base element. + Type `int`. """ + + self.path = None + """ Path that identifies the base element. + Type `str`. """ + + super(ElementDefinitionBase, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ElementDefinitionBase, self).elementProperties() + js.extend([ + ("max", "max", str, False, None, True), + ("min", "min", int, False, None, True), + ("path", "path", str, False, None, True), + ]) + return js + + +class ElementDefinitionBinding(element.Element): + """ ValueSet details if this is coded. + + Binds to a value set if this element is coded (code, Coding, + CodeableConcept, Quantity), or the data types (string, uri). + """ + + resource_type = "ElementDefinitionBinding" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Human explanation of the value set. + Type `str`. """ + + self.strength = None + """ required | extensible | preferred | example. + Type `str`. """ + + self.valueSet = None + """ Source of value set. + Type `str`. """ + + super(ElementDefinitionBinding, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ElementDefinitionBinding, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, False), + ("strength", "strength", str, False, None, True), + ("valueSet", "valueSet", str, False, None, False), + ]) + return js + + +class ElementDefinitionConstraint(element.Element): + """ Condition that must evaluate to true. + + Formal constraints such as co-occurrence and other constraints that can be + computationally evaluated within the context of the instance. + """ + + resource_type = "ElementDefinitionConstraint" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ FHIRPath expression of constraint. + Type `str`. """ + + self.human = None + """ Human description of constraint. + Type `str`. """ + + self.key = None + """ Target of 'condition' reference above. + Type `str`. """ + + self.requirements = None + """ Why this constraint is necessary or appropriate. + Type `str`. """ + + self.severity = None + """ error | warning. + Type `str`. """ + + self.source = None + """ Reference to original source of constraint. + Type `str`. """ + + self.xpath = None + """ XPath expression of constraint. + Type `str`. """ + + super(ElementDefinitionConstraint, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ElementDefinitionConstraint, self).elementProperties() + js.extend([ + ("expression", "expression", str, False, None, False), + ("human", "human", str, False, None, True), + ("key", "key", str, False, None, True), + ("requirements", "requirements", str, False, None, False), + ("severity", "severity", str, False, None, True), + ("source", "source", str, False, None, False), + ("xpath", "xpath", str, False, None, False), + ]) + return js + + +class ElementDefinitionExample(element.Element): + """ Example value (as defined for type). + + A sample value for this element demonstrating the type of information that + would typically be found in the element. + """ + + resource_type = "ElementDefinitionExample" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.label = None + """ Describes the purpose of this example. + Type `str`. """ + + self.valueAddress = None + """ Value of Example (one of allowed types). + Type `Address` (represented as `dict` in JSON). """ + + self.valueAge = None + """ Value of Example (one of allowed types). + Type `Age` (represented as `dict` in JSON). """ + + self.valueAnnotation = None + """ Value of Example (one of allowed types). + Type `Annotation` (represented as `dict` in JSON). """ + + self.valueAttachment = None + """ Value of Example (one of allowed types). + Type `Attachment` (represented as `dict` in JSON). """ + + self.valueBase64Binary = None + """ Value of Example (one of allowed types). + Type `str`. """ + + self.valueBoolean = None + """ 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`. """ + + self.valueCodeableConcept = None + """ Value of Example (one of allowed types). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueCoding = None + """ 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). """ + + self.valueDateTime = None + """ Value of Example (one of allowed types). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueDecimal = None + """ Value of Example (one of allowed types). + Type `float`. """ + + self.valueDistance = None + """ 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). """ + + self.valueId = None + """ Value of Example (one of allowed types). + Type `str`. """ + + self.valueIdentifier = None + """ Value of Example (one of allowed types). + Type `Identifier` (represented as `dict` in JSON). """ + + self.valueInstant = None + """ Value of Example (one of allowed types). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueInteger = None + """ Value of Example (one of allowed types). + Type `int`. """ + + self.valueMarkdown = None + """ Value of Example (one of allowed types). + Type `str`. """ + + self.valueMoney = None + """ Value of Example (one of allowed types). + Type `Money` (represented as `dict` in JSON). """ + + self.valueOid = None + """ 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). """ + + self.valuePositiveInt = None + """ Value of Example (one of allowed types). + Type `int`. """ + + self.valueQuantity = None + """ Value of Example (one of allowed types). + Type `Quantity` (represented as `dict` in JSON). """ + + self.valueRange = None + """ Value of Example (one of allowed types). + Type `Range` (represented as `dict` in JSON). """ + + self.valueRatio = None + """ Value of Example (one of allowed types). + Type `Ratio` (represented as `dict` in JSON). """ + + self.valueReference = None + """ 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). """ + + self.valueSignature = None + """ Value of Example (one of allowed types). + Type `Signature` (represented as `dict` in JSON). """ + + self.valueString = None + """ Value of Example (one of allowed types). + Type `str`. """ + + self.valueTime = None + """ Value of Example (one of allowed types). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueTiming = None + """ 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`. """ + + self.valueUri = None + """ 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): + js = super(ElementDefinitionExample, self).elementProperties() + js.extend([ + ("label", "label", str, False, None, True), + ("valueAddress", "valueAddress", address.Address, False, "value", True), + ("valueAge", "valueAge", age.Age, False, "value", True), + ("valueAnnotation", "valueAnnotation", annotation.Annotation, False, "value", True), + ("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), + ("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 + + +class ElementDefinitionMapping(element.Element): + """ Map element to another set of definitions. + + Identifies a concept from an external specification that roughly + corresponds to this element. + """ + + resource_type = "ElementDefinitionMapping" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Comments about the mapping or its use. + Type `str`. """ + + self.identity = None + """ Reference to mapping declaration. + Type `str`. """ + + self.language = None + """ Computable language of mapping. + Type `str`. """ + + self.map = None + """ Details of the mapping. + Type `str`. """ + + super(ElementDefinitionMapping, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ElementDefinitionMapping, self).elementProperties() + js.extend([ + ("comment", "comment", str, False, None, False), + ("identity", "identity", str, False, None, True), + ("language", "language", str, False, None, False), + ("map", "map", str, False, None, True), + ]) + return js + + +class ElementDefinitionSlicing(element.Element): + """ This element is sliced - slices follow. + + Indicates that the element is sliced into a set of alternative definitions + (i.e. in a structure definition, there are multiple different constraints + on a single element in the base resource). Slicing can be used in any + resource that has cardinality ..* on the base resource, or any resource + with a choice of types. The set of slices is any elements that come after + this in the element sequence that have the same path, until a shorter path + occurs (the shorter path terminates the set). + """ + + resource_type = "ElementDefinitionSlicing" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Text description of how slicing works (or not). + Type `str`. """ + + self.discriminator = None + """ Element values that are used to distinguish the slices. + List of `ElementDefinitionSlicingDiscriminator` items (represented as `dict` in JSON). """ + + self.ordered = None + """ If elements must be in same order as slices. + Type `bool`. """ + + self.rules = None + """ closed | open | openAtEnd. + Type `str`. """ + + super(ElementDefinitionSlicing, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ElementDefinitionSlicing, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, False), + ("discriminator", "discriminator", ElementDefinitionSlicingDiscriminator, True, None, False), + ("ordered", "ordered", bool, False, None, False), + ("rules", "rules", str, False, None, True), + ]) + return js + + +class ElementDefinitionSlicingDiscriminator(element.Element): + """ Element values that are used to distinguish the slices. + + Designates which child elements are used to discriminate between the slices + when processing an instance. If one or more discriminators are provided, + the value of the child elements in the instance data SHALL completely + distinguish which slice the element in the resource matches based on the + allowed values for those elements in each of the slices. + """ + + resource_type = "ElementDefinitionSlicingDiscriminator" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.path = None + """ Path to element value. + Type `str`. """ + + self.type = None + """ value | exists | pattern | type | profile. + Type `str`. """ + + super(ElementDefinitionSlicingDiscriminator, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ElementDefinitionSlicingDiscriminator, self).elementProperties() + js.extend([ + ("path", "path", str, False, None, True), + ("type", "type", str, False, None, True), + ]) + return js + + +class ElementDefinitionType(element.Element): + """ Data type and Profile for this element. + + The data type or resource that the value of this element is permitted to + be. + """ + + resource_type = "ElementDefinitionType" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.aggregation = None + """ contained | referenced | bundled - how aggregated. + List of `str` items. """ + + self.code = None + """ Data type or Resource (reference to definition). + Type `str`. """ + + self.profile = None + """ Profiles (StructureDefinition or IG) - one must apply. + List of `str` items. """ + + self.targetProfile = None + """ Profile (StructureDefinition or IG) on the Reference/canonical + target - one must apply. + List of `str` items. """ + + self.versioning = None + """ either | independent | specific. + Type `str`. """ + + super(ElementDefinitionType, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ElementDefinitionType, self).elementProperties() + js.extend([ + ("aggregation", "aggregation", str, True, None, False), + ("code", "code", str, False, None, True), + ("profile", "profile", str, True, None, False), + ("targetProfile", "targetProfile", str, True, None, False), + ("versioning", "versioning", str, False, None, False), + ]) + return js + + +import sys +try: + from . import address +except ImportError: + address = sys.modules[__package__ + '.address'] +try: + from . import age +except ImportError: + age = sys.modules[__package__ + '.age'] +try: + from . import annotation +except ImportError: + annotation = sys.modules[__package__ + '.annotation'] +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 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: + fhirdate = sys.modules[__package__ + '.fhirdate'] +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 parameterdefinition +except ImportError: + parameterdefinition = sys.modules[__package__ + '.parameterdefinition'] +try: + 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 relatedartifact +except ImportError: + relatedartifact = sys.modules[__package__ + '.relatedartifact'] +try: + from . import sampleddata +except ImportError: + sampleddata = sys.modules[__package__ + '.sampleddata'] +try: + from . import signature +except ImportError: + signature = sys.modules[__package__ + '.signature'] +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/R4/encounter.py b/fhirclient/models/R4/encounter.py new file mode 100644 index 000000000..00225a3ab --- /dev/null +++ b/fhirclient/models/R4/encounter.py @@ -0,0 +1,454 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Encounter) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Encounter(domainresource.DomainResource): + """ An interaction during which services are provided to the patient. + + An interaction between a patient and healthcare provider(s) for the purpose + of providing healthcare service(s) or assessing the health status of a + patient. + """ + + resource_type = "Encounter" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ The set of accounts that may be used for billing for this Encounter. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.appointment = None + """ The appointment that scheduled this encounter. + 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 + """ Classification of patient encounter. + Type `Coding` (represented as `dict` in JSON). """ + + self.diagnosis = None + """ The list of diagnosis relevant to this encounter. + List of `EncounterDiagnosis` items (represented as `dict` in JSON). """ + + self.episodeOfCare = None + """ Episode(s) of care that this encounter should be recorded against. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.hospitalization = None + """ Details about the admission to a healthcare service. + Type `EncounterHospitalization` (represented as `dict` in JSON). """ + + self.identifier = None + """ Identifier(s) by which this encounter is known. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.length = None + """ Quantity of time the encounter lasted (less time absent). + Type `Duration` (represented as `dict` in JSON). """ + + self.location = None + """ List of locations where the patient has been. + List of `EncounterLocation` items (represented as `dict` in JSON). """ + + self.partOf = None + """ Another Encounter this encounter is part of. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.participant = None + """ List of participants involved in the encounter. + List of `EncounterParticipant` items (represented as `dict` in JSON). """ + + self.period = None + """ The start and end time of the encounter. + Type `Period` (represented as `dict` in JSON). """ + + self.priority = None + """ Indicates the urgency of the encounter. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + 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 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 | + cancelled +. + Type `str`. """ + + self.statusHistory = None + """ List of past encounter statuses. + List of `EncounterStatusHistory` items (represented as `dict` in JSON). """ + + self.subject = None + """ The patient or group present at the encounter. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.type = None + """ Specific type of encounter. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(Encounter, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Encounter, self).elementProperties() + js.extend([ + ("account", "account", fhirreference.FHIRReference, True, 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, 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), + ("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), + ("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), + ("type", "type", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +from . import backboneelement + +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 + 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ inpatient | outpatient | ambulatory | emergency +. + Type `Coding` (represented as `dict` in JSON). """ + + self.period = None + """ The time that the episode was in the specified class. + Type `Period` (represented as `dict` in JSON). """ + + super(EncounterClassHistory, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EncounterClassHistory, self).elementProperties() + js.extend([ + ("class_fhir", "class", coding.Coding, False, None, True), + ("period", "period", period.Period, False, None, True), + ]) + return js + + +class EncounterDiagnosis(backboneelement.BackboneElement): + """ The list of diagnosis relevant to this encounter. + """ + + resource_type = "EncounterDiagnosis" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.condition = None + """ 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.use = None + """ Role that this diagnosis has within the encounter (e.g. admission, + billing, discharge …). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(EncounterDiagnosis, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EncounterDiagnosis, self).elementProperties() + js.extend([ + ("condition", "condition", fhirreference.FHIRReference, False, None, True), + ("rank", "rank", int, False, None, False), + ("use", "use", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class EncounterHospitalization(backboneelement.BackboneElement): + """ Details about the admission to a healthcare service. + """ + + resource_type = "EncounterHospitalization" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.admitSource = None + """ From where patient was admitted (physician referral, transfer). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.destination = None + """ Location/organization to which the patient is discharged. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.dietPreference = None + """ Diet preferences reported by the patient. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.dischargeDisposition = None + """ Category or kind of location after discharge. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.origin = None + """ The location/organization from which the patient came before + admission. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.preAdmissionIdentifier = None + """ Pre-admission identifier. + Type `Identifier` (represented as `dict` in JSON). """ + + self.reAdmission = None + """ The type of hospital re-admission that has occurred (if any). If + the value is absent, then this is not identified as a readmission. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.specialArrangement = None + """ Wheelchair, translator, stretcher, etc.. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.specialCourtesy = None + """ Special courtesies (VIP, board member). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(EncounterHospitalization, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EncounterHospitalization, self).elementProperties() + js.extend([ + ("admitSource", "admitSource", codeableconcept.CodeableConcept, False, None, False), + ("destination", "destination", fhirreference.FHIRReference, False, None, False), + ("dietPreference", "dietPreference", codeableconcept.CodeableConcept, True, None, False), + ("dischargeDisposition", "dischargeDisposition", codeableconcept.CodeableConcept, False, None, False), + ("origin", "origin", fhirreference.FHIRReference, False, None, False), + ("preAdmissionIdentifier", "preAdmissionIdentifier", identifier.Identifier, False, None, False), + ("reAdmission", "reAdmission", codeableconcept.CodeableConcept, False, None, False), + ("specialArrangement", "specialArrangement", codeableconcept.CodeableConcept, True, None, False), + ("specialCourtesy", "specialCourtesy", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +class EncounterLocation(backboneelement.BackboneElement): + """ List of locations where the patient has been. + + List of locations where the patient has been during this encounter. + """ + + resource_type = "EncounterLocation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.location = None + """ Location the encounter takes place. + 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`. """ + + super(EncounterLocation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EncounterLocation, self).elementProperties() + 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 + + +class EncounterParticipant(backboneelement.BackboneElement): + """ List of participants involved in the encounter. + + The list of people responsible for providing the service. + """ + + resource_type = "EncounterParticipant" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.individual = None + """ Persons involved in the encounter other than the patient. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.period = None + """ Period of time during the encounter that the participant + participated. + Type `Period` (represented as `dict` in JSON). """ + + self.type = None + """ Role of participant in encounter. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(EncounterParticipant, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EncounterParticipant, self).elementProperties() + js.extend([ + ("individual", "individual", fhirreference.FHIRReference, False, None, False), + ("period", "period", period.Period, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +class EncounterStatusHistory(backboneelement.BackboneElement): + """ List of past encounter statuses. + + The status history permits the encounter resource to contain the status + history without needing to read through the historical versions of the + resource, or even have the server store them. + """ + + resource_type = "EncounterStatusHistory" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 time that the episode was in the specified status. + Type `Period` (represented as `dict` in JSON). """ + + self.status = None + """ planned | arrived | triaged | in-progress | onleave | finished | + cancelled +. + Type `str`. """ + + super(EncounterStatusHistory, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EncounterStatusHistory, self).elementProperties() + js.extend([ + ("period", "period", period.Period, False, None, True), + ("status", "status", 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 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 period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/R4/encounter_tests.py b/fhirclient/models/R4/encounter_tests.py new file mode 100644 index 000000000..f0ea0d0fb --- /dev/null +++ b/fhirclient/models/R4/encounter_tests.py @@ -0,0 +1,462 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import encounter +from .fhirdate import FHIRDate + + +class EncounterTests(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("Encounter", js["resourceType"]) + return encounter.Encounter(js) + + def testEncounter1(self): + inst = self.instantiate_from("encounter-example-home.json") + self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") + self.implEncounter1(inst) + + js = inst.as_json() + self.assertEqual("Encounter", js["resourceType"]) + inst2 = encounter.Encounter(js) + self.implEncounter1(inst2) + + def implEncounter1(self, inst): + 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-f201-20130404.json") + self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") + self.implEncounter2(inst) + + js = inst.as_json() + self.assertEqual("Encounter", js["resourceType"]) + inst2 = encounter.Encounter(js) + self.implEncounter2(inst2) + + 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://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.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, "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-f003-abscess.json") + self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") + self.implEncounter3(inst) + + js = inst.as_json() + self.assertEqual("Encounter", js["resourceType"]) + inst2 = encounter.Encounter(js) + self.implEncounter3(inst2) + + 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://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, "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, "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, 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, "Non-urgent ear, nose and throat admission") + self.assertEqual(inst.priority.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") + self.assertEqual(inst.type[0].coding[0].display, "Patient-initiated encounter") + self.assertEqual(inst.type[0].coding[0].system, "http://snomed.info/sct") + + def testEncounter4(self): + inst = self.instantiate_from("encounter-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") + self.implEncounter4(inst) + + js = inst.as_json() + self.assertEqual("Encounter", js["resourceType"]) + inst2 = encounter.Encounter(js) + 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://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, "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, "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, 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, "Urgent") + 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, "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 testEncounter6(self): + inst = self.instantiate_from("encounter-example-f203-20130311.json") + self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") + self.implEncounter6(inst) + + js = inst.as_json() + self.assertEqual("Encounter", js["resourceType"]) + inst2 = encounter.Encounter(js) + self.implEncounter6(inst2) + + def implEncounter6(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.diagnosis[0].rank, 1) + 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") + self.assertEqual(inst.hospitalization.dietPreference[0].coding[0].code, "276026009") + self.assertEqual(inst.hospitalization.dietPreference[0].coding[0].display, "Fluid balance regulation") + self.assertEqual(inst.hospitalization.dietPreference[0].coding[0].system, "http://snomed.info/sct") + 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://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://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://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) + self.assertEqual(inst.period.start.as_json(), "2013-03-11") + 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.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") + self.assertEqual(inst.statusHistory[0].status, "arrived") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type[0].coding[0].code, "183807002") + 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-f202-20130128.json") + self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") + self.implEncounter8(inst) + + js = inst.as_json() + self.assertEqual("Encounter", js["resourceType"]) + inst2 = encounter.Encounter(js) + self.implEncounter8(inst2) + + def implEncounter8(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.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.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-emerg.json") + self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") + self.implEncounter9(inst) + + js = inst.as_json() + self.assertEqual("Encounter", js["resourceType"]) + inst2 = encounter.Encounter(js) + self.implEncounter9(inst2) + + def implEncounter9(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://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-f001-heart.json") + self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") + self.implEncounter10(inst) + + js = inst.as_json() + self.assertEqual("Encounter", js["resourceType"]) + inst2 = encounter.Encounter(js) + self.implEncounter10(inst2) + + def implEncounter10(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.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/R4/endpoint.py b/fhirclient/models/R4/endpoint.py new file mode 100644 index 000000000..8f69f0180 --- /dev/null +++ b/fhirclient/models/R4/endpoint.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Endpoint) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Endpoint(domainresource.DomainResource): + """ The technical details of an endpoint that can be used for electronic + services. + + The technical details of an endpoint that can be used for electronic + services, such as for web services providing XDS.b or a REST endpoint for + another FHIR server. This may include any security context information. + """ + + resource_type = "Endpoint" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ The technical base address for connecting to this endpoint. + Type `str`. """ + + self.connectionType = None + """ Protocol/Profile/Standard to be used with this endpoint connection. + Type `Coding` (represented as `dict` in JSON). """ + + self.contact = None + """ Contact details for source (e.g. troubleshooting). + List of `ContactPoint` items (represented as `dict` in JSON). """ + + self.header = None + """ Usage depends on the channel type. + List of `str` items. """ + + self.identifier = None + """ Identifies this endpoint across multiple systems. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.managingOrganization = None + """ Organization that manages this endpoint (might not be the + organization that exposes the endpoint). + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.name = None + """ A name that this endpoint can be identified by. + Type `str`. """ + + self.payloadMimeType = None + """ Mimetype to send. If not specified, the content could be anything + (including no payload, if the connectionType defined this). + List of `str` items. """ + + self.payloadType = None + """ The type of content that may be used at this endpoint (e.g. XDS + Discharge summaries). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.period = None + """ Interval the endpoint is expected to be operational. + Type `Period` (represented as `dict` in JSON). """ + + self.status = None + """ active | suspended | error | off | entered-in-error | test. + Type `str`. """ + + super(Endpoint, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Endpoint, self).elementProperties() + js.extend([ + ("address", "address", str, False, None, True), + ("connectionType", "connectionType", coding.Coding, False, None, True), + ("contact", "contact", contactpoint.ContactPoint, True, None, False), + ("header", "header", str, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("managingOrganization", "managingOrganization", fhirreference.FHIRReference, False, None, False), + ("name", "name", str, False, None, False), + ("payloadMimeType", "payloadMimeType", str, True, None, False), + ("payloadType", "payloadType", codeableconcept.CodeableConcept, True, None, True), + ("period", "period", period.Period, False, None, False), + ("status", "status", 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 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/R4/endpoint_tests.py b/fhirclient/models/R4/endpoint_tests.py new file mode 100644 index 000000000..67d810573 --- /dev/null +++ b/fhirclient/models/R4/endpoint_tests.py @@ -0,0 +1,126 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import endpoint +from .fhirdate import FHIRDate + + +class EndpointTests(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("Endpoint", js["resourceType"]) + return endpoint.Endpoint(js) + + def testEndpoint1(self): + inst = self.instantiate_from("endpoint-example-iid.json") + self.assertIsNotNone(inst, "Must have instantiated a Endpoint instance") + self.implEndpoint1(inst) + + js = inst.as_json() + self.assertEqual("Endpoint", js["resourceType"]) + inst2 = endpoint.Endpoint(js) + self.implEndpoint1(inst2) + + 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://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-direct.json") + self.assertIsNotNone(inst, "Must have instantiated a Endpoint instance") + self.implEndpoint2(inst) + + js = inst.as_json() + self.assertEqual("Endpoint", js["resourceType"]) + inst2 = endpoint.Endpoint(js) + 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://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 testEndpoint4(self): + inst = self.instantiate_from("endpoint-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Endpoint instance") + self.implEndpoint4(inst) + + js = inst.as_json() + self.assertEqual("Endpoint", js["resourceType"]) + inst2 = endpoint.Endpoint(js) + self.implEndpoint4(inst2) + + 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://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") + self.assertEqual(inst.header[0], "bearer-code BASGS534s4") + 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") + self.assertEqual(inst.payloadType[0].coding[0].system, "http://hl7.org/fhir/resource-types") + 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") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/R4/enrollmentrequest.py b/fhirclient/models/R4/enrollmentrequest.py new file mode 100644 index 000000000..4f66ec000 --- /dev/null +++ b/fhirclient/models/R4/enrollmentrequest.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/EnrollmentRequest) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class EnrollmentRequest(domainresource.DomainResource): + """ Enroll in coverage. + + This resource provides the insurance enrollment details to the insurer + regarding a specified coverage. + """ + + resource_type = "EnrollmentRequest" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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` (represented as `dict` in JSON). """ + + self.created = None + """ Creation date. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.identifier = None + """ Business Identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.insurer = None + """ Target. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.provider = None + """ Responsible practitioner. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.status = None + """ active | cancelled | draft | entered-in-error. + Type `str`. """ + + 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), + ("provider", "provider", fhirreference.FHIRReference, False, None, False), + ("status", "status", str, False, None, False), + ]) + 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/R4/enrollmentrequest_tests.py b/fhirclient/models/R4/enrollmentrequest_tests.py new file mode 100644 index 000000000..ad7cac117 --- /dev/null +++ b/fhirclient/models/R4/enrollmentrequest_tests.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import enrollmentrequest +from .fhirdate import FHIRDate + + +class EnrollmentRequestTests(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("EnrollmentRequest", js["resourceType"]) + return enrollmentrequest.EnrollmentRequest(js) + + def testEnrollmentRequest1(self): + inst = self.instantiate_from("enrollmentrequest-example.json") + self.assertIsNotNone(inst, "Must have instantiated a EnrollmentRequest instance") + self.implEnrollmentRequest1(inst) + + js = inst.as_json() + self.assertEqual("EnrollmentRequest", js["resourceType"]) + inst2 = enrollmentrequest.EnrollmentRequest(js) + self.implEnrollmentRequest1(inst2) + + def implEnrollmentRequest1(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, "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/R4/enrollmentresponse.py b/fhirclient/models/R4/enrollmentresponse.py new file mode 100644 index 000000000..d3a08f9bb --- /dev/null +++ b/fhirclient/models/R4/enrollmentresponse.py @@ -0,0 +1,88 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/EnrollmentResponse) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class EnrollmentResponse(domainresource.DomainResource): + """ EnrollmentResponse resource. + + This resource provides enrollment and plan details from the processing of + an EnrollmentRequest resource. + """ + + resource_type = "EnrollmentResponse" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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.disposition = None + """ Disposition Message. + Type `str`. """ + + self.identifier = None + """ Business Identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.organization = None + """ Insurer. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.outcome = None + """ queued | complete | error | partial. + Type `str`. """ + + self.request = None + """ Claim reference. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.requestProvider = None + """ Responsible practitioner. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.status = None + """ active | cancelled | draft | entered-in-error. + Type `str`. """ + + super(EnrollmentResponse, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EnrollmentResponse, self).elementProperties() + js.extend([ + ("created", "created", fhirdate.FHIRDate, False, None, False), + ("disposition", "disposition", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("organization", "organization", fhirreference.FHIRReference, False, None, False), + ("outcome", "outcome", str, False, None, False), + ("request", "request", fhirreference.FHIRReference, False, None, False), + ("requestProvider", "requestProvider", fhirreference.FHIRReference, False, None, False), + ("status", "status", str, False, None, False), + ]) + 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/R4/enrollmentresponse_tests.py b/fhirclient/models/R4/enrollmentresponse_tests.py new file mode 100644 index 000000000..2c46b4ee7 --- /dev/null +++ b/fhirclient/models/R4/enrollmentresponse_tests.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import enrollmentresponse +from .fhirdate import FHIRDate + + +class EnrollmentResponseTests(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("EnrollmentResponse", js["resourceType"]) + return enrollmentresponse.EnrollmentResponse(js) + + def testEnrollmentResponse1(self): + inst = self.instantiate_from("enrollmentresponse-example.json") + self.assertIsNotNone(inst, "Must have instantiated a EnrollmentResponse instance") + self.implEnrollmentResponse1(inst) + + js = inst.as_json() + self.assertEqual("EnrollmentResponse", js["resourceType"]) + inst2 = enrollmentresponse.EnrollmentResponse(js) + self.implEnrollmentResponse1(inst2) + + def implEnrollmentResponse1(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, "Dependant added to policy.") + 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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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/R4/episodeofcare.py b/fhirclient/models/R4/episodeofcare.py new file mode 100644 index 000000000..820113d10 --- /dev/null +++ b/fhirclient/models/R4/episodeofcare.py @@ -0,0 +1,198 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/EpisodeOfCare) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class EpisodeOfCare(domainresource.DomainResource): + """ An association of a Patient with an Organization and Healthcare + Provider(s) for a period of time that the Organization assumes some level + of responsibility. + + An association between a patient and an organization / healthcare + provider(s) during which time encounters may occur. The managing + organization assumes a level of responsibility for the patient during this + time. + """ + + resource_type = "EpisodeOfCare" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ The set of accounts that may be used for billing for this + EpisodeOfCare. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.careManager = None + """ 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. + List of `EpisodeOfCareDiagnosis` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Business Identifier(s) relevant for this EpisodeOfCare. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.managingOrganization = None + """ Organization that assumes care. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.patient = None + """ The patient who is the focus of this episode of care. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.period = None + """ Interval during responsibility is assumed. + Type `Period` (represented as `dict` in JSON). """ + + self.referralRequest = None + """ Originating Referral Request(s). + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.status = None + """ planned | waitlist | active | onhold | finished | cancelled | + entered-in-error. + Type `str`. """ + + self.statusHistory = None + """ Past list of status codes (the current status may be included to + cover the start date of the status). + List of `EpisodeOfCareStatusHistory` items (represented as `dict` in JSON). """ + + self.team = None + """ Other practitioners facilitating this episode of care. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.type = None + """ Type/class - e.g. specialist referral, disease management. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(EpisodeOfCare, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EpisodeOfCare, self).elementProperties() + js.extend([ + ("account", "account", fhirreference.FHIRReference, True, None, False), + ("careManager", "careManager", fhirreference.FHIRReference, False, None, False), + ("diagnosis", "diagnosis", EpisodeOfCareDiagnosis, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("managingOrganization", "managingOrganization", fhirreference.FHIRReference, False, None, False), + ("patient", "patient", fhirreference.FHIRReference, False, None, True), + ("period", "period", period.Period, False, None, False), + ("referralRequest", "referralRequest", fhirreference.FHIRReference, True, None, False), + ("status", "status", str, False, None, True), + ("statusHistory", "statusHistory", EpisodeOfCareStatusHistory, True, None, False), + ("team", "team", fhirreference.FHIRReference, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +from . import backboneelement + +class EpisodeOfCareDiagnosis(backboneelement.BackboneElement): + """ The list of diagnosis relevant to this episode of care. + """ + + resource_type = "EpisodeOfCareDiagnosis" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.condition = None + """ Conditions/problems/diagnoses this episode of care is for. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.rank = None + """ Ranking of the diagnosis (for each role type). + Type `int`. """ + + self.role = None + """ Role that this diagnosis has within the episode of care (e.g. + admission, billing, discharge …). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(EpisodeOfCareDiagnosis, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EpisodeOfCareDiagnosis, self).elementProperties() + js.extend([ + ("condition", "condition", fhirreference.FHIRReference, False, None, True), + ("rank", "rank", int, False, None, False), + ("role", "role", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class EpisodeOfCareStatusHistory(backboneelement.BackboneElement): + """ Past list of status codes (the current status may be included to cover the + start date of the status). + + The history of statuses that the EpisodeOfCare has been through (without + requiring processing the history of the resource). + """ + + resource_type = "EpisodeOfCareStatusHistory" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Duration the EpisodeOfCare was in the specified status. + Type `Period` (represented as `dict` in JSON). """ + + self.status = None + """ planned | waitlist | active | onhold | finished | cancelled | + entered-in-error. + Type `str`. """ + + super(EpisodeOfCareStatusHistory, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EpisodeOfCareStatusHistory, self).elementProperties() + js.extend([ + ("period", "period", period.Period, False, None, True), + ("status", "status", str, 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 period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/R4/episodeofcare_tests.py b/fhirclient/models/R4/episodeofcare_tests.py new file mode 100644 index 000000000..ba10b79d9 --- /dev/null +++ b/fhirclient/models/R4/episodeofcare_tests.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import episodeofcare +from .fhirdate import FHIRDate + + +class EpisodeOfCareTests(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("EpisodeOfCare", js["resourceType"]) + return episodeofcare.EpisodeOfCare(js) + + def testEpisodeOfCare1(self): + inst = self.instantiate_from("episodeofcare-example.json") + self.assertIsNotNone(inst, "Must have instantiated a EpisodeOfCare instance") + self.implEpisodeOfCare1(inst) + + js = inst.as_json() + self.assertEqual("EpisodeOfCare", js["resourceType"]) + inst2 = episodeofcare.EpisodeOfCare(js) + self.implEpisodeOfCare1(inst2) + + 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://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") + self.assertEqual(inst.statusHistory[0].period.end.date, FHIRDate("2014-09-14").date) + self.assertEqual(inst.statusHistory[0].period.end.as_json(), "2014-09-14") + self.assertEqual(inst.statusHistory[0].period.start.date, FHIRDate("2014-09-01").date) + self.assertEqual(inst.statusHistory[0].period.start.as_json(), "2014-09-01") + self.assertEqual(inst.statusHistory[0].status, "planned") + self.assertEqual(inst.statusHistory[1].period.end.date, FHIRDate("2014-09-21").date) + self.assertEqual(inst.statusHistory[1].period.end.as_json(), "2014-09-21") + self.assertEqual(inst.statusHistory[1].period.start.date, FHIRDate("2014-09-15").date) + self.assertEqual(inst.statusHistory[1].period.start.as_json(), "2014-09-15") + self.assertEqual(inst.statusHistory[1].status, "active") + self.assertEqual(inst.statusHistory[2].period.end.date, FHIRDate("2014-09-24").date) + self.assertEqual(inst.statusHistory[2].period.end.as_json(), "2014-09-24") + self.assertEqual(inst.statusHistory[2].period.start.date, FHIRDate("2014-09-22").date) + self.assertEqual(inst.statusHistory[2].period.start.as_json(), "2014-09-22") + self.assertEqual(inst.statusHistory[2].status, "onhold") + self.assertEqual(inst.statusHistory[3].period.start.date, FHIRDate("2014-09-25").date) + self.assertEqual(inst.statusHistory[3].period.start.as_json(), "2014-09-25") + self.assertEqual(inst.statusHistory[3].status, "active") + 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://terminology.hl7.org/CodeSystem/episodeofcare-type") + diff --git a/fhirclient/models/eventdefinition.py b/fhirclient/models/R4/eventdefinition.py similarity index 99% rename from fhirclient/models/eventdefinition.py rename to fhirclient/models/R4/eventdefinition.py index f3a18a3e3..47bc6d4d5 100644 --- a/fhirclient/models/eventdefinition.py +++ b/fhirclient/models/R4/eventdefinition.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/EventDefinition) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/EventDefinition) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/eventdefinition_tests.py b/fhirclient/models/R4/eventdefinition_tests.py similarity index 95% rename from fhirclient/models/eventdefinition_tests.py rename to fhirclient/models/R4/eventdefinition_tests.py index 903d444ae..53a9a0d69 100644 --- a/fhirclient/models/eventdefinition_tests.py +++ b/fhirclient/models/R4/eventdefinition_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/evidence.py b/fhirclient/models/R4/evidence.py similarity index 99% rename from fhirclient/models/evidence.py rename to fhirclient/models/R4/evidence.py index d2b6ba5ee..9510c22da 100644 --- a/fhirclient/models/evidence.py +++ b/fhirclient/models/R4/evidence.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Evidence) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Evidence) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/evidence_tests.py b/fhirclient/models/R4/evidence_tests.py similarity index 93% rename from fhirclient/models/evidence_tests.py rename to fhirclient/models/R4/evidence_tests.py index e61c309ae..953ac5075 100644 --- a/fhirclient/models/evidence_tests.py +++ b/fhirclient/models/R4/evidence_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/evidencevariable.py b/fhirclient/models/R4/evidencevariable.py similarity index 99% rename from fhirclient/models/evidencevariable.py rename to fhirclient/models/R4/evidencevariable.py index e0ef1fb60..c15fa76c5 100644 --- a/fhirclient/models/evidencevariable.py +++ b/fhirclient/models/R4/evidencevariable.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/EvidenceVariable) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/EvidenceVariable) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/evidencevariable_tests.py b/fhirclient/models/R4/evidencevariable_tests.py similarity index 94% rename from fhirclient/models/evidencevariable_tests.py rename to fhirclient/models/R4/evidencevariable_tests.py index 1f0d8069b..c7821a9af 100644 --- a/fhirclient/models/evidencevariable_tests.py +++ b/fhirclient/models/R4/evidencevariable_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/examplescenario.py b/fhirclient/models/R4/examplescenario.py similarity index 99% rename from fhirclient/models/examplescenario.py rename to fhirclient/models/R4/examplescenario.py index dcc85f74a..f42e1fd49 100644 --- a/fhirclient/models/examplescenario.py +++ b/fhirclient/models/R4/examplescenario.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ExampleScenario) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ExampleScenario) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/examplescenario_tests.py b/fhirclient/models/R4/examplescenario_tests.py similarity index 99% rename from fhirclient/models/examplescenario_tests.py rename to fhirclient/models/R4/examplescenario_tests.py index 451a4cc24..8864b6577 100644 --- a/fhirclient/models/examplescenario_tests.py +++ b/fhirclient/models/R4/examplescenario_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/R4/explanationofbenefit.py b/fhirclient/models/R4/explanationofbenefit.py new file mode 100644 index 000000000..1cfdfdf5c --- /dev/null +++ b/fhirclient/models/R4/explanationofbenefit.py @@ -0,0 +1,1608 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ExplanationOfBenefit) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class ExplanationOfBenefit(domainresource.DomainResource): + """ Explanation of Benefit resource. + + This resource provides: the claim details; adjudication details from the + processing of a Claim; and optionally account balance information, for + informing the subscriber of the benefits provided. + """ + + resource_type = "ExplanationOfBenefit" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.accident = None + """ 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 + """ Relevant time frame for the claim. + Type `Period` (represented as `dict` in JSON). """ + + self.careTeam = None + """ Care Team members. + List of `ExplanationOfBenefitCareTeam` items (represented as `dict` in JSON). """ + + self.claim = None + """ Claim reference. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.claimResponse = None + """ Claim response reference. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.created = None + """ Response creation date. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.diagnosis = None + """ Pertinent diagnosis information. + List of `ExplanationOfBenefitDiagnosis` items (represented as `dict` in JSON). """ + + self.disposition = None + """ Disposition Message. + Type `str`. """ + + self.enterer = None + """ Author of the claim. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.facility = None + """ Servicing Facility. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.form = None + """ 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.fundsReserveRequested = None + """ For whom to reserve funds. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.identifier = None + """ Business Identifier for the resource. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.insurance = None + """ Patient insurance information. + List of `ExplanationOfBenefitInsurance` items (represented as `dict` in JSON). """ + + self.insurer = None + """ Party responsible for reimbursement. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.item = None + """ Product or service provided. + List of `ExplanationOfBenefitItem` items (represented as `dict` in JSON). """ + + self.originalPrescription = None + """ Original prescription if superceded by fulfiller. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.outcome = None + """ queued | complete | error | partial. + Type `str`. """ + + self.patient = None + """ The recipient of the products and services. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.payee = None + """ Recipient of benefits payable. + Type `ExplanationOfBenefitPayee` (represented as `dict` in JSON). """ + + self.payment = None + """ 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` (represented as `dict` in JSON). """ + + self.priority = None + """ Desired processing urgency. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.procedure = None + """ Clinical procedures performed. + List of `ExplanationOfBenefitProcedure` items (represented as `dict` in JSON). """ + + self.processNote = None + """ Note concerning adjudication. + List of `ExplanationOfBenefitProcessNote` items (represented as `dict` in JSON). """ + + self.provider = None + """ Party responsible for the claim. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.referral = None + """ Treatment Referral. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.related = None + """ Prior or corollary claims. + List of `ExplanationOfBenefitRelated` items (represented as `dict` in JSON). """ + + self.status = None + """ active | cancelled | draft | entered-in-error. + Type `str`. """ + + self.subType = None + """ More granular claim type. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.supportingInfo = None + """ Supporting information. + List of `ExplanationOfBenefitSupportingInfo` items (represented as `dict` in JSON). """ + + self.total = None + """ Adjudication totals. + List of `ExplanationOfBenefitTotal` items (represented as `dict` in JSON). """ + + self.type = None + """ Category or discipline. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.use = None + """ claim | preauthorization | predetermination. + Type `str`. """ + + super(ExplanationOfBenefit, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefit, self).elementProperties() + 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, True), + ("diagnosis", "diagnosis", ExplanationOfBenefitDiagnosis, True, None, False), + ("disposition", "disposition", str, False, None, False), + ("enterer", "enterer", fhirreference.FHIRReference, False, None, False), + ("facility", "facility", fhirreference.FHIRReference, 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), + ("insurance", "insurance", ExplanationOfBenefitInsurance, True, None, True), + ("insurer", "insurer", fhirreference.FHIRReference, False, None, True), + ("item", "item", ExplanationOfBenefitItem, True, None, False), + ("originalPrescription", "originalPrescription", 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, True), + ("referral", "referral", fhirreference.FHIRReference, False, None, False), + ("related", "related", ExplanationOfBenefitRelated, True, 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 + + +from . import backboneelement + +class ExplanationOfBenefitAccident(backboneelement.BackboneElement): + """ Details of the event. + + Details of a accident which resulted in injuries which required the + products and services listed in the claim. + """ + + resource_type = "ExplanationOfBenefitAccident" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ When the incident occurred. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.locationAddress = None + """ Where the event occurred. + Type `Address` (represented as `dict` in JSON). """ + + self.locationReference = None + """ Where the event occurred. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.type = None + """ The nature of the accident. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ExplanationOfBenefitAccident, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitAccident, self).elementProperties() + js.extend([ + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("locationAddress", "locationAddress", address.Address, False, "location", False), + ("locationReference", "locationReference", fhirreference.FHIRReference, False, "location", False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class ExplanationOfBenefitAddItem(backboneelement.BackboneElement): + """ Insurer added line items. + + The first-tier service adjudications for payor added product or service + lines. + """ + + resource_type = "ExplanationOfBenefitAddItem" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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.bodySite = None + """ Anatomical location. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.detail = None + """ Insurer added line items. + List of `ExplanationOfBenefitAddItemDetail` items (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 + """ 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 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.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) + + def elementProperties(self): + js = super(ExplanationOfBenefitAddItem, self).elementProperties() + js.extend([ + ("adjudication", "adjudication", ExplanationOfBenefitItemAdjudication, True, None, False), + ("bodySite", "bodySite", codeableconcept.CodeableConcept, False, None, False), + ("detail", "detail", ExplanationOfBenefitAddItemDetail, True, 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), + ("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): + """ Insurer added line items. + + The second-tier service adjudications for payor added services. + """ + + resource_type = "ExplanationOfBenefitAddItemDetail" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Applicable note numbers. + List of `int` items. """ + + self.productOrService = None + """ Billing, service, product, or drug code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + 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 + """ Applicable note numbers. + List of `int` items. """ + + self.productOrService = None + """ Billing, service, product, or drug code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.quantity = None + """ Count of products or services. + Type `Quantity` (represented as `dict` in JSON). """ + + 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(ExplanationOfBenefitAddItemDetailSubDetail, 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), + ("unitPrice", "unitPrice", money.Money, False, None, False), + ]) + return js + + +class ExplanationOfBenefitBenefitBalance(backboneelement.BackboneElement): + """ Balance by Benefit Category. + """ + + resource_type = "ExplanationOfBenefitBenefitBalance" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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.description = None + """ Description of the benefit or services covered. + Type `str`. """ + + self.excluded = None + """ Excluded from the plan. + Type `bool`. """ + + self.financial = None + """ Benefit Summary. + List of `ExplanationOfBenefitBenefitBalanceFinancial` items (represented as `dict` in JSON). """ + + self.name = None + """ Short name for the benefit. + Type `str`. """ + + self.network = None + """ In or out of network. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.term = None + """ Annual or lifetime. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.unit = None + """ Individual or family. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ExplanationOfBenefitBenefitBalance, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitBenefitBalance, self).elementProperties() + js.extend([ + ("category", "category", codeableconcept.CodeableConcept, False, None, True), + ("description", "description", str, False, None, False), + ("excluded", "excluded", bool, False, None, False), + ("financial", "financial", ExplanationOfBenefitBenefitBalanceFinancial, True, None, False), + ("name", "name", str, False, None, False), + ("network", "network", codeableconcept.CodeableConcept, False, None, False), + ("term", "term", codeableconcept.CodeableConcept, False, None, False), + ("unit", "unit", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class ExplanationOfBenefitBenefitBalanceFinancial(backboneelement.BackboneElement): + """ Benefit Summary. + + Benefits Used to date. + """ + + resource_type = "ExplanationOfBenefitBenefitBalanceFinancial" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.allowedMoney = None + """ Benefits allowed. + Type `Money` (represented as `dict` in JSON). """ + + self.allowedString = None + """ Benefits allowed. + Type `str`. """ + + self.allowedUnsignedInt = None + """ Benefits allowed. + Type `int`. """ + + self.type = None + """ Benefit classification. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.usedMoney = None + """ Benefits used. + Type `Money` (represented as `dict` in JSON). """ + + self.usedUnsignedInt = None + """ Benefits used. + Type `int`. """ + + super(ExplanationOfBenefitBenefitBalanceFinancial, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitBenefitBalanceFinancial, 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), + ("usedUnsignedInt", "usedUnsignedInt", int, False, "used", False), + ]) + return js + + +class ExplanationOfBenefitCareTeam(backboneelement.BackboneElement): + """ Care Team members. + + The members of the team who provided the products and services. + """ + + resource_type = "ExplanationOfBenefitCareTeam" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.provider = None + """ Practitioner or organization. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.qualification = None + """ Practitioner credential or specialization. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.responsible = None + """ Indicator of the lead practitioner. + Type `bool`. """ + + self.role = None + """ Function within the team. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.sequence = None + """ Order of care team. + Type `int`. """ + + super(ExplanationOfBenefitCareTeam, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitCareTeam, self).elementProperties() + js.extend([ + ("provider", "provider", fhirreference.FHIRReference, False, None, True), + ("qualification", "qualification", codeableconcept.CodeableConcept, False, None, False), + ("responsible", "responsible", bool, False, None, False), + ("role", "role", codeableconcept.CodeableConcept, False, None, False), + ("sequence", "sequence", int, False, None, True), + ]) + return js + + +class ExplanationOfBenefitDiagnosis(backboneelement.BackboneElement): + """ Pertinent diagnosis information. + + Information about diagnoses relevant to the claim items. + """ + + resource_type = "ExplanationOfBenefitDiagnosis" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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). """ + + 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 + """ Diagnosis instance identifier. + Type `int`. """ + + self.type = None + """ Timing or nature of the diagnosis. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(ExplanationOfBenefitDiagnosis, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitDiagnosis, self).elementProperties() + 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), + ]) + return js + + +class ExplanationOfBenefitInsurance(backboneelement.BackboneElement): + """ Patient insurance information. + + Financial instruments for reimbursement for the health care products and + services specified on the claim. + """ + + resource_type = "ExplanationOfBenefitInsurance" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.coverage = None + """ Insurance information. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.focal = None + """ Coverage to be used for adjudication. + Type `bool`. """ + + self.preAuthRef = None + """ Prior authorization reference number. + List of `str` items. """ + + super(ExplanationOfBenefitInsurance, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitInsurance, self).elementProperties() + js.extend([ + ("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): + """ Product or service provided. + + 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Adjudication details. + List of `ExplanationOfBenefitItemAdjudication` items (represented as `dict` in JSON). """ + + self.bodySite = None + """ Anatomical location. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.careTeamSequence = None + """ Applicable care team members. + List of `int` items. """ + + self.category = None + """ Benefit classification. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.detail = None + """ Additional items. + List of `ExplanationOfBenefitItemDetail` items (represented as `dict` in JSON). """ + + self.diagnosisSequence = None + """ Applicable diagnoses. + List of `int` items. """ + + self.encounter = None + """ Encounters related to this billed item. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.factor = None + """ Price scaling factor. + Type `float`. """ + + self.informationSequence = None + """ Applicable exception and supporting information. + 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 + """ 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.noteNumber = None + """ Applicable note numbers. + List of `int` items. """ + + 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 the product or service is provided under. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.quantity = None + """ Count of products or services. + Type `Quantity` (represented as `dict` in JSON). """ + + self.revenue = None + """ Revenue or cost center code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.sequence = None + """ Item instance identifier. + Type `int`. """ + + 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.udi = None + """ Unique device identifier. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.unitPrice = None + """ Fee, charge or cost per item. + Type `Money` (represented as `dict` in JSON). """ + + super(ExplanationOfBenefitItem, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitItem, self).elementProperties() + js.extend([ + ("adjudication", "adjudication", ExplanationOfBenefitItemAdjudication, True, None, False), + ("bodySite", "bodySite", codeableconcept.CodeableConcept, False, None, False), + ("careTeamSequence", "careTeamSequence", int, True, None, False), + ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("detail", "detail", ExplanationOfBenefitItemDetail, True, None, False), + ("diagnosisSequence", "diagnosisSequence", int, True, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, True, None, False), + ("factor", "factor", float, False, 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), + ("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), + ("servicedDate", "servicedDate", fhirdate.FHIRDate, False, "serviced", False), + ("servicedPeriod", "servicedPeriod", period.Period, False, "serviced", False), + ("subSite", "subSite", codeableconcept.CodeableConcept, True, None, False), + ("udi", "udi", fhirreference.FHIRReference, True, None, False), + ("unitPrice", "unitPrice", money.Money, False, None, False), + ]) + return js + + +class ExplanationOfBenefitItemAdjudication(backboneelement.BackboneElement): + """ Adjudication details. + + 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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. + Type `Money` (represented as `dict` in JSON). """ + + self.category = None + """ Type of adjudication information. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.reason = None + """ Explanation of adjudication outcome. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.value = None + """ Non-monitary value. + Type `float`. """ + + super(ExplanationOfBenefitItemAdjudication, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitItemAdjudication, self).elementProperties() + js.extend([ + ("amount", "amount", money.Money, False, None, False), + ("category", "category", codeableconcept.CodeableConcept, False, None, True), + ("reason", "reason", codeableconcept.CodeableConcept, False, None, False), + ("value", "value", float, False, None, False), + ]) + return js + + +class ExplanationOfBenefitItemDetail(backboneelement.BackboneElement): + """ Additional items. + + Second-tier of goods and services. + """ + + resource_type = "ExplanationOfBenefitItemDetail" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Detail level adjudication details. + List of `ExplanationOfBenefitItemAdjudication` items (represented as `dict` in JSON). """ + + self.category = None + """ Benefit classification. + Type `CodeableConcept` (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 + """ 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 the product or service is provided under. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.quantity = None + """ Count of products or services. + Type `Quantity` (represented as `dict` in JSON). """ + + self.revenue = None + """ Revenue or cost center code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.sequence = None + """ Product or service provided. + Type `int`. """ + + self.subDetail = None + """ Additional items. + List of `ExplanationOfBenefitItemDetailSubDetail` items (represented as `dict` in JSON). """ + + self.udi = None + """ Unique device identifier. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.unitPrice = None + """ Fee, charge or cost per item. + Type `Money` (represented as `dict` in JSON). """ + + super(ExplanationOfBenefitItemDetail, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitItemDetail, self).elementProperties() + js.extend([ + ("adjudication", "adjudication", ExplanationOfBenefitItemAdjudication, True, None, False), + ("category", "category", codeableconcept.CodeableConcept, 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), + ("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), + ("subDetail", "subDetail", ExplanationOfBenefitItemDetailSubDetail, True, None, False), + ("udi", "udi", fhirreference.FHIRReference, True, None, False), + ("unitPrice", "unitPrice", money.Money, False, None, False), + ]) + return js + + +class ExplanationOfBenefitItemDetailSubDetail(backboneelement.BackboneElement): + """ Additional items. + + Third-tier of goods and services. + """ + + resource_type = "ExplanationOfBenefitItemDetailSubDetail" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Subdetail level adjudication details. + List of `ExplanationOfBenefitItemAdjudication` items (represented as `dict` in JSON). """ + + self.category = None + """ Benefit classification. + Type `CodeableConcept` (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 + """ 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 the product or service is provided under. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.quantity = None + """ Count of products or services. + Type `Quantity` (represented as `dict` in JSON). """ + + self.revenue = None + """ Revenue or cost center code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.sequence = None + """ Product or service provided. + Type `int`. """ + + self.udi = None + """ Unique device identifier. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.unitPrice = None + """ Fee, charge or cost per item. + Type `Money` (represented as `dict` in JSON). """ + + super(ExplanationOfBenefitItemDetailSubDetail, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitItemDetailSubDetail, self).elementProperties() + js.extend([ + ("adjudication", "adjudication", ExplanationOfBenefitItemAdjudication, True, None, False), + ("category", "category", codeableconcept.CodeableConcept, 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), + ("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), + ("udi", "udi", fhirreference.FHIRReference, True, None, False), + ("unitPrice", "unitPrice", money.Money, False, None, False), + ]) + return js + + +class ExplanationOfBenefitPayee(backboneelement.BackboneElement): + """ Recipient of benefits payable. + + The party to be reimbursed for cost of the products and services according + to the terms of the policy. + """ + + resource_type = "ExplanationOfBenefitPayee" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.party = None + """ Recipient reference. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.type = None + """ Category of recipient. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ExplanationOfBenefitPayee, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitPayee, self).elementProperties() + js.extend([ + ("party", "party", fhirreference.FHIRReference, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class ExplanationOfBenefitPayment(backboneelement.BackboneElement): + """ Payment Details. + + Payment details for the adjudication of the claim. + """ + + resource_type = "ExplanationOfBenefitPayment" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.adjustment = None + """ Payment adjustment for non-claim issues. + Type `Money` (represented as `dict` in JSON). """ + + self.adjustmentReason = None + """ Explanation for the variance. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.amount = None + """ Payable amount after adjustment. + Type `Money` (represented as `dict` in JSON). """ + + self.date = None + """ Expected date of payment. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.identifier = None + """ Business identifier for the payment. + Type `Identifier` (represented as `dict` in JSON). """ + + self.type = None + """ Partial or complete payment. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ExplanationOfBenefitPayment, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitPayment, self).elementProperties() + js.extend([ + ("adjustment", "adjustment", money.Money, False, None, False), + ("adjustmentReason", "adjustmentReason", codeableconcept.CodeableConcept, False, None, False), + ("amount", "amount", money.Money, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class ExplanationOfBenefitProcedure(backboneelement.BackboneElement): + """ Clinical procedures performed. + + Procedures performed on the patient relevant to the billing items with the + claim. + """ + + resource_type = "ExplanationOfBenefitProcedure" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ When the procedure was performed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.procedureCodeableConcept = None + """ Specific clinical procedure. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.procedureReference = None + """ Specific clinical procedure. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.sequence = None + """ 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): + js = super(ExplanationOfBenefitProcedure, self).elementProperties() + js.extend([ + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("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): + """ Note concerning adjudication. + + A note that describes or explains adjudication results in a human readable + form. + """ + + resource_type = "ExplanationOfBenefitProcessNote" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Language of the text. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.number = None + """ Note instance identifier. + Type `int`. """ + + self.text = None + """ Note explanatory text. + Type `str`. """ + + self.type = None + """ display | print | printoper. + Type `str`. """ + + super(ExplanationOfBenefitProcessNote, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitProcessNote, self).elementProperties() + js.extend([ + ("language", "language", codeableconcept.CodeableConcept, False, None, False), + ("number", "number", int, False, None, False), + ("text", "text", str, False, None, False), + ("type", "type", str, False, None, False), + ]) + return js + + +class ExplanationOfBenefitRelated(backboneelement.BackboneElement): + """ Prior or corollary claims. + + 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.claim = None + """ Reference to the related claim. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.reference = None + """ File or case reference. + Type `Identifier` (represented as `dict` in JSON). """ + + self.relationship = None + """ How the reference claim is related. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ExplanationOfBenefitRelated, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitRelated, self).elementProperties() + js.extend([ + ("claim", "claim", fhirreference.FHIRReference, False, None, False), + ("reference", "reference", identifier.Identifier, False, None, False), + ("relationship", "relationship", codeableconcept.CodeableConcept, False, None, False), + ]) + 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 +except ImportError: + address = sys.modules[__package__ + '.address'] +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 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 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/R4/explanationofbenefit_tests.py b/fhirclient/models/R4/explanationofbenefit_tests.py new file mode 100644 index 000000000..5fc6ff31c --- /dev/null +++ b/fhirclient/models/R4/explanationofbenefit_tests.py @@ -0,0 +1,184 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import explanationofbenefit +from .fhirdate import FHIRDate + + +class ExplanationOfBenefitTests(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("ExplanationOfBenefit", js["resourceType"]) + return explanationofbenefit.ExplanationOfBenefit(js) + + def testExplanationOfBenefit1(self): + inst = self.instantiate_from("explanationofbenefit-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ExplanationOfBenefit instance") + self.implExplanationOfBenefit1(inst) + + js = inst.as_json() + self.assertEqual("ExplanationOfBenefit", js["resourceType"]) + inst2 = explanationofbenefit.ExplanationOfBenefit(js) + self.implExplanationOfBenefit1(inst2) + + def implExplanationOfBenefit1(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.disposition, "Claim settled as per contract.") + 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.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.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].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].servicedDate.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.item[0].servicedDate.as_json(), "2014-08-16") + self.assertEqual(inst.item[0].unitPrice.currency, "USD") + self.assertEqual(inst.item[0].unitPrice.value, 135.57) + 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://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.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://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/R4/expression.py similarity index 97% rename from fhirclient/models/expression.py rename to fhirclient/models/R4/expression.py index 119206532..e871fb098 100644 --- a/fhirclient/models/expression.py +++ b/fhirclient/models/R4/expression.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Expression) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Expression) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/R4/extension.py b/fhirclient/models/R4/extension.py new file mode 100644 index 000000000..b37f021a4 --- /dev/null +++ b/fhirclient/models/R4/extension.py @@ -0,0 +1,409 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Extension) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Extension(element.Element): + """ Optional Extensions Element. + + Optional Extension Element - found in all resources. + """ + + resource_type = "Extension" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.url = None + """ identifies the meaning of the extension. + Type `str`. """ + + self.valueAddress = None + """ Value of extension. + Type `Address` (represented as `dict` in JSON). """ + + self.valueAge = None + """ Value of extension. + Type `Age` (represented as `dict` in JSON). """ + + self.valueAnnotation = None + """ Value of extension. + Type `Annotation` (represented as `dict` in JSON). """ + + self.valueAttachment = None + """ Value of extension. + Type `Attachment` (represented as `dict` in JSON). """ + + self.valueBase64Binary = None + """ Value of extension. + Type `str`. """ + + self.valueBoolean = None + """ Value of extension. + Type `bool`. """ + + self.valueCanonical = None + """ Value of extension. + Type `str`. """ + + self.valueCode = None + """ Value of extension. + Type `str`. """ + + self.valueCodeableConcept = None + """ Value of extension. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueCoding = None + """ 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). """ + + self.valueDateTime = None + """ Value of extension. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueDecimal = None + """ Value of extension. + Type `float`. """ + + self.valueDistance = None + """ 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). """ + + self.valueId = None + """ Value of extension. + Type `str`. """ + + self.valueIdentifier = None + """ Value of extension. + Type `Identifier` (represented as `dict` in JSON). """ + + self.valueInstant = None + """ Value of extension. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueInteger = None + """ Value of extension. + Type `int`. """ + + self.valueMarkdown = None + """ Value of extension. + Type `str`. """ + + self.valueMoney = None + """ Value of extension. + Type `Money` (represented as `dict` in JSON). """ + + self.valueOid = None + """ 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). """ + + self.valuePositiveInt = None + """ Value of extension. + Type `int`. """ + + self.valueQuantity = None + """ Value of extension. + Type `Quantity` (represented as `dict` in JSON). """ + + self.valueRange = None + """ Value of extension. + Type `Range` (represented as `dict` in JSON). """ + + self.valueRatio = None + """ Value of extension. + Type `Ratio` (represented as `dict` in JSON). """ + + self.valueReference = None + """ 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). """ + + self.valueSignature = None + """ Value of extension. + Type `Signature` (represented as `dict` in JSON). """ + + self.valueString = None + """ Value of extension. + Type `str`. """ + + self.valueTime = None + """ Value of extension. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueTiming = None + """ 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`. """ + + self.valueUri = None + """ 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): + js = super(Extension, self).elementProperties() + js.extend([ + ("url", "url", str, False, None, True), + ("valueAddress", "valueAddress", address.Address, False, "value", False), + ("valueAge", "valueAge", age.Age, False, "value", False), + ("valueAnnotation", "valueAnnotation", annotation.Annotation, False, "value", False), + ("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), + ("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 + + +import sys +try: + from . import address +except ImportError: + address = sys.modules[__package__ + '.address'] +try: + from . import age +except ImportError: + age = sys.modules[__package__ + '.age'] +try: + from . import annotation +except ImportError: + annotation = sys.modules[__package__ + '.annotation'] +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 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: + fhirdate = sys.modules[__package__ + '.fhirdate'] +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 parameterdefinition +except ImportError: + parameterdefinition = sys.modules[__package__ + '.parameterdefinition'] +try: + 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 relatedartifact +except ImportError: + relatedartifact = sys.modules[__package__ + '.relatedartifact'] +try: + from . import sampleddata +except ImportError: + sampleddata = sys.modules[__package__ + '.sampleddata'] +try: + from . import signature +except ImportError: + signature = sys.modules[__package__ + '.signature'] +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/R4/familymemberhistory.py b/fhirclient/models/R4/familymemberhistory.py new file mode 100644 index 000000000..9ced6eab6 --- /dev/null +++ b/fhirclient/models/R4/familymemberhistory.py @@ -0,0 +1,268 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/FamilyMemberHistory) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class FamilyMemberHistory(domainresource.DomainResource): + """ Information about patient's relatives, relevant for patient. + + Significant health conditions for a person related to the patient relevant + in the context of care for the patient. + """ + + resource_type = "FamilyMemberHistory" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.ageAge = None + """ (approximate) age. + Type `Age` (represented as `dict` in JSON). """ + + self.ageRange = None + """ (approximate) age. + Type `Range` (represented as `dict` in JSON). """ + + self.ageString = None + """ (approximate) age. + Type `str`. """ + + self.bornDate = None + """ (approximate) date of birth. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.bornPeriod = None + """ (approximate) date of birth. + Type `Period` (represented as `dict` in JSON). """ + + self.bornString = None + """ (approximate) date of birth. + Type `str`. """ + + self.condition = None + """ 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 recorded or last updated. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.deceasedAge = None + """ Dead? How old/when?. + Type `Age` (represented as `dict` in JSON). """ + + self.deceasedBoolean = None + """ Dead? How old/when?. + Type `bool`. """ + + self.deceasedDate = None + """ Dead? How old/when?. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.deceasedRange = None + """ Dead? How old/when?. + Type `Range` (represented as `dict` in JSON). """ + + self.deceasedString = None + """ Dead? How old/when?. + Type `str`. """ + + self.estimatedAge = None + """ Age is estimated?. + Type `bool`. """ + + 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.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` (represented as `dict` in JSON). """ + + self.reasonCode = None + """ Why was family member history performed?. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.reasonReference = None + """ Why was family member history performed?. + 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`. """ + + super(FamilyMemberHistory, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(FamilyMemberHistory, self).elementProperties() + js.extend([ + ("ageAge", "ageAge", age.Age, False, "age", False), + ("ageRange", "ageRange", range.Range, False, "age", False), + ("ageString", "ageString", str, False, "age", False), + ("bornDate", "bornDate", fhirdate.FHIRDate, False, "born", False), + ("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), + ("estimatedAge", "estimatedAge", bool, 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), + ("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 + + +from . import backboneelement + +class FamilyMemberHistoryCondition(backboneelement.BackboneElement): + """ Condition that the related person had. + + The significant Conditions (or condition) that the family member had. This + is a repeating section to allow a system to represent more than one + condition per resource, though there is nothing stopping multiple resources + - one per condition. + """ + + resource_type = "FamilyMemberHistoryCondition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ 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). """ + + self.onsetAge = None + """ When condition first manifested. + Type `Age` (represented as `dict` in JSON). """ + + self.onsetPeriod = None + """ When condition first manifested. + Type `Period` (represented as `dict` in JSON). """ + + self.onsetRange = None + """ When condition first manifested. + Type `Range` (represented as `dict` in JSON). """ + + self.onsetString = None + """ When condition first manifested. + Type `str`. """ + + self.outcome = None + """ deceased | permanent disability | etc.. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(FamilyMemberHistoryCondition, self).__init__(jsondict=jsondict, strict=strict) + + 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), + ("onsetRange", "onsetRange", range.Range, False, "onset", False), + ("onsetString", "onsetString", str, False, "onset", False), + ("outcome", "outcome", 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: + 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'] +try: + from . import range +except ImportError: + range = sys.modules[__package__ + '.range'] diff --git a/fhirclient/models/R4/familymemberhistory_tests.py b/fhirclient/models/R4/familymemberhistory_tests.py new file mode 100644 index 000000000..67662cc34 --- /dev/null +++ b/fhirclient/models/R4/familymemberhistory_tests.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import familymemberhistory +from .fhirdate import FHIRDate + + +class FamilyMemberHistoryTests(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("FamilyMemberHistory", js["resourceType"]) + return familymemberhistory.FamilyMemberHistory(js) + + def testFamilyMemberHistory1(self): + inst = self.instantiate_from("familymemberhistory-example.json") + self.assertIsNotNone(inst, "Must have instantiated a FamilyMemberHistory instance") + self.implFamilyMemberHistory1(inst) + + js = inst.as_json() + self.assertEqual("FamilyMemberHistory", js["resourceType"]) + inst2 = familymemberhistory.FamilyMemberHistory(js) + self.implFamilyMemberHistory1(inst2) + + def implFamilyMemberHistory1(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].system, "http://snomed.info/sct") + 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, 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, "
Father died of a heart attack aged 74
") + self.assertEqual(inst.text.status, "generated") + + def testFamilyMemberHistory2(self): + inst = self.instantiate_from("familymemberhistory-example-mother.json") + self.assertIsNotNone(inst, "Must have instantiated a FamilyMemberHistory instance") + self.implFamilyMemberHistory2(inst) + + js = inst.as_json() + self.assertEqual("FamilyMemberHistory", js["resourceType"]) + inst2 = familymemberhistory.FamilyMemberHistory(js) + self.implFamilyMemberHistory2(inst2) + + def implFamilyMemberHistory2(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].system, "http://snomed.info/sct") + 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, 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, "
Mother died of a stroke aged 56
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/fhirabstractbase.py b/fhirclient/models/R4/fhirabstractbase.py similarity index 100% rename from fhirclient/models/fhirabstractbase.py rename to fhirclient/models/R4/fhirabstractbase.py diff --git a/fhirclient/models/fhirabstractresource.py b/fhirclient/models/R4/fhirabstractresource.py similarity index 100% rename from fhirclient/models/fhirabstractresource.py rename to fhirclient/models/R4/fhirabstractresource.py diff --git a/fhirclient/models/fhirdate.py b/fhirclient/models/R4/fhirdate.py similarity index 100% rename from fhirclient/models/fhirdate.py rename to fhirclient/models/R4/fhirdate.py diff --git a/fhirclient/models/R4/fhirelementfactory.py b/fhirclient/models/R4/fhirelementfactory.py new file mode 100644 index 000000000..45a6f4415 --- /dev/null +++ b/fhirclient/models/R4/fhirelementfactory.py @@ -0,0 +1,2013 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + + +class FHIRElementFactory(object): + """ Factory class to instantiate resources by resource name. + """ + + @classmethod + def instantiate(cls, resource_type, jsondict): + """ Instantiate a resource of the type correlating to "resource_type". + + :param str resource_type: The name/type of the resource to instantiate + :param dict jsondict: The JSON dictionary to use for data + :returns: A resource of the respective type or `Element` + """ + if "Account" == resource_type: + from . import account + return account.Account(jsondict) + if "AccountCoverage" == resource_type: + from . import account + return account.AccountCoverage(jsondict) + if "AccountGuarantor" == resource_type: + from . import account + return account.AccountGuarantor(jsondict) + if "ActivityDefinition" == resource_type: + from . import activitydefinition + return activitydefinition.ActivityDefinition(jsondict) + if "ActivityDefinitionDynamicValue" == resource_type: + from . import activitydefinition + return activitydefinition.ActivityDefinitionDynamicValue(jsondict) + if "ActivityDefinitionParticipant" == resource_type: + from . import activitydefinition + return activitydefinition.ActivityDefinitionParticipant(jsondict) + if "Address" == resource_type: + from . import address + return address.Address(jsondict) + if "AdverseEvent" == resource_type: + from . import adverseevent + return adverseevent.AdverseEvent(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) + if "AllergyIntolerance" == resource_type: + from . import allergyintolerance + return allergyintolerance.AllergyIntolerance(jsondict) + if "AllergyIntoleranceReaction" == resource_type: + from . import allergyintolerance + return allergyintolerance.AllergyIntoleranceReaction(jsondict) + if "Annotation" == resource_type: + from . import annotation + return annotation.Annotation(jsondict) + if "Appointment" == resource_type: + from . import appointment + return appointment.Appointment(jsondict) + if "AppointmentParticipant" == resource_type: + from . import appointment + return appointment.AppointmentParticipant(jsondict) + if "AppointmentResponse" == resource_type: + from . import appointmentresponse + return appointmentresponse.AppointmentResponse(jsondict) + if "Attachment" == resource_type: + from . import attachment + return attachment.Attachment(jsondict) + if "AuditEvent" == resource_type: + from . import auditevent + return auditevent.AuditEvent(jsondict) + if "AuditEventAgent" == resource_type: + from . import auditevent + return auditevent.AuditEventAgent(jsondict) + if "AuditEventAgentNetwork" == resource_type: + from . import auditevent + return auditevent.AuditEventAgentNetwork(jsondict) + if "AuditEventEntity" == resource_type: + from . import auditevent + return auditevent.AuditEventEntity(jsondict) + if "AuditEventEntityDetail" == resource_type: + from . import auditevent + return auditevent.AuditEventEntityDetail(jsondict) + if "AuditEventSource" == resource_type: + from . import auditevent + return auditevent.AuditEventSource(jsondict) + if "BackboneElement" == resource_type: + from . import backboneelement + return backboneelement.BackboneElement(jsondict) + if "Basic" == resource_type: + from . import basic + return basic.Basic(jsondict) + if "Binary" == resource_type: + from . import binary + return binary.Binary(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) + if "BundleEntry" == resource_type: + from . import bundle + return bundle.BundleEntry(jsondict) + if "BundleEntryRequest" == resource_type: + from . import bundle + return bundle.BundleEntryRequest(jsondict) + if "BundleEntryResponse" == resource_type: + from . import bundle + return bundle.BundleEntryResponse(jsondict) + if "BundleEntrySearch" == resource_type: + from . import bundle + return bundle.BundleEntrySearch(jsondict) + if "BundleLink" == resource_type: + from . import bundle + return bundle.BundleLink(jsondict) + if "CapabilityStatement" == resource_type: + from . import capabilitystatement + return capabilitystatement.CapabilityStatement(jsondict) + if "CapabilityStatementDocument" == resource_type: + from . import capabilitystatement + return capabilitystatement.CapabilityStatementDocument(jsondict) + if "CapabilityStatementImplementation" == resource_type: + from . import capabilitystatement + return capabilitystatement.CapabilityStatementImplementation(jsondict) + if "CapabilityStatementMessaging" == resource_type: + from . import capabilitystatement + return capabilitystatement.CapabilityStatementMessaging(jsondict) + if "CapabilityStatementMessagingEndpoint" == resource_type: + from . import capabilitystatement + return capabilitystatement.CapabilityStatementMessagingEndpoint(jsondict) + if "CapabilityStatementMessagingSupportedMessage" == resource_type: + from . import capabilitystatement + return capabilitystatement.CapabilityStatementMessagingSupportedMessage(jsondict) + if "CapabilityStatementRest" == resource_type: + from . import capabilitystatement + return capabilitystatement.CapabilityStatementRest(jsondict) + if "CapabilityStatementRestInteraction" == resource_type: + from . import capabilitystatement + return capabilitystatement.CapabilityStatementRestInteraction(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 "CapabilityStatementSoftware" == resource_type: + from . import capabilitystatement + return capabilitystatement.CapabilityStatementSoftware(jsondict) + if "CarePlan" == resource_type: + from . import careplan + return careplan.CarePlan(jsondict) + if "CarePlanActivity" == resource_type: + from . import careplan + return careplan.CarePlanActivity(jsondict) + if "CarePlanActivityDetail" == resource_type: + from . import careplan + return careplan.CarePlanActivityDetail(jsondict) + if "CareTeam" == resource_type: + from . import careteam + return careteam.CareTeam(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 "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.ChargeItemPerformer(jsondict) + if "Claim" == resource_type: + from . import claim + return claim.Claim(jsondict) + if "ClaimAccident" == resource_type: + from . import claim + return claim.ClaimAccident(jsondict) + if "ClaimCareTeam" == resource_type: + from . import claim + return claim.ClaimCareTeam(jsondict) + if "ClaimDiagnosis" == resource_type: + from . import claim + return claim.ClaimDiagnosis(jsondict) + if "ClaimInsurance" == resource_type: + from . import claim + return claim.ClaimInsurance(jsondict) + if "ClaimItem" == resource_type: + from . import claim + return claim.ClaimItem(jsondict) + if "ClaimItemDetail" == resource_type: + from . import claim + return claim.ClaimItemDetail(jsondict) + if "ClaimItemDetailSubDetail" == resource_type: + from . import claim + return claim.ClaimItemDetailSubDetail(jsondict) + if "ClaimPayee" == resource_type: + from . import claim + return claim.ClaimPayee(jsondict) + if "ClaimProcedure" == resource_type: + from . import claim + return claim.ClaimProcedure(jsondict) + if "ClaimRelated" == resource_type: + from . import claim + return claim.ClaimRelated(jsondict) + if "ClaimResponse" == resource_type: + from . import claimresponse + return claimresponse.ClaimResponse(jsondict) + if "ClaimResponseAddItem" == resource_type: + from . import claimresponse + return claimresponse.ClaimResponseAddItem(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) + if "ClaimResponseInsurance" == resource_type: + from . import claimresponse + return claimresponse.ClaimResponseInsurance(jsondict) + if "ClaimResponseItem" == resource_type: + from . import claimresponse + return claimresponse.ClaimResponseItem(jsondict) + if "ClaimResponseItemAdjudication" == resource_type: + from . import claimresponse + return claimresponse.ClaimResponseItemAdjudication(jsondict) + if "ClaimResponseItemDetail" == resource_type: + from . import claimresponse + return claimresponse.ClaimResponseItemDetail(jsondict) + if "ClaimResponseItemDetailSubDetail" == resource_type: + from . import claimresponse + return claimresponse.ClaimResponseItemDetailSubDetail(jsondict) + if "ClaimResponsePayment" == resource_type: + from . import claimresponse + return claimresponse.ClaimResponsePayment(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) + if "ClinicalImpressionFinding" == resource_type: + from . import clinicalimpression + return clinicalimpression.ClinicalImpressionFinding(jsondict) + if "ClinicalImpressionInvestigation" == resource_type: + from . import clinicalimpression + return clinicalimpression.ClinicalImpressionInvestigation(jsondict) + if "CodeSystem" == resource_type: + from . import codesystem + return codesystem.CodeSystem(jsondict) + if "CodeSystemConcept" == resource_type: + from . import codesystem + return codesystem.CodeSystemConcept(jsondict) + if "CodeSystemConceptDesignation" == resource_type: + from . import codesystem + return codesystem.CodeSystemConceptDesignation(jsondict) + if "CodeSystemConceptProperty" == resource_type: + from . import codesystem + return codesystem.CodeSystemConceptProperty(jsondict) + if "CodeSystemFilter" == resource_type: + from . import codesystem + return codesystem.CodeSystemFilter(jsondict) + if "CodeSystemProperty" == resource_type: + from . import codesystem + return codesystem.CodeSystemProperty(jsondict) + if "CodeableConcept" == resource_type: + from . import codeableconcept + return codeableconcept.CodeableConcept(jsondict) + if "Coding" == resource_type: + from . import coding + return coding.Coding(jsondict) + if "Communication" == resource_type: + from . import communication + return communication.Communication(jsondict) + if "CommunicationPayload" == resource_type: + from . import communication + return communication.CommunicationPayload(jsondict) + if "CommunicationRequest" == resource_type: + from . import communicationrequest + return communicationrequest.CommunicationRequest(jsondict) + if "CommunicationRequestPayload" == resource_type: + from . import communicationrequest + return communicationrequest.CommunicationRequestPayload(jsondict) + if "CompartmentDefinition" == resource_type: + from . import compartmentdefinition + return compartmentdefinition.CompartmentDefinition(jsondict) + if "CompartmentDefinitionResource" == resource_type: + from . import compartmentdefinition + return compartmentdefinition.CompartmentDefinitionResource(jsondict) + if "Composition" == resource_type: + from . import composition + return composition.Composition(jsondict) + if "CompositionAttester" == resource_type: + from . import composition + return composition.CompositionAttester(jsondict) + if "CompositionEvent" == resource_type: + from . import composition + return composition.CompositionEvent(jsondict) + if "CompositionRelatesTo" == resource_type: + from . import composition + return composition.CompositionRelatesTo(jsondict) + if "CompositionSection" == resource_type: + from . import composition + return composition.CompositionSection(jsondict) + if "ConceptMap" == resource_type: + from . import conceptmap + return conceptmap.ConceptMap(jsondict) + if "ConceptMapGroup" == resource_type: + from . import conceptmap + return conceptmap.ConceptMapGroup(jsondict) + if "ConceptMapGroupElement" == resource_type: + from . import conceptmap + return conceptmap.ConceptMapGroupElement(jsondict) + if "ConceptMapGroupElementTarget" == resource_type: + from . import conceptmap + return conceptmap.ConceptMapGroupElementTarget(jsondict) + if "ConceptMapGroupElementTargetDependsOn" == resource_type: + from . import conceptmap + return conceptmap.ConceptMapGroupElementTargetDependsOn(jsondict) + if "ConceptMapGroupUnmapped" == resource_type: + from . import conceptmap + return conceptmap.ConceptMapGroupUnmapped(jsondict) + if "Condition" == resource_type: + from . import condition + return condition.Condition(jsondict) + if "ConditionEvidence" == resource_type: + from . import condition + return condition.ConditionEvidence(jsondict) + if "ConditionStage" == resource_type: + from . import condition + return condition.ConditionStage(jsondict) + if "Consent" == resource_type: + from . import consent + return consent.Consent(jsondict) + if "ConsentPolicy" == resource_type: + from . import consent + return consent.ConsentPolicy(jsondict) + if "ConsentProvision" == resource_type: + from . import consent + return consent.ConsentProvision(jsondict) + if "ConsentProvisionActor" == resource_type: + from . import consent + return consent.ConsentProvisionActor(jsondict) + if "ConsentProvisionData" == resource_type: + from . import consent + return consent.ConsentProvisionData(jsondict) + if "ConsentVerification" == resource_type: + from . import consent + return consent.ConsentVerification(jsondict) + if "ContactDetail" == resource_type: + from . import contactdetail + return contactdetail.ContactDetail(jsondict) + if "ContactPoint" == resource_type: + from . import contactpoint + return contactpoint.ContactPoint(jsondict) + if "Contract" == resource_type: + from . import contract + return contract.Contract(jsondict) + if "ContractContentDefinition" == resource_type: + from . import contract + return contract.ContractContentDefinition(jsondict) + if "ContractFriendly" == resource_type: + from . import contract + return contract.ContractFriendly(jsondict) + if "ContractLegal" == resource_type: + from . import contract + return contract.ContractLegal(jsondict) + if "ContractRule" == resource_type: + from . import contract + return contract.ContractRule(jsondict) + if "ContractSigner" == resource_type: + from . import contract + return contract.ContractSigner(jsondict) + if "ContractTerm" == resource_type: + from . import contract + return contract.ContractTerm(jsondict) + 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.ContractTermOffer(jsondict) + if "ContractTermOfferAnswer" == resource_type: + from . import contract + return contract.ContractTermOfferAnswer(jsondict) + if "ContractTermOfferParty" == resource_type: + from . import contract + 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) + if "Count" == resource_type: + from . import count + return count.Count(jsondict) + if "Coverage" == resource_type: + from . import coverage + return coverage.Coverage(jsondict) + 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.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) + if "DataRequirementCodeFilter" == resource_type: + from . import datarequirement + return datarequirement.DataRequirementCodeFilter(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 "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 "DeviceRequestParameter" == resource_type: + from . import devicerequest + return devicerequest.DeviceRequestParameter(jsondict) + if "DeviceSpecialization" == resource_type: + from . import device + return device.DeviceSpecialization(jsondict) + if "DeviceUdiCarrier" == resource_type: + from . import device + 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 "DiagnosticReportMedia" == resource_type: + from . import diagnosticreport + 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 "DocumentManifestRelated" == resource_type: + from . import documentmanifest + return documentmanifest.DocumentManifestRelated(jsondict) + if "DocumentReference" == resource_type: + from . import documentreference + return documentreference.DocumentReference(jsondict) + if "DocumentReferenceContent" == resource_type: + from . import documentreference + return documentreference.DocumentReferenceContent(jsondict) + if "DocumentReferenceContext" == resource_type: + from . import documentreference + return documentreference.DocumentReferenceContext(jsondict) + if "DocumentReferenceRelatesTo" == resource_type: + from . import documentreference + return documentreference.DocumentReferenceRelatesTo(jsondict) + if "DomainResource" == resource_type: + from . import domainresource + return domainresource.DomainResource(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) + if "ElementDefinition" == resource_type: + from . import elementdefinition + return elementdefinition.ElementDefinition(jsondict) + if "ElementDefinitionBase" == resource_type: + from . import elementdefinition + return elementdefinition.ElementDefinitionBase(jsondict) + if "ElementDefinitionBinding" == resource_type: + from . import elementdefinition + return elementdefinition.ElementDefinitionBinding(jsondict) + if "ElementDefinitionConstraint" == resource_type: + from . import elementdefinition + return elementdefinition.ElementDefinitionConstraint(jsondict) + if "ElementDefinitionExample" == resource_type: + from . import elementdefinition + return elementdefinition.ElementDefinitionExample(jsondict) + if "ElementDefinitionMapping" == resource_type: + from . import elementdefinition + return elementdefinition.ElementDefinitionMapping(jsondict) + if "ElementDefinitionSlicing" == resource_type: + from . import elementdefinition + return elementdefinition.ElementDefinitionSlicing(jsondict) + if "ElementDefinitionSlicingDiscriminator" == resource_type: + from . import elementdefinition + return elementdefinition.ElementDefinitionSlicingDiscriminator(jsondict) + if "ElementDefinitionType" == resource_type: + from . import elementdefinition + return elementdefinition.ElementDefinitionType(jsondict) + if "Encounter" == resource_type: + from . import encounter + return encounter.Encounter(jsondict) + if "EncounterClassHistory" == resource_type: + from . import encounter + return encounter.EncounterClassHistory(jsondict) + if "EncounterDiagnosis" == resource_type: + from . import encounter + return encounter.EncounterDiagnosis(jsondict) + if "EncounterHospitalization" == resource_type: + from . import encounter + return encounter.EncounterHospitalization(jsondict) + if "EncounterLocation" == resource_type: + from . import encounter + return encounter.EncounterLocation(jsondict) + if "EncounterParticipant" == resource_type: + from . import encounter + return encounter.EncounterParticipant(jsondict) + if "EncounterStatusHistory" == resource_type: + from . import encounter + return encounter.EncounterStatusHistory(jsondict) + if "Endpoint" == resource_type: + from . import endpoint + return endpoint.Endpoint(jsondict) + if "EnrollmentRequest" == resource_type: + from . import enrollmentrequest + return enrollmentrequest.EnrollmentRequest(jsondict) + if "EnrollmentResponse" == resource_type: + from . import enrollmentresponse + return enrollmentresponse.EnrollmentResponse(jsondict) + if "EpisodeOfCare" == resource_type: + from . import episodeofcare + return episodeofcare.EpisodeOfCare(jsondict) + if "EpisodeOfCareDiagnosis" == resource_type: + from . import episodeofcare + return episodeofcare.EpisodeOfCareDiagnosis(jsondict) + if "EpisodeOfCareStatusHistory" == resource_type: + from . import episodeofcare + return episodeofcare.EpisodeOfCareStatusHistory(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) + if "ExplanationOfBenefitAccident" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitAccident(jsondict) + if "ExplanationOfBenefitAddItem" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitAddItem(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) + if "ExplanationOfBenefitBenefitBalanceFinancial" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitBenefitBalanceFinancial(jsondict) + if "ExplanationOfBenefitCareTeam" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitCareTeam(jsondict) + if "ExplanationOfBenefitDiagnosis" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitDiagnosis(jsondict) + if "ExplanationOfBenefitInsurance" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitInsurance(jsondict) + if "ExplanationOfBenefitItem" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitItem(jsondict) + if "ExplanationOfBenefitItemAdjudication" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitItemAdjudication(jsondict) + if "ExplanationOfBenefitItemDetail" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitItemDetail(jsondict) + if "ExplanationOfBenefitItemDetailSubDetail" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitItemDetailSubDetail(jsondict) + if "ExplanationOfBenefitPayee" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitPayee(jsondict) + if "ExplanationOfBenefitPayment" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitPayment(jsondict) + if "ExplanationOfBenefitProcedure" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitProcedure(jsondict) + if "ExplanationOfBenefitProcessNote" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitProcessNote(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) + if "FamilyMemberHistory" == resource_type: + from . import familymemberhistory + return familymemberhistory.FamilyMemberHistory(jsondict) + if "FamilyMemberHistoryCondition" == resource_type: + from . import familymemberhistory + return familymemberhistory.FamilyMemberHistoryCondition(jsondict) + if "Flag" == resource_type: + from . import flag + return flag.Flag(jsondict) + if "Goal" == resource_type: + from . import goal + return goal.Goal(jsondict) + if "GoalTarget" == resource_type: + from . import goal + return goal.GoalTarget(jsondict) + if "GraphDefinition" == resource_type: + from . import graphdefinition + return graphdefinition.GraphDefinition(jsondict) + if "GraphDefinitionLink" == resource_type: + from . import graphdefinition + return graphdefinition.GraphDefinitionLink(jsondict) + if "GraphDefinitionLinkTarget" == resource_type: + from . import graphdefinition + return graphdefinition.GraphDefinitionLinkTarget(jsondict) + if "GraphDefinitionLinkTargetCompartment" == resource_type: + from . import graphdefinition + return graphdefinition.GraphDefinitionLinkTargetCompartment(jsondict) + if "Group" == resource_type: + from . import group + return group.Group(jsondict) + if "GroupCharacteristic" == resource_type: + from . import group + return group.GroupCharacteristic(jsondict) + if "GroupMember" == resource_type: + from . import group + return group.GroupMember(jsondict) + if "GuidanceResponse" == resource_type: + from . import guidanceresponse + return guidanceresponse.GuidanceResponse(jsondict) + if "HealthcareService" == resource_type: + from . import healthcareservice + return healthcareservice.HealthcareService(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) + if "HumanName" == resource_type: + from . import humanname + return humanname.HumanName(jsondict) + if "Identifier" == resource_type: + from . import identifier + return identifier.Identifier(jsondict) + if "ImagingStudy" == resource_type: + from . import imagingstudy + return imagingstudy.ImagingStudy(jsondict) + if "ImagingStudySeries" == resource_type: + from . import imagingstudy + return imagingstudy.ImagingStudySeries(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 "ImmunizationEducation" == resource_type: + from . import immunization + return immunization.ImmunizationEducation(jsondict) + if "ImmunizationEvaluation" == resource_type: + from . import immunizationevaluation + return immunizationevaluation.ImmunizationEvaluation(jsondict) + if "ImmunizationPerformer" == resource_type: + from . import immunization + 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) + if "ImmunizationRecommendation" == resource_type: + from . import immunizationrecommendation + return immunizationrecommendation.ImmunizationRecommendation(jsondict) + if "ImmunizationRecommendationRecommendation" == resource_type: + from . import immunizationrecommendation + return immunizationrecommendation.ImmunizationRecommendationRecommendation(jsondict) + if "ImmunizationRecommendationRecommendationDateCriterion" == resource_type: + from . import immunizationrecommendation + return immunizationrecommendation.ImmunizationRecommendationRecommendationDateCriterion(jsondict) + if "ImplementationGuide" == resource_type: + from . import implementationguide + return implementationguide.ImplementationGuide(jsondict) + 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.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 "ImplementationGuideManifest" == resource_type: + from . import implementationguide + return implementationguide.ImplementationGuideManifest(jsondict) + if "ImplementationGuideManifestPage" == resource_type: + from . import implementationguide + return implementationguide.ImplementationGuideManifestPage(jsondict) + if "ImplementationGuideManifestResource" == resource_type: + from . import implementationguide + 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) + if "Linkage" == resource_type: + from . import linkage + return linkage.Linkage(jsondict) + if "LinkageItem" == resource_type: + from . import linkage + return linkage.LinkageItem(jsondict) + if "List" == resource_type: + from . import list + return list.List(jsondict) + if "ListEntry" == resource_type: + from . import list + return list.ListEntry(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) + if "MeasureGroup" == resource_type: + from . import measure + return measure.MeasureGroup(jsondict) + if "MeasureGroupPopulation" == resource_type: + from . import measure + return measure.MeasureGroupPopulation(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) + if "MeasureReportGroup" == resource_type: + from . import measurereport + return measurereport.MeasureReportGroup(jsondict) + if "MeasureReportGroupPopulation" == resource_type: + from . import measurereport + return measurereport.MeasureReportGroupPopulation(jsondict) + if "MeasureReportGroupStratifier" == resource_type: + from . import measurereport + return measurereport.MeasureReportGroupStratifier(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) + if "MeasureSupplementalData" == resource_type: + from . import measure + return measure.MeasureSupplementalData(jsondict) + if "Media" == resource_type: + from . import media + return media.Media(jsondict) + if "Medication" == resource_type: + from . import medication + return medication.Medication(jsondict) + if "MedicationAdministration" == resource_type: + from . import medicationadministration + return medicationadministration.MedicationAdministration(jsondict) + if "MedicationAdministrationDosage" == resource_type: + from . import medicationadministration + return medicationadministration.MedicationAdministrationDosage(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) + if "MedicationDispensePerformer" == resource_type: + from . import medicationdispense + return medicationdispense.MedicationDispensePerformer(jsondict) + if "MedicationDispenseSubstitution" == resource_type: + from . import medicationdispense + return medicationdispense.MedicationDispenseSubstitution(jsondict) + if "MedicationIngredient" == resource_type: + from . import medication + return medication.MedicationIngredient(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 "MedicationRequestDispenseRequestInitialFill" == resource_type: + from . import medicationrequest + 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) + if "MessageDefinitionAllowedResponse" == resource_type: + from . import messagedefinition + return messagedefinition.MessageDefinitionAllowedResponse(jsondict) + if "MessageDefinitionFocus" == resource_type: + from . import messagedefinition + return messagedefinition.MessageDefinitionFocus(jsondict) + if "MessageHeader" == resource_type: + from . import messageheader + return messageheader.MessageHeader(jsondict) + if "MessageHeaderDestination" == resource_type: + from . import messageheader + return messageheader.MessageHeaderDestination(jsondict) + if "MessageHeaderResponse" == resource_type: + from . import messageheader + return messageheader.MessageHeaderResponse(jsondict) + if "MessageHeaderSource" == resource_type: + from . import messageheader + return messageheader.MessageHeaderSource(jsondict) + if "Meta" == resource_type: + from . import meta + return meta.Meta(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) + if "NamingSystem" == resource_type: + from . import namingsystem + return namingsystem.NamingSystem(jsondict) + if "NamingSystemUniqueId" == resource_type: + from . import namingsystem + return namingsystem.NamingSystemUniqueId(jsondict) + if "Narrative" == resource_type: + from . import narrative + return narrative.Narrative(jsondict) + if "NutritionOrder" == resource_type: + from . import nutritionorder + return nutritionorder.NutritionOrder(jsondict) + if "NutritionOrderEnteralFormula" == resource_type: + from . import nutritionorder + return nutritionorder.NutritionOrderEnteralFormula(jsondict) + if "NutritionOrderEnteralFormulaAdministration" == resource_type: + from . import nutritionorder + return nutritionorder.NutritionOrderEnteralFormulaAdministration(jsondict) + if "NutritionOrderOralDiet" == resource_type: + from . import nutritionorder + return nutritionorder.NutritionOrderOralDiet(jsondict) + if "NutritionOrderOralDietNutrient" == resource_type: + from . import nutritionorder + return nutritionorder.NutritionOrderOralDietNutrient(jsondict) + if "NutritionOrderOralDietTexture" == resource_type: + from . import nutritionorder + return nutritionorder.NutritionOrderOralDietTexture(jsondict) + if "NutritionOrderSupplement" == resource_type: + from . import nutritionorder + return nutritionorder.NutritionOrderSupplement(jsondict) + if "Observation" == resource_type: + from . import observation + return observation.Observation(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 "OperationDefinition" == resource_type: + from . import operationdefinition + return operationdefinition.OperationDefinition(jsondict) + if "OperationDefinitionOverload" == resource_type: + from . import operationdefinition + return operationdefinition.OperationDefinitionOverload(jsondict) + if "OperationDefinitionParameter" == resource_type: + from . import operationdefinition + return operationdefinition.OperationDefinitionParameter(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) + if "OperationOutcomeIssue" == resource_type: + from . import operationoutcome + return operationoutcome.OperationOutcomeIssue(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) + if "ParameterDefinition" == resource_type: + from . import parameterdefinition + return parameterdefinition.ParameterDefinition(jsondict) + if "Parameters" == resource_type: + from . import parameters + return parameters.Parameters(jsondict) + if "ParametersParameter" == resource_type: + from . import parameters + return parameters.ParametersParameter(jsondict) + if "Patient" == resource_type: + from . import patient + return patient.Patient(jsondict) + if "PatientCommunication" == resource_type: + from . import patient + return patient.PatientCommunication(jsondict) + if "PatientContact" == resource_type: + from . import patient + return patient.PatientContact(jsondict) + if "PatientLink" == resource_type: + from . import patient + return patient.PatientLink(jsondict) + if "PaymentNotice" == resource_type: + from . import paymentnotice + return paymentnotice.PaymentNotice(jsondict) + if "PaymentReconciliation" == resource_type: + from . import paymentreconciliation + return paymentreconciliation.PaymentReconciliation(jsondict) + if "PaymentReconciliationDetail" == resource_type: + from . import paymentreconciliation + return paymentreconciliation.PaymentReconciliationDetail(jsondict) + if "PaymentReconciliationProcessNote" == resource_type: + from . import paymentreconciliation + return paymentreconciliation.PaymentReconciliationProcessNote(jsondict) + if "Period" == resource_type: + from . import period + return period.Period(jsondict) + if "Person" == resource_type: + from . import person + return person.Person(jsondict) + if "PersonLink" == resource_type: + from . import person + return person.PersonLink(jsondict) + if "PlanDefinition" == resource_type: + from . import plandefinition + return plandefinition.PlanDefinition(jsondict) + if "PlanDefinitionAction" == resource_type: + from . import plandefinition + return plandefinition.PlanDefinitionAction(jsondict) + if "PlanDefinitionActionCondition" == resource_type: + from . import plandefinition + return plandefinition.PlanDefinitionActionCondition(jsondict) + if "PlanDefinitionActionDynamicValue" == resource_type: + from . import plandefinition + return plandefinition.PlanDefinitionActionDynamicValue(jsondict) + if "PlanDefinitionActionParticipant" == resource_type: + from . import plandefinition + return plandefinition.PlanDefinitionActionParticipant(jsondict) + if "PlanDefinitionActionRelatedAction" == resource_type: + from . import plandefinition + return plandefinition.PlanDefinitionActionRelatedAction(jsondict) + if "PlanDefinitionGoal" == resource_type: + from . import plandefinition + return plandefinition.PlanDefinitionGoal(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) + if "PractitionerQualification" == resource_type: + from . import practitioner + return practitioner.PractitionerQualification(jsondict) + if "PractitionerRole" == resource_type: + from . import practitionerrole + return practitionerrole.PractitionerRole(jsondict) + if "PractitionerRoleAvailableTime" == resource_type: + from . import practitionerrole + return practitionerrole.PractitionerRoleAvailableTime(jsondict) + if "PractitionerRoleNotAvailable" == resource_type: + from . import practitionerrole + return practitionerrole.PractitionerRoleNotAvailable(jsondict) + if "Procedure" == resource_type: + from . import procedure + return procedure.Procedure(jsondict) + if "ProcedureFocalDevice" == resource_type: + from . import procedure + return procedure.ProcedureFocalDevice(jsondict) + if "ProcedurePerformer" == resource_type: + from . import procedure + return procedure.ProcedurePerformer(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) + if "ProvenanceAgent" == resource_type: + from . import provenance + return provenance.ProvenanceAgent(jsondict) + if "ProvenanceEntity" == resource_type: + from . import provenance + return provenance.ProvenanceEntity(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 "QuestionnaireItemInitial" == resource_type: + from . import questionnaire + return questionnaire.QuestionnaireItemInitial(jsondict) + if "QuestionnaireResponse" == resource_type: + from . import questionnaireresponse + return questionnaireresponse.QuestionnaireResponse(jsondict) + if "QuestionnaireResponseItem" == resource_type: + from . import questionnaireresponse + return questionnaireresponse.QuestionnaireResponseItem(jsondict) + if "QuestionnaireResponseItemAnswer" == resource_type: + from . import questionnaireresponse + return questionnaireresponse.QuestionnaireResponseItemAnswer(jsondict) + if "Range" == resource_type: + from . import range + return range.Range(jsondict) + if "Ratio" == resource_type: + from . import ratio + return ratio.Ratio(jsondict) + if "Reference" == resource_type: + from . import reference + return reference.Reference(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) + if "RequestGroupAction" == resource_type: + from . import requestgroup + return requestgroup.RequestGroupAction(jsondict) + if "RequestGroupActionCondition" == resource_type: + from . import requestgroup + return requestgroup.RequestGroupActionCondition(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) + if "Resource" == resource_type: + from . import resource + return resource.Resource(jsondict) + if "RiskAssessment" == resource_type: + from . import riskassessment + return riskassessment.RiskAssessment(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) + if "Schedule" == resource_type: + from . import schedule + return schedule.Schedule(jsondict) + if "SearchParameter" == resource_type: + from . import searchparameter + return searchparameter.SearchParameter(jsondict) + if "SearchParameterComponent" == resource_type: + from . import searchparameter + return searchparameter.SearchParameterComponent(jsondict) + if "ServiceRequest" == resource_type: + from . import servicerequest + return servicerequest.ServiceRequest(jsondict) + if "Signature" == resource_type: + from . import signature + return signature.Signature(jsondict) + if "Slot" == resource_type: + from . import slot + return slot.Slot(jsondict) + if "Specimen" == resource_type: + from . import specimen + return specimen.Specimen(jsondict) + if "SpecimenCollection" == resource_type: + from . import specimen + return specimen.SpecimenCollection(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) + if "StructureDefinitionMapping" == resource_type: + from . import structuredefinition + return structuredefinition.StructureDefinitionMapping(jsondict) + if "StructureDefinitionSnapshot" == resource_type: + from . import structuredefinition + return structuredefinition.StructureDefinitionSnapshot(jsondict) + if "StructureMap" == resource_type: + from . import structuremap + return structuremap.StructureMap(jsondict) + if "StructureMapGroup" == resource_type: + from . import structuremap + return structuremap.StructureMapGroup(jsondict) + if "StructureMapGroupInput" == resource_type: + from . import structuremap + return structuremap.StructureMapGroupInput(jsondict) + if "StructureMapGroupRule" == resource_type: + from . import structuremap + return structuremap.StructureMapGroupRule(jsondict) + if "StructureMapGroupRuleDependent" == resource_type: + from . import structuremap + return structuremap.StructureMapGroupRuleDependent(jsondict) + if "StructureMapGroupRuleSource" == resource_type: + from . import structuremap + return structuremap.StructureMapGroupRuleSource(jsondict) + if "StructureMapGroupRuleTarget" == resource_type: + from . import structuremap + return structuremap.StructureMapGroupRuleTarget(jsondict) + if "StructureMapGroupRuleTargetParameter" == resource_type: + from . import structuremap + return structuremap.StructureMapGroupRuleTargetParameter(jsondict) + if "StructureMapStructure" == resource_type: + from . import structuremap + return structuremap.StructureMapStructure(jsondict) + if "Subscription" == resource_type: + from . import subscription + return subscription.Subscription(jsondict) + if "SubscriptionChannel" == resource_type: + from . import subscription + return subscription.SubscriptionChannel(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) + if "SupplyDeliverySuppliedItem" == resource_type: + from . import supplydelivery + return supplydelivery.SupplyDeliverySuppliedItem(jsondict) + if "SupplyRequest" == resource_type: + from . import supplyrequest + return supplyrequest.SupplyRequest(jsondict) + if "SupplyRequestParameter" == resource_type: + from . import supplyrequest + return supplyrequest.SupplyRequestParameter(jsondict) + if "Task" == resource_type: + from . import task + return task.Task(jsondict) + if "TaskInput" == resource_type: + from . import task + return task.TaskInput(jsondict) + if "TaskOutput" == resource_type: + from . import task + return task.TaskOutput(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) + if "TestReportParticipant" == resource_type: + from . import testreport + return testreport.TestReportParticipant(jsondict) + if "TestReportSetup" == resource_type: + from . import testreport + return testreport.TestReportSetup(jsondict) + if "TestReportSetupAction" == resource_type: + from . import testreport + return testreport.TestReportSetupAction(jsondict) + if "TestReportSetupActionAssert" == resource_type: + from . import testreport + return testreport.TestReportSetupActionAssert(jsondict) + if "TestReportSetupActionOperation" == resource_type: + from . import testreport + return testreport.TestReportSetupActionOperation(jsondict) + if "TestReportTeardown" == resource_type: + from . import testreport + return testreport.TestReportTeardown(jsondict) + if "TestReportTeardownAction" == resource_type: + from . import testreport + return testreport.TestReportTeardownAction(jsondict) + if "TestReportTest" == resource_type: + from . import testreport + return testreport.TestReportTest(jsondict) + if "TestReportTestAction" == resource_type: + from . import testreport + return testreport.TestReportTestAction(jsondict) + if "TestScript" == resource_type: + from . import testscript + return testscript.TestScript(jsondict) + if "TestScriptDestination" == resource_type: + from . import testscript + return testscript.TestScriptDestination(jsondict) + if "TestScriptFixture" == resource_type: + from . import testscript + return testscript.TestScriptFixture(jsondict) + if "TestScriptMetadata" == resource_type: + from . import testscript + return testscript.TestScriptMetadata(jsondict) + if "TestScriptMetadataCapability" == resource_type: + from . import testscript + return testscript.TestScriptMetadataCapability(jsondict) + if "TestScriptMetadataLink" == resource_type: + from . import testscript + return testscript.TestScriptMetadataLink(jsondict) + if "TestScriptOrigin" == resource_type: + from . import testscript + return testscript.TestScriptOrigin(jsondict) + if "TestScriptSetup" == resource_type: + from . import testscript + return testscript.TestScriptSetup(jsondict) + if "TestScriptSetupAction" == resource_type: + from . import testscript + return testscript.TestScriptSetupAction(jsondict) + if "TestScriptSetupActionAssert" == resource_type: + from . import testscript + return testscript.TestScriptSetupActionAssert(jsondict) + if "TestScriptSetupActionOperation" == resource_type: + from . import testscript + return testscript.TestScriptSetupActionOperation(jsondict) + if "TestScriptSetupActionOperationRequestHeader" == resource_type: + from . import testscript + return testscript.TestScriptSetupActionOperationRequestHeader(jsondict) + if "TestScriptTeardown" == resource_type: + from . import testscript + return testscript.TestScriptTeardown(jsondict) + if "TestScriptTeardownAction" == resource_type: + from . import testscript + return testscript.TestScriptTeardownAction(jsondict) + if "TestScriptTest" == resource_type: + from . import testscript + return testscript.TestScriptTest(jsondict) + if "TestScriptTestAction" == resource_type: + from . import testscript + return testscript.TestScriptTestAction(jsondict) + if "TestScriptVariable" == resource_type: + from . import testscript + return testscript.TestScriptVariable(jsondict) + if "Timing" == resource_type: + from . import timing + return timing.Timing(jsondict) + if "TimingRepeat" == resource_type: + from . import timing + return timing.TimingRepeat(jsondict) + if "TriggerDefinition" == resource_type: + from . import triggerdefinition + return triggerdefinition.TriggerDefinition(jsondict) + if "UsageContext" == resource_type: + from . import usagecontext + return usagecontext.UsageContext(jsondict) + if "ValueSet" == resource_type: + from . import valueset + return valueset.ValueSet(jsondict) + if "ValueSetCompose" == resource_type: + from . import valueset + return valueset.ValueSetCompose(jsondict) + if "ValueSetComposeInclude" == resource_type: + from . import valueset + return valueset.ValueSetComposeInclude(jsondict) + if "ValueSetComposeIncludeConcept" == resource_type: + from . import valueset + return valueset.ValueSetComposeIncludeConcept(jsondict) + if "ValueSetComposeIncludeConceptDesignation" == resource_type: + from . import valueset + return valueset.ValueSetComposeIncludeConceptDesignation(jsondict) + if "ValueSetComposeIncludeFilter" == resource_type: + from . import valueset + return valueset.ValueSetComposeIncludeFilter(jsondict) + if "ValueSetExpansion" == resource_type: + from . import valueset + return valueset.ValueSetExpansion(jsondict) + if "ValueSetExpansionContains" == resource_type: + from . import valueset + return valueset.ValueSetExpansionContains(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 "VisionPrescriptionLensSpecification" == resource_type: + from . import visionprescription + return visionprescription.VisionPrescriptionLensSpecification(jsondict) + if "VisionPrescriptionLensSpecificationPrism" == resource_type: + from . import visionprescription + return visionprescription.VisionPrescriptionLensSpecificationPrism(jsondict) + from . import element + return element.Element(jsondict) diff --git a/fhirclient/models/fhirreference.py b/fhirclient/models/R4/fhirreference.py similarity index 100% rename from fhirclient/models/fhirreference.py rename to fhirclient/models/R4/fhirreference.py diff --git a/fhirclient/models/fhirsearch.py b/fhirclient/models/R4/fhirsearch.py similarity index 100% rename from fhirclient/models/fhirsearch.py rename to fhirclient/models/R4/fhirsearch.py diff --git a/fhirclient/models/R4/flag.py b/fhirclient/models/R4/flag.py new file mode 100644 index 000000000..9d05d38df --- /dev/null +++ b/fhirclient/models/R4/flag.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Flag) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Flag(domainresource.DomainResource): + """ Key information to flag to healthcare providers. + + Prospective warnings of potential issues when providing care to the + patient. + """ + + resource_type = "Flag" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Flag creator. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.category = None + """ Clinical, administrative, etc.. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.code = None + """ Coded or textual message to display to user. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.encounter = None + """ Alert relevant during encounter. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.identifier = None + """ Business identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.period = None + """ Time period when flag is active. + Type `Period` (represented as `dict` in JSON). """ + + self.status = None + """ active | inactive | entered-in-error. + Type `str`. """ + + self.subject = None + """ Who/What is flag about?. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(Flag, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Flag, self).elementProperties() + js.extend([ + ("author", "author", fhirreference.FHIRReference, 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), + ("period", "period", period.Period, False, None, False), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, 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 period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/R4/flag_tests.py b/fhirclient/models/R4/flag_tests.py new file mode 100644 index 000000000..13de5a0e2 --- /dev/null +++ b/fhirclient/models/R4/flag_tests.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import flag +from .fhirdate import FHIRDate + + +class FlagTests(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("Flag", js["resourceType"]) + return flag.Flag(js) + + def testFlag1(self): + inst = self.instantiate_from("flag-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Flag instance") + self.implFlag1(inst) + + js = inst.as_json() + self.assertEqual("Flag", js["resourceType"]) + inst2 = flag.Flag(js) + self.implFlag1(inst2) + + def implFlag1(self, inst): + 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) + self.assertEqual(inst.period.start.as_json(), "2015-01-17") + 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/R4/goal.py b/fhirclient/models/R4/goal.py new file mode 100644 index 000000000..6d5f68b2f --- /dev/null +++ b/fhirclient/models/R4/goal.py @@ -0,0 +1,238 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Goal) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Goal(domainresource.DomainResource): + """ Describes the intended objective(s) for a patient, group or organization. + + Describes the intended objective(s) for a patient, group or organization + care, for example, weight loss, restoring an activity of daily living, + obtaining herd immunity via immunization, meeting a process improvement + objective, etc. + """ + + resource_type = "Goal" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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 (represented as `dict` in JSON). """ + + self.category = None + """ E.g. Treatment, dietary, behavioral, etc.. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.description = None + """ Code or text describing goal. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.expressedBy = None + """ Who's responsible for creating Goal?. + 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). """ + + self.outcomeCode = None + """ What result was achieved regarding the goal?. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.outcomeReference = None + """ Observation that resulted from goal. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.priority = None + """ high-priority | medium-priority | low-priority. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.startCodeableConcept = None + """ When goal pursuit begins. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.startDate = None + """ When goal pursuit begins. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.statusDate = None + """ When goal status took effect. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.statusReason = None + """ Reason for current status. + Type `str`. """ + + self.subject = None + """ Who this goal is intended for. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.target = None + """ Target outcome for the goal. + 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), + ("statusDate", "statusDate", fhirdate.FHIRDate, False, None, False), + ("statusReason", "statusReason", str, False, None, False), + ("subject", "subject", fhirreference.FHIRReference, False, None, True), + ("target", "target", GoalTarget, True, None, False), + ]) + return js + + +from . import backboneelement + +class GoalTarget(backboneelement.BackboneElement): + """ Target outcome for the goal. + + Indicates what should be done by when. + """ + + resource_type = "GoalTarget" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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). """ + + self.detailRange = None + """ 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). """ + + self.dueDuration = None + """ Reach goal on or before. + Type `Duration` (represented as `dict` in JSON). """ + + self.measure = None + """ The parameter whose value is being tracked. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(GoalTarget, self).__init__(jsondict=jsondict, strict=strict) + + 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), + ]) + 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 duration +except ImportError: + duration = sys.modules[__package__ + '.duration'] +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/R4/goal_tests.py b/fhirclient/models/R4/goal_tests.py new file mode 100644 index 000000000..da44169ff --- /dev/null +++ b/fhirclient/models/R4/goal_tests.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import goal +from .fhirdate import FHIRDate + + +class GoalTests(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("Goal", js["resourceType"]) + return goal.Goal(js) + + def testGoal1(self): + inst = self.instantiate_from("goal-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Goal instance") + self.implGoal1(inst) + + js = inst.as_json() + self.assertEqual("Goal", js["resourceType"]) + inst2 = goal.Goal(js) + self.implGoal1(inst2) + + def implGoal1(self, inst): + 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.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.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-stop-smoking.json") + self.assertIsNotNone(inst, "Must have instantiated a Goal instance") + self.implGoal2(inst) + + js = inst.as_json() + self.assertEqual("Goal", js["resourceType"]) + inst2 = goal.Goal(js) + self.implGoal2(inst2) + + def implGoal2(self, inst): + 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.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.text.status, "additional") + diff --git a/fhirclient/models/R4/graphdefinition.py b/fhirclient/models/R4/graphdefinition.py new file mode 100644 index 000000000..819d8215e --- /dev/null +++ b/fhirclient/models/R4/graphdefinition.py @@ -0,0 +1,280 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/GraphDefinition) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class GraphDefinition(domainresource.DomainResource): + """ 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 + Graph Definition resource defines a set and makes rules about the set. + """ + + resource_type = "GraphDefinition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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.date = None + """ Date last changed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Natural language description of the graph definition. + Type `str`. """ + + self.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.jurisdiction = None + """ Intended jurisdiction for graph definition (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.link = None + """ Links this graph makes rules about. + List of `GraphDefinitionLink` items (represented as `dict` in JSON). """ + + self.name = None + """ Name for this graph definition (computer friendly). + Type `str`. """ + + self.profile = None + """ Profile on base resource. + Type `str`. """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this graph definition is defined. + Type `str`. """ + + self.start = None + """ Type of resource at which the graph starts. + Type `str`. """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.url = None + """ Canonical identifier for this graph 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 graph definition. + Type `str`. """ + + super(GraphDefinition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(GraphDefinition, self).elementProperties() + js.extend([ + ("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), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("link", "link", GraphDefinitionLink, True, None, False), + ("name", "name", str, False, None, True), + ("profile", "profile", str, False, None, False), + ("publisher", "publisher", str, False, None, False), + ("purpose", "purpose", str, False, None, False), + ("start", "start", str, False, None, True), + ("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 GraphDefinitionLink(backboneelement.BackboneElement): + """ Links this graph makes rules about. + """ + + resource_type = "GraphDefinitionLink" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Why this link is specified. + Type `str`. """ + + self.max = None + """ Maximum occurrences for this link. + Type `str`. """ + + self.min = None + """ Minimum occurrences for this link. + Type `int`. """ + + self.path = None + """ Path in the resource that contains the link. + Type `str`. """ + + self.sliceName = None + """ Which slice (if profiled). + Type `str`. """ + + self.target = None + """ Potential target for the link. + List of `GraphDefinitionLinkTarget` items (represented as `dict` in JSON). """ + + super(GraphDefinitionLink, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(GraphDefinitionLink, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, False), + ("max", "max", str, False, None, False), + ("min", "min", int, False, None, False), + ("path", "path", str, False, None, False), + ("sliceName", "sliceName", str, False, None, False), + ("target", "target", GraphDefinitionLinkTarget, True, None, False), + ]) + return js + + +class GraphDefinitionLinkTarget(backboneelement.BackboneElement): + """ Potential target for the link. + """ + + resource_type = "GraphDefinitionLinkTarget" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.compartment = None + """ Compartment Consistency Rules. + List of `GraphDefinitionLinkTargetCompartment` items (represented as `dict` in JSON). """ + + self.link = None + """ 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`. """ + + self.type = None + """ Type of resource this link refers to. + Type `str`. """ + + super(GraphDefinitionLinkTarget, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(GraphDefinitionLinkTarget, self).elementProperties() + 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), + ]) + return js + + +class GraphDefinitionLinkTargetCompartment(backboneelement.BackboneElement): + """ Compartment Consistency Rules. + """ + + resource_type = "GraphDefinitionLinkTargetCompartment" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Identifies the compartment. + Type `str`. """ + + self.description = None + """ Documentation for FHIRPath expression. + Type `str`. """ + + self.expression = None + """ Custom rule, as a FHIRPath expression. + Type `str`. """ + + self.rule = None + """ identical | matching | different | custom. + Type `str`. """ + + self.use = None + """ condition | requirement. + Type `str`. """ + + super(GraphDefinitionLinkTargetCompartment, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(GraphDefinitionLinkTargetCompartment, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("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 + + +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/R4/graphdefinition_tests.py b/fhirclient/models/R4/graphdefinition_tests.py new file mode 100644 index 000000000..32fa28db0 --- /dev/null +++ b/fhirclient/models/R4/graphdefinition_tests.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import graphdefinition +from .fhirdate import FHIRDate + + +class GraphDefinitionTests(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("GraphDefinition", js["resourceType"]) + return graphdefinition.GraphDefinition(js) + + def testGraphDefinition1(self): + inst = self.instantiate_from("graphdefinition-example.json") + self.assertIsNotNone(inst, "Must have instantiated a GraphDefinition instance") + self.implGraphDefinition1(inst) + + js = inst.as_json() + self.assertEqual("GraphDefinition", js["resourceType"]) + inst2 = graphdefinition.GraphDefinition(js) + self.implGraphDefinition1(inst2) + + def implGraphDefinition1(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.date.date, FHIRDate("2015-08-04").date) + self.assertEqual(inst.date.as_json(), "2015-08-04") + self.assertEqual(inst.description, "Specify to include list references when generating a document using the $document operation") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.link[0].description, "Link to List") + 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") + self.assertEqual(inst.publisher, "FHIR Project") + self.assertEqual(inst.start, "Composition") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.url, "http://h7.org/fhir/GraphDefinition/example") + diff --git a/fhirclient/models/R4/group.py b/fhirclient/models/R4/group.py new file mode 100644 index 000000000..6fbe9e858 --- /dev/null +++ b/fhirclient/models/R4/group.py @@ -0,0 +1,220 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Group) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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 + not formally or legally recognized; i.e. a collection of entities that + isn't an Organization. + """ + + resource_type = "Group" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 group's record is in active use. + Type `bool`. """ + + self.actual = None + """ Descriptive or actual. + Type `bool`. """ + + self.characteristic = None + """ Include / Exclude group members by Trait. + List of `GroupCharacteristic` items (represented as `dict` in JSON). """ + + self.code = None + """ Kind of Group members. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.identifier = None + """ 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). """ + + self.name = None + """ Label for Group. + Type `str`. """ + + self.quantity = None + """ Number of members. + Type `int`. """ + + self.type = None + """ person | animal | practitioner | device | medication | substance. + Type `str`. """ + + super(Group, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Group, self).elementProperties() + js.extend([ + ("active", "active", bool, False, None, False), + ("actual", "actual", bool, False, None, True), + ("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), + ("type", "type", str, False, None, True), + ]) + return js + + +from . import backboneelement + +class GroupCharacteristic(backboneelement.BackboneElement): + """ Include / Exclude group members by Trait. + + Identifies traits whose presence r absence is shared by members of the + group. + """ + + resource_type = "GroupCharacteristic" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Kind of characteristic. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.exclude = None + """ Group includes or excludes. + Type `bool`. """ + + self.period = None + """ Period over which characteristic is tested. + Type `Period` (represented as `dict` in JSON). """ + + self.valueBoolean = None + """ Value held by characteristic. + Type `bool`. """ + + self.valueCodeableConcept = None + """ Value held by characteristic. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueQuantity = None + """ Value held by characteristic. + Type `Quantity` (represented as `dict` in JSON). """ + + self.valueRange = None + """ 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): + js = super(GroupCharacteristic, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("exclude", "exclude", bool, False, None, True), + ("period", "period", period.Period, False, None, False), + ("valueBoolean", "valueBoolean", bool, False, "value", True), + ("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 + + +class GroupMember(backboneelement.BackboneElement): + """ Who or what is in group. + + Identifies the resource instances that are members of the group. + """ + + resource_type = "GroupMember" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.entity = None + """ Reference to the group member. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.inactive = None + """ If member is no longer in group. + Type `bool`. """ + + self.period = None + """ Period member belonged to the group. + Type `Period` (represented as `dict` in JSON). """ + + super(GroupMember, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(GroupMember, self).elementProperties() + js.extend([ + ("entity", "entity", fhirreference.FHIRReference, False, None, True), + ("inactive", "inactive", bool, False, None, False), + ("period", "period", period.Period, 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 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'] diff --git a/fhirclient/models/R4/group_tests.py b/fhirclient/models/R4/group_tests.py new file mode 100644 index 000000000..04a176f44 --- /dev/null +++ b/fhirclient/models/R4/group_tests.py @@ -0,0 +1,139 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import group +from .fhirdate import FHIRDate + + +class GroupTests(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("Group", js["resourceType"]) + return group.Group(js) + + def testGroup1(self): + inst = self.instantiate_from("group-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Group instance") + self.implGroup1(inst) + + js = inst.as_json() + self.assertEqual("Group", js["resourceType"]) + inst2 = group.Group(js) + 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) + self.assertEqual(inst.member[0].period.start.as_json(), "2014-10-08") + self.assertTrue(inst.member[1].inactive) + self.assertEqual(inst.member[1].period.start.date, FHIRDate("2015-04-02").date) + self.assertEqual(inst.member[1].period.start.as_json(), "2015-04-02") + self.assertEqual(inst.member[2].period.start.date, FHIRDate("2015-08-06").date) + 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 testGroup3(self): + inst = self.instantiate_from("group-example-patientlist.json") + self.assertIsNotNone(inst, "Must have instantiated a Group instance") + self.implGroup3(inst) + + js = inst.as_json() + self.assertEqual("Group", js["resourceType"]) + inst2 = group.Group(js) + self.implGroup3(inst2) + + def implGroup3(self, inst): + self.assertTrue(inst.actual) + 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.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/R4/guidanceresponse.py b/fhirclient/models/R4/guidanceresponse.py new file mode 100644 index 000000000..e6d8ff63f --- /dev/null +++ b/fhirclient/models/R4/guidanceresponse.py @@ -0,0 +1,147 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/GuidanceResponse) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class GuidanceResponse(domainresource.DomainResource): + """ The formal response to a guidance request. + + A guidance response is the formal response to a guidance request, including + any output parameters returned by the evaluation, as well as the + description of any proposed actions to be taken. + """ + + resource_type = "GuidanceResponse" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + 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 (represented as `dict` in JSON). """ + + self.identifier = None + """ Business identifier. + List of `Identifier` items (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. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.occurrenceDateTime = None + """ When the guidance response was processed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.outputParameters = None + """ The output parameters of the evaluation, if any. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.performer = None + """ Device returning the guidance. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.reasonCode = None + """ Why guidance is needed. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.reasonReference = None + """ Why guidance is needed. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + 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` (represented as `dict` in JSON). """ + + self.status = None + """ success | data-requested | data-required | in-progress | failure | + entered-in-error. + Type `str`. """ + + self.subject = None + """ Patient the request was performed for. + 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([ + ("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, 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), + ("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), + ]) + 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 datarequirement +except ImportError: + datarequirement = sys.modules[__package__ + '.datarequirement'] +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/R4/guidanceresponse_tests.py b/fhirclient/models/R4/guidanceresponse_tests.py new file mode 100644 index 000000000..f6e7d4b3f --- /dev/null +++ b/fhirclient/models/R4/guidanceresponse_tests.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import guidanceresponse +from .fhirdate import FHIRDate + + +class GuidanceResponseTests(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("GuidanceResponse", js["resourceType"]) + return guidanceresponse.GuidanceResponse(js) + + def testGuidanceResponse1(self): + inst = self.instantiate_from("guidanceresponse-example.json") + self.assertIsNotNone(inst, "Must have instantiated a GuidanceResponse instance") + self.implGuidanceResponse1(inst) + + js = inst.as_json() + self.assertEqual("GuidanceResponse", js["resourceType"]) + inst2 = guidanceresponse.GuidanceResponse(js) + self.implGuidanceResponse1(inst2) + + def implGuidanceResponse1(self, inst): + self.assertEqual(inst.contained[0].id, "outputParameters1") + self.assertEqual(inst.id, "example") + 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.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/R4/healthcareservice.py b/fhirclient/models/R4/healthcareservice.py new file mode 100644 index 000000000..755857f9c --- /dev/null +++ b/fhirclient/models/R4/healthcareservice.py @@ -0,0 +1,303 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/HealthcareService) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class HealthcareService(domainresource.DomainResource): + """ The details of a healthcare service available at a location. + """ + + resource_type = "HealthcareService" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 HealthcareService record is in active use. + Type `bool`. """ + + self.appointmentRequired = None + """ If an appointment is required for access to this service. + Type `bool`. """ + + self.availabilityExceptions = None + """ Description of availability exceptions. + Type `str`. """ + + self.availableTime = None + """ Times the Service Site is available. + List of `HealthcareServiceAvailableTime` items (represented as `dict` in JSON). """ + + self.category = None + """ Broad category of service being performed or delivered. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.characteristic = None + """ Collection of characteristics (attributes). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.comment = None + """ Additional description and/or any specific issues not covered + 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 intended for/available to. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.eligibility = None + """ Specific eligibility requirements required to use the service. + List of `HealthcareServiceEligibility` items (represented as `dict` in JSON). """ + + self.endpoint = None + """ 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 + fields. + Type `str`. """ + + self.identifier = None + """ External identifiers for this item. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.location = None + """ Location(s) where service may be provided. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.name = None + """ Description of service as presented to a consumer while searching. + Type `str`. """ + + self.notAvailable = None + """ Not available during this time due to provided reason. + List of `HealthcareServiceNotAvailable` items (represented as `dict` in JSON). """ + + self.photo = None + """ Facilitates quick identification of the service. + Type `Attachment` (represented as `dict` in JSON). """ + + 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` (represented as `dict` in JSON). """ + + self.referralMethod = None + """ Ways that the service accepts referrals. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.serviceProvisionCode = None + """ Conditions under which service is available/offered. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.specialty = None + """ Specialties handled by the HealthcareService. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.telecom = None + """ Contacts related to the healthcare service. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + self.type = None + """ Type of service that may be delivered or performed. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(HealthcareService, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(HealthcareService, self).elementProperties() + js.extend([ + ("active", "active", bool, False, None, False), + ("appointmentRequired", "appointmentRequired", bool, False, None, False), + ("availabilityExceptions", "availabilityExceptions", str, False, None, False), + ("availableTime", "availableTime", HealthcareServiceAvailableTime, True, 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", HealthcareServiceEligibility, True, None, False), + ("endpoint", "endpoint", fhirreference.FHIRReference, True, None, False), + ("extraDetails", "extraDetails", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("location", "location", fhirreference.FHIRReference, True, None, False), + ("name", "name", str, False, None, False), + ("notAvailable", "notAvailable", HealthcareServiceNotAvailable, True, None, False), + ("photo", "photo", attachment.Attachment, False, 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), + ("specialty", "specialty", codeableconcept.CodeableConcept, True, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +from . import backboneelement + +class HealthcareServiceAvailableTime(backboneelement.BackboneElement): + """ Times the Service Site is available. + + A collection of times that the Service Site is available. + """ + + resource_type = "HealthcareServiceAvailableTime" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Always available? e.g. 24 hour service. + Type `bool`. """ + + self.availableEndTime = None + """ Closing time of day (ignored if allDay = true). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.availableStartTime = None + """ Opening time of day (ignored if allDay = true). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.daysOfWeek = None + """ mon | tue | wed | thu | fri | sat | sun. + List of `str` items. """ + + super(HealthcareServiceAvailableTime, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(HealthcareServiceAvailableTime, self).elementProperties() + js.extend([ + ("allDay", "allDay", bool, False, None, False), + ("availableEndTime", "availableEndTime", fhirdate.FHIRDate, False, None, False), + ("availableStartTime", "availableStartTime", fhirdate.FHIRDate, False, None, False), + ("daysOfWeek", "daysOfWeek", str, True, None, False), + ]) + 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. + + The HealthcareService is not available during this period of time due to + the provided reason. + """ + + resource_type = "HealthcareServiceNotAvailable" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Reason presented to the user explaining why time not available. + Type `str`. """ + + self.during = None + """ Service not available from this date. + Type `Period` (represented as `dict` in JSON). """ + + super(HealthcareServiceNotAvailable, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(HealthcareServiceNotAvailable, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, True), + ("during", "during", period.Period, 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 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: + 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/R4/healthcareservice_tests.py b/fhirclient/models/R4/healthcareservice_tests.py new file mode 100644 index 000000000..730a44083 --- /dev/null +++ b/fhirclient/models/R4/healthcareservice_tests.py @@ -0,0 +1,108 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import healthcareservice +from .fhirdate import FHIRDate + + +class HealthcareServiceTests(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("HealthcareService", js["resourceType"]) + return healthcareservice.HealthcareService(js) + + def testHealthcareService1(self): + inst = self.instantiate_from("healthcareservice-example.json") + self.assertIsNotNone(inst, "Must have instantiated a HealthcareService instance") + self.implHealthcareService1(inst) + + js = inst.as_json() + self.assertEqual("HealthcareService", js["resourceType"]) + inst2 = healthcareservice.HealthcareService(js) + self.implHealthcareService1(inst2) + + def implHealthcareService1(self, inst): + self.assertTrue(inst.active) + self.assertFalse(inst.appointmentRequired) + self.assertEqual(inst.availabilityExceptions, "Reduced capacity is available during the Christmas period") + self.assertTrue(inst.availableTime[0].allDay) + self.assertEqual(inst.availableTime[0].daysOfWeek[0], "wed") + self.assertEqual(inst.availableTime[1].availableEndTime.date, FHIRDate("05:30:00").date) + self.assertEqual(inst.availableTime[1].availableEndTime.as_json(), "05:30:00") + self.assertEqual(inst.availableTime[1].availableStartTime.date, FHIRDate("08:30:00").date) + self.assertEqual(inst.availableTime[1].availableStartTime.as_json(), "08:30:00") + self.assertEqual(inst.availableTime[1].daysOfWeek[0], "mon") + self.assertEqual(inst.availableTime[1].daysOfWeek[1], "tue") + self.assertEqual(inst.availableTime[1].daysOfWeek[2], "thu") + self.assertEqual(inst.availableTime[1].daysOfWeek[3], "fri") + self.assertEqual(inst.availableTime[2].availableEndTime.date, FHIRDate("04:30:00").date) + self.assertEqual(inst.availableTime[2].availableEndTime.as_json(), "04:30:00") + self.assertEqual(inst.availableTime[2].availableStartTime.date, FHIRDate("09:30:00").date) + 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[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[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) + self.assertEqual(inst.notAvailable[0].during.end.as_json(), "2015-12-26") + self.assertEqual(inst.notAvailable[0].during.start.date, FHIRDate("2015-12-25").date) + self.assertEqual(inst.notAvailable[0].during.start.as_json(), "2015-12-25") + self.assertEqual(inst.notAvailable[1].description, "New Years Day") + self.assertEqual(inst.notAvailable[1].during.end.date, FHIRDate("2016-01-01").date) + 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.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") + self.assertEqual(inst.referralMethod[1].coding[0].display, "Fax") + self.assertEqual(inst.referralMethod[2].coding[0].code, "elec") + self.assertEqual(inst.referralMethod[2].coding[0].display, "Secure Messaging") + self.assertEqual(inst.referralMethod[3].coding[0].code, "semail") + 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://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") + self.assertEqual(inst.telecom[0].system, "phone") + self.assertEqual(inst.telecom[0].use, "work") + self.assertEqual(inst.telecom[0].value, "(555) silent") + self.assertEqual(inst.telecom[1].system, "email") + self.assertEqual(inst.telecom[1].use, "work") + self.assertEqual(inst.telecom[1].value, "directaddress@example.com") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type[0].coding[0].code, "394913002") + self.assertEqual(inst.type[0].coding[0].display, "Psychotherapy") + self.assertEqual(inst.type[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.type[1].coding[0].code, "394587001") + self.assertEqual(inst.type[1].coding[0].display, "Psychiatry") + self.assertEqual(inst.type[1].coding[0].system, "http://snomed.info/sct") + diff --git a/fhirclient/models/R4/humanname.py b/fhirclient/models/R4/humanname.py new file mode 100644 index 000000000..f0f2b4444 --- /dev/null +++ b/fhirclient/models/R4/humanname.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/HumanName) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class HumanName(element.Element): + """ Name of a human - parts and usage. + + A human's name with the ability to identify parts and usage. + """ + + resource_type = "HumanName" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.family = None + """ Family name (often called 'Surname'). + Type `str`. """ + + self.given = None + """ Given names (not always 'first'). Includes middle names. + List of `str` items. """ + + self.period = None + """ Time period when name was/is in use. + Type `Period` (represented as `dict` in JSON). """ + + self.prefix = None + """ Parts that come before the name. + List of `str` items. """ + + self.suffix = None + """ Parts that come after the name. + List of `str` items. """ + + self.text = None + """ Text representation of the full name. + Type `str`. """ + + self.use = None + """ usual | official | temp | nickname | anonymous | old | maiden. + Type `str`. """ + + super(HumanName, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(HumanName, self).elementProperties() + js.extend([ + ("family", "family", str, False, None, False), + ("given", "given", str, True, None, False), + ("period", "period", period.Period, False, None, False), + ("prefix", "prefix", str, True, None, False), + ("suffix", "suffix", str, True, None, False), + ("text", "text", str, False, None, False), + ("use", "use", str, False, None, False), + ]) + return js + + +import sys +try: + from . import period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/R4/identifier.py b/fhirclient/models/R4/identifier.py new file mode 100644 index 000000000..1ff5be284 --- /dev/null +++ b/fhirclient/models/R4/identifier.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Identifier) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Identifier(element.Element): + """ An identifier intended for computation. + + An identifier - identifies some entity uniquely and unambiguously. + Typically this is used for business identifiers. + """ + + resource_type = "Identifier" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.assigner = None + """ Organization that issued id (may be just text). + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.period = None + """ Time period when id is/was valid for use. + Type `Period` (represented as `dict` in JSON). """ + + self.system = None + """ The namespace for the identifier value. + Type `str`. """ + + self.type = None + """ Description of identifier. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.use = None + """ usual | official | temp | secondary | old (If known). + Type `str`. """ + + self.value = None + """ The value that is unique. + Type `str`. """ + + super(Identifier, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Identifier, self).elementProperties() + js.extend([ + ("assigner", "assigner", fhirreference.FHIRReference, False, None, False), + ("period", "period", period.Period, False, None, False), + ("system", "system", str, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("use", "use", str, False, None, False), + ("value", "value", str, 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 period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/R4/imagingstudy.py b/fhirclient/models/R4/imagingstudy.py new file mode 100644 index 000000000..f1f37cce3 --- /dev/null +++ b/fhirclient/models/R4/imagingstudy.py @@ -0,0 +1,332 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ImagingStudy) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class ImagingStudy(domainresource.DomainResource): + """ A set of images produced in single study (one or more series of references + images). + + Representation of the content produced in a DICOM imaging study. A study + comprises a set of series, each of which includes a set of Service-Object + Pair Instances (SOP Instances - images or other data) acquired or produced + in a common context. A series is of only one modality (e.g. X-ray, CT, MR, + ultrasound), but a study may have multiple series of different modalities. + """ + + resource_type = "ImagingStudy" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.basedOn = None + """ Request fulfilled. + 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 (represented as `dict` in JSON). """ + + self.identifier = None + """ Identifiers for the whole study. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.interpreter = None + """ Who interpreted images. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.location = None + """ Where ImagingStudy occurred. + Type `FHIRReference` (represented as `dict` in JSON). """ + + 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`. """ + + self.numberOfSeries = None + """ Number of Study Related Series. + Type `int`. """ + + self.procedureCode = None + """ The performed procedure code. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.procedureReference = None + """ The performed Procedure reference. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.reasonCode = None + """ Why the study was requested. + 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` (represented as `dict` in JSON). """ + + self.series = None + """ Each study has one or more series of instances. + List of `ImagingStudySeries` items (represented as `dict` in JSON). """ + + self.started = None + """ When the study was started. + Type `FHIRDate` (represented as `str` in JSON). """ + + 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([ + ("basedOn", "basedOn", fhirreference.FHIRReference, True, 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), + ("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), + ("procedureCode", "procedureCode", codeableconcept.CodeableConcept, True, 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), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, True), + ]) + return js + + +from . import backboneelement + +class ImagingStudySeries(backboneelement.BackboneElement): + """ Each study has one or more series of instances. + + Each study has one or more series of images or other content. + """ + + resource_type = "ImagingStudySeries" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.bodySite = None + """ Body part examined. + Type `Coding` (represented as `dict` in JSON). """ + + self.description = None + """ A short human readable summary of the series. + Type `str`. """ + + self.endpoint = None + """ Series access endpoint. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.instance = None + """ A single SOP instance from the series. + List of `ImagingStudySeriesInstance` items (represented as `dict` in JSON). """ + + self.laterality = None + """ Body part laterality. + Type `Coding` (represented as `dict` in JSON). """ + + self.modality = None + """ The modality of the instances in the series. + Type `Coding` (represented as `dict` in JSON). """ + + self.number = None + """ Numeric identifier of this series. + Type `int`. """ + + self.numberOfInstances = None + """ Number of Series Related Instances. + Type `int`. """ + + self.performer = None + """ Who performed the series. + 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 + """ DICOM Series Instance UID for the series. + Type `str`. """ + + super(ImagingStudySeries, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ImagingStudySeries, self).elementProperties() + js.extend([ + ("bodySite", "bodySite", coding.Coding, False, None, False), + ("description", "description", str, False, None, False), + ("endpoint", "endpoint", fhirreference.FHIRReference, True, None, False), + ("instance", "instance", ImagingStudySeriesInstance, True, None, False), + ("laterality", "laterality", coding.Coding, False, None, False), + ("modality", "modality", coding.Coding, False, None, True), + ("number", "number", int, False, None, False), + ("numberOfInstances", "numberOfInstances", int, False, 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), + ]) + return js + + +class ImagingStudySeriesInstance(backboneelement.BackboneElement): + """ A single SOP instance from the series. + + A single SOP instance within the series, e.g. an image, or presentation + state. + """ + + resource_type = "ImagingStudySeriesInstance" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.number = None + """ The number of this instance in the series. + Type `int`. """ + + self.sopClass = None + """ DICOM class type. + Type `Coding` (represented as `dict` in JSON). """ + + self.title = None + """ Description of instance. + Type `str`. """ + + self.uid = None + """ DICOM SOP Instance UID. + Type `str`. """ + + super(ImagingStudySeriesInstance, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ImagingStudySeriesInstance, self).elementProperties() + js.extend([ + ("number", "number", int, False, None, False), + ("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: + 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'] diff --git a/fhirclient/models/R4/imagingstudy_tests.py b/fhirclient/models/R4/imagingstudy_tests.py new file mode 100644 index 000000000..8023912bc --- /dev/null +++ b/fhirclient/models/R4/imagingstudy_tests.py @@ -0,0 +1,129 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import imagingstudy +from .fhirdate import FHIRDate + + +class ImagingStudyTests(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("ImagingStudy", js["resourceType"]) + return imagingstudy.ImagingStudy(js) + + def testImagingStudy1(self): + inst = self.instantiate_from("imagingstudy-example-xr.json") + self.assertIsNotNone(inst, "Must have instantiated a ImagingStudy instance") + self.implImagingStudy1(inst) + + js = inst.as_json() + self.assertEqual("ImagingStudy", js["resourceType"]) + inst2 = imagingstudy.ImagingStudy(js) + self.implImagingStudy1(inst2) + + def implImagingStudy1(self, inst): + self.assertEqual(inst.id, "example-xr") + 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.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.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, "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.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, "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") + self.assertEqual(inst.series[0].modality.code, "DX") + 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, "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") + + def testImagingStudy2(self): + inst = self.instantiate_from("imagingstudy-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ImagingStudy instance") + self.implImagingStudy2(inst) + + js = inst.as_json() + self.assertEqual("ImagingStudy", js["resourceType"]) + inst2 = imagingstudy.ImagingStudy(js) + self.implImagingStudy2(inst2) + + 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") + self.assertEqual(inst.series[0].bodySite.display, "Upper Trunk Structure") + 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.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, "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") + diff --git a/fhirclient/models/R4/immunization.py b/fhirclient/models/R4/immunization.py new file mode 100644 index 000000000..0bc82c0c8 --- /dev/null +++ b/fhirclient/models/R4/immunization.py @@ -0,0 +1,390 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Immunization) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Immunization(domainresource.DomainResource): + """ Immunization event information. + + 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 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 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.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 immunization occurred. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.lotNumber = None + """ Vaccine lot number. + Type `str`. """ + + self.manufacturer = None + """ Vaccine manufacturer. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.note = None + """ 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` (represented as `dict` in JSON). """ + + self.performer = None + """ Who performed event. + 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). """ + + self.route = None + """ How vaccine entered body. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.site = None + """ Body site vaccine was administered. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.status = None + """ completed | entered-in-error | not-done. + Type `str`. """ + + 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. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(Immunization, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Immunization, self).elementProperties() + js.extend([ + ("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), + ("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), + ("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), + ("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), + ("statusReason", "statusReason", codeableconcept.CodeableConcept, False, None, False), + ("subpotentReason", "subpotentReason", codeableconcept.CodeableConcept, True, None, False), + ("vaccineCode", "vaccineCode", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +from . import backboneelement + +class ImmunizationEducation(backboneelement.BackboneElement): + """ Educational material presented to patient. + + Educational material presented to the patient (or guardian) at the time of + vaccine administration. + """ + + resource_type = "ImmunizationEducation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.documentType = None + """ Educational material document identifier. + Type `str`. """ + + 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(ImmunizationEducation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ImmunizationEducation, self).elementProperties() + js.extend([ + ("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 ImmunizationPerformer(backboneelement.BackboneElement): + """ Who performed event. + + Indicates who performed the immunization event. + """ + + resource_type = "ImmunizationPerformer" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 or organization who was performing. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.function = None + """ What type of performance was done. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ImmunizationPerformer, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ImmunizationPerformer, self).elementProperties() + js.extend([ + ("actor", "actor", fhirreference.FHIRReference, False, None, True), + ("function", "function", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class ImmunizationProtocolApplied(backboneelement.BackboneElement): + """ Protocol followed by the provider. + + The protocol (set of recommendations) being followed by the provider who + administered the dose. + """ + + resource_type = "ImmunizationProtocolApplied" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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.doseNumberPositiveInt = None + """ Dose number within series. + Type `int`. """ + + self.doseNumberString = None + """ Dose number within series. + Type `str`. """ + + 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(ImmunizationProtocolApplied, self).elementProperties() + js.extend([ + ("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 ImmunizationReaction(backboneelement.BackboneElement): + """ Details of a reaction that follows immunization. + + Categorical data indicating that an adverse event is associated in time to + an immunization. + """ + + resource_type = "ImmunizationReaction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ When reaction started. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.detail = None + """ Additional information on reaction. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.reported = None + """ Indicates self-reported reaction. + Type `bool`. """ + + super(ImmunizationReaction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ImmunizationReaction, self).elementProperties() + js.extend([ + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("detail", "detail", fhirreference.FHIRReference, False, None, False), + ("reported", "reported", bool, 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 quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/R4/immunization_tests.py b/fhirclient/models/R4/immunization_tests.py new file mode 100644 index 000000000..3689fe0fd --- /dev/null +++ b/fhirclient/models/R4/immunization_tests.py @@ -0,0 +1,244 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import immunization +from .fhirdate import FHIRDate + + +class ImmunizationTests(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("Immunization", js["resourceType"]) + return immunization.Immunization(js) + + def testImmunization1(self): + inst = self.instantiate_from("immunization-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Immunization instance") + self.implImmunization1(inst) + + js = inst.as_json() + self.assertEqual("Immunization", js["resourceType"]) + inst2 = immunization.Immunization(js) + self.implImmunization1(inst2) + + def implImmunization1(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.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.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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://terminology.hl7.org/CodeSystem/immunization-origin") + self.assertEqual(inst.reportOrigin.text, "Written Record") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.vaccineCode.coding[0].code, "GNFLU") + self.assertEqual(inst.vaccineCode.coding[0].system, "urn:oid:1.2.36.1.2001.1005.17") + self.assertEqual(inst.vaccineCode.text, "Influenza") + + 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.implImmunization4(inst) + + js = inst.as_json() + self.assertEqual("Immunization", js["resourceType"]) + inst2 = immunization.Immunization(js) + self.implImmunization4(inst2) + + def implImmunization4(self, inst): + self.assertEqual(inst.id, "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, "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 testImmunization5(self): + inst = self.instantiate_from("immunization-example-subpotent.json") + self.assertIsNotNone(inst, "Must have instantiated a Immunization instance") + self.implImmunization5(inst) + + js = inst.as_json() + self.assertEqual("Immunization", js["resourceType"]) + inst2 = immunization.Immunization(js) + self.implImmunization5(inst2) + + def implImmunization5(self, inst): + self.assertEqual(inst.doseQuantity.code, "ml") + self.assertEqual(inst.doseQuantity.system, "http://unitsofmeasure.org") + 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.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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("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.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://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.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, "Hepatitis B") + diff --git a/fhirclient/models/immunizationevaluation.py b/fhirclient/models/R4/immunizationevaluation.py similarity index 98% rename from fhirclient/models/immunizationevaluation.py rename to fhirclient/models/R4/immunizationevaluation.py index e0961c28a..a1394668c 100644 --- a/fhirclient/models/immunizationevaluation.py +++ b/fhirclient/models/R4/immunizationevaluation.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ImmunizationEvaluation) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ImmunizationEvaluation) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/immunizationevaluation_tests.py b/fhirclient/models/R4/immunizationevaluation_tests.py similarity index 97% rename from fhirclient/models/immunizationevaluation_tests.py rename to fhirclient/models/R4/immunizationevaluation_tests.py index 8d810ec25..ddaacf0c1 100644 --- a/fhirclient/models/immunizationevaluation_tests.py +++ b/fhirclient/models/R4/immunizationevaluation_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/R4/immunizationrecommendation.py b/fhirclient/models/R4/immunizationrecommendation.py new file mode 100644 index 000000000..23a2074b5 --- /dev/null +++ b/fhirclient/models/R4/immunizationrecommendation.py @@ -0,0 +1,208 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ImmunizationRecommendation) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class ImmunizationRecommendation(domainresource.DomainResource): + """ Guidance or advice relating to an immunization. + + A patient's point-in-time set of recommendations (i.e. forecasting) + according to a published schedule with optional supporting justification. + """ + + resource_type = "ImmunizationRecommendation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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` (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` (represented as `dict` in JSON). """ + + self.recommendation = None + """ Vaccine administration recommendations. + List of `ImmunizationRecommendationRecommendation` items (represented as `dict` in JSON). """ + + super(ImmunizationRecommendation, self).__init__(jsondict=jsondict, strict=strict) + + 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), + ]) + return js + + +from . import backboneelement + +class ImmunizationRecommendationRecommendation(backboneelement.BackboneElement): + """ Vaccine administration recommendations. + """ + + resource_type = "ImmunizationRecommendationRecommendation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + 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.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 recommendation status. + Type `CodeableConcept` (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 (represented as `dict` in JSON). """ + + self.supportingPatientInformation = None + """ Patient observations supporting recommendation. + 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 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([ + ("contraindicatedVaccineCode", "contraindicatedVaccineCode", codeableconcept.CodeableConcept, True, None, False), + ("dateCriterion", "dateCriterion", ImmunizationRecommendationRecommendationDateCriterion, True, 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), + ("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, True, None, False), + ]) + return js + + +class ImmunizationRecommendationRecommendationDateCriterion(backboneelement.BackboneElement): + """ Dates governing proposed immunization. + + Vaccine date recommendations. For example, earliest date to administer, + latest date to administer, etc. + """ + + resource_type = "ImmunizationRecommendationRecommendationDateCriterion" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 date. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.value = None + """ Recommended date. + Type `FHIRDate` (represented as `str` in JSON). """ + + super(ImmunizationRecommendationRecommendationDateCriterion, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ImmunizationRecommendationRecommendationDateCriterion, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("value", "value", fhirdate.FHIRDate, 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/R4/immunizationrecommendation_tests.py b/fhirclient/models/R4/immunizationrecommendation_tests.py new file mode 100644 index 000000000..9a0371a3c --- /dev/null +++ b/fhirclient/models/R4/immunizationrecommendation_tests.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import immunizationrecommendation +from .fhirdate import FHIRDate + + +class ImmunizationRecommendationTests(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("ImmunizationRecommendation", js["resourceType"]) + return immunizationrecommendation.ImmunizationRecommendation(js) + + def testImmunizationRecommendation1(self): + inst = self.instantiate_from("immunizationrecommendation-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ImmunizationRecommendation instance") + self.implImmunizationRecommendation1(inst) + + js = inst.as_json() + self.assertEqual("ImmunizationRecommendation", js["resourceType"]) + inst2 = immunizationrecommendation.ImmunizationRecommendation(js) + 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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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://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://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://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].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].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-example-target-disease.json") + self.assertIsNotNone(inst, "Must have instantiated a ImmunizationRecommendation instance") + self.implImmunizationRecommendation2(inst) + + js = inst.as_json() + self.assertEqual("ImmunizationRecommendation", js["resourceType"]) + inst2 = immunizationrecommendation.ImmunizationRecommendation(js) + 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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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://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://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].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].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
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/R4/implementationguide.py b/fhirclient/models/R4/implementationguide.py new file mode 100644 index 000000000..4f919bb0a --- /dev/null +++ b/fhirclient/models/R4/implementationguide.py @@ -0,0 +1,652 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ImplementationGuide) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class ImplementationGuide(domainresource.DomainResource): + """ A set of rules about how FHIR is used. + + A set of rules of how a particular interoperability or standards problem is + solved - typically through the use of FHIR resources. This resource is used + to gather all the parts of an implementation guide into a logical whole and + to publish a computable definition of all the parts. + """ + + resource_type = "ImplementationGuide" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 last changed. + Type `FHIRDate` (represented as `str` in JSON). """ + + 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 `ImplementationGuideDependsOn` items (represented as `dict` in JSON). """ + + self.description = None + """ Natural language description of the implementation guide. + Type `str`. """ + + self.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.fhirVersion = None + """ FHIR Version(s) this Implementation Guide targets. + List of `str` items. """ + + self.global_fhir = None + """ Profiles that apply globally. + List of `ImplementationGuideGlobal` items (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ 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.packageId = None + """ NPM Package name for IG. + Type `str`. """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.title = None + """ Name for this implementation guide (human friendly). + Type `str`. """ + + self.url = None + """ Canonical identifier for this implementation guide, 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 implementation guide. + Type `str`. """ + + super(ImplementationGuide, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ImplementationGuide, self).elementProperties() + js.extend([ + ("contact", "contact", contactdetail.ContactDetail, True, None, False), + ("copyright", "copyright", str, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, 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, 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), + ("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), + ]) + return js + + +from . import backboneelement + +class ImplementationGuideDefinition(backboneelement.BackboneElement): + """ Information needed to build the IG. + + The information needed by an IG publisher tool to publish the whole + implementation guide. + """ + + resource_type = "ImplementationGuideDefinition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.grouping = None + """ Grouping used to present related resources in the IG. + List of `ImplementationGuideDefinitionGrouping` items (represented as `dict` in JSON). """ + + 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). """ + + 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(ImplementationGuideDefinition, self).elementProperties() + js.extend([ + ("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 ImplementationGuideDefinitionGrouping(backboneelement.BackboneElement): + """ Grouping used to present related resources in the IG. + + A logical group of resources. Logical groups can be used when building + pages. + """ + + resource_type = "ImplementationGuideDefinitionGrouping" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Human readable text describing the package. + Type `str`. """ + + self.name = None + """ Descriptive name for the package. + Type `str`. """ + + super(ImplementationGuideDefinitionGrouping, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ImplementationGuideDefinitionGrouping, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, False), + ("name", "name", str, False, None, True), + ]) + return js + + +class ImplementationGuideDefinitionPage(backboneelement.BackboneElement): + """ Page/Section in the Guide. + + A page / section in the implementation guide. The root page is the + implementation guide home page. + """ + + resource_type = "ImplementationGuideDefinitionPage" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.generation = None + """ html | markdown | xml | generated. + Type `str`. """ + + 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.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(ImplementationGuideDefinitionPage, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ImplementationGuideDefinitionPage, self).elementProperties() + js.extend([ + ("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 ImplementationGuideDefinitionResource(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 = "ImplementationGuideDefinitionResource" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Reason why included in guide. + Type `str`. """ + + self.exampleBoolean = None + """ Is an example/What is this an example of?. + Type `bool`. """ + + 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.reference = None + """ Location of the resource. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(ImplementationGuideDefinitionResource, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ImplementationGuideDefinitionResource, self).elementProperties() + js.extend([ + ("description", "description", str, 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), + ("reference", "reference", fhirreference.FHIRReference, False, None, True), + ]) + return js + + +class ImplementationGuideDefinitionTemplate(backboneelement.BackboneElement): + """ A template for building resources. + """ + + 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 = "ImplementationGuideDependsOn" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.packageId = None + """ NPM Package name for IG this depends on. + Type `str`. """ + + self.uri = None + """ Identity of the IG that this depends on. + Type `str`. """ + + self.version = None + """ Version of the IG. + Type `str`. """ + + 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 + """ HTML page within the parent IG. + List of `ImplementationGuideManifestPage` items (represented as `dict` in JSON). """ + + 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 + """ Title of the page, for references. + Type `str`. """ + + 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`. """ + + 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(ImplementationGuideManifestResource, self).elementProperties() + js.extend([ + ("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 + + +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 usagecontext +except ImportError: + usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/R4/implementationguide_tests.py b/fhirclient/models/R4/implementationguide_tests.py new file mode 100644 index 000000000..2d5dfa322 --- /dev/null +++ b/fhirclient/models/R4/implementationguide_tests.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import implementationguide +from .fhirdate import FHIRDate + + +class ImplementationGuideTests(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("ImplementationGuide", js["resourceType"]) + return implementationguide.ImplementationGuide(js) + + def testImplementationGuide1(self): + inst = self.instantiate_from("implementationguide-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ImplementationGuide instance") + self.implImplementationGuide1(inst) + + js = inst.as_json() + self.assertEqual("ImplementationGuide", js["resourceType"]) + inst2 = implementationguide.ImplementationGuide(js) + self.implImplementationGuide1(inst2) + + def implImplementationGuide1(self, inst): + 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") + self.assertEqual(inst.contact[1].name, "HL7") + self.assertEqual(inst.contact[1].telecom[0].system, "url") + self.assertEqual(inst.contact[1].telecom[0].value, "http://hl7.org/fhir") + 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.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[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.packageId, "hl7.fhir.us.daf") + self.assertEqual(inst.publisher, "ONC / HL7 Joint project") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.url, "http://hl7.org/fhir/us/daf") + self.assertEqual(inst.version, "0") + diff --git a/fhirclient/models/insuranceplan.py b/fhirclient/models/R4/insuranceplan.py similarity index 99% rename from fhirclient/models/insuranceplan.py rename to fhirclient/models/R4/insuranceplan.py index 70cc6d240..597489519 100644 --- a/fhirclient/models/insuranceplan.py +++ b/fhirclient/models/R4/insuranceplan.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/InsurancePlan) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/InsurancePlan) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/insuranceplan_tests.py b/fhirclient/models/R4/insuranceplan_tests.py similarity index 94% rename from fhirclient/models/insuranceplan_tests.py rename to fhirclient/models/R4/insuranceplan_tests.py index 2160ce856..41080aca2 100644 --- a/fhirclient/models/insuranceplan_tests.py +++ b/fhirclient/models/R4/insuranceplan_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/invoice.py b/fhirclient/models/R4/invoice.py similarity index 99% rename from fhirclient/models/invoice.py rename to fhirclient/models/R4/invoice.py index 98962fb28..1038e3375 100644 --- a/fhirclient/models/invoice.py +++ b/fhirclient/models/R4/invoice.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Invoice) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Invoice) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/invoice_tests.py b/fhirclient/models/R4/invoice_tests.py similarity index 95% rename from fhirclient/models/invoice_tests.py rename to fhirclient/models/R4/invoice_tests.py index 04e419bf1..7138e32ca 100644 --- a/fhirclient/models/invoice_tests.py +++ b/fhirclient/models/R4/invoice_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/R4/library.py b/fhirclient/models/R4/library.py new file mode 100644 index 000000000..272a40dbc --- /dev/null +++ b/fhirclient/models/R4/library.py @@ -0,0 +1,244 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Library) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Library(domainresource.DomainResource): + """ Represents a library of quality improvement components. + + The Library resource is a general-purpose container for knowledge asset + definitions. It can be used to describe and expose existing knowledge + assets such as logic libraries and information model descriptions, as well + as to describe a collection of knowledge assets. + """ + + resource_type = "Library" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 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). """ + + self.content = None + """ Contents of the library, either embedded or referenced. + List of `Attachment` items (represented as `dict` in JSON). """ + + self.copyright = None + """ Use and/or publishing restrictions. + Type `str`. """ + + self.dataRequirement = None + """ What data is referenced by this library. + List of `DataRequirement` items (represented as `dict` in JSON). """ + + self.date = None + """ 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`. """ + + self.identifier = None + """ Additional identifier for the library. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ Intended jurisdiction for library (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.lastReviewDate = None + """ When the library was last reviewed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.name = None + """ Name for this library (computer friendly). + Type `str`. """ + + self.parameter = None + """ Parameters defined by the library. + List of `ParameterDefinition` items (represented as `dict` in JSON). """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this library 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.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.. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.type = None + """ logic-library | model-definition | asset-collection | module- + definition. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.url = None + """ Canonical identifier for this library, represented as a URI + (globally unique). + Type `str`. """ + + self.usage = None + """ Describes the clinical usage of the library. + 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 library. + Type `str`. """ + + super(Library, self).__init__(jsondict=jsondict, strict=strict) + + 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), + ("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), + ("parameter", "parameter", parameterdefinition.ParameterDefinition, True, 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, True), + ("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 attachment +except ImportError: + attachment = sys.modules[__package__ + '.attachment'] +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 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 parameterdefinition +except ImportError: + parameterdefinition = sys.modules[__package__ + '.parameterdefinition'] +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/R4/library_tests.py b/fhirclient/models/R4/library_tests.py new file mode 100644 index 000000000..ec47220e2 --- /dev/null +++ b/fhirclient/models/R4/library_tests.py @@ -0,0 +1,202 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import library +from .fhirdate import FHIRDate + + +class LibraryTests(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("Library", js["resourceType"]) + return library.Library(js) + + def testLibrary1(self): + inst = self.instantiate_from("library-predecessor-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Library instance") + self.implLibrary1(inst) + + js = inst.as_json() + self.assertEqual("Library", js["resourceType"]) + inst2 = library.Library(js) + 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[1].code[0].code, "confirmed") + self.assertEqual(inst.dataRequirement[1].codeFilter[1].path, "clinicalStatus") + self.assertEqual(inst.dataRequirement[1].codeFilter[2].path, "code") + 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[1].code[0].code, "confirmed") + self.assertEqual(inst.dataRequirement[2].codeFilter[1].path, "clinicalStatus") + self.assertEqual(inst.dataRequirement[2].codeFilter[2].path, "code") + 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[1].code[0].code, "ambulatory") + self.assertEqual(inst.dataRequirement[3].codeFilter[1].path, "class") + self.assertEqual(inst.dataRequirement[3].codeFilter[2].path, "type") + 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].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].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[1].path, "medication.code") + 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[1].path, "medication.code") + 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") + self.assertEqual(inst.description, "Logic for CMS 146: Appropriate Testing for Children with Pharyngitis") + 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") + self.assertEqual(inst.title, "Appropriate Testing for Children with Pharyngitis") + self.assertEqual(inst.type.coding[0].code, "logic-library") + self.assertEqual(inst.version, "2.0.0") + + def testLibrary3(self): + inst = self.instantiate_from("library-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Library instance") + self.implLibrary3(inst) + + js = inst.as_json() + self.assertEqual("Library", js["resourceType"]) + inst2 = library.Library(js) + self.implLibrary3(inst2) + + 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].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") + self.assertEqual(inst.description, "Common Logic for adherence to Chlamydia Screening guidelines") + 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") + self.assertEqual(inst.title, "Chlamydia Screening Common Library") + self.assertEqual(inst.topic[0].text, "Chlamydia Screening") + self.assertEqual(inst.type.coding[0].code, "logic-library") + self.assertEqual(inst.version, "2.0.0") + + def testLibrary4(self): + inst = self.instantiate_from("library-composition-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Library instance") + self.implLibrary4(inst) + + js = inst.as_json() + self.assertEqual("Library", js["resourceType"]) + inst2 = library.Library(js) + self.implLibrary4(inst2) + + def implLibrary4(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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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, "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/R4/linkage.py b/fhirclient/models/R4/linkage.py new file mode 100644 index 000000000..8f8d04b00 --- /dev/null +++ b/fhirclient/models/R4/linkage.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Linkage) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Linkage(domainresource.DomainResource): + """ Links records for 'same' item. + + Identifies two or more records (resource instances) that refer to the same + real-world "occurrence". + """ + + resource_type = "Linkage" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 linkage assertion is active or not. + Type `bool`. """ + + self.author = None + """ Who is responsible for linkages. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.item = None + """ Item to be linked. + List of `LinkageItem` items (represented as `dict` in JSON). """ + + super(Linkage, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Linkage, self).elementProperties() + js.extend([ + ("active", "active", bool, False, None, False), + ("author", "author", fhirreference.FHIRReference, False, None, False), + ("item", "item", LinkageItem, True, None, True), + ]) + return js + + +from . import backboneelement + +class LinkageItem(backboneelement.BackboneElement): + """ Item to be linked. + + 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. + """ + + resource_type = "LinkageItem" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Resource being linked. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.type = None + """ source | alternate | historical. + Type `str`. """ + + super(LinkageItem, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(LinkageItem, self).elementProperties() + js.extend([ + ("resource", "resource", fhirreference.FHIRReference, False, None, True), + ("type", "type", str, False, None, True), + ]) + return js + + +import sys +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] diff --git a/fhirclient/models/R4/linkage_tests.py b/fhirclient/models/R4/linkage_tests.py new file mode 100644 index 000000000..7d55aaf58 --- /dev/null +++ b/fhirclient/models/R4/linkage_tests.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import linkage +from .fhirdate import FHIRDate + + +class LinkageTests(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("Linkage", js["resourceType"]) + return linkage.Linkage(js) + + def testLinkage1(self): + inst = self.instantiate_from("linkage-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Linkage instance") + self.implLinkage1(inst) + + js = inst.as_json() + self.assertEqual("Linkage", js["resourceType"]) + inst2 = linkage.Linkage(js) + self.implLinkage1(inst2) + + 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/R4/list.py b/fhirclient/models/R4/list.py new file mode 100644 index 000000000..ed40cc616 --- /dev/null +++ b/fhirclient/models/R4/list.py @@ -0,0 +1,165 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/List) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class List(domainresource.DomainResource): + """ A list is a curated collection of resources. + """ + + resource_type = "List" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 the purpose of this list is. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.date = None + """ When the list was prepared. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.emptyReason = None + """ Why list is empty. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.encounter = None + """ Context in which list created. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.entry = None + """ Entries in the list. + List of `ListEntry` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Business identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.mode = None + """ working | snapshot | changes. + Type `str`. """ + + self.note = None + """ Comments about the list. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.orderedBy = None + """ What order the list has. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.source = None + """ Who and/or what defined the list contents (aka Author). + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.status = None + """ current | retired | entered-in-error. + Type `str`. """ + + self.subject = None + """ If all resources have the same subject. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.title = None + """ Descriptive name for the list. + Type `str`. """ + + super(List, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(List, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("emptyReason", "emptyReason", codeableconcept.CodeableConcept, False, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), + ("entry", "entry", ListEntry, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("mode", "mode", str, False, None, True), + ("note", "note", annotation.Annotation, True, None, False), + ("orderedBy", "orderedBy", codeableconcept.CodeableConcept, False, None, False), + ("source", "source", fhirreference.FHIRReference, False, None, False), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ("title", "title", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class ListEntry(backboneelement.BackboneElement): + """ Entries in the list. + + Entries in this list. + """ + + resource_type = "ListEntry" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ When item added to list. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.deleted = None + """ If this item is actually marked as deleted. + Type `bool`. """ + + self.flag = None + """ Status/Workflow information about this item. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.item = None + """ Actual entry. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(ListEntry, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ListEntry, self).elementProperties() + js.extend([ + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("deleted", "deleted", bool, False, None, False), + ("flag", "flag", codeableconcept.CodeableConcept, False, None, False), + ("item", "item", fhirreference.FHIRReference, 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 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/R4/list_tests.py b/fhirclient/models/R4/list_tests.py new file mode 100644 index 000000000..f039941ea --- /dev/null +++ b/fhirclient/models/R4/list_tests.py @@ -0,0 +1,299 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import list +from .fhirdate import FHIRDate + + +class ListTests(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("List", js["resourceType"]) + return list.List(js) + + def testList1(self): + inst = self.instantiate_from("list-example-medlist.json") + self.assertIsNotNone(inst, "Must have instantiated a List instance") + self.implList1(inst) + + js = inst.as_json() + self.assertEqual("List", js["resourceType"]) + inst2 = list.List(js) + self.implList1(inst2) + + def implList1(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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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 testList2(self): + inst = self.instantiate_from("list-example-familyhistory-genetics-profile-annie.json") + self.assertIsNotNone(inst, "Must have instantiated a List instance") + self.implList2(inst) + + js = inst.as_json() + self.assertEqual("List", js["resourceType"]) + inst2 = list.List(js) + self.implList2(inst2) + + def implList2(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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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-simple-empty.json") + self.assertIsNotNone(inst, "Must have instantiated a List instance") + self.implList3(inst) + + js = inst.as_json() + self.assertEqual("List", js["resourceType"]) + inst2 = list.List(js) + self.implList3(inst2) + + def implList3(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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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-empty.json") + self.assertIsNotNone(inst, "Must have instantiated a List instance") + self.implList4(inst) + + js = inst.as_json() + self.assertEqual("List", js["resourceType"]) + inst2 = list.List(js) + self.implList4(inst2) + + def implList4(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://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.status, "current") + self.assertEqual(inst.text.status, "generated") + + def testList5(self): + inst = self.instantiate_from("list-example-familyhistory-genetics-profile.json") + self.assertIsNotNone(inst, "Must have instantiated a List instance") + self.implList5(inst) + + js = inst.as_json() + self.assertEqual("List", js["resourceType"]) + inst2 = list.List(js) + self.implList5(inst2) + + 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, "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-f201-roel.json") + self.assertIsNotNone(inst, "Must have instantiated a List instance") + self.implList6(inst) + + js = inst.as_json() + self.assertEqual("List", js["resourceType"]) + inst2 = list.List(js) + self.implList6(inst2) + + 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, "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.json") + self.assertIsNotNone(inst, "Must have instantiated a List instance") + self.implList7(inst) + + js = inst.as_json() + self.assertEqual("List", js["resourceType"]) + inst2 = list.List(js) + self.implList7(inst2) + + def implList7(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].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-allergies.json") + self.assertIsNotNone(inst, "Must have instantiated a List instance") + self.implList8(inst) + + js = inst.as_json() + self.assertEqual("List", js["resourceType"]) + inst2 = list.List(js) + self.implList8(inst2) + + def implList8(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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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-double-cousin-relationship-pedigree.json") + self.assertIsNotNone(inst, "Must have instantiated a List instance") + self.implList9(inst) + + js = inst.as_json() + self.assertEqual("List", js["resourceType"]) + inst2 = list.List(js) + self.implList9(inst2) + + def implList9(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].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/R4/location.py b/fhirclient/models/R4/location.py new file mode 100644 index 000000000..3785d6f06 --- /dev/null +++ b/fhirclient/models/R4/location.py @@ -0,0 +1,240 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Location) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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 + accommodated. + """ + + resource_type = "Location" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Physical location. + 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. + 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. + Type `str`. """ + + self.endpoint = None + """ Technical endpoints providing access to services operated for the + location. + 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. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.managingOrganization = None + """ Organization responsible for provisioning and upkeep. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.mode = None + """ instance | kind. + Type `str`. """ + + self.name = None + """ Name of the location as used by humans. + Type `str`. """ + + self.operationalStatus = None + """ 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 a part of. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.physicalType = None + """ Physical form of the location. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.position = None + """ The absolute geographic location. + Type `LocationPosition` (represented as `dict` in JSON). """ + + self.status = None + """ active | suspended | inactive. + Type `str`. """ + + self.telecom = None + """ Contact details of the location. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + self.type = None + """ Type of function performed. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(Location, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Location, self).elementProperties() + 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), + ("name", "name", str, False, None, False), + ("operationalStatus", "operationalStatus", coding.Coding, False, None, False), + ("partOf", "partOf", fhirreference.FHIRReference, False, None, False), + ("physicalType", "physicalType", codeableconcept.CodeableConcept, False, None, False), + ("position", "position", LocationPosition, False, None, False), + ("status", "status", str, False, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, 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. + + The absolute geographic location of the Location, expressed using the WGS84 + datum (This is the same co-ordinate system used in KML). + """ + + resource_type = "LocationPosition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.altitude = None + """ Altitude with WGS84 datum. + Type `float`. """ + + self.latitude = None + """ Latitude with WGS84 datum. + Type `float`. """ + + self.longitude = None + """ Longitude with WGS84 datum. + Type `float`. """ + + super(LocationPosition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(LocationPosition, self).elementProperties() + js.extend([ + ("altitude", "altitude", float, False, None, False), + ("latitude", "latitude", float, False, None, True), + ("longitude", "longitude", float, False, None, True), + ]) + 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 coding +except ImportError: + coding = sys.modules[__package__ + '.coding'] +try: + 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: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] diff --git a/fhirclient/models/R4/location_tests.py b/fhirclient/models/R4/location_tests.py new file mode 100644 index 000000000..1775a09ee --- /dev/null +++ b/fhirclient/models/R4/location_tests.py @@ -0,0 +1,233 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import location +from .fhirdate import FHIRDate + + +class LocationTests(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("Location", js["resourceType"]) + return location.Location(js) + + def testLocation1(self): + inst = self.instantiate_from("location-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Location instance") + self.implLocation1(inst) + + js = inst.as_json() + self.assertEqual("Location", js["resourceType"]) + inst2 = location.Location(js) + self.implLocation1(inst2) + + def implLocation1(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.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, "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") + + def testLocation2(self): + inst = self.instantiate_from("location-example-room.json") + self.assertIsNotNone(inst, "Must have instantiated a Location instance") + self.implLocation2(inst) + + js = inst.as_json() + self.assertEqual("Location", js["resourceType"]) + inst2 = location.Location(js) + self.implLocation2(inst2) + + def implLocation2(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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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 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, "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[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-ambulance.json") + self.assertIsNotNone(inst, "Must have instantiated a Location instance") + self.implLocation3(inst) + + js = inst.as_json() + self.assertEqual("Location", js["resourceType"]) + inst2 = location.Location(js) + self.implLocation3(inst2) + + def implLocation3(self, inst): + 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, "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.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[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-ukpharmacy.json") + self.assertIsNotNone(inst, "Must have instantiated a Location instance") + self.implLocation4(inst) + + js = inst.as_json() + self.assertEqual("Location", js["resourceType"]) + inst2 = location.Location(js) + self.implLocation4(inst2) + + def implLocation4(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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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[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-patients-home.json") + self.assertIsNotNone(inst, "Must have instantiated a Location instance") + self.implLocation5(inst) + + js = inst.as_json() + self.assertEqual("Location", js["resourceType"]) + inst2 = location.Location(js) + self.implLocation5(inst2) + + def implLocation5(self, inst): + 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, "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, "
Patient's Home
") + self.assertEqual(inst.text.status, "generated") + 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-hl7hq.json") + self.assertIsNotNone(inst, "Must have instantiated a Location instance") + self.implLocation6(inst) + + js = inst.as_json() + self.assertEqual("Location", js["resourceType"]) + inst2 = location.Location(js) + self.implLocation6(inst2) + + def implLocation6(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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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://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].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, "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/R4/marketingstatus.py similarity index 98% rename from fhirclient/models/marketingstatus.py rename to fhirclient/models/R4/marketingstatus.py index 8450885b8..1e49a3874 100644 --- a/fhirclient/models/marketingstatus.py +++ b/fhirclient/models/R4/marketingstatus.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MarketingStatus) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MarketingStatus) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/R4/measure.py b/fhirclient/models/R4/measure.py new file mode 100644 index 000000000..72649b872 --- /dev/null +++ b/fhirclient/models/R4/measure.py @@ -0,0 +1,511 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Measure) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Measure(domainresource.DomainResource): + """ A quality measure definition. + + The Measure resource provides the definition of a quality measure. + """ + + resource_type = "Measure" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 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`. """ + + self.compositeScoring = None + """ opportunity | all-or-nothing | linear | weighted. + 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.definition = None + """ Defined terms used in the measure documentation. + List of `str` items. """ + + self.description = None + """ Natural language description of the measure. + Type `str`. """ + + self.disclaimer = None + """ 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`. """ + + self.group = None + """ Population criteria group. + List of `MeasureGroup` items (represented as `dict` in JSON). """ + + self.guidance = None + """ Additional guidance for implementers. + Type `str`. """ + + self.identifier = None + """ Additional identifier for the measure. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.improvementNotation = None + """ increase | decrease. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ Intended jurisdiction for measure (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.lastReviewDate = None + """ When the measure was last reviewed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.library = None + """ Logic used by the measure. + List of `str` items. """ + + self.name = None + """ Name for this measure (computer friendly). + Type `str`. """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this measure is defined. + Type `str`. """ + + self.rateAggregation = None + """ How is rate aggregation performed for this measure. + Type `str`. """ + + self.rationale = None + """ Detailed description of why the measure exists. + 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.riskAdjustment = None + """ 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.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). """ + + self.title = None + """ Name for this measure (human friendly). + Type `str`. """ + + self.topic = None + """ The category of the measure, such as Education, Treatment, + Assessment, etc.. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.type = None + """ process | outcome | structure | patient-reported-outcome | + composite. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.url = None + """ Canonical identifier for this measure, represented as a URI + (globally unique). + Type `str`. """ + + self.usage = None + """ Describes the clinical usage of the measure. + 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 measure. + Type `str`. """ + + super(Measure, self).__init__(jsondict=jsondict, strict=strict) + + 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), + ("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", codeableconcept.CodeableConcept, False, 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), + ("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), + ("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), + ("type", "type", 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 + + +from . import backboneelement + +class MeasureGroup(backboneelement.BackboneElement): + """ Population criteria group. + + A group of population criteria for the measure. + """ + + resource_type = "MeasureGroup" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 group. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.description = None + """ Summary description. + Type `str`. """ + + self.population = None + """ Population criteria. + List of `MeasureGroupPopulation` items (represented as `dict` in JSON). """ + + self.stratifier = None + """ Stratifier criteria for the measure. + List of `MeasureGroupStratifier` items (represented as `dict` in JSON). """ + + super(MeasureGroup, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MeasureGroup, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("description", "description", str, False, None, False), + ("population", "population", MeasureGroupPopulation, True, None, False), + ("stratifier", "stratifier", MeasureGroupStratifier, True, None, False), + ]) + return js + + +class MeasureGroupPopulation(backboneelement.BackboneElement): + """ Population criteria. + + A population criteria for the measure. + """ + + resource_type = "MeasureGroupPopulation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ initial-population | numerator | numerator-exclusion | denominator + | denominator-exclusion | denominator-exception | measure- + population | measure-population-exclusion | measure-observation. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.criteria = None + """ 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`. """ + + 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", expression.Expression, False, None, True), + ("description", "description", str, False, None, False), + ]) + return js + + +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 + valid FHIR Resource Path. + """ + + resource_type = "MeasureGroupStratifier" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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. + 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 `Expression` (represented as `dict` in JSON). """ + + self.description = None + """ The human readable description of this stratifier. + Type `str`. """ + + super(MeasureGroupStratifier, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MeasureGroupStratifier, self).elementProperties() + js.extend([ + ("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 + + +class MeasureSupplementalData(backboneelement.BackboneElement): + """ What other data should be reported with the measure. + + The supplemental data criteria for the measure report, specified as either + the name of a valid CQL expression within a referenced library, or a valid + FHIR Resource Path. + """ + + resource_type = "MeasureSupplementalData" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 supplemental data. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.criteria = None + """ Expression describing additional data to be reported. + Type `Expression` (represented as `dict` in JSON). """ + + self.description = None + """ The human readable description of this supplemental data. + Type `str`. """ + + self.usage = None + """ supplemental-data | risk-adjustment-factor. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(MeasureSupplementalData, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MeasureSupplementalData, self).elementProperties() + js.extend([ + ("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 + + +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 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 usagecontext +except ImportError: + usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/R4/measure_tests.py b/fhirclient/models/R4/measure_tests.py new file mode 100644 index 000000000..875d72e6e --- /dev/null +++ b/fhirclient/models/R4/measure_tests.py @@ -0,0 +1,272 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import measure +from .fhirdate import FHIRDate + + +class MeasureTests(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("Measure", js["resourceType"]) + return measure.Measure(js) + + def testMeasure1(self): + inst = self.instantiate_from("measure-component-b-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Measure instance") + self.implMeasure1(inst) + + js = inst.as_json() + self.assertEqual("Measure", js["resourceType"]) + inst2 = measure.Measure(js) + 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.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.") + 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-01-01").date) + self.assertEqual(inst.effectivePeriod.start.as_json(), "2017-01-01") + self.assertTrue(inst.experimental) + 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.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.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.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.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") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "146") + 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.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].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].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].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://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 testMeasure4(self): + inst = self.instantiate_from("measure-component-a-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Measure instance") + self.implMeasure4(inst) + + js = inst.as_json() + self.assertEqual("Measure", js["resourceType"]) + inst2 = measure.Measure(js) + self.implMeasure4(inst2) + + 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.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-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 testMeasure5(self): + inst = self.instantiate_from("measure-composite-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.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") + diff --git a/fhirclient/models/R4/measurereport.py b/fhirclient/models/R4/measurereport.py new file mode 100644 index 000000000..8772a2393 --- /dev/null +++ b/fhirclient/models/R4/measurereport.py @@ -0,0 +1,370 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MeasureReport) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class MeasureReport(domainresource.DomainResource): + """ Results of a measure evaluation. + + 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ When the report was generated. + Type `FHIRDate` (represented as `str` 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 MeasureReport. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.improvementNotation = None + """ increase | decrease. + Type `CodeableConcept` (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.reporter = None + """ Who is reporting the data. + 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 | subject-list | summary | data-collection. + Type `str`. """ + + super(MeasureReport, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MeasureReport, self).elementProperties() + js.extend([ + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("evaluatedResource", "evaluatedResource", fhirreference.FHIRReference, True, None, False), + ("group", "group", MeasureReportGroup, True, 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), + ("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 + + +from . import backboneelement + +class MeasureReportGroup(backboneelement.BackboneElement): + """ Measure results for each group. + + The results of the calculation, one for each population group in the + measure. + """ + + resource_type = "MeasureReportGroup" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 group. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.measureScore = None + """ What score this group achieved. + Type `Quantity` (represented as `dict` in JSON). """ + + self.population = None + """ The populations in the group. + List of `MeasureReportGroupPopulation` items (represented as `dict` in JSON). """ + + self.stratifier = None + """ Stratification results. + List of `MeasureReportGroupStratifier` items (represented as `dict` in JSON). """ + + super(MeasureReportGroup, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MeasureReportGroup, self).elementProperties() + js.extend([ + ("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), + ]) + return js + + +class MeasureReportGroupPopulation(backboneelement.BackboneElement): + """ The populations in the group. + + The populations that make up the population group, one for each type of + population appropriate for the measure. + """ + + resource_type = "MeasureReportGroupPopulation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ initial-population | numerator | numerator-exclusion | denominator + | denominator-exclusion | denominator-exception | measure- + population | measure-population-exclusion | measure-observation. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.count = None + """ Size of the population. + Type `int`. """ + + 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) + + def elementProperties(self): + js = super(MeasureReportGroupPopulation, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("count", "count", int, False, None, False), + ("subjectResults", "subjectResults", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +class MeasureReportGroupStratifier(backboneelement.BackboneElement): + """ Stratification results. + + When a measure includes multiple stratifiers, there will be a stratifier + group for each stratifier defined by the measure. + """ + + resource_type = "MeasureReportGroupStratifier" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 of the group. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.stratum = None + """ 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) + + def elementProperties(self): + js = super(MeasureReportGroupStratifier, self).elementProperties() + js.extend([ + ("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, 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 + will be four strata, one for each possible gender value. + """ + + resource_type = "MeasureReportGroupStratifierStratum" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Stratifier component values. + List of `MeasureReportGroupStratifierStratumComponent` items (represented as `dict` in JSON). """ + + self.measureScore = None + """ What score this stratum achieved. + Type `Quantity` (represented as `dict` in JSON). """ + + self.population = None + """ Population results in this stratum. + List of `MeasureReportGroupStratifierStratumPopulation` items (represented as `dict` in JSON). """ + + self.value = None + """ The stratum value, e.g. male. + 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([ + ("component", "component", MeasureReportGroupStratifierStratumComponent, True, None, False), + ("measureScore", "measureScore", quantity.Quantity, False, None, False), + ("population", "population", MeasureReportGroupStratifierStratumPopulation, True, None, False), + ("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 + + +class MeasureReportGroupStratifierStratumPopulation(backboneelement.BackboneElement): + """ Population results in this stratum. + + The populations that make up the stratum, one for each type of population + appropriate to the measure. + """ + + resource_type = "MeasureReportGroupStratifierStratumPopulation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ initial-population | numerator | numerator-exclusion | denominator + | denominator-exclusion | denominator-exception | measure- + population | measure-population-exclusion | measure-observation. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.count = None + """ Size of the population. + Type `int`. """ + + 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) + + def elementProperties(self): + js = super(MeasureReportGroupStratifierStratumPopulation, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("count", "count", int, False, None, False), + ("subjectResults", "subjectResults", fhirreference.FHIRReference, 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'] +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/R4/measurereport_tests.py b/fhirclient/models/R4/measurereport_tests.py new file mode 100644 index 000000000..2670c28d2 --- /dev/null +++ b/fhirclient/models/R4/measurereport_tests.py @@ -0,0 +1,359 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import measurereport +from .fhirdate import FHIRDate + + +class MeasureReportTests(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("MeasureReport", js["resourceType"]) + return measurereport.MeasureReport(js) + + def testMeasureReport1(self): + inst = self.instantiate_from("measurereport-cms146-cat1-example.json") + self.assertIsNotNone(inst, "Must have instantiated a MeasureReport instance") + self.implMeasureReport1(inst) + + js = inst.as_json() + self.assertEqual("MeasureReport", js["resourceType"]) + inst2 = measurereport.MeasureReport(js) + self.implMeasureReport1(inst2) + + def implMeasureReport1(self, inst): + self.assertEqual(inst.contained[0].id, "reporter") + 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") + self.assertEqual(inst.group[0].population[1].count, 1) + self.assertEqual(inst.group[0].population[2].code.coding[0].code, "denominator") + 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].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") + self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[1].count, 1) + self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[2].code.coding[0].code, "denominator") + 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.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") + self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[1].count, 0) + self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[2].code.coding[0].code, "denominator") + 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.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") + self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[1].count, 0) + self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[2].code.coding[0].code, "denominator") + 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.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") + self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[1].count, 1) + self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[2].code.coding[0].code, "denominator") + 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.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") + self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[1].count, 1) + self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[2].code.coding[0].code, "denominator") + 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.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") + self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[1].count, 0) + self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[2].code.coding[0].code, "denominator") + 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.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") + self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[1].count, 0) + self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[2].code.coding[0].code, "denominator") + 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.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") + self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[1].count, 0) + self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[2].code.coding[0].code, "denominator") + 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.text, "unknown") + self.assertEqual(inst.id, "measurereport-cms146-cat1-example") + 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) + 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, "individual") + + def testMeasureReport2(self): + inst = self.instantiate_from("measurereport-cms146-cat2-example.json") + self.assertIsNotNone(inst, "Must have instantiated a MeasureReport instance") + self.implMeasureReport2(inst) + + js = inst.as_json() + self.assertEqual("MeasureReport", js["resourceType"]) + inst2 = measurereport.MeasureReport(js) + self.implMeasureReport2(inst2) + + def implMeasureReport2(self, inst): + self.assertEqual(inst.contained[0].id, "reporter") + 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") + self.assertEqual(inst.group[0].population[1].count, 200) + self.assertEqual(inst.group[0].population[2].code.coding[0].code, "denominator") + 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].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") + self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[1].count, 100) + self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[2].code.coding[0].code, "denominator") + 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.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") + self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[1].count, 100) + self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[2].code.coding[0].code, "denominator") + 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.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") + self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[1].count, 100) + self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[2].code.coding[0].code, "denominator") + 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.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") + self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[1].count, 100) + self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[2].code.coding[0].code, "denominator") + 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.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") + self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[1].count, 100) + self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[2].code.coding[0].code, "denominator") + 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.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") + self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[1].count, 100) + self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[2].code.coding[0].code, "denominator") + 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.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") + self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[1].count, 0) + self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[2].code.coding[0].code, "denominator") + 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.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") + self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[1].count, 0) + self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[2].code.coding[0].code, "denominator") + 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.text, "unknown") + self.assertEqual(inst.id, "measurereport-cms146-cat2-example") + 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, "subject-list") + + def testMeasureReport3(self): + inst = self.instantiate_from("measurereport-cms146-cat3-example.json") + self.assertIsNotNone(inst, "Must have instantiated a MeasureReport instance") + self.implMeasureReport3(inst) + + js = inst.as_json() + self.assertEqual("MeasureReport", js["resourceType"]) + inst2 = measurereport.MeasureReport(js) + self.implMeasureReport3(inst2) + + def implMeasureReport3(self, inst): + self.assertEqual(inst.contained[0].id, "reporter") + 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") + self.assertEqual(inst.group[0].population[1].count, 200) + self.assertEqual(inst.group[0].population[2].code.coding[0].code, "denominator") + 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].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") + self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[1].count, 100) + self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[2].code.coding[0].code, "denominator") + 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.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") + self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[1].count, 100) + self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[2].code.coding[0].code, "denominator") + 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.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") + self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[1].count, 100) + self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[2].code.coding[0].code, "denominator") + 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.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") + self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[1].count, 100) + self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[2].code.coding[0].code, "denominator") + 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.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") + self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[1].count, 100) + self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[2].code.coding[0].code, "denominator") + 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.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") + self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[1].count, 100) + self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[2].code.coding[0].code, "denominator") + 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.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") + self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[1].count, 0) + self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[2].code.coding[0].code, "denominator") + 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.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") + self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[1].count, 0) + self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[2].code.coding[0].code, "denominator") + 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.text, "unknown") + self.assertEqual(inst.id, "measurereport-cms146-cat3-example") + 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) + 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, "summary") + diff --git a/fhirclient/models/R4/media.py b/fhirclient/models/R4/media.py new file mode 100644 index 000000000..8db045d22 --- /dev/null +++ b/fhirclient/models/R4/media.py @@ -0,0 +1,178 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Media) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Media(domainresource.DomainResource): + """ A photo, video, or audio recording acquired or used in healthcare. The + actual content may be inline or provided by direct reference. + """ + + resource_type = "Media" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.basedOn = None + """ Procedure that caused this media to be created. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.bodySite = None + """ 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.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` (represented as `dict` in JSON). """ + + self.deviceName = None + """ Name of the device/manufacturer. + Type `str`. """ + + self.duration = None + """ Length in seconds (audio / video). + 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). + Type `int`. """ + + self.height = None + """ Height of the image in pixels (photo/video). + Type `int`. """ + + self.identifier = None + """ 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.operator = None + """ The person who generated the image. + 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` (represented as `dict` in JSON). """ + + self.type = None + """ 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. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.width = None + """ Width of the image in pixels (photo/video). + Type `int`. """ + + super(Media, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Media, self).elementProperties() + js.extend([ + ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), + ("bodySite", "bodySite", codeableconcept.CodeableConcept, False, None, False), + ("content", "content", attachment.Attachment, False, None, True), + ("createdDateTime", "createdDateTime", fhirdate.FHIRDate, False, "created", False), + ("createdPeriod", "createdPeriod", period.Period, False, "created", False), + ("device", "device", fhirreference.FHIRReference, 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), + ("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), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("view", "view", codeableconcept.CodeableConcept, False, None, False), + ("width", "width", int, False, None, False), + ]) + return js + + +import sys +try: + from . import annotation +except ImportError: + annotation = sys.modules[__package__ + '.annotation'] +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 period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/R4/media_tests.py b/fhirclient/models/R4/media_tests.py new file mode 100644 index 000000000..38b1596d8 --- /dev/null +++ b/fhirclient/models/R4/media_tests.py @@ -0,0 +1,155 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import media +from .fhirdate import FHIRDate + + +class MediaTests(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("Media", js["resourceType"]) + return media.Media(js) + + def testMedia1(self): + inst = self.instantiate_from("media-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Media instance") + self.implMedia1(inst) + + js = inst.as_json() + self.assertEqual("Media", js["resourceType"]) + inst2 = media.Media(js) + 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.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.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: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: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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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.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 testMedia3(self): + inst = self.instantiate_from("media-example-xray.json") + self.assertIsNotNone(inst, "Must have instantiated a Media instance") + self.implMedia3(inst) + + js = inst.as_json() + self.assertEqual("Media", js["resourceType"]) + inst2 = media.Media(js) + self.implMedia3(inst2) + + 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.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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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.width, 640) + + def testMedia4(self): + inst = self.instantiate_from("media-example-sound.json") + self.assertIsNotNone(inst, "Must have instantiated a Media instance") + self.implMedia4(inst) + + js = inst.as_json() + self.assertEqual("Media", js["resourceType"]) + inst2 = media.Media(js) + self.implMedia4(inst2) + + def implMedia4(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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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") + diff --git a/fhirclient/models/R4/medication.py b/fhirclient/models/R4/medication.py new file mode 100644 index 000000000..bf7134f85 --- /dev/null +++ b/fhirclient/models/R4/medication.py @@ -0,0 +1,179 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Medication) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Medication(domainresource.DomainResource): + """ Definition of a Medication. + + This resource is primarily used for the identification and definition of a + medication for the purposes of prescribing, dispensing, and administering a + medication as well as for making statements about medication use. + """ + + resource_type = "Medication" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 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). """ + + self.form = None + """ powder | tablets | capsule +. + Type `CodeableConcept` (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.manufacturer = None + """ Manufacturer of the item. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.status = None + """ active | inactive | entered-in-error. + Type `str`. """ + + super(Medication, self).__init__(jsondict=jsondict, strict=strict) + + 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), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("ingredient", "ingredient", MedicationIngredient, True, None, False), + ("manufacturer", "manufacturer", fhirreference.FHIRReference, False, None, False), + ("status", "status", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class MedicationBatch(backboneelement.BackboneElement): + """ Details about packaged medications. + + Information that only applies to packages (not products). + """ + + resource_type = "MedicationBatch" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.expirationDate = None + """ When batch will expire. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.lotNumber = None + """ Identifier assigned to batch. + Type `str`. """ + + super(MedicationBatch, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationBatch, self).elementProperties() + js.extend([ + ("expirationDate", "expirationDate", fhirdate.FHIRDate, False, None, False), + ("lotNumber", "lotNumber", str, False, None, False), + ]) + return js + + +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.isActive = None + """ Active ingredient indicator. + Type `bool`. """ + + self.itemCodeableConcept = None + """ The actual ingredient or content. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.itemReference = None + """ 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(MedicationIngredient, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationIngredient, 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 + + +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 ratio +except ImportError: + ratio = sys.modules[__package__ + '.ratio'] diff --git a/fhirclient/models/R4/medicationadministration.py b/fhirclient/models/R4/medicationadministration.py new file mode 100644 index 000000000..0342eeafa --- /dev/null +++ b/fhirclient/models/R4/medicationadministration.py @@ -0,0 +1,277 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicationAdministration) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class MedicationAdministration(domainresource.DomainResource): + """ Administration of medication to a patient. + + Describes the event of a patient consuming or otherwise being administered + a medication. This may be as simple as swallowing a tablet or it may be a + long running infusion. Related resources tie this event to the authorizing + prescription, and the specific encounter between patient and health care + practitioner. + """ + + resource_type = "MedicationAdministration" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Type of medication usage. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.context = None + """ Encounter or Episode of Care administered as part of. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.device = None + """ Device used to administer. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.dosage = None + """ Details of how medication was taken. + Type `MedicationAdministrationDosage` (represented as `dict` in JSON). """ + + self.effectiveDateTime = None + """ Start and end time of administration. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.effectivePeriod = None + """ Start and end time of administration. + Type `Period` (represented as `dict` in JSON). """ + + self.eventHistory = None + """ A list of events of interest in the lifecycle. + 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` (represented as `dict` in JSON). """ + + self.note = None + """ Information about the administration. + 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 performed the medication administration and what they did. + List of `MedicationAdministrationPerformer` items (represented as `dict` in JSON). """ + + self.reasonCode = None + """ Reason administration performed. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.reasonReference = None + """ Condition or observation that supports why the medication was + administered. + 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 | 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` (represented as `dict` in JSON). """ + + self.supportingInformation = None + """ Additional information to support administration. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + super(MedicationAdministration, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationAdministration, self).elementProperties() + js.extend([ + ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("context", "context", fhirreference.FHIRReference, False, 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), + ("note", "note", annotation.Annotation, True, None, False), + ("partOf", "partOf", fhirreference.FHIRReference, True, None, False), + ("performer", "performer", MedicationAdministrationPerformer, True, None, False), + ("reasonCode", "reasonCode", 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), + ]) + return js + + +from . import backboneelement + +class MedicationAdministrationDosage(backboneelement.BackboneElement): + """ Details of how medication was taken. + + Describes the medication dosage information details e.g. dose, rate, site, + route, etc. + """ + + resource_type = "MedicationAdministrationDosage" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.dose = None + """ Amount of medication per dose. + Type `Quantity` (represented as `dict` in JSON). """ + + self.method = None + """ How drug was administered. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.rateQuantity = None + """ Dose quantity per unit of time. + Type `Quantity` (represented as `dict` in JSON). """ + + self.rateRatio = None + """ Dose quantity per unit of time. + Type `Ratio` (represented as `dict` in JSON). """ + + self.route = None + """ Path of substance into body. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.site = None + """ Body site administered to. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.text = None + """ Free text dosage instructions e.g. SIG. + Type `str`. """ + + super(MedicationAdministrationDosage, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationAdministrationDosage, self).elementProperties() + js.extend([ + ("dose", "dose", quantity.Quantity, False, None, False), + ("method", "method", codeableconcept.CodeableConcept, False, None, False), + ("rateQuantity", "rateQuantity", quantity.Quantity, False, "rate", False), + ("rateRatio", "rateRatio", ratio.Ratio, False, "rate", False), + ("route", "route", codeableconcept.CodeableConcept, False, None, False), + ("site", "site", codeableconcept.CodeableConcept, False, None, False), + ("text", "text", str, False, None, False), + ]) + return js + + +class MedicationAdministrationPerformer(backboneelement.BackboneElement): + """ Who performed the medication administration and what they did. + + Indicates who or what performed the medication administration and how they + were involved. + """ + + resource_type = "MedicationAdministrationPerformer" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 medication administration. + Type `FHIRReference` (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) + + def elementProperties(self): + js = super(MedicationAdministrationPerformer, 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: + 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'] +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/R4/medicationdispense.py b/fhirclient/models/R4/medicationdispense.py new file mode 100644 index 000000000..80bd16497 --- /dev/null +++ b/fhirclient/models/R4/medicationdispense.py @@ -0,0 +1,286 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicationDispense) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class MedicationDispense(domainresource.DomainResource): + """ Dispensing a medication to a named patient. + + Indicates that a medication product is to be or has been dispensed for a + named person/patient. This includes a description of the medication + product (supply) provided and the instructions for administering the + medication. The medication dispense is the result of a pharmacy system + responding to a medication order. + """ + + resource_type = "MedicationDispense" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.authorizingPrescription = None + """ Medication order that authorizes the dispense. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.category = None + """ Type of medication dispense. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.context = None + """ Encounter / Episode associated with event. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.daysSupply = None + """ Amount of medication expressed as a timing amount. + Type `Quantity` (represented as `dict` in JSON). """ + + self.destination = None + """ Where the medication was sent. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.detectedIssue = None + """ Clinical issue with action. + 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 + the caregiver. + List of `Dosage` items (represented as `dict` in JSON). """ + + self.eventHistory = None + """ 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` (represented as `dict` in JSON). """ + + self.note = None + """ Information about the dispense. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.partOf = None + """ Event that dispense is part of. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.performer = None + """ Who performed event. + List of `MedicationDispensePerformer` items (represented as `dict` in JSON). """ + + self.quantity = None + """ Amount dispensed. + Type `Quantity` (represented as `dict` in JSON). """ + + self.receiver = None + """ Who collected the medication. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.status = None + """ 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` (represented as `dict` in JSON). """ + + self.substitution = None + """ Whether a substitution was performed on the dispense. + Type `MedicationDispenseSubstitution` (represented as `dict` in JSON). """ + + self.supportingInformation = None + """ Information that supports the dispensing of the medication. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.type = None + """ Trial fill, partial fill, emergency fill, etc.. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.whenHandedOver = None + """ When product was given out. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.whenPrepared = None + """ When product was packaged and reviewed. + Type `FHIRDate` (represented as `str` in JSON). """ + + super(MedicationDispense, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationDispense, self).elementProperties() + js.extend([ + ("authorizingPrescription", "authorizingPrescription", fhirreference.FHIRReference, True, None, False), + ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("context", "context", fhirreference.FHIRReference, False, None, False), + ("daysSupply", "daysSupply", quantity.Quantity, False, None, False), + ("destination", "destination", fhirreference.FHIRReference, False, None, False), + ("detectedIssue", "detectedIssue", fhirreference.FHIRReference, True, None, False), + ("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), + ("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, 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), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("whenHandedOver", "whenHandedOver", fhirdate.FHIRDate, False, None, False), + ("whenPrepared", "whenPrepared", fhirdate.FHIRDate, False, None, False), + ]) + return js + + +from . import backboneelement + +class MedicationDispensePerformer(backboneelement.BackboneElement): + """ Who performed event. + + Indicates who or what performed the event. + """ + + resource_type = "MedicationDispensePerformer" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 performing. + Type `FHIRReference` (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) + + def elementProperties(self): + js = super(MedicationDispensePerformer, self).elementProperties() + js.extend([ + ("actor", "actor", fhirreference.FHIRReference, False, None, True), + ("function", "function", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +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 + 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. + """ + + resource_type = "MedicationDispenseSubstitution" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.reason = None + """ Why was substitution made. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.responsibleParty = None + """ Who is responsible for the substitution. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.type = None + """ Code signifying whether a different drug was dispensed from what + was prescribed. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.wasSubstituted = None + """ Whether a substitution was or was not performed on the dispense. + Type `bool`. """ + + super(MedicationDispenseSubstitution, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationDispenseSubstitution, self).elementProperties() + js.extend([ + ("reason", "reason", codeableconcept.CodeableConcept, True, None, False), + ("responsibleParty", "responsibleParty", fhirreference.FHIRReference, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("wasSubstituted", "wasSubstituted", bool, 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 dosage +except ImportError: + dosage = sys.modules[__package__ + '.dosage'] +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'] diff --git a/fhirclient/models/medicationknowledge.py b/fhirclient/models/R4/medicationknowledge.py similarity index 99% rename from fhirclient/models/medicationknowledge.py rename to fhirclient/models/R4/medicationknowledge.py index 9b6d37d24..1b9175a5c 100644 --- a/fhirclient/models/medicationknowledge.py +++ b/fhirclient/models/R4/medicationknowledge.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicationKnowledge) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicationKnowledge) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/medicationknowledge_tests.py b/fhirclient/models/R4/medicationknowledge_tests.py similarity index 95% rename from fhirclient/models/medicationknowledge_tests.py rename to fhirclient/models/R4/medicationknowledge_tests.py index f591dc6d9..c907548cf 100644 --- a/fhirclient/models/medicationknowledge_tests.py +++ b/fhirclient/models/R4/medicationknowledge_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/R4/medicationrequest.py b/fhirclient/models/R4/medicationrequest.py new file mode 100644 index 000000000..a86db8838 --- /dev/null +++ b/fhirclient/models/R4/medicationrequest.py @@ -0,0 +1,394 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicationRequest) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class MedicationRequest(domainresource.DomainResource): + """ Ordering of medication for patient or group. + + An order or request for both supply of the medication and the instructions + for administration of the medication to a patient. The resource is called + "MedicationRequest" rather than "MedicationPrescription" or + "MedicationOrder" to generalize the use across inpatient and outpatient + settings, including care plans, etc., and to harmonize with workflow + patterns. + """ + + resource_type = "MedicationRequest" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ When request was initially authored. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.basedOn = None + """ What request fulfills. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.category = None + """ Type of medication usage. + List of `CodeableConcept` items (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 (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 (represented as `dict` in JSON). """ + + self.groupIdentifier = None + """ Composite request this is part of. + Type `Identifier` (represented as `dict` in JSON). """ + + self.identifier = None + """ 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 | original-order | instance-order | option. + Type `str`. """ + + self.medicationCodeableConcept = None + """ Medication to be taken. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.medicationReference = None + """ Medication to be taken. + 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` (represented as `dict` in JSON). """ + + self.priority = None + """ routine | urgent | asap | stat. + Type `str`. """ + + self.reasonCode = None + """ 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 + being written. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.recorder = None + """ Person who entered the request. + 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 `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` (represented as `dict` in JSON). """ + + self.substitution = None + """ Any restrictions on medication substitution. + Type `MedicationRequestSubstitution` (represented as `dict` in JSON). """ + + self.supportingInformation = None + """ Information to support ordering of the medication. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + super(MedicationRequest, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationRequest, self).elementProperties() + js.extend([ + ("authoredOn", "authoredOn", fhirdate.FHIRDate, False, None, False), + ("basedOn", "basedOn", 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), + ("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), + ]) + return js + + +from . import backboneelement + +class MedicationRequestDispenseRequest(backboneelement.BackboneElement): + """ Medication supply authorization. + + Indicates the specific details for the dispense or medication supply part + of a medication request (also known as a Medication Prescription or + Medication Order). Note that this information is not always sent with the + order. There may be in some settings (e.g. hospitals) institutional or + system support for completing the dispense details in the pharmacy + department. + """ + + resource_type = "MedicationRequestDispenseRequest" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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` (represented as `dict` in JSON). """ + + self.quantity = None + """ Amount of medication to supply per dispense. + Type `Quantity` (represented as `dict` in JSON). """ + + self.validityPeriod = None + """ Time period supply is authorized for. + Type `Period` (represented as `dict` in JSON). """ + + super(MedicationRequestDispenseRequest, self).__init__(jsondict=jsondict, strict=strict) + + 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), + ("validityPeriod", "validityPeriod", period.Period, False, None, False), + ]) + return js + + +class MedicationRequestDispenseRequestInitialFill(backboneelement.BackboneElement): + """ First fill details. + + Indicates the quantity or duration for the first dispense of the + medication. + """ + + resource_type = "MedicationRequestDispenseRequestInitialFill" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.duration = None + """ First fill duration. + Type `Duration` (represented as `dict` in JSON). """ + + self.quantity = None + """ First fill quantity. + Type `Quantity` (represented as `dict` in JSON). """ + + super(MedicationRequestDispenseRequestInitialFill, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationRequestDispenseRequestInitialFill, self).elementProperties() + js.extend([ + ("duration", "duration", duration.Duration, False, None, False), + ("quantity", "quantity", quantity.Quantity, False, None, False), + ]) + return js + + +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 + substitution must not happen. This block explains the prescriber's intent. + If nothing is specified substitution may be done. + """ + + resource_type = "MedicationRequestSubstitution" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + 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). """ + + super(MedicationRequestSubstitution, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationRequestSubstitution, self).elementProperties() + js.extend([ + ("allowedBoolean", "allowedBoolean", bool, False, "allowed", True), + ("allowedCodeableConcept", "allowedCodeableConcept", codeableconcept.CodeableConcept, False, "allowed", True), + ("reason", "reason", 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 dosage +except ImportError: + dosage = sys.modules[__package__ + '.dosage'] +try: + from . import duration +except ImportError: + duration = sys.modules[__package__ + '.duration'] +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 quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/R4/medicationstatement.py b/fhirclient/models/R4/medicationstatement.py new file mode 100644 index 000000000..0eba41e4b --- /dev/null +++ b/fhirclient/models/R4/medicationstatement.py @@ -0,0 +1,184 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicationStatement) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class MedicationStatement(domainresource.DomainResource): + """ Record of medication being taken by a patient. + + 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 + 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. + + The primary difference between a medication statement and a medication + administration is that the medication administration has complete + administration information and is based on actual administration + information from the person who administered the medication. A medication + statement is often, if not always, less specific. There is no required + date/time when the medication was administered, in fact we only know that a + source has reported the patient is taking this medication, where details + such as time, quantity, or rate or even medication product may be + incomplete or missing or less precise. As stated earlier, the medication + statement information may come from the patient's memory, from a + prescription bottle or from a list of medications the patient, clinician or + other party maintains. Medication administration is more formal and is not + missing detailed information. + """ + + resource_type = "MedicationStatement" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.basedOn = None + """ Fulfils plan, proposal or order. + 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 + """ Encounter / Episode associated with MedicationStatement. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.dateAsserted = None + """ When the statement was asserted?. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.derivedFrom = None + """ Additional supporting information. + 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 is/was/will be taken. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.effectivePeriod = None + """ The date/time or interval when the medication is/was/will be taken. + Type `Period` (represented as `dict` in JSON). """ + + self.identifier = None + """ External identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.informationSource = None + """ Person or organization that provided the information about the + taking of this medication. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.medicationCodeableConcept = None + """ What medication was taken. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.medicationReference = None + """ What medication was taken. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.note = None + """ Further information about the statement. + 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.reasonCode = None + """ Reason for why the medication is being/was taken. + 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 (represented as `dict` in JSON). """ + + self.status = None + """ active | completed | entered-in-error | intended | stopped | on- + 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` (represented as `dict` in JSON). """ + + super(MedicationStatement, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationStatement, self).elementProperties() + js.extend([ + ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), + ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("context", "context", fhirreference.FHIRReference, False, None, False), + ("dateAsserted", "dateAsserted", fhirdate.FHIRDate, False, None, False), + ("derivedFrom", "derivedFrom", fhirreference.FHIRReference, True, None, False), + ("dosage", "dosage", dosage.Dosage, True, None, False), + ("effectiveDateTime", "effectiveDateTime", fhirdate.FHIRDate, False, "effective", False), + ("effectivePeriod", "effectivePeriod", period.Period, False, "effective", False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("informationSource", "informationSource", fhirreference.FHIRReference, False, None, False), + ("medicationCodeableConcept", "medicationCodeableConcept", codeableconcept.CodeableConcept, False, "medication", True), + ("medicationReference", "medicationReference", fhirreference.FHIRReference, False, "medication", True), + ("note", "note", annotation.Annotation, True, None, False), + ("partOf", "partOf", fhirreference.FHIRReference, True, None, False), + ("reasonCode", "reasonCode", 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), + ]) + 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 dosage +except ImportError: + dosage = sys.modules[__package__ + '.dosage'] +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/medicinalproduct.py b/fhirclient/models/R4/medicinalproduct.py similarity index 99% rename from fhirclient/models/medicinalproduct.py rename to fhirclient/models/R4/medicinalproduct.py index 4c80f4132..e9e3f26da 100644 --- a/fhirclient/models/medicinalproduct.py +++ b/fhirclient/models/R4/medicinalproduct.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicinalProduct) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicinalProduct) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/medicinalproduct_tests.py b/fhirclient/models/R4/medicinalproduct_tests.py similarity index 97% rename from fhirclient/models/medicinalproduct_tests.py rename to fhirclient/models/R4/medicinalproduct_tests.py index 44ad5b778..fbb0d493c 100644 --- a/fhirclient/models/medicinalproduct_tests.py +++ b/fhirclient/models/R4/medicinalproduct_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/medicinalproductauthorization.py b/fhirclient/models/R4/medicinalproductauthorization.py similarity index 99% rename from fhirclient/models/medicinalproductauthorization.py rename to fhirclient/models/R4/medicinalproductauthorization.py index 00c892210..ca08bac2f 100644 --- a/fhirclient/models/medicinalproductauthorization.py +++ b/fhirclient/models/R4/medicinalproductauthorization.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicinalProductAuthorization) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicinalProductAuthorization) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/medicinalproductauthorization_tests.py b/fhirclient/models/R4/medicinalproductauthorization_tests.py similarity index 98% rename from fhirclient/models/medicinalproductauthorization_tests.py rename to fhirclient/models/R4/medicinalproductauthorization_tests.py index 06bfbe368..dd5020011 100644 --- a/fhirclient/models/medicinalproductauthorization_tests.py +++ b/fhirclient/models/R4/medicinalproductauthorization_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/medicinalproductcontraindication.py b/fhirclient/models/R4/medicinalproductcontraindication.py similarity index 98% rename from fhirclient/models/medicinalproductcontraindication.py rename to fhirclient/models/R4/medicinalproductcontraindication.py index 6cb443b4a..0669fd46c 100644 --- a/fhirclient/models/medicinalproductcontraindication.py +++ b/fhirclient/models/R4/medicinalproductcontraindication.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicinalProductContraindication) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicinalProductContraindication) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/medicinalproductcontraindication_tests.py b/fhirclient/models/R4/medicinalproductcontraindication_tests.py similarity index 95% rename from fhirclient/models/medicinalproductcontraindication_tests.py rename to fhirclient/models/R4/medicinalproductcontraindication_tests.py index 35880578a..8ec3e2462 100644 --- a/fhirclient/models/medicinalproductcontraindication_tests.py +++ b/fhirclient/models/R4/medicinalproductcontraindication_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/medicinalproductindication.py b/fhirclient/models/R4/medicinalproductindication.py similarity index 99% rename from fhirclient/models/medicinalproductindication.py rename to fhirclient/models/R4/medicinalproductindication.py index 39b04a03b..1c183dcdd 100644 --- a/fhirclient/models/medicinalproductindication.py +++ b/fhirclient/models/R4/medicinalproductindication.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicinalProductIndication) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicinalProductIndication) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/medicinalproductindication_tests.py b/fhirclient/models/R4/medicinalproductindication_tests.py similarity index 96% rename from fhirclient/models/medicinalproductindication_tests.py rename to fhirclient/models/R4/medicinalproductindication_tests.py index 7fdccd884..8b480c281 100644 --- a/fhirclient/models/medicinalproductindication_tests.py +++ b/fhirclient/models/R4/medicinalproductindication_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/medicinalproductingredient.py b/fhirclient/models/R4/medicinalproductingredient.py similarity index 99% rename from fhirclient/models/medicinalproductingredient.py rename to fhirclient/models/R4/medicinalproductingredient.py index 109b408fc..f22efa5d6 100644 --- a/fhirclient/models/medicinalproductingredient.py +++ b/fhirclient/models/R4/medicinalproductingredient.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicinalProductIngredient) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicinalProductIngredient) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/medicinalproductingredient_tests.py b/fhirclient/models/R4/medicinalproductingredient_tests.py similarity index 96% rename from fhirclient/models/medicinalproductingredient_tests.py rename to fhirclient/models/R4/medicinalproductingredient_tests.py index 0d12ce536..8d8971d02 100644 --- a/fhirclient/models/medicinalproductingredient_tests.py +++ b/fhirclient/models/R4/medicinalproductingredient_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/medicinalproductinteraction.py b/fhirclient/models/R4/medicinalproductinteraction.py similarity index 98% rename from fhirclient/models/medicinalproductinteraction.py rename to fhirclient/models/R4/medicinalproductinteraction.py index 7509dc063..4145e98cf 100644 --- a/fhirclient/models/medicinalproductinteraction.py +++ b/fhirclient/models/R4/medicinalproductinteraction.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicinalProductInteraction) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicinalProductInteraction) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/medicinalproductinteraction_tests.py b/fhirclient/models/R4/medicinalproductinteraction_tests.py similarity index 96% rename from fhirclient/models/medicinalproductinteraction_tests.py rename to fhirclient/models/R4/medicinalproductinteraction_tests.py index 5b588b398..e419ce111 100644 --- a/fhirclient/models/medicinalproductinteraction_tests.py +++ b/fhirclient/models/R4/medicinalproductinteraction_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/medicinalproductmanufactured.py b/fhirclient/models/R4/medicinalproductmanufactured.py similarity index 98% rename from fhirclient/models/medicinalproductmanufactured.py rename to fhirclient/models/R4/medicinalproductmanufactured.py index 7c41b0165..574a3e18f 100644 --- a/fhirclient/models/medicinalproductmanufactured.py +++ b/fhirclient/models/R4/medicinalproductmanufactured.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicinalProductManufactured) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicinalProductManufactured) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/medicinalproductmanufactured_tests.py b/fhirclient/models/R4/medicinalproductmanufactured_tests.py similarity index 96% rename from fhirclient/models/medicinalproductmanufactured_tests.py rename to fhirclient/models/R4/medicinalproductmanufactured_tests.py index af54dfd0b..13f0323da 100644 --- a/fhirclient/models/medicinalproductmanufactured_tests.py +++ b/fhirclient/models/R4/medicinalproductmanufactured_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/medicinalproductpackaged.py b/fhirclient/models/R4/medicinalproductpackaged.py similarity index 99% rename from fhirclient/models/medicinalproductpackaged.py rename to fhirclient/models/R4/medicinalproductpackaged.py index 3af1de8a1..cc1525655 100644 --- a/fhirclient/models/medicinalproductpackaged.py +++ b/fhirclient/models/R4/medicinalproductpackaged.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicinalProductPackaged) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicinalProductPackaged) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/medicinalproductpackaged_tests.py b/fhirclient/models/R4/medicinalproductpackaged_tests.py similarity index 98% rename from fhirclient/models/medicinalproductpackaged_tests.py rename to fhirclient/models/R4/medicinalproductpackaged_tests.py index 4fa5bf77e..06506947d 100644 --- a/fhirclient/models/medicinalproductpackaged_tests.py +++ b/fhirclient/models/R4/medicinalproductpackaged_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/medicinalproductpharmaceutical.py b/fhirclient/models/R4/medicinalproductpharmaceutical.py similarity index 99% rename from fhirclient/models/medicinalproductpharmaceutical.py rename to fhirclient/models/R4/medicinalproductpharmaceutical.py index b4f9363d0..5b6e39788 100644 --- a/fhirclient/models/medicinalproductpharmaceutical.py +++ b/fhirclient/models/R4/medicinalproductpharmaceutical.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicinalProductPharmaceutical) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicinalProductPharmaceutical) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/medicinalproductpharmaceutical_tests.py b/fhirclient/models/R4/medicinalproductpharmaceutical_tests.py similarity index 96% rename from fhirclient/models/medicinalproductpharmaceutical_tests.py rename to fhirclient/models/R4/medicinalproductpharmaceutical_tests.py index 1d7376a7f..b53d73550 100644 --- a/fhirclient/models/medicinalproductpharmaceutical_tests.py +++ b/fhirclient/models/R4/medicinalproductpharmaceutical_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/medicinalproductundesirableeffect.py b/fhirclient/models/R4/medicinalproductundesirableeffect.py similarity index 97% rename from fhirclient/models/medicinalproductundesirableeffect.py rename to fhirclient/models/R4/medicinalproductundesirableeffect.py index 6b9b8119d..1e82b9937 100644 --- a/fhirclient/models/medicinalproductundesirableeffect.py +++ b/fhirclient/models/R4/medicinalproductundesirableeffect.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicinalProductUndesirableEffect) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicinalProductUndesirableEffect) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/medicinalproductundesirableeffect_tests.py b/fhirclient/models/R4/medicinalproductundesirableeffect_tests.py similarity index 96% rename from fhirclient/models/medicinalproductundesirableeffect_tests.py rename to fhirclient/models/R4/medicinalproductundesirableeffect_tests.py index 018715ea0..7c2c96093 100644 --- a/fhirclient/models/medicinalproductundesirableeffect_tests.py +++ b/fhirclient/models/R4/medicinalproductundesirableeffect_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/R4/messagedefinition.py b/fhirclient/models/R4/messagedefinition.py new file mode 100644 index 000000000..2635916e3 --- /dev/null +++ b/fhirclient/models/R4/messagedefinition.py @@ -0,0 +1,272 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MessageDefinition) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class MessageDefinition(domainresource.DomainResource): + """ A resource that defines a type of message that can be exchanged between + systems. + + Defines the characteristics of a message that can be shared between + systems, including the type of event that initiates the message, the + content to be transmitted and what response(s), if any, are permitted. + """ + + resource_type = "MessageDefinition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.allowedResponse = None + """ Responses to this message. + List of `MessageDefinitionAllowedResponse` items (represented as `dict` in JSON). """ + + self.base = None + """ Definition this one is based on. + Type `str`. """ + + self.category = None + """ consequence | currency | notification. + Type `str`. """ + + 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 message definition. + Type `str`. """ + + 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`. """ + + self.focus = None + """ 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 + """ 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). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.name = None + """ Name for this message definition (computer friendly). + Type `str`. """ + + self.parent = None + """ Protocol/workflow this is part of. + List of `str` items. """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this message definition is defined. + Type `str`. """ + + self.replaces = None + """ Takes the place of. + List of `str` items. """ + + self.responseRequired = None + """ always | on-error | never | on-success. + Type `str`. """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.title = None + """ Name for this message definition (human friendly). + Type `str`. """ + + self.url = None + """ Business Identifier for a given MessageDefinition. + 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 message definition. + Type `str`. """ + + super(MessageDefinition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MessageDefinition, self).elementProperties() + js.extend([ + ("allowedResponse", "allowedResponse", MessageDefinitionAllowedResponse, True, 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), + ("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), + ("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", str, True, None, False), + ("publisher", "publisher", str, False, None, False), + ("purpose", "purpose", str, 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), + ("useContext", "useContext", usagecontext.UsageContext, True, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class MessageDefinitionAllowedResponse(backboneelement.BackboneElement): + """ Responses to this message. + + Indicates what types of messages may be sent as an application-level + response to this message. + """ + + resource_type = "MessageDefinitionAllowedResponse" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.message = None + """ Reference to allowed message definition response. + Type `str`. """ + + self.situation = None + """ When should this response be used. + Type `str`. """ + + super(MessageDefinitionAllowedResponse, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MessageDefinitionAllowedResponse, self).elementProperties() + js.extend([ + ("message", "message", str, False, None, True), + ("situation", "situation", str, False, None, False), + ]) + return js + + +class MessageDefinitionFocus(backboneelement.BackboneElement): + """ Resource(s) that are the subject of the event. + + Identifies the resource (or resources) that are being addressed by the + event. For example, the Encounter for an admit message or two Account + records for a merge. + """ + + resource_type = "MessageDefinitionFocus" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 resource. + Type `str`. """ + + self.max = None + """ Maximum number of focuses of this type. + Type `str`. """ + + self.min = None + """ Minimum number of focuses of this type. + Type `int`. """ + + self.profile = None + """ Profile that must be adhered to by focus. + Type `str`. """ + + super(MessageDefinitionFocus, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MessageDefinitionFocus, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("max", "max", str, False, None, False), + ("min", "min", int, False, None, True), + ("profile", "profile", str, 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 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/R4/messagedefinition_tests.py b/fhirclient/models/R4/messagedefinition_tests.py new file mode 100644 index 000000000..e082a9cc1 --- /dev/null +++ b/fhirclient/models/R4/messagedefinition_tests.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import messagedefinition +from .fhirdate import FHIRDate + + +class MessageDefinitionTests(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("MessageDefinition", js["resourceType"]) + return messagedefinition.MessageDefinition(js) + + def testMessageDefinition1(self): + inst = self.instantiate_from("messagedefinition-example.json") + self.assertIsNotNone(inst, "Must have instantiated a MessageDefinition instance") + self.implMessageDefinition1(inst) + + js = inst.as_json() + self.assertEqual("MessageDefinition", js["resourceType"]) + inst2 = messagedefinition.MessageDefinition(js) + self.implMessageDefinition1(inst2) + + def implMessageDefinition1(self, inst): + 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.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 MessageDefinition instances.") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.div, "
Message definition base example
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "Message definition base example") + self.assertEqual(inst.url, "http://hl7.org/fhir/MessageDefinition/example") + diff --git a/fhirclient/models/R4/messageheader.py b/fhirclient/models/R4/messageheader.py new file mode 100644 index 000000000..d0b9faef0 --- /dev/null +++ b/fhirclient/models/R4/messageheader.py @@ -0,0 +1,255 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MessageHeader) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class MessageHeader(domainresource.DomainResource): + """ A resource that describes a message that is exchanged between systems. + + The header for a message exchange that is either requesting or responding + to an action. The reference(s) that are the subject of the action as well + as other information related to the action are typically transmitted in a + bundle in which the MessageHeader resource instance is the first resource + in the bundle. + """ + + resource_type = "MessageHeader" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ The source of the decision. + 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). + List of `MessageHeaderDestination` items (represented as `dict` in JSON). """ + + self.enterer = None + """ The source of the data entry. + Type `FHIRReference` (represented as `dict` in JSON). """ + + 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 (represented as `dict` in JSON). """ + + self.reason = None + """ Cause of event. + Type `CodeableConcept` (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` (represented as `dict` in JSON). """ + + self.sender = None + """ Real world sender of the message. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.source = None + """ Message source application. + Type `MessageHeaderSource` (represented as `dict` 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), + ("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), + ("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), + ]) + return js + + +from . import backboneelement + +class MessageHeaderDestination(backboneelement.BackboneElement): + """ Message destination application(s). + + The destination application which the message is intended for. + """ + + resource_type = "MessageHeaderDestination" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Actual destination address or id. + Type `str`. """ + + self.name = None + """ 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` (represented as `dict` in JSON). """ + + super(MessageHeaderDestination, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MessageHeaderDestination, self).elementProperties() + 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 + + +class MessageHeaderResponse(backboneelement.BackboneElement): + """ If this is a reply to prior message. + + Information about the message that this message is a response to. Only + present if this message is a response. + """ + + resource_type = "MessageHeaderResponse" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ ok | transient-error | fatal-error. + Type `str`. """ + + self.details = None + """ Specific list of hints/warnings/errors. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.identifier = None + """ Id of original message. + Type `str`. """ + + super(MessageHeaderResponse, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MessageHeaderResponse, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("details", "details", fhirreference.FHIRReference, False, None, False), + ("identifier", "identifier", str, False, None, True), + ]) + return js + + +class MessageHeaderSource(backboneelement.BackboneElement): + """ Message source application. + + The source application from which this message originated. + """ + + resource_type = "MessageHeaderSource" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Human contact for problems. + Type `ContactPoint` (represented as `dict` in JSON). """ + + self.endpoint = None + """ Actual message source address or id. + Type `str`. """ + + self.name = None + """ Name of system. + Type `str`. """ + + self.software = None + """ Name of software running the system. + Type `str`. """ + + self.version = None + """ Version of software running. + Type `str`. """ + + super(MessageHeaderSource, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MessageHeaderSource, self).elementProperties() + js.extend([ + ("contact", "contact", contactpoint.ContactPoint, False, None, False), + ("endpoint", "endpoint", str, False, None, True), + ("name", "name", str, False, None, False), + ("software", "software", str, False, 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 coding +except ImportError: + coding = sys.modules[__package__ + '.coding'] +try: + from . import contactpoint +except ImportError: + contactpoint = sys.modules[__package__ + '.contactpoint'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] diff --git a/fhirclient/models/R4/messageheader_tests.py b/fhirclient/models/R4/messageheader_tests.py new file mode 100644 index 000000000..4e2237de6 --- /dev/null +++ b/fhirclient/models/R4/messageheader_tests.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import messageheader +from .fhirdate import FHIRDate + + +class MessageHeaderTests(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("MessageHeader", js["resourceType"]) + return messageheader.MessageHeader(js) + + def testMessageHeader1(self): + inst = self.instantiate_from("messageheader-example.json") + self.assertIsNotNone(inst, "Must have instantiated a MessageHeader instance") + self.implMessageHeader1(inst) + + js = inst.as_json() + self.assertEqual("MessageHeader", js["resourceType"]) + inst2 = messageheader.MessageHeader(js) + 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.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://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") + self.assertEqual(inst.source.contact.value, "+1 (555) 123 4567") + self.assertEqual(inst.source.endpoint, "llp:10.11.12.13:5432") + self.assertEqual(inst.source.name, "Acme Central Patient Registry") + self.assertEqual(inst.source.software, "FooBar Patient Manager") + self.assertEqual(inst.source.version, "3.1.45.AABB") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/R4/meta.py b/fhirclient/models/R4/meta.py new file mode 100644 index 000000000..ef74d5b35 --- /dev/null +++ b/fhirclient/models/R4/meta.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Meta) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +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 might not always + be associated with version changes to the resource. + """ + + resource_type = "Meta" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.lastUpdated = None + """ When the resource version last changed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.profile = None + """ Profiles this resource claims to conform to. + List of `str` items. """ + + self.security = None + """ 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). """ + + self.versionId = None + """ Version specific identifier. + Type `str`. """ + + super(Meta, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Meta, self).elementProperties() + js.extend([ + ("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), + ]) + return js + + +import sys +try: + from . import coding +except ImportError: + coding = sys.modules[__package__ + '.coding'] +try: + from . import fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] diff --git a/fhirclient/models/R4/metadataresource.py b/fhirclient/models/R4/metadataresource.py new file mode 100644 index 000000000..b83b98c62 --- /dev/null +++ b/fhirclient/models/R4/metadataresource.py @@ -0,0 +1,113 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MetadataResource) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class MetadataResource(domainresource.DomainResource): + """ Common Ancestor declaration for definitional resources. + + Common Ancestor declaration for conformance and knowledge artifact + resources. + """ + + resource_type = "MetadataResource" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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.date = None + """ Date last changed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Natural language description of the metadata resource. + Type `str`. """ + + self.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.jurisdiction = None + """ Intended jurisdiction for metadata resource (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.name = None + """ Name for this metadata resource (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.title = None + """ Name for this metadata resource (human friendly). + Type `str`. """ + + self.url = None + """ Canonical identifier for this metadata resource, 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 metadata resource. + Type `str`. """ + + super(MetadataResource, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MetadataResource, self).elementProperties() + js.extend([ + ("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), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("name", "name", str, False, None, False), + ("publisher", "publisher", str, False, None, False), + ("status", "status", str, False, None, True), + ("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 + + +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/molecularsequence.py b/fhirclient/models/R4/molecularsequence.py similarity index 99% rename from fhirclient/models/molecularsequence.py rename to fhirclient/models/R4/molecularsequence.py index f881a1d06..a0bb8bdcd 100644 --- a/fhirclient/models/molecularsequence.py +++ b/fhirclient/models/R4/molecularsequence.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MolecularSequence) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MolecularSequence) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/molecularsequence_tests.py b/fhirclient/models/R4/molecularsequence_tests.py similarity index 99% rename from fhirclient/models/molecularsequence_tests.py rename to fhirclient/models/R4/molecularsequence_tests.py index 49da9068b..7a8488e25 100644 --- a/fhirclient/models/molecularsequence_tests.py +++ b/fhirclient/models/R4/molecularsequence_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/R4/money.py b/fhirclient/models/R4/money.py new file mode 100644 index 000000000..8addde860 --- /dev/null +++ b/fhirclient/models/R4/money.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Money) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Money(element.Element): + """ An amount of economic utility in some recognized currency. + """ + + resource_type = "Money" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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/R4/namingsystem.py b/fhirclient/models/R4/namingsystem.py new file mode 100644 index 000000000..fdf72745c --- /dev/null +++ b/fhirclient/models/R4/namingsystem.py @@ -0,0 +1,175 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/NamingSystem) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class NamingSystem(domainresource.DomainResource): + """ System of unique identification. + + A curated namespace that issues unique symbols within that namespace for + the identification of concepts, people, devices, etc. Represents a + "System" used within the Identifier and Coding data types. + """ + + resource_type = "NamingSystem" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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.date = None + """ Date last changed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Natural language description of the naming system. + Type `str`. """ + + self.jurisdiction = None + """ Intended jurisdiction for naming system (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.kind = None + """ codesystem | identifier | root. + Type `str`. """ + + self.name = None + """ Name for this naming system (computer friendly). + Type `str`. """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.responsible = None + """ Who maintains system namespace?. + Type `str`. """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.type = None + """ e.g. driver, provider, patient, bank etc.. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.uniqueId = None + """ Unique identifiers used for system. + List of `NamingSystemUniqueId` items (represented as `dict` in JSON). """ + + self.usage = None + """ How/where is it used. + Type `str`. """ + + self.useContext = None + """ 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) + + def elementProperties(self): + js = super(NamingSystem, self).elementProperties() + js.extend([ + ("contact", "contact", contactdetail.ContactDetail, True, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, True), + ("description", "description", str, False, None, False), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("kind", "kind", str, False, None, True), + ("name", "name", str, False, None, True), + ("publisher", "publisher", str, False, None, False), + ("responsible", "responsible", str, False, None, False), + ("status", "status", str, False, None, True), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("uniqueId", "uniqueId", NamingSystemUniqueId, True, None, True), + ("usage", "usage", str, False, None, False), + ("useContext", "useContext", usagecontext.UsageContext, True, None, False), + ]) + return js + + +from . import backboneelement + +class NamingSystemUniqueId(backboneelement.BackboneElement): + """ Unique identifiers used for system. + + Indicates how the system may be identified when referenced in electronic + exchange. + """ + + resource_type = "NamingSystemUniqueId" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Notes about identifier usage. + Type `str`. """ + + self.period = None + """ When is identifier valid?. + Type `Period` (represented as `dict` in JSON). """ + + self.preferred = None + """ Is this the id that should be used for this type. + Type `bool`. """ + + self.type = None + """ oid | uuid | uri | other. + Type `str`. """ + + self.value = None + """ The unique identifier. + Type `str`. """ + + super(NamingSystemUniqueId, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(NamingSystemUniqueId, self).elementProperties() + js.extend([ + ("comment", "comment", str, False, None, False), + ("period", "period", period.Period, False, None, False), + ("preferred", "preferred", bool, False, None, False), + ("type", "type", str, False, None, True), + ("value", "value", 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 period +except ImportError: + period = sys.modules[__package__ + '.period'] +try: + from . import usagecontext +except ImportError: + usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/R4/namingsystem_tests.py b/fhirclient/models/R4/namingsystem_tests.py new file mode 100644 index 000000000..1b35660cb --- /dev/null +++ b/fhirclient/models/R4/namingsystem_tests.py @@ -0,0 +1,98 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import namingsystem +from .fhirdate import FHIRDate + + +class NamingSystemTests(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("NamingSystem", js["resourceType"]) + return namingsystem.NamingSystem(js) + + def testNamingSystem1(self): + inst = self.instantiate_from("namingsystem-example-id.json") + self.assertIsNotNone(inst, "Must have instantiated a NamingSystem instance") + self.implNamingSystem1(inst) + + js = inst.as_json() + self.assertEqual("NamingSystem", js["resourceType"]) + inst2 = namingsystem.NamingSystem(js) + self.implNamingSystem1(inst2) + + def implNamingSystem1(self, inst): + self.assertEqual(inst.contact[0].name, "HL7 Australia FHIR Team") + self.assertEqual(inst.contact[0].telecom[0].system, "url") + 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.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") + self.assertEqual(inst.status, "active") + 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://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") + self.assertEqual(inst.uniqueId[0].value, "1.2.36.1.2001.1003.0") + self.assertEqual(inst.uniqueId[1].period.start.date, FHIRDate("2015-08-21").date) + self.assertEqual(inst.uniqueId[1].period.start.as_json(), "2015-08-21") + self.assertTrue(inst.uniqueId[1].preferred) + self.assertEqual(inst.uniqueId[1].type, "uri") + self.assertEqual(inst.uniqueId[1].value, "http://ns.electronichealth.net.au/id/hi/ihi/1.0") + self.assertEqual(inst.usage, "Used in Australia for identifying patients") + + def testNamingSystem2(self): + inst = self.instantiate_from("namingsystem-example.json") + self.assertIsNotNone(inst, "Must have instantiated a NamingSystem instance") + self.implNamingSystem2(inst) + + js = inst.as_json() + self.assertEqual("NamingSystem", js["resourceType"]) + inst2 = namingsystem.NamingSystem(js) + self.implNamingSystem2(inst2) + + def implNamingSystem2(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("2014-12-13").date) + 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") + self.assertEqual(inst.status, "active") + 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") + self.assertTrue(inst.uniqueId[1].preferred) + self.assertEqual(inst.uniqueId[1].type, "uri") + self.assertEqual(inst.uniqueId[1].value, "http://snomed.info/sct") + diff --git a/fhirclient/models/R4/narrative.py b/fhirclient/models/R4/narrative.py new file mode 100644 index 000000000..3e282e7c4 --- /dev/null +++ b/fhirclient/models/R4/narrative.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Narrative) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Narrative(element.Element): + """ 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.div = None + """ Limited xhtml content. + Type `str`. """ + + self.status = None + """ generated | extensions | additional | empty. + Type `str`. """ + + super(Narrative, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Narrative, self).elementProperties() + js.extend([ + ("div", "div", str, False, None, True), + ("status", "status", str, False, None, True), + ]) + return js + + diff --git a/fhirclient/models/R4/nutritionorder.py b/fhirclient/models/R4/nutritionorder.py new file mode 100644 index 000000000..5b95cbde4 --- /dev/null +++ b/fhirclient/models/R4/nutritionorder.py @@ -0,0 +1,458 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/NutritionOrder) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class NutritionOrder(domainresource.DomainResource): + """ Diet, formula or nutritional supplement request. + + A request to supply a diet, formula feeding (enteral) or oral nutritional + supplement to a patient/resident. + """ + + resource_type = "NutritionOrder" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.allergyIntolerance = None + """ List of the patient's food and nutrition-related allergies and + intolerances. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.dateTime = None + """ Date and time the nutrition order was requested. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.encounter = None + """ The encounter associated with this nutrition order. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.enteralFormula = None + """ Enteral formula components. + Type `NutritionOrderEnteralFormula` (represented as `dict` in JSON). """ + + self.excludeFoodModifier = None + """ Order-specific modifier about the type of food that should not be + given. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.foodPreferenceModifier = None + """ Order-specific modifier about the type of food that should be given. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.identifier = None + """ 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` (represented as `dict` in JSON). """ + + self.patient = None + """ The person who requires the diet, formula or nutritional supplement. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.status = None + """ proposed | draft | planned | requested | active | on-hold | + completed | cancelled | entered-in-error. + Type `str`. """ + + self.supplement = None + """ Supplement components. + List of `NutritionOrderSupplement` items (represented as `dict` in JSON). """ + + super(NutritionOrder, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(NutritionOrder, self).elementProperties() + js.extend([ + ("allergyIntolerance", "allergyIntolerance", fhirreference.FHIRReference, True, None, False), + ("dateTime", "dateTime", fhirdate.FHIRDate, False, None, True), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), + ("enteralFormula", "enteralFormula", NutritionOrderEnteralFormula, False, None, False), + ("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, True), + ("supplement", "supplement", NutritionOrderSupplement, True, None, False), + ]) + return js + + +from . import backboneelement + +class NutritionOrderEnteralFormula(backboneelement.BackboneElement): + """ Enteral formula components. + + Feeding provided through the gastrointestinal tract via a tube, catheter, + or stoma that delivers nutrition distal to the oral cavity. + """ + + resource_type = "NutritionOrderEnteralFormula" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.additiveProductName = None + """ Product or brand name of the modular additive. + Type `str`. """ + + self.additiveType = None + """ Type of modular component to add to the feeding. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.administration = None + """ Formula feeding instruction as structured data. + List of `NutritionOrderEnteralFormulaAdministration` items (represented as `dict` in JSON). """ + + self.administrationInstruction = None + """ Formula feeding instructions expressed as text. + Type `str`. """ + + self.baseFormulaProductName = None + """ Product or brand name of the enteral or infant formula. + Type `str`. """ + + self.baseFormulaType = None + """ Type of enteral or infant formula. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.caloricDensity = None + """ Amount of energy per specified volume that is required. + Type `Quantity` (represented as `dict` in JSON). """ + + self.maxVolumeToDeliver = None + """ Upper limit on formula volume per unit of time. + Type `Quantity` (represented as `dict` in JSON). """ + + self.routeofAdministration = None + """ How the formula should enter the patient's gastrointestinal tract. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(NutritionOrderEnteralFormula, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(NutritionOrderEnteralFormula, self).elementProperties() + js.extend([ + ("additiveProductName", "additiveProductName", str, False, None, False), + ("additiveType", "additiveType", codeableconcept.CodeableConcept, False, None, False), + ("administration", "administration", NutritionOrderEnteralFormulaAdministration, True, None, False), + ("administrationInstruction", "administrationInstruction", str, False, None, False), + ("baseFormulaProductName", "baseFormulaProductName", str, False, None, False), + ("baseFormulaType", "baseFormulaType", codeableconcept.CodeableConcept, False, None, False), + ("caloricDensity", "caloricDensity", quantity.Quantity, False, None, False), + ("maxVolumeToDeliver", "maxVolumeToDeliver", quantity.Quantity, False, None, False), + ("routeofAdministration", "routeofAdministration", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class NutritionOrderEnteralFormulaAdministration(backboneelement.BackboneElement): + """ Formula feeding instruction as structured data. + + Formula administration instructions as structured data. This repeating + structure allows for changing the administration rate or volume over time + for both bolus and continuous feeding. An example of this would be an + instruction to increase the rate of continuous feeding every 2 hours. + """ + + resource_type = "NutritionOrderEnteralFormulaAdministration" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 volume of formula to provide. + Type `Quantity` (represented as `dict` in JSON). """ + + self.rateQuantity = None + """ Speed with which the formula is provided per period of time. + Type `Quantity` (represented as `dict` in JSON). """ + + self.rateRatio = None + """ Speed with which the formula is provided per period of time. + Type `Ratio` (represented as `dict` in JSON). """ + + self.schedule = None + """ Scheduled frequency of enteral feeding. + Type `Timing` (represented as `dict` in JSON). """ + + super(NutritionOrderEnteralFormulaAdministration, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(NutritionOrderEnteralFormulaAdministration, self).elementProperties() + js.extend([ + ("quantity", "quantity", quantity.Quantity, False, None, False), + ("rateQuantity", "rateQuantity", quantity.Quantity, False, "rate", False), + ("rateRatio", "rateRatio", ratio.Ratio, False, "rate", False), + ("schedule", "schedule", timing.Timing, False, None, False), + ]) + return js + + +class NutritionOrderOralDiet(backboneelement.BackboneElement): + """ Oral diet components. + + Diet given orally in contrast to enteral (tube) feeding. + """ + + resource_type = "NutritionOrderOralDiet" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.fluidConsistencyType = None + """ The required consistency of fluids and liquids provided to the + patient. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.instruction = None + """ Instructions or additional information about the oral diet. + Type `str`. """ + + self.nutrient = None + """ Required nutrient modifications. + List of `NutritionOrderOralDietNutrient` items (represented as `dict` in JSON). """ + + self.schedule = None + """ Scheduled frequency of diet. + List of `Timing` items (represented as `dict` in JSON). """ + + self.texture = None + """ Required texture modifications. + List of `NutritionOrderOralDietTexture` items (represented as `dict` in JSON). """ + + self.type = None + """ Type of oral diet or diet restrictions that describe what can be + consumed orally. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(NutritionOrderOralDiet, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(NutritionOrderOralDiet, self).elementProperties() + js.extend([ + ("fluidConsistencyType", "fluidConsistencyType", codeableconcept.CodeableConcept, True, None, False), + ("instruction", "instruction", str, False, None, False), + ("nutrient", "nutrient", NutritionOrderOralDietNutrient, True, None, False), + ("schedule", "schedule", timing.Timing, True, None, False), + ("texture", "texture", NutritionOrderOralDietTexture, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +class NutritionOrderOralDietNutrient(backboneelement.BackboneElement): + """ Required nutrient modifications. + + Class that defines the quantity and type of nutrient modifications (for + example carbohydrate, fiber or sodium) required for the oral diet. + """ + + resource_type = "NutritionOrderOralDietNutrient" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 the specified nutrient. + Type `Quantity` (represented as `dict` in JSON). """ + + self.modifier = None + """ Type of nutrient that is being modified. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(NutritionOrderOralDietNutrient, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(NutritionOrderOralDietNutrient, self).elementProperties() + js.extend([ + ("amount", "amount", quantity.Quantity, False, None, False), + ("modifier", "modifier", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class NutritionOrderOralDietTexture(backboneelement.BackboneElement): + """ Required texture modifications. + + Class that describes any texture modifications required for the patient to + safely consume various types of solid foods. + """ + + resource_type = "NutritionOrderOralDietTexture" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.foodType = None + """ Concepts that are used to identify an entity that is ingested for + nutritional purposes. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.modifier = None + """ Code to indicate how to alter the texture of the foods, e.g. pureed. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(NutritionOrderOralDietTexture, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(NutritionOrderOralDietTexture, self).elementProperties() + js.extend([ + ("foodType", "foodType", codeableconcept.CodeableConcept, False, None, False), + ("modifier", "modifier", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class NutritionOrderSupplement(backboneelement.BackboneElement): + """ Supplement components. + + Oral nutritional products given in order to add further nutritional value + to the patient's diet. + """ + + resource_type = "NutritionOrderSupplement" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Instructions or additional information about the oral supplement. + Type `str`. """ + + self.productName = None + """ Product or brand name of the nutritional supplement. + Type `str`. """ + + self.quantity = None + """ Amount of the nutritional supplement. + Type `Quantity` (represented as `dict` in JSON). """ + + self.schedule = None + """ Scheduled frequency of supplement. + List of `Timing` items (represented as `dict` in JSON). """ + + self.type = None + """ Type of supplement product requested. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(NutritionOrderSupplement, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(NutritionOrderSupplement, self).elementProperties() + js.extend([ + ("instruction", "instruction", str, False, None, False), + ("productName", "productName", str, False, None, False), + ("quantity", "quantity", quantity.Quantity, False, None, False), + ("schedule", "schedule", timing.Timing, True, None, False), + ("type", "type", 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 quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] +try: + from . import ratio +except ImportError: + ratio = sys.modules[__package__ + '.ratio'] +try: + from . import timing +except ImportError: + timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/R4/nutritionorder_tests.py b/fhirclient/models/R4/nutritionorder_tests.py new file mode 100644 index 000000000..8d72e36f6 --- /dev/null +++ b/fhirclient/models/R4/nutritionorder_tests.py @@ -0,0 +1,543 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import nutritionorder +from .fhirdate import FHIRDate + + +class NutritionOrderTests(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("NutritionOrder", js["resourceType"]) + return nutritionorder.NutritionOrder(js) + + def testNutritionOrder1(self): + inst = self.instantiate_from("nutritionorder-example-diabeticsupplement.json") + self.assertIsNotNone(inst, "Must have instantiated a NutritionOrder instance") + self.implNutritionOrder1(inst) + + js = inst.as_json() + self.assertEqual("NutritionOrder", js["resourceType"]) + inst2 = nutritionorder.NutritionOrder(js) + 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, "kosher") + 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") + self.assertEqual(inst.supplement[0].quantity.value, 1) + self.assertEqual(inst.supplement[0].schedule[0].repeat.boundsPeriod.start.date, FHIRDate("2015-02-10T15:00:00Z").date) + self.assertEqual(inst.supplement[0].schedule[0].repeat.boundsPeriod.start.as_json(), "2015-02-10T15:00:00Z") + self.assertEqual(inst.supplement[0].schedule[0].repeat.frequency, 1) + self.assertEqual(inst.supplement[0].schedule[0].repeat.period, 24) + self.assertEqual(inst.supplement[0].schedule[0].repeat.periodUnit, "h") + self.assertEqual(inst.supplement[0].schedule[1].repeat.duration, 1) + self.assertEqual(inst.supplement[0].schedule[1].repeat.durationUnit, "h") + self.assertEqual(inst.supplement[0].schedule[1].repeat.when[0], "HS") + self.assertEqual(inst.supplement[0].type.coding[0].code, "443051000124104") + self.assertEqual(inst.supplement[0].type.coding[0].display, "Adult diabetes specialty 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 diabetic formula") + self.assertEqual(inst.supplement[0].type.coding[1].system, "http://goodhealthhospital.org/supplement-type-codes") + self.assertEqual(inst.supplement[0].type.text, "Adult diabetic formula") + self.assertEqual(inst.text.status, "generated") + + def testNutritionOrder2(self): + inst = self.instantiate_from("nutritionorder-example-enteralbolus.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.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://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") + self.assertEqual(inst.enteralFormula.administration[0].quantity.unit, "milliliters") + self.assertEqual(inst.enteralFormula.administration[0].quantity.value, 240) + self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.boundsPeriod.start.date, FHIRDate("2014-09-17T16:00:00Z").date) + self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.boundsPeriod.start.as_json(), "2014-09-17T16:00:00Z") + self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.frequency, 1) + 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, "442991000124104") + self.assertEqual(inst.enteralFormula.baseFormulaType.coding[0].display, "Adult high protein 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.5) + 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, 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://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://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 testNutritionOrder3(self): + inst = self.instantiate_from("nutritionorder-example-fiberrestricteddiet.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") + 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, "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") + self.assertEqual(inst.oralDiet.nutrient[0].amount.value, 50) + self.assertEqual(inst.oralDiet.nutrient[0].modifier.coding[0].code, "256674009") + self.assertEqual(inst.oralDiet.nutrient[0].modifier.coding[0].display, "Fat") + 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, "15108003") + self.assertEqual(inst.oralDiet.type[0].coding[0].display, "Restricted fiber diet") + self.assertEqual(inst.oralDiet.type[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.oralDiet.type[0].coding[1].code, "1000") + self.assertEqual(inst.oralDiet.type[0].coding[1].display, "Fiber restricted") + self.assertEqual(inst.oralDiet.type[0].coding[1].system, "http://goodhealthhospital.org/diet-type-codes") + self.assertEqual(inst.oralDiet.type[0].text, "Fiber restricted diet") + self.assertEqual(inst.oralDiet.type[1].coding[0].code, "16208003") + self.assertEqual(inst.oralDiet.type[1].coding[0].display, "Low fat diet") + self.assertEqual(inst.oralDiet.type[1].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.oralDiet.type[1].coding[1].code, "1100") + self.assertEqual(inst.oralDiet.type[1].coding[1].display, "Low Fat") + self.assertEqual(inst.oralDiet.type[1].coding[1].system, "http://goodhealthhospital.org/diet-type-codes") + self.assertEqual(inst.oralDiet.type[1].text, "Low fat diet") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + + 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.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.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://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") + self.assertEqual(inst.enteralFormula.administration[0].quantity.unit, "ounces") + self.assertEqual(inst.enteralFormula.administration[0].quantity.value, 4) + self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.boundsPeriod.start.date, FHIRDate("2014-09-17").date) + self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.boundsPeriod.start.as_json(), "2014-09-17") + self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.frequency, 1) + self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.period, 3) + self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.periodUnit, "h") + self.assertEqual(inst.enteralFormula.baseFormulaProductName, "Acme Infant Formula + Iron") + self.assertEqual(inst.enteralFormula.baseFormulaType.coding[0].code, "412414007") + self.assertEqual(inst.enteralFormula.baseFormulaType.coding[0].display, "infant formula + iron") + self.assertEqual(inst.enteralFormula.baseFormulaType.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.enteralFormula.caloricDensity.code, "cal/[foz_us]") + self.assertEqual(inst.enteralFormula.caloricDensity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.enteralFormula.caloricDensity.unit, "calories per ounce") + self.assertEqual(inst.enteralFormula.caloricDensity.value, 20) + self.assertEqual(inst.enteralFormula.maxVolumeToDeliver.code, "[foz_us]") + self.assertEqual(inst.enteralFormula.maxVolumeToDeliver.system, "http://unitsofmeasure.org") + self.assertEqual(inst.enteralFormula.maxVolumeToDeliver.unit, "ounces") + 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://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 testNutritionOrder7(self): + inst = self.instantiate_from("nutritionorder-example-enteralcontinuous.json") + self.assertIsNotNone(inst, "Must have instantiated a NutritionOrder instance") + self.implNutritionOrder7(inst) + + js = inst.as_json() + self.assertEqual("NutritionOrder", js["resourceType"]) + inst2 = nutritionorder.NutritionOrder(js) + self.implNutritionOrder7(inst2) + + 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.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.text.status, "generated") + + def testNutritionOrder9(self): + inst = self.instantiate_from("nutritionorder-example-pureeddiet.json") + self.assertIsNotNone(inst, "Must have instantiated a NutritionOrder instance") + self.implNutritionOrder9(inst) + + js = inst.as_json() + self.assertEqual("NutritionOrder", js["resourceType"]) + inst2 = nutritionorder.NutritionOrder(js) + self.implNutritionOrder9(inst2) + + 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.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") + 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.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/R4/observation.py b/fhirclient/models/R4/observation.py new file mode 100644 index 000000000..5be83ac7e --- /dev/null +++ b/fhirclient/models/R4/observation.py @@ -0,0 +1,430 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Observation) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Observation(domainresource.DomainResource): + """ Measurements and simple assertions. + + Measurements and simple assertions made about a patient, device or other + subject. + """ + + resource_type = "Observation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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 + """ Observed body part. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.category = None + """ Classification of type 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.component = None + """ Component results. + List of `ObservationComponent` items (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` (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.. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.issued = None + """ 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 (represented as `dict` in JSON). """ + + self.referenceRange = None + """ Provides guide for interpretation. + List of `ObservationReferenceRange` items (represented as `dict` in JSON). """ + + self.specimen = None + """ Specimen used for this observation. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.status = None + """ registered | preliminary | final | amended +. + Type `str`. """ + + self.subject = None + """ Who and/or what the observation is about. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.valueBoolean = None + """ Actual result. + Type `bool`. """ + + self.valueCodeableConcept = None + """ Actual result. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueDateTime = None + """ 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). """ + + self.valueQuantity = None + """ Actual result. + Type `Quantity` (represented as `dict` in JSON). """ + + self.valueRange = None + """ Actual result. + Type `Range` (represented as `dict` in JSON). """ + + self.valueRatio = None + """ Actual result. + Type `Ratio` (represented as `dict` in JSON). """ + + self.valueSampledData = None + """ Actual result. + Type `SampledData` (represented as `dict` in JSON). """ + + self.valueString = None + """ Actual result. + Type `str`. """ + + self.valueTime = None + """ Actual result. + Type `FHIRDate` (represented as `str` in JSON). """ + + super(Observation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Observation, self).elementProperties() + js.extend([ + ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), + ("bodySite", "bodySite", codeableconcept.CodeableConcept, False, None, False), + ("category", "category", codeableconcept.CodeableConcept, True, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("component", "component", ObservationComponent, True, 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, 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), + ("specimen", "specimen", fhirreference.FHIRReference, False, None, False), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, 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), + ("valueRatio", "valueRatio", ratio.Ratio, False, "value", False), + ("valueSampledData", "valueSampledData", sampleddata.SampledData, False, "value", False), + ("valueString", "valueString", str, False, "value", False), + ("valueTime", "valueTime", fhirdate.FHIRDate, False, "value", False), + ]) + return js + + +from . import backboneelement + +class ObservationComponent(backboneelement.BackboneElement): + """ Component results. + + Some observations have multiple component observations. These component + observations are expressed as separate code value pairs that share the same + attributes. Examples include systolic and diastolic component observations + for blood pressure measurement and multiple component observations for + genetics observations. + """ + + resource_type = "ObservationComponent" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 component observation (code / type). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.dataAbsentReason = None + """ Why the component result is missing. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.interpretation = None + """ High, low, normal, etc.. + 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.valueBoolean = None + """ Actual component result. + Type `bool`. """ + + self.valueCodeableConcept = None + """ Actual component result. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueDateTime = None + """ 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). """ + + self.valueQuantity = None + """ Actual component result. + Type `Quantity` (represented as `dict` in JSON). """ + + self.valueRange = None + """ Actual component result. + Type `Range` (represented as `dict` in JSON). """ + + self.valueRatio = None + """ Actual component result. + Type `Ratio` (represented as `dict` in JSON). """ + + self.valueSampledData = None + """ Actual component result. + Type `SampledData` (represented as `dict` in JSON). """ + + self.valueString = None + """ Actual component result. + Type `str`. """ + + self.valueTime = None + """ Actual component result. + Type `FHIRDate` (represented as `str` in JSON). """ + + super(ObservationComponent, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ObservationComponent, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("dataAbsentReason", "dataAbsentReason", codeableconcept.CodeableConcept, False, None, False), + ("interpretation", "interpretation", codeableconcept.CodeableConcept, True, None, False), + ("referenceRange", "referenceRange", ObservationReferenceRange, True, None, 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), + ("valueRatio", "valueRatio", ratio.Ratio, False, "value", False), + ("valueSampledData", "valueSampledData", sampleddata.SampledData, False, "value", False), + ("valueString", "valueString", str, False, "value", False), + ("valueTime", "valueTime", fhirdate.FHIRDate, False, "value", False), + ]) + return js + + +class ObservationReferenceRange(backboneelement.BackboneElement): + """ Provides guide for interpretation. + + Guidance on how to interpret the value by comparison to a normal or + 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Reference range population. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.high = None + """ High Range, if relevant. + Type `Quantity` (represented as `dict` in JSON). """ + + self.low = None + """ Low Range, if relevant. + Type `Quantity` (represented as `dict` in JSON). """ + + self.text = None + """ Text based reference range in an observation. + Type `str`. """ + + self.type = None + """ Reference range qualifier. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ObservationReferenceRange, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ObservationReferenceRange, self).elementProperties() + js.extend([ + ("age", "age", range.Range, False, None, False), + ("appliesTo", "appliesTo", codeableconcept.CodeableConcept, True, None, False), + ("high", "high", quantity.Quantity, False, None, False), + ("low", "low", quantity.Quantity, False, None, False), + ("text", "text", str, False, None, False), + ("type", "type", 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 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 sampleddata +except ImportError: + sampleddata = sys.modules[__package__ + '.sampleddata'] +try: + from . import timing +except ImportError: + timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/R4/observation_tests.py b/fhirclient/models/R4/observation_tests.py new file mode 100644 index 000000000..5c1686e5a --- /dev/null +++ b/fhirclient/models/R4/observation_tests.py @@ -0,0 +1,339 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import observation +from .fhirdate import FHIRDate + + +class ObservationTests(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("Observation", js["resourceType"]) + return observation.Observation(js) + + def testObservation1(self): + inst = self.instantiate_from("observation-example-genetics-1.json") + self.assertIsNotNone(inst, "Must have instantiated a Observation instance") + self.implObservation1(inst) + + js = inst.as_json() + self.assertEqual("Observation", js["resourceType"]) + inst2 = observation.Observation(js) + self.implObservation1(inst2) + + def implObservation1(self, inst): + 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.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.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-bmd.json") + self.assertIsNotNone(inst, "Must have instantiated a Observation instance") + self.implObservation2(inst) + + js = inst.as_json() + self.assertEqual("Observation", js["resourceType"]) + inst2 = observation.Observation(js) + self.implObservation2(inst2) + + def implObservation2(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.code.coding[0].system, "http://loinc.org") + 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, "g/cm-2") + self.assertEqual(inst.valueQuantity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.valueQuantity.unit, "g/cm²") + self.assertEqual(inst.valueQuantity.value, 0.887) + + def testObservation3(self): + inst = self.instantiate_from("observation-example-respiratory-rate.json") + self.assertIsNotNone(inst, "Must have instantiated a Observation instance") + self.implObservation3(inst) + + js = inst.as_json() + self.assertEqual("Observation", js["resourceType"]) + inst2 = observation.Observation(js) + self.implObservation3(inst2) + + def implObservation3(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://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, "/min") + self.assertEqual(inst.valueQuantity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.valueQuantity.unit, "breaths/minute") + self.assertEqual(inst.valueQuantity.value, 26) + + def testObservation4(self): + inst = self.instantiate_from("observation-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Observation instance") + self.implObservation4(inst) + + js = inst.as_json() + self.assertEqual("Observation", js["resourceType"]) + inst2 = observation.Observation(js) + self.implObservation4(inst2) + + def implObservation4(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://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.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, "[lb_av]") + self.assertEqual(inst.valueQuantity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.valueQuantity.unit, "lbs") + self.assertEqual(inst.valueQuantity.value, 185) + + def testObservation5(self): + inst = self.instantiate_from("observation-example-haplotype2.json") + self.assertIsNotNone(inst, "Must have instantiated a Observation instance") + self.implObservation5(inst) + + js = inst.as_json() + self.assertEqual("Observation", js["resourceType"]) + inst2 = observation.Observation(js) + self.implObservation5(inst2) + + def implObservation5(self, inst): + 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.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.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-mbp.json") + self.assertIsNotNone(inst, "Must have instantiated a Observation instance") + self.implObservation6(inst) + + js = inst.as_json() + self.assertEqual("Observation", js["resourceType"]) + inst2 = observation.Observation(js) + self.implObservation6(inst2) + + def implObservation6(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://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, "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-genetics-brcapat.json") + self.assertIsNotNone(inst, "Must have instantiated a Observation instance") + self.implObservation7(inst) + + js = inst.as_json() + self.assertEqual("Observation", js["resourceType"]) + inst2 = observation.Observation(js) + self.implObservation7(inst2) + + def implObservation7(self, inst): + 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.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-bmi.json") + self.assertIsNotNone(inst, "Must have instantiated a Observation instance") + self.implObservation8(inst) + + js = inst.as_json() + self.assertEqual("Observation", js["resourceType"]) + inst2 = observation.Observation(js) + self.implObservation8(inst2) + + def implObservation8(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://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, "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-body-height.json") + self.assertIsNotNone(inst, "Must have instantiated a Observation instance") + self.implObservation9(inst) + + js = inst.as_json() + self.assertEqual("Observation", js["resourceType"]) + inst2 = observation.Observation(js) + self.implObservation9(inst2) + + def implObservation9(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://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, "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, "[in_i]") + self.assertEqual(inst.valueQuantity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.valueQuantity.unit, "in") + self.assertEqual(inst.valueQuantity.value, 66.89999999999999) + + def testObservation10(self): + inst = self.instantiate_from("observation-example-eye-color.json") + self.assertIsNotNone(inst, "Must have instantiated a Observation instance") + self.implObservation10(inst) + + js = inst.as_json() + self.assertEqual("Observation", js["resourceType"]) + inst2 = observation.Observation(js) + self.implObservation10(inst2) + + def implObservation10(self, inst): + 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.valueString, "blue") + diff --git a/fhirclient/models/observationdefinition.py b/fhirclient/models/R4/observationdefinition.py similarity index 99% rename from fhirclient/models/observationdefinition.py rename to fhirclient/models/R4/observationdefinition.py index 9f5d381c8..f6bb564cd 100644 --- a/fhirclient/models/observationdefinition.py +++ b/fhirclient/models/R4/observationdefinition.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ObservationDefinition) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ObservationDefinition) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/observationdefinition_tests.py b/fhirclient/models/R4/observationdefinition_tests.py similarity index 94% rename from fhirclient/models/observationdefinition_tests.py rename to fhirclient/models/R4/observationdefinition_tests.py index df5b4f66b..2e3a5644c 100644 --- a/fhirclient/models/observationdefinition_tests.py +++ b/fhirclient/models/R4/observationdefinition_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/R4/operationdefinition.py b/fhirclient/models/R4/operationdefinition.py new file mode 100644 index 000000000..68a1ba7ab --- /dev/null +++ b/fhirclient/models/R4/operationdefinition.py @@ -0,0 +1,375 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/OperationDefinition) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class OperationDefinition(domainresource.DomainResource): + """ Definition of an operation or a named query. + + A formal computable definition of an operation (on the RESTful interface) + or a named query (using the search interaction). + """ + + resource_type = "OperationDefinition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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 `str`. """ + + self.code = None + """ Name used to invoke the operation. + Type `str`. """ + + self.comment = None + """ Additional information about use. + Type `str`. """ + + self.contact = None + """ Contact details for the publisher. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.date = None + """ Date last changed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Natural language description of the operation definition. + Type `str`. """ + + self.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.inputProfile = None + """ Validation information for in parameters. + Type `str`. """ + + self.instance = None + """ Invoke on an instance?. + Type `bool`. """ + + self.jurisdiction = None + """ Intended jurisdiction for operation definition (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.kind = None + """ operation | query. + Type `str`. """ + + self.name = None + """ 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). """ + + self.parameter = None + """ Parameters for the operation/query. + List of `OperationDefinitionParameter` items (represented as `dict` in JSON). """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this operation definition is defined. + Type `str`. """ + + self.resource = None + """ Types this operation applies to. + List of `str` items. """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.system = None + """ Invoke at the system level?. + Type `bool`. """ + + self.title = None + """ Name for this operation definition (human friendly). + Type `str`. """ + + self.type = None + """ Invoke at the type level?. + Type `bool`. """ + + self.url = None + """ Canonical identifier for this operation 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 operation definition. + Type `str`. """ + + super(OperationDefinition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(OperationDefinition, self).elementProperties() + js.extend([ + ("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), + ("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), + ("purpose", "purpose", str, False, None, False), + ("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), + ("version", "version", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class OperationDefinitionOverload(backboneelement.BackboneElement): + """ Define overloaded variants for when generating code. + + Defines an appropriate combination of parameters to use when invoking this + operation, to help code generators when generating overloaded parameter + sets for this operation. + """ + + resource_type = "OperationDefinitionOverload" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Comments to go on overload. + Type `str`. """ + + self.parameterName = None + """ Name of parameter to include in overload. + List of `str` items. """ + + super(OperationDefinitionOverload, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(OperationDefinitionOverload, self).elementProperties() + js.extend([ + ("comment", "comment", str, False, None, False), + ("parameterName", "parameterName", str, True, None, False), + ]) + return js + + +class OperationDefinitionParameter(backboneelement.BackboneElement): + """ Parameters for the operation/query. + + The parameters for the operation/query. + """ + + resource_type = "OperationDefinitionParameter" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.binding = None + """ ValueSet details if this is coded. + Type `OperationDefinitionParameterBinding` (represented as `dict` in JSON). """ + + self.documentation = None + """ Description of meaning/use. + Type `str`. """ + + self.max = None + """ Maximum Cardinality (a number or *). + Type `str`. """ + + self.min = None + """ Minimum Cardinality. + Type `int`. """ + + self.name = None + """ Name in Parameters.parameter.name or in URL. + Type `str`. """ + + self.part = None + """ Parts of a nested Parameter. + List of `OperationDefinitionParameter` items (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 | 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`. """ + + self.use = None + """ in | out. + Type `str`. """ + + super(OperationDefinitionParameter, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(OperationDefinitionParameter, self).elementProperties() + js.extend([ + ("binding", "binding", OperationDefinitionParameterBinding, False, None, False), + ("documentation", "documentation", str, False, None, False), + ("max", "max", str, False, None, True), + ("min", "min", int, False, None, True), + ("name", "name", str, False, None, True), + ("part", "part", OperationDefinitionParameter, True, 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), + ]) + return js + + +class OperationDefinitionParameterBinding(backboneelement.BackboneElement): + """ ValueSet details if this is coded. + + Binds to a value set if this parameter is coded (code, Coding, + CodeableConcept). + """ + + resource_type = "OperationDefinitionParameterBinding" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.strength = None + """ required | extensible | preferred | example. + Type `str`. """ + + self.valueSet = None + """ Source of value set. + Type `str`. """ + + super(OperationDefinitionParameterBinding, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(OperationDefinitionParameterBinding, self).elementProperties() + js.extend([ + ("strength", "strength", str, False, None, 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 + + +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/R4/operationdefinition_tests.py b/fhirclient/models/R4/operationdefinition_tests.py new file mode 100644 index 000000000..0c6008af3 --- /dev/null +++ b/fhirclient/models/R4/operationdefinition_tests.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import operationdefinition +from .fhirdate import FHIRDate + + +class OperationDefinitionTests(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("OperationDefinition", js["resourceType"]) + return operationdefinition.OperationDefinition(js) + + def testOperationDefinition1(self): + inst = self.instantiate_from("operationdefinition-example.json") + self.assertIsNotNone(inst, "Must have instantiated a OperationDefinition instance") + self.implOperationDefinition1(inst) + + js = inst.as_json() + self.assertEqual("OperationDefinition", js["resourceType"]) + inst2 = operationdefinition.OperationDefinition(js) + 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") + self.assertEqual(inst.contact[0].telecom[0].system, "email") + 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 implementation") + self.assertEqual(inst.id, "example") + self.assertTrue(inst.instance) + self.assertEqual(inst.jurisdiction[0].coding[0].code, "GB") + self.assertEqual(inst.jurisdiction[0].coding[0].display, "United Kingdom of Great Britain and Northern Ireland (the)") + self.assertEqual(inst.jurisdiction[0].coding[0].system, "urn:iso:std:iso:3166") + self.assertEqual(inst.kind, "operation") + self.assertEqual(inst.name, "Populate Questionnaire") + self.assertEqual(inst.overload[0].parameterName[0], "subject") + self.assertEqual(inst.overload[0].parameterName[1], "local") + self.assertEqual(inst.overload[1].comment, "local defaults to false when not passed as a parameter") + self.assertEqual(inst.overload[1].parameterName[0], "subject") + self.assertEqual(inst.parameter[0].max, "1") + self.assertEqual(inst.parameter[0].min, 1) + self.assertEqual(inst.parameter[0].name, "subject") + self.assertEqual(inst.parameter[0].type, "Reference") + self.assertEqual(inst.parameter[0].use, "in") + self.assertEqual(inst.parameter[1].documentation, "If the *local* parameter is set to true, server information about the specified subject will be used to populate the instance.") + self.assertEqual(inst.parameter[1].max, "1") + self.assertEqual(inst.parameter[1].min, 0) + self.assertEqual(inst.parameter[1].name, "local") + self.assertEqual(inst.parameter[1].type, "Reference") + self.assertEqual(inst.parameter[1].use, "in") + self.assertEqual(inst.parameter[2].documentation, "The partially (or fully)-populated set of answers for the specified Questionnaire") + self.assertEqual(inst.parameter[2].max, "1") + self.assertEqual(inst.parameter[2].min, 1) + self.assertEqual(inst.parameter[2].name, "return") + self.assertEqual(inst.parameter[2].type, "QuestionnaireResponse") + self.assertEqual(inst.parameter[2].use, "out") + self.assertEqual(inst.publisher, "Acme Healthcare Services") + self.assertEqual(inst.resource[0], "Questionnaire") + self.assertEqual(inst.status, "draft") + self.assertFalse(inst.system) + self.assertEqual(inst.text.status, "generated") + self.assertFalse(inst.type) + self.assertEqual(inst.url, "http://h7.org/fhir/OperationDefinition/example") + self.assertEqual(inst.useContext[0].code.code, "venue") + self.assertEqual(inst.useContext[0].code.display, "Clinical Venue") + 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://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.version, "B") + diff --git a/fhirclient/models/R4/operationoutcome.py b/fhirclient/models/R4/operationoutcome.py new file mode 100644 index 000000000..8aeb25980 --- /dev/null +++ b/fhirclient/models/R4/operationoutcome.py @@ -0,0 +1,103 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/OperationOutcome) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class OperationOutcome(domainresource.DomainResource): + """ Information about the success/failure of an action. + + A collection of error, warning, or information messages that result from a + system action. + """ + + resource_type = "OperationOutcome" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.issue = None + """ A single issue associated with the action. + List of `OperationOutcomeIssue` items (represented as `dict` in JSON). """ + + super(OperationOutcome, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(OperationOutcome, self).elementProperties() + js.extend([ + ("issue", "issue", OperationOutcomeIssue, True, None, True), + ]) + return js + + +from . import backboneelement + +class OperationOutcomeIssue(backboneelement.BackboneElement): + """ A single issue associated with the action. + + An error, warning, or information message that results from a system + action. + """ + + resource_type = "OperationOutcomeIssue" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Error or warning code. + Type `str`. """ + + self.details = None + """ Additional details about the error. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.diagnostics = None + """ Additional diagnostic information about the issue. + Type `str`. """ + + self.expression = None + """ FHIRPath of element(s) related to issue. + List of `str` items. """ + + self.location = None + """ Deprecated: Path of element(s) related to issue. + List of `str` items. """ + + self.severity = None + """ fatal | error | warning | information. + Type `str`. """ + + super(OperationOutcomeIssue, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(OperationOutcomeIssue, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("details", "details", codeableconcept.CodeableConcept, False, None, False), + ("diagnostics", "diagnostics", str, False, None, False), + ("expression", "expression", str, True, None, False), + ("location", "location", str, True, None, False), + ("severity", "severity", str, False, None, True), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] diff --git a/fhirclient/models/R4/operationoutcome_tests.py b/fhirclient/models/R4/operationoutcome_tests.py new file mode 100644 index 000000000..f78f852fd --- /dev/null +++ b/fhirclient/models/R4/operationoutcome_tests.py @@ -0,0 +1,152 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import operationoutcome +from .fhirdate import FHIRDate + + +class OperationOutcomeTests(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("OperationOutcome", js["resourceType"]) + return operationoutcome.OperationOutcome(js) + + def testOperationOutcome1(self): + inst = self.instantiate_from("operationoutcome-example-validationfail.json") + self.assertIsNotNone(inst, "Must have instantiated a OperationOutcome instance") + self.implOperationOutcome1(inst) + + js = inst.as_json() + self.assertEqual("OperationOutcome", js["resourceType"]) + inst2 = operationoutcome.OperationOutcome(js) + self.implOperationOutcome1(inst2) + + def implOperationOutcome1(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.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") + self.assertIsNotNone(inst, "Must have instantiated a OperationOutcome instance") + self.implOperationOutcome2(inst) + + js = inst.as_json() + self.assertEqual("OperationOutcome", js["resourceType"]) + inst2 = operationoutcome.OperationOutcome(js) + self.implOperationOutcome2(inst2) + + def implOperationOutcome2(self, inst): + self.assertEqual(inst.id, "break-the-glass") + 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://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-searchfail.json") + self.assertIsNotNone(inst, "Must have instantiated a OperationOutcome instance") + self.implOperationOutcome3(inst) + + js = inst.as_json() + self.assertEqual("OperationOutcome", js["resourceType"]) + inst2 = operationoutcome.OperationOutcome(js) + self.implOperationOutcome3(inst2) + + def implOperationOutcome3(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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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-exception.json") + self.assertIsNotNone(inst, "Must have instantiated a OperationOutcome instance") + self.implOperationOutcome4(inst) + + js = inst.as_json() + self.assertEqual("OperationOutcome", js["resourceType"]) + inst2 = operationoutcome.OperationOutcome(js) + self.implOperationOutcome4(inst2) + + def implOperationOutcome4(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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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.json") + self.assertIsNotNone(inst, "Must have instantiated a OperationOutcome instance") + self.implOperationOutcome5(inst) + + js = inst.as_json() + self.assertEqual("OperationOutcome", js["resourceType"]) + inst2 = operationoutcome.OperationOutcome(js) + self.implOperationOutcome5(inst2) + + def implOperationOutcome5(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], "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-allok.json") + self.assertIsNotNone(inst, "Must have instantiated a OperationOutcome instance") + self.implOperationOutcome6(inst) + + js = inst.as_json() + self.assertEqual("OperationOutcome", js["resourceType"]) + inst2 = operationoutcome.OperationOutcome(js) + self.implOperationOutcome6(inst2) + + def implOperationOutcome6(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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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/R4/organization.py b/fhirclient/models/R4/organization.py new file mode 100644 index 000000000..710cdfb24 --- /dev/null +++ b/fhirclient/models/R4/organization.py @@ -0,0 +1,159 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Organization) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Organization(domainresource.DomainResource): + """ A grouping of people or organizations with a common purpose. + + 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, payer/insurer, etc. + """ + + resource_type = "Organization" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 the organization's record is still in active use. + Type `bool`. """ + + self.address = None + """ An address for the organization. + 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 + known as in the past. + List of `str` items. """ + + self.contact = None + """ Contact for the organization for a certain purpose. + List of `OrganizationContact` items (represented as `dict` in JSON). """ + + self.endpoint = None + """ Technical endpoints providing access to services operated for the + organization. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Identifies this organization across multiple systems. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.name = None + """ Name used for the organization. + Type `str`. """ + + self.partOf = None + """ The organization of which this organization forms a part. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.telecom = None + """ A contact detail for the organization. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + self.type = None + """ Kind of organization. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(Organization, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Organization, self).elementProperties() + js.extend([ + ("active", "active", bool, False, None, False), + ("address", "address", address.Address, True, None, False), + ("alias", "alias", str, True, None, False), + ("contact", "contact", OrganizationContact, True, None, False), + ("endpoint", "endpoint", fhirreference.FHIRReference, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("name", "name", str, False, None, False), + ("partOf", "partOf", fhirreference.FHIRReference, False, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +from . import backboneelement + +class OrganizationContact(backboneelement.BackboneElement): + """ Contact for the organization for a certain purpose. + """ + + resource_type = "OrganizationContact" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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(OrganizationContact, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(OrganizationContact, 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 + + +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'] diff --git a/fhirclient/models/R4/organization_tests.py b/fhirclient/models/R4/organization_tests.py new file mode 100644 index 000000000..833d9d822 --- /dev/null +++ b/fhirclient/models/R4/organization_tests.py @@ -0,0 +1,325 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import organization +from .fhirdate import FHIRDate + + +class OrganizationTests(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("Organization", js["resourceType"]) + return organization.Organization(js) + + def testOrganization1(self): + inst = self.instantiate_from("organization-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Organization instance") + self.implOrganization1(inst) + + js = inst.as_json() + self.assertEqual("Organization", js["resourceType"]) + inst2 = organization.Organization(js) + self.implOrganization1(inst2) + + def implOrganization1(self, inst): + 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].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") + + def testOrganization2(self): + inst = self.instantiate_from("organization-example-mmanu.json") + self.assertIsNotNone(inst, "Must have instantiated a Organization instance") + self.implOrganization2(inst) + + js = inst.as_json() + self.assertEqual("Organization", js["resourceType"]) + inst2 = organization.Organization(js) + self.implOrganization2(inst2) + + def implOrganization2(self, inst): + self.assertTrue(inst.active) + 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") + + def testOrganization3(self): + inst = self.instantiate_from("organization-example-gastro.json") + self.assertIsNotNone(inst, "Must have instantiated a Organization instance") + self.implOrganization3(inst) + + js = inst.as_json() + self.assertEqual("Organization", js["resourceType"]) + inst2 = organization.Organization(js) + 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], "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://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 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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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 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://terminology.hl7.org/CodeSystem/organization-type") + + def testOrganization7(self): + inst = self.instantiate_from("organization-example-f201-aumc.json") + self.assertIsNotNone(inst, "Must have instantiated a Organization instance") + self.implOrganization7(inst) + + js = inst.as_json() + self.assertEqual("Organization", js["resourceType"]) + inst2 = organization.Organization(js) + self.implOrganization7(inst2) + + def implOrganization7(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.contact[0].address.city, "Den helder") + self.assertEqual(inst.contact[0].address.country, "NLD") + self.assertEqual(inst.contact[0].address.line[0], "Walvisbaai 3") + self.assertEqual(inst.contact[0].address.line[1], "Gebouw 2") + self.assertEqual(inst.contact[0].address.postalCode, "2333ZA") + self.assertEqual(inst.contact[0].name.family, "Brand") + self.assertEqual(inst.contact[0].name.given[0], "Ronald") + self.assertEqual(inst.contact[0].name.prefix[0], "Prof.Dr.") + self.assertEqual(inst.contact[0].name.text, "Professor Brand") + self.assertEqual(inst.contact[0].name.use, "official") + 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, "+31715269702") + self.assertEqual(inst.id, "f201") + 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") + self.assertEqual(inst.telecom[0].value, "+31715269111") + 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, "V6") + self.assertEqual(inst.type[0].coding[1].display, "University Medical Hospital") + 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://terminology.hl7.org/CodeSystem/organization-type") + + def testOrganization8(self): + inst = self.instantiate_from("organization-example-good-health-care.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.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 testOrganization9(self): + inst = self.instantiate_from("organization-example-f001-burgers.json") + self.assertIsNotNone(inst, "Must have instantiated a Organization instance") + self.implOrganization9(inst) + + js = inst.as_json() + self.assertEqual("Organization", js["resourceType"]) + inst2 = organization.Organization(js) + self.implOrganization9(inst2) + + def implOrganization9(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://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, "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-insurer.json") + self.assertIsNotNone(inst, "Must have instantiated a Organization instance") + self.implOrganization10(inst) + + js = inst.as_json() + self.assertEqual("Organization", js["resourceType"]) + inst2 = organization.Organization(js) + self.implOrganization10(inst2) + + def implOrganization10(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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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/R4/organizationaffiliation.py similarity index 98% rename from fhirclient/models/organizationaffiliation.py rename to fhirclient/models/R4/organizationaffiliation.py index 208ee27b2..957bd6870 100644 --- a/fhirclient/models/organizationaffiliation.py +++ b/fhirclient/models/R4/organizationaffiliation.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/OrganizationAffiliation) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/OrganizationAffiliation) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/organizationaffiliation_tests.py b/fhirclient/models/R4/organizationaffiliation_tests.py similarity index 98% rename from fhirclient/models/organizationaffiliation_tests.py rename to fhirclient/models/R4/organizationaffiliation_tests.py index 548c9d7c8..67aa6a19b 100644 --- a/fhirclient/models/organizationaffiliation_tests.py +++ b/fhirclient/models/R4/organizationaffiliation_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/R4/parameterdefinition.py b/fhirclient/models/R4/parameterdefinition.py new file mode 100644 index 000000000..e6b6a126d --- /dev/null +++ b/fhirclient/models/R4/parameterdefinition.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ParameterDefinition) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class ParameterDefinition(element.Element): + """ Definition of a parameter to a module. + + The parameters to the module. This collection specifies both the input and + output parameters. Input parameters are provided by the caller as part of + the $evaluate operation. Output parameters are included in the + GuidanceResponse. + """ + + resource_type = "ParameterDefinition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ A brief description of the parameter. + Type `str`. """ + + self.max = None + """ Maximum cardinality (a number of *). + Type `str`. """ + + self.min = None + """ Minimum cardinality. + Type `int`. """ + + self.name = None + """ Name used to access the parameter value. + Type `str`. """ + + self.profile = None + """ What profile the value is expected to be. + Type `str`. """ + + self.type = None + """ What type of value. + Type `str`. """ + + self.use = None + """ in | out. + Type `str`. """ + + super(ParameterDefinition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ParameterDefinition, self).elementProperties() + js.extend([ + ("documentation", "documentation", str, False, None, False), + ("max", "max", str, False, None, False), + ("min", "min", int, False, None, False), + ("name", "name", str, False, None, False), + ("profile", "profile", str, False, None, False), + ("type", "type", str, False, None, True), + ("use", "use", str, False, None, True), + ]) + return js + + diff --git a/fhirclient/models/R4/parameters.py b/fhirclient/models/R4/parameters.py new file mode 100644 index 000000000..2971a187c --- /dev/null +++ b/fhirclient/models/R4/parameters.py @@ -0,0 +1,453 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Parameters) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import resource + +class Parameters(resource.Resource): + """ Operation Request or Response. + + 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.parameter = None + """ Operation Parameter. + List of `ParametersParameter` items (represented as `dict` in JSON). """ + + super(Parameters, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Parameters, self).elementProperties() + js.extend([ + ("parameter", "parameter", ParametersParameter, True, None, False), + ]) + return js + + +from . import backboneelement + +class ParametersParameter(backboneelement.BackboneElement): + """ Operation Parameter. + + A parameter passed to or received from the operation. + """ + + resource_type = "ParametersParameter" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 from the definition. + Type `str`. """ + + self.part = None + """ Named part of a multi-part parameter. + List of `ParametersParameter` items (represented as `dict` in JSON). """ + + self.resource = None + """ If parameter is a whole resource. + Type `Resource` (represented as `dict` in JSON). """ + + self.valueAddress = None + """ If parameter is a data type. + Type `Address` (represented as `dict` in JSON). """ + + self.valueAge = None + """ If parameter is a data type. + Type `Age` (represented as `dict` in JSON). """ + + self.valueAnnotation = None + """ If parameter is a data type. + Type `Annotation` (represented as `dict` in JSON). """ + + self.valueAttachment = None + """ If parameter is a data type. + Type `Attachment` (represented as `dict` in JSON). """ + + self.valueBase64Binary = None + """ If parameter is a data type. + Type `str`. """ + + self.valueBoolean = None + """ 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`. """ + + self.valueCodeableConcept = None + """ If parameter is a data type. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueCoding = None + """ 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). """ + + self.valueDateTime = None + """ If parameter is a data type. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueDecimal = None + """ If parameter is a data type. + Type `float`. """ + + self.valueDistance = None + """ 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). """ + + self.valueId = None + """ If parameter is a data type. + Type `str`. """ + + self.valueIdentifier = None + """ If parameter is a data type. + Type `Identifier` (represented as `dict` in JSON). """ + + self.valueInstant = None + """ If parameter is a data type. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueInteger = None + """ If parameter is a data type. + Type `int`. """ + + self.valueMarkdown = None + """ If parameter is a data type. + Type `str`. """ + + self.valueMoney = None + """ If parameter is a data type. + Type `Money` (represented as `dict` in JSON). """ + + self.valueOid = None + """ 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). """ + + self.valuePositiveInt = None + """ If parameter is a data type. + Type `int`. """ + + self.valueQuantity = None + """ If parameter is a data type. + Type `Quantity` (represented as `dict` in JSON). """ + + self.valueRange = None + """ If parameter is a data type. + Type `Range` (represented as `dict` in JSON). """ + + self.valueRatio = None + """ If parameter is a data type. + Type `Ratio` (represented as `dict` in JSON). """ + + self.valueReference = None + """ 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). """ + + self.valueSignature = None + """ If parameter is a data type. + Type `Signature` (represented as `dict` in JSON). """ + + self.valueString = None + """ If parameter is a data type. + Type `str`. """ + + self.valueTime = None + """ If parameter is a data type. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueTiming = None + """ 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`. """ + + self.valueUri = None + """ 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): + js = super(ParametersParameter, self).elementProperties() + js.extend([ + ("name", "name", str, False, None, True), + ("part", "part", ParametersParameter, True, None, False), + ("resource", "resource", resource.Resource, False, None, False), + ("valueAddress", "valueAddress", address.Address, False, "value", False), + ("valueAge", "valueAge", age.Age, False, "value", False), + ("valueAnnotation", "valueAnnotation", annotation.Annotation, False, "value", False), + ("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), + ("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 + + +import sys +try: + from . import address +except ImportError: + address = sys.modules[__package__ + '.address'] +try: + from . import age +except ImportError: + age = sys.modules[__package__ + '.age'] +try: + from . import annotation +except ImportError: + annotation = sys.modules[__package__ + '.annotation'] +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 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: + fhirdate = sys.modules[__package__ + '.fhirdate'] +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 parameterdefinition +except ImportError: + parameterdefinition = sys.modules[__package__ + '.parameterdefinition'] +try: + 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 relatedartifact +except ImportError: + relatedartifact = sys.modules[__package__ + '.relatedartifact'] +try: + from . import sampleddata +except ImportError: + sampleddata = sys.modules[__package__ + '.sampleddata'] +try: + from . import signature +except ImportError: + signature = sys.modules[__package__ + '.signature'] +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/R4/parameters_tests.py b/fhirclient/models/R4/parameters_tests.py new file mode 100644 index 000000000..c61ac0997 --- /dev/null +++ b/fhirclient/models/R4/parameters_tests.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import parameters +from .fhirdate import FHIRDate + + +class ParametersTests(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("Parameters", js["resourceType"]) + return parameters.Parameters(js) + + def testParameters1(self): + inst = self.instantiate_from("parameters-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Parameters instance") + self.implParameters1(inst) + + js = inst.as_json() + self.assertEqual("Parameters", js["resourceType"]) + inst2 = parameters.Parameters(js) + self.implParameters1(inst2) + + def implParameters1(self, inst): + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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/R4/patient.py b/fhirclient/models/R4/patient.py new file mode 100644 index 000000000..836d1f701 --- /dev/null +++ b/fhirclient/models/R4/patient.py @@ -0,0 +1,296 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Patient) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Patient(domainresource.DomainResource): + """ Information about an individual or animal receiving health care services. + + Demographics and other administrative information about an individual or + animal receiving care or other health-related services. + """ + + resource_type = "Patient" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 patient's record is in active use. + Type `bool`. """ + + self.address = None + """ An address for the individual. + List of `Address` items (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 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 + """ A contact party (e.g. guardian, partner, friend) for the patient. + List of `PatientContact` items (represented as `dict` in JSON). """ + + self.deceasedBoolean = None + """ Indicates if the individual is deceased or not. + Type `bool`. """ + + self.deceasedDateTime = None + """ Indicates if the individual is deceased or not. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.gender = None + """ male | female | other | unknown. + Type `str`. """ + + self.generalPractitioner = None + """ Patient's nominated primary care provider. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.identifier = None + """ An identifier for this patient. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.link = None + """ Link to another patient resource that concerns the same actual + person. + List of `PatientLink` items (represented as `dict` in JSON). """ + + self.managingOrganization = None + """ Organization that is the custodian of the patient record. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.maritalStatus = None + """ Marital (civil) status of a patient. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.multipleBirthBoolean = None + """ Whether patient is part of a multiple birth. + Type `bool`. """ + + self.multipleBirthInteger = None + """ Whether patient is part of a multiple birth. + Type `int`. """ + + self.name = None + """ A name associated with the patient. + List of `HumanName` items (represented as `dict` in JSON). """ + + self.photo = None + """ Image of the patient. + List of `Attachment` items (represented as `dict` in JSON). """ + + self.telecom = None + """ A contact detail for the individual. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(Patient, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Patient, self).elementProperties() + js.extend([ + ("active", "active", bool, False, None, False), + ("address", "address", address.Address, True, None, False), + ("birthDate", "birthDate", fhirdate.FHIRDate, False, None, False), + ("communication", "communication", PatientCommunication, True, None, False), + ("contact", "contact", PatientContact, True, None, False), + ("deceasedBoolean", "deceasedBoolean", bool, False, "deceased", False), + ("deceasedDateTime", "deceasedDateTime", fhirdate.FHIRDate, False, "deceased", False), + ("gender", "gender", str, False, None, False), + ("generalPractitioner", "generalPractitioner", fhirreference.FHIRReference, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("link", "link", PatientLink, True, None, False), + ("managingOrganization", "managingOrganization", fhirreference.FHIRReference, False, None, False), + ("maritalStatus", "maritalStatus", codeableconcept.CodeableConcept, False, None, False), + ("multipleBirthBoolean", "multipleBirthBoolean", bool, False, "multipleBirth", False), + ("multipleBirthInteger", "multipleBirthInteger", int, False, "multipleBirth", False), + ("name", "name", humanname.HumanName, True, None, False), + ("photo", "photo", attachment.Attachment, True, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ]) + return js + + +from . import backboneelement + +class PatientCommunication(backboneelement.BackboneElement): + """ A language which may be used to communicate with the patient about his or + her health. + """ + + resource_type = "PatientCommunication" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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(PatientCommunication, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PatientCommunication, self).elementProperties() + js.extend([ + ("language", "language", codeableconcept.CodeableConcept, False, None, True), + ("preferred", "preferred", bool, False, None, False), + ]) + return js + + +class PatientContact(backboneelement.BackboneElement): + """ A contact party (e.g. guardian, partner, friend) for the patient. + """ + + resource_type = "PatientContact" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Address for the contact person. + Type `Address` (represented as `dict` in JSON). """ + + self.gender = None + """ male | female | other | unknown. + Type `str`. """ + + self.name = None + """ A name associated with the contact person. + Type `HumanName` (represented as `dict` in JSON). """ + + self.organization = None + """ Organization that is associated with the contact. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.period = None + """ The period during which this contact person or organization is + valid to be contacted relating to this patient. + Type `Period` (represented as `dict` in JSON). """ + + self.relationship = None + """ The kind of relationship. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.telecom = None + """ A contact detail for the person. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(PatientContact, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PatientContact, self).elementProperties() + js.extend([ + ("address", "address", address.Address, False, None, False), + ("gender", "gender", str, False, None, False), + ("name", "name", humanname.HumanName, False, None, False), + ("organization", "organization", fhirreference.FHIRReference, False, None, False), + ("period", "period", period.Period, False, None, False), + ("relationship", "relationship", codeableconcept.CodeableConcept, True, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ]) + return js + + +class PatientLink(backboneelement.BackboneElement): + """ Link to another patient resource that concerns the same actual person. + + Link to another patient resource that concerns the same actual patient. + """ + + resource_type = "PatientLink" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.other = None + """ The other patient or related person resource that the link refers + to. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.type = None + """ replaced-by | replaces | refer | seealso. + Type `str`. """ + + super(PatientLink, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PatientLink, self).elementProperties() + js.extend([ + ("other", "other", fhirreference.FHIRReference, False, None, True), + ("type", "type", str, False, None, True), + ]) + return js + + +import sys +try: + from . import address +except ImportError: + address = sys.modules[__package__ + '.address'] +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 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: + 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 period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/R4/patient_tests.py b/fhirclient/models/R4/patient_tests.py new file mode 100644 index 000000000..bdf8faa97 --- /dev/null +++ b/fhirclient/models/R4/patient_tests.py @@ -0,0 +1,376 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import patient +from .fhirdate import FHIRDate + + +class PatientTests(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("Patient", js["resourceType"]) + return patient.Patient(js) + + def testPatient1(self): + inst = self.instantiate_from("patient-example-xds.json") + self.assertIsNotNone(inst, "Must have instantiated a Patient instance") + self.implPatient1(inst) + + js = inst.as_json() + self.assertEqual("Patient", js["resourceType"]) + inst2 = patient.Patient(js) + self.implPatient1(inst2) + + def implPatient1(self, inst): + self.assertTrue(inst.active) + 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, "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://terminology.hl7.org/CodeSystem/v2-0203") + self.assertEqual(inst.identifier[0].use, "usual") + 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-f001-pieter.json") + self.assertIsNotNone(inst, "Must have instantiated a Patient instance") + self.implPatient2(inst) + + js = inst.as_json() + self.assertEqual("Patient", js["resourceType"]) + inst2 = patient.Patient(js) + self.implPatient2(inst2) + + def implPatient2(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].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://terminology.hl7.org/CodeSystem/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://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-d.json") + self.assertIsNotNone(inst, "Must have instantiated a Patient instance") + self.implPatient3(inst) + + js = inst.as_json() + self.assertEqual("Patient", js["resourceType"]) + inst2 = patient.Patient(js) + self.implPatient3(inst2) + + def implPatient3(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://terminology.hl7.org/CodeSystem/v2-0203") + self.assertEqual(inst.identifier[0].use, "usual") + 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.text.status, "generated") + + def testPatient4(self): + inst = self.instantiate_from("patient-example-infant-twin-1.json") + self.assertIsNotNone(inst, "Must have instantiated a Patient instance") + self.implPatient4(inst) + + js = inst.as_json() + self.assertEqual("Patient", js["resourceType"]) + inst2 = patient.Patient(js) + self.implPatient4(inst2) + + def implPatient4(self, inst): + 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://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-infant-mom.json") + self.assertIsNotNone(inst, "Must have instantiated a Patient instance") + self.implPatient5(inst) + + js = inst.as_json() + self.assertEqual("Patient", js["resourceType"]) + inst2 = patient.Patient(js) + self.implPatient5(inst2) + + def implPatient5(self, inst): + 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.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-newborn.json") + self.assertIsNotNone(inst, "Must have instantiated a Patient instance") + self.implPatient6(inst) + + js = inst.as_json() + self.assertEqual("Patient", js["resourceType"]) + inst2 = patient.Patient(js) + self.implPatient6(inst2) + + def implPatient6(self, inst): + 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-infant-fetal.json") + self.assertIsNotNone(inst, "Must have instantiated a Patient instance") + self.implPatient7(inst) + + js = inst.as_json() + self.assertEqual("Patient", js["resourceType"]) + inst2 = patient.Patient(js) + self.implPatient7(inst2) + + def implPatient7(self, inst): + 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, "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-genetics-example1.json") + self.assertIsNotNone(inst, "Must have instantiated a Patient instance") + self.implPatient8(inst) + + js = inst.as_json() + self.assertEqual("Patient", js["resourceType"]) + inst2 = patient.Patient(js) + self.implPatient8(inst2) + + def implPatient8(self, inst): + self.assertTrue(inst.active) + self.assertEqual(inst.address[0].line[0], "2222 Home Street") + self.assertEqual(inst.address[0].use, "home") + 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, "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-b.json") + self.assertIsNotNone(inst, "Must have instantiated a Patient instance") + self.implPatient9(inst) + + js = inst.as_json() + self.assertEqual("Patient", js["resourceType"]) + inst2 = patient.Patient(js) + self.implPatient9(inst2) + + def implPatient9(self, inst): + self.assertTrue(inst.active) + 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/gif") + self.assertEqual(inst.text.status, "generated") + + def testPatient10(self): + inst = self.instantiate_from("patient-example-c.json") + self.assertIsNotNone(inst, "Must have instantiated a Patient instance") + self.implPatient10(inst) + + js = inst.as_json() + self.assertEqual("Patient", js["resourceType"]) + inst2 = patient.Patient(js) + self.implPatient10(inst2) + + def implPatient10(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.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/R4/paymentnotice.py b/fhirclient/models/R4/paymentnotice.py new file mode 100644 index 000000000..222e2eff6 --- /dev/null +++ b/fhirclient/models/R4/paymentnotice.py @@ -0,0 +1,116 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/PaymentNotice) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class PaymentNotice(domainresource.DomainResource): + """ PaymentNotice request. + + This resource provides the status of the payment for goods and services + rendered, and the request and response resource references. + """ + + resource_type = "PaymentNotice" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 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 for the payment noctice. + List of `Identifier` items (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 + """ Issued or cleared Status of the payment. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.provider = None + """ Responsible practitioner. + 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` (represented as `dict` in JSON). """ + + self.response = None + """ Response reference. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.status = None + """ active | cancelled | draft | entered-in-error. + Type `str`. """ + + super(PaymentNotice, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PaymentNotice, self).elementProperties() + js.extend([ + ("amount", "amount", money.Money, False, None, True), + ("created", "created", fhirdate.FHIRDate, False, None, True), + ("identifier", "identifier", identifier.Identifier, True, 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, 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'] diff --git a/fhirclient/models/R4/paymentnotice_tests.py b/fhirclient/models/R4/paymentnotice_tests.py new file mode 100644 index 000000000..6dc17b331 --- /dev/null +++ b/fhirclient/models/R4/paymentnotice_tests.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import paymentnotice +from .fhirdate import FHIRDate + + +class PaymentNoticeTests(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("PaymentNotice", js["resourceType"]) + return paymentnotice.PaymentNotice(js) + + def testPaymentNotice1(self): + inst = self.instantiate_from("paymentnotice-example.json") + self.assertIsNotNone(inst, "Must have instantiated a PaymentNotice instance") + self.implPaymentNotice1(inst) + + js = inst.as_json() + self.assertEqual("PaymentNotice", js["resourceType"]) + inst2 = paymentnotice.PaymentNotice(js) + 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://terminology.hl7.org/CodeSystem/paymentstatus") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.div, "
A human-readable rendering of the PaymentNotice
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/R4/paymentreconciliation.py b/fhirclient/models/R4/paymentreconciliation.py new file mode 100644 index 000000000..274c3b8a0 --- /dev/null +++ b/fhirclient/models/R4/paymentreconciliation.py @@ -0,0 +1,247 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/PaymentReconciliation) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class PaymentReconciliation(domainresource.DomainResource): + """ PaymentReconciliation resource. + + This resource provides the details including amount of a payment and + allocates the payment items being paid. + """ + + resource_type = "PaymentReconciliation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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.detail = None + """ Settlement particulars. + List of `PaymentReconciliationDetail` items (represented as `dict` in JSON). """ + + self.disposition = None + """ Disposition message. + Type `str`. """ + + self.formCode = None + """ Printed form identifier. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.identifier = None + """ Business Identifier for a payment reconciliation. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.outcome = None + """ 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 + """ Note concerning processing. + List of `PaymentReconciliationProcessNote` items (represented as `dict` in JSON). """ + + self.request = None + """ Reference to requesting resource. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.requestor = None + """ Responsible practitioner. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.status = None + """ active | cancelled | draft | entered-in-error. + Type `str`. """ + + super(PaymentReconciliation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PaymentReconciliation, self).elementProperties() + js.extend([ + ("created", "created", fhirdate.FHIRDate, False, None, True), + ("detail", "detail", PaymentReconciliationDetail, True, None, False), + ("disposition", "disposition", str, False, None, False), + ("formCode", "formCode", codeableconcept.CodeableConcept, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, 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), + ("requestor", "requestor", fhirreference.FHIRReference, False, None, False), + ("status", "status", str, False, None, True), + ]) + return js + + +from . import backboneelement + +class PaymentReconciliationDetail(backboneelement.BackboneElement): + """ Settlement particulars. + + Distribution of the payment amount for a previously acknowledged payable. + """ + + resource_type = "PaymentReconciliationDetail" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 allocated to this payable. + Type `Money` (represented as `dict` in JSON). """ + + self.date = None + """ 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 + """ 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 + """ Request giving rise to the payment. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.response = None + """ 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 + """ Submitter of the request. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.type = None + """ Category of payment. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(PaymentReconciliationDetail, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PaymentReconciliationDetail, self).elementProperties() + 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), + ]) + return js + + +class PaymentReconciliationProcessNote(backboneelement.BackboneElement): + """ Note concerning processing. + + A note that describes or explains the processing in a human readable form. + """ + + resource_type = "PaymentReconciliationProcessNote" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Note explanatory text. + Type `str`. """ + + self.type = None + """ display | print | printoper. + Type `str`. """ + + super(PaymentReconciliationProcessNote, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PaymentReconciliationProcessNote, self).elementProperties() + js.extend([ + ("text", "text", str, 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 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'] diff --git a/fhirclient/models/R4/paymentreconciliation_tests.py b/fhirclient/models/R4/paymentreconciliation_tests.py new file mode 100644 index 000000000..2778d15a6 --- /dev/null +++ b/fhirclient/models/R4/paymentreconciliation_tests.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import paymentreconciliation +from .fhirdate import FHIRDate + + +class PaymentReconciliationTests(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("PaymentReconciliation", js["resourceType"]) + return paymentreconciliation.PaymentReconciliation(js) + + def testPaymentReconciliation1(self): + inst = self.instantiate_from("paymentreconciliation-example.json") + self.assertIsNotNone(inst, "Must have instantiated a PaymentReconciliation instance") + self.implPaymentReconciliation1(inst) + + js = inst.as_json() + self.assertEqual("PaymentReconciliation", js["resourceType"]) + inst2 = paymentreconciliation.PaymentReconciliation(js) + self.implPaymentReconciliation1(inst2) + + 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.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://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://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://terminology.hl7.org/CodeSystem/payment-type") + self.assertEqual(inst.disposition, "2014 August mid-month settlement.") + 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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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, "display") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.div, "
A human-readable rendering of the PaymentReconciliation
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/R4/period.py b/fhirclient/models/R4/period.py new file mode 100644 index 000000000..3eababa79 --- /dev/null +++ b/fhirclient/models/R4/period.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Period) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Period(element.Element): + """ Time range defined by start and end date/time. + + A time period defined by a start and end date and optionally time. + """ + + resource_type = "Period" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ End time with inclusive boundary, if not ongoing. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.start = None + """ Starting time with inclusive boundary. + Type `FHIRDate` (represented as `str` in JSON). """ + + super(Period, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Period, self).elementProperties() + js.extend([ + ("end", "end", fhirdate.FHIRDate, False, None, False), + ("start", "start", fhirdate.FHIRDate, False, None, False), + ]) + return js + + +import sys +try: + from . import fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] diff --git a/fhirclient/models/R4/person.py b/fhirclient/models/R4/person.py new file mode 100644 index 000000000..ee90c4a53 --- /dev/null +++ b/fhirclient/models/R4/person.py @@ -0,0 +1,149 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Person) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Person(domainresource.DomainResource): + """ A generic person record. + + Demographics and administrative information about a person independent of a + specific health-related context. + """ + + resource_type = "Person" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ This person's record is in active use. + Type `bool`. """ + + self.address = None + """ One or more addresses for the person. + List of `Address` items (represented as `dict` in JSON). """ + + self.birthDate = None + """ The date on which the person was born. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.gender = None + """ male | female | other | unknown. + Type `str`. """ + + self.identifier = None + """ A human identifier for this person. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.link = None + """ Link to a resource that concerns the same actual person. + List of `PersonLink` items (represented as `dict` in JSON). """ + + self.managingOrganization = None + """ The organization that is the custodian of the person record. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.name = None + """ A name associated with the person. + List of `HumanName` items (represented as `dict` in JSON). """ + + self.photo = None + """ Image of the person. + Type `Attachment` (represented as `dict` in JSON). """ + + self.telecom = None + """ A contact detail for the person. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(Person, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Person, self).elementProperties() + js.extend([ + ("active", "active", bool, False, None, False), + ("address", "address", address.Address, True, None, False), + ("birthDate", "birthDate", fhirdate.FHIRDate, False, None, False), + ("gender", "gender", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("link", "link", PersonLink, True, None, False), + ("managingOrganization", "managingOrganization", fhirreference.FHIRReference, False, None, False), + ("name", "name", humanname.HumanName, True, None, False), + ("photo", "photo", attachment.Attachment, False, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ]) + return js + + +from . import backboneelement + +class PersonLink(backboneelement.BackboneElement): + """ Link to a resource that concerns the same actual person. + """ + + resource_type = "PersonLink" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.assurance = None + """ level1 | level2 | level3 | level4. + Type `str`. """ + + self.target = None + """ The resource to which this actual person is associated. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(PersonLink, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PersonLink, self).elementProperties() + js.extend([ + ("assurance", "assurance", str, False, None, False), + ("target", "target", fhirreference.FHIRReference, False, None, True), + ]) + return js + + +import sys +try: + from . import address +except ImportError: + address = sys.modules[__package__ + '.address'] +try: + from . import attachment +except ImportError: + attachment = sys.modules[__package__ + '.attachment'] +try: + 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: + 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'] diff --git a/fhirclient/models/R4/person_tests.py b/fhirclient/models/R4/person_tests.py new file mode 100644 index 000000000..778f6d81d --- /dev/null +++ b/fhirclient/models/R4/person_tests.py @@ -0,0 +1,96 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import person +from .fhirdate import FHIRDate + + +class PersonTests(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("Person", js["resourceType"]) + return person.Person(js) + + def testPerson1(self): + inst = self.instantiate_from("person-example-f002-ariadne.json") + self.assertIsNotNone(inst, "Must have instantiated a Person instance") + self.implPerson1(inst) + + js = inst.as_json() + self.assertEqual("Person", js["resourceType"]) + inst2 = person.Person(js) + self.implPerson1(inst2) + + def implPerson1(self, inst): + self.assertTrue(inst.active) + 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.photo.contentType, "image/jpeg") + 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") + + def testPerson2(self): + inst = self.instantiate_from("person-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Person instance") + self.implPerson2(inst) + + js = inst.as_json() + self.assertEqual("Person", js["resourceType"]) + inst2 = person.Person(js) + self.implPerson2(inst2) + + def implPerson2(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.birthDate.date, FHIRDate("1974-12-25").date) + self.assertEqual(inst.birthDate.as_json(), "1974-12-25") + self.assertEqual(inst.gender, "male") + self.assertEqual(inst.id, "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://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") + self.assertEqual(inst.name[0].use, "official") + self.assertEqual(inst.name[1].given[0], "Jim") + self.assertEqual(inst.name[1].use, "usual") + 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, "(03) 5555 6473") + self.assertEqual(inst.telecom[2].system, "email") + self.assertEqual(inst.telecom[2].use, "home") + self.assertEqual(inst.telecom[2].value, "Jim@example.org") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/R4/plandefinition.py b/fhirclient/models/R4/plandefinition.py new file mode 100644 index 000000000..2ba8df0b3 --- /dev/null +++ b/fhirclient/models/R4/plandefinition.py @@ -0,0 +1,732 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/PlanDefinition) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class PlanDefinition(domainresource.DomainResource): + """ The definition of a plan for a series of actions, independent of any + specific patient or context. + + This resource allows for the definition of various types of plans as a + sharable, consumable, and executable artifact. The resource is general + enough to support the description of a broad range of clinical artifacts + such as clinical decision support rules, order sets and protocols. + """ + + resource_type = "PlanDefinition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Action defined by the plan. + List of `PlanDefinitionAction` items (represented as `dict` in JSON). """ + + self.approvalDate = None + """ 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.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 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`. """ + + self.goal = None + """ What the plan is trying to accomplish. + List of `PlanDefinitionGoal` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Additional identifier for the plan definition. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ Intended jurisdiction for plan definition (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.lastReviewDate = None + """ When the plan definition was last reviewed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.library = None + """ Logic used by the plan definition. + List of `str` items. """ + + self.name = None + """ Name for this plan definition (computer friendly). + Type `str`. """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this plan definition is defined. + Type `str`. """ + + self.relatedArtifact = None + """ 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. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.type = None + """ order-set | clinical-protocol | eca-rule | workflow-definition. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.url = None + """ Canonical identifier for this plan definition, represented as a URI + (globally unique). + Type `str`. """ + + self.usage = None + """ Describes the clinical usage of the plan. + 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 plan definition. + Type `str`. """ + + super(PlanDefinition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PlanDefinition, self).elementProperties() + 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), + ("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", 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), + ("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 + + +from . import backboneelement + +class PlanDefinitionAction(backboneelement.BackboneElement): + """ Action defined by the plan. + + An action or group of actions to be taken as part of the plan. + """ + + resource_type = "PlanDefinitionAction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ A sub-action. + List of `PlanDefinitionAction` items (represented as `dict` in JSON). """ + + self.cardinalityBehavior = None + """ single | multiple. + Type `str`. """ + + self.code = None + """ Code representing the meaning of the action or sub-actions. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.condition = None + """ Whether or not the action is applicable. + List of `PlanDefinitionActionCondition` items (represented as `dict` in JSON). """ + + self.definitionCanonical = None + """ Description of the activity to be performed. + Type `str`. """ + + self.definitionUri = None + """ Description of the activity to be performed. + Type `str`. """ + + self.description = None + """ Brief description of the action. + Type `str`. """ + + self.documentation = None + """ Supporting documentation for the intended performer of the action. + List of `RelatedArtifact` items (represented as `dict` in JSON). """ + + self.dynamicValue = None + """ Dynamic aspects of the definition. + List of `PlanDefinitionActionDynamicValue` items (represented as `dict` in JSON). """ + + self.goalId = None + """ What goals this action supports. + List of `str` items. """ + + self.groupingBehavior = None + """ visual-group | logical-group | sentence-group. + Type `str`. """ + + self.input = None + """ Input data requirements. + List of `DataRequirement` items (represented as `dict` in JSON). """ + + self.output = None + """ Output data definition. + List of `DataRequirement` items (represented as `dict` in JSON). """ + + self.participant = None + """ Who should participate in the action. + List of `PlanDefinitionActionParticipant` 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.reason = None + """ Why the action should be performed. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.relatedAction = None + """ Relationship to another action. + List of `PlanDefinitionActionRelatedAction` items (represented as `dict` in JSON). """ + + self.requiredBehavior = None + """ must | could | must-unless-documented. + Type `str`. """ + + self.selectionBehavior = None + """ 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). """ + + self.timingDuration = None + """ When the action should take place. + Type `Duration` (represented as `dict` in JSON). """ + + self.timingPeriod = None + """ When the action should take place. + Type `Period` (represented as `dict` in JSON). """ + + self.timingRange = None + """ When the action should take place. + Type `Range` (represented as `dict` in JSON). """ + + self.timingTiming = None + """ When the action should take place. + Type `Timing` (represented as `dict` in JSON). """ + + self.title = None + """ User-visible title. + Type `str`. """ + + self.transform = None + """ Transform to apply the template. + Type `str`. """ + + 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 `CodeableConcept` (represented as `dict` in JSON). """ + + super(PlanDefinitionAction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PlanDefinitionAction, self).elementProperties() + js.extend([ + ("action", "action", PlanDefinitionAction, True, None, False), + ("cardinalityBehavior", "cardinalityBehavior", str, False, None, False), + ("code", "code", codeableconcept.CodeableConcept, True, None, False), + ("condition", "condition", PlanDefinitionActionCondition, True, 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), + ("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", str, False, None, False), + ("trigger", "trigger", triggerdefinition.TriggerDefinition, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class PlanDefinitionActionCondition(backboneelement.BackboneElement): + """ Whether or not the action is applicable. + + An expression that describes applicability criteria or start/stop + conditions for the action. + """ + + resource_type = "PlanDefinitionActionCondition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Boolean-valued expression. + Type `Expression` (represented as `dict` in JSON). """ + + self.kind = None + """ applicability | start | stop. + Type `str`. """ + + super(PlanDefinitionActionCondition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PlanDefinitionActionCondition, self).elementProperties() + js.extend([ + ("expression", "expression", expression.Expression, False, None, False), + ("kind", "kind", str, False, None, True), + ]) + return js + + +class PlanDefinitionActionDynamicValue(backboneelement.BackboneElement): + """ Dynamic aspects of the definition. + + Customizations that should be applied to the statically defined resource. + For example, if the dosage of a medication must be computed based on the + patient's weight, a customization would be used to specify an expression + that calculated the weight, and the path on the resource that would contain + the result. + """ + + resource_type = "PlanDefinitionActionDynamicValue" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ An expression that provides the dynamic value for the customization. + Type `Expression` (represented as `dict` in JSON). """ + + self.path = None + """ The path to the element to be set dynamically. + Type `str`. """ + + super(PlanDefinitionActionDynamicValue, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PlanDefinitionActionDynamicValue, self).elementProperties() + js.extend([ + ("expression", "expression", expression.Expression, False, None, False), + ("path", "path", str, False, None, False), + ]) + return js + + +class PlanDefinitionActionParticipant(backboneelement.BackboneElement): + """ Who should participate in the action. + + Indicates who should participate in performing the action described. + """ + + resource_type = "PlanDefinitionActionParticipant" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.role = None + """ E.g. Nurse, Surgeon, Parent. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.type = None + """ patient | practitioner | related-person | device. + Type `str`. """ + + super(PlanDefinitionActionParticipant, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PlanDefinitionActionParticipant, self).elementProperties() + js.extend([ + ("role", "role", codeableconcept.CodeableConcept, False, None, False), + ("type", "type", str, False, None, True), + ]) + return js + + +class PlanDefinitionActionRelatedAction(backboneelement.BackboneElement): + """ Relationship to another action. + + A relationship to another action such as "before" or "30-60 minutes after + start of". + """ + + resource_type = "PlanDefinitionActionRelatedAction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.actionId = None + """ What action is this related to. + Type `str`. """ + + self.offsetDuration = None + """ Time offset for the relationship. + Type `Duration` (represented as `dict` in JSON). """ + + self.offsetRange = None + """ Time offset for the relationship. + Type `Range` (represented as `dict` in JSON). """ + + self.relationship = None + """ before-start | before | before-end | concurrent-with-start | + concurrent | concurrent-with-end | after-start | after | after-end. + Type `str`. """ + + super(PlanDefinitionActionRelatedAction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PlanDefinitionActionRelatedAction, self).elementProperties() + js.extend([ + ("actionId", "actionId", str, False, None, True), + ("offsetDuration", "offsetDuration", duration.Duration, False, "offset", False), + ("offsetRange", "offsetRange", range.Range, False, "offset", False), + ("relationship", "relationship", str, False, None, True), + ]) + return js + + +class PlanDefinitionGoal(backboneelement.BackboneElement): + """ What the plan is trying to accomplish. + + Goals that describe what the activities within the plan are intended to + achieve. For example, weight loss, restoring an activity of daily living, + obtaining herd immunity via immunization, meeting a process improvement + objective, etc. + """ + + resource_type = "PlanDefinitionGoal" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.addresses = None + """ What does the goal address. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.category = None + """ E.g. Treatment, dietary, behavioral. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.description = None + """ Code or text describing the goal. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.documentation = None + """ Supporting documentation for the goal. + List of `RelatedArtifact` items (represented as `dict` in JSON). """ + + self.priority = None + """ high-priority | medium-priority | low-priority. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.start = None + """ When goal pursuit begins. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.target = None + """ Target outcome for the goal. + List of `PlanDefinitionGoalTarget` items (represented as `dict` in JSON). """ + + super(PlanDefinitionGoal, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PlanDefinitionGoal, self).elementProperties() + js.extend([ + ("addresses", "addresses", codeableconcept.CodeableConcept, True, None, False), + ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("description", "description", codeableconcept.CodeableConcept, False, None, True), + ("documentation", "documentation", relatedartifact.RelatedArtifact, True, None, False), + ("priority", "priority", codeableconcept.CodeableConcept, False, None, False), + ("start", "start", codeableconcept.CodeableConcept, False, None, False), + ("target", "target", PlanDefinitionGoalTarget, True, None, False), + ]) + return js + + +class PlanDefinitionGoalTarget(backboneelement.BackboneElement): + """ Target outcome for the goal. + + Indicates what should be done and within what timeframe. + """ + + resource_type = "PlanDefinitionGoalTarget" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.detailCodeableConcept = None + """ The target value to be achieved. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.detailQuantity = None + """ The target value to be achieved. + Type `Quantity` (represented as `dict` in JSON). """ + + self.detailRange = None + """ The target value to be achieved. + Type `Range` (represented as `dict` in JSON). """ + + self.due = None + """ Reach goal within. + Type `Duration` (represented as `dict` in JSON). """ + + self.measure = None + """ The parameter whose value is to be tracked. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(PlanDefinitionGoalTarget, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PlanDefinitionGoalTarget, self).elementProperties() + js.extend([ + ("detailCodeableConcept", "detailCodeableConcept", codeableconcept.CodeableConcept, False, "detail", False), + ("detailQuantity", "detailQuantity", quantity.Quantity, False, "detail", False), + ("detailRange", "detailRange", range.Range, False, "detail", False), + ("due", "due", duration.Duration, False, None, False), + ("measure", "measure", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +import sys +try: + from . import age +except ImportError: + age = sys.modules[__package__ + '.age'] +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 quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] +try: + from . import range +except ImportError: + range = sys.modules[__package__ + '.range'] +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/R4/plandefinition_tests.py b/fhirclient/models/R4/plandefinition_tests.py new file mode 100644 index 000000000..cae9dfa2a --- /dev/null +++ b/fhirclient/models/R4/plandefinition_tests.py @@ -0,0 +1,605 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import plandefinition +from .fhirdate import FHIRDate + + +class PlanDefinitionTests(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("PlanDefinition", js["resourceType"]) + return plandefinition.PlanDefinition(js) + + def testPlanDefinition1(self): + inst = self.instantiate_from("plandefinition-example-kdn5-simplified.json") + self.assertIsNotNone(inst, "Must have instantiated a PlanDefinition instance") + self.implPlanDefinition1(inst) + + js = inst.as_json() + self.assertEqual("PlanDefinition", js["resourceType"]) + inst2 = plandefinition.PlanDefinition(js) + 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") + self.assertEqual(inst.action[0].action[0].action[0].action[0].action[0].extension[0].extension[1].valueInteger, 8) + 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") + self.assertEqual(inst.action[0].action[0].action[0].action[0].action[1].id, "action-2") + self.assertEqual(inst.action[0].action[0].action[0].action[0].action[1].relatedAction[0].actionId, "action-1") + self.assertEqual(inst.action[0].action[0].action[0].action[0].action[1].relatedAction[0].relationship, "concurrent-with-start") + self.assertEqual(inst.action[0].action[0].action[0].action[0].action[1].textEquivalent, "CARBOplatin AUC 5 IV over 30 minutes on Day 1") + self.assertEqual(inst.action[0].action[0].action[0].action[0].id, "cycle-definition-1") + self.assertEqual(inst.action[0].action[0].action[0].action[0].textEquivalent, "21-day cycle for 6 cycles") + self.assertEqual(inst.action[0].action[0].action[0].action[0].timingTiming.repeat.count, 6) + self.assertEqual(inst.action[0].action[0].action[0].action[0].timingTiming.repeat.duration, 21) + self.assertEqual(inst.action[0].action[0].action[0].action[0].timingTiming.repeat.durationUnit, "d") + self.assertEqual(inst.action[0].action[0].action[0].groupingBehavior, "sentence-group") + self.assertEqual(inst.action[0].action[0].action[0].selectionBehavior, "exactly-one") + self.assertEqual(inst.action[0].action[0].selectionBehavior, "all") + 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.copyright, "All rights reserved.") + self.assertTrue(inst.experimental) + self.assertEqual(inst.id, "KDN5") + self.assertEqual(inst.identifier[0].system, "http://example.org/ordertemplates") + 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") + self.assertEqual(inst.relatedArtifact[0].url, "http://www.example.org/professionals/physician_gls/PDF/kidney.pdf") + self.assertEqual(inst.relatedArtifact[1].citation, "Oudard S, et al. J Urol. 2007;177(5):1698-702") + self.assertEqual(inst.relatedArtifact[1].type, "citation") + self.assertEqual(inst.relatedArtifact[1].url, "http://www.ncbi.nlm.nih.gov/pubmed/17437788") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "additional") + self.assertEqual(inst.title, "Gemcitabine/CARBOplatin") + self.assertEqual(inst.type.text, "Chemotherapy Order Template") + self.assertEqual(inst.useContext[0].code.code, "treamentSetting-or-diseaseStatus") + self.assertEqual(inst.useContext[0].code.system, "http://example.org/fhir/CodeSystem/indications") + self.assertEqual(inst.useContext[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/usagecontext-group") + self.assertEqual(inst.useContext[0].extension[0].valueString, "A") + self.assertEqual(inst.useContext[0].valueCodeableConcept.text, "Metastatic") + self.assertEqual(inst.useContext[1].code.code, "disease-or-histology") + self.assertEqual(inst.useContext[1].code.system, "http://example.org/fhir/CodeSystem/indications") + self.assertEqual(inst.useContext[1].extension[0].url, "http://hl7.org/fhir/StructureDefinition/usagecontext-group") + 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://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") + self.assertEqual(inst.useContext[3].code.code, "treatmentSetting-or-diseaseStatus") + self.assertEqual(inst.useContext[3].code.system, "http://example.org/fhir/CodeSystem/indications") + self.assertEqual(inst.useContext[3].extension[0].url, "http://hl7.org/fhir/StructureDefinition/usagecontext-group") + self.assertEqual(inst.useContext[3].extension[0].valueString, "B") + self.assertEqual(inst.useContext[3].valueCodeableConcept.text, "Relapsed") + self.assertEqual(inst.useContext[4].code.code, "disease-or-histology") + self.assertEqual(inst.useContext[4].code.system, "http://example.org/fhir/CodeSystem/indications") + self.assertEqual(inst.useContext[4].extension[0].url, "http://hl7.org/fhir/StructureDefinition/usagecontext-group") + 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://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-options-example.json") + self.assertIsNotNone(inst, "Must have instantiated a PlanDefinition instance") + self.implPlanDefinition2(inst) + + js = inst.as_json() + self.assertEqual("PlanDefinition", js["resourceType"]) + inst2 = plandefinition.PlanDefinition(js) + self.implPlanDefinition2(inst2) + + def implPlanDefinition2(self, inst): + 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.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.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.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.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.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.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].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.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.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.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.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)") + self.assertEqual(inst.action[0].action[1].action[0].action[0].action[2].textEquivalent, "fluoxetine 20 mg capsule 1 capsule oral 1 time daily now (30 tablet; 3 refills)") + self.assertEqual(inst.action[0].action[1].action[0].action[0].action[3].textEquivalent, "paroxetine 20 mg tablet 1 tablet oral 1 time daily now (30 tablet; 3 refills)") + self.assertEqual(inst.action[0].action[1].action[0].action[0].action[4].textEquivalent, "sertraline 50 mg tablet 1 tablet oral 1 time daily now (30 tablet; 3 refills)") + self.assertEqual(inst.action[0].action[1].action[0].action[0].documentation[0].document.contentType, "text/html") + self.assertEqual(inst.action[0].action[1].action[0].action[0].documentation[0].document.title, "National Library of Medicine. DailyMed website. CITALOPRAM- citalopram hydrobromide tablet, film coated.") + self.assertEqual(inst.action[0].action[1].action[0].action[0].documentation[0].document.url, "http://dailymed.nlm.nih.gov/dailymed/drugInfo.cfm?setid=6daeb45c-451d-b135-bf8f-2d6dff4b6b01") + self.assertEqual(inst.action[0].action[1].action[0].action[0].documentation[0].type, "citation") + self.assertEqual(inst.action[0].action[1].action[0].action[0].groupingBehavior, "logical-group") + self.assertEqual(inst.action[0].action[1].action[0].action[0].selectionBehavior, "at-most-one") + self.assertEqual(inst.action[0].action[1].action[0].action[0].title, "Selective Serotonin Reuptake Inhibitors (Choose a mazimum of one or document reasons for exception)") + self.assertEqual(inst.action[0].action[1].action[0].action[1].textEquivalent, "Dopamine Norepinephrine Reuptake Inhibitors (Choose a maximum of one or document reasons for exception)") + 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/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://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") + self.assertEqual(inst.action[0].action[1].action[0].documentation[0].type, "citation") + 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[0].title, "First-Line Antidepressants") + self.assertEqual(inst.action[0].action[1].groupingBehavior, "logical-group") + self.assertEqual(inst.action[0].action[1].selectionBehavior, "at-most-one") + self.assertEqual(inst.action[0].action[1].title, "Medications") + 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") + 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.contained[0].id, "referralToMentalHealthCare") + self.assertEqual(inst.contained[1].id, "citalopramPrescription") + self.assertEqual(inst.contained[2].id, "citalopramMedication") + self.assertEqual(inst.contained[3].id, "citalopramSubstance") + 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, "Orders to be applied to a patient characterized as low suicide risk.") + 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.assertTrue(inst.experimental) + self.assertEqual(inst.id, "low-suicide-risk-order-set") + self.assertEqual(inst.identifier[0].system, "http://motivemi.com/artifacts") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "mmi:low-suicide-risk-order-set") + 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-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") + self.assertEqual(inst.title, "Low Suicide Risk Order Set") + self.assertEqual(inst.topic[0].text, "Suicide risk assessment") + 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://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://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://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://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://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://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://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 testPlanDefinition6(self): + inst = self.instantiate_from("plandefinition-predecessor-example.json") + self.assertIsNotNone(inst, "Must have instantiated a PlanDefinition instance") + self.implPlanDefinition6(inst) + + js = inst.as_json() + self.assertEqual("PlanDefinition", js["resourceType"]) + inst2 = plandefinition.PlanDefinition(js) + self.implPlanDefinition6(inst2) + + 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[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[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[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[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.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].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") + self.assertEqual(inst.title, "Example Zika Virus Intervention") + 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") + diff --git a/fhirclient/models/population.py b/fhirclient/models/R4/population.py similarity index 98% rename from fhirclient/models/population.py rename to fhirclient/models/R4/population.py index ea22d8067..eeba21b51 100644 --- a/fhirclient/models/population.py +++ b/fhirclient/models/R4/population.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Population) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Population) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/R4/practitioner.py b/fhirclient/models/R4/practitioner.py new file mode 100644 index 000000000..ccbe5971f --- /dev/null +++ b/fhirclient/models/R4/practitioner.py @@ -0,0 +1,175 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Practitioner) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Practitioner(domainresource.DomainResource): + """ A person with a formal responsibility in the provisioning of healthcare or + related services. + + A person who is directly or indirectly involved in the provisioning of + healthcare. + """ + + resource_type = "Practitioner" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 practitioner's record is in active use. + Type `bool`. """ + + self.address = None + """ Address(es) of the practitioner that are not role specific + (typically home address). + List of `Address` items (represented as `dict` in JSON). """ + + self.birthDate = None + """ The date on which the practitioner was born. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.communication = None + """ A language the practitioner can use in patient communication. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.gender = None + """ male | female | other | unknown. + Type `str`. """ + + self.identifier = None + """ An identifier for the person as this agent. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.name = None + """ The name(s) associated with the practitioner. + List of `HumanName` items (represented as `dict` in JSON). """ + + self.photo = None + """ Image of the person. + List of `Attachment` items (represented as `dict` in JSON). """ + + self.qualification = None + """ Certification, licenses, or training pertaining to the provision of + care. + List of `PractitionerQualification` items (represented as `dict` in JSON). """ + + self.telecom = None + """ A contact detail for the practitioner (that apply to all roles). + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(Practitioner, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Practitioner, self).elementProperties() + js.extend([ + ("active", "active", bool, False, None, False), + ("address", "address", address.Address, True, None, False), + ("birthDate", "birthDate", fhirdate.FHIRDate, False, None, False), + ("communication", "communication", codeableconcept.CodeableConcept, True, None, False), + ("gender", "gender", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("name", "name", humanname.HumanName, True, None, False), + ("photo", "photo", attachment.Attachment, True, None, False), + ("qualification", "qualification", PractitionerQualification, True, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ]) + return js + + +from . import backboneelement + +class PractitionerQualification(backboneelement.BackboneElement): + """ 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 representation of the qualification. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.identifier = None + """ An identifier for this qualification for the practitioner. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.issuer = None + """ Organization that regulates and issues the qualification. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.period = None + """ Period during which the qualification is valid. + Type `Period` (represented as `dict` in JSON). """ + + super(PractitionerQualification, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PractitionerQualification, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("issuer", "issuer", fhirreference.FHIRReference, False, None, False), + ("period", "period", period.Period, False, None, False), + ]) + return js + + +import sys +try: + from . import address +except ImportError: + address = sys.modules[__package__ + '.address'] +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 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: + 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 period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/R4/practitioner_tests.py b/fhirclient/models/R4/practitioner_tests.py new file mode 100644 index 000000000..fe7ecfd77 --- /dev/null +++ b/fhirclient/models/R4/practitioner_tests.py @@ -0,0 +1,396 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import practitioner +from .fhirdate import FHIRDate + + +class PractitionerTests(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("Practitioner", js["resourceType"]) + return practitioner.Practitioner(js) + + def testPractitioner1(self): + inst = self.instantiate_from("practitioner-example-f203-jvg.json") + self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") + self.implPractitioner1(inst) + + js = inst.as_json() + self.assertEqual("Practitioner", js["resourceType"]) + inst2 = practitioner.Practitioner(js) + self.implPractitioner1(inst2) + + def implPractitioner1(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.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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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, "+31715269111") + self.assertEqual(inst.text.status, "generated") + + def testPractitioner2(self): + inst = self.instantiate_from("practitioner-example-f201-ab.json") + self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") + self.implPractitioner2(inst) + + js = inst.as_json() + self.assertEqual("Practitioner", js["resourceType"]) + inst2 = practitioner.Practitioner(js) + self.implPractitioner2(inst2) + + def implPractitioner2(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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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, "+31715269111") + self.assertEqual(inst.text.status, "generated") + + def testPractitioner3(self): + inst = self.instantiate_from("practitioner-example-f202-lm.json") + self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") + self.implPractitioner3(inst) + + js = inst.as_json() + self.assertEqual("Practitioner", js["resourceType"]) + inst2 = practitioner.Practitioner(js) + self.implPractitioner3(inst2) + + def implPractitioner3(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.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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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, "+31715269111") + self.assertEqual(inst.text.status, "generated") + + def testPractitioner4(self): + inst = self.instantiate_from("practitioner-example-xcda-author.json") + self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") + self.implPractitioner4(inst) + + js = inst.as_json() + self.assertEqual("Practitioner", js["resourceType"]) + inst2 = practitioner.Practitioner(js) + self.implPractitioner4(inst2) + + def implPractitioner4(self, inst): + 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.text.status, "generated") + + def testPractitioner5(self): + inst = self.instantiate_from("practitioner-example-f003-mv.json") + self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") + self.implPractitioner5(inst) + + js = inst.as_json() + self.assertEqual("Practitioner", js["resourceType"]) + inst2 = practitioner.Practitioner(js) + self.implPractitioner5(inst2) + + 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 91") + self.assertEqual(inst.address[0].postalCode, "1105 AZ") + 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: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, "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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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.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.text.status, "generated") + + def testPractitioner6(self): + inst = self.instantiate_from("practitioner-example-f002-pv.json") + self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") + self.implPractitioner6(inst) + + js = inst.as_json() + self.assertEqual("Practitioner", js["resourceType"]) + inst2 = practitioner.Practitioner(js) + self.implPractitioner6(inst2) + + def implPractitioner6(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.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, "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, "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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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, "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.text.status, "generated") + + def testPractitioner7(self): + inst = self.instantiate_from("practitioner-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") + self.implPractitioner7(inst) + + js = inst.as_json() + self.assertEqual("Practitioner", js["resourceType"]) + inst2 = practitioner.Practitioner(js) + 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") + self.assertEqual(inst.address[0].postalCode, "9105 PZ") + self.assertEqual(inst.address[0].use, "work") + self.assertEqual(inst.birthDate.date, FHIRDate("1971-11-07").date) + self.assertEqual(inst.birthDate.as_json(), "1971-11-07") + self.assertEqual(inst.gender, "female") + self.assertEqual(inst.id, "f007") + 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, "874635264") + 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") + 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, "020556936") + self.assertEqual(inst.telecom[1].system, "email") + self.assertEqual(inst.telecom[1].use, "work") + self.assertEqual(inst.telecom[1].value, "S.M.Heps@bmc.nl") + self.assertEqual(inst.telecom[2].system, "fax") + self.assertEqual(inst.telecom[2].use, "work") + self.assertEqual(inst.telecom[2].value, "0205669283") + self.assertEqual(inst.text.status, "generated") + + def testPractitioner9(self): + inst = self.instantiate_from("practitioner-example-f204-ce.json") + self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") + self.implPractitioner9(inst) + + js = inst.as_json() + self.assertEqual("Practitioner", js["resourceType"]) + inst2 = practitioner.Practitioner(js) + self.implPractitioner9(inst2) + + def implPractitioner9(self, inst): + 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("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, "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, "+31715262169") + self.assertEqual(inst.text.status, "generated") + + def testPractitioner10(self): + inst = self.instantiate_from("practitioner-example-xcda1.json") + self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") + self.implPractitioner10(inst) + + js = inst.as_json() + self.assertEqual("Practitioner", js["resourceType"]) + inst2 = practitioner.Practitioner(js) + self.implPractitioner10(inst2) + + def implPractitioner10(self, inst): + 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, "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/R4/practitionerrole.py b/fhirclient/models/R4/practitionerrole.py new file mode 100644 index 000000000..9531f01d3 --- /dev/null +++ b/fhirclient/models/R4/practitionerrole.py @@ -0,0 +1,218 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/PractitionerRole) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class PractitionerRole(domainresource.DomainResource): + """ Roles/organizations the practitioner is associated with. + + A specific set of Roles/Locations/specialties/services that a practitioner + may perform at an organization for a period of time. + """ + + resource_type = "PractitionerRole" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 practitioner role record is in active use. + Type `bool`. """ + + self.availabilityExceptions = None + """ Description of availability exceptions. + Type `str`. """ + + self.availableTime = None + """ Times the Service Site is available. + List of `PractitionerRoleAvailableTime` items (represented as `dict` in JSON). """ + + self.code = None + """ Roles which this practitioner may perform. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.endpoint = None + """ Technical endpoints providing access to services operated for the + practitioner with this role. + 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 (represented as `dict` in JSON). """ + + self.identifier = None + """ Business Identifiers that are specific to a role/location. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.location = None + """ The location(s) at which this practitioner provides care. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.notAvailable = None + """ Not available during this time due to provided reason. + List of `PractitionerRoleNotAvailable` items (represented as `dict` in JSON). """ + + self.organization = None + """ Organization where the roles are available. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.period = None + """ The period during which the practitioner is authorized to perform + in these role(s). + Type `Period` (represented as `dict` in JSON). """ + + self.practitioner = None + """ Practitioner that is able to provide the defined services for the + organization. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.specialty = None + """ Specific specialty of the practitioner. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.telecom = None + """ Contact details that are specific to the role/location/service. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(PractitionerRole, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PractitionerRole, self).elementProperties() + js.extend([ + ("active", "active", bool, False, None, False), + ("availabilityExceptions", "availabilityExceptions", str, False, None, False), + ("availableTime", "availableTime", PractitionerRoleAvailableTime, True, 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), + ("notAvailable", "notAvailable", PractitionerRoleNotAvailable, True, None, False), + ("organization", "organization", fhirreference.FHIRReference, False, None, False), + ("period", "period", period.Period, False, None, False), + ("practitioner", "practitioner", fhirreference.FHIRReference, False, None, False), + ("specialty", "specialty", codeableconcept.CodeableConcept, True, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ]) + return js + + +from . import backboneelement + +class PractitionerRoleAvailableTime(backboneelement.BackboneElement): + """ Times the Service Site is available. + + A collection of times the practitioner is available or performing this role + at the location and/or healthcareservice. + """ + + resource_type = "PractitionerRoleAvailableTime" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Always available? e.g. 24 hour service. + Type `bool`. """ + + self.availableEndTime = None + """ Closing time of day (ignored if allDay = true). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.availableStartTime = None + """ Opening time of day (ignored if allDay = true). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.daysOfWeek = None + """ mon | tue | wed | thu | fri | sat | sun. + List of `str` items. """ + + super(PractitionerRoleAvailableTime, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PractitionerRoleAvailableTime, self).elementProperties() + js.extend([ + ("allDay", "allDay", bool, False, None, False), + ("availableEndTime", "availableEndTime", fhirdate.FHIRDate, False, None, False), + ("availableStartTime", "availableStartTime", fhirdate.FHIRDate, False, None, False), + ("daysOfWeek", "daysOfWeek", str, True, None, False), + ]) + return js + + +class PractitionerRoleNotAvailable(backboneelement.BackboneElement): + """ Not available during this time due to provided reason. + + The practitioner is not available or performing this role during this + period of time due to the provided reason. + """ + + resource_type = "PractitionerRoleNotAvailable" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Reason presented to the user explaining why time not available. + Type `str`. """ + + self.during = None + """ Service not available from this date. + Type `Period` (represented as `dict` in JSON). """ + + super(PractitionerRoleNotAvailable, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PractitionerRoleNotAvailable, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, True), + ("during", "during", period.Period, False, 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 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/R4/practitionerrole_tests.py b/fhirclient/models/R4/practitionerrole_tests.py new file mode 100644 index 000000000..d09a21ab7 --- /dev/null +++ b/fhirclient/models/R4/practitionerrole_tests.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import practitionerrole +from .fhirdate import FHIRDate + + +class PractitionerRoleTests(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("PractitionerRole", js["resourceType"]) + return practitionerrole.PractitionerRole(js) + + def testPractitionerRole1(self): + inst = self.instantiate_from("practitionerrole-example.json") + self.assertIsNotNone(inst, "Must have instantiated a PractitionerRole instance") + self.implPractitionerRole1(inst) + + js = inst.as_json() + self.assertEqual("PractitionerRole", js["resourceType"]) + inst2 = practitionerrole.PractitionerRole(js) + self.implPractitionerRole1(inst2) + + def implPractitionerRole1(self, inst): + self.assertTrue(inst.active) + self.assertEqual(inst.availabilityExceptions, "Adam is generally unavailable on public holidays and during the Christmas/New Year break") + self.assertEqual(inst.availableTime[0].availableEndTime.date, FHIRDate("16:30:00").date) + self.assertEqual(inst.availableTime[0].availableEndTime.as_json(), "16:30:00") + self.assertEqual(inst.availableTime[0].availableStartTime.date, FHIRDate("09:00:00").date) + self.assertEqual(inst.availableTime[0].availableStartTime.as_json(), "09:00:00") + self.assertEqual(inst.availableTime[0].daysOfWeek[0], "mon") + self.assertEqual(inst.availableTime[0].daysOfWeek[1], "tue") + self.assertEqual(inst.availableTime[0].daysOfWeek[2], "wed") + self.assertEqual(inst.availableTime[1].availableEndTime.date, FHIRDate("12:00:00").date) + self.assertEqual(inst.availableTime[1].availableEndTime.as_json(), "12:00:00") + self.assertEqual(inst.availableTime[1].availableStartTime.date, FHIRDate("09:00:00").date) + self.assertEqual(inst.availableTime[1].availableStartTime.as_json(), "09:00:00") + 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://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") + self.assertEqual(inst.notAvailable[0].during.start.date, FHIRDate("2017-05-01").date) + self.assertEqual(inst.notAvailable[0].during.start.as_json(), "2017-05-01") + 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, "phone") + self.assertEqual(inst.telecom[0].use, "work") + self.assertEqual(inst.telecom[0].value, "(03) 5555 6473") + self.assertEqual(inst.telecom[1].system, "email") + self.assertEqual(inst.telecom[1].use, "work") + self.assertEqual(inst.telecom[1].value, "adam.southern@example.org") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/R4/procedure.py b/fhirclient/models/R4/procedure.py new file mode 100644 index 000000000..404161254 --- /dev/null +++ b/fhirclient/models/R4/procedure.py @@ -0,0 +1,309 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Procedure) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Procedure(domainresource.DomainResource): + """ An action that is being or was performed on a patient. + + 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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 (represented as `dict` in JSON). """ + + self.bodySite = None + """ Target body sites. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.category = None + """ Classification of the procedure. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.code = None + """ Identification of the procedure. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.complication = None + """ Complication following the procedure. + 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 (represented as `dict` in JSON). """ + + self.encounter = None + """ Encounter created as part of. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.focalDevice = None + """ Manipulated, implanted, or removed device. + List of `ProcedureFocalDevice` items (represented as `dict` in JSON). """ + + self.followUp = None + """ Instructions for follow up. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.identifier = None + """ External Identifiers for this procedure. + 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.location = None + """ Where the procedure happened. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.note = None + """ Additional information about the procedure. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.outcome = None + """ The result of procedure. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.partOf = None + """ Part of referenced event. + 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 + """ When the procedure was performed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.performedPeriod = None + """ 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). """ + + self.reasonCode = None + """ Coded reason procedure performed. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.reasonReference = None + """ 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 (represented as `dict` in JSON). """ + + self.status = None + """ 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` (represented as `dict` in JSON). """ + + self.usedCode = None + """ Coded items used during the procedure. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.usedReference = None + """ Items used during procedure. + 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), + ("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), + ("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), + ]) + return js + + +from . import backboneelement + +class ProcedureFocalDevice(backboneelement.BackboneElement): + """ 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 + a focal portion of the Procedure. + """ + + resource_type = "ProcedureFocalDevice" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Kind of change to device. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.manipulated = None + """ Device that was changed. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(ProcedureFocalDevice, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ProcedureFocalDevice, self).elementProperties() + js.extend([ + ("action", "action", codeableconcept.CodeableConcept, False, None, False), + ("manipulated", "manipulated", fhirreference.FHIRReference, False, None, True), + ]) + return js + + +class ProcedurePerformer(backboneelement.BackboneElement): + """ The people who performed the procedure. + + Limited to "real" people rather than equipment. + """ + + resource_type = "ProcedurePerformer" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ The reference to the practitioner. + 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` (represented as `dict` in JSON). """ + + super(ProcedurePerformer, self).__init__(jsondict=jsondict, strict=strict) + + 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), + ]) + return js + + +import sys +try: + from . import age +except ImportError: + age = sys.modules[__package__ + '.age'] +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'] +try: + from . import range +except ImportError: + range = sys.modules[__package__ + '.range'] diff --git a/fhirclient/models/R4/procedure_tests.py b/fhirclient/models/R4/procedure_tests.py new file mode 100644 index 000000000..270b5f27b --- /dev/null +++ b/fhirclient/models/R4/procedure_tests.py @@ -0,0 +1,325 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import procedure +from .fhirdate import FHIRDate + + +class ProcedureTests(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("Procedure", js["resourceType"]) + return procedure.Procedure(js) + + def testProcedure1(self): + inst = self.instantiate_from("procedure-example-f201-tpf.json") + self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") + self.implProcedure1(inst) + + js = inst.as_json() + self.assertEqual("Procedure", js["resourceType"]) + inst2 = procedure.Procedure(js) + self.implProcedure1(inst2) + + def implProcedure1(self, inst): + 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.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-ambulation.json") + self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") + self.implProcedure2(inst) + + js = inst.as_json() + self.assertEqual("Procedure", js["resourceType"]) + inst2 = procedure.Procedure(js) + self.implProcedure2(inst2) + + def implProcedure2(self, inst): + 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-implant.json") + self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") + self.implProcedure3(inst) + + js = inst.as_json() + self.assertEqual("Procedure", js["resourceType"]) + inst2 = procedure.Procedure(js) + self.implProcedure3(inst2) + + def implProcedure3(self, inst): + 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.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.status, "generated") + + def testProcedure4(self): + inst = self.instantiate_from("procedure-example-colon-biopsy.json") + self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") + self.implProcedure4(inst) + + js = inst.as_json() + self.assertEqual("Procedure", js["resourceType"]) + inst2 = procedure.Procedure(js) + self.implProcedure4(inst2) + + def implProcedure4(self, inst): + 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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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-f004-tracheotomy.json") + self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") + self.implProcedure5(inst) + + js = inst.as_json() + self.assertEqual("Procedure", js["resourceType"]) + inst2 = procedure.Procedure(js) + self.implProcedure5(inst2) + + def implProcedure5(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].system, "http://snomed.info/sct") + 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.status, "generated") + + def testProcedure6(self): + inst = self.instantiate_from("procedure-example-education.json") + self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") + self.implProcedure6(inst) + + js = inst.as_json() + self.assertEqual("Procedure", js["resourceType"]) + inst2 = procedure.Procedure(js) + self.implProcedure6(inst2) + + def implProcedure6(self, inst): + self.assertEqual(inst.category.coding[0].code, "311401005") + self.assertEqual(inst.category.coding[0].display, "Patient education (procedure)") + self.assertEqual(inst.category.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.category.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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.div, "
Health education - breast examination for early detection of breast mass
") + self.assertEqual(inst.text.status, "generated") + + def testProcedure7(self): + inst = self.instantiate_from("procedure-example-colonoscopy.json") + self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") + self.implProcedure7(inst) + + js = inst.as_json() + self.assertEqual("Procedure", js["resourceType"]) + inst2 = procedure.Procedure(js) + self.implProcedure7(inst2) + + def implProcedure7(self, inst): + 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, "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-physical-therapy.json") + self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") + self.implProcedure8(inst) + + js = inst.as_json() + self.assertEqual("Procedure", js["resourceType"]) + inst2 = procedure.Procedure(js) + self.implProcedure8(inst2) + + def implProcedure8(self, inst): + 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.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.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): + inst = self.instantiate_from("procedure-example-f003-abscess.json") + self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") + self.implProcedure9(inst) + + js = inst.as_json() + self.assertEqual("Procedure", js["resourceType"]) + inst2 = procedure.Procedure(js) + self.implProcedure9(inst2) + + def implProcedure9(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, "172960003") + self.assertEqual(inst.code.coding[0].display, "Incision of retropharyngeal abscess") + 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].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.json") + self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") + self.implProcedure10(inst) + + js = inst.as_json() + self.assertEqual("Procedure", js["resourceType"]) + inst2 = procedure.Procedure(js) + self.implProcedure10(inst2) + + def implProcedure10(self, inst): + 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.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/prodcharacteristic.py b/fhirclient/models/R4/prodcharacteristic.py similarity index 99% rename from fhirclient/models/prodcharacteristic.py rename to fhirclient/models/R4/prodcharacteristic.py index 8a2b5c6a2..409ea09d1 100644 --- a/fhirclient/models/prodcharacteristic.py +++ b/fhirclient/models/R4/prodcharacteristic.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ProdCharacteristic) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ProdCharacteristic) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/productshelflife.py b/fhirclient/models/R4/productshelflife.py similarity index 98% rename from fhirclient/models/productshelflife.py rename to fhirclient/models/R4/productshelflife.py index 140062f07..ef00dd298 100644 --- a/fhirclient/models/productshelflife.py +++ b/fhirclient/models/R4/productshelflife.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ProductShelfLife) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ProductShelfLife) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/R4/provenance.py b/fhirclient/models/R4/provenance.py new file mode 100644 index 000000000..d83392b25 --- /dev/null +++ b/fhirclient/models/R4/provenance.py @@ -0,0 +1,205 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Provenance) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Provenance(domainresource.DomainResource): + """ Who, What, When for a set of resources. + + Provenance of a resource is a record that describes entities and processes + involved in producing and delivering or otherwise influencing that + resource. Provenance provides a critical foundation for assessing + authenticity, enabling trust, and allowing reproducibility. Provenance + assertions are a form of contextual metadata and can themselves become + important records with their own provenance. Provenance statement indicates + clinical significance in terms of confidence in authenticity, reliability, + and trustworthiness, integrity, and stage in lifecycle (e.g. Document + Completion - has the artifact been legally authenticated), all of which may + impact security, privacy, and trust policies. + """ + + resource_type = "Provenance" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.activity = None + """ Activity that occurred. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.agent = None + """ Actor involved. + List of `ProvenanceAgent` items (represented as `dict` in JSON). """ + + self.entity = None + """ An entity used in this activity. + List of `ProvenanceEntity` items (represented as `dict` in JSON). """ + + self.location = None + """ Where the activity occurred, if relevant. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.occurredDateTime = None + """ When the activity occurred. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.occurredPeriod = None + """ When the activity occurred. + Type `Period` (represented as `dict` in JSON). """ + + self.policy = None + """ Policy or plan the activity was defined by. + List of `str` items. """ + + self.reason = None + """ Reason the activity is occurring. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.recorded = None + """ When the activity was recorded / updated. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.signature = None + """ Signature on target. + List of `Signature` items (represented as `dict` in JSON). """ + + self.target = None + """ Target Reference(s) (usually version specific). + 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", codeableconcept.CodeableConcept, False, None, False), + ("agent", "agent", ProvenanceAgent, True, None, True), + ("entity", "entity", ProvenanceEntity, True, None, False), + ("location", "location", fhirreference.FHIRReference, 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", 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), + ]) + return js + + +from . import backboneelement + +class ProvenanceAgent(backboneelement.BackboneElement): + """ Actor involved. + + 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 = "ProvenanceAgent" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.onBehalfOf = None + """ Who the agent is representing. + 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.type = None + """ How the agent participated. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.who = None + """ Who participated. + 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([ + ("onBehalfOf", "onBehalfOf", fhirreference.FHIRReference, False, None, False), + ("role", "role", codeableconcept.CodeableConcept, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("who", "who", fhirreference.FHIRReference, False, None, True), + ]) + return js + + +class ProvenanceEntity(backboneelement.BackboneElement): + """ An entity used in this activity. + """ + + resource_type = "ProvenanceEntity" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Entity is attributed to this agent. + List of `ProvenanceAgent` items (represented as `dict` in JSON). """ + + self.role = None + """ derivation | revision | quotation | source | removal. + Type `str`. """ + + self.what = None + """ Identity of entity. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(ProvenanceEntity, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ProvenanceEntity, self).elementProperties() + js.extend([ + ("agent", "agent", ProvenanceAgent, True, None, False), + ("role", "role", str, False, None, True), + ("what", "what", 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 period +except ImportError: + period = sys.modules[__package__ + '.period'] +try: + from . import signature +except ImportError: + signature = sys.modules[__package__ + '.signature'] diff --git a/fhirclient/models/R4/provenance_tests.py b/fhirclient/models/R4/provenance_tests.py new file mode 100644 index 000000000..5a980e177 --- /dev/null +++ b/fhirclient/models/R4/provenance_tests.py @@ -0,0 +1,142 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import provenance +from .fhirdate import FHIRDate + + +class ProvenanceTests(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("Provenance", js["resourceType"]) + return provenance.Provenance(js) + + def testProvenance1(self): + inst = self.instantiate_from("provenance-example-sig.json") + self.assertIsNotNone(inst, "Must have instantiated a Provenance instance") + self.implProvenance1(inst) + + js = inst.as_json() + self.assertEqual("Provenance", js["resourceType"]) + inst2 = provenance.Provenance(js) + self.implProvenance1(inst2) + + def implProvenance1(self, inst): + 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): + inst = self.instantiate_from("provenance-example-cwl.json") + self.assertIsNotNone(inst, "Must have instantiated a Provenance instance") + self.implProvenance2(inst) + + js = inst.as_json() + self.assertEqual("Provenance", js["resourceType"]) + inst2 = provenance.Provenance(js) + self.implProvenance2(inst2) + + def implProvenance2(self, inst): + 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-cwl") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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-biocompute-object.json") + self.assertIsNotNone(inst, "Must have instantiated a Provenance instance") + self.implProvenance3(inst) + + js = inst.as_json() + self.assertEqual("Provenance", js["resourceType"]) + inst2 = provenance.Provenance(js) + self.implProvenance3(inst2) + + def implProvenance3(self, inst): + 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): + inst = self.instantiate_from("provenance-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Provenance instance") + self.implProvenance4(inst) + + js = inst.as_json() + self.assertEqual("Provenance", js["resourceType"]) + inst2 = provenance.Provenance(js) + self.implProvenance4(inst2) + + def implProvenance4(self, inst): + 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].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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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].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.status, "generated") + diff --git a/fhirclient/models/R4/quantity.py b/fhirclient/models/R4/quantity.py new file mode 100644 index 000000000..eb2ab7f76 --- /dev/null +++ b/fhirclient/models/R4/quantity.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MoneyQuantity) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Quantity(element.Element): + """ A measured or measurable amount. + + A measured amount (or an amount that can potentially be measured). Note + that measured amounts include amounts that are not precisely quantified, + including amounts involving arbitrary units and floating currencies. + """ + + resource_type = "Quantity" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 form of the unit. + Type `str`. """ + + self.comparator = None + """ < | <= | >= | > - how to understand the value. + Type `str`. """ + + self.system = None + """ System that defines coded unit form. + Type `str`. """ + + self.unit = None + """ Unit representation. + Type `str`. """ + + self.value = None + """ Numerical value (with implicit precision). + Type `float`. """ + + super(Quantity, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Quantity, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, False), + ("comparator", "comparator", str, False, None, False), + ("system", "system", str, False, None, False), + ("unit", "unit", str, False, None, False), + ("value", "value", float, False, None, False), + ]) + return js + + diff --git a/fhirclient/models/R4/questionnaire.py b/fhirclient/models/R4/questionnaire.py new file mode 100644 index 000000000..83e28970c --- /dev/null +++ b/fhirclient/models/R4/questionnaire.py @@ -0,0 +1,530 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Questionnaire) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Questionnaire(domainresource.DomainResource): + """ A structured set of questions. + + A structured set of questions intended to guide the collection of answers + from end-users. Questionnaires provide detailed control over order, + presentation, phraseology and grouping to allow coherent, consistent data + collection. + """ + + resource_type = "Questionnaire" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 questionnaire was approved by publisher. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.code = None + """ Concept that represents the overall questionnaire. + List of `Coding` 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.derivedFrom = None + """ Instantiates protocol or definition. + List of `str` items. """ + + self.description = None + """ Natural language description of the questionnaire. + Type `str`. """ + + self.effectivePeriod = None + """ When the questionnaire 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 questionnaire. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.item = None + """ Questions and sections within the Questionnaire. + List of `QuestionnaireItem` items (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ Intended jurisdiction for questionnaire (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.lastReviewDate = None + """ When the questionnaire was last reviewed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.name = None + """ Name for this questionnaire (computer friendly). + Type `str`. """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this questionnaire is defined. + Type `str`. """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.subjectType = None + """ Resource that can be subject of QuestionnaireResponse. + List of `str` items. """ + + self.title = None + """ Name for this questionnaire (human friendly). + Type `str`. """ + + self.url = None + """ Canonical identifier for this questionnaire, 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 questionnaire. + Type `str`. """ + + super(Questionnaire, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Questionnaire, self).elementProperties() + js.extend([ + ("approvalDate", "approvalDate", fhirdate.FHIRDate, False, None, False), + ("code", "code", coding.Coding, True, None, False), + ("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), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("item", "item", QuestionnaireItem, True, None, False), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("lastReviewDate", "lastReviewDate", fhirdate.FHIRDate, False, None, False), + ("name", "name", str, False, None, False), + ("publisher", "publisher", str, False, None, False), + ("purpose", "purpose", str, False, None, False), + ("status", "status", str, False, None, True), + ("subjectType", "subjectType", str, True, 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 QuestionnaireItem(backboneelement.BackboneElement): + """ Questions and sections within the Questionnaire. + + A particular question, question grouping or display text that is part of + the questionnaire. + """ + + resource_type = "QuestionnaireItem" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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). """ + + self.definition = None + """ 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.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. + List of `QuestionnaireItem` items (represented as `dict` in JSON). """ + + self.linkId = None + """ Unique id for item in questionnaire. + Type `str`. """ + + self.maxLength = None + """ No more than this many characters. + Type `int`. """ + + self.prefix = None + """ E.g. "1(a)", "2.5.3". + Type `str`. """ + + self.readOnly = None + """ Don't allow human editing. + Type `bool`. """ + + self.repeats = None + """ Whether the item may repeat. + Type `bool`. """ + + self.required = None + """ Whether the item must be included in data results. + Type `bool`. """ + + self.text = None + """ Primary text for the item. + Type `str`. """ + + self.type = None + """ group | display | boolean | decimal | integer | date | dateTime +. + Type `str`. """ + + super(QuestionnaireItem, self).__init__(jsondict=jsondict, strict=strict) + + 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), + ("initial", "initial", QuestionnaireItemInitial, True, None, False), + ("item", "item", QuestionnaireItem, True, None, False), + ("linkId", "linkId", str, False, None, True), + ("maxLength", "maxLength", int, False, None, False), + ("prefix", "prefix", str, False, None, False), + ("readOnly", "readOnly", bool, False, None, False), + ("repeats", "repeats", bool, False, None, False), + ("required", "required", bool, False, None, False), + ("text", "text", str, False, None, False), + ("type", "type", str, False, None, True), + ]) + 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. + + A constraint indicating that this item should only be enabled + (displayed/allow answers to be captured) when the specified condition is + true. + """ + + resource_type = "QuestionnaireItemEnableWhen" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.answerBoolean = None + """ Value for question comparison based on operator. + Type `bool`. """ + + self.answerCoding = None + """ Value for question comparison based on operator. + Type `Coding` (represented as `dict` in JSON). """ + + self.answerDate = None + """ Value for question comparison based on operator. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.answerDateTime = None + """ Value for question comparison based on operator. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.answerDecimal = None + """ Value for question comparison based on operator. + Type `float`. """ + + self.answerInteger = None + """ Value for question comparison based on operator. + Type `int`. """ + + self.answerQuantity = None + """ Value for question comparison based on operator. + Type `Quantity` (represented as `dict` in JSON). """ + + self.answerReference = None + """ Value for question comparison based on operator. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.answerString = None + """ Value for question comparison based on operator. + Type `str`. """ + + self.answerTime = None + """ Value for question comparison based on operator. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.operator = None + """ exists | = | != | > | < | >= | <=. + Type `str`. """ + + self.question = None + """ Question that determines whether item is enabled. + Type `str`. """ + + super(QuestionnaireItemEnableWhen, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(QuestionnaireItemEnableWhen, self).elementProperties() + js.extend([ + ("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 QuestionnaireItemInitial(backboneelement.BackboneElement): + """ Initial value(s) when item is first rendered. + + One or more values that should be pre-populated in the answer when + initially rendering the questionnaire for user input. + """ + + resource_type = "QuestionnaireItemInitial" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ 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 + """ Actual value for initializing the question. + Type `Coding` (represented as `dict` in JSON). """ + + self.valueDate = None + """ 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 + """ 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 + """ Actual value for initializing the question. + Type `str`. """ + + self.valueTime = None + """ Actual value for initializing the question. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueUri = None + """ Actual value for initializing the question. + Type `str`. """ + + super(QuestionnaireItemInitial, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + 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 + + +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 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 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 quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] +try: + from . import usagecontext +except ImportError: + usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/R4/questionnaire_tests.py b/fhirclient/models/R4/questionnaire_tests.py new file mode 100644 index 000000000..5d59b29c1 --- /dev/null +++ b/fhirclient/models/R4/questionnaire_tests.py @@ -0,0 +1,366 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import questionnaire +from .fhirdate import FHIRDate + + +class QuestionnaireTests(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("Questionnaire", js["resourceType"]) + return questionnaire.Questionnaire(js) + + def testQuestionnaire1(self): + inst = self.instantiate_from("questionnaire-cqf-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Questionnaire instance") + self.implQuestionnaire1(inst) + + js = inst.as_json() + self.assertEqual("Questionnaire", js["resourceType"]) + inst2 = questionnaire.Questionnaire(js) + self.implQuestionnaire1(inst2) + + def implQuestionnaire1(self, inst): + 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, "Patient Health Questionnaire (PHQ-9)") + self.assertEqual(inst.version, "1.0.0") + + def testQuestionnaire2(self): + inst = self.instantiate_from("questionnaire-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Questionnaire instance") + self.implQuestionnaire2(inst) + + js = inst.as_json() + self.assertEqual("Questionnaire", js["resourceType"]) + inst2 = questionnaire.Questionnaire(js) + 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") + self.assertEqual(inst.date.date, FHIRDate("2010").date) + self.assertEqual(inst.date.as_json(), "2010") + self.assertEqual(inst.id, "f201") + self.assertEqual(inst.item[0].linkId, "1") + self.assertEqual(inst.item[0].text, "Do you have allergies?") + self.assertEqual(inst.item[0].type, "boolean") + 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[0].type, "string") + 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[1].type, "date") + 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[2].type, "string") + 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].item[3].type, "string") + self.assertEqual(inst.item[1].linkId, "2") + self.assertEqual(inst.item[1].text, "General questions") + self.assertEqual(inst.item[1].type, "group") + 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[0].type, "boolean") + 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].item[1].type, "boolean") + self.assertEqual(inst.item[2].linkId, "3") + self.assertEqual(inst.item[2].text, "Intoxications") + self.assertEqual(inst.item[2].type, "group") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.subjectType[0], "Patient") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.url, "http://hl7.org/fhir/Questionnaire/f201") + + def testQuestionnaire4(self): + inst = self.instantiate_from("questionnaire-example-gcs.json") + self.assertIsNotNone(inst, "Must have instantiated a Questionnaire instance") + self.implQuestionnaire4(inst) + + js = inst.as_json() + self.assertEqual("Questionnaire", js["resourceType"]) + inst2 = questionnaire.Questionnaire(js) + self.implQuestionnaire4(inst2) + + 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") + self.assertEqual(inst.contained[1].id, "verbal") + self.assertEqual(inst.contained[2].id, "eye") + 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") + self.assertEqual(inst.item[2].type, "choice") + self.assertEqual(inst.publisher, "FHIR Project team") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.subjectType[0], "Patient") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "Glasgow Coma Score") + self.assertEqual(inst.url, "http://hl7.org/fhir/Questionnaire/gcs") + + def testQuestionnaire5(self): + inst = self.instantiate_from("questionnaire-example-bluebook.json") + self.assertIsNotNone(inst, "Must have instantiated a Questionnaire instance") + self.implQuestionnaire5(inst) + + js = inst.as_json() + self.assertEqual("Questionnaire", js["resourceType"]) + inst2 = questionnaire.Questionnaire(js) + self.implQuestionnaire5(inst2) + + 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.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, "NSW Government My Personal Health Record") + self.assertEqual(inst.url, "http://hl7.org/fhir/Questionnaire/bb") + diff --git a/fhirclient/models/R4/questionnaireresponse.py b/fhirclient/models/R4/questionnaireresponse.py new file mode 100644 index 000000000..36dab4281 --- /dev/null +++ b/fhirclient/models/R4/questionnaireresponse.py @@ -0,0 +1,259 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class QuestionnaireResponse(domainresource.DomainResource): + """ A structured set of questions and their answers. + + A structured set of questions and their answers. The questions are ordered + and grouped into coherent subsets, corresponding to the structure of the + grouping of the questionnaire being responded to. + """ + + resource_type = "QuestionnaireResponse" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Person who received and recorded the answers. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.authored = None + """ Date the answers were gathered. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.basedOn = None + """ Request fulfilled by this QuestionnaireResponse. + List of `FHIRReference` items (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. + Type `Identifier` (represented as `dict` in JSON). """ + + self.item = None + """ Groups and questions. + List of `QuestionnaireResponseItem` items (represented as `dict` in JSON). """ + + self.partOf = None + """ Part of this action. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.questionnaire = None + """ Form being answered. + Type `str`. """ + + self.source = None + """ The person who answered the questions. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.status = None + """ in-progress | completed | amended | entered-in-error | stopped. + Type `str`. """ + + self.subject = None + """ The subject of the questions. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(QuestionnaireResponse, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(QuestionnaireResponse, self).elementProperties() + js.extend([ + ("author", "author", fhirreference.FHIRReference, False, None, False), + ("authored", "authored", fhirdate.FHIRDate, False, None, False), + ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("item", "item", QuestionnaireResponseItem, True, 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), + ]) + return js + + +from . import backboneelement + +class QuestionnaireResponseItem(backboneelement.BackboneElement): + """ Groups and questions. + + A group or question item from the original questionnaire for which answers + are provided. + """ + + resource_type = "QuestionnaireResponseItem" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ The response(s) to the question. + List of `QuestionnaireResponseItemAnswer` items (represented as `dict` in JSON). """ + + self.definition = None + """ ElementDefinition - details for the item. + Type `str`. """ + + self.item = None + """ Nested questionnaire response items. + List of `QuestionnaireResponseItem` items (represented as `dict` in JSON). """ + + self.linkId = None + """ Pointer to specific item from Questionnaire. + Type `str`. """ + + self.text = None + """ Name for group or question text. + Type `str`. """ + + super(QuestionnaireResponseItem, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(QuestionnaireResponseItem, self).elementProperties() + js.extend([ + ("answer", "answer", QuestionnaireResponseItemAnswer, True, None, False), + ("definition", "definition", str, False, None, False), + ("item", "item", QuestionnaireResponseItem, True, None, False), + ("linkId", "linkId", str, False, None, True), + ("text", "text", str, False, None, False), + ]) + return js + + +class QuestionnaireResponseItemAnswer(backboneelement.BackboneElement): + """ The response(s) to the question. + + The respondent's answer(s) to the question. + """ + + resource_type = "QuestionnaireResponseItemAnswer" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Nested groups and questions. + List of `QuestionnaireResponseItem` items (represented as `dict` in JSON). """ + + self.valueAttachment = None + """ Single-valued answer to the question. + Type `Attachment` (represented as `dict` in JSON). """ + + self.valueBoolean = None + """ Single-valued answer to the question. + Type `bool`. """ + + self.valueCoding = None + """ Single-valued answer to the question. + Type `Coding` (represented as `dict` in JSON). """ + + self.valueDate = None + """ Single-valued answer to the question. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueDateTime = None + """ Single-valued answer to the question. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueDecimal = None + """ Single-valued answer to the question. + Type `float`. """ + + self.valueInteger = None + """ Single-valued answer to the question. + Type `int`. """ + + self.valueQuantity = None + """ Single-valued answer to the question. + Type `Quantity` (represented as `dict` in JSON). """ + + self.valueReference = None + """ Single-valued answer to the question. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.valueString = None + """ Single-valued answer to the question. + Type `str`. """ + + self.valueTime = None + """ Single-valued answer to the question. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueUri = None + """ Single-valued answer to the question. + Type `str`. """ + + super(QuestionnaireResponseItemAnswer, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(QuestionnaireResponseItemAnswer, self).elementProperties() + js.extend([ + ("item", "item", QuestionnaireResponseItem, True, None, False), + ("valueAttachment", "valueAttachment", attachment.Attachment, False, "value", False), + ("valueBoolean", "valueBoolean", bool, False, "value", False), + ("valueCoding", "valueCoding", coding.Coding, False, "value", False), + ("valueDate", "valueDate", fhirdate.FHIRDate, False, "value", False), + ("valueDateTime", "valueDateTime", fhirdate.FHIRDate, False, "value", False), + ("valueDecimal", "valueDecimal", float, False, "value", False), + ("valueInteger", "valueInteger", int, False, "value", False), + ("valueQuantity", "valueQuantity", quantity.Quantity, False, "value", False), + ("valueReference", "valueReference", fhirreference.FHIRReference, False, "value", False), + ("valueString", "valueString", str, False, "value", False), + ("valueTime", "valueTime", fhirdate.FHIRDate, False, "value", False), + ("valueUri", "valueUri", str, False, "value", False), + ]) + return js + + +import sys +try: + from . import attachment +except ImportError: + attachment = sys.modules[__package__ + '.attachment'] +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 quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/R4/questionnaireresponse_tests.py b/fhirclient/models/R4/questionnaireresponse_tests.py new file mode 100644 index 000000000..0ccad0350 --- /dev/null +++ b/fhirclient/models/R4/questionnaireresponse_tests.py @@ -0,0 +1,775 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import questionnaireresponse +from .fhirdate import FHIRDate + + +class QuestionnaireResponseTests(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("QuestionnaireResponse", js["resourceType"]) + return questionnaireresponse.QuestionnaireResponse(js) + + def testQuestionnaireResponse1(self): + inst = self.instantiate_from("questionnaireresponse-example.json") + self.assertIsNotNone(inst, "Must have instantiated a QuestionnaireResponse instance") + self.implQuestionnaireResponse1(inst) + + js = inst.as_json() + self.assertEqual("QuestionnaireResponse", js["resourceType"]) + inst2 = questionnaireresponse.QuestionnaireResponse(js) + self.implQuestionnaireResponse1(inst2) + + def implQuestionnaireResponse1(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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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-ussg-fht-answers.json") + self.assertIsNotNone(inst, "Must have instantiated a QuestionnaireResponse instance") + self.implQuestionnaireResponse2(inst) + + js = inst.as_json() + self.assertEqual("QuestionnaireResponse", js["resourceType"]) + inst2 = questionnaireresponse.QuestionnaireResponse(js) + self.implQuestionnaireResponse2(inst2) + + def implQuestionnaireResponse2(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") + self.assertEqual(inst.item[0].item[0].answer[0].valueDate.date, FHIRDate("2008-01-17").date) + self.assertEqual(inst.item[0].item[0].answer[0].valueDate.as_json(), "2008-01-17") + self.assertEqual(inst.item[0].item[0].linkId, "0.1") + self.assertEqual(inst.item[0].item[0].text, "Date Done") + self.assertEqual(inst.item[0].linkId, "0") + self.assertEqual(inst.item[1].definition, "http://loinc.org/fhir/DataElement/54126-8") + self.assertEqual(inst.item[1].item[0].item[0].answer[0].valueString, "Annie Proband") + self.assertEqual(inst.item[1].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54125-0") + self.assertEqual(inst.item[1].item[0].item[0].linkId, "1.1.1") + self.assertEqual(inst.item[1].item[0].item[0].text, "Name") + self.assertEqual(inst.item[1].item[0].item[1].answer[0].valueCoding.code, "LA3-6") + self.assertEqual(inst.item[1].item[0].item[1].answer[0].valueCoding.display, "Female") + self.assertEqual(inst.item[1].item[0].item[1].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[1].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54131-8") + self.assertEqual(inst.item[1].item[0].item[1].linkId, "1.1.2") + self.assertEqual(inst.item[1].item[0].item[1].text, "Gender") + self.assertEqual(inst.item[1].item[0].item[2].answer[0].valueDate.date, FHIRDate("1966-04-04").date) + self.assertEqual(inst.item[1].item[0].item[2].answer[0].valueDate.as_json(), "1966-04-04") + self.assertEqual(inst.item[1].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/21112-8") + self.assertEqual(inst.item[1].item[0].item[2].linkId, "1.1.3") + self.assertEqual(inst.item[1].item[0].item[2].text, "Date of Birth") + self.assertEqual(inst.item[1].item[0].item[3].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[1].item[0].item[3].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[1].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[1].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54132-6") + self.assertEqual(inst.item[1].item[0].item[3].linkId, "1.1.4") + self.assertEqual(inst.item[1].item[0].item[3].text, "Were you born a twin?") + self.assertEqual(inst.item[1].item[0].item[4].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[1].item[0].item[4].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[1].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[1].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54128-4") + self.assertEqual(inst.item[1].item[0].item[4].linkId, "1.1.5") + self.assertEqual(inst.item[1].item[0].item[4].text, "Were you adopted?") + self.assertEqual(inst.item[1].item[0].item[5].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[1].item[0].item[5].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[1].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[1].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54135-9") + self.assertEqual(inst.item[1].item[0].item[5].linkId, "1.1.6") + self.assertEqual(inst.item[1].item[0].item[5].text, "Are your parents related to each other in any way other than marriage?") + self.assertEqual(inst.item[1].item[0].item[6].answer[0].item[0].item[0].answer[0].valueCoding.code, "[in_i]") + self.assertEqual(inst.item[1].item[0].item[6].answer[0].item[0].item[0].answer[0].valueCoding.display, "inches") + self.assertEqual(inst.item[1].item[0].item[6].answer[0].item[0].item[0].answer[0].valueCoding.system, "http://unitsofmeasure.org") + self.assertEqual(inst.item[1].item[0].item[6].answer[0].item[0].item[0].linkId, "1.1.7.1.1") + self.assertEqual(inst.item[1].item[0].item[6].answer[0].item[0].item[0].text, "Units") + self.assertEqual(inst.item[1].item[0].item[6].answer[0].item[0].linkId, "1.1.7.1") + self.assertEqual(inst.item[1].item[0].item[6].answer[0].valueDecimal, 63) + 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_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") + self.assertEqual(inst.item[1].item[0].item[7].answer[0].item[0].item[0].text, "Units") + self.assertEqual(inst.item[1].item[0].item[7].answer[0].item[0].linkId, "1.1.8.1") + self.assertEqual(inst.item[1].item[0].item[7].answer[0].valueDecimal, 127) + self.assertEqual(inst.item[1].item[0].item[7].definition, "http://loinc.org/fhir/DataElement/29463-7") + self.assertEqual(inst.item[1].item[0].item[7].linkId, "1.1.8") + self.assertEqual(inst.item[1].item[0].item[7].text, "Weight") + self.assertEqual(inst.item[1].item[0].item[8].answer[0].valueDecimal, 22.5) + self.assertEqual(inst.item[1].item[0].item[8].definition, "http://loinc.org/fhir/DataElement/39156-5") + self.assertEqual(inst.item[1].item[0].item[8].linkId, "1.1.9") + self.assertEqual(inst.item[1].item[0].item[8].text, "Body mass index (BMI) [Ratio]") + self.assertEqual(inst.item[1].item[0].item[9].answer[0].valueCoding.code, "LA4457-3") + self.assertEqual(inst.item[1].item[0].item[9].answer[0].valueCoding.display, "White") + self.assertEqual(inst.item[1].item[0].item[9].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[1].item[0].item[9].definition, "http://loinc.org/fhir/DataElement/54134-2") + self.assertEqual(inst.item[1].item[0].item[9].linkId, "1.1.10") + self.assertEqual(inst.item[1].item[0].item[9].text, "Race") + self.assertEqual(inst.item[1].item[0].linkId, "1.1") + 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].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") + self.assertEqual(inst.item[2].item[1].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[1].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54136-7") + self.assertEqual(inst.item[2].item[1].item[0].item[0].linkId, "2.1.1.1") + self.assertEqual(inst.item[2].item[1].item[0].item[0].text, "Relationship to you") + self.assertEqual(inst.item[2].item[1].item[0].item[1].answer[0].valueString, "Brian") + self.assertEqual(inst.item[2].item[1].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54138-3") + self.assertEqual(inst.item[2].item[1].item[0].item[1].linkId, "2.1.1.2") + self.assertEqual(inst.item[2].item[1].item[0].item[1].text, "Name") + self.assertEqual(inst.item[2].item[1].item[0].item[2].answer[0].valueCoding.code, "LA2-8") + self.assertEqual(inst.item[2].item[1].item[0].item[2].answer[0].valueCoding.display, "Male") + self.assertEqual(inst.item[2].item[1].item[0].item[2].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[1].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/54123-5") + self.assertEqual(inst.item[2].item[1].item[0].item[2].linkId, "2.1.1.3") + self.assertEqual(inst.item[2].item[1].item[0].item[2].text, "Gender") + self.assertEqual(inst.item[2].item[1].item[0].item[3].answer[0].item[0].item[0].answer[0].valueDecimal, 32) + self.assertEqual(inst.item[2].item[1].item[0].item[3].answer[0].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54141-7") + self.assertEqual(inst.item[2].item[1].item[0].item[3].answer[0].item[0].item[0].linkId, "2.1.1.4.2.2") + self.assertEqual(inst.item[2].item[1].item[0].item[3].answer[0].item[0].item[0].text, "Age") + self.assertEqual(inst.item[2].item[1].item[0].item[3].answer[0].item[0].linkId, "2.1.1.4.2") + self.assertEqual(inst.item[2].item[1].item[0].item[3].answer[0].valueCoding.code, "LA33-6") + self.assertEqual(inst.item[2].item[1].item[0].item[3].answer[0].valueCoding.display, "Yes") + self.assertEqual(inst.item[2].item[1].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[1].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54139-1") + self.assertEqual(inst.item[2].item[1].item[0].item[3].linkId, "2.1.1.4") + self.assertEqual(inst.item[2].item[1].item[0].item[3].text, "Living?") + self.assertEqual(inst.item[2].item[1].item[0].item[4].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[1].item[0].item[4].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[1].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[1].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54121-9") + self.assertEqual(inst.item[2].item[1].item[0].item[4].linkId, "2.1.1.5") + self.assertEqual(inst.item[2].item[1].item[0].item[4].text, "Was this person born a twin?") + self.assertEqual(inst.item[2].item[1].item[0].item[5].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[1].item[0].item[5].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[1].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[1].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54122-7") + self.assertEqual(inst.item[2].item[1].item[0].item[5].linkId, "2.1.1.6") + self.assertEqual(inst.item[2].item[1].item[0].item[5].text, "Was this person adopted?") + self.assertEqual(inst.item[2].item[1].item[0].linkId, "2.1.1") + self.assertEqual(inst.item[2].item[1].item[1].item[0].answer[0].valueCoding.code, "LA10550-4") + self.assertEqual(inst.item[2].item[1].item[1].item[0].answer[0].valueCoding.display, "-- Other Cancer") + self.assertEqual(inst.item[2].item[1].item[1].item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[1].item[1].item[0].linkId, "2.1.2.1") + self.assertEqual(inst.item[2].item[1].item[1].item[0].text, "Disease or Condition") + self.assertEqual(inst.item[2].item[1].item[1].item[1].answer[0].valueCoding.code, "LA10397-0") + self.assertEqual(inst.item[2].item[1].item[1].item[1].answer[0].valueCoding.display, "30-39") + self.assertEqual(inst.item[2].item[1].item[1].item[1].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[1].item[1].item[1].linkId, "2.1.2.2") + self.assertEqual(inst.item[2].item[1].item[1].item[1].text, "Age at Diagnosis") + self.assertEqual(inst.item[2].item[1].item[1].linkId, "2.1.2") + self.assertEqual(inst.item[2].item[1].item[1].text, "This family member's history of disease") + self.assertEqual(inst.item[2].item[1].linkId, "2.1") + self.assertEqual(inst.item[2].item[2].item[0].item[0].answer[0].valueCoding.code, "LA10418-4") + self.assertEqual(inst.item[2].item[2].item[0].item[0].answer[0].valueCoding.display, "Sister") + self.assertEqual(inst.item[2].item[2].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[2].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54136-7") + self.assertEqual(inst.item[2].item[2].item[0].item[0].linkId, "2.1.1.1") + self.assertEqual(inst.item[2].item[2].item[0].item[0].text, "Relationship to you") + self.assertEqual(inst.item[2].item[2].item[0].item[1].answer[0].valueString, "Janet") + self.assertEqual(inst.item[2].item[2].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54138-3") + self.assertEqual(inst.item[2].item[2].item[0].item[1].linkId, "2.1.1.2") + self.assertEqual(inst.item[2].item[2].item[0].item[1].text, "Name") + self.assertEqual(inst.item[2].item[2].item[0].item[2].answer[0].valueCoding.code, "LA3-6") + self.assertEqual(inst.item[2].item[2].item[0].item[2].answer[0].valueCoding.display, "Female") + self.assertEqual(inst.item[2].item[2].item[0].item[2].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[2].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/54123-5") + self.assertEqual(inst.item[2].item[2].item[0].item[2].linkId, "2.1.1.3") + self.assertEqual(inst.item[2].item[2].item[0].item[2].text, "Gender") + self.assertEqual(inst.item[2].item[2].item[0].item[3].answer[0].item[0].item[0].answer[0].valueDecimal, 36) + self.assertEqual(inst.item[2].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[2].item[0].item[3].answer[0].item[0].item[0].linkId, "2.1.1.4.2.2") + self.assertEqual(inst.item[2].item[2].item[0].item[3].answer[0].item[0].item[0].text, "Age") + self.assertEqual(inst.item[2].item[2].item[0].item[3].answer[0].item[0].linkId, "2.1.1.4.2") + self.assertEqual(inst.item[2].item[2].item[0].item[3].answer[0].valueCoding.code, "LA33-6") + self.assertEqual(inst.item[2].item[2].item[0].item[3].answer[0].valueCoding.display, "Yes") + self.assertEqual(inst.item[2].item[2].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[2].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54139-1") + self.assertEqual(inst.item[2].item[2].item[0].item[3].linkId, "2.1.1.4") + self.assertEqual(inst.item[2].item[2].item[0].item[3].text, "Living?") + self.assertEqual(inst.item[2].item[2].item[0].item[4].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[2].item[0].item[4].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[2].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[2].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54121-9") + self.assertEqual(inst.item[2].item[2].item[0].item[4].linkId, "2.1.1.5") + self.assertEqual(inst.item[2].item[2].item[0].item[4].text, "Was this person born a twin?") + self.assertEqual(inst.item[2].item[2].item[0].item[5].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[2].item[0].item[5].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[2].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[2].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54122-7") + self.assertEqual(inst.item[2].item[2].item[0].item[5].linkId, "2.1.1.6") + self.assertEqual(inst.item[2].item[2].item[0].item[5].text, "Was this person adopted?") + self.assertEqual(inst.item[2].item[2].item[0].linkId, "2.1.1") + self.assertEqual(inst.item[2].item[2].item[1].item[0].answer[0].valueCoding.code, "LA10536-3") + self.assertEqual(inst.item[2].item[2].item[1].item[0].answer[0].valueCoding.display, "-- Breast Cancer") + self.assertEqual(inst.item[2].item[2].item[1].item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[2].item[1].item[0].linkId, "2.1.2.1") + self.assertEqual(inst.item[2].item[2].item[1].item[0].text, "Disease or Condition") + self.assertEqual(inst.item[2].item[2].item[1].item[1].answer[0].valueCoding.code, "LA10397-0") + self.assertEqual(inst.item[2].item[2].item[1].item[1].answer[0].valueCoding.display, "30-39") + self.assertEqual(inst.item[2].item[2].item[1].item[1].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[2].item[1].item[1].linkId, "2.1.2.2") + self.assertEqual(inst.item[2].item[2].item[1].item[1].text, "Age at Diagnosis") + self.assertEqual(inst.item[2].item[2].item[1].linkId, "2.1.2") + self.assertEqual(inst.item[2].item[2].item[1].text, "This family member's history of disease") + self.assertEqual(inst.item[2].item[2].linkId, "2.1") + self.assertEqual(inst.item[2].item[3].item[0].item[0].answer[0].valueCoding.code, "LA10419-2") + self.assertEqual(inst.item[2].item[3].item[0].item[0].answer[0].valueCoding.display, "Nephew") + self.assertEqual(inst.item[2].item[3].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[3].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54136-7") + self.assertEqual(inst.item[2].item[3].item[0].item[0].linkId, "2.1.1.1") + self.assertEqual(inst.item[2].item[3].item[0].item[0].text, "Relationship to you") + self.assertEqual(inst.item[2].item[3].item[0].item[1].answer[0].valueString, "Ian") + self.assertEqual(inst.item[2].item[3].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54138-3") + self.assertEqual(inst.item[2].item[3].item[0].item[1].linkId, "2.1.1.2") + self.assertEqual(inst.item[2].item[3].item[0].item[1].text, "Name") + self.assertEqual(inst.item[2].item[3].item[0].item[2].answer[0].valueCoding.code, "LA2-8") + self.assertEqual(inst.item[2].item[3].item[0].item[2].answer[0].valueCoding.display, "Male") + self.assertEqual(inst.item[2].item[3].item[0].item[2].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[3].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/54123-5") + self.assertEqual(inst.item[2].item[3].item[0].item[2].linkId, "2.1.1.3") + self.assertEqual(inst.item[2].item[3].item[0].item[2].text, "Gender") + self.assertEqual(inst.item[2].item[3].item[0].item[3].answer[0].item[0].item[0].answer[0].valueDecimal, 16) + self.assertEqual(inst.item[2].item[3].item[0].item[3].answer[0].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54141-7") + self.assertEqual(inst.item[2].item[3].item[0].item[3].answer[0].item[0].item[0].linkId, "2.1.1.4.2.2") + self.assertEqual(inst.item[2].item[3].item[0].item[3].answer[0].item[0].item[0].text, "Age") + self.assertEqual(inst.item[2].item[3].item[0].item[3].answer[0].item[0].linkId, "2.1.1.4.2") + self.assertEqual(inst.item[2].item[3].item[0].item[3].answer[0].valueCoding.code, "LA33-6") + self.assertEqual(inst.item[2].item[3].item[0].item[3].answer[0].valueCoding.display, "Yes") + self.assertEqual(inst.item[2].item[3].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[3].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54139-1") + self.assertEqual(inst.item[2].item[3].item[0].item[3].linkId, "2.1.1.4") + self.assertEqual(inst.item[2].item[3].item[0].item[3].text, "Living?") + self.assertEqual(inst.item[2].item[3].item[0].item[4].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[3].item[0].item[4].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[3].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[3].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54121-9") + self.assertEqual(inst.item[2].item[3].item[0].item[4].linkId, "2.1.1.5") + self.assertEqual(inst.item[2].item[3].item[0].item[4].text, "Was this person born a twin?") + self.assertEqual(inst.item[2].item[3].item[0].item[5].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[3].item[0].item[5].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[3].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[3].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54122-7") + self.assertEqual(inst.item[2].item[3].item[0].item[5].linkId, "2.1.1.6") + self.assertEqual(inst.item[2].item[3].item[0].item[5].text, "Was this person adopted?") + self.assertEqual(inst.item[2].item[3].item[0].linkId, "2.1.1") + self.assertEqual(inst.item[2].item[3].linkId, "2.1") + self.assertEqual(inst.item[2].item[4].item[0].item[0].answer[0].valueCoding.code, "LA10420-0") + self.assertEqual(inst.item[2].item[4].item[0].item[0].answer[0].valueCoding.display, "Niece") + self.assertEqual(inst.item[2].item[4].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[4].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54136-7") + self.assertEqual(inst.item[2].item[4].item[0].item[0].linkId, "2.1.1.1") + self.assertEqual(inst.item[2].item[4].item[0].item[0].text, "Relationship to you") + self.assertEqual(inst.item[2].item[4].item[0].item[1].answer[0].valueString, "Helen") + self.assertEqual(inst.item[2].item[4].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54138-3") + self.assertEqual(inst.item[2].item[4].item[0].item[1].linkId, "2.1.1.2") + self.assertEqual(inst.item[2].item[4].item[0].item[1].text, "Name") + self.assertEqual(inst.item[2].item[4].item[0].item[2].answer[0].valueCoding.code, "LA3-6") + self.assertEqual(inst.item[2].item[4].item[0].item[2].answer[0].valueCoding.display, "Female") + self.assertEqual(inst.item[2].item[4].item[0].item[2].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[4].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/54123-5") + self.assertEqual(inst.item[2].item[4].item[0].item[2].linkId, "2.1.1.3") + self.assertEqual(inst.item[2].item[4].item[0].item[2].text, "Gender") + self.assertEqual(inst.item[2].item[4].item[0].item[3].answer[0].item[0].item[0].answer[0].valueDecimal, 15) + self.assertEqual(inst.item[2].item[4].item[0].item[3].answer[0].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54141-7") + self.assertEqual(inst.item[2].item[4].item[0].item[3].answer[0].item[0].item[0].linkId, "2.1.1.4.2.2") + self.assertEqual(inst.item[2].item[4].item[0].item[3].answer[0].item[0].item[0].text, "Age") + self.assertEqual(inst.item[2].item[4].item[0].item[3].answer[0].item[0].linkId, "2.1.1.4.2") + self.assertEqual(inst.item[2].item[4].item[0].item[3].answer[0].valueCoding.code, "LA33-6") + self.assertEqual(inst.item[2].item[4].item[0].item[3].answer[0].valueCoding.display, "Yes") + self.assertEqual(inst.item[2].item[4].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[4].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54139-1") + self.assertEqual(inst.item[2].item[4].item[0].item[3].linkId, "2.1.1.4") + self.assertEqual(inst.item[2].item[4].item[0].item[3].text, "Living?") + self.assertEqual(inst.item[2].item[4].item[0].item[4].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[4].item[0].item[4].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[4].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[4].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54121-9") + self.assertEqual(inst.item[2].item[4].item[0].item[4].linkId, "2.1.1.5") + self.assertEqual(inst.item[2].item[4].item[0].item[4].text, "Was this person born a twin?") + self.assertEqual(inst.item[2].item[4].item[0].item[5].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[4].item[0].item[5].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[4].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[4].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54122-7") + self.assertEqual(inst.item[2].item[4].item[0].item[5].linkId, "2.1.1.6") + self.assertEqual(inst.item[2].item[4].item[0].item[5].text, "Was this person adopted?") + self.assertEqual(inst.item[2].item[4].item[0].linkId, "2.1.1") + self.assertEqual(inst.item[2].item[4].linkId, "2.1") + self.assertEqual(inst.item[2].item[5].item[0].item[0].answer[0].valueCoding.code, "LA10416-8") + self.assertEqual(inst.item[2].item[5].item[0].item[0].answer[0].valueCoding.display, "Father") + self.assertEqual(inst.item[2].item[5].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[5].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54136-7") + self.assertEqual(inst.item[2].item[5].item[0].item[0].linkId, "2.1.1.1") + self.assertEqual(inst.item[2].item[5].item[0].item[0].text, "Relationship to you") + self.assertEqual(inst.item[2].item[5].item[0].item[1].answer[0].valueString, "Donald") + self.assertEqual(inst.item[2].item[5].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54138-3") + self.assertEqual(inst.item[2].item[5].item[0].item[1].linkId, "2.1.1.2") + self.assertEqual(inst.item[2].item[5].item[0].item[1].text, "Name") + self.assertEqual(inst.item[2].item[5].item[0].item[2].answer[0].valueCoding.code, "LA2-8") + self.assertEqual(inst.item[2].item[5].item[0].item[2].answer[0].valueCoding.display, "Male") + self.assertEqual(inst.item[2].item[5].item[0].item[2].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[5].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/54123-5") + self.assertEqual(inst.item[2].item[5].item[0].item[2].linkId, "2.1.1.3") + self.assertEqual(inst.item[2].item[5].item[0].item[2].text, "Gender") + self.assertEqual(inst.item[2].item[5].item[0].item[3].answer[0].item[0].item[0].answer[0].valueDecimal, 52) + self.assertEqual(inst.item[2].item[5].item[0].item[3].answer[0].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54141-7") + self.assertEqual(inst.item[2].item[5].item[0].item[3].answer[0].item[0].item[0].linkId, "2.1.1.4.2.2") + self.assertEqual(inst.item[2].item[5].item[0].item[3].answer[0].item[0].item[0].text, "Age") + self.assertEqual(inst.item[2].item[5].item[0].item[3].answer[0].item[0].linkId, "2.1.1.4.2") + self.assertEqual(inst.item[2].item[5].item[0].item[3].answer[0].valueCoding.code, "LA33-6") + self.assertEqual(inst.item[2].item[5].item[0].item[3].answer[0].valueCoding.display, "Yes") + self.assertEqual(inst.item[2].item[5].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[5].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54139-1") + self.assertEqual(inst.item[2].item[5].item[0].item[3].linkId, "2.1.1.4") + self.assertEqual(inst.item[2].item[5].item[0].item[3].text, "Living?") + self.assertEqual(inst.item[2].item[5].item[0].item[4].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[5].item[0].item[4].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[5].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[5].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54121-9") + self.assertEqual(inst.item[2].item[5].item[0].item[4].linkId, "2.1.1.5") + self.assertEqual(inst.item[2].item[5].item[0].item[4].text, "Was this person born a twin?") + self.assertEqual(inst.item[2].item[5].item[0].item[5].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[5].item[0].item[5].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[5].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[5].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54122-7") + self.assertEqual(inst.item[2].item[5].item[0].item[5].linkId, "2.1.1.6") + self.assertEqual(inst.item[2].item[5].item[0].item[5].text, "Was this person adopted?") + self.assertEqual(inst.item[2].item[5].item[0].linkId, "2.1.1") + self.assertEqual(inst.item[2].item[5].linkId, "2.1") + self.assertEqual(inst.item[2].item[6].item[0].item[0].answer[0].valueCoding.code, "LA10425-9") + self.assertEqual(inst.item[2].item[6].item[0].item[0].answer[0].valueCoding.display, "Paternal Uncle") + self.assertEqual(inst.item[2].item[6].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[6].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54136-7") + self.assertEqual(inst.item[2].item[6].item[0].item[0].linkId, "2.1.1.1") + self.assertEqual(inst.item[2].item[6].item[0].item[0].text, "Relationship to you") + self.assertEqual(inst.item[2].item[6].item[0].item[1].answer[0].valueString, "Eric") + self.assertEqual(inst.item[2].item[6].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54138-3") + self.assertEqual(inst.item[2].item[6].item[0].item[1].linkId, "2.1.1.2") + self.assertEqual(inst.item[2].item[6].item[0].item[1].text, "Name") + self.assertEqual(inst.item[2].item[6].item[0].item[2].answer[0].valueCoding.code, "LA2-8") + self.assertEqual(inst.item[2].item[6].item[0].item[2].answer[0].valueCoding.display, "Male") + self.assertEqual(inst.item[2].item[6].item[0].item[2].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[6].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/54123-5") + self.assertEqual(inst.item[2].item[6].item[0].item[2].linkId, "2.1.1.3") + self.assertEqual(inst.item[2].item[6].item[0].item[2].text, "Gender") + self.assertEqual(inst.item[2].item[6].item[0].item[3].answer[0].item[0].item[0].answer[0].valueDecimal, 56) + self.assertEqual(inst.item[2].item[6].item[0].item[3].answer[0].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54141-7") + self.assertEqual(inst.item[2].item[6].item[0].item[3].answer[0].item[0].item[0].linkId, "2.1.1.4.2.2") + self.assertEqual(inst.item[2].item[6].item[0].item[3].answer[0].item[0].item[0].text, "Age") + self.assertEqual(inst.item[2].item[6].item[0].item[3].answer[0].item[0].linkId, "2.1.1.4.2") + self.assertEqual(inst.item[2].item[6].item[0].item[3].answer[0].valueCoding.code, "LA33-6") + self.assertEqual(inst.item[2].item[6].item[0].item[3].answer[0].valueCoding.display, "Yes") + self.assertEqual(inst.item[2].item[6].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[6].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54139-1") + self.assertEqual(inst.item[2].item[6].item[0].item[3].linkId, "2.1.1.4") + self.assertEqual(inst.item[2].item[6].item[0].item[3].text, "Living?") + self.assertEqual(inst.item[2].item[6].item[0].item[4].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[6].item[0].item[4].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[6].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[6].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54121-9") + self.assertEqual(inst.item[2].item[6].item[0].item[4].linkId, "2.1.1.5") + self.assertEqual(inst.item[2].item[6].item[0].item[4].text, "Was this person born a twin?") + self.assertEqual(inst.item[2].item[6].item[0].item[5].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[6].item[0].item[5].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[6].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[6].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54122-7") + self.assertEqual(inst.item[2].item[6].item[0].item[5].linkId, "2.1.1.6") + self.assertEqual(inst.item[2].item[6].item[0].item[5].text, "Was this person adopted?") + self.assertEqual(inst.item[2].item[6].item[0].linkId, "2.1.1") + self.assertEqual(inst.item[2].item[6].linkId, "2.1") + self.assertEqual(inst.item[2].item[7].item[0].item[0].answer[0].valueCoding.code, "LA10421-8") + self.assertEqual(inst.item[2].item[7].item[0].item[0].answer[0].valueCoding.display, "Paternal Aunt") + self.assertEqual(inst.item[2].item[7].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[7].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54136-7") + self.assertEqual(inst.item[2].item[7].item[0].item[0].linkId, "2.1.1.1") + self.assertEqual(inst.item[2].item[7].item[0].item[0].text, "Relationship to you") + self.assertEqual(inst.item[2].item[7].item[0].item[1].answer[0].valueString, "Fiona") + self.assertEqual(inst.item[2].item[7].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54138-3") + self.assertEqual(inst.item[2].item[7].item[0].item[1].linkId, "2.1.1.2") + self.assertEqual(inst.item[2].item[7].item[0].item[1].text, "Name") + self.assertEqual(inst.item[2].item[7].item[0].item[2].answer[0].valueCoding.code, "LA3-6") + self.assertEqual(inst.item[2].item[7].item[0].item[2].answer[0].valueCoding.display, "Female") + self.assertEqual(inst.item[2].item[7].item[0].item[2].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[7].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/54123-5") + self.assertEqual(inst.item[2].item[7].item[0].item[2].linkId, "2.1.1.3") + self.assertEqual(inst.item[2].item[7].item[0].item[2].text, "Gender") + self.assertEqual(inst.item[2].item[7].item[0].item[3].answer[0].item[0].item[0].answer[0].valueDecimal, 57) + self.assertEqual(inst.item[2].item[7].item[0].item[3].answer[0].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54141-7") + self.assertEqual(inst.item[2].item[7].item[0].item[3].answer[0].item[0].item[0].linkId, "2.1.1.4.2.2") + self.assertEqual(inst.item[2].item[7].item[0].item[3].answer[0].item[0].item[0].text, "Age") + self.assertEqual(inst.item[2].item[7].item[0].item[3].answer[0].item[0].linkId, "2.1.1.4.2") + self.assertEqual(inst.item[2].item[7].item[0].item[3].answer[0].valueCoding.code, "LA33-6") + self.assertEqual(inst.item[2].item[7].item[0].item[3].answer[0].valueCoding.display, "Yes") + self.assertEqual(inst.item[2].item[7].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[7].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54139-1") + self.assertEqual(inst.item[2].item[7].item[0].item[3].linkId, "2.1.1.4") + self.assertEqual(inst.item[2].item[7].item[0].item[3].text, "Living?") + self.assertEqual(inst.item[2].item[7].item[0].item[4].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[7].item[0].item[4].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[7].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[7].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54121-9") + self.assertEqual(inst.item[2].item[7].item[0].item[4].linkId, "2.1.1.5") + self.assertEqual(inst.item[2].item[7].item[0].item[4].text, "Was this person born a twin?") + self.assertEqual(inst.item[2].item[7].item[0].item[5].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[7].item[0].item[5].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[7].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[7].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54122-7") + self.assertEqual(inst.item[2].item[7].item[0].item[5].linkId, "2.1.1.6") + self.assertEqual(inst.item[2].item[7].item[0].item[5].text, "Was this person adopted?") + self.assertEqual(inst.item[2].item[7].item[0].linkId, "2.1.1") + self.assertEqual(inst.item[2].item[7].item[1].item[0].answer[0].valueCoding.code, "LA10543-9") + self.assertEqual(inst.item[2].item[7].item[1].item[0].answer[0].valueCoding.display, "-- Skin Cancer") + self.assertEqual(inst.item[2].item[7].item[1].item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[7].item[1].item[0].linkId, "2.1.2.1") + self.assertEqual(inst.item[2].item[7].item[1].item[0].text, "Disease or Condition") + self.assertEqual(inst.item[2].item[7].item[1].linkId, "2.1.2") + self.assertEqual(inst.item[2].item[7].item[1].text, "This family member's history of disease") + self.assertEqual(inst.item[2].item[7].linkId, "2.1") + self.assertEqual(inst.item[2].item[8].item[0].item[0].answer[0].valueCoding.code, "LA10423-4") + self.assertEqual(inst.item[2].item[8].item[0].item[0].answer[0].valueCoding.display, "Paternal Grandfather") + self.assertEqual(inst.item[2].item[8].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[8].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54136-7") + self.assertEqual(inst.item[2].item[8].item[0].item[0].linkId, "2.1.1.1") + self.assertEqual(inst.item[2].item[8].item[0].item[0].text, "Relationship to you") + self.assertEqual(inst.item[2].item[8].item[0].item[1].answer[0].valueString, "Bob") + self.assertEqual(inst.item[2].item[8].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54138-3") + self.assertEqual(inst.item[2].item[8].item[0].item[1].linkId, "2.1.1.2") + self.assertEqual(inst.item[2].item[8].item[0].item[1].text, "Name") + self.assertEqual(inst.item[2].item[8].item[0].item[2].answer[0].valueCoding.code, "LA2-8") + self.assertEqual(inst.item[2].item[8].item[0].item[2].answer[0].valueCoding.display, "Male") + self.assertEqual(inst.item[2].item[8].item[0].item[2].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[8].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/54123-5") + self.assertEqual(inst.item[2].item[8].item[0].item[2].linkId, "2.1.1.3") + self.assertEqual(inst.item[2].item[8].item[0].item[2].text, "Gender") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[0].answer[0].valueCoding.code, "LA10537-1") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[0].answer[0].valueCoding.display, "-- Colon Cancer") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54112-8") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[0].linkId, "2.1.1.4.1.1") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[0].text, "Cause of Death") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[1].answer[0].valueCoding.code, "LA10400-2") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[1].answer[0].valueCoding.display, "OVER 60") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[1].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54113-6") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[1].linkId, "2.1.1.4.1.2") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[1].text, "Age at Death") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].linkId, "2.1.1.4.1") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[8].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54139-1") + self.assertEqual(inst.item[2].item[8].item[0].item[3].linkId, "2.1.1.4") + self.assertEqual(inst.item[2].item[8].item[0].item[3].text, "Living?") + self.assertEqual(inst.item[2].item[8].item[0].item[4].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[8].item[0].item[4].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[8].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[8].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54121-9") + self.assertEqual(inst.item[2].item[8].item[0].item[4].linkId, "2.1.1.5") + self.assertEqual(inst.item[2].item[8].item[0].item[4].text, "Was this person born a twin?") + self.assertEqual(inst.item[2].item[8].item[0].item[5].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[8].item[0].item[5].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[8].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[8].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54122-7") + self.assertEqual(inst.item[2].item[8].item[0].item[5].linkId, "2.1.1.6") + self.assertEqual(inst.item[2].item[8].item[0].item[5].text, "Was this person adopted?") + self.assertEqual(inst.item[2].item[8].item[0].linkId, "2.1.1") + self.assertEqual(inst.item[2].item[8].item[1].item[0].answer[0].valueCoding.code, "LA10537-1") + self.assertEqual(inst.item[2].item[8].item[1].item[0].answer[0].valueCoding.display, "-- Colon Cancer") + self.assertEqual(inst.item[2].item[8].item[1].item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[8].item[1].item[0].linkId, "2.1.2.1") + self.assertEqual(inst.item[2].item[8].item[1].item[0].text, "Disease or Condition") + self.assertEqual(inst.item[2].item[8].item[1].item[1].answer[0].valueCoding.code, "LA10400-2") + self.assertEqual(inst.item[2].item[8].item[1].item[1].answer[0].valueCoding.display, "OVER 60") + self.assertEqual(inst.item[2].item[8].item[1].item[1].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[8].item[1].item[1].linkId, "2.1.2.2") + self.assertEqual(inst.item[2].item[8].item[1].item[1].text, "Age at Diagnosis") + self.assertEqual(inst.item[2].item[8].item[1].linkId, "2.1.2") + self.assertEqual(inst.item[2].item[8].item[1].text, "This family member's history of disease") + self.assertEqual(inst.item[2].item[8].linkId, "2.1") + self.assertEqual(inst.item[2].item[9].item[0].item[0].answer[0].valueCoding.code, "LA10424-2") + self.assertEqual(inst.item[2].item[9].item[0].item[0].answer[0].valueCoding.display, "Paternal Grandmother") + self.assertEqual(inst.item[2].item[9].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[9].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54136-7") + self.assertEqual(inst.item[2].item[9].item[0].item[0].linkId, "2.1.1.1") + self.assertEqual(inst.item[2].item[9].item[0].item[0].text, "Relationship to you") + self.assertEqual(inst.item[2].item[9].item[0].item[1].answer[0].valueString, "Claire") + self.assertEqual(inst.item[2].item[9].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54138-3") + self.assertEqual(inst.item[2].item[9].item[0].item[1].linkId, "2.1.1.2") + self.assertEqual(inst.item[2].item[9].item[0].item[1].text, "Name") + self.assertEqual(inst.item[2].item[9].item[0].item[2].answer[0].valueCoding.code, "LA3-6") + self.assertEqual(inst.item[2].item[9].item[0].item[2].answer[0].valueCoding.display, "Female") + self.assertEqual(inst.item[2].item[9].item[0].item[2].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[9].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/54123-5") + self.assertEqual(inst.item[2].item[9].item[0].item[2].linkId, "2.1.1.3") + self.assertEqual(inst.item[2].item[9].item[0].item[2].text, "Gender") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[0].answer[0].item[0].answer[0].valueString, "Lou Gehrigs") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[0].answer[0].item[0].linkId, "2.1.1.4.1.1.1") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[0].answer[0].item[0].text, "Please specify") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[0].answer[0].valueCoding.code, "LA10589-2") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[0].answer[0].valueCoding.display, "-- Other/Unexpected") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54112-8") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[0].linkId, "2.1.1.4.1.1") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[0].text, "Cause of Death") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[1].answer[0].valueCoding.code, "LA10400-2") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[1].answer[0].valueCoding.display, "OVER 60") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[1].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54113-6") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[1].linkId, "2.1.1.4.1.2") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[1].text, "Age at Death") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].linkId, "2.1.1.4.1") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[9].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54139-1") + self.assertEqual(inst.item[2].item[9].item[0].item[3].linkId, "2.1.1.4") + self.assertEqual(inst.item[2].item[9].item[0].item[3].text, "Living?") + self.assertEqual(inst.item[2].item[9].item[0].item[4].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[9].item[0].item[4].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[9].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[9].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54121-9") + self.assertEqual(inst.item[2].item[9].item[0].item[4].linkId, "2.1.1.5") + self.assertEqual(inst.item[2].item[9].item[0].item[4].text, "Was this person born a twin?") + self.assertEqual(inst.item[2].item[9].item[0].item[5].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[9].item[0].item[5].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[9].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[9].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54122-7") + self.assertEqual(inst.item[2].item[9].item[0].item[5].linkId, "2.1.1.6") + self.assertEqual(inst.item[2].item[9].item[0].item[5].text, "Was this person adopted?") + self.assertEqual(inst.item[2].item[9].item[0].linkId, "2.1.1") + 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-gcs.json") + self.assertIsNotNone(inst, "Must have instantiated a QuestionnaireResponse instance") + self.implQuestionnaireResponse5(inst) + + js = inst.as_json() + self.assertEqual("QuestionnaireResponse", js["resourceType"]) + inst2 = questionnaireresponse.QuestionnaireResponse(js) + self.implQuestionnaireResponse5(inst2) + + def implQuestionnaireResponse5(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/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/R4/range.py b/fhirclient/models/R4/range.py new file mode 100644 index 000000000..ffeb2a2c6 --- /dev/null +++ b/fhirclient/models/R4/range.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Range) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Range(element.Element): + """ Set of values bounded by low and high. + + A set of ordered Quantities defined by a low and high limit. + """ + + resource_type = "Range" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.high = None + """ High limit. + Type `Quantity` (represented as `dict` in JSON). """ + + self.low = None + """ Low limit. + Type `Quantity` (represented as `dict` in JSON). """ + + super(Range, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Range, self).elementProperties() + js.extend([ + ("high", "high", quantity.Quantity, False, None, False), + ("low", "low", quantity.Quantity, False, None, False), + ]) + return js + + +import sys +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/R4/ratio.py b/fhirclient/models/R4/ratio.py new file mode 100644 index 000000000..32fa00b13 --- /dev/null +++ b/fhirclient/models/R4/ratio.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Ratio) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Ratio(element.Element): + """ A ratio of two Quantity values - a numerator and a denominator. + + A relationship of two Quantity values - expressed as a numerator and a + denominator. + """ + + resource_type = "Ratio" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.denominator = None + """ Denominator value. + Type `Quantity` (represented as `dict` in JSON). """ + + self.numerator = None + """ Numerator value. + Type `Quantity` (represented as `dict` in JSON). """ + + super(Ratio, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Ratio, self).elementProperties() + js.extend([ + ("denominator", "denominator", quantity.Quantity, False, None, False), + ("numerator", "numerator", quantity.Quantity, False, None, False), + ]) + return js + + +import sys +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/R4/reference.py b/fhirclient/models/R4/reference.py new file mode 100644 index 000000000..cbec10cf3 --- /dev/null +++ b/fhirclient/models/R4/reference.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Reference) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Reference(element.Element): + """ A reference from one resource to another. + """ + + resource_type = "Reference" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.display = None + """ Text alternative for the resource. + Type `str`. """ + + self.identifier = None + """ Logical reference, when literal reference is not known. + Type `Identifier` (represented as `dict` in JSON). """ + + self.reference = None + """ 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): + js = super(Reference, self).elementProperties() + js.extend([ + ("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 + + +import sys +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] diff --git a/fhirclient/models/R4/relatedartifact.py b/fhirclient/models/R4/relatedartifact.py new file mode 100644 index 000000000..8e50ddae2 --- /dev/null +++ b/fhirclient/models/R4/relatedartifact.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/RelatedArtifact) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class RelatedArtifact(element.Element): + """ Related artifacts for a knowledge resource. + + Related artifacts such as additional documentation, justification, or + bibliographic references. + """ + + resource_type = "RelatedArtifact" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.citation = None + """ Bibliographic citation for the artifact. + Type `str`. """ + + self.display = None + """ Brief description of the related artifact. + Type `str`. """ + + self.document = None + """ 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 `str`. """ + + self.type = None + """ documentation | justification | citation | predecessor | successor + | derived-from | depends-on | composed-of. + Type `str`. """ + + self.url = None + """ Where the artifact can be accessed. + Type `str`. """ + + super(RelatedArtifact, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(RelatedArtifact, self).elementProperties() + js.extend([ + ("citation", "citation", str, False, None, False), + ("display", "display", str, False, None, False), + ("document", "document", attachment.Attachment, 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), + ]) + return js + + +import sys +try: + from . import attachment +except ImportError: + attachment = sys.modules[__package__ + '.attachment'] diff --git a/fhirclient/models/R4/relatedperson.py b/fhirclient/models/R4/relatedperson.py new file mode 100644 index 000000000..87dc03332 --- /dev/null +++ b/fhirclient/models/R4/relatedperson.py @@ -0,0 +1,171 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/RelatedPerson) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class RelatedPerson(domainresource.DomainResource): + """ 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 + who is not the target of healthcare, nor has a formal responsibility in the + care process. + """ + + resource_type = "RelatedPerson" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 related person's record is in active use. + Type `bool`. """ + + self.address = None + """ Address where the related person can be contacted or visited. + List of `Address` items (represented as `dict` in JSON). """ + + self.birthDate = None + """ 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`. """ + + self.identifier = None + """ A human identifier for this person. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.name = None + """ A name associated with the person. + List of `HumanName` items (represented as `dict` in JSON). """ + + self.patient = None + """ The patient this person is related to. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.period = None + """ Period of time that this relationship is considered valid. + Type `Period` (represented as `dict` in JSON). """ + + self.photo = None + """ Image of the person. + List of `Attachment` items (represented as `dict` in JSON). """ + + self.relationship = None + """ The nature of the relationship. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.telecom = None + """ A contact detail for the person. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(RelatedPerson, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(RelatedPerson, self).elementProperties() + js.extend([ + ("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, 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 +except ImportError: + address = sys.modules[__package__ + '.address'] +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 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: + 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 period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/R4/relatedperson_tests.py b/fhirclient/models/R4/relatedperson_tests.py new file mode 100644 index 000000000..d6c2f1ed2 --- /dev/null +++ b/fhirclient/models/R4/relatedperson_tests.py @@ -0,0 +1,195 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import relatedperson +from .fhirdate import FHIRDate + + +class RelatedPersonTests(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("RelatedPerson", js["resourceType"]) + return relatedperson.RelatedPerson(js) + + def testRelatedPerson1(self): + inst = self.instantiate_from("relatedperson-example-peter.json") + self.assertIsNotNone(inst, "Must have instantiated a RelatedPerson instance") + self.implRelatedPerson1(inst) + + js = inst.as_json() + self.assertEqual("RelatedPerson", js["resourceType"]) + inst2 = relatedperson.RelatedPerson(js) + self.implRelatedPerson1(inst2) + + def implRelatedPerson1(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.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, "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-f001-sarah.json") + self.assertIsNotNone(inst, "Must have instantiated a RelatedPerson instance") + self.implRelatedPerson2(inst) + + js = inst.as_json() + self.assertEqual("RelatedPerson", js["resourceType"]) + inst2 = relatedperson.RelatedPerson(js) + self.implRelatedPerson2(inst2) + + def implRelatedPerson2(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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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.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, "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-newborn-mom.json") + self.assertIsNotNone(inst, "Must have instantiated a RelatedPerson instance") + self.implRelatedPerson3(inst) + + js = inst.as_json() + self.assertEqual("RelatedPerson", js["resourceType"]) + inst2 = relatedperson.RelatedPerson(js) + self.implRelatedPerson3(inst2) + + def implRelatedPerson3(self, inst): + self.assertTrue(inst.active) + self.assertEqual(inst.address[0].line[0], "2222 Home Street") + self.assertEqual(inst.address[0].use, "home") + 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.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, "555-555-2003") + self.assertEqual(inst.text.status, "generated") + + def testRelatedPerson4(self): + inst = self.instantiate_from("relatedperson-example.json") + self.assertIsNotNone(inst, "Must have instantiated a RelatedPerson instance") + self.implRelatedPerson4(inst) + + js = inst.as_json() + self.assertEqual("RelatedPerson", js["resourceType"]) + inst2 = relatedperson.RelatedPerson(js) + self.implRelatedPerson4(inst2) + + def implRelatedPerson4(self, inst): + self.assertTrue(inst.active) + self.assertEqual(inst.address[0].city, "Paris") + self.assertEqual(inst.address[0].country, "FRA") + self.assertEqual(inst.address[0].line[0], "43, Place du Marché Sainte Catherine") + self.assertEqual(inst.address[0].postalCode, "75004") + self.assertEqual(inst.gender, "female") + self.assertEqual(inst.id, "benedicte") + self.assertEqual(inst.identifier[0].system, "urn:oid:1.2.250.1.61") + 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[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/R4/requestgroup.py b/fhirclient/models/R4/requestgroup.py new file mode 100644 index 000000000..6db34bcc9 --- /dev/null +++ b/fhirclient/models/R4/requestgroup.py @@ -0,0 +1,406 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/RequestGroup) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class RequestGroup(domainresource.DomainResource): + """ A group of related requests. + + A group of related requests that can be used to capture intended activities + that have inter-dependencies such as "give this medication after that one". + """ + + resource_type = "RequestGroup" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Proposed actions, if any. + List of `RequestGroupAction` items (represented as `dict` in JSON). """ + + self.author = None + """ Device or practitioner that authored the request group. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.authoredOn = None + """ When the request group was authored. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.basedOn = None + """ Fulfills plan, proposal, or order. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.code = None + """ What's being requested/ordered. + Type `CodeableConcept` (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. + Type `Identifier` (represented as `dict` in JSON). """ + + self.identifier = None + """ 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`. """ + + self.note = None + """ Additional notes about the response. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.priority = None + """ routine | urgent | asap | stat. + Type `str`. """ + + self.reasonCode = None + """ Why the request group is needed. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.reasonReference = None + """ 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 (represented as `dict` in JSON). """ + + self.status = None + """ draft | active | suspended | cancelled | completed | entered-in- + error | unknown. + Type `str`. """ + + self.subject = None + """ Who the request group is about. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(RequestGroup, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(RequestGroup, self).elementProperties() + js.extend([ + ("action", "action", RequestGroupAction, True, None, False), + ("author", "author", fhirreference.FHIRReference, False, None, False), + ("authoredOn", "authoredOn", fhirdate.FHIRDate, False, None, False), + ("basedOn", "basedOn", 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), + ("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), + ]) + return js + + +from . import backboneelement + +class RequestGroupAction(backboneelement.BackboneElement): + """ Proposed actions, if any. + + The actions, if any, produced by the evaluation of the artifact. + """ + + resource_type = "RequestGroupAction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Sub action. + List of `RequestGroupAction` items (represented as `dict` in JSON). """ + + self.cardinalityBehavior = None + """ single | multiple. + Type `str`. """ + + self.code = None + """ Code representing the meaning of the action or sub-actions. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.condition = None + """ Whether or not the action is applicable. + List of `RequestGroupActionCondition` items (represented as `dict` in JSON). """ + + self.description = None + """ Short description of the action. + Type `str`. """ + + self.documentation = None + """ Supporting documentation for the intended performer of the action. + List of `RelatedArtifact` items (represented as `dict` in JSON). """ + + self.groupingBehavior = None + """ visual-group | logical-group | sentence-group. + Type `str`. """ + + self.participant = None + """ Who should perform the action. + 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). """ + + self.requiredBehavior = None + """ must | could | must-unless-documented. + Type `str`. """ + + self.resource = None + """ The target of the action. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.selectionBehavior = None + """ any | all | all-or-none | exactly-one | at-most-one | one-or-more. + Type `str`. """ + + 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). """ + + self.timingDuration = None + """ When the action should take place. + Type `Duration` (represented as `dict` in JSON). """ + + self.timingPeriod = None + """ When the action should take place. + Type `Period` (represented as `dict` in JSON). """ + + self.timingRange = None + """ When the action should take place. + Type `Range` (represented as `dict` in JSON). """ + + self.timingTiming = None + """ When the action should take place. + Type `Timing` (represented as `dict` in JSON). """ + + self.title = None + """ User-visible title. + Type `str`. """ + + self.type = None + """ create | update | remove | fire-event. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(RequestGroupAction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(RequestGroupAction, self).elementProperties() + js.extend([ + ("action", "action", RequestGroupAction, True, None, False), + ("cardinalityBehavior", "cardinalityBehavior", str, False, None, False), + ("code", "code", codeableconcept.CodeableConcept, True, None, False), + ("condition", "condition", RequestGroupActionCondition, True, None, False), + ("description", "description", str, False, None, False), + ("documentation", "documentation", relatedartifact.RelatedArtifact, True, None, False), + ("groupingBehavior", "groupingBehavior", 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", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class RequestGroupActionCondition(backboneelement.BackboneElement): + """ Whether or not the action is applicable. + + An expression that describes applicability criteria, or start/stop + conditions for the action. + """ + + resource_type = "RequestGroupActionCondition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Boolean-valued expression. + Type `Expression` (represented as `dict` in JSON). """ + + self.kind = None + """ applicability | start | stop. + Type `str`. """ + + super(RequestGroupActionCondition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(RequestGroupActionCondition, self).elementProperties() + js.extend([ + ("expression", "expression", expression.Expression, False, None, False), + ("kind", "kind", str, False, None, True), + ]) + return js + + +class RequestGroupActionRelatedAction(backboneelement.BackboneElement): + """ Relationship to another action. + + A relationship to another action such as "before" or "30-60 minutes after + start of". + """ + + resource_type = "RequestGroupActionRelatedAction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.actionId = None + """ What action this is related to. + Type `str`. """ + + self.offsetDuration = None + """ Time offset for the relationship. + Type `Duration` (represented as `dict` in JSON). """ + + self.offsetRange = None + """ Time offset for the relationship. + Type `Range` (represented as `dict` in JSON). """ + + self.relationship = None + """ before-start | before | before-end | concurrent-with-start | + concurrent | concurrent-with-end | after-start | after | after-end. + Type `str`. """ + + super(RequestGroupActionRelatedAction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(RequestGroupActionRelatedAction, self).elementProperties() + js.extend([ + ("actionId", "actionId", str, False, None, True), + ("offsetDuration", "offsetDuration", duration.Duration, False, "offset", False), + ("offsetRange", "offsetRange", range.Range, False, "offset", False), + ("relationship", "relationship", str, False, None, True), + ]) + return js + + +import sys +try: + from . import age +except ImportError: + age = sys.modules[__package__ + '.age'] +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 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 range +except ImportError: + range = sys.modules[__package__ + '.range'] +try: + from . import relatedartifact +except ImportError: + relatedartifact = sys.modules[__package__ + '.relatedartifact'] +try: + from . import timing +except ImportError: + timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/R4/requestgroup_tests.py b/fhirclient/models/R4/requestgroup_tests.py new file mode 100644 index 000000000..42cbe4842 --- /dev/null +++ b/fhirclient/models/R4/requestgroup_tests.py @@ -0,0 +1,124 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import requestgroup +from .fhirdate import FHIRDate + + +class RequestGroupTests(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("RequestGroup", js["resourceType"]) + return requestgroup.RequestGroup(js) + + def testRequestGroup1(self): + inst = self.instantiate_from("requestgroup-kdn5-example.json") + self.assertIsNotNone(inst, "Must have instantiated a RequestGroup instance") + self.implRequestGroup1(inst) + + js = inst.as_json() + self.assertEqual("RequestGroup", js["resourceType"]) + inst2 = requestgroup.RequestGroup(js) + self.implRequestGroup1(inst2) + + def implRequestGroup1(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") + self.assertEqual(inst.action[0].action[0].action[0].action[0].action[0].extension[0].extension[1].valueInteger, 8) + 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].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") + self.assertEqual(inst.action[0].action[0].action[0].action[0].action[1].id, "action-2") + self.assertEqual(inst.action[0].action[0].action[0].action[0].action[1].relatedAction[0].actionId, "action-1") + self.assertEqual(inst.action[0].action[0].action[0].action[0].action[1].relatedAction[0].relationship, "concurrent-with-start") + self.assertEqual(inst.action[0].action[0].action[0].action[0].action[1].textEquivalent, "CARBOplatin AUC 5 IV over 30 minutes on Day 1") + self.assertEqual(inst.action[0].action[0].action[0].action[0].id, "cycle-definition-1") + self.assertEqual(inst.action[0].action[0].action[0].action[0].textEquivalent, "21-day cycle for 6 cycles") + self.assertEqual(inst.action[0].action[0].action[0].action[0].timingTiming.repeat.count, 6) + self.assertEqual(inst.action[0].action[0].action[0].action[0].timingTiming.repeat.duration, 21) + self.assertEqual(inst.action[0].action[0].action[0].action[0].timingTiming.repeat.durationUnit, "d") + self.assertEqual(inst.action[0].action[0].action[0].groupingBehavior, "sentence-group") + self.assertEqual(inst.action[0].action[0].action[0].selectionBehavior, "exactly-one") + self.assertEqual(inst.action[0].action[0].selectionBehavior, "all") + self.assertEqual(inst.action[0].selectionBehavior, "exactly-one") + 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, "1111") + 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/R4/researchdefinition.py similarity index 99% rename from fhirclient/models/researchdefinition.py rename to fhirclient/models/R4/researchdefinition.py index 111123f7c..5701a8487 100644 --- a/fhirclient/models/researchdefinition.py +++ b/fhirclient/models/R4/researchdefinition.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ResearchDefinition) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ResearchDefinition) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/researchdefinition_tests.py b/fhirclient/models/R4/researchdefinition_tests.py similarity index 94% rename from fhirclient/models/researchdefinition_tests.py rename to fhirclient/models/R4/researchdefinition_tests.py index 3d8f6ebcd..7d8b156af 100644 --- a/fhirclient/models/researchdefinition_tests.py +++ b/fhirclient/models/R4/researchdefinition_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/researchelementdefinition.py b/fhirclient/models/R4/researchelementdefinition.py similarity index 99% rename from fhirclient/models/researchelementdefinition.py rename to fhirclient/models/R4/researchelementdefinition.py index 17b39e471..348424b14 100644 --- a/fhirclient/models/researchelementdefinition.py +++ b/fhirclient/models/R4/researchelementdefinition.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ResearchElementDefinition) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ResearchElementDefinition) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/researchelementdefinition_tests.py b/fhirclient/models/R4/researchelementdefinition_tests.py similarity index 95% rename from fhirclient/models/researchelementdefinition_tests.py rename to fhirclient/models/R4/researchelementdefinition_tests.py index 1646921fb..a221e6cdd 100644 --- a/fhirclient/models/researchelementdefinition_tests.py +++ b/fhirclient/models/R4/researchelementdefinition_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/R4/researchstudy.py b/fhirclient/models/R4/researchstudy.py new file mode 100644 index 000000000..fc087fc34 --- /dev/null +++ b/fhirclient/models/R4/researchstudy.py @@ -0,0 +1,275 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ResearchStudy) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class ResearchStudy(domainresource.DomainResource): + """ Investigation to increase healthcare-related patient-independent knowledge. + + 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. + """ + + resource_type = "ResearchStudy" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.arm = None + """ Defined path through the study for a subject. + List of `ResearchStudyArm` items (represented as `dict` in JSON). """ + + self.category = None + """ 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). """ + + self.description = None + """ What this is study doing. + Type `str`. """ + + self.enrollment = None + """ Inclusion & exclusion criteria. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.focus = None + """ 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.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 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 (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 + """ 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 (represented as `dict` in JSON). """ + + self.reasonStopped = None + """ 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 + """ References and dependencies. + List of `RelatedArtifact` items (represented as `dict` in JSON). """ + + self.site = None + """ Facility where study activities are conducted. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.sponsor = None + """ Organization that initiates and is legally responsible for the + study. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.status = None + """ 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 + """ Name for this study. + Type `str`. """ + + super(ResearchStudy, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ResearchStudy, self).elementProperties() + 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), + ("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), + ("relatedArtifact", "relatedArtifact", relatedartifact.RelatedArtifact, True, None, False), + ("site", "site", fhirreference.FHIRReference, True, None, False), + ("sponsor", "sponsor", fhirreference.FHIRReference, False, None, False), + ("status", "status", str, False, None, True), + ("title", "title", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class ResearchStudyArm(backboneelement.BackboneElement): + """ Defined path through the study for a subject. + + Describes an expected sequence of events for one of the participants of a + study. E.g. Exposure to drug A, wash-out, exposure to drug B, wash-out, + follow-up. + """ + + resource_type = "ResearchStudyArm" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Short explanation of study path. + Type `str`. """ + + self.name = None + """ 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([ + ("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 + + +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 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'] diff --git a/fhirclient/models/R4/researchstudy_tests.py b/fhirclient/models/R4/researchstudy_tests.py new file mode 100644 index 000000000..acffac035 --- /dev/null +++ b/fhirclient/models/R4/researchstudy_tests.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import researchstudy +from .fhirdate import FHIRDate + + +class ResearchStudyTests(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("ResearchStudy", js["resourceType"]) + return researchstudy.ResearchStudy(js) + + def testResearchStudy1(self): + inst = self.instantiate_from("researchstudy-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ResearchStudy instance") + self.implResearchStudy1(inst) + + js = inst.as_json() + self.assertEqual("ResearchStudy", js["resourceType"]) + inst2 = researchstudy.ResearchStudy(js) + self.implResearchStudy1(inst2) + + def implResearchStudy1(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, "completed") + self.assertEqual(inst.text.div, "
[Put rendering here]
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/R4/researchsubject.py b/fhirclient/models/R4/researchsubject.py new file mode 100644 index 000000000..891e017e5 --- /dev/null +++ b/fhirclient/models/R4/researchsubject.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ResearchSubject) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class ResearchSubject(domainresource.DomainResource): + """ Physical entity which is the primary unit of interest in the study. + + A physical entity which is the primary unit of operational and/or + administrative interest in a study. + """ + + resource_type = "ResearchSubject" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.actualArm = None + """ What path was followed. + Type `str`. """ + + self.assignedArm = None + """ What path should be followed. + Type `str`. """ + + self.consent = None + """ Agreement to participate in study. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.identifier = None + """ 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` (represented as `dict` in JSON). """ + + self.period = None + """ Start and end of participation. + Type `Period` (represented as `dict` in JSON). """ + + self.status = None + """ 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` (represented as `dict` in JSON). """ + + super(ResearchSubject, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ResearchSubject, self).elementProperties() + js.extend([ + ("actualArm", "actualArm", str, False, None, False), + ("assignedArm", "assignedArm", str, False, None, False), + ("consent", "consent", fhirreference.FHIRReference, 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), + ("study", "study", fhirreference.FHIRReference, False, None, True), + ]) + return js + + +import sys +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/R4/researchsubject_tests.py b/fhirclient/models/R4/researchsubject_tests.py new file mode 100644 index 000000000..3e2ada280 --- /dev/null +++ b/fhirclient/models/R4/researchsubject_tests.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import researchsubject +from .fhirdate import FHIRDate + + +class ResearchSubjectTests(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("ResearchSubject", js["resourceType"]) + return researchsubject.ResearchSubject(js) + + def testResearchSubject1(self): + inst = self.instantiate_from("researchsubject-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ResearchSubject instance") + self.implResearchSubject1(inst) + + js = inst.as_json() + self.assertEqual("ResearchSubject", js["resourceType"]) + inst2 = researchsubject.ResearchSubject(js) + self.implResearchSubject1(inst2) + + def implResearchSubject1(self, inst): + self.assertEqual(inst.id, "example") + 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/R4/resource.py b/fhirclient/models/R4/resource.py new file mode 100644 index 000000000..9837c3469 --- /dev/null +++ b/fhirclient/models/R4/resource.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Resource) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import fhirabstractresource + +class Resource(fhirabstractresource.FHIRAbstractResource): + """ Base Resource. + + This is the base resource type for everything. + """ + + resource_type = "Resource" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.id = None + """ Logical id of this artifact. + Type `str`. """ + + self.implicitRules = None + """ A set of rules under which this content was created. + Type `str`. """ + + self.language = None + """ Language of the resource content. + Type `str`. """ + + self.meta = None + """ Metadata about the resource. + Type `Meta` (represented as `dict` in JSON). """ + + super(Resource, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Resource, self).elementProperties() + js.extend([ + ("id", "id", str, False, None, False), + ("implicitRules", "implicitRules", str, False, None, False), + ("language", "language", str, False, None, False), + ("meta", "meta", meta.Meta, False, None, False), + ]) + return js + + +import sys +try: + from . import meta +except ImportError: + meta = sys.modules[__package__ + '.meta'] diff --git a/fhirclient/models/R4/riskassessment.py b/fhirclient/models/R4/riskassessment.py new file mode 100644 index 000000000..5e5d7ad06 --- /dev/null +++ b/fhirclient/models/R4/riskassessment.py @@ -0,0 +1,221 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/RiskAssessment) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class RiskAssessment(domainresource.DomainResource): + """ Potential outcomes for a subject with likelihood. + + An assessment of the likely outcome(s) for a patient or other subject as + well as the likelihood of each outcome. + """ + + resource_type = "RiskAssessment" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.basedOn = None + """ Request fulfilled by this assessment. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.basis = None + """ Information used in assessment. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.code = None + """ Type of assessment. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.condition = None + """ Condition assessed. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.encounter = None + """ Where was assessment performed?. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.identifier = None + """ Unique identifier for the assessment. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.method = None + """ Evaluation mechanism. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.mitigation = None + """ 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). """ + + self.occurrencePeriod = None + """ When was assessment made?. + Type `Period` (represented as `dict` in JSON). """ + + self.parent = None + """ Part of this occurrence. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.performer = None + """ Who did assessment?. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.prediction = None + """ Outcome predicted. + List of `RiskAssessmentPrediction` items (represented as `dict` in JSON). """ + + self.reasonCode = None + """ Why the assessment was necessary?. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.reasonReference = None + """ Why the assessment was necessary?. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.status = None + """ registered | preliminary | final | amended +. + Type `str`. """ + + self.subject = None + """ Who/what does assessment apply to?. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(RiskAssessment, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(RiskAssessment, self).elementProperties() + js.extend([ + ("basedOn", "basedOn", fhirreference.FHIRReference, False, None, False), + ("basis", "basis", fhirreference.FHIRReference, True, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("condition", "condition", fhirreference.FHIRReference, 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), + ("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, True), + ]) + return js + + +from . import backboneelement + +class RiskAssessmentPrediction(backboneelement.BackboneElement): + """ Outcome predicted. + + Describes the expected outcome for the subject. + """ + + resource_type = "RiskAssessmentPrediction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.outcome = None + """ Possible outcome for the subject. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.probabilityDecimal = None + """ Likelihood of specified outcome. + Type `float`. """ + + self.probabilityRange = None + """ Likelihood of specified outcome. + Type `Range` (represented as `dict` in JSON). """ + + self.qualitativeRisk = None + """ Likelihood of specified outcome as a qualitative value. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.rationale = None + """ Explanation of prediction. + Type `str`. """ + + self.relativeRisk = None + """ Relative likelihood. + Type `float`. """ + + self.whenPeriod = None + """ Timeframe or age range. + Type `Period` (represented as `dict` in JSON). """ + + self.whenRange = None + """ Timeframe or age range. + Type `Range` (represented as `dict` in JSON). """ + + super(RiskAssessmentPrediction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(RiskAssessmentPrediction, self).elementProperties() + js.extend([ + ("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), + ("rationale", "rationale", str, False, None, False), + ("relativeRisk", "relativeRisk", float, False, None, False), + ("whenPeriod", "whenPeriod", period.Period, False, "when", False), + ("whenRange", "whenRange", range.Range, False, "when", 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'] +try: + from . import range +except ImportError: + range = sys.modules[__package__ + '.range'] diff --git a/fhirclient/models/R4/riskassessment_tests.py b/fhirclient/models/R4/riskassessment_tests.py new file mode 100644 index 000000000..7236b7c3d --- /dev/null +++ b/fhirclient/models/R4/riskassessment_tests.py @@ -0,0 +1,225 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import riskassessment +from .fhirdate import FHIRDate + + +class RiskAssessmentTests(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("RiskAssessment", js["resourceType"]) + return riskassessment.RiskAssessment(js) + + def testRiskAssessment1(self): + inst = self.instantiate_from("riskassessment-example-population.json") + self.assertIsNotNone(inst, "Must have instantiated a RiskAssessment instance") + self.implRiskAssessment1(inst) + + js = inst.as_json() + self.assertEqual("RiskAssessment", js["resourceType"]) + inst2 = riskassessment.RiskAssessment(js) + 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[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") + self.assertEqual(inst.prediction[0].probabilityDecimal, 0.02) + self.assertEqual(inst.prediction[0].whenRange.high.code, "a") + self.assertEqual(inst.prediction[0].whenRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[0].whenRange.high.unit, "years") + self.assertEqual(inst.prediction[0].whenRange.high.value, 49) + self.assertEqual(inst.prediction[0].whenRange.low.code, "a") + self.assertEqual(inst.prediction[0].whenRange.low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[0].whenRange.low.unit, "years") + self.assertEqual(inst.prediction[0].whenRange.low.value, 39) + self.assertEqual(inst.status, "final") + self.assertEqual(inst.text.status, "additional") + + def testRiskAssessment3(self): + inst = self.instantiate_from("riskassessment-example.json") + self.assertIsNotNone(inst, "Must have instantiated a RiskAssessment instance") + self.implRiskAssessment3(inst) + + js = inst.as_json() + self.assertEqual("RiskAssessment", js["resourceType"]) + inst2 = riskassessment.RiskAssessment(js) + self.implRiskAssessment3(inst2) + + def implRiskAssessment3(self, inst): + 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") + self.assertEqual(inst.prediction[0].probabilityDecimal, 0.000168) + self.assertEqual(inst.prediction[0].whenRange.high.code, "a") + self.assertEqual(inst.prediction[0].whenRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[0].whenRange.high.unit, "years") + self.assertEqual(inst.prediction[0].whenRange.high.value, 53) + self.assertEqual(inst.prediction[1].outcome.text, "Breast Cancer") + self.assertEqual(inst.prediction[1].probabilityDecimal, 0.000368) + self.assertEqual(inst.prediction[1].whenRange.high.code, "a") + self.assertEqual(inst.prediction[1].whenRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[1].whenRange.high.unit, "years") + self.assertEqual(inst.prediction[1].whenRange.high.value, 57) + self.assertEqual(inst.prediction[1].whenRange.low.code, "a") + self.assertEqual(inst.prediction[1].whenRange.low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[1].whenRange.low.unit, "years") + self.assertEqual(inst.prediction[1].whenRange.low.value, 54) + self.assertEqual(inst.prediction[2].outcome.text, "Breast Cancer") + self.assertEqual(inst.prediction[2].probabilityDecimal, 0.000594) + self.assertEqual(inst.prediction[2].whenRange.high.code, "a") + self.assertEqual(inst.prediction[2].whenRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[2].whenRange.high.unit, "years") + self.assertEqual(inst.prediction[2].whenRange.high.value, 62) + self.assertEqual(inst.prediction[2].whenRange.low.code, "a") + self.assertEqual(inst.prediction[2].whenRange.low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[2].whenRange.low.unit, "years") + self.assertEqual(inst.prediction[2].whenRange.low.value, 58) + self.assertEqual(inst.prediction[3].outcome.text, "Breast Cancer") + self.assertEqual(inst.prediction[3].probabilityDecimal, 0.000838) + self.assertEqual(inst.prediction[3].whenRange.high.code, "a") + self.assertEqual(inst.prediction[3].whenRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[3].whenRange.high.unit, "years") + self.assertEqual(inst.prediction[3].whenRange.high.value, 67) + self.assertEqual(inst.prediction[3].whenRange.low.code, "a") + self.assertEqual(inst.prediction[3].whenRange.low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[3].whenRange.low.unit, "years") + self.assertEqual(inst.prediction[3].whenRange.low.value, 63) + self.assertEqual(inst.prediction[4].outcome.text, "Breast Cancer") + self.assertEqual(inst.prediction[4].probabilityDecimal, 0.001089) + self.assertEqual(inst.prediction[4].whenRange.high.code, "a") + self.assertEqual(inst.prediction[4].whenRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[4].whenRange.high.unit, "years") + self.assertEqual(inst.prediction[4].whenRange.high.value, 72) + self.assertEqual(inst.prediction[4].whenRange.low.code, "a") + self.assertEqual(inst.prediction[4].whenRange.low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[4].whenRange.low.unit, "years") + self.assertEqual(inst.prediction[4].whenRange.low.value, 68) + self.assertEqual(inst.prediction[5].outcome.text, "Breast Cancer") + self.assertEqual(inst.prediction[5].probabilityDecimal, 0.001327) + self.assertEqual(inst.prediction[5].whenRange.high.code, "a") + self.assertEqual(inst.prediction[5].whenRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[5].whenRange.high.unit, "years") + self.assertEqual(inst.prediction[5].whenRange.high.value, 77) + self.assertEqual(inst.prediction[5].whenRange.low.code, "a") + self.assertEqual(inst.prediction[5].whenRange.low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[5].whenRange.low.unit, "years") + self.assertEqual(inst.prediction[5].whenRange.low.value, 73) + self.assertEqual(inst.prediction[6].outcome.text, "Breast Cancer") + self.assertEqual(inst.prediction[6].probabilityDecimal, 0.00153) + self.assertEqual(inst.prediction[6].whenRange.high.code, "a") + self.assertEqual(inst.prediction[6].whenRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[6].whenRange.high.unit, "years") + self.assertEqual(inst.prediction[6].whenRange.high.value, 82) + self.assertEqual(inst.prediction[6].whenRange.low.code, "a") + self.assertEqual(inst.prediction[6].whenRange.low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[6].whenRange.low.unit, "years") + self.assertEqual(inst.prediction[6].whenRange.low.value, 78) + self.assertEqual(inst.prediction[7].outcome.text, "Breast Cancer") + self.assertEqual(inst.prediction[7].probabilityDecimal, 0.001663) + self.assertEqual(inst.prediction[7].whenRange.high.code, "a") + self.assertEqual(inst.prediction[7].whenRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[7].whenRange.high.unit, "years") + self.assertEqual(inst.prediction[7].whenRange.high.value, 88) + self.assertEqual(inst.prediction[7].whenRange.low.code, "a") + self.assertEqual(inst.prediction[7].whenRange.low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[7].whenRange.low.unit, "years") + 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/R4/riskevidencesynthesis.py similarity index 99% rename from fhirclient/models/riskevidencesynthesis.py rename to fhirclient/models/R4/riskevidencesynthesis.py index 3a0e31558..61820bc9a 100644 --- a/fhirclient/models/riskevidencesynthesis.py +++ b/fhirclient/models/R4/riskevidencesynthesis.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/RiskEvidenceSynthesis) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/RiskEvidenceSynthesis) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/riskevidencesynthesis_tests.py b/fhirclient/models/R4/riskevidencesynthesis_tests.py similarity index 94% rename from fhirclient/models/riskevidencesynthesis_tests.py rename to fhirclient/models/R4/riskevidencesynthesis_tests.py index 611ed7243..45170b318 100644 --- a/fhirclient/models/riskevidencesynthesis_tests.py +++ b/fhirclient/models/R4/riskevidencesynthesis_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/R4/sampleddata.py b/fhirclient/models/R4/sampleddata.py new file mode 100644 index 000000000..e1b5530f9 --- /dev/null +++ b/fhirclient/models/R4/sampleddata.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SampledData) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class SampledData(element.Element): + """ A series of measurements taken by a device. + + A series of measurements taken by a device, with upper and lower limits. + There may be more than one dimension in the data. + """ + + resource_type = "SampledData" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.data = None + """ Decimal values with spaces, or "E" | "U" | "L". + Type `str`. """ + + self.dimensions = None + """ Number of sample points at each time point. + Type `int`. """ + + self.factor = None + """ Multiply data by this before adding to origin. + Type `float`. """ + + self.lowerLimit = None + """ Lower limit of detection. + Type `float`. """ + + self.origin = None + """ Zero value and units. + Type `Quantity` (represented as `dict` in JSON). """ + + self.period = None + """ Number of milliseconds between samples. + Type `float`. """ + + self.upperLimit = None + """ Upper limit of detection. + Type `float`. """ + + super(SampledData, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SampledData, self).elementProperties() + js.extend([ + ("data", "data", str, False, None, False), + ("dimensions", "dimensions", int, False, None, True), + ("factor", "factor", float, False, None, False), + ("lowerLimit", "lowerLimit", float, False, None, False), + ("origin", "origin", quantity.Quantity, False, None, True), + ("period", "period", float, False, None, True), + ("upperLimit", "upperLimit", float, False, None, False), + ]) + return js + + +import sys +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/R4/schedule.py b/fhirclient/models/R4/schedule.py new file mode 100644 index 000000000..8305b010e --- /dev/null +++ b/fhirclient/models/R4/schedule.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Schedule) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Schedule(domainresource.DomainResource): + """ A container for slots of time that may be available for booking + appointments. + """ + + resource_type = "Schedule" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 schedule is in active use. + Type `bool`. """ + + self.actor = None + """ Resource(s) that availability information is being provided for. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.comment = None + """ Comments on availability. + Type `str`. """ + + self.identifier = None + """ External Ids for this item. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.planningHorizon = None + """ Period of time covered by schedule. + Type `Period` (represented as `dict` in JSON). """ + + self.serviceCategory = None + """ High-level category. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.serviceType = None + """ Specific service. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.specialty = None + """ Type of specialty needed. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(Schedule, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Schedule, self).elementProperties() + js.extend([ + ("active", "active", bool, False, None, False), + ("actor", "actor", fhirreference.FHIRReference, True, None, True), + ("comment", "comment", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("planningHorizon", "planningHorizon", period.Period, False, None, False), + ("serviceCategory", "serviceCategory", codeableconcept.CodeableConcept, True, None, False), + ("serviceType", "serviceType", codeableconcept.CodeableConcept, True, None, False), + ("specialty", "specialty", codeableconcept.CodeableConcept, 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 period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/R4/schedule_tests.py b/fhirclient/models/R4/schedule_tests.py new file mode 100644 index 000000000..85b89a406 --- /dev/null +++ b/fhirclient/models/R4/schedule_tests.py @@ -0,0 +1,119 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import schedule +from .fhirdate import FHIRDate + + +class ScheduleTests(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("Schedule", js["resourceType"]) + return schedule.Schedule(js) + + def testSchedule1(self): + inst = self.instantiate_from("schedule-provider-location1-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Schedule instance") + self.implSchedule1(inst) + + js = inst.as_json() + self.assertEqual("Schedule", js["resourceType"]) + inst2 = schedule.Schedule(js) + self.implSchedule1(inst2) + + def implSchedule1(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.identifier[0].system, "http://example.org/scheduleid") + self.assertEqual(inst.identifier[0].use, "usual") + 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-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Schedule instance") + self.implSchedule2(inst) + + js = inst.as_json() + self.assertEqual("Schedule", js["resourceType"]) + inst2 = schedule.Schedule(js) + self.implSchedule2(inst2) + + def implSchedule2(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.identifier[0].system, "http://example.org/scheduleid") + self.assertEqual(inst.identifier[0].use, "usual") + 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): + inst = self.instantiate_from("schedule-provider-location2-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Schedule instance") + self.implSchedule3(inst) + + js = inst.as_json() + self.assertEqual("Schedule", js["resourceType"]) + inst2 = schedule.Schedule(js) + self.implSchedule3(inst2) + + def implSchedule3(self, inst): + self.assertTrue(inst.active) + self.assertEqual(inst.comment, "The slots attached to this schedule are for neurosurgery operations at Starfleet HQ only.") + self.assertEqual(inst.id, "exampleloc2") + 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[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") + self.assertEqual(inst.specialty[0].coding[0].display, "Surgery-Neurosurgery") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/R4/searchparameter.py b/fhirclient/models/R4/searchparameter.py new file mode 100644 index 000000000..a97033ec4 --- /dev/null +++ b/fhirclient/models/R4/searchparameter.py @@ -0,0 +1,222 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SearchParameter) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class SearchParameter(domainresource.DomainResource): + """ Search parameter for a resource. + + A search parameter that defines a named search item that can be used to + search/filter on a resource. + """ + + resource_type = "SearchParameter" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.base = None + """ The resource type(s) this search parameter applies to. + List of `str` items. """ + + self.chain = None + """ Chained names supported. + List of `str` items. """ + + self.code = None + """ Code used in URL. + Type `str`. """ + + self.comparator = None + """ eq | ne | gt | lt | ge | le | sa | eb | ap. + List of `str` items. """ + + self.component = None + """ For Composite resources to define the parts. + List of `SearchParameterComponent` items (represented as `dict` in JSON). """ + + self.contact = None + """ Contact details for the publisher. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.date = None + """ Date last changed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.derivedFrom = None + """ Original definition for the search parameter. + Type `str`. """ + + self.description = None + """ Natural language description of the search parameter. + Type `str`. """ + + self.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.expression = None + """ FHIRPath expression that extracts the values. + Type `str`. """ + + self.jurisdiction = None + """ Intended jurisdiction for search parameter (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.modifier = None + """ missing | exact | contains | not | text | in | not-in | below | + 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`. """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this search parameter is defined. + Type `str`. """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.target = None + """ Types of resource (if a resource reference). + List of `str` items. """ + + self.type = None + """ number | date | string | token | reference | composite | quantity | + uri | special. + Type `str`. """ + + self.url = None + """ Canonical identifier for this search parameter, 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 search parameter. + Type `str`. """ + + self.xpath = None + """ XPath that extracts the values. + Type `str`. """ + + self.xpathUsage = None + """ normal | phonetic | nearby | distance | other. + Type `str`. """ + + super(SearchParameter, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SearchParameter, self).elementProperties() + js.extend([ + ("base", "base", str, True, None, True), + ("chain", "chain", str, True, None, False), + ("code", "code", str, False, None, True), + ("comparator", "comparator", str, True, None, False), + ("component", "component", SearchParameterComponent, True, None, False), + ("contact", "contact", contactdetail.ContactDetail, True, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("derivedFrom", "derivedFrom", str, False, None, False), + ("description", "description", str, False, None, True), + ("experimental", "experimental", bool, False, None, False), + ("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), + ("status", "status", str, False, None, True), + ("target", "target", str, True, None, False), + ("type", "type", str, False, None, True), + ("url", "url", str, False, None, True), + ("useContext", "useContext", usagecontext.UsageContext, True, None, False), + ("version", "version", str, False, None, False), + ("xpath", "xpath", str, False, None, False), + ("xpathUsage", "xpathUsage", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class SearchParameterComponent(backboneelement.BackboneElement): + """ For Composite resources to define the parts. + + Used to define the parts of a composite search parameter. + """ + + resource_type = "SearchParameterComponent" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Defines how the part works. + Type `str`. """ + + self.expression = None + """ Subexpression relative to main expression. + Type `str`. """ + + super(SearchParameterComponent, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SearchParameterComponent, self).elementProperties() + js.extend([ + ("definition", "definition", str, False, None, True), + ("expression", "expression", 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 usagecontext +except ImportError: + usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/R4/searchparameter_tests.py b/fhirclient/models/R4/searchparameter_tests.py new file mode 100644 index 000000000..37fb082b8 --- /dev/null +++ b/fhirclient/models/R4/searchparameter_tests.py @@ -0,0 +1,129 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import searchparameter +from .fhirdate import FHIRDate + + +class SearchParameterTests(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("SearchParameter", js["resourceType"]) + return searchparameter.SearchParameter(js) + + def testSearchParameter1(self): + inst = self.instantiate_from("searchparameter-example-extension.json") + self.assertIsNotNone(inst, "Must have instantiated a SearchParameter instance") + self.implSearchParameter1(inst) + + js = inst.as_json() + self.assertEqual("SearchParameter", js["resourceType"]) + inst2 = searchparameter.SearchParameter(js) + self.implSearchParameter1(inst2) + + def implSearchParameter1(self, inst): + self.assertEqual(inst.base[0], "Patient") + self.assertEqual(inst.code, "part-agree") + self.assertEqual(inst.contact[0].telecom[0].system, "url") + self.assertEqual(inst.contact[0].telecom[0].value, "http://hl7.org/fhir") + self.assertEqual(inst.description, "Search by url for a participation agreement, which is stored in a DocumentReference") + self.assertTrue(inst.experimental) + self.assertEqual(inst.expression, "DocumentReference.extension('http://example.org/fhir/StructureDefinition/participation-agreement')") + self.assertEqual(inst.id, "example-extension") + self.assertEqual(inst.name, "Example Search Parameter on an extension") + self.assertEqual(inst.publisher, "Health Level Seven International (FHIR Infrastructure)") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.target[0], "DocumentReference") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type, "reference") + self.assertEqual(inst.url, "http://hl7.org/fhir/SearchParameter/example-extension") + self.assertEqual(inst.xpath, "f:DocumentReference/f:extension[@url='http://example.org/fhir/StructureDefinition/participation-agreement']") + self.assertEqual(inst.xpathUsage, "normal") + + def testSearchParameter2(self): + inst = self.instantiate_from("searchparameter-example-reference.json") + self.assertIsNotNone(inst, "Must have instantiated a SearchParameter instance") + self.implSearchParameter2(inst) + + js = inst.as_json() + self.assertEqual("SearchParameter", js["resourceType"]) + inst2 = searchparameter.SearchParameter(js) + self.implSearchParameter2(inst2) + + def implSearchParameter2(self, inst): + self.assertEqual(inst.base[0], "Condition") + self.assertEqual(inst.chain[0], "name") + self.assertEqual(inst.chain[1], "identifier") + self.assertEqual(inst.code, "subject") + self.assertEqual(inst.contact[0].name, "[string]") + 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-10-23").date) + self.assertEqual(inst.date.as_json(), "2013-10-23") + self.assertEqual(inst.description, "Search by condition subject") + self.assertTrue(inst.experimental) + self.assertEqual(inst.expression, "Condition.subject") + self.assertEqual(inst.id, "example-reference") + self.assertEqual(inst.modifier[0], "missing") + self.assertEqual(inst.name, "Example Search Parameter") + self.assertEqual(inst.publisher, "Health Level Seven International (FHIR Infrastructure)") + self.assertEqual(inst.purpose, "Need to search Condition by subject") + self.assertEqual(inst.status, "draft") + 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-reference") + self.assertEqual(inst.xpathUsage, "normal") + + def testSearchParameter3(self): + inst = self.instantiate_from("searchparameter-example.json") + self.assertIsNotNone(inst, "Must have instantiated a SearchParameter instance") + self.implSearchParameter3(inst) + + js = inst.as_json() + self.assertEqual("SearchParameter", js["resourceType"]) + inst2 = searchparameter.SearchParameter(js) + self.implSearchParameter3(inst2) + + def implSearchParameter3(self, inst): + self.assertEqual(inst.base[0], "Resource") + self.assertEqual(inst.code, "_id") + self.assertEqual(inst.comparator[0], "eq") + self.assertEqual(inst.contact[0].name, "[string]") + 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-10-23").date) + self.assertEqual(inst.date.as_json(), "2013-10-23") + self.assertEqual(inst.derivedFrom, "http://hl7.org/fhir/SearchParameter/Resource-id") + self.assertEqual(inst.description, "Search by resource identifier - e.g. same as the read interaction, but can return included resources") + self.assertTrue(inst.experimental) + self.assertEqual(inst.expression, "id") + 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, "ID-SEARCH-PARAMETER") + self.assertEqual(inst.publisher, "Health Level Seven International (FHIR Infrastructure)") + self.assertEqual(inst.purpose, "Need to search by identifier for various infrastructural cases - mainly retrieving packages, and matching as part of a chain") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + 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://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://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/servicerequest.py b/fhirclient/models/R4/servicerequest.py similarity index 99% rename from fhirclient/models/servicerequest.py rename to fhirclient/models/R4/servicerequest.py index 3d5cda6fa..cf8b46544 100644 --- a/fhirclient/models/servicerequest.py +++ b/fhirclient/models/R4/servicerequest.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ServiceRequest) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ServiceRequest) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/servicerequest_tests.py b/fhirclient/models/R4/servicerequest_tests.py similarity index 99% rename from fhirclient/models/servicerequest_tests.py rename to fhirclient/models/R4/servicerequest_tests.py index 0dbb2b06d..fd1a5fa4c 100644 --- a/fhirclient/models/servicerequest_tests.py +++ b/fhirclient/models/R4/servicerequest_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/R4/signature.py b/fhirclient/models/R4/signature.py new file mode 100644 index 000000000..0170df426 --- /dev/null +++ b/fhirclient/models/R4/signature.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Signature) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Signature(element.Element): + """ A Signature - XML DigSig, JWS, Graphical image of signature, etc.. + + 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.data = None + """ The actual signature content (XML DigSig. JWS, picture, etc.). + Type `str`. """ + + 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.targetFormat = None + """ The technical format of the signed resources. + Type `str`. """ + + self.type = None + """ Indication of the reason the entity signed the object(s). + List of `Coding` items (represented as `dict` in JSON). """ + + self.when = None + """ When the signature was created. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.who = None + """ Who signed. + 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([ + ("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), + ("who", "who", fhirreference.FHIRReference, False, None, True), + ]) + return js + + +import sys +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'] diff --git a/fhirclient/models/R4/slot.py b/fhirclient/models/R4/slot.py new file mode 100644 index 000000000..8aae1b98f --- /dev/null +++ b/fhirclient/models/R4/slot.py @@ -0,0 +1,113 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Slot) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Slot(domainresource.DomainResource): + """ A slot of time on a schedule that may be available for booking appointments. + """ + + resource_type = "Slot" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.appointmentType = None + """ The style of appointment or patient that may be booked in the slot + (not service type). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.comment = None + """ Comments on the slot to describe any extended information. Such as + custom constraints on the slot. + Type `str`. """ + + self.end = None + """ Date/Time that the slot is to conclude. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.identifier = None + """ External Ids for this item. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.overbooked = None + """ This slot has already been overbooked, appointments are unlikely to + be accepted for this time. + Type `bool`. """ + + self.schedule = None + """ The schedule resource that this slot defines an interval of status + information. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.serviceCategory = None + """ A broad categorization of the service that is to be performed + during this appointment. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.serviceType = None + """ The type of appointments that can be booked into this slot (ideally + this would be an identifiable service - which is at a location, + rather than the location itself). If provided then this overrides + the value provided on the availability resource. + 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. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.start = None + """ Date/Time that the slot is to begin. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.status = None + """ busy | free | busy-unavailable | busy-tentative | entered-in-error. + Type `str`. """ + + super(Slot, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Slot, self).elementProperties() + js.extend([ + ("appointmentType", "appointmentType", codeableconcept.CodeableConcept, False, None, False), + ("comment", "comment", str, False, None, False), + ("end", "end", fhirdate.FHIRDate, False, None, True), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("overbooked", "overbooked", bool, False, None, False), + ("schedule", "schedule", fhirreference.FHIRReference, False, None, True), + ("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), + ("status", "status", 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'] diff --git a/fhirclient/models/R4/slot_tests.py b/fhirclient/models/R4/slot_tests.py new file mode 100644 index 000000000..77552d752 --- /dev/null +++ b/fhirclient/models/R4/slot_tests.py @@ -0,0 +1,133 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import slot +from .fhirdate import FHIRDate + + +class SlotTests(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("Slot", js["resourceType"]) + return slot.Slot(js) + + def testSlot1(self): + inst = self.instantiate_from("slot-example-busy.json") + self.assertIsNotNone(inst, "Must have instantiated a Slot instance") + self.implSlot1(inst) + + js = inst.as_json() + self.assertEqual("Slot", js["resourceType"]) + inst2 = slot.Slot(js) + self.implSlot1(inst2) + + def implSlot1(self, inst): + self.assertEqual(inst.comment, "Assessments should be performed before requesting appointments in this slot.") + self.assertEqual(inst.end.date, FHIRDate("2013-12-25T09:15:00Z").date) + self.assertEqual(inst.end.as_json(), "2013-12-25T09:15:00Z") + 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[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.json") + self.assertIsNotNone(inst, "Must have instantiated a Slot instance") + self.implSlot2(inst) + + js = inst.as_json() + self.assertEqual("Slot", js["resourceType"]) + inst2 = slot.Slot(js) + self.implSlot2(inst2) + + def implSlot2(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://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): + inst = self.instantiate_from("slot-example-unavailable.json") + self.assertIsNotNone(inst, "Must have instantiated a Slot instance") + self.implSlot3(inst) + + js = inst.as_json() + self.assertEqual("Slot", js["resourceType"]) + inst2 = slot.Slot(js) + self.implSlot3(inst2) + + def implSlot3(self, inst): + self.assertEqual(inst.comment, "Dr Careful is out of the office") + 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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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-tentative.json") + self.assertIsNotNone(inst, "Must have instantiated a Slot instance") + self.implSlot4(inst) + + js = inst.as_json() + self.assertEqual("Slot", js["resourceType"]) + inst2 = slot.Slot(js) + self.implSlot4(inst2) + + def implSlot4(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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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/R4/specimen.py b/fhirclient/models/R4/specimen.py new file mode 100644 index 000000000..e6621f22e --- /dev/null +++ b/fhirclient/models/R4/specimen.py @@ -0,0 +1,317 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Specimen) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Specimen(domainresource.DomainResource): + """ Sample for analysis. + + A sample to be used for analysis. + """ + + resource_type = "Specimen" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.accessionIdentifier = None + """ Identifier assigned by the lab. + Type `Identifier` (represented as `dict` in JSON). """ + + self.collection = None + """ 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). """ + + self.identifier = None + """ External Identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.note = None + """ Comments. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.parent = None + """ Specimen from which this specimen originated. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.processing = None + """ Processing and processing step details. + List of `SpecimenProcessing` items (represented as `dict` in JSON). """ + + self.receivedTime = None + """ The time when specimen was received for processing. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.request = None + """ Why the specimen was collected. + 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 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. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(Specimen, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Specimen, self).elementProperties() + 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), + ("parent", "parent", fhirreference.FHIRReference, True, None, False), + ("processing", "processing", SpecimenProcessing, True, None, False), + ("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, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import backboneelement + +class SpecimenCollection(backboneelement.BackboneElement): + """ Collection details. + + Details concerning the specimen collection. + """ + + resource_type = "SpecimenCollection" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.bodySite = None + """ Anatomical collection site. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.collectedDateTime = None + """ Collection time. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.collectedPeriod = None + """ Collection time. + Type `Period` (represented as `dict` in JSON). """ + + self.collector = None + """ Who collected the specimen. + 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. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.quantity = None + """ The quantity of specimen collected. + Type `Quantity` (represented as `dict` in JSON). """ + + super(SpecimenCollection, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SpecimenCollection, self).elementProperties() + js.extend([ + ("bodySite", "bodySite", codeableconcept.CodeableConcept, False, None, False), + ("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), + ]) + return js + + +class SpecimenContainer(backboneelement.BackboneElement): + """ Direct container of specimen (tube/slide, etc.). + + The container holding the specimen. The recursive nature of containers; + i.e. blood in tube in tray in rack is not addressed here. + """ + + resource_type = "SpecimenContainer" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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). """ + + self.capacity = None + """ Container volume or size. + Type `Quantity` (represented as `dict` in JSON). """ + + self.description = None + """ Textual description of the container. + Type `str`. """ + + self.identifier = None + """ Id for the container. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.specimenQuantity = None + """ Quantity of specimen within container. + Type `Quantity` (represented as `dict` in JSON). """ + + self.type = None + """ Kind of container directly associated with specimen. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(SpecimenContainer, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SpecimenContainer, self).elementProperties() + js.extend([ + ("additiveCodeableConcept", "additiveCodeableConcept", codeableconcept.CodeableConcept, False, "additive", False), + ("additiveReference", "additiveReference", fhirreference.FHIRReference, False, "additive", False), + ("capacity", "capacity", quantity.Quantity, False, None, False), + ("description", "description", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("specimenQuantity", "specimenQuantity", quantity.Quantity, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class SpecimenProcessing(backboneelement.BackboneElement): + """ Processing and processing step details. + + Details concerning processing and processing steps for the specimen. + """ + + resource_type = "SpecimenProcessing" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Material used in the processing step. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.description = None + """ Textual description of procedure. + Type `str`. """ + + self.procedure = None + """ Indicates the treatment step applied to the specimen. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.timeDateTime = None + """ Date and time of specimen processing. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.timePeriod = None + """ Date and time of specimen processing. + Type `Period` (represented as `dict` in JSON). """ + + super(SpecimenProcessing, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SpecimenProcessing, self).elementProperties() + js.extend([ + ("additive", "additive", fhirreference.FHIRReference, True, 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 + + +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 duration +except ImportError: + duration = sys.modules[__package__ + '.duration'] +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 quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/R4/specimen_tests.py b/fhirclient/models/R4/specimen_tests.py new file mode 100644 index 000000000..d317bdaf7 --- /dev/null +++ b/fhirclient/models/R4/specimen_tests.py @@ -0,0 +1,194 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import specimen +from .fhirdate import FHIRDate + + +class SpecimenTests(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("Specimen", js["resourceType"]) + return specimen.Specimen(js) + + def testSpecimen1(self): + inst = self.instantiate_from("specimen-example-isolate.json") + self.assertIsNotNone(inst, "Must have instantiated a Specimen instance") + self.implSpecimen1(inst) + + js = inst.as_json() + self.assertEqual("Specimen", js["resourceType"]) + inst2 = specimen.Specimen(js) + self.implSpecimen1(inst2) + + def implSpecimen1(self, inst): + self.assertEqual(inst.accessionIdentifier.system, "http://lab.acme.org/specimens/2011") + self.assertEqual(inst.accessionIdentifier.value, "X352356-ISO1") + 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://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") + self.assertEqual(inst.status, "available") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.coding[0].code, "429951000124103") + self.assertEqual(inst.type.coding[0].display, "Bacterial isolate specimen") + self.assertEqual(inst.type.coding[0].system, "http://snomed.info/sct") + + def testSpecimen2(self): + inst = self.instantiate_from("specimen-example-pooled-serum.json") + self.assertIsNotNone(inst, "Must have instantiated a Specimen instance") + self.implSpecimen2(inst) + + js = inst.as_json() + self.assertEqual("Specimen", js["resourceType"]) + inst2 = specimen.Specimen(js) + self.implSpecimen2(inst2) + + def implSpecimen2(self, inst): + 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, "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") + self.assertIsNotNone(inst, "Must have instantiated a Specimen instance") + self.implSpecimen3(inst) + + js = inst.as_json() + self.assertEqual("Specimen", js["resourceType"]) + inst2 = specimen.Specimen(js) + self.implSpecimen3(inst2) + + def implSpecimen3(self, inst): + self.assertEqual(inst.accessionIdentifier.system, "http://lab.acme.org/specimens/2015") + self.assertEqual(inst.accessionIdentifier.value, "X352356") + self.assertEqual(inst.collection.collectedDateTime.date, FHIRDate("2015-08-18T07:03:00Z").date) + self.assertEqual(inst.collection.collectedDateTime.as_json(), "2015-08-18T07:03:00Z") + self.assertEqual(inst.container[0].capacity.unit, "mls") + self.assertEqual(inst.container[0].capacity.value, 50) + self.assertEqual(inst.container[0].specimenQuantity.unit, "mls") + 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://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) + self.assertEqual(inst.receivedTime.as_json(), "2015-08-18T07:03:00Z") + self.assertEqual(inst.status, "available") + 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://terminology.hl7.org/CodeSystem/v2-0487") + + def testSpecimen4(self): + inst = self.instantiate_from("specimen-example-serum.json") + self.assertIsNotNone(inst, "Must have instantiated a Specimen instance") + self.implSpecimen4(inst) + + js = inst.as_json() + self.assertEqual("Specimen", js["resourceType"]) + inst2 = specimen.Specimen(js) + 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") + self.assertEqual(inst.collection.bodySite.coding[0].display, "Structure of median cubital vein (body structure)") + self.assertEqual(inst.collection.bodySite.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.collection.bodySite.text, "Right median cubital vein") + 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://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") + self.assertEqual(inst.container[0].capacity.unit, "mL") + self.assertEqual(inst.container[0].capacity.value, 10) + self.assertEqual(inst.container[0].description, "Green Gel tube") + self.assertEqual(inst.container[0].identifier[0].value, "48736-15394-75465") + self.assertEqual(inst.container[0].specimenQuantity.unit, "mL") + self.assertEqual(inst.container[0].specimenQuantity.value, 6) + self.assertEqual(inst.container[0].type.text, "Vacutainer") + 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") + self.assertEqual(inst.status, "available") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.coding[0].code, "122555007") + self.assertEqual(inst.type.coding[0].display, "Venous blood specimen") + self.assertEqual(inst.type.coding[0].system, "http://snomed.info/sct") + diff --git a/fhirclient/models/specimendefinition.py b/fhirclient/models/R4/specimendefinition.py similarity index 99% rename from fhirclient/models/specimendefinition.py rename to fhirclient/models/R4/specimendefinition.py index 06d070da7..e1b11b106 100644 --- a/fhirclient/models/specimendefinition.py +++ b/fhirclient/models/R4/specimendefinition.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SpecimenDefinition) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SpecimenDefinition) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/specimendefinition_tests.py b/fhirclient/models/R4/specimendefinition_tests.py similarity index 99% rename from fhirclient/models/specimendefinition_tests.py rename to fhirclient/models/R4/specimendefinition_tests.py index ed93dd43d..8c0f869f4 100644 --- a/fhirclient/models/specimendefinition_tests.py +++ b/fhirclient/models/R4/specimendefinition_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/R4/structuredefinition.py b/fhirclient/models/R4/structuredefinition.py new file mode 100644 index 000000000..f7d187171 --- /dev/null +++ b/fhirclient/models/R4/structuredefinition.py @@ -0,0 +1,346 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/StructureDefinition) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class StructureDefinition(domainresource.DomainResource): + """ Structural Definition. + + A definition of a FHIR structure. This resource is used to describe the + underlying resources, data types defined in FHIR, and also for describing + extensions and constraints on resources and data types. + """ + + resource_type = "StructureDefinition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.abstract = None + """ Whether the structure is abstract. + Type `bool`. """ + + self.baseDefinition = None + """ Definition that this type is constrained/specialized from. + Type `str`. """ + + self.contact = None + """ Contact details for the publisher. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.context = None + """ 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.copyright = None + """ Use and/or publishing restrictions. + Type `str`. """ + + self.date = None + """ Date last changed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.derivation = None + """ specialization | constraint - How relates to base definition. + Type `str`. """ + + self.description = None + """ Natural language description of the structure definition. + Type `str`. """ + + self.differential = None + """ Differential view of the structure. + Type `StructureDefinitionDifferential` (represented as `dict` in JSON). """ + + self.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.fhirVersion = None + """ FHIR Version this StructureDefinition targets. + Type `str`. """ + + self.identifier = None + """ Additional identifier for the structure definition. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ Intended jurisdiction for structure definition (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.keyword = None + """ Assist with indexing and finding. + List of `Coding` items (represented as `dict` in JSON). """ + + self.kind = None + """ primitive-type | complex-type | resource | logical. + Type `str`. """ + + self.mapping = None + """ External specification that the content is mapped to. + List of `StructureDefinitionMapping` items (represented as `dict` in JSON). """ + + self.name = None + """ Name for this structure definition (computer friendly). + Type `str`. """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this structure definition is defined. + Type `str`. """ + + self.snapshot = None + """ Snapshot view of the structure. + Type `StructureDefinitionSnapshot` (represented as `dict` in JSON). """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.title = None + """ Name for this structure definition (human friendly). + Type `str`. """ + + self.type = None + """ Type defined or constrained by this structure. + Type `str`. """ + + self.url = None + """ Canonical identifier for this structure 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 structure definition. + Type `str`. """ + + super(StructureDefinition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(StructureDefinition, self).elementProperties() + js.extend([ + ("abstract", "abstract", bool, False, None, True), + ("baseDefinition", "baseDefinition", str, False, None, False), + ("contact", "contact", contactdetail.ContactDetail, True, None, False), + ("context", "context", StructureDefinitionContext, True, None, False), + ("contextInvariant", "contextInvariant", str, True, None, False), + ("copyright", "copyright", str, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("derivation", "derivation", str, False, None, False), + ("description", "description", str, False, None, False), + ("differential", "differential", StructureDefinitionDifferential, False, None, False), + ("experimental", "experimental", bool, False, None, False), + ("fhirVersion", "fhirVersion", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("keyword", "keyword", coding.Coding, True, None, False), + ("kind", "kind", str, False, None, True), + ("mapping", "mapping", StructureDefinitionMapping, True, None, False), + ("name", "name", str, False, None, True), + ("publisher", "publisher", str, False, None, False), + ("purpose", "purpose", str, False, None, False), + ("snapshot", "snapshot", StructureDefinitionSnapshot, False, None, False), + ("status", "status", str, False, None, True), + ("title", "title", str, False, None, False), + ("type", "type", str, False, None, True), + ("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 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. + + A differential view is expressed relative to the base StructureDefinition - + a statement of differences that it applies. + """ + + resource_type = "StructureDefinitionDifferential" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Definition of elements in the resource (if no StructureDefinition). + List of `ElementDefinition` items (represented as `dict` in JSON). """ + + super(StructureDefinitionDifferential, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(StructureDefinitionDifferential, self).elementProperties() + js.extend([ + ("element", "element", elementdefinition.ElementDefinition, True, None, True), + ]) + return js + + +class StructureDefinitionMapping(backboneelement.BackboneElement): + """ External specification that the content is mapped to. + + An external specification that the content is mapped to. + """ + + resource_type = "StructureDefinitionMapping" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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(StructureDefinitionMapping, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(StructureDefinitionMapping, 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 + + +class StructureDefinitionSnapshot(backboneelement.BackboneElement): + """ Snapshot view of the structure. + + A snapshot view is expressed in a standalone form that can be used and + interpreted without considering the base StructureDefinition. + """ + + resource_type = "StructureDefinitionSnapshot" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Definition of elements in the resource (if no StructureDefinition). + List of `ElementDefinition` items (represented as `dict` in JSON). """ + + super(StructureDefinitionSnapshot, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(StructureDefinitionSnapshot, self).elementProperties() + js.extend([ + ("element", "element", elementdefinition.ElementDefinition, True, 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 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/R4/structuredefinition_tests.py b/fhirclient/models/R4/structuredefinition_tests.py new file mode 100644 index 000000000..8ef676ed1 --- /dev/null +++ b/fhirclient/models/R4/structuredefinition_tests.py @@ -0,0 +1,144 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import structuredefinition +from .fhirdate import FHIRDate + + +class StructureDefinitionTests(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("StructureDefinition", js["resourceType"]) + return structuredefinition.StructureDefinition(js) + + def testStructureDefinition1(self): + inst = self.instantiate_from("structuredefinition-example-section-library.json") + self.assertIsNotNone(inst, "Must have instantiated a StructureDefinition instance") + self.implStructureDefinition1(inst) + + js = inst.as_json() + self.assertEqual("StructureDefinition", js["resourceType"]) + inst2 = structuredefinition.StructureDefinition(js) + 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/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.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, "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/R4/structuremap.py b/fhirclient/models/R4/structuremap.py new file mode 100644 index 000000000..d48284a53 --- /dev/null +++ b/fhirclient/models/R4/structuremap.py @@ -0,0 +1,915 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/StructureMap) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class StructureMap(domainresource.DomainResource): + """ A Map of relationships between 2 structures that can be used to transform + data. + """ + + resource_type = "StructureMap" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 last changed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Natural language description of the structure map. + Type `str`. """ + + self.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.group = None + """ Named sections for reader convenience. + List of `StructureMapGroup` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Additional identifier for the structure map. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.import_fhir = None + """ Other maps used by this map (canonical URLs). + List of `str` items. """ + + self.jurisdiction = None + """ Intended jurisdiction for structure map (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.name = None + """ Name for this structure map (computer friendly). + Type `str`. """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this structure map is defined. + Type `str`. """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.structure = None + """ Structure Definition used by this map. + List of `StructureMapStructure` items (represented as `dict` in JSON). """ + + self.title = None + """ Name for this structure map (human friendly). + Type `str`. """ + + self.url = None + """ Canonical identifier for this structure map, 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 structure map. + Type `str`. """ + + super(StructureMap, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(StructureMap, self).elementProperties() + js.extend([ + ("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), + ("experimental", "experimental", bool, False, None, False), + ("group", "group", StructureMapGroup, True, None, True), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("import_fhir", "import", str, True, 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), + ("status", "status", str, False, None, True), + ("structure", "structure", StructureMapStructure, True, None, False), + ("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 StructureMapGroup(backboneelement.BackboneElement): + """ Named sections for reader convenience. + + Organizes the mapping into manageable chunks for human review/ease of + maintenance. + """ + + resource_type = "StructureMapGroup" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Additional description/explanation for group. + Type `str`. """ + + self.extends = None + """ Another group that this group adds rules to. + Type `str`. """ + + self.input = None + """ Named instance provided when invoking the map. + List of `StructureMapGroupInput` items (represented as `dict` in JSON). """ + + self.name = None + """ Human-readable label. + Type `str`. """ + + self.rule = None + """ Transform Rule from source to target. + List of `StructureMapGroupRule` items (represented as `dict` in JSON). """ + + self.typeMode = None + """ none | types | type-and-types. + Type `str`. """ + + super(StructureMapGroup, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(StructureMapGroup, self).elementProperties() + js.extend([ + ("documentation", "documentation", str, False, None, False), + ("extends", "extends", str, False, None, False), + ("input", "input", StructureMapGroupInput, True, None, True), + ("name", "name", str, False, None, True), + ("rule", "rule", StructureMapGroupRule, True, None, True), + ("typeMode", "typeMode", str, False, None, True), + ]) + return js + + +class StructureMapGroupInput(backboneelement.BackboneElement): + """ Named instance provided when invoking the map. + + A name assigned to an instance of data. The instance must be provided when + the mapping is invoked. + """ + + resource_type = "StructureMapGroupInput" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Documentation for this instance of data. + Type `str`. """ + + self.mode = None + """ source | target. + Type `str`. """ + + self.name = None + """ Name for this instance of data. + Type `str`. """ + + self.type = None + """ Type for this instance of data. + Type `str`. """ + + super(StructureMapGroupInput, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(StructureMapGroupInput, self).elementProperties() + js.extend([ + ("documentation", "documentation", str, False, None, False), + ("mode", "mode", str, False, None, True), + ("name", "name", str, False, None, True), + ("type", "type", str, False, None, False), + ]) + return js + + +class StructureMapGroupRule(backboneelement.BackboneElement): + """ Transform Rule from source to target. + """ + + resource_type = "StructureMapGroupRule" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.dependent = None + """ Which other rules to apply in the context of this rule. + List of `StructureMapGroupRuleDependent` items (represented as `dict` in JSON). """ + + self.documentation = None + """ Documentation for this instance of data. + Type `str`. """ + + self.name = None + """ Name of the rule for internal references. + Type `str`. """ + + self.rule = None + """ Rules contained in this rule. + List of `StructureMapGroupRule` items (represented as `dict` in JSON). """ + + self.source = None + """ Source inputs to the mapping. + List of `StructureMapGroupRuleSource` items (represented as `dict` in JSON). """ + + self.target = None + """ Content to create because of this mapping rule. + List of `StructureMapGroupRuleTarget` items (represented as `dict` in JSON). """ + + super(StructureMapGroupRule, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(StructureMapGroupRule, self).elementProperties() + js.extend([ + ("dependent", "dependent", StructureMapGroupRuleDependent, True, None, False), + ("documentation", "documentation", str, False, None, False), + ("name", "name", str, False, None, True), + ("rule", "rule", StructureMapGroupRule, True, None, False), + ("source", "source", StructureMapGroupRuleSource, True, None, True), + ("target", "target", StructureMapGroupRuleTarget, True, None, False), + ]) + return js + + +class StructureMapGroupRuleDependent(backboneelement.BackboneElement): + """ Which other rules to apply in the context of this rule. + """ + + resource_type = "StructureMapGroupRuleDependent" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 a rule or group to apply. + Type `str`. """ + + self.variable = None + """ Variable to pass to the rule or group. + List of `str` items. """ + + super(StructureMapGroupRuleDependent, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(StructureMapGroupRuleDependent, self).elementProperties() + js.extend([ + ("name", "name", str, False, None, True), + ("variable", "variable", str, True, None, True), + ]) + return js + + +class StructureMapGroupRuleSource(backboneelement.BackboneElement): + """ Source inputs to the mapping. + """ + + resource_type = "StructureMapGroupRuleSource" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.check = None + """ FHIRPath expression - must be true or the mapping engine throws an + error instead of completing. + Type `str`. """ + + self.condition = None + """ FHIRPath expression - must be true or the rule does not apply. + Type `str`. """ + + self.context = None + """ Type or variable this rule applies to. + Type `str`. """ + + self.defaultValueAddress = None + """ Default value if no value exists. + Type `Address` (represented as `dict` in JSON). """ + + self.defaultValueAge = None + """ Default value if no value exists. + Type `Age` (represented as `dict` in JSON). """ + + self.defaultValueAnnotation = None + """ Default value if no value exists. + Type `Annotation` (represented as `dict` in JSON). """ + + self.defaultValueAttachment = None + """ Default value if no value exists. + Type `Attachment` (represented as `dict` in JSON). """ + + self.defaultValueBase64Binary = None + """ Default value if no value exists. + Type `str`. """ + + self.defaultValueBoolean = None + """ 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`. """ + + self.defaultValueCodeableConcept = None + """ Default value if no value exists. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.defaultValueCoding = None + """ 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). """ + + self.defaultValueDateTime = None + """ Default value if no value exists. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.defaultValueDecimal = None + """ Default value if no value exists. + Type `float`. """ + + self.defaultValueDistance = None + """ 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). """ + + self.defaultValueId = None + """ Default value if no value exists. + Type `str`. """ + + self.defaultValueIdentifier = None + """ Default value if no value exists. + Type `Identifier` (represented as `dict` in JSON). """ + + self.defaultValueInstant = None + """ Default value if no value exists. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.defaultValueInteger = None + """ Default value if no value exists. + Type `int`. """ + + self.defaultValueMarkdown = None + """ Default value if no value exists. + Type `str`. """ + + self.defaultValueMoney = None + """ Default value if no value exists. + Type `Money` (represented as `dict` in JSON). """ + + self.defaultValueOid = None + """ 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). """ + + self.defaultValuePositiveInt = None + """ Default value if no value exists. + Type `int`. """ + + self.defaultValueQuantity = None + """ Default value if no value exists. + Type `Quantity` (represented as `dict` in JSON). """ + + self.defaultValueRange = None + """ Default value if no value exists. + Type `Range` (represented as `dict` in JSON). """ + + self.defaultValueRatio = None + """ Default value if no value exists. + Type `Ratio` (represented as `dict` in JSON). """ + + self.defaultValueReference = None + """ 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). """ + + self.defaultValueSignature = None + """ Default value if no value exists. + Type `Signature` (represented as `dict` in JSON). """ + + self.defaultValueString = None + """ Default value if no value exists. + Type `str`. """ + + self.defaultValueTime = None + """ Default value if no value exists. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.defaultValueTiming = None + """ 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`. """ + + self.defaultValueUri = None + """ 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`. """ + + self.listMode = None + """ 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`. """ + + self.min = None + """ Specified minimum cardinality. + Type `int`. """ + + self.type = None + """ Rule only applies if source has this type. + Type `str`. """ + + self.variable = None + """ Named context for field, if a field is specified. + Type `str`. """ + + super(StructureMapGroupRuleSource, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(StructureMapGroupRuleSource, self).elementProperties() + js.extend([ + ("check", "check", str, False, None, False), + ("condition", "condition", str, False, None, False), + ("context", "context", str, False, None, True), + ("defaultValueAddress", "defaultValueAddress", address.Address, False, "defaultValue", False), + ("defaultValueAge", "defaultValueAge", age.Age, False, "defaultValue", False), + ("defaultValueAnnotation", "defaultValueAnnotation", annotation.Annotation, False, "defaultValue", False), + ("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), + ("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), + ("variable", "variable", str, False, None, False), + ]) + return js + + +class StructureMapGroupRuleTarget(backboneelement.BackboneElement): + """ Content to create because of this mapping rule. + """ + + resource_type = "StructureMapGroupRuleTarget" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.context = None + """ Type or variable this rule applies to. + Type `str`. """ + + self.contextType = None + """ type | variable. + Type `str`. """ + + self.element = None + """ Field to create in the context. + Type `str`. """ + + self.listMode = None + """ first | share | last | collate. + List of `str` items. """ + + self.listRuleId = None + """ Internal rule reference for shared list items. + Type `str`. """ + + self.parameter = None + """ Parameters to the transform. + List of `StructureMapGroupRuleTargetParameter` items (represented as `dict` in JSON). """ + + self.transform = None + """ create | copy +. + Type `str`. """ + + self.variable = None + """ Named context for field, if desired, and a field is specified. + Type `str`. """ + + super(StructureMapGroupRuleTarget, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(StructureMapGroupRuleTarget, self).elementProperties() + js.extend([ + ("context", "context", str, False, None, False), + ("contextType", "contextType", str, False, None, False), + ("element", "element", str, False, None, False), + ("listMode", "listMode", str, True, None, False), + ("listRuleId", "listRuleId", str, False, None, False), + ("parameter", "parameter", StructureMapGroupRuleTargetParameter, True, None, False), + ("transform", "transform", str, False, None, False), + ("variable", "variable", str, False, None, False), + ]) + return js + + +class StructureMapGroupRuleTargetParameter(backboneelement.BackboneElement): + """ Parameters to the transform. + """ + + resource_type = "StructureMapGroupRuleTargetParameter" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.valueBoolean = None + """ Parameter value - variable or literal. + Type `bool`. """ + + self.valueDecimal = None + """ Parameter value - variable or literal. + Type `float`. """ + + self.valueId = None + """ Parameter value - variable or literal. + Type `str`. """ + + self.valueInteger = None + """ Parameter value - variable or literal. + Type `int`. """ + + self.valueString = None + """ Parameter value - variable or literal. + Type `str`. """ + + super(StructureMapGroupRuleTargetParameter, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(StructureMapGroupRuleTargetParameter, self).elementProperties() + js.extend([ + ("valueBoolean", "valueBoolean", bool, False, "value", True), + ("valueDecimal", "valueDecimal", float, False, "value", True), + ("valueId", "valueId", str, False, "value", True), + ("valueInteger", "valueInteger", int, False, "value", True), + ("valueString", "valueString", str, False, "value", True), + ]) + return js + + +class StructureMapStructure(backboneelement.BackboneElement): + """ Structure Definition used by this map. + + A structure definition used by this map. The structure definition may + describe instances that are converted, or the instances that are produced. + """ + + resource_type = "StructureMapStructure" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.alias = None + """ Name for type in this map. + Type `str`. """ + + self.documentation = None + """ Documentation on use of structure. + Type `str`. """ + + self.mode = None + """ source | queried | target | produced. + Type `str`. """ + + self.url = None + """ Canonical reference to structure definition. + Type `str`. """ + + super(StructureMapStructure, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(StructureMapStructure, self).elementProperties() + js.extend([ + ("alias", "alias", str, False, None, False), + ("documentation", "documentation", str, False, None, False), + ("mode", "mode", str, False, None, True), + ("url", "url", str, False, None, True), + ]) + return js + + +import sys +try: + from . import address +except ImportError: + address = sys.modules[__package__ + '.address'] +try: + from . import age +except ImportError: + age = sys.modules[__package__ + '.age'] +try: + from . import annotation +except ImportError: + annotation = sys.modules[__package__ + '.annotation'] +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 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: + fhirdate = sys.modules[__package__ + '.fhirdate'] +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 parameterdefinition +except ImportError: + parameterdefinition = sys.modules[__package__ + '.parameterdefinition'] +try: + 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 relatedartifact +except ImportError: + relatedartifact = sys.modules[__package__ + '.relatedartifact'] +try: + from . import sampleddata +except ImportError: + sampleddata = sys.modules[__package__ + '.sampleddata'] +try: + from . import signature +except ImportError: + signature = sys.modules[__package__ + '.signature'] +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/R4/structuremap_tests.py b/fhirclient/models/R4/structuremap_tests.py new file mode 100644 index 000000000..9c143ff8c --- /dev/null +++ b/fhirclient/models/R4/structuremap_tests.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import structuremap +from .fhirdate import FHIRDate + + +class StructureMapTests(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("StructureMap", js["resourceType"]) + return structuremap.StructureMap(js) + + def testStructureMap1(self): + inst = self.instantiate_from("structuremap-example.json") + self.assertIsNotNone(inst, "Must have instantiated a StructureMap instance") + self.implStructureMap1(inst) + + js = inst.as_json() + self.assertEqual("StructureMap", js["resourceType"]) + inst2 = structuremap.StructureMap(js) + self.implStructureMap1(inst2) + + def implStructureMap1(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.date.date, FHIRDate("2017-03-09").date) + self.assertEqual(inst.date.as_json(), "2017-03-09") + self.assertEqual(inst.description, "Example Structure Map") + self.assertEqual(inst.group[0].documentation, "test -> testValue") + self.assertEqual(inst.group[0].input[0].mode, "source") + self.assertEqual(inst.group[0].input[0].name, "test") + self.assertEqual(inst.group[0].name, "Examples") + self.assertEqual(inst.group[0].rule[0].name, "rule1") + self.assertEqual(inst.group[0].rule[0].source[0].context, "Source") + self.assertEqual(inst.group[0].rule[0].source[0].element, "test") + self.assertEqual(inst.group[0].rule[0].source[0].type, "SourceClassA") + self.assertEqual(inst.group[0].rule[0].source[0].variable, "t") + self.assertEqual(inst.group[0].rule[0].target[0].context, "Destination") + self.assertEqual(inst.group[0].rule[0].target[0].contextType, "variable") + self.assertEqual(inst.group[0].rule[0].target[0].element, "testValue") + self.assertEqual(inst.group[0].rule[0].target[0].transform, "copy") + self.assertEqual(inst.group[0].typeMode, "none") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier[0].system, "urn:ietf:rfc:3986") + self.assertEqual(inst.identifier[0].value, "urn:oid:37843577-95fb-4adb-84c0-8837188a7bf3") + self.assertEqual(inst.jurisdiction[0].coding[0].code, "009") + self.assertEqual(inst.jurisdiction[0].coding[0].display, "Oceania") + self.assertEqual(inst.jurisdiction[0].coding[0].system, "http://unstats.un.org/unsd/methods/m49/m49.htm") + self.assertEqual(inst.name, "ExampleMap") + self.assertEqual(inst.publisher, "HL7 FHIR Standard") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "Example Map") + self.assertEqual(inst.url, "http://hl7.org/fhir/StructureMap/example") + self.assertEqual(inst.version, "0.1") + diff --git a/fhirclient/models/R4/subscription.py b/fhirclient/models/R4/subscription.py new file mode 100644 index 000000000..45906defd --- /dev/null +++ b/fhirclient/models/R4/subscription.py @@ -0,0 +1,130 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Subscription) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Subscription(domainresource.DomainResource): + """ Server push subscription criteria. + + 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 can take an appropriate action. + """ + + resource_type = "Subscription" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.channel = None + """ The channel on which to report matches to the criteria. + Type `SubscriptionChannel` (represented as `dict` in JSON). """ + + self.contact = None + """ Contact details for source (e.g. troubleshooting). + List of `ContactPoint` items (represented as `dict` in JSON). """ + + self.criteria = None + """ Rule for server push. + Type `str`. """ + + self.end = None + """ When to automatically delete the subscription. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.error = None + """ Latest error note. + Type `str`. """ + + self.reason = None + """ Description of why this subscription was created. + Type `str`. """ + + self.status = None + """ requested | active | error | off. + Type `str`. """ + + super(Subscription, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Subscription, self).elementProperties() + js.extend([ + ("channel", "channel", SubscriptionChannel, False, None, True), + ("contact", "contact", contactpoint.ContactPoint, True, None, False), + ("criteria", "criteria", str, False, None, True), + ("end", "end", fhirdate.FHIRDate, False, None, False), + ("error", "error", str, False, None, False), + ("reason", "reason", str, False, None, True), + ("status", "status", str, False, None, True), + ]) + return js + + +from . import backboneelement + +class SubscriptionChannel(backboneelement.BackboneElement): + """ The channel on which to report matches to the criteria. + + Details where to send notifications when resources are received that meet + the criteria. + """ + + resource_type = "SubscriptionChannel" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Where the channel points to. + Type `str`. """ + + self.header = None + """ Usage depends on the channel type. + List of `str` items. """ + + self.payload = None + """ MIME type to send, or omit for no payload. + Type `str`. """ + + self.type = None + """ rest-hook | websocket | email | sms | message. + Type `str`. """ + + super(SubscriptionChannel, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubscriptionChannel, self).elementProperties() + js.extend([ + ("endpoint", "endpoint", str, False, None, False), + ("header", "header", str, True, None, False), + ("payload", "payload", str, False, None, False), + ("type", "type", str, False, None, True), + ]) + return js + + +import sys +try: + from . import contactpoint +except ImportError: + contactpoint = sys.modules[__package__ + '.contactpoint'] +try: + from . import fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] diff --git a/fhirclient/models/R4/subscription_tests.py b/fhirclient/models/R4/subscription_tests.py new file mode 100644 index 000000000..273938db9 --- /dev/null +++ b/fhirclient/models/R4/subscription_tests.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import subscription +from .fhirdate import FHIRDate + + +class SubscriptionTests(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("Subscription", js["resourceType"]) + return subscription.Subscription(js) + + def testSubscription1(self): + inst = self.instantiate_from("subscription-example-error.json") + self.assertIsNotNone(inst, "Must have instantiated a Subscription instance") + self.implSubscription1(inst) + + js = inst.as_json() + self.assertEqual("Subscription", js["resourceType"]) + inst2 = subscription.Subscription(js) + self.implSubscription1(inst2) + + def implSubscription1(self, inst): + self.assertEqual(inst.channel.endpoint, "https://biliwatch.com/customers/mount-auburn-miu/on-result") + self.assertEqual(inst.channel.header[0], "Authorization: Bearer secret-token-abc-123") + self.assertEqual(inst.channel.payload, "application/fhir+json") + self.assertEqual(inst.channel.type, "rest-hook") + self.assertEqual(inst.contact[0].system, "phone") + self.assertEqual(inst.contact[0].value, "ext 4123") + self.assertEqual(inst.criteria, "Observation?code=http://loinc.org|1975-2") + 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.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.text.div, "
[Put rendering here]
") + self.assertEqual(inst.text.status, "generated") + + def testSubscription2(self): + inst = self.instantiate_from("subscription-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Subscription instance") + self.implSubscription2(inst) + + js = inst.as_json() + self.assertEqual("Subscription", js["resourceType"]) + inst2 = subscription.Subscription(js) + self.implSubscription2(inst2) + + def implSubscription2(self, inst): + self.assertEqual(inst.channel.endpoint, "https://biliwatch.com/customers/mount-auburn-miu/on-result") + self.assertEqual(inst.channel.header[0], "Authorization: Bearer secret-token-abc-123") + self.assertEqual(inst.channel.payload, "application/fhir+json") + self.assertEqual(inst.channel.type, "rest-hook") + self.assertEqual(inst.contact[0].system, "phone") + self.assertEqual(inst.contact[0].value, "ext 4123") + self.assertEqual(inst.criteria, "Observation?code=http://loinc.org|1975-2") + 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.text.div, "
[Put rendering here]
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/R4/substance.py b/fhirclient/models/R4/substance.py new file mode 100644 index 000000000..171497c9b --- /dev/null +++ b/fhirclient/models/R4/substance.py @@ -0,0 +1,175 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Substance) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Substance(domainresource.DomainResource): + """ A homogeneous material with a definite composition. + """ + + resource_type = "Substance" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ What class/type of substance this is. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.code = None + """ What substance this is. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.description = None + """ Textual description of the substance, comments. + Type `str`. """ + + self.identifier = None + """ Unique identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.ingredient = None + """ Composition information about the substance. + List of `SubstanceIngredient` items (represented as `dict` in JSON). """ + + self.instance = None + """ If this describes a specific package/container of the substance. + List of `SubstanceInstance` items (represented as `dict` in JSON). """ + + self.status = None + """ active | inactive | entered-in-error. + Type `str`. """ + + super(Substance, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Substance, self).elementProperties() + js.extend([ + ("category", "category", codeableconcept.CodeableConcept, True, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("description", "description", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("ingredient", "ingredient", SubstanceIngredient, True, None, False), + ("instance", "instance", SubstanceInstance, True, None, False), + ("status", "status", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class SubstanceIngredient(backboneelement.BackboneElement): + """ Composition information about the substance. + + A substance can be composed of other substances. + """ + + resource_type = "SubstanceIngredient" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Optional amount (concentration). + Type `Ratio` (represented as `dict` in JSON). """ + + self.substanceCodeableConcept = None + """ A component of the substance. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.substanceReference = None + """ A component of the substance. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(SubstanceIngredient, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceIngredient, self).elementProperties() + js.extend([ + ("quantity", "quantity", ratio.Ratio, False, None, False), + ("substanceCodeableConcept", "substanceCodeableConcept", codeableconcept.CodeableConcept, False, "substance", True), + ("substanceReference", "substanceReference", fhirreference.FHIRReference, False, "substance", True), + ]) + return js + + +class SubstanceInstance(backboneelement.BackboneElement): + """ If this describes a specific package/container of the substance. + + Substance may be used to describe a kind of substance, or a specific + package/container of the substance: an instance. + """ + + resource_type = "SubstanceInstance" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.expiry = None + """ When no longer valid to use. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.identifier = None + """ Identifier of the package/container. + Type `Identifier` (represented as `dict` in JSON). """ + + self.quantity = None + """ Amount of substance in the package. + Type `Quantity` (represented as `dict` in JSON). """ + + super(SubstanceInstance, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceInstance, self).elementProperties() + js.extend([ + ("expiry", "expiry", fhirdate.FHIRDate, False, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("quantity", "quantity", quantity.Quantity, 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 quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] +try: + from . import ratio +except ImportError: + ratio = sys.modules[__package__ + '.ratio'] diff --git a/fhirclient/models/R4/substance_tests.py b/fhirclient/models/R4/substance_tests.py new file mode 100644 index 000000000..fd830ebaa --- /dev/null +++ b/fhirclient/models/R4/substance_tests.py @@ -0,0 +1,188 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import substance +from .fhirdate import FHIRDate + + +class SubstanceTests(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("Substance", js["resourceType"]) + return substance.Substance(js) + + def testSubstance1(self): + inst = self.instantiate_from("substance-example-silver-nitrate-product.json") + self.assertIsNotNone(inst, "Must have instantiated a Substance instance") + self.implSubstance1(inst) + + js = inst.as_json() + self.assertEqual("Substance", js["resourceType"]) + inst2 = substance.Substance(js) + 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://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") + self.assertEqual(inst.contained[0].id, "ingr1") + self.assertEqual(inst.contained[1].id, "ingr2") + self.assertEqual(inst.description, "Augmentin 875") + self.assertEqual(inst.id, "f205") + self.assertEqual(inst.ingredient[0].quantity.denominator.code, "mg") + self.assertEqual(inst.ingredient[0].quantity.denominator.system, "http://unitsofmeasure.org") + self.assertEqual(inst.ingredient[0].quantity.denominator.unit, "mg") + self.assertEqual(inst.ingredient[0].quantity.denominator.value, 1000) + self.assertEqual(inst.ingredient[0].quantity.numerator.code, "mg") + self.assertEqual(inst.ingredient[0].quantity.numerator.system, "http://unitsofmeasure.org") + self.assertEqual(inst.ingredient[0].quantity.numerator.unit, "mg") + self.assertEqual(inst.ingredient[0].quantity.numerator.value, 875) + self.assertEqual(inst.ingredient[1].quantity.denominator.code, "mg") + self.assertEqual(inst.ingredient[1].quantity.denominator.system, "http://unitsofmeasure.org") + self.assertEqual(inst.ingredient[1].quantity.denominator.unit, "mg") + self.assertEqual(inst.ingredient[1].quantity.denominator.value, 1000) + self.assertEqual(inst.ingredient[1].quantity.numerator.code, "mg") + 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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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-f203-potassium.json") + self.assertIsNotNone(inst, "Must have instantiated a Substance instance") + self.implSubstance3(inst) + + js = inst.as_json() + self.assertEqual("Substance", js["resourceType"]) + inst2 = substance.Substance(js) + self.implSubstance3(inst2) + + def implSubstance3(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, "88480006") + self.assertEqual(inst.code.coding[0].display, "Potassium") + 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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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-f201-dust.json") + self.assertIsNotNone(inst, "Must have instantiated a Substance instance") + self.implSubstance4(inst) + + js = inst.as_json() + self.assertEqual("Substance", js["resourceType"]) + inst2 = substance.Substance(js) + self.implSubstance4(inst2) + + def implSubstance4(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 testSubstance5(self): + inst = self.instantiate_from("substance-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Substance instance") + self.implSubstance5(inst) + + js = inst.as_json() + self.assertEqual("Substance", js["resourceType"]) + inst2 = substance.Substance(js) + self.implSubstance5(inst2) + + def implSubstance5(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://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, "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-f202-staphylococcus.json") + self.assertIsNotNone(inst, "Must have instantiated a Substance instance") + self.implSubstance6(inst) + + js = inst.as_json() + self.assertEqual("Substance", js["resourceType"]) + inst2 = substance.Substance(js) + self.implSubstance6(inst2) + + def implSubstance6(self, inst): + 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/R4/substanceamount.py similarity index 99% rename from fhirclient/models/substanceamount.py rename to fhirclient/models/R4/substanceamount.py index dc3983faf..ea6bac883 100644 --- a/fhirclient/models/substanceamount.py +++ b/fhirclient/models/R4/substanceamount.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SubstanceAmount) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SubstanceAmount) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/substancenucleicacid.py b/fhirclient/models/R4/substancenucleicacid.py similarity index 99% rename from fhirclient/models/substancenucleicacid.py rename to fhirclient/models/R4/substancenucleicacid.py index e688477b5..bc264b568 100644 --- a/fhirclient/models/substancenucleicacid.py +++ b/fhirclient/models/R4/substancenucleicacid.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SubstanceNucleicAcid) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SubstanceNucleicAcid) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/substancepolymer.py b/fhirclient/models/R4/substancepolymer.py similarity index 99% rename from fhirclient/models/substancepolymer.py rename to fhirclient/models/R4/substancepolymer.py index da3ddbe65..b78b4b6c2 100644 --- a/fhirclient/models/substancepolymer.py +++ b/fhirclient/models/R4/substancepolymer.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SubstancePolymer) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SubstancePolymer) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/substanceprotein.py b/fhirclient/models/R4/substanceprotein.py similarity index 99% rename from fhirclient/models/substanceprotein.py rename to fhirclient/models/R4/substanceprotein.py index 4770bc693..85ab899b0 100644 --- a/fhirclient/models/substanceprotein.py +++ b/fhirclient/models/R4/substanceprotein.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SubstanceProtein) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SubstanceProtein) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/substancereferenceinformation.py b/fhirclient/models/R4/substancereferenceinformation.py similarity index 99% rename from fhirclient/models/substancereferenceinformation.py rename to fhirclient/models/R4/substancereferenceinformation.py index 2f6fac14b..b58066570 100644 --- a/fhirclient/models/substancereferenceinformation.py +++ b/fhirclient/models/R4/substancereferenceinformation.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SubstanceReferenceInformation) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SubstanceReferenceInformation) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/substancesourcematerial.py b/fhirclient/models/R4/substancesourcematerial.py similarity index 99% rename from fhirclient/models/substancesourcematerial.py rename to fhirclient/models/R4/substancesourcematerial.py index 45c346b76..31ff2d611 100644 --- a/fhirclient/models/substancesourcematerial.py +++ b/fhirclient/models/R4/substancesourcematerial.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SubstanceSourceMaterial) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SubstanceSourceMaterial) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/substancespecification.py b/fhirclient/models/R4/substancespecification.py similarity index 99% rename from fhirclient/models/substancespecification.py rename to fhirclient/models/R4/substancespecification.py index aa9a14eae..a226296de 100644 --- a/fhirclient/models/substancespecification.py +++ b/fhirclient/models/R4/substancespecification.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SubstanceSpecification) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SubstanceSpecification) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/substancespecification_tests.py b/fhirclient/models/R4/substancespecification_tests.py similarity index 98% rename from fhirclient/models/substancespecification_tests.py rename to fhirclient/models/R4/substancespecification_tests.py index 64454c84e..09a7ee335 100644 --- a/fhirclient/models/substancespecification_tests.py +++ b/fhirclient/models/R4/substancespecification_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/R4/supplydelivery.py b/fhirclient/models/R4/supplydelivery.py new file mode 100644 index 000000000..65e5a2d43 --- /dev/null +++ b/fhirclient/models/R4/supplydelivery.py @@ -0,0 +1,170 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SupplyDelivery) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class SupplyDelivery(domainresource.DomainResource): + """ Delivery of bulk Supplies. + + Record of delivery of what is supplied. + """ + + resource_type = "SupplyDelivery" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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.destination = None + """ Where the Supply was sent. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.identifier = None + """ External identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.occurrenceDateTime = None + """ When event occurred. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.occurrencePeriod = None + """ When event occurred. + Type `Period` (represented as `dict` in JSON). """ + + self.occurrenceTiming = None + """ When event occurred. + Type `Timing` (represented as `dict` in JSON). """ + + self.partOf = None + """ Part of referenced event. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.patient = None + """ Patient for whom the item is supplied. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.receiver = None + """ Who collected the Supply. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.status = None + """ in-progress | completed | abandoned | entered-in-error. + Type `str`. """ + + self.suppliedItem = None + """ The item that is delivered or supplied. + Type `SupplyDeliverySuppliedItem` (represented as `dict` in JSON). """ + + self.supplier = None + """ Dispenser. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.type = None + """ Category of dispense event. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(SupplyDelivery, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SupplyDelivery, self).elementProperties() + js.extend([ + ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), + ("destination", "destination", fhirreference.FHIRReference, 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), + ("partOf", "partOf", fhirreference.FHIRReference, True, None, False), + ("patient", "patient", fhirreference.FHIRReference, False, None, False), + ("receiver", "receiver", fhirreference.FHIRReference, True, None, False), + ("status", "status", str, False, None, False), + ("suppliedItem", "suppliedItem", SupplyDeliverySuppliedItem, False, None, False), + ("supplier", "supplier", fhirreference.FHIRReference, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import backboneelement + +class SupplyDeliverySuppliedItem(backboneelement.BackboneElement): + """ The item that is delivered or supplied. + + The item that is being delivered or has been supplied. + """ + + resource_type = "SupplyDeliverySuppliedItem" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Medication, Substance, or Device supplied. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.itemReference = None + """ Medication, Substance, or Device supplied. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.quantity = None + """ Amount dispensed. + Type `Quantity` (represented as `dict` in JSON). """ + + super(SupplyDeliverySuppliedItem, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SupplyDeliverySuppliedItem, self).elementProperties() + js.extend([ + ("itemCodeableConcept", "itemCodeableConcept", codeableconcept.CodeableConcept, False, "item", False), + ("itemReference", "itemReference", fhirreference.FHIRReference, False, "item", False), + ("quantity", "quantity", quantity.Quantity, 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'] +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] +try: + from . import timing +except ImportError: + timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/R4/supplydelivery_tests.py b/fhirclient/models/R4/supplydelivery_tests.py new file mode 100644 index 000000000..2bc873fc8 --- /dev/null +++ b/fhirclient/models/R4/supplydelivery_tests.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import supplydelivery +from .fhirdate import FHIRDate + + +class SupplyDeliveryTests(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("SupplyDelivery", js["resourceType"]) + return supplydelivery.SupplyDelivery(js) + + def testSupplyDelivery1(self): + inst = self.instantiate_from("supplydelivery-example.json") + self.assertIsNotNone(inst, "Must have instantiated a SupplyDelivery instance") + self.implSupplyDelivery1(inst) + + js = inst.as_json() + self.assertEqual("SupplyDelivery", js["resourceType"]) + inst2 = supplydelivery.SupplyDelivery(js) + self.implSupplyDelivery1(inst2) + + def implSupplyDelivery1(self, inst): + 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-pumpdelivery.json") + self.assertIsNotNone(inst, "Must have instantiated a SupplyDelivery instance") + self.implSupplyDelivery2(inst) + + js = inst.as_json() + self.assertEqual("SupplyDelivery", js["resourceType"]) + inst2 = supplydelivery.SupplyDelivery(js) + self.implSupplyDelivery2(inst2) + + def implSupplyDelivery2(self, inst): + 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") + diff --git a/fhirclient/models/R4/supplyrequest.py b/fhirclient/models/R4/supplyrequest.py new file mode 100644 index 000000000..7925787f7 --- /dev/null +++ b/fhirclient/models/R4/supplyrequest.py @@ -0,0 +1,211 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SupplyRequest) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class SupplyRequest(domainresource.DomainResource): + """ Request for a medication, substance or device. + + A record of a request for a medication, substance or device used in the + healthcare setting. + """ + + resource_type = "SupplyRequest" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ When the request was made. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.category = None + """ The kind of supply (central, non-stock, etc.). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.deliverFrom = None + """ The origin of the supply. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.deliverTo = None + """ The destination of the supply. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.identifier = None + """ 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. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.occurrencePeriod = None + """ When the request should be fulfilled. + Type `Period` (represented as `dict` in JSON). """ + + self.occurrenceTiming = None + """ When the request should be fulfilled. + Type `Timing` (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.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 + """ The reason why the supply item was requested. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.requester = None + """ Individual making the request. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.status = None + """ draft | active | suspended +. + Type `str`. """ + + self.supplier = None + """ Who is intended to fulfill the request. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + super(SupplyRequest, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SupplyRequest, self).elementProperties() + js.extend([ + ("authoredOn", "authoredOn", fhirdate.FHIRDate, False, None, False), + ("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, 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), + ("parameter", "parameter", SupplyRequestParameter, True, None, False), + ("priority", "priority", str, 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), + ]) + return js + + +from . import backboneelement + +class SupplyRequestParameter(backboneelement.BackboneElement): + """ Ordered item details. + + Specific parameters for the ordered item. For example, the size of the + indicated item. + """ + + resource_type = "SupplyRequestParameter" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Item 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.valueRange = None + """ Value of detail. + Type `Range` (represented as `dict` in JSON). """ + + super(SupplyRequestParameter, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SupplyRequestParameter, self).elementProperties() + js.extend([ + ("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 + + +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'] +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: + timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/R4/supplyrequest_tests.py b/fhirclient/models/R4/supplyrequest_tests.py new file mode 100644 index 000000000..801936f7c --- /dev/null +++ b/fhirclient/models/R4/supplyrequest_tests.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import supplyrequest +from .fhirdate import FHIRDate + + +class SupplyRequestTests(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("SupplyRequest", js["resourceType"]) + return supplyrequest.SupplyRequest(js) + + def testSupplyRequest1(self): + inst = self.instantiate_from("supplyrequest-example-simpleorder.json") + self.assertIsNotNone(inst, "Must have instantiated a SupplyRequest instance") + self.implSupplyRequest1(inst) + + js = inst.as_json() + self.assertEqual("SupplyRequest", js["resourceType"]) + inst2 = supplyrequest.SupplyRequest(js) + self.implSupplyRequest1(inst2) + + def implSupplyRequest1(self, inst): + self.assertEqual(inst.authoredOn.date, FHIRDate("2016-12-31").date) + self.assertEqual(inst.authoredOn.as_json(), "2016-12-31") + 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[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.priority, "asap") + 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/R4/task.py b/fhirclient/models/R4/task.py new file mode 100644 index 000000000..b7a66a148 --- /dev/null +++ b/fhirclient/models/R4/task.py @@ -0,0 +1,907 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Task) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Task(domainresource.DomainResource): + """ A task to be performed. + """ + + resource_type = "Task" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Task Creation Date. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.basedOn = None + """ Request fulfilled by this task. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.businessStatus = None + """ E.g. "Specimen collected", "IV prepped". + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.code = None + """ Task Type. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + 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` (represented as `dict` in JSON). """ + + self.for_fhir = None + """ Beneficiary of the Task. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.groupIdentifier = None + """ Requisition or grouper id. + Type `Identifier` (represented as `dict` in JSON). """ + + self.identifier = None + """ Task Instance Identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.input = None + """ 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 + """ 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). """ + + self.output = None + """ Information produced as part of task. + List of `TaskOutput` items (represented as `dict` in JSON). """ + + self.owner = None + """ Responsible individual. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.partOf = None + """ Composite task. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.performerType = None + """ Requested performer. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.priority = None + """ routine | urgent | asap | stat. + Type `str`. """ + + 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 (represented as `dict` in JSON). """ + + self.requester = None + """ Who is asking for task to be done. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.restriction = None + """ Constraints on fulfillment tasks. + Type `TaskRestriction` (represented as `dict` in JSON). """ + + self.status = None + """ draft | requested | received | accepted | +. + Type `str`. """ + + self.statusReason = None + """ Reason for current status. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(Task, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Task, self).elementProperties() + js.extend([ + ("authoredOn", "authoredOn", fhirdate.FHIRDate, False, None, False), + ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), + ("businessStatus", "businessStatus", codeableconcept.CodeableConcept, False, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, 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), + ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, False, None, False), + ("reasonReference", "reasonReference", fhirreference.FHIRReference, False, None, False), + ("relevantHistory", "relevantHistory", fhirreference.FHIRReference, True, 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), + ]) + return js + + +from . import backboneelement + +class TaskInput(backboneelement.BackboneElement): + """ Information used to perform task. + + Additional information that may be needed in the execution of the task. + """ + + resource_type = "TaskInput" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Label for the input. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueAddress = None + """ Content to use in performing the task. + Type `Address` (represented as `dict` in JSON). """ + + self.valueAge = None + """ Content to use in performing the task. + Type `Age` (represented as `dict` in JSON). """ + + self.valueAnnotation = None + """ Content to use in performing the task. + Type `Annotation` (represented as `dict` in JSON). """ + + self.valueAttachment = None + """ Content to use in performing the task. + Type `Attachment` (represented as `dict` in JSON). """ + + self.valueBase64Binary = None + """ Content to use in performing the task. + Type `str`. """ + + self.valueBoolean = None + """ 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`. """ + + self.valueCodeableConcept = None + """ Content to use in performing the task. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueCoding = None + """ 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). """ + + self.valueDateTime = None + """ Content to use in performing the task. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueDecimal = None + """ Content to use in performing the task. + Type `float`. """ + + self.valueDistance = None + """ 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). """ + + self.valueId = None + """ Content to use in performing the task. + Type `str`. """ + + self.valueIdentifier = None + """ Content to use in performing the task. + Type `Identifier` (represented as `dict` in JSON). """ + + self.valueInstant = None + """ Content to use in performing the task. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueInteger = None + """ Content to use in performing the task. + Type `int`. """ + + self.valueMarkdown = None + """ Content to use in performing the task. + Type `str`. """ + + self.valueMoney = None + """ Content to use in performing the task. + Type `Money` (represented as `dict` in JSON). """ + + self.valueOid = None + """ 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). """ + + self.valuePositiveInt = None + """ Content to use in performing the task. + Type `int`. """ + + self.valueQuantity = None + """ Content to use in performing the task. + Type `Quantity` (represented as `dict` in JSON). """ + + self.valueRange = None + """ Content to use in performing the task. + Type `Range` (represented as `dict` in JSON). """ + + self.valueRatio = None + """ Content to use in performing the task. + Type `Ratio` (represented as `dict` in JSON). """ + + self.valueReference = None + """ 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). """ + + self.valueSignature = None + """ Content to use in performing the task. + Type `Signature` (represented as `dict` in JSON). """ + + self.valueString = None + """ Content to use in performing the task. + Type `str`. """ + + self.valueTime = None + """ Content to use in performing the task. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueTiming = None + """ 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`. """ + + self.valueUri = None + """ 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): + js = super(TaskInput, self).elementProperties() + js.extend([ + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ("valueAddress", "valueAddress", address.Address, False, "value", True), + ("valueAge", "valueAge", age.Age, False, "value", True), + ("valueAnnotation", "valueAnnotation", annotation.Annotation, False, "value", True), + ("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), + ("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 + + +class TaskOutput(backboneelement.BackboneElement): + """ Information produced as part of task. + + Outputs produced by the Task. + """ + + resource_type = "TaskOutput" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Label for output. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueAddress = None + """ Result of output. + Type `Address` (represented as `dict` in JSON). """ + + self.valueAge = None + """ Result of output. + Type `Age` (represented as `dict` in JSON). """ + + self.valueAnnotation = None + """ Result of output. + Type `Annotation` (represented as `dict` in JSON). """ + + self.valueAttachment = None + """ Result of output. + Type `Attachment` (represented as `dict` in JSON). """ + + self.valueBase64Binary = None + """ Result of output. + Type `str`. """ + + self.valueBoolean = None + """ Result of output. + Type `bool`. """ + + self.valueCanonical = None + """ Result of output. + Type `str`. """ + + self.valueCode = None + """ Result of output. + Type `str`. """ + + self.valueCodeableConcept = None + """ Result of output. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueCoding = None + """ 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). """ + + self.valueDateTime = None + """ Result of output. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueDecimal = None + """ Result of output. + Type `float`. """ + + self.valueDistance = None + """ 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). """ + + self.valueId = None + """ Result of output. + Type `str`. """ + + self.valueIdentifier = None + """ Result of output. + Type `Identifier` (represented as `dict` in JSON). """ + + self.valueInstant = None + """ Result of output. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueInteger = None + """ Result of output. + Type `int`. """ + + self.valueMarkdown = None + """ Result of output. + Type `str`. """ + + self.valueMoney = None + """ Result of output. + Type `Money` (represented as `dict` in JSON). """ + + self.valueOid = None + """ 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). """ + + self.valuePositiveInt = None + """ Result of output. + Type `int`. """ + + self.valueQuantity = None + """ Result of output. + Type `Quantity` (represented as `dict` in JSON). """ + + self.valueRange = None + """ Result of output. + Type `Range` (represented as `dict` in JSON). """ + + self.valueRatio = None + """ Result of output. + Type `Ratio` (represented as `dict` in JSON). """ + + self.valueReference = None + """ 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). """ + + self.valueSignature = None + """ Result of output. + Type `Signature` (represented as `dict` in JSON). """ + + self.valueString = None + """ Result of output. + Type `str`. """ + + self.valueTime = None + """ Result of output. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueTiming = None + """ 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`. """ + + self.valueUri = None + """ 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): + js = super(TaskOutput, self).elementProperties() + js.extend([ + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ("valueAddress", "valueAddress", address.Address, False, "value", True), + ("valueAge", "valueAge", age.Age, False, "value", True), + ("valueAnnotation", "valueAnnotation", annotation.Annotation, False, "value", True), + ("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), + ("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 + + +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. + """ + + resource_type = "TaskRestriction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ When fulfillment sought. + Type `Period` (represented as `dict` in JSON). """ + + self.recipient = None + """ For whom is fulfillment sought?. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.repetitions = None + """ How many times to repeat. + Type `int`. """ + + super(TaskRestriction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TaskRestriction, self).elementProperties() + js.extend([ + ("period", "period", period.Period, False, None, False), + ("recipient", "recipient", fhirreference.FHIRReference, True, None, False), + ("repetitions", "repetitions", int, False, None, False), + ]) + return js + + +import sys +try: + from . import address +except ImportError: + address = sys.modules[__package__ + '.address'] +try: + from . import age +except ImportError: + age = sys.modules[__package__ + '.age'] +try: + from . import annotation +except ImportError: + annotation = sys.modules[__package__ + '.annotation'] +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 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: + fhirdate = sys.modules[__package__ + '.fhirdate'] +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 parameterdefinition +except ImportError: + parameterdefinition = sys.modules[__package__ + '.parameterdefinition'] +try: + 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 relatedartifact +except ImportError: + relatedartifact = sys.modules[__package__ + '.relatedartifact'] +try: + from . import sampleddata +except ImportError: + sampleddata = sys.modules[__package__ + '.sampleddata'] +try: + from . import signature +except ImportError: + signature = sys.modules[__package__ + '.signature'] +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/R4/task_tests.py b/fhirclient/models/R4/task_tests.py new file mode 100644 index 000000000..d3b03f0a7 --- /dev/null +++ b/fhirclient/models/R4/task_tests.py @@ -0,0 +1,396 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import task +from .fhirdate import FHIRDate + + +class TaskTests(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("Task", js["resourceType"]) + return task.Task(js) + + def testTask1(self): + inst = self.instantiate_from("task-example6.json") + self.assertIsNotNone(inst, "Must have instantiated a Task instance") + self.implTask1(inst) + + js = inst.as_json() + self.assertEqual("Task", js["resourceType"]) + inst2 = task.Task(js) + self.implTask1(inst2) + + 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, "test completed and posted") + 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.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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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://terminology.hl7.org/CodeSystem/task-performer-type") + self.assertEqual(inst.performerType[0].text, "Performer") + self.assertEqual(inst.priority, "routine") + 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.text.status, "generated") + + def testTask2(self): + inst = self.instantiate_from("task-example-fm-poll.json") + self.assertIsNotNone(inst, "Must have instantiated a Task instance") + self.implTask2(inst) + + js = inst.as_json() + self.assertEqual("Task", js["resourceType"]) + inst2 = task.Task(js) + self.implTask2(inst2) + + def implTask2(self, inst): + 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, "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-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://terminology.hl7.org/CodeSystem/task-performer-type") + self.assertEqual(inst.performerType[0].text, "Performer") + self.assertEqual(inst.priority, "routine") + 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.text.status, "generated") + + 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.implTask5(inst) + + js = inst.as_json() + self.assertEqual("Task", js["resourceType"]) + inst2 = task.Task(js) + self.implTask5(inst2) + + 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") + self.assertEqual(inst.id, "example3") + 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 testTask6(self): + inst = self.instantiate_from("task-example-fm-status-resp.json") + self.assertIsNotNone(inst, "Must have instantiated a Task instance") + self.implTask6(inst) + + js = inst.as_json() + self.assertEqual("Task", js["resourceType"]) + inst2 = task.Task(js) + self.implTask6(inst2) + + 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.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, "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.meta.tag[0].code, "HTEST") + self.assertEqual(inst.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://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, "accepted") + self.assertEqual(inst.text.status, "generated") + + def testTask8(self): + inst = self.instantiate_from("task-example-fm-release.json") + self.assertIsNotNone(inst, "Must have instantiated a Task instance") + self.implTask8(inst) + + js = inst.as_json() + self.assertEqual("Task", js["resourceType"]) + inst2 = task.Task(js) + self.implTask8(inst2) + + 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, "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("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 testTask9(self): + inst = self.instantiate_from("task-example-fm-cancel.json") + self.assertIsNotNone(inst, "Must have instantiated a Task instance") + self.implTask9(inst) + + js = inst.as_json() + self.assertEqual("Task", js["resourceType"]) + inst2 = task.Task(js) + self.implTask9(inst2) + + 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, "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") + 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-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://terminology.hl7.org/CodeSystem/task-performer-type") + self.assertEqual(inst.performerType[0].text, "Performer") + self.assertEqual(inst.priority, "routine") + 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.text.status, "generated") + diff --git a/fhirclient/models/terminologycapabilities.py b/fhirclient/models/R4/terminologycapabilities.py similarity index 99% rename from fhirclient/models/terminologycapabilities.py rename to fhirclient/models/R4/terminologycapabilities.py index e18e3dc8a..2a6b7020f 100644 --- a/fhirclient/models/terminologycapabilities.py +++ b/fhirclient/models/R4/terminologycapabilities.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/TerminologyCapabilities) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/TerminologyCapabilities) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/terminologycapabilities_tests.py b/fhirclient/models/R4/terminologycapabilities_tests.py similarity index 96% rename from fhirclient/models/terminologycapabilities_tests.py rename to fhirclient/models/R4/terminologycapabilities_tests.py index c4558073f..efc3879c2 100644 --- a/fhirclient/models/terminologycapabilities_tests.py +++ b/fhirclient/models/R4/terminologycapabilities_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/R4/testreport.py b/fhirclient/models/R4/testreport.py new file mode 100644 index 000000000..2ce6c53ac --- /dev/null +++ b/fhirclient/models/R4/testreport.py @@ -0,0 +1,431 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/TestReport) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class TestReport(domainresource.DomainResource): + """ Describes the results of a TestScript execution. + + A summary of information based on the results of executing a TestScript. + """ + + resource_type = "TestReport" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ External identifier. + Type `Identifier` (represented as `dict` in JSON). """ + + self.issued = None + """ When the TestScript was executed and this TestReport was generated. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.name = None + """ Informal name of the executed TestScript. + Type `str`. """ + + self.participant = None + """ A participant in the test execution, either the execution engine, a + client, or a server. + List of `TestReportParticipant` items (represented as `dict` in JSON). """ + + self.result = None + """ pass | fail | pending. + Type `str`. """ + + self.score = None + """ The final score (percentage of tests passed) resulting from the + execution of the TestScript. + Type `float`. """ + + self.setup = None + """ The results of the series of required setup operations before the + tests were executed. + Type `TestReportSetup` (represented as `dict` in JSON). """ + + self.status = None + """ completed | in-progress | waiting | stopped | entered-in-error. + Type `str`. """ + + self.teardown = None + """ The results of running the series of required clean up steps. + Type `TestReportTeardown` (represented as `dict` in JSON). """ + + self.test = None + """ A test executed from the test script. + List of `TestReportTest` items (represented as `dict` in JSON). """ + + self.testScript = None + """ Reference to the version-specific TestScript that was executed to + produce this TestReport. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.tester = None + """ Name of the tester producing this report (Organization or + individual). + Type `str`. """ + + super(TestReport, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestReport, self).elementProperties() + js.extend([ + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("issued", "issued", fhirdate.FHIRDate, False, None, False), + ("name", "name", str, False, None, False), + ("participant", "participant", TestReportParticipant, True, None, False), + ("result", "result", str, False, None, True), + ("score", "score", float, False, None, False), + ("setup", "setup", TestReportSetup, False, None, False), + ("status", "status", str, False, None, True), + ("teardown", "teardown", TestReportTeardown, False, None, False), + ("test", "test", TestReportTest, True, None, False), + ("testScript", "testScript", fhirreference.FHIRReference, False, None, True), + ("tester", "tester", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class TestReportParticipant(backboneelement.BackboneElement): + """ A participant in the test execution, either the execution engine, a client, + or a server. + """ + + resource_type = "TestReportParticipant" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.display = None + """ The display name of the participant. + Type `str`. """ + + self.type = None + """ test-engine | client | server. + Type `str`. """ + + self.uri = None + """ The uri of the participant. An absolute URL is preferred. + Type `str`. """ + + super(TestReportParticipant, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestReportParticipant, self).elementProperties() + js.extend([ + ("display", "display", str, False, None, False), + ("type", "type", str, False, None, True), + ("uri", "uri", str, False, None, True), + ]) + return js + + +class TestReportSetup(backboneelement.BackboneElement): + """ The results of the series of required setup operations before the tests + were executed. + """ + + resource_type = "TestReportSetup" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ A setup operation or assert that was executed. + List of `TestReportSetupAction` items (represented as `dict` in JSON). """ + + super(TestReportSetup, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestReportSetup, self).elementProperties() + js.extend([ + ("action", "action", TestReportSetupAction, True, None, True), + ]) + return js + + +class TestReportSetupAction(backboneelement.BackboneElement): + """ A setup operation or assert that was executed. + + Action would contain either an operation or an assertion. + """ + + resource_type = "TestReportSetupAction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.assert_fhir = None + """ The assertion to perform. + Type `TestReportSetupActionAssert` (represented as `dict` in JSON). """ + + self.operation = None + """ The operation to perform. + Type `TestReportSetupActionOperation` (represented as `dict` in JSON). """ + + super(TestReportSetupAction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestReportSetupAction, self).elementProperties() + js.extend([ + ("assert_fhir", "assert", TestReportSetupActionAssert, False, None, False), + ("operation", "operation", TestReportSetupActionOperation, False, None, False), + ]) + return js + + +class TestReportSetupActionAssert(backboneelement.BackboneElement): + """ The assertion to perform. + + The results of the assertion performed on the previous operations. + """ + + resource_type = "TestReportSetupActionAssert" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.detail = None + """ A link to further details on the result. + Type `str`. """ + + self.message = None + """ A message associated with the result. + Type `str`. """ + + self.result = None + """ pass | skip | fail | warning | error. + Type `str`. """ + + super(TestReportSetupActionAssert, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestReportSetupActionAssert, self).elementProperties() + js.extend([ + ("detail", "detail", str, False, None, False), + ("message", "message", str, False, None, False), + ("result", "result", str, False, None, True), + ]) + return js + + +class TestReportSetupActionOperation(backboneelement.BackboneElement): + """ The operation to perform. + + The operation performed. + """ + + resource_type = "TestReportSetupActionOperation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.detail = None + """ A link to further details on the result. + Type `str`. """ + + self.message = None + """ A message associated with the result. + Type `str`. """ + + self.result = None + """ pass | skip | fail | warning | error. + Type `str`. """ + + super(TestReportSetupActionOperation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestReportSetupActionOperation, self).elementProperties() + js.extend([ + ("detail", "detail", str, False, None, False), + ("message", "message", str, False, None, False), + ("result", "result", str, False, None, True), + ]) + return js + + +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 all the + tests were executed (successfully or otherwise). + """ + + resource_type = "TestReportTeardown" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ One or more teardown operations performed. + List of `TestReportTeardownAction` items (represented as `dict` in JSON). """ + + super(TestReportTeardown, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestReportTeardown, self).elementProperties() + js.extend([ + ("action", "action", TestReportTeardownAction, True, None, True), + ]) + return js + + +class TestReportTeardownAction(backboneelement.BackboneElement): + """ One or more teardown operations performed. + + The teardown action will only contain an operation. + """ + + resource_type = "TestReportTeardownAction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.operation = None + """ The teardown operation performed. + Type `TestReportSetupActionOperation` (represented as `dict` in JSON). """ + + super(TestReportTeardownAction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestReportTeardownAction, self).elementProperties() + js.extend([ + ("operation", "operation", TestReportSetupActionOperation, False, None, True), + ]) + return js + + +class TestReportTest(backboneelement.BackboneElement): + """ A test executed from the test script. + """ + + resource_type = "TestReportTest" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ A test operation or assert that was performed. + List of `TestReportTestAction` items (represented as `dict` in JSON). """ + + self.description = None + """ Tracking/reporting short description of the test. + Type `str`. """ + + self.name = None + """ Tracking/logging name of this test. + Type `str`. """ + + super(TestReportTest, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestReportTest, self).elementProperties() + js.extend([ + ("action", "action", TestReportTestAction, True, None, True), + ("description", "description", str, False, None, False), + ("name", "name", str, False, None, False), + ]) + return js + + +class TestReportTestAction(backboneelement.BackboneElement): + """ A test operation or assert that was performed. + + Action would contain either an operation or an assertion. + """ + + resource_type = "TestReportTestAction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.assert_fhir = None + """ The assertion performed. + Type `TestReportSetupActionAssert` (represented as `dict` in JSON). """ + + self.operation = None + """ The operation performed. + Type `TestReportSetupActionOperation` (represented as `dict` in JSON). """ + + super(TestReportTestAction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestReportTestAction, self).elementProperties() + js.extend([ + ("assert_fhir", "assert", TestReportSetupActionAssert, False, None, False), + ("operation", "operation", TestReportSetupActionOperation, False, None, False), + ]) + 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/R4/testreport_tests.py b/fhirclient/models/R4/testreport_tests.py new file mode 100644 index 000000000..143f9fd65 --- /dev/null +++ b/fhirclient/models/R4/testreport_tests.py @@ -0,0 +1,103 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import testreport +from .fhirdate import FHIRDate + + +class TestReportTests(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("TestReport", js["resourceType"]) + return testreport.TestReport(js) + + def testTestReport1(self): + inst = self.instantiate_from("testreport-example.json") + self.assertIsNotNone(inst, "Must have instantiated a TestReport instance") + self.implTestReport1(inst) + + js = inst.as_json() + self.assertEqual("TestReport", js["resourceType"]) + inst2 = testreport.TestReport(js) + self.implTestReport1(inst2) + + def implTestReport1(self, inst): + self.assertEqual(inst.id, "testreport-example") + 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.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") + self.assertEqual(inst.participant[0].uri, "http://projectcrucible.org") + self.assertEqual(inst.participant[1].display, "HealthIntersections STU3") + self.assertEqual(inst.participant[1].type, "server") + self.assertEqual(inst.participant[1].uri, "http://fhir3.healthintersections.com.au/open") + self.assertEqual(inst.result, "pass") + self.assertEqual(inst.score, 100.0) + self.assertEqual(inst.setup.action[0].operation.detail, "http://projectcrucible.org/permalink/1") + self.assertEqual(inst.setup.action[0].operation.message, "DELETE Patient") + self.assertEqual(inst.setup.action[0].operation.result, "pass") + self.assertEqual(inst.setup.action[1].assert_fhir.detail, "http://projectcrucible.org/permalink/1") + self.assertEqual(inst.setup.action[1].assert_fhir.message, "HTTP 204") + self.assertEqual(inst.setup.action[1].assert_fhir.result, "pass") + self.assertEqual(inst.setup.action[2].operation.detail, "http://projectcrucible.org/permalink/1") + self.assertEqual(inst.setup.action[2].operation.message, "POST Patient/fixture-patient-create") + self.assertEqual(inst.setup.action[2].operation.result, "pass") + self.assertEqual(inst.setup.action[3].assert_fhir.detail, "http://projectcrucible.org/permalink/1") + self.assertEqual(inst.setup.action[3].assert_fhir.message, "HTTP 201") + self.assertEqual(inst.setup.action[3].assert_fhir.result, "pass") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.teardown.action[0].operation.detail, "http://projectcrucible.org/permalink/3") + self.assertEqual(inst.teardown.action[0].operation.message, "DELETE Patient/fixture-patient-create.") + self.assertEqual(inst.teardown.action[0].operation.result, "pass") + self.assertEqual(inst.test[0].action[0].operation.detail, "http://projectcrucible.org/permalink/2") + self.assertEqual(inst.test[0].action[0].operation.message, "GET Patient/fixture-patient-create") + self.assertEqual(inst.test[0].action[0].operation.result, "pass") + self.assertEqual(inst.test[0].action[1].assert_fhir.detail, "http://projectcrucible.org/permalink/2") + self.assertEqual(inst.test[0].action[1].assert_fhir.message, "HTTP 200") + self.assertEqual(inst.test[0].action[1].assert_fhir.result, "pass") + self.assertEqual(inst.test[0].action[2].assert_fhir.detail, "http://projectcrucible.org/permalink/2") + self.assertEqual(inst.test[0].action[2].assert_fhir.message, "Last-Modified Present") + self.assertEqual(inst.test[0].action[2].assert_fhir.result, "pass") + self.assertEqual(inst.test[0].action[3].assert_fhir.detail, "http://projectcrucible.org/permalink/2") + self.assertEqual(inst.test[0].action[3].assert_fhir.message, "Response is Patient") + self.assertEqual(inst.test[0].action[3].assert_fhir.result, "pass") + self.assertEqual(inst.test[0].action[4].assert_fhir.detail, "http://projectcrucible.org/permalink/2") + self.assertEqual(inst.test[0].action[4].assert_fhir.message, "Response validates") + self.assertEqual(inst.test[0].action[4].assert_fhir.result, "pass") + self.assertEqual(inst.test[0].action[5].assert_fhir.detail, "http://projectcrucible.org/permalink/2") + self.assertEqual(inst.test[0].action[5].assert_fhir.message, "Patient.name.family 'Chalmers'") + self.assertEqual(inst.test[0].action[5].assert_fhir.result, "pass") + self.assertEqual(inst.test[0].action[6].assert_fhir.detail, "http://projectcrucible.org/permalink/2") + self.assertEqual(inst.test[0].action[6].assert_fhir.message, "Patient.name.given 'Peter'") + self.assertEqual(inst.test[0].action[6].assert_fhir.result, "pass") + self.assertEqual(inst.test[0].action[7].assert_fhir.detail, "http://projectcrucible.org/permalink/2") + self.assertEqual(inst.test[0].action[7].assert_fhir.message, "Patient.name.family 'Chalmers'") + self.assertEqual(inst.test[0].action[7].assert_fhir.result, "pass") + self.assertEqual(inst.test[0].action[8].assert_fhir.detail, "http://projectcrucible.org/permalink/2") + self.assertEqual(inst.test[0].action[8].assert_fhir.message, "Patient.name.family 'Chalmers'") + self.assertEqual(inst.test[0].action[8].assert_fhir.result, "pass") + self.assertEqual(inst.test[0].action[9].assert_fhir.detail, "http://projectcrucible.org/permalink/2") + self.assertEqual(inst.test[0].action[9].assert_fhir.message, "Patient expected values.") + self.assertEqual(inst.test[0].action[9].assert_fhir.result, "pass") + 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.tester, "HL7 Execution Engine") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/R4/testscript.py b/fhirclient/models/R4/testscript.py new file mode 100644 index 000000000..49b0efcbe --- /dev/null +++ b/fhirclient/models/R4/testscript.py @@ -0,0 +1,989 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/TestScript) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class TestScript(domainresource.DomainResource): + """ Describes a set of tests. + + A structured set of tests against a FHIR server or client implementation to + determine compliance against the FHIR specification. + """ + + resource_type = "TestScript" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 last changed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Natural language description of the test script. + Type `str`. """ + + self.destination = None + """ An abstract server representing a destination or receiver in a + message exchange. + List of `TestScriptDestination` items (represented as `dict` in JSON). """ + + self.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.fixture = None + """ Fixture in the test script - by reference (uri). + List of `TestScriptFixture` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Additional identifier for the test script. + Type `Identifier` (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ Intended jurisdiction for test script (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.metadata = None + """ Required capability that is assumed to function correctly on the + FHIR server being tested. + Type `TestScriptMetadata` (represented as `dict` in JSON). """ + + self.name = None + """ Name for this test script (computer friendly). + Type `str`. """ + + self.origin = None + """ An abstract server representing a client or sender in a message + exchange. + List of `TestScriptOrigin` items (represented as `dict` in JSON). """ + + self.profile = None + """ Reference of the validation profile. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this test script is defined. + Type `str`. """ + + self.setup = None + """ A series of required setup operations before tests are executed. + Type `TestScriptSetup` (represented as `dict` in JSON). """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.teardown = None + """ A series of required clean up steps. + Type `TestScriptTeardown` (represented as `dict` in JSON). """ + + self.test = None + """ A test in this script. + List of `TestScriptTest` items (represented as `dict` in JSON). """ + + self.title = None + """ Name for this test script (human friendly). + Type `str`. """ + + self.url = None + """ Canonical identifier for this test script, 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.variable = None + """ Placeholder for evaluated elements. + List of `TestScriptVariable` items (represented as `dict` in JSON). """ + + self.version = None + """ Business version of the test script. + Type `str`. """ + + super(TestScript, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScript, self).elementProperties() + js.extend([ + ("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), + ("destination", "destination", TestScriptDestination, True, None, False), + ("experimental", "experimental", bool, False, None, False), + ("fixture", "fixture", TestScriptFixture, True, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("metadata", "metadata", TestScriptMetadata, False, None, False), + ("name", "name", str, False, None, True), + ("origin", "origin", TestScriptOrigin, True, None, False), + ("profile", "profile", fhirreference.FHIRReference, True, None, False), + ("publisher", "publisher", str, False, None, False), + ("purpose", "purpose", str, False, None, False), + ("setup", "setup", TestScriptSetup, False, None, False), + ("status", "status", str, False, None, True), + ("teardown", "teardown", TestScriptTeardown, False, None, False), + ("test", "test", TestScriptTest, True, None, False), + ("title", "title", str, False, None, False), + ("url", "url", str, False, None, True), + ("useContext", "useContext", usagecontext.UsageContext, True, None, False), + ("variable", "variable", TestScriptVariable, True, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class TestScriptDestination(backboneelement.BackboneElement): + """ An abstract server representing a destination or receiver in a message + exchange. + + An abstract server used in operations within this test script in the + destination element. + """ + + resource_type = "TestScriptDestination" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.index = None + """ The index of the abstract destination server starting at 1. + Type `int`. """ + + self.profile = None + """ FHIR-Server | FHIR-SDC-FormManager | FHIR-SDC-FormReceiver | FHIR- + SDC-FormProcessor. + Type `Coding` (represented as `dict` in JSON). """ + + super(TestScriptDestination, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScriptDestination, self).elementProperties() + js.extend([ + ("index", "index", int, False, None, True), + ("profile", "profile", coding.Coding, False, None, True), + ]) + return js + + +class TestScriptFixture(backboneelement.BackboneElement): + """ Fixture in the test script - by reference (uri). + + Fixture in the test script - by reference (uri). All fixtures are required + for the test script to execute. + """ + + resource_type = "TestScriptFixture" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.autocreate = None + """ Whether or not to implicitly create the fixture during setup. + Type `bool`. """ + + self.autodelete = None + """ Whether or not to implicitly delete the fixture during teardown. + Type `bool`. """ + + self.resource = None + """ Reference of the resource. + 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, True), + ("autodelete", "autodelete", bool, False, None, True), + ("resource", "resource", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +class TestScriptMetadata(backboneelement.BackboneElement): + """ Required capability that is assumed to function correctly on the FHIR + server being tested. + + The required capability must exist and are assumed to function correctly on + the FHIR server being tested. + """ + + resource_type = "TestScriptMetadata" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Capabilities that are assumed to function correctly on the FHIR + server being tested. + List of `TestScriptMetadataCapability` items (represented as `dict` in JSON). """ + + self.link = None + """ Links to the FHIR specification. + List of `TestScriptMetadataLink` items (represented as `dict` in JSON). """ + + super(TestScriptMetadata, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScriptMetadata, self).elementProperties() + js.extend([ + ("capability", "capability", TestScriptMetadataCapability, True, None, True), + ("link", "link", TestScriptMetadataLink, True, None, False), + ]) + return js + + +class TestScriptMetadataCapability(backboneelement.BackboneElement): + """ Capabilities that are assumed to function correctly on the FHIR server + being tested. + + Capabilities that must exist and are assumed to function correctly on the + FHIR server being tested. + """ + + resource_type = "TestScriptMetadataCapability" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.capabilities = None + """ Required Capability Statement. + Type `str`. """ + + self.description = None + """ The expected capabilities of the server. + Type `str`. """ + + self.destination = None + """ Which server these requirements apply to. + Type `int`. """ + + self.link = None + """ Links to the FHIR specification. + List of `str` items. """ + + self.origin = None + """ Which origin server these requirements apply to. + List of `int` items. """ + + self.required = None + """ Are the capabilities required?. + Type `bool`. """ + + self.validated = None + """ Are the capabilities validated?. + Type `bool`. """ + + super(TestScriptMetadataCapability, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScriptMetadataCapability, self).elementProperties() + js.extend([ + ("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, True), + ("validated", "validated", bool, False, None, True), + ]) + return js + + +class TestScriptMetadataLink(backboneelement.BackboneElement): + """ Links to the FHIR specification. + + A link to the FHIR specification that this test is covering. + """ + + resource_type = "TestScriptMetadataLink" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Short description. + Type `str`. """ + + self.url = None + """ URL to the specification. + Type `str`. """ + + super(TestScriptMetadataLink, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScriptMetadataLink, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, False), + ("url", "url", str, False, None, True), + ]) + return js + + +class TestScriptOrigin(backboneelement.BackboneElement): + """ An abstract server representing a client or sender in a message exchange. + + An abstract server used in operations within this test script in the origin + element. + """ + + resource_type = "TestScriptOrigin" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.index = None + """ The index of the abstract origin server starting at 1. + Type `int`. """ + + self.profile = None + """ FHIR-Client | FHIR-SDC-FormFiller. + Type `Coding` (represented as `dict` in JSON). """ + + super(TestScriptOrigin, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScriptOrigin, self).elementProperties() + js.extend([ + ("index", "index", int, False, None, True), + ("profile", "profile", coding.Coding, False, None, True), + ]) + return js + + +class TestScriptSetup(backboneelement.BackboneElement): + """ A series of required setup operations before tests are executed. + """ + + resource_type = "TestScriptSetup" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ A setup operation or assert to perform. + List of `TestScriptSetupAction` items (represented as `dict` in JSON). """ + + super(TestScriptSetup, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScriptSetup, self).elementProperties() + js.extend([ + ("action", "action", TestScriptSetupAction, True, None, True), + ]) + return js + + +class TestScriptSetupAction(backboneelement.BackboneElement): + """ A setup operation or assert to perform. + + Action would contain either an operation or an assertion. + """ + + resource_type = "TestScriptSetupAction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.assert_fhir = None + """ The assertion to perform. + Type `TestScriptSetupActionAssert` (represented as `dict` in JSON). """ + + self.operation = None + """ The setup operation to perform. + Type `TestScriptSetupActionOperation` (represented as `dict` in JSON). """ + + super(TestScriptSetupAction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScriptSetupAction, self).elementProperties() + js.extend([ + ("assert_fhir", "assert", TestScriptSetupActionAssert, False, None, False), + ("operation", "operation", TestScriptSetupActionOperation, False, None, False), + ]) + return js + + +class TestScriptSetupActionAssert(backboneelement.BackboneElement): + """ The assertion to perform. + + Evaluates the results of previous operations to determine if the server + under test behaves appropriately. + """ + + resource_type = "TestScriptSetupActionAssert" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.compareToSourceExpression = None + """ The FHIRPath expression to evaluate against the source fixture. + Type `str`. """ + + self.compareToSourceId = None + """ Id of the source fixture to be evaluated. + Type `str`. """ + + self.compareToSourcePath = None + """ XPath or JSONPath expression to evaluate against the source fixture. + Type `str`. """ + + self.contentType = None + """ Mime type to compare against the 'Content-Type' header. + Type `str`. """ + + self.description = None + """ Tracking/reporting assertion description. + Type `str`. """ + + self.direction = None + """ response | request. + Type `str`. """ + + self.expression = None + """ The FHIRPath expression to be evaluated. + Type `str`. """ + + self.headerField = None + """ HTTP header field name. + Type `str`. """ + + self.label = None + """ Tracking/logging assertion label. + Type `str`. """ + + self.minimumId = None + """ Fixture Id of minimum content resource. + Type `str`. """ + + self.navigationLinks = None + """ Perform validation on navigation links?. + Type `bool`. """ + + self.operator = None + """ equals | notEquals | in | notIn | greaterThan | lessThan | empty | + notEmpty | contains | notContains | eval. + Type `str`. """ + + self.path = None + """ XPath or JSONPath expression. + Type `str`. """ + + self.requestMethod = None + """ delete | get | options | patch | post | put | head. + Type `str`. """ + + self.requestURL = None + """ Request URL comparison value. + Type `str`. """ + + self.resource = None + """ Resource type. + Type `str`. """ + + self.response = None + """ okay | created | noContent | notModified | bad | forbidden | + notFound | methodNotAllowed | conflict | gone | preconditionFailed + | unprocessable. + Type `str`. """ + + self.responseCode = None + """ HTTP response code to test. + Type `str`. """ + + self.sourceId = None + """ Fixture Id of source expression or headerField. + Type `str`. """ + + self.validateProfileId = None + """ Profile Id of validation profile reference. + Type `str`. """ + + self.value = None + """ The value to compare to. + Type `str`. """ + + self.warningOnly = None + """ Will this assert produce a warning only on error?. + Type `bool`. """ + + super(TestScriptSetupActionAssert, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScriptSetupActionAssert, self).elementProperties() + js.extend([ + ("compareToSourceExpression", "compareToSourceExpression", str, False, None, False), + ("compareToSourceId", "compareToSourceId", str, False, None, False), + ("compareToSourcePath", "compareToSourcePath", str, False, None, False), + ("contentType", "contentType", str, False, None, False), + ("description", "description", str, False, None, False), + ("direction", "direction", str, False, None, False), + ("expression", "expression", str, False, None, False), + ("headerField", "headerField", str, False, None, False), + ("label", "label", str, False, None, False), + ("minimumId", "minimumId", str, False, None, False), + ("navigationLinks", "navigationLinks", bool, False, None, False), + ("operator", "operator", str, False, None, False), + ("path", "path", str, False, None, False), + ("requestMethod", "requestMethod", str, False, None, False), + ("requestURL", "requestURL", str, False, None, False), + ("resource", "resource", str, False, None, False), + ("response", "response", str, False, None, False), + ("responseCode", "responseCode", str, 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, True), + ]) + return js + + +class TestScriptSetupActionOperation(backboneelement.BackboneElement): + """ The setup operation to perform. + + The operation to perform. + """ + + resource_type = "TestScriptSetupActionOperation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.accept = None + """ Mime type to accept in the payload of the response, with charset + etc.. + Type `str`. """ + + self.contentType = None + """ Mime type of the request payload contents, with charset etc.. + Type `str`. """ + + self.description = None + """ Tracking/reporting operation description. + Type `str`. """ + + self.destination = None + """ Server responding to the request. + Type `int`. """ + + self.encodeRequestUrl = None + """ Whether or not to send the request url in encoded format. + Type `bool`. """ + + self.label = None + """ 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`. """ + + self.params = None + """ Explicitly defined path parameters. + Type `str`. """ + + self.requestHeader = None + """ Each operation can have one or more header elements. + List of `TestScriptSetupActionOperationRequestHeader` items (represented as `dict` in JSON). """ + + self.requestId = None + """ Fixture Id of mapped request. + Type `str`. """ + + self.resource = None + """ Resource type. + Type `str`. """ + + self.responseId = None + """ Fixture Id of mapped response. + Type `str`. """ + + self.sourceId = None + """ Fixture Id of body for PUT and POST requests. + Type `str`. """ + + self.targetId = None + """ Id of fixture used for extracting the [id], [type], and [vid] for + GET requests. + Type `str`. """ + + self.type = None + """ The operation code type that will be executed. + Type `Coding` (represented as `dict` in JSON). """ + + self.url = None + """ Request URL. + Type `str`. """ + + super(TestScriptSetupActionOperation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScriptSetupActionOperation, self).elementProperties() + js.extend([ + ("accept", "accept", str, False, None, False), + ("contentType", "contentType", str, False, None, False), + ("description", "description", str, False, None, False), + ("destination", "destination", int, 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), + ("requestId", "requestId", str, False, None, False), + ("resource", "resource", str, False, None, False), + ("responseId", "responseId", str, False, None, False), + ("sourceId", "sourceId", str, False, None, False), + ("targetId", "targetId", str, False, None, False), + ("type", "type", coding.Coding, False, None, False), + ("url", "url", str, False, None, False), + ]) + return js + + +class TestScriptSetupActionOperationRequestHeader(backboneelement.BackboneElement): + """ Each operation can have one or more header elements. + + Header elements would be used to set HTTP headers. + """ + + resource_type = "TestScriptSetupActionOperationRequestHeader" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.field = None + """ HTTP header field name. + Type `str`. """ + + self.value = None + """ HTTP headerfield value. + Type `str`. """ + + super(TestScriptSetupActionOperationRequestHeader, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScriptSetupActionOperationRequestHeader, self).elementProperties() + js.extend([ + ("field", "field", str, False, None, True), + ("value", "value", str, False, None, True), + ]) + return js + + +class TestScriptTeardown(backboneelement.BackboneElement): + """ A series of required clean up steps. + + A series of operations required to clean up after all the tests are + executed (successfully or otherwise). + """ + + resource_type = "TestScriptTeardown" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ One or more teardown operations to perform. + List of `TestScriptTeardownAction` items (represented as `dict` in JSON). """ + + super(TestScriptTeardown, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScriptTeardown, self).elementProperties() + js.extend([ + ("action", "action", TestScriptTeardownAction, True, None, True), + ]) + return js + + +class TestScriptTeardownAction(backboneelement.BackboneElement): + """ One or more teardown operations to perform. + + The teardown action will only contain an operation. + """ + + resource_type = "TestScriptTeardownAction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.operation = None + """ The teardown operation to perform. + Type `TestScriptSetupActionOperation` (represented as `dict` in JSON). """ + + super(TestScriptTeardownAction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScriptTeardownAction, self).elementProperties() + js.extend([ + ("operation", "operation", TestScriptSetupActionOperation, False, None, True), + ]) + return js + + +class TestScriptTest(backboneelement.BackboneElement): + """ A test in this script. + """ + + resource_type = "TestScriptTest" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ A test operation or assert to perform. + List of `TestScriptTestAction` items (represented as `dict` in JSON). """ + + self.description = None + """ Tracking/reporting short description of the test. + Type `str`. """ + + self.name = None + """ Tracking/logging name of this test. + Type `str`. """ + + super(TestScriptTest, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScriptTest, self).elementProperties() + js.extend([ + ("action", "action", TestScriptTestAction, True, None, True), + ("description", "description", str, False, None, False), + ("name", "name", str, False, None, False), + ]) + return js + + +class TestScriptTestAction(backboneelement.BackboneElement): + """ A test operation or assert to perform. + + Action would contain either an operation or an assertion. + """ + + resource_type = "TestScriptTestAction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.assert_fhir = None + """ The setup assertion to perform. + Type `TestScriptSetupActionAssert` (represented as `dict` in JSON). """ + + self.operation = None + """ The setup operation to perform. + Type `TestScriptSetupActionOperation` (represented as `dict` in JSON). """ + + super(TestScriptTestAction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScriptTestAction, self).elementProperties() + js.extend([ + ("assert_fhir", "assert", TestScriptSetupActionAssert, False, None, False), + ("operation", "operation", TestScriptSetupActionOperation, False, None, False), + ]) + return js + + +class TestScriptVariable(backboneelement.BackboneElement): + """ Placeholder for evaluated elements. + + Variable is set based either on element value in response body or on header + field value in the response headers. + """ + + resource_type = "TestScriptVariable" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.defaultValue = None + """ Default, hard-coded, or user-defined value for this variable. + Type `str`. """ + + self.description = None + """ Natural language description of the variable. + Type `str`. """ + + self.expression = None + """ The FHIRPath expression against the fixture body. + Type `str`. """ + + self.headerField = None + """ HTTP header field name for source. + Type `str`. """ + + self.hint = None + """ Hint help text for default value to enter. + Type `str`. """ + + self.name = None + """ Descriptive name for this variable. + Type `str`. """ + + self.path = None + """ XPath or JSONPath against the fixture body. + Type `str`. """ + + self.sourceId = None + """ Fixture Id of source expression or headerField within this variable. + Type `str`. """ + + super(TestScriptVariable, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScriptVariable, self).elementProperties() + js.extend([ + ("defaultValue", "defaultValue", str, False, None, False), + ("description", "description", str, False, None, False), + ("expression", "expression", str, False, None, False), + ("headerField", "headerField", str, False, None, False), + ("hint", "hint", str, False, None, False), + ("name", "name", str, False, None, True), + ("path", "path", str, False, None, False), + ("sourceId", "sourceId", str, 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 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 usagecontext +except ImportError: + usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/R4/testscript_tests.py b/fhirclient/models/R4/testscript_tests.py new file mode 100644 index 000000000..311b3ee4b --- /dev/null +++ b/fhirclient/models/R4/testscript_tests.py @@ -0,0 +1,774 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import testscript +from .fhirdate import FHIRDate + + +class TestScriptTests(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("TestScript", js["resourceType"]) + return testscript.TestScript(js) + + def testTestScript1(self): + inst = self.instantiate_from("testscript-example-multisystem.json") + self.assertIsNotNone(inst, "Must have instantiated a TestScript instance") + self.implTestScript1(inst) + + js = inst.as_json() + self.assertEqual("TestScript", js["resourceType"]) + inst2 = testscript.TestScript(js) + 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.assertEqual(inst.destination[0].index, 1) + self.assertEqual(inst.destination[0].profile.code, "FHIR-Server") + self.assertEqual(inst.destination[1].index, 2) + self.assertEqual(inst.destination[1].profile.code, "FHIR-Server") + self.assertTrue(inst.experimental) + self.assertEqual(inst.id, "testscript-example-multisystem") + 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.9878") + 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") + self.assertEqual(inst.metadata.capability[1].origin[0], 1) + self.assertTrue(inst.metadata.capability[1].required) + self.assertFalse(inst.metadata.capability[1].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-multisystem") + self.assertEqual(inst.origin[0].index, 1) + self.assertEqual(inst.origin[0].profile.code, "FHIR-Client") + 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.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://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") + self.assertEqual(inst.test[1].action[0].operation.accept, "xml") + 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://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") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "Multisystem Test Script") + self.assertEqual(inst.url, "http://hl7.org/fhir/TestScript/testscript-example-multisystem") + self.assertEqual(inst.variable[0].defaultValue, "example") + self.assertEqual(inst.variable[0].name, "Dest1PatientResourceId") + self.assertEqual(inst.variable[1].defaultValue, "example") + self.assertEqual(inst.variable[1].name, "Dest2PatientResourceId") + self.assertEqual(inst.version, "1.0") + + def testTestScript2(self): + inst = self.instantiate_from("testscript-example-history.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") + 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].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 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.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, "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.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.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-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 testTestScript3(self): + inst = self.instantiate_from("testscript-example-update.json") + self.assertIsNotNone(inst, "Must have instantiated a TestScript instance") + self.implTestScript3(inst) + + js = inst.as_json() + self.assertEqual("TestScript", js["resourceType"]) + inst2 = testscript.TestScript(js) + self.implTestScript3(inst2) + + 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") + 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].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 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.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, "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://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.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.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.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.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].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 testTestScript4(self): + inst = self.instantiate_from("testscript-example-search.json") + self.assertIsNotNone(inst, "Must have instantiated a TestScript instance") + self.implTestScript4(inst) + + js = inst.as_json() + self.assertEqual("TestScript", js["resourceType"]) + inst2 = testscript.TestScript(js) + self.implTestScript4(inst2) + + 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") + 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 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") + self.assertEqual(inst.identifier.value, "urn:oid:1.3.6.1.4.1.21367.2005.3.7.9881") + 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") + self.assertEqual(inst.publisher, "HL7") + 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://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://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://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://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") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.url, "http://hl7.org/fhir/TestScript/testscript-example-search") + self.assertEqual(inst.variable[0].headerField, "Location") + self.assertEqual(inst.variable[0].name, "PatientCreateLocation") + self.assertEqual(inst.variable[0].sourceId, "PatientCreateResponse") + self.assertEqual(inst.variable[1].description, "Enter patient search criteria for a known family name on the target system") + self.assertEqual(inst.variable[1].hint, "[Family name]") + self.assertEqual(inst.variable[1].name, "PatientSearchFamilyName") + self.assertEqual(inst.variable[2].description, "Enter patient search criteria for a known given name on the target system") + self.assertEqual(inst.variable[2].hint, "[Given name]") + self.assertEqual(inst.variable[2].name, "PatientSearchGivenName") + self.assertEqual(inst.variable[3].description, "Evaluate the returned Patient searchset Bundle.total value") + self.assertEqual(inst.variable[3].expression, "Bundle.total.toInteger()") + self.assertEqual(inst.variable[3].name, "PatientSearchBundleTotal") + self.assertEqual(inst.version, "1.0") + + def testTestScript5(self): + inst = self.instantiate_from("testscript-example.json") + self.assertIsNotNone(inst, "Must have instantiated a TestScript instance") + self.implTestScript5(inst) + + js = inst.as_json() + self.assertEqual("TestScript", js["resourceType"]) + inst2 = testscript.TestScript(js) + self.implTestScript5(inst2) + + 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") + 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 read the created 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") + 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.9876") + 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") + self.assertEqual(inst.publisher, "HL7") + 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://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.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://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://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://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.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) + 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.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://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://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/R4/timing.py b/fhirclient/models/R4/timing.py new file mode 100644 index 000000000..a3a4c68be --- /dev/null +++ b/fhirclient/models/R4/timing.py @@ -0,0 +1,186 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Timing) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import backboneelement + +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 + to record when things are planned, expected or requested to occur. The most + common usage is in dosage instructions for medications. They are also used + when planning care of various kinds, and may be used for reporting the + schedule to which past regular activities were carried out. + """ + + resource_type = "Timing" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ BID | TID | QID | AM | PM | QD | QOD | +. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.event = None + """ When the event occurs. + List of `FHIRDate` items (represented as `str` in JSON). """ + + self.repeat = None + """ When the event is to occur. + Type `TimingRepeat` (represented as `dict` in JSON). """ + + super(Timing, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Timing, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("event", "event", fhirdate.FHIRDate, True, None, False), + ("repeat", "repeat", TimingRepeat, False, None, False), + ]) + return js + + +from . import element + +class TimingRepeat(element.Element): + """ When the event is to occur. + + A set of rules that describe when the event is scheduled. + """ + + resource_type = "TimingRepeat" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.boundsDuration = None + """ Length/Range of lengths, or (Start and/or end) limits. + Type `Duration` (represented as `dict` in JSON). """ + + self.boundsPeriod = None + """ Length/Range of lengths, or (Start and/or end) limits. + Type `Period` (represented as `dict` in JSON). """ + + self.boundsRange = None + """ Length/Range of lengths, or (Start and/or end) limits. + Type `Range` (represented as `dict` in JSON). """ + + self.count = None + """ Number of times to repeat. + Type `int`. """ + + self.countMax = None + """ Maximum number of times to repeat. + Type `int`. """ + + self.dayOfWeek = None + """ mon | tue | wed | thu | fri | sat | sun. + List of `str` items. """ + + self.duration = None + """ How long when it happens. + Type `float`. """ + + self.durationMax = None + """ How long when it happens (Max). + Type `float`. """ + + self.durationUnit = None + """ s | min | h | d | wk | mo | a - unit of time (UCUM). + Type `str`. """ + + self.frequency = None + """ Event occurs frequency times per period. + Type `int`. """ + + self.frequencyMax = None + """ Event occurs up to frequencyMax times per period. + Type `int`. """ + + self.offset = None + """ Minutes from event (before or after). + Type `int`. """ + + self.period = None + """ Event occurs frequency times per period. + Type `float`. """ + + self.periodMax = None + """ Upper limit of period (3-4 hours). + Type `float`. """ + + self.periodUnit = None + """ s | min | h | d | wk | mo | a - unit of time (UCUM). + Type `str`. """ + + self.timeOfDay = None + """ Time of day for action. + List of `FHIRDate` items (represented as `str` in JSON). """ + + self.when = None + """ Code for time period of occurrence. + List of `str` items. """ + + super(TimingRepeat, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TimingRepeat, self).elementProperties() + js.extend([ + ("boundsDuration", "boundsDuration", duration.Duration, False, "bounds", False), + ("boundsPeriod", "boundsPeriod", period.Period, False, "bounds", False), + ("boundsRange", "boundsRange", range.Range, False, "bounds", False), + ("count", "count", int, False, None, False), + ("countMax", "countMax", int, False, None, False), + ("dayOfWeek", "dayOfWeek", str, True, None, False), + ("duration", "duration", float, False, None, False), + ("durationMax", "durationMax", float, False, None, False), + ("durationUnit", "durationUnit", str, False, None, False), + ("frequency", "frequency", int, False, None, False), + ("frequencyMax", "frequencyMax", int, False, None, False), + ("offset", "offset", int, False, None, False), + ("period", "period", float, False, None, False), + ("periodMax", "periodMax", float, False, None, False), + ("periodUnit", "periodUnit", str, False, None, False), + ("timeOfDay", "timeOfDay", fhirdate.FHIRDate, True, None, False), + ("when", "when", str, True, 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 fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] +try: + 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/R4/triggerdefinition.py b/fhirclient/models/R4/triggerdefinition.py new file mode 100644 index 000000000..baf9f1a8e --- /dev/null +++ b/fhirclient/models/R4/triggerdefinition.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/TriggerDefinition) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class TriggerDefinition(element.Element): + """ Defines an expected trigger for a module. + + 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.condition = None + """ Whether the event triggers (boolean expression). + Type `Expression` (represented as `dict` in JSON). """ + + 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.timingDate = None + """ Timing of the event. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.timingDateTime = None + """ Timing of the event. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.timingReference = None + """ Timing of the event. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.timingTiming = None + """ Timing of the event. + Type `Timing` (represented as `dict` in JSON). """ + + self.type = None + """ 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) + + def elementProperties(self): + js = super(TriggerDefinition, self).elementProperties() + js.extend([ + ("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 + + +import sys +try: + 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: + fhirdate = sys.modules[__package__ + '.fhirdate'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import timing +except ImportError: + timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/R4/usagecontext.py b/fhirclient/models/R4/usagecontext.py new file mode 100644 index 000000000..99fbb1ec4 --- /dev/null +++ b/fhirclient/models/R4/usagecontext.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/UsageContext) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +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, + 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). + """ + + resource_type = "UsageContext" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 context being specified. + Type `Coding` (represented as `dict` in JSON). """ + + self.valueCodeableConcept = None + """ Value that defines the context. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueQuantity = None + """ Value that defines the context. + Type `Quantity` (represented as `dict` in JSON). """ + + self.valueRange = None + """ 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): + js = super(UsageContext, self).elementProperties() + js.extend([ + ("code", "code", coding.Coding, False, None, True), + ("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 + + +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 fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +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/R4/valueset.py b/fhirclient/models/R4/valueset.py new file mode 100644 index 000000000..523be577a --- /dev/null +++ b/fhirclient/models/R4/valueset.py @@ -0,0 +1,566 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ValueSet) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class ValueSet(domainresource.DomainResource): + """ 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.compose = None + """ Content logical definition of the value set (CLD). + Type `ValueSetCompose` (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 value set. + Type `str`. """ + + self.expansion = None + """ Used when the value set is "expanded". + Type `ValueSetExpansion` (represented as `dict` in JSON). """ + + self.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.identifier = None + """ Additional identifier for the value set (business identifier). + List of `Identifier` items (represented as `dict` in JSON). """ + + self.immutable = None + """ Indicates whether or not any change to the content logical + definition may occur. + Type `bool`. """ + + self.jurisdiction = None + """ Intended jurisdiction for value set (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.name = None + """ Name for this value set (computer friendly). + Type `str`. """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this value set is defined. + Type `str`. """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.title = None + """ Name for this value set (human friendly). + Type `str`. """ + + self.url = None + """ Canonical identifier for this value set, 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 value set. + Type `str`. """ + + super(ValueSet, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ValueSet, self).elementProperties() + js.extend([ + ("compose", "compose", ValueSetCompose, False, 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), + ("expansion", "expansion", ValueSetExpansion, False, None, False), + ("experimental", "experimental", bool, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("immutable", "immutable", bool, False, None, False), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("name", "name", str, False, None, False), + ("publisher", "publisher", str, False, None, False), + ("purpose", "purpose", str, False, None, False), + ("status", "status", str, False, None, True), + ("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 ValueSetCompose(backboneelement.BackboneElement): + """ Content logical definition of the value set (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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Explicitly exclude codes from a code system or other value sets. + List of `ValueSetComposeInclude` items (represented as `dict` in JSON). """ + + self.inactive = None + """ Whether inactive codes are in the value set. + Type `bool`. """ + + self.include = None + """ Include one or more codes from a code system or other value set(s). + List of `ValueSetComposeInclude` items (represented as `dict` in JSON). """ + + self.lockedDate = None + """ Fixed date for references with no specified version (transitive). + Type `FHIRDate` (represented as `str` in JSON). """ + + super(ValueSetCompose, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ValueSetCompose, self).elementProperties() + js.extend([ + ("exclude", "exclude", ValueSetComposeInclude, True, None, False), + ("inactive", "inactive", bool, False, None, False), + ("include", "include", ValueSetComposeInclude, True, None, True), + ("lockedDate", "lockedDate", fhirdate.FHIRDate, False, None, False), + ]) + return js + + +class ValueSetComposeInclude(backboneelement.BackboneElement): + """ Include one or more codes from a code system or other value set(s). + """ + + resource_type = "ValueSetComposeInclude" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.concept = None + """ A concept defined in the system. + List of `ValueSetComposeIncludeConcept` items (represented as `dict` in JSON). """ + + self.filter = None + """ Select codes/concepts by their properties (including relationships). + List of `ValueSetComposeIncludeFilter` items (represented as `dict` in JSON). """ + + self.system = None + """ The system the codes come from. + Type `str`. """ + + self.valueSet = None + """ Select the contents included in this value set. + List of `str` items. """ + + self.version = None + """ Specific version of the code system referred to. + Type `str`. """ + + super(ValueSetComposeInclude, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ValueSetComposeInclude, self).elementProperties() + js.extend([ + ("concept", "concept", ValueSetComposeIncludeConcept, True, None, False), + ("filter", "filter", ValueSetComposeIncludeFilter, True, None, False), + ("system", "system", str, False, None, False), + ("valueSet", "valueSet", str, True, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + +class ValueSetComposeIncludeConcept(backboneelement.BackboneElement): + """ A concept defined in the system. + + Specifies a concept to be included or excluded. + """ + + resource_type = "ValueSetComposeIncludeConcept" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 or expression from system. + Type `str`. """ + + self.designation = None + """ Additional representations for this concept. + List of `ValueSetComposeIncludeConceptDesignation` items (represented as `dict` in JSON). """ + + self.display = None + """ Text to display for this code for this value set in this valueset. + Type `str`. """ + + super(ValueSetComposeIncludeConcept, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ValueSetComposeIncludeConcept, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("designation", "designation", ValueSetComposeIncludeConceptDesignation, True, None, False), + ("display", "display", str, False, None, False), + ]) + return js + + +class ValueSetComposeIncludeConceptDesignation(backboneelement.BackboneElement): + """ Additional representations for this concept. + + Additional representations for this concept when used in this value set - + other languages, aliases, specialized purposes, used for particular + purposes, etc. + """ + + resource_type = "ValueSetComposeIncludeConceptDesignation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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. + Type `str`. """ + + self.use = None + """ Types of uses of designations. + Type `Coding` (represented as `dict` in JSON). """ + + self.value = None + """ The text value for this designation. + Type `str`. """ + + super(ValueSetComposeIncludeConceptDesignation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ValueSetComposeIncludeConceptDesignation, self).elementProperties() + js.extend([ + ("language", "language", str, False, None, False), + ("use", "use", coding.Coding, False, None, False), + ("value", "value", str, False, None, True), + ]) + return js + + +class ValueSetComposeIncludeFilter(backboneelement.BackboneElement): + """ Select codes/concepts by their properties (including relationships). + + 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.op = None + """ = | is-a | descendent-of | is-not-a | regex | in | not-in | + generalizes | exists. + Type `str`. """ + + self.property = None + """ A property/filter defined by the code system. + Type `str`. """ + + self.value = None + """ Code from the system, or regex criteria, or boolean value for + exists. + Type `str`. """ + + super(ValueSetComposeIncludeFilter, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ValueSetComposeIncludeFilter, self).elementProperties() + js.extend([ + ("op", "op", str, False, None, True), + ("property", "property", str, False, None, True), + ("value", "value", str, False, None, True), + ]) + return js + + +class ValueSetExpansion(backboneelement.BackboneElement): + """ Used when the value set is "expanded". + + A value set can also be "expanded", where the value set is turned into a + simple collection of enumerated codes. This element holds the expansion, if + it has been performed. + """ + + resource_type = "ValueSetExpansion" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.contains = None + """ Codes in the value set. + List of `ValueSetExpansionContains` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Identifies the value set expansion (business identifier). + Type `str`. """ + + self.offset = None + """ Offset at which this resource starts. + Type `int`. """ + + self.parameter = None + """ Parameter that controlled the expansion process. + List of `ValueSetExpansionParameter` items (represented as `dict` in JSON). """ + + self.timestamp = None + """ Time ValueSet expansion happened. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.total = None + """ Total number of codes in the expansion. + Type `int`. """ + + super(ValueSetExpansion, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ValueSetExpansion, self).elementProperties() + js.extend([ + ("contains", "contains", ValueSetExpansionContains, True, None, False), + ("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), + ("total", "total", int, False, None, False), + ]) + return js + + +class ValueSetExpansionContains(backboneelement.BackboneElement): + """ Codes in the value set. + + The codes that are contained in the value set expansion. + """ + + resource_type = "ValueSetExpansionContains" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.abstract = None + """ If user cannot select this entry. + Type `bool`. """ + + self.code = None + """ Code - if blank, this is not a selectable code. + Type `str`. """ + + self.contains = None + """ Codes contained under this entry. + List of `ValueSetExpansionContains` items (represented as `dict` in JSON). """ + + self.designation = None + """ Additional representations for this item. + List of `ValueSetComposeIncludeConceptDesignation` items (represented as `dict` in JSON). """ + + self.display = None + """ User display for the concept. + Type `str`. """ + + self.inactive = None + """ If concept is inactive in the code system. + Type `bool`. """ + + self.system = None + """ System value for the code. + Type `str`. """ + + self.version = None + """ Version in which this code/display is defined. + Type `str`. """ + + super(ValueSetExpansionContains, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ValueSetExpansionContains, self).elementProperties() + js.extend([ + ("abstract", "abstract", bool, False, None, False), + ("code", "code", str, False, None, False), + ("contains", "contains", ValueSetExpansionContains, True, None, False), + ("designation", "designation", ValueSetComposeIncludeConceptDesignation, True, None, False), + ("display", "display", str, False, None, False), + ("inactive", "inactive", bool, False, None, False), + ("system", "system", str, False, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + +class ValueSetExpansionParameter(backboneelement.BackboneElement): + """ Parameter that controlled the expansion process. + + A parameter that controlled the expansion process. These parameters may be + used by users of expanded value sets to check whether the expansion is + suitable for a particular purpose, or to pick the correct expansion. + """ + + resource_type = "ValueSetExpansionParameter" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 as assigned by the client or server. + Type `str`. """ + + self.valueBoolean = None + """ Value of the named parameter. + Type `bool`. """ + + self.valueCode = None + """ 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`. """ + + self.valueInteger = None + """ Value of the named parameter. + Type `int`. """ + + self.valueString = None + """ Value of the named parameter. + Type `str`. """ + + self.valueUri = None + """ Value of the named parameter. + Type `str`. """ + + super(ValueSetExpansionParameter, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ValueSetExpansionParameter, self).elementProperties() + js.extend([ + ("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), + ("valueUri", "valueUri", str, False, "value", 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 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/R4/valueset_tests.py b/fhirclient/models/R4/valueset_tests.py new file mode 100644 index 000000000..860f93d4b --- /dev/null +++ b/fhirclient/models/R4/valueset_tests.py @@ -0,0 +1,516 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import valueset +from .fhirdate import FHIRDate + + +class ValueSetTests(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("ValueSet", js["resourceType"]) + return valueset.ValueSet(js) + + def testValueSet1(self): + inst = self.instantiate_from("valueset-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ValueSet instance") + self.implValueSet1(inst) + + js = inst.as_json() + self.assertEqual("ValueSet", js["resourceType"]) + inst2 = valueset.ValueSet(js) + 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") + self.assertEqual(inst.compose.include[0].system, "http://loinc.org") + 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.expansion.contains[0].code, "14647-2") + self.assertEqual(inst.expansion.contains[0].display, "Cholesterol [Moles/volume] in Serum or Plasma") + self.assertEqual(inst.expansion.contains[0].system, "http://loinc.org") + self.assertEqual(inst.expansion.contains[0].version, "2.50") + self.assertTrue(inst.expansion.contains[1].abstract) + self.assertEqual(inst.expansion.contains[1].contains[0].code, "2093-3") + self.assertEqual(inst.expansion.contains[1].contains[0].display, "Cholesterol [Mass/volume] in Serum or Plasma") + self.assertEqual(inst.expansion.contains[1].contains[0].system, "http://loinc.org") + self.assertEqual(inst.expansion.contains[1].contains[0].version, "2.50") + self.assertEqual(inst.expansion.contains[1].contains[1].code, "48620-9") + self.assertEqual(inst.expansion.contains[1].contains[1].display, "Cholesterol [Mass/volume] in Serum or Plasma ultracentrifugate") + self.assertEqual(inst.expansion.contains[1].contains[1].system, "http://loinc.org") + self.assertEqual(inst.expansion.contains[1].contains[1].version, "2.50") + self.assertEqual(inst.expansion.contains[1].contains[2].code, "9342-7") + self.assertEqual(inst.expansion.contains[1].contains[2].display, "Cholesterol [Percentile]") + self.assertEqual(inst.expansion.contains[1].contains[2].system, "http://loinc.org") + self.assertEqual(inst.expansion.contains[1].contains[2].version, "2.50") + self.assertEqual(inst.expansion.contains[1].display, "Cholesterol codes") + self.assertTrue(inst.expansion.contains[2].abstract) + self.assertEqual(inst.expansion.contains[2].contains[0].code, "2096-6") + self.assertEqual(inst.expansion.contains[2].contains[0].display, "Cholesterol/Triglyceride [Mass Ratio] in Serum or Plasma") + self.assertEqual(inst.expansion.contains[2].contains[0].system, "http://loinc.org") + self.assertEqual(inst.expansion.contains[2].contains[0].version, "2.50") + self.assertEqual(inst.expansion.contains[2].contains[1].code, "35200-5") + self.assertEqual(inst.expansion.contains[2].contains[1].display, "Cholesterol/Triglyceride [Mass Ratio] in Serum or Plasma") + self.assertEqual(inst.expansion.contains[2].contains[1].system, "http://loinc.org") + self.assertEqual(inst.expansion.contains[2].contains[1].version, "2.50") + self.assertEqual(inst.expansion.contains[2].contains[2].code, "48089-7") + self.assertEqual(inst.expansion.contains[2].contains[2].display, "Cholesterol/Apolipoprotein B [Molar ratio] in Serum or Plasma") + self.assertEqual(inst.expansion.contains[2].contains[2].system, "http://loinc.org") + self.assertEqual(inst.expansion.contains[2].contains[2].version, "2.50") + self.assertEqual(inst.expansion.contains[2].contains[3].code, "55838-7") + self.assertEqual(inst.expansion.contains[2].contains[3].display, "Cholesterol/Phospholipid [Molar ratio] in Serum or Plasma") + self.assertEqual(inst.expansion.contains[2].contains[3].system, "http://loinc.org") + self.assertEqual(inst.expansion.contains[2].contains[3].version, "2.50") + self.assertEqual(inst.expansion.contains[2].display, "Cholesterol Ratios") + self.assertEqual(inst.expansion.extension[0].url, "http://hl7.org/fhir/StructureDefinition/valueset-expansionSource") + self.assertEqual(inst.expansion.extension[0].valueUri, "http://hl7.org/fhir/ValueSet/example-extensional") + self.assertEqual(inst.expansion.identifier, "urn:uuid:42316ff8-2714-4680-9980-f37a6d1a71bc") + self.assertEqual(inst.expansion.offset, 0) + self.assertEqual(inst.expansion.parameter[0].name, "version") + self.assertEqual(inst.expansion.parameter[0].valueString, "2.50") + self.assertEqual(inst.expansion.timestamp.date, FHIRDate("2015-06-22T13:56:07Z").date) + self.assertEqual(inst.expansion.timestamp.as_json(), "2015-06-22T13:56:07Z") + self.assertEqual(inst.expansion.total, 8) + self.assertTrue(inst.experimental) + self.assertEqual(inst.id, "example-expansion") + 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, "FHIR Project team") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.url, "http://hl7.org/fhir/ValueSet/example-expansion") + self.assertEqual(inst.version, "20150622") + + def testValueSet4(self): + inst = self.instantiate_from("valueset-example-inactive.json") + self.assertIsNotNone(inst, "Must have instantiated a ValueSet instance") + self.implValueSet4(inst) + + js = inst.as_json() + self.assertEqual("ValueSet", js["resourceType"]) + inst2 = valueset.ValueSet(js) + self.implValueSet4(inst2) + + 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://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://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://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://terminology.hl7.org/CodeSystem/v3-ActMood") + self.assertEqual(inst.expansion.contains[1].display, "expectation") + 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://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") + self.assertEqual(inst.id, "inactive") + self.assertEqual(inst.name, "Example-inactive") + self.assertEqual(inst.status, "draft") + 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 testValueSet5(self): + inst = self.instantiate_from("valueset-example-filter.json") + self.assertIsNotNone(inst, "Must have instantiated a ValueSet instance") + self.implValueSet5(inst) + + js = inst.as_json() + self.assertEqual("ValueSet", js["resourceType"]) + inst2 = valueset.ValueSet(js) + self.implValueSet5(inst2) + + def implValueSet5(self, inst): + self.assertEqual(inst.compose.include[0].filter[0].op, "=") + 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.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-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.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 testValueSet6(self): + inst = self.instantiate_from("valueset-example-yesnodontknow.json") + self.assertIsNotNone(inst, "Must have instantiated a ValueSet instance") + self.implValueSet6(inst) + + js = inst.as_json() + self.assertEqual("ValueSet", js["resourceType"]) + inst2 = valueset.ValueSet(js) + self.implValueSet6(inst2) + + 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://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://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://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://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") + self.assertEqual(inst.id, "yesnodontknow") + self.assertEqual(inst.name, "Yes/No/Don't Know") + 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 testValueSet7(self): + inst = self.instantiate_from("valueset-examplescenario-actor-type.json") + self.assertIsNotNone(inst, "Must have instantiated a ValueSet instance") + self.implValueSet7(inst) + + js = inst.as_json() + self.assertEqual("ValueSet", js["resourceType"]) + inst2 = valueset.ValueSet(js) + self.implValueSet7(inst2) + + 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.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, "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/ValueSet/examplescenario-actor-type") + self.assertEqual(inst.version, "4.0.0") + + def testValueSet8(self): + inst = self.instantiate_from("valueset-list-example-codes.json") + self.assertIsNotNone(inst, "Must have instantiated a ValueSet instance") + self.implValueSet8(inst) + + js = inst.as_json() + self.assertEqual("ValueSet", js["resourceType"]) + inst2 = valueset.ValueSet(js) + self.implValueSet8(inst2) + + 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("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.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.316") + 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, "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, "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/R4/verificationresult.py similarity index 99% rename from fhirclient/models/verificationresult.py rename to fhirclient/models/R4/verificationresult.py index 6231f5508..057b2b35c 100644 --- a/fhirclient/models/verificationresult.py +++ b/fhirclient/models/R4/verificationresult.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/VerificationResult) on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/VerificationResult) on 2019-10-12. # 2019, SMART Health IT. diff --git a/fhirclient/models/verificationresult_tests.py b/fhirclient/models/R4/verificationresult_tests.py similarity index 94% rename from fhirclient/models/verificationresult_tests.py rename to fhirclient/models/R4/verificationresult_tests.py index 4e96e66dd..818119ace 100644 --- a/fhirclient/models/verificationresult_tests.py +++ b/fhirclient/models/R4/verificationresult_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. # 2019, SMART Health IT. - +from __future__ import unicode_literals import os import io import unittest diff --git a/fhirclient/models/R4/visionprescription.py b/fhirclient/models/R4/visionprescription.py new file mode 100644 index 000000000..82a555763 --- /dev/null +++ b/fhirclient/models/R4/visionprescription.py @@ -0,0 +1,233 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/VisionPrescription) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class VisionPrescription(domainresource.DomainResource): + """ Prescription for vision correction products for a patient. + + An authorization for the provision of glasses and/or contact lenses to a + patient. + """ + + resource_type = "VisionPrescription" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ 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.encounter = None + """ Created during encounter / admission / stay. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.identifier = None + """ 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` (represented as `dict` in JSON). """ + + self.prescriber = None + """ Who authorized the vision prescription. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.status = None + """ active | cancelled | draft | entered-in-error. + Type `str`. """ + + super(VisionPrescription, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(VisionPrescription, self).elementProperties() + js.extend([ + ("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), + ("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 VisionPrescriptionLensSpecification(backboneelement.BackboneElement): + """ Vision lens authorization. + + Contain the details of the individual lens specifications and serves as + the authorization for the fullfillment by certified professionals. + """ + + resource_type = "VisionPrescriptionLensSpecification" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.add = None + """ Added power for multifocal levels. + Type `float`. """ + + self.axis = None + """ Lens meridian which contain no power for astigmatism. + Type `int`. """ + + self.backCurve = None + """ Contact lens back curvature. + Type `float`. """ + + self.brand = None + """ Brand required. + Type `str`. """ + + self.color = None + """ Color required. + Type `str`. """ + + self.cylinder = None + """ Lens power for astigmatism. + Type `float`. """ + + self.diameter = None + """ Contact lens diameter. + Type `float`. """ + + self.duration = None + """ Lens wear duration. + Type `Quantity` (represented as `dict` in JSON). """ + + self.eye = None + """ right | left. + Type `str`. """ + + self.note = None + """ Notes for coatings. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.power = None + """ Contact lens power. + Type `float`. """ + + self.prism = None + """ 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 + """ Power of the lens. + Type `float`. """ + + super(VisionPrescriptionLensSpecification, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + 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), + ("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, True), + ("note", "note", annotation.Annotation, True, None, False), + ("power", "power", float, 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 +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 quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/R4/visionprescription_tests.py b/fhirclient/models/R4/visionprescription_tests.py new file mode 100644 index 000000000..1c5b1c889 --- /dev/null +++ b/fhirclient/models/R4/visionprescription_tests.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import visionprescription +from .fhirdate import FHIRDate + + +class VisionPrescriptionTests(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("VisionPrescription", js["resourceType"]) + return visionprescription.VisionPrescription(js) + + def testVisionPrescription1(self): + inst = self.instantiate_from("visionprescription-example-1.json") + self.assertIsNotNone(inst, "Must have instantiated a VisionPrescription instance") + self.implVisionPrescription1(inst) + + js = inst.as_json() + self.assertEqual("VisionPrescription", js["resourceType"]) + inst2 = visionprescription.VisionPrescription(js) + 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.id, "33124") + self.assertEqual(inst.identifier[0].system, "http://www.happysight.com/prescription") + self.assertEqual(inst.identifier[0].value, "15014") + 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") + + def testVisionPrescription2(self): + inst = self.instantiate_from("visionprescription-example.json") + self.assertIsNotNone(inst, "Must have instantiated a VisionPrescription instance") + self.implVisionPrescription2(inst) + + js = inst.as_json() + self.assertEqual("VisionPrescription", js["resourceType"]) + inst2 = visionprescription.VisionPrescription(js) + 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.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/models/STU3/__init__.py b/fhirclient/models/STU3/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/fhirclient/models/STU3/account.py b/fhirclient/models/STU3/account.py new file mode 100644 index 000000000..c2d0c622e --- /dev/null +++ b/fhirclient/models/STU3/account.py @@ -0,0 +1,195 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Account) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Account(domainresource.DomainResource): + """ Tracks balance, charges, for patient or cost center. + + A financial tool for tracking value accrued for a particular purpose. In + the healthcare field, used to track charges for a patient, cost centers, + etc. + """ + + resource_type = "Account" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ 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. + List of `AccountCoverage` items (represented as `dict` in JSON). """ + + self.description = None + """ Explanation of purpose/use. + Type `str`. """ + + self.guarantor = None + """ Responsible for the account. + List of `AccountGuarantor` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Account number. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.name = None + """ Human-readable label. + Type `str`. """ + + self.owner = None + """ Who is responsible?. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.period = None + """ Transaction window. + Type `Period` (represented as `dict` in JSON). """ + + self.status = None + """ active | inactive | entered-in-error. + Type `str`. """ + + self.subject = None + """ What is account tied to?. + Type `FHIRReference` referencing `Patient, Device, Practitioner, Location, HealthcareService, Organization` (represented as `dict` in JSON). """ + + self.type = None + """ E.g. patient, expense, depreciation. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(Account, self).__init__(jsondict=jsondict, strict=strict) + + 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), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import backboneelement + +class AccountCoverage(backboneelement.BackboneElement): + """ The party(s) that are responsible for covering the payment of this account, + and what order should they be applied to the account. + """ + + resource_type = "AccountCoverage" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + 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). """ + + self.priority = None + """ The priority of the coverage in the context of this account. + Type `int`. """ + + super(AccountCoverage, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(AccountCoverage, self).elementProperties() + js.extend([ + ("coverage", "coverage", fhirreference.FHIRReference, False, None, True), + ("priority", "priority", int, False, None, False), + ]) + return js + + +class AccountGuarantor(backboneelement.BackboneElement): + """ Responsible for the account. + + Parties financially responsible for the account. + """ + + resource_type = "AccountGuarantor" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.onHold = None + """ Credit or other hold applied. + Type `bool`. """ + + self.party = None + """ Responsible entity. + Type `FHIRReference` referencing `Patient, RelatedPerson, Organization` (represented as `dict` in JSON). """ + + self.period = None + """ Guarrantee account during. + Type `Period` (represented as `dict` in JSON). """ + + super(AccountGuarantor, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(AccountGuarantor, self).elementProperties() + js.extend([ + ("onHold", "onHold", bool, False, None, False), + ("party", "party", fhirreference.FHIRReference, False, None, True), + ("period", "period", period.Period, 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 money +except ImportError: + money = sys.modules[__package__ + '.money'] +try: + from . import period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/STU3/account_tests.py b/fhirclient/models/STU3/account_tests.py new file mode 100644 index 000000000..2cd65c0d0 --- /dev/null +++ b/fhirclient/models/STU3/account_tests.py @@ -0,0 +1,101 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import account +from .fhirdate import FHIRDate + + +class AccountTests(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("Account", js["resourceType"]) + return account.Account(js) + + def testAccount1(self): + inst = self.instantiate_from("account-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Account instance") + self.implAccount1(inst) + + js = inst.as_json() + self.assertEqual("Account", js["resourceType"]) + inst2 = account.Account(js) + 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.description, "Hospital charges") + 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, "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.status, "active") + 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.text, "patient") + + def testAccount2(self): + inst = self.instantiate_from("account-example-with-guarantor.json") + self.assertIsNotNone(inst, "Must have instantiated a Account instance") + self.implAccount2(inst) + + js = inst.as_json() + self.assertEqual("Account", js["resourceType"]) + inst2 = account.Account(js) + 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.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, "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.status, "active") + 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.text, "patient") + diff --git a/fhirclient/models/STU3/activitydefinition.py b/fhirclient/models/STU3/activitydefinition.py new file mode 100644 index 000000000..40f8e6fbb --- /dev/null +++ b/fhirclient/models/STU3/activitydefinition.py @@ -0,0 +1,366 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ActivityDefinition) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class ActivityDefinition(domainresource.DomainResource): + """ The definition of a specific activity to be taken, independent of any + particular patient or context. + + This resource allows for the definition of some activity to be performed, + independent of a particular patient, practitioner, or other performance + context. + """ + + resource_type = "ActivityDefinition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 activity definition was approved by publisher. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.bodySite = None + """ What part of body to perform on. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.code = None + """ Detail type of activity. + 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.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. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Natural language description of the activity definition. + Type `str`. """ + + self.dosage = None + """ Detailed dosage instructions. + List of `Dosage` items (represented as `dict` in JSON). """ + + self.dynamicValue = None + """ Dynamic aspects of the definition. + List of `ActivityDefinitionDynamicValue` 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.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.identifier = None + """ Additional identifier for the activity definition. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ Intended jurisdiction for activity definition (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.kind = None + """ Kind of resource. + Type `str`. """ + + self.lastReviewDate = None + """ When the activity definition was last reviewed. + 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). """ + + self.location = None + """ Where it should happen. + Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + + self.name = None + """ Name for this activity definition (computer friendly). + Type `str`. """ + + self.participant = None + """ Who should participate in the action. + List of `ActivityDefinitionParticipant` items (represented as `dict` in JSON). """ + + 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). """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this activity definition is defined. + Type `str`. """ + + self.quantity = None + """ How much is administered/consumed/supplied. + Type `Quantity` (represented as `dict` in JSON). """ + + self.relatedArtifact = None + """ Additional documentation, citations, etc. + List of `RelatedArtifact` items (represented as `dict` in JSON). """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.timingDateTime = None + """ When activity is to occur. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.timingPeriod = None + """ When activity is to occur. + Type `Period` (represented as `dict` in JSON). """ + + self.timingRange = None + """ When activity is to occur. + Type `Range` (represented as `dict` in JSON). """ + + self.timingTiming = None + """ When activity is to occur. + Type `Timing` (represented as `dict` in JSON). """ + + self.title = None + """ Name for this activity definition (human friendly). + Type `str`. """ + + self.topic = None + """ 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). """ + + self.url = None + """ Logical URI to reference this activity definition (globally unique). + Type `str`. """ + + self.usage = None + """ Describes the clinical usage of the asset. + 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 activity definition. + Type `str`. """ + + super(ActivityDefinition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ActivityDefinition, self).elementProperties() + js.extend([ + ("approvalDate", "approvalDate", fhirdate.FHIRDate, False, 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), + ("dosage", "dosage", dosage.Dosage, True, None, False), + ("dynamicValue", "dynamicValue", ActivityDefinitionDynamicValue, True, None, False), + ("effectivePeriod", "effectivePeriod", period.Period, False, None, False), + ("experimental", "experimental", bool, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, 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), + ("location", "location", fhirreference.FHIRReference, False, None, False), + ("name", "name", str, False, None, False), + ("participant", "participant", ActivityDefinitionParticipant, True, None, False), + ("productCodeableConcept", "productCodeableConcept", codeableconcept.CodeableConcept, False, "product", False), + ("productReference", "productReference", fhirreference.FHIRReference, False, "product", 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), + ("status", "status", str, False, None, True), + ("timingDateTime", "timingDateTime", fhirdate.FHIRDate, 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), + ("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 + + +from . import backboneelement + +class ActivityDefinitionDynamicValue(backboneelement.BackboneElement): + """ Dynamic aspects of the definition. + + Dynamic values that will be evaluated to produce values for elements of the + 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. + """ + + resource_type = "ActivityDefinitionDynamicValue" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 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`. """ + + self.path = None + """ The path to the element to be set dynamically. + Type `str`. """ + + super(ActivityDefinitionDynamicValue, self).__init__(jsondict=jsondict, strict=strict) + + 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), + ]) + return js + + +class ActivityDefinitionParticipant(backboneelement.BackboneElement): + """ Who should participate in the action. + + Indicates who should participate in performing the action described. + """ + + resource_type = "ActivityDefinitionParticipant" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.role = None + """ E.g. Nurse, Surgeon, Parent, etc. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.type = None + """ patient | practitioner | related-person. + Type `str`. """ + + super(ActivityDefinitionParticipant, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ActivityDefinitionParticipant, self).elementProperties() + js.extend([ + ("role", "role", codeableconcept.CodeableConcept, 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 contributor +except ImportError: + contributor = sys.modules[__package__ + '.contributor'] +try: + from . import dosage +except ImportError: + dosage = sys.modules[__package__ + '.dosage'] +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 quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] +try: + from . import range +except ImportError: + range = sys.modules[__package__ + '.range'] +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/STU3/activitydefinition_tests.py b/fhirclient/models/STU3/activitydefinition_tests.py new file mode 100644 index 000000000..0b8a1f67b --- /dev/null +++ b/fhirclient/models/STU3/activitydefinition_tests.py @@ -0,0 +1,394 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import activitydefinition +from .fhirdate import FHIRDate + + +class ActivityDefinitionTests(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("ActivityDefinition", js["resourceType"]) + return activitydefinition.ActivityDefinition(js) + + def testActivityDefinition1(self): + inst = self.instantiate_from("activitydefinition-predecessor-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ActivityDefinition instance") + self.implActivityDefinition1(inst) + + js = inst.as_json() + self.assertEqual("ActivityDefinition", js["resourceType"]) + inst2 = activitydefinition.ActivityDefinition(js) + self.implActivityDefinition1(inst2) + + def implActivityDefinition1(self, inst): + self.assertEqual(inst.approvalDate.date, FHIRDate("2016-03-12").date) + self.assertEqual(inst.approvalDate.as_json(), "2016-03-12") + 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)") + 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") + 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.assertTrue(inst.experimental) + 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("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, "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].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].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].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].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].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].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].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 testActivityDefinition2(self): + inst = self.instantiate_from("activitydefinition-procedurerequest-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ActivityDefinition instance") + self.implActivityDefinition2(inst) + + js = inst.as_json() + self.assertEqual("ActivityDefinition", js["resourceType"]) + inst2 = activitydefinition.ActivityDefinition(js) + self.implActivityDefinition2(inst2) + + def implActivityDefinition2(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].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.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") + self.assertEqual(inst.participant[0].role.text, "Interventional Cardiology") + self.assertEqual(inst.participant[0].type, "practitioner") + self.assertEqual(inst.purpose, "Describes the proposal to perform a Heart Valve replacement.") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.topic[0].coding[0].code, "34068001") + 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].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].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") + + def testActivityDefinition3(self): + inst = self.instantiate_from("activitydefinition-medicationorder-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ActivityDefinition instance") + self.implActivityDefinition3(inst) + + js = inst.as_json() + self.assertEqual("ActivityDefinition", js["resourceType"]) + inst2 = activitydefinition.ActivityDefinition(js) + 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.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") + 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.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].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)") + self.assertEqual(inst.dosage[0].text, "1 tablet oral 1 time daily") + 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].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].path, "dispenseRequest.quantity") + 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.assertTrue(inst.experimental) + self.assertEqual(inst.id, "citalopramPrescription") + self.assertEqual(inst.identifier[0].system, "http://motivemi.com") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "citalopramPrescription") + 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, "MedicationRequest") + self.assertEqual(inst.lastReviewDate.date, FHIRDate("2016-08-15").date) + self.assertEqual(inst.lastReviewDate.as_json(), "2016-08-15") + self.assertEqual(inst.name, "CitalopramPrescription") + self.assertEqual(inst.publisher, "Motive Medical Intelligence") + self.assertEqual(inst.purpose, "Defines a guideline supported prescription for the treatment of depressive disorders") + 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, "composed-of") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "Citalopram Prescription") + self.assertEqual(inst.topic[0].text, "Mental Health Treatment") + 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].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].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].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].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].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].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].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 testActivityDefinition4(self): + inst = self.instantiate_from("activitydefinition-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ActivityDefinition instance") + self.implActivityDefinition4(inst) + + js = inst.as_json() + self.assertEqual("ActivityDefinition", js["resourceType"]) + inst2 = activitydefinition.ActivityDefinition(js) + self.implActivityDefinition4(inst2) + + def implActivityDefinition4(self, inst): + self.assertEqual(inst.approvalDate.date, FHIRDate("2017-03-01").date) + self.assertEqual(inst.approvalDate.as_json(), "2017-03-01") + 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)") + 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") + 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.assertTrue(inst.experimental) + 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("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, "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].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].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].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].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].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].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].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") + + def testActivityDefinition5(self): + inst = self.instantiate_from("activitydefinition-supplyrequest-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ActivityDefinition instance") + self.implActivityDefinition5(inst) + + js = inst.as_json() + self.assertEqual("ActivityDefinition", js["resourceType"]) + inst2 = activitydefinition.ActivityDefinition(js) + self.implActivityDefinition5(inst2) + + def implActivityDefinition5(self, inst): + self.assertEqual(inst.code.coding[0].code, "BlueTubes") + self.assertEqual(inst.code.coding[0].display, "Blood collect tubes blue cap") + 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.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") + diff --git a/fhirclient/models/STU3/address.py b/fhirclient/models/STU3/address.py new file mode 100644 index 000000000..2b19d62a3 --- /dev/null +++ b/fhirclient/models/STU3/address.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Address) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Address(element.Element): + """ An address expressed using postal conventions (as opposed to GPS or other + location definition formats). + + An address expressed using postal conventions (as opposed to GPS or other + location definition formats). This data type may be used to convey + addresses for use in delivering mail as well as for visiting locations + which might not be valid for mail delivery. There are a variety of postal + address formats defined around the world. + """ + + resource_type = "Address" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.city = None + """ Name of city, town etc.. + Type `str`. """ + + self.country = None + """ Country (e.g. can be ISO 3166 2 or 3 letter code). + Type `str`. """ + + self.district = None + """ District name (aka county). + Type `str`. """ + + self.line = None + """ Street name, number, direction & P.O. Box etc.. + List of `str` items. """ + + self.period = None + """ Time period when address was/is in use. + Type `Period` (represented as `dict` in JSON). """ + + self.postalCode = None + """ Postal code for area. + Type `str`. """ + + self.state = None + """ Sub-unit of country (abbreviations ok). + Type `str`. """ + + self.text = None + """ Text representation of the address. + Type `str`. """ + + self.type = None + """ postal | physical | both. + Type `str`. """ + + self.use = None + """ home | work | temp | old - purpose of this address. + Type `str`. """ + + super(Address, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Address, self).elementProperties() + js.extend([ + ("city", "city", str, False, None, False), + ("country", "country", str, False, None, False), + ("district", "district", str, False, None, False), + ("line", "line", str, True, None, False), + ("period", "period", period.Period, False, None, False), + ("postalCode", "postalCode", str, False, None, False), + ("state", "state", str, False, None, False), + ("text", "text", str, False, None, False), + ("type", "type", str, False, None, False), + ("use", "use", str, False, None, False), + ]) + return js + + +import sys +try: + from . import period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/STU3/adverseevent.py b/fhirclient/models/STU3/adverseevent.py new file mode 100644 index 000000000..d0ff5a7dc --- /dev/null +++ b/fhirclient/models/STU3/adverseevent.py @@ -0,0 +1,205 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/AdverseEvent) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class AdverseEvent(domainresource.DomainResource): + """ Medical care, research study or other healthcare event causing physical + injury. + + Actual or potential/avoided event causing unintended physical injury + resulting from or contributed to by medical care, a research study or other + healthcare setting factors that requires additional monitoring, treatment, + or hospitalization, or that results in death. + """ + + resource_type = "AdverseEvent" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ 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. + Type `str`. """ + + 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.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.identifier = None + """ Business identifier for the event. + Type `Identifier` (represented as `dict` in JSON). """ + + self.location = None + """ Location where adverse event occurred. + Type `FHIRReference` referencing `Location` (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.recorder = None + """ Who recorded the adverse event. + Type `FHIRReference` referencing `Patient, Practitioner, RelatedPerson` (represented as `dict` in JSON). """ + + self.referenceDocument = None + """ AdverseEvent.referenceDocument. + List of `FHIRReference` items referencing `DocumentReference` (represented as `dict` in JSON). """ + + self.seriousness = 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). """ + + self.subject = None + """ Subject or group impacted by event. + Type `FHIRReference` referencing `Patient, ResearchSubject, Medication, Device` (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). """ + + 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), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("description", "description", str, False, None, False), + ("eventParticipant", "eventParticipant", fhirreference.FHIRReference, 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), + ("recorder", "recorder", fhirreference.FHIRReference, False, None, False), + ("referenceDocument", "referenceDocument", fhirreference.FHIRReference, True, None, False), + ("seriousness", "seriousness", codeableconcept.CodeableConcept, False, None, False), + ("study", "study", fhirreference.FHIRReference, True, None, False), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ("subjectMedicalHistory", "subjectMedicalHistory", fhirreference.FHIRReference, True, None, False), + ("suspectEntity", "suspectEntity", AdverseEventSuspectEntity, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import backboneelement + +class AdverseEventSuspectEntity(backboneelement.BackboneElement): + """ The suspected agent causing the adverse event. + + Describes the entity that is suspected to have caused the adverse event. + """ + + resource_type = "AdverseEventSuspectEntity" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.causality = None + """ causality1 | causality2. + Type `str`. """ + + self.causalityAssessment = None + """ assess1 | assess2. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.causalityAuthor = None + """ AdverseEvent.suspectEntity.causalityAuthor. + Type `FHIRReference` referencing `Practitioner, PractitionerRole` (represented as `dict` in JSON). """ + + self.causalityMethod = None + """ method1 | method2. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.causalityProductRelatedness = 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) + + def elementProperties(self): + js = super(AdverseEventSuspectEntity, 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), + ]) + 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/STU3/adverseevent_tests.py b/fhirclient/models/STU3/adverseevent_tests.py new file mode 100644 index 000000000..71711f639 --- /dev/null +++ b/fhirclient/models/STU3/adverseevent_tests.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import adverseevent +from .fhirdate import FHIRDate + + +class AdverseEventTests(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("AdverseEvent", js["resourceType"]) + return adverseevent.AdverseEvent(js) + + def testAdverseEvent1(self): + inst = self.instantiate_from("adverseevent-example.json") + self.assertIsNotNone(inst, "Must have instantiated a AdverseEvent instance") + self.implAdverseEvent1(inst) + + js = inst.as_json() + self.assertEqual("AdverseEvent", js["resourceType"]) + inst2 = adverseevent.AdverseEvent(js) + self.implAdverseEvent1(inst2) + + def implAdverseEvent1(self, inst): + self.assertEqual(inst.category, "AE") + 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.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.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/STU3/age.py b/fhirclient/models/STU3/age.py new file mode 100644 index 000000000..e232b2f8d --- /dev/null +++ b/fhirclient/models/STU3/age.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Age) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import quantity + +class Age(quantity.Quantity): + """ A duration of time during which an organism (or a process) has existed. + """ + + resource_type = "Age" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + super(Age, self).__init__(jsondict=jsondict, strict=strict) + + diff --git a/fhirclient/models/STU3/allergyintolerance.py b/fhirclient/models/STU3/allergyintolerance.py new file mode 100644 index 000000000..fc6a56892 --- /dev/null +++ b/fhirclient/models/STU3/allergyintolerance.py @@ -0,0 +1,227 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/AllergyIntolerance) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class AllergyIntolerance(domainresource.DomainResource): + """ Allergy or Intolerance (generally: Risk of adverse reaction to a substance). + + Risk of harmful or undesirable, physiological response which is unique to + an individual and associated with exposure to a substance. + """ + + resource_type = "AllergyIntolerance" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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). """ + + self.category = None + """ food | medication | environment | biologic. + List of `str` items. """ + + self.clinicalStatus = None + """ active | inactive | resolved. + Type `str`. """ + + self.code = None + """ Code that identifies the allergy or intolerance. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.criticality = None + """ low | high | unable-to-assess. + Type `str`. """ + + self.identifier = None + """ External ids for this item. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.lastOccurrence = None + """ Date(/time) of last known occurrence of a reaction. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.note = None + """ Additional text not captured in other fields. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.onsetAge = None + """ When allergy or intolerance was identified. + Type `Age` (represented as `dict` in JSON). """ + + self.onsetDateTime = None + """ When allergy or intolerance was identified. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.onsetPeriod = None + """ When allergy or intolerance was identified. + Type `Period` (represented as `dict` in JSON). """ + + self.onsetRange = None + """ When allergy or intolerance was identified. + Type `Range` (represented as `dict` in JSON). """ + + self.onsetString = None + """ When allergy or intolerance was identified. + Type `str`. """ + + self.patient = None + """ Who the sensitivity is for. + Type `FHIRReference` referencing `Patient` (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.recorder = None + """ Who recorded the sensitivity. + Type `FHIRReference` referencing `Practitioner, Patient` (represented as `dict` in JSON). """ + + self.type = None + """ allergy | intolerance - Underlying mechanism (if known). + Type `str`. """ + + self.verificationStatus = None + """ unconfirmed | confirmed | refuted | entered-in-error. + Type `str`. """ + + 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), + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("criticality", "criticality", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("lastOccurrence", "lastOccurrence", fhirdate.FHIRDate, False, None, False), + ("note", "note", annotation.Annotation, True, None, False), + ("onsetAge", "onsetAge", age.Age, False, "onset", False), + ("onsetDateTime", "onsetDateTime", fhirdate.FHIRDate, False, "onset", False), + ("onsetPeriod", "onsetPeriod", period.Period, False, "onset", False), + ("onsetRange", "onsetRange", range.Range, False, "onset", False), + ("onsetString", "onsetString", str, False, "onset", False), + ("patient", "patient", fhirreference.FHIRReference, False, None, True), + ("reaction", "reaction", AllergyIntoleranceReaction, True, None, False), + ("recorder", "recorder", fhirreference.FHIRReference, False, None, False), + ("type", "type", str, False, None, False), + ("verificationStatus", "verificationStatus", str, False, None, True), + ]) + return js + + +from . import backboneelement + +class AllergyIntoleranceReaction(backboneelement.BackboneElement): + """ Adverse Reaction Events linked to exposure to substance. + + Details about each adverse reaction event linked to exposure to the + identified substance. + """ + + resource_type = "AllergyIntoleranceReaction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 the event as a whole. + Type `str`. """ + + self.exposureRoute = None + """ How the subject was exposed to the substance. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.manifestation = None + """ Clinical symptoms/signs associated with the Event. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.note = None + """ Text about event not captured in other fields. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.onset = None + """ Date(/time) when manifestations showed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.severity = None + """ mild | moderate | severe (of event as a whole). + Type `str`. """ + + self.substance = None + """ Specific substance or pharmaceutical product considered to be + responsible for event. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(AllergyIntoleranceReaction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(AllergyIntoleranceReaction, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, False), + ("exposureRoute", "exposureRoute", codeableconcept.CodeableConcept, False, None, False), + ("manifestation", "manifestation", codeableconcept.CodeableConcept, True, None, True), + ("note", "note", annotation.Annotation, True, None, False), + ("onset", "onset", fhirdate.FHIRDate, False, None, False), + ("severity", "severity", str, False, None, False), + ("substance", "substance", 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: + 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'] +try: + from . import range +except ImportError: + range = sys.modules[__package__ + '.range'] diff --git a/fhirclient/models/STU3/allergyintolerance_tests.py b/fhirclient/models/STU3/allergyintolerance_tests.py new file mode 100644 index 000000000..1202a78cf --- /dev/null +++ b/fhirclient/models/STU3/allergyintolerance_tests.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import allergyintolerance +from .fhirdate import FHIRDate + + +class AllergyIntoleranceTests(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("AllergyIntolerance", js["resourceType"]) + return allergyintolerance.AllergyIntolerance(js) + + def testAllergyIntolerance1(self): + inst = self.instantiate_from("allergyintolerance-example.json") + self.assertIsNotNone(inst, "Must have instantiated a AllergyIntolerance instance") + self.implAllergyIntolerance1(inst) + + js = inst.as_json() + self.assertEqual("AllergyIntolerance", js["resourceType"]) + inst2 = allergyintolerance.AllergyIntolerance(js) + 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.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") + self.assertEqual(inst.criticality, "high") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier[0].system, "http://acme.com/ids/patients/risks") + 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.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") + self.assertEqual(inst.reaction[0].description, "Challenge Protocol. Severe reaction to subcutaneous cashew extract. Epinephrine administered") + self.assertEqual(inst.reaction[0].exposureRoute.coding[0].code, "34206005") + self.assertEqual(inst.reaction[0].exposureRoute.coding[0].display, "Subcutaneous route") + self.assertEqual(inst.reaction[0].exposureRoute.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.reaction[0].manifestation[0].coding[0].code, "39579001") + self.assertEqual(inst.reaction[0].manifestation[0].coding[0].display, "Anaphylactic reaction") + self.assertEqual(inst.reaction[0].manifestation[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.reaction[0].onset.date, FHIRDate("2012-06-12").date) + self.assertEqual(inst.reaction[0].onset.as_json(), "2012-06-12") + self.assertEqual(inst.reaction[0].severity, "severe") + self.assertEqual(inst.reaction[0].substance.coding[0].code, "1160593") + self.assertEqual(inst.reaction[0].substance.coding[0].display, "cashew nut allergenic extract Injectable Product") + self.assertEqual(inst.reaction[0].substance.coding[0].system, "http://www.nlm.nih.gov/research/umls/rxnorm") + self.assertEqual(inst.reaction[1].manifestation[0].coding[0].code, "64305001") + self.assertEqual(inst.reaction[1].manifestation[0].coding[0].display, "Urticaria") + self.assertEqual(inst.reaction[1].manifestation[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.reaction[1].note[0].text, "The patient reports that the onset of urticaria was within 15 minutes of eating cashews.") + 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.text.status, "generated") + self.assertEqual(inst.type, "allergy") + self.assertEqual(inst.verificationStatus, "confirmed") + diff --git a/fhirclient/models/STU3/annotation.py b/fhirclient/models/STU3/annotation.py new file mode 100644 index 000000000..67d2df9f7 --- /dev/null +++ b/fhirclient/models/STU3/annotation.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Annotation) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Annotation(element.Element): + """ Text node with attribution. + + A text note which also contains information about who made the statement + and when. + """ + + resource_type = "Annotation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.authorReference = None + """ Individual responsible for the annotation. + Type `FHIRReference` referencing `Practitioner, Patient, RelatedPerson` (represented as `dict` in JSON). """ + + self.authorString = None + """ Individual responsible for the annotation. + Type `str`. """ + + self.text = None + """ The annotation - text content. + Type `str`. """ + + self.time = None + """ When the annotation was made. + Type `FHIRDate` (represented as `str` in JSON). """ + + super(Annotation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Annotation, self).elementProperties() + js.extend([ + ("authorReference", "authorReference", fhirreference.FHIRReference, False, "author", False), + ("authorString", "authorString", str, False, "author", False), + ("text", "text", str, False, None, True), + ("time", "time", fhirdate.FHIRDate, False, None, False), + ]) + 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'] diff --git a/fhirclient/models/STU3/appointment.py b/fhirclient/models/STU3/appointment.py new file mode 100644 index 000000000..f1156d48e --- /dev/null +++ b/fhirclient/models/STU3/appointment.py @@ -0,0 +1,209 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Appointment) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Appointment(domainresource.DomainResource): + """ A booking of a healthcare event among patient(s), practitioner(s), related + person(s) and/or device(s) for a specific date/time. This may result in one + or more Encounter(s). + """ + + resource_type = "Appointment" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.appointmentType = None + """ The style of appointment or patient that has been booked in the + slot (not service type). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.comment = None + """ Additional comments. + Type `str`. """ + + self.created = None + """ The date that this appointment was initially created. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Shown on a subject line in a meeting request, or appointment list. + Type `str`. """ + + self.end = None + """ When appointment is to conclude. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.identifier = None + """ 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`. """ + + self.participant = None + """ Participants involved in appointment. + List of `AppointmentParticipant` items (represented as `dict` in JSON). """ + + self.priority = None + """ Used to make informed decisions if needing to re-prioritize. + Type `int`. """ + + self.reason = None + """ Reason this appointment is scheduled. + List of `CodeableConcept` 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 + during this appointment. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.serviceType = None + """ The specific service that is to be performed during this + appointment. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.slot = None + """ The slots that this appointment is filling. + List of `FHIRReference` items referencing `Slot` (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. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.start = None + """ When appointment is to take place. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.status = None + """ proposed | pending | booked | arrived | fulfilled | cancelled | + noshow | entered-in-error. + Type `str`. """ + + self.supportingInformation = None + """ Additional information to support the appointment. + List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + + super(Appointment, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Appointment, self).elementProperties() + js.extend([ + ("appointmentType", "appointmentType", 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), + ("priority", "priority", int, False, None, False), + ("reason", "reason", codeableconcept.CodeableConcept, True, None, False), + ("requestedPeriod", "requestedPeriod", period.Period, True, None, False), + ("serviceCategory", "serviceCategory", codeableconcept.CodeableConcept, False, None, False), + ("serviceType", "serviceType", codeableconcept.CodeableConcept, True, None, False), + ("slot", "slot", fhirreference.FHIRReference, True, None, False), + ("specialty", "specialty", codeableconcept.CodeableConcept, True, None, False), + ("start", "start", fhirdate.FHIRDate, False, None, False), + ("status", "status", str, False, None, True), + ("supportingInformation", "supportingInformation", fhirreference.FHIRReference, True, None, False), + ]) + return js + + +from . import backboneelement + +class AppointmentParticipant(backboneelement.BackboneElement): + """ Participants involved in appointment. + + List of participants involved in the appointment. + """ + + resource_type = "AppointmentParticipant" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Person, Location/HealthcareService or Device. + Type `FHIRReference` referencing `Patient, Practitioner, RelatedPerson, Device, HealthcareService, Location` (represented as `dict` in JSON). """ + + self.required = None + """ required | optional | information-only. + Type `str`. """ + + self.status = None + """ accepted | declined | tentative | needs-action. + Type `str`. """ + + self.type = None + """ Role of participant in the appointment. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(AppointmentParticipant, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(AppointmentParticipant, self).elementProperties() + js.extend([ + ("actor", "actor", fhirreference.FHIRReference, False, None, False), + ("required", "required", str, False, None, False), + ("status", "status", str, False, None, True), + ("type", "type", codeableconcept.CodeableConcept, True, 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/STU3/appointment_tests.py b/fhirclient/models/STU3/appointment_tests.py new file mode 100644 index 000000000..fa3ef923a --- /dev/null +++ b/fhirclient/models/STU3/appointment_tests.py @@ -0,0 +1,157 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import appointment +from .fhirdate import FHIRDate + + +class AppointmentTests(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("Appointment", js["resourceType"]) + return appointment.Appointment(js) + + def testAppointment1(self): + inst = self.instantiate_from("appointment-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Appointment instance") + self.implAppointment1(inst) + + js = inst.as_json() + self.assertEqual("Appointment", js["resourceType"]) + inst2 = appointment.Appointment(js) + self.implAppointment1(inst2) + + def implAppointment1(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.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.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.participant[0].required, "required") + self.assertEqual(inst.participant[0].status, "accepted") + self.assertEqual(inst.participant[1].required, "required") + 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[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.text.div, "
Brian MRI results discussion
") + self.assertEqual(inst.text.status, "generated") + + def testAppointment2(self): + inst = self.instantiate_from("appointment-example-request.json") + self.assertIsNotNone(inst, "Must have instantiated a Appointment instance") + self.implAppointment2(inst) + + js = inst.as_json() + self.assertEqual("Appointment", js["resourceType"]) + inst2 = appointment.Appointment(js) + self.implAppointment2(inst2) + + def implAppointment2(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.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.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.participant[0].required, "required") + self.assertEqual(inst.participant[0].status, "needs-action") + self.assertEqual(inst.participant[1].required, "required") + 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[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.text.div, "
Brian MRI results discussion
") + self.assertEqual(inst.text.status, "generated") + + def testAppointment3(self): + inst = self.instantiate_from("appointment-example2doctors.json") + self.assertIsNotNone(inst, "Must have instantiated a Appointment instance") + self.implAppointment3(inst) + + js = inst.as_json() + self.assertEqual("Appointment", js["resourceType"]) + inst2 = appointment.Appointment(js) + 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.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.participant[0].required, "information-only") + self.assertEqual(inst.participant[0].status, "accepted") + self.assertEqual(inst.participant[1].required, "required") + self.assertEqual(inst.participant[1].status, "accepted") + self.assertEqual(inst.participant[2].required, "required") + self.assertEqual(inst.participant[2].status, "accepted") + 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.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-09T09:00:00Z").date) + self.assertEqual(inst.start.as_json(), "2013-12-09T09:00:00Z") + self.assertEqual(inst.status, "booked") + self.assertEqual(inst.text.div, "
Brian MRI results discussion
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/STU3/appointmentresponse.py b/fhirclient/models/STU3/appointmentresponse.py new file mode 100644 index 000000000..07b0b8e16 --- /dev/null +++ b/fhirclient/models/STU3/appointmentresponse.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/AppointmentResponse) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class AppointmentResponse(domainresource.DomainResource): + """ A reply to an appointment request for a patient and/or practitioner(s), + such as a confirmation or rejection. + """ + + resource_type = "AppointmentResponse" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Person, Location/HealthcareService or Device. + Type `FHIRReference` referencing `Patient, Practitioner, RelatedPerson, Device, HealthcareService, Location` (represented as `dict` in JSON). """ + + self.appointment = None + """ Appointment this response relates to. + Type `FHIRReference` referencing `Appointment` (represented as `dict` in JSON). """ + + self.comment = None + """ Additional comments. + Type `str`. """ + + self.end = None + """ Time from appointment, or requested new end time. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.identifier = None + """ External Ids for this item. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.participantStatus = None + """ accepted | declined | tentative | in-process | completed | needs- + action | entered-in-error. + Type `str`. """ + + self.participantType = None + """ Role of participant in the appointment. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.start = None + """ Time from appointment, or requested new start time. + Type `FHIRDate` (represented as `str` in JSON). """ + + super(AppointmentResponse, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(AppointmentResponse, self).elementProperties() + js.extend([ + ("actor", "actor", fhirreference.FHIRReference, False, None, False), + ("appointment", "appointment", fhirreference.FHIRReference, False, None, True), + ("comment", "comment", str, False, None, False), + ("end", "end", fhirdate.FHIRDate, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("participantStatus", "participantStatus", str, False, None, True), + ("participantType", "participantType", codeableconcept.CodeableConcept, True, None, False), + ("start", "start", fhirdate.FHIRDate, 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/STU3/appointmentresponse_tests.py b/fhirclient/models/STU3/appointmentresponse_tests.py new file mode 100644 index 000000000..7cce66a73 --- /dev/null +++ b/fhirclient/models/STU3/appointmentresponse_tests.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import appointmentresponse +from .fhirdate import FHIRDate + + +class AppointmentResponseTests(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("AppointmentResponse", js["resourceType"]) + return appointmentresponse.AppointmentResponse(js) + + def testAppointmentResponse1(self): + inst = self.instantiate_from("appointmentresponse-example-req.json") + self.assertIsNotNone(inst, "Must have instantiated a AppointmentResponse instance") + self.implAppointmentResponse1(inst) + + js = inst.as_json() + self.assertEqual("AppointmentResponse", js["resourceType"]) + inst2 = appointmentresponse.AppointmentResponse(js) + self.implAppointmentResponse1(inst2) + + def implAppointmentResponse1(self, inst): + self.assertEqual(inst.comment, "can't we try for this time, can't do mornings") + self.assertEqual(inst.end.date, FHIRDate("2013-12-25T13:30:00Z").date) + self.assertEqual(inst.end.as_json(), "2013-12-25T13:30:00Z") + 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.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.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
") + self.assertEqual(inst.text.status, "generated") + + def testAppointmentResponse2(self): + inst = self.instantiate_from("appointmentresponse-example.json") + self.assertIsNotNone(inst, "Must have instantiated a AppointmentResponse instance") + self.implAppointmentResponse2(inst) + + js = inst.as_json() + self.assertEqual("AppointmentResponse", js["resourceType"]) + inst2 = appointmentresponse.AppointmentResponse(js) + self.implAppointmentResponse2(inst2) + + def implAppointmentResponse2(self, inst): + self.assertEqual(inst.id, "example") + 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/STU3/attachment.py b/fhirclient/models/STU3/attachment.py new file mode 100644 index 000000000..aba8a282f --- /dev/null +++ b/fhirclient/models/STU3/attachment.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Attachment) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Attachment(element.Element): + """ Content in a format defined elsewhere. + + For referring to data content defined in other formats. + """ + + resource_type = "Attachment" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.contentType = None + """ Mime type of the content, with charset etc.. + Type `str`. """ + + self.creation = None + """ Date attachment was first created. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.data = None + """ Data inline, base64ed. + Type `str`. """ + + self.hash = None + """ Hash of the data (sha-1, base64ed). + Type `str`. """ + + self.language = None + """ Human language of the content (BCP-47). + Type `str`. """ + + self.size = None + """ Number of bytes of content (if url provided). + Type `int`. """ + + self.title = None + """ Label to display in place of the data. + Type `str`. """ + + self.url = None + """ Uri where the data can be found. + Type `str`. """ + + super(Attachment, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Attachment, self).elementProperties() + js.extend([ + ("contentType", "contentType", str, False, None, False), + ("creation", "creation", fhirdate.FHIRDate, False, None, False), + ("data", "data", str, False, None, False), + ("hash", "hash", str, False, None, False), + ("language", "language", str, False, None, False), + ("size", "size", int, False, None, False), + ("title", "title", str, False, None, False), + ("url", "url", str, False, None, False), + ]) + return js + + +import sys +try: + from . import fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] diff --git a/fhirclient/models/STU3/auditevent.py b/fhirclient/models/STU3/auditevent.py new file mode 100644 index 000000000..c060261d6 --- /dev/null +++ b/fhirclient/models/STU3/auditevent.py @@ -0,0 +1,375 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/AuditEvent) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class AuditEvent(domainresource.DomainResource): + """ Event record kept for security purposes. + + A record of an event made for purposes of maintaining a security log. + Typical uses include detection of intrusion attempts and monitoring for + inappropriate usage. + """ + + resource_type = "AuditEvent" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Type of action performed during the event. + Type `str`. """ + + self.agent = None + """ Actor involved in the event. + List of `AuditEventAgent` items (represented as `dict` in JSON). """ + + self.entity = None + """ Data or objects used. + List of `AuditEventEntity` items (represented as `dict` in JSON). """ + + self.outcome = None + """ Whether the event succeeded or failed. + Type `str`. """ + + self.outcomeDesc = None + """ Description of the event outcome. + Type `str`. """ + + 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. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.source = None + """ Audit Event Reporter. + Type `AuditEventSource` (represented as `dict` in JSON). """ + + self.subtype = None + """ More specific type/id for the event. + List of `Coding` items (represented as `dict` in JSON). """ + + self.type = None + """ Type/identifier of event. + Type `Coding` (represented as `dict` in JSON). """ + + super(AuditEvent, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(AuditEvent, self).elementProperties() + js.extend([ + ("action", "action", str, False, None, False), + ("agent", "agent", AuditEventAgent, True, None, True), + ("entity", "entity", AuditEventEntity, True, None, False), + ("outcome", "outcome", str, False, None, False), + ("outcomeDesc", "outcomeDesc", str, False, None, False), + ("purposeOfEvent", "purposeOfEvent", codeableconcept.CodeableConcept, True, None, False), + ("recorded", "recorded", fhirdate.FHIRDate, False, None, True), + ("source", "source", AuditEventSource, False, None, True), + ("subtype", "subtype", coding.Coding, True, None, False), + ("type", "type", coding.Coding, False, None, True), + ]) + return js + + +from . import backboneelement + +class AuditEventAgent(backboneelement.BackboneElement): + """ Actor involved in the event. + + An actor taking an active role in the event or activity that is logged. + """ + + resource_type = "AuditEventAgent" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.altId = None + """ Alternative User id e.g. authentication. + Type `str`. """ + + self.location = None + """ Where. + Type `FHIRReference` referencing `Location` (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. + Type `str`. """ + + self.network = None + """ Logical network location for application activity. + Type `AuditEventAgentNetwork` (represented as `dict` in JSON). """ + + self.policy = None + """ Policy that authorized event. + List of `str` items. """ + + self.purposeOfUse = None + """ 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`. """ + + self.role = None + """ 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). """ + + super(AuditEventAgent, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(AuditEventAgent, self).elementProperties() + js.extend([ + ("altId", "altId", str, False, None, False), + ("location", "location", fhirreference.FHIRReference, False, None, False), + ("media", "media", coding.Coding, False, None, False), + ("name", "name", str, False, None, False), + ("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), + ]) + return js + + +class AuditEventAgentNetwork(backboneelement.BackboneElement): + """ Logical network location for application activity. + + Logical network location for application activity, if the activity has a + network location. + """ + + resource_type = "AuditEventAgentNetwork" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Identifier for the network access point of the user device. + Type `str`. """ + + self.type = None + """ The type of network access point. + Type `str`. """ + + super(AuditEventAgentNetwork, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(AuditEventAgentNetwork, self).elementProperties() + js.extend([ + ("address", "address", str, False, None, False), + ("type", "type", str, False, None, False), + ]) + return js + + +class AuditEventEntity(backboneelement.BackboneElement): + """ Data or objects used. + + Specific instances of data or objects that have been accessed. + """ + + resource_type = "AuditEventEntity" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Descriptive text. + Type `str`. """ + + self.detail = None + """ 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). """ + + self.name = None + """ Descriptor for entity. + Type `str`. """ + + self.query = None + """ 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). """ + + self.securityLabel = None + """ Security labels on the entity. + List of `Coding` items (represented as `dict` in JSON). """ + + self.type = None + """ Type of entity involved. + Type `Coding` (represented as `dict` in JSON). """ + + super(AuditEventEntity, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(AuditEventEntity, self).elementProperties() + 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), + ]) + return js + + +class AuditEventEntityDetail(backboneelement.BackboneElement): + """ Additional Information about the entity. + + Tagged value pairs for conveying additional information about the entity. + """ + + resource_type = "AuditEventEntityDetail" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Name of the property. + Type `str`. """ + + self.value = None + """ Property value. + Type `str`. """ + + super(AuditEventEntityDetail, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(AuditEventEntityDetail, self).elementProperties() + js.extend([ + ("type", "type", str, False, None, True), + ("value", "value", str, False, None, True), + ]) + return js + + +class AuditEventSource(backboneelement.BackboneElement): + """ Audit Event Reporter. + + The system that is reporting the event. + """ + + resource_type = "AuditEventSource" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 identity of source detecting the event. + Type `Identifier` (represented as `dict` in JSON). """ + + self.site = None + """ Logical source location within the enterprise. + Type `str`. """ + + self.type = None + """ The type of source where event originated. + List of `Coding` items (represented as `dict` in JSON). """ + + super(AuditEventSource, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(AuditEventSource, self).elementProperties() + js.extend([ + ("identifier", "identifier", identifier.Identifier, False, None, True), + ("site", "site", str, False, None, False), + ("type", "type", coding.Coding, True, 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'] diff --git a/fhirclient/models/STU3/auditevent_tests.py b/fhirclient/models/STU3/auditevent_tests.py new file mode 100644 index 000000000..74b79da34 --- /dev/null +++ b/fhirclient/models/STU3/auditevent_tests.py @@ -0,0 +1,452 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import auditevent +from .fhirdate import FHIRDate + + +class AuditEventTests(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("AuditEvent", js["resourceType"]) + return auditevent.AuditEvent(js) + + def testAuditEvent1(self): + inst = self.instantiate_from("audit-event-example-search.json") + self.assertIsNotNone(inst, "Must have instantiated a AuditEvent instance") + self.implAuditEvent1(inst) + + js = inst.as_json() + self.assertEqual("AuditEvent", js["resourceType"]) + inst2 = auditevent.AuditEvent(js) + self.implAuditEvent1(inst2) + + 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.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 testAuditEvent2(self): + inst = self.instantiate_from("audit-event-example-logout.json") + self.assertIsNotNone(inst, "Must have instantiated a AuditEvent instance") + self.implAuditEvent2(inst) + + js = inst.as_json() + self.assertEqual("AuditEvent", js["resourceType"]) + inst2 = auditevent.AuditEvent(js) + self.implAuditEvent2(inst2) + + def implAuditEvent2(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[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-logout") + 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.subtype[0].code, "110123") + self.assertEqual(inst.subtype[0].display, "Logout") + 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 testAuditEvent3(self): + inst = self.instantiate_from("audit-event-example-vread.json") + self.assertIsNotNone(inst, "Must have instantiated a AuditEvent instance") + self.implAuditEvent3(inst) + + js = inst.as_json() + self.assertEqual("AuditEvent", js["resourceType"]) + inst2 = auditevent.AuditEvent(js) + 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].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].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.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.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 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[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[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.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].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[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].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[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.id, "example-media") + 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") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.code, "110106") + self.assertEqual(inst.type.display, "Export") + self.assertEqual(inst.type.system, "http://dicom.nema.org/resources/ontology/DCM") + + 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].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.id, "example-login") + 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.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.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.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, "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[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.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].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].detail[0].type, "MSH-10") + self.assertEqual(inst.entity[1].detail[0].value, "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].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.id, "example-pixQuery") + 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") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.code, "110112") + self.assertEqual(inst.type.display, "Query") + self.assertEqual(inst.type.system, "http://dicom.nema.org/resources/ontology/DCM") + + def testAuditEvent7(self): + inst = self.instantiate_from("auditevent-example.json") + self.assertIsNotNone(inst, "Must have instantiated a AuditEvent instance") + self.implAuditEvent7(inst) + + js = inst.as_json() + self.assertEqual("AuditEvent", js["resourceType"]) + inst2 = auditevent.AuditEvent(js) + self.implAuditEvent7(inst2) + + def implAuditEvent7(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") + 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.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") + + def testAuditEvent8(self): + inst = self.instantiate_from("auditevent-example-disclosure.json") + self.assertIsNotNone(inst, "Must have instantiated a AuditEvent instance") + self.implAuditEvent8(inst) + + js = inst.as_json() + self.assertEqual("AuditEvent", js["resourceType"]) + inst2 = auditevent.AuditEvent(js) + self.implAuditEvent8(inst2) + + 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") + self.assertEqual(inst.agent[0].network.address, "custodian.net") + 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[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.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.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].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].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].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].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[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[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].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.id, "example-disclosure") + 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.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.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.
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.code, "110106") + self.assertEqual(inst.type.display, "Export") + self.assertEqual(inst.type.system, "http://dicom.nema.org/resources/ontology/DCM") + diff --git a/fhirclient/models/STU3/backboneelement.py b/fhirclient/models/STU3/backboneelement.py new file mode 100644 index 000000000..ee5e7e79b --- /dev/null +++ b/fhirclient/models/STU3/backboneelement.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/BackboneElement) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class BackboneElement(element.Element): + """ Base for elements defined inside a resource. + + Base definition for all elements that are defined inside a resource - but + not those in a data type. + """ + + resource_type = "BackboneElement" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.modifierExtension = None + """ Extensions that cannot be ignored. + List of `Extension` items (represented as `dict` in JSON). """ + + super(BackboneElement, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(BackboneElement, self).elementProperties() + js.extend([ + ("modifierExtension", "modifierExtension", extension.Extension, True, None, False), + ]) + return js + + +import sys +try: + from . import extension +except ImportError: + extension = sys.modules[__package__ + '.extension'] diff --git a/fhirclient/models/STU3/basic.py b/fhirclient/models/STU3/basic.py new file mode 100644 index 000000000..5f1eb9f47 --- /dev/null +++ b/fhirclient/models/STU3/basic.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Basic) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Basic(domainresource.DomainResource): + """ Resource for non-supported content. + + Basic is used for handling concepts not yet defined in FHIR, narrative-only + resources that don't map to an existing resource, and custom resources not + appropriate for inclusion in the FHIR specification. + """ + + resource_type = "Basic" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Who created. + Type `FHIRReference` referencing `Practitioner, Patient, RelatedPerson` (represented as `dict` in JSON). """ + + self.code = None + """ Kind of Resource. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.created = None + """ When created. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.identifier = None + """ Business identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.subject = None + """ Identifies the focus of this resource. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + super(Basic, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Basic, self).elementProperties() + js.extend([ + ("author", "author", fhirreference.FHIRReference, False, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("created", "created", fhirdate.FHIRDate, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("subject", "subject", fhirreference.FHIRReference, 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/STU3/basic_tests.py b/fhirclient/models/STU3/basic_tests.py new file mode 100644 index 000000000..55c46d197 --- /dev/null +++ b/fhirclient/models/STU3/basic_tests.py @@ -0,0 +1,106 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import basic +from .fhirdate import FHIRDate + + +class BasicTests(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("Basic", js["resourceType"]) + return basic.Basic(js) + + def testBasic1(self): + inst = self.instantiate_from("basic-example2.json") + self.assertIsNotNone(inst, "Must have instantiated a Basic instance") + self.implBasic1(inst) + + js = inst.as_json() + self.assertEqual("Basic", js["resourceType"]) + inst2 = basic.Basic(js) + self.implBasic1(inst2) + + def implBasic1(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") + + def testBasic2(self): + inst = self.instantiate_from("basic-example-narrative.json") + self.assertIsNotNone(inst, "Must have instantiated a Basic instance") + self.implBasic2(inst) + + js = inst.as_json() + self.assertEqual("Basic", js["resourceType"]) + inst2 = basic.Basic(js) + 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.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.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") + self.assertEqual(inst.extension[1].url, "http://example.org/do-not-use/fhir-extensions/referral#notes") + self.assertEqual(inst.extension[1].valueString, "The patient had fever peaks over the last couple of days. He is worried about these peaks.") + self.assertEqual(inst.extension[2].url, "http://example.org/do-not-use/fhir-extensions/referral#fulfillingEncounter") + 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.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") + self.assertEqual(inst.modifierExtension[0].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.modifierExtension[1].url, "http://example.org/do-not-use/fhir-extensions/referral#targetDate") + self.assertEqual(inst.modifierExtension[1].valuePeriod.end.date, FHIRDate("2013-04-15").date) + self.assertEqual(inst.modifierExtension[1].valuePeriod.end.as_json(), "2013-04-15") + self.assertEqual(inst.modifierExtension[1].valuePeriod.start.date, FHIRDate("2013-04-01").date) + self.assertEqual(inst.modifierExtension[1].valuePeriod.start.as_json(), "2013-04-01") + 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") + diff --git a/fhirclient/models/STU3/binary.py b/fhirclient/models/STU3/binary.py new file mode 100644 index 000000000..cfe944375 --- /dev/null +++ b/fhirclient/models/STU3/binary.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Binary) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import resource + +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. + """ + + resource_type = "Binary" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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.securityContext = None + """ Access Control Management. + Type `FHIRReference` referencing `Resource` (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), + ("securityContext", "securityContext", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +import sys +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] diff --git a/fhirclient/models/STU3/binary_tests.py b/fhirclient/models/STU3/binary_tests.py new file mode 100644 index 000000000..3be4a0392 --- /dev/null +++ b/fhirclient/models/STU3/binary_tests.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import binary +from .fhirdate import FHIRDate + + +class BinaryTests(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("Binary", js["resourceType"]) + return binary.Binary(js) + + def testBinary1(self): + inst = self.instantiate_from("binary-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Binary instance") + self.implBinary1(inst) + + js = inst.as_json() + self.assertEqual("Binary", js["resourceType"]) + inst2 = binary.Binary(js) + self.implBinary1(inst2) + + def implBinary1(self, inst): + self.assertEqual(inst.contentType, "application/pdf") + self.assertEqual(inst.id, "example") + diff --git a/fhirclient/models/STU3/bodysite.py b/fhirclient/models/STU3/bodysite.py new file mode 100644 index 000000000..8e6505241 --- /dev/null +++ b/fhirclient/models/STU3/bodysite.py @@ -0,0 +1,88 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/BodySite) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class BodySite(domainresource.DomainResource): + """ Specific and identified anatomical location. + + 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. + """ + + resource_type = "BodySite" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 body site 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. + Type `str`. """ + + self.identifier = None + """ Bodysite 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.qualifier = None + """ Modification to location code. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(BodySite, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(BodySite, 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), + ("patient", "patient", fhirreference.FHIRReference, False, None, True), + ("qualifier", "qualifier", codeableconcept.CodeableConcept, True, 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 fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] diff --git a/fhirclient/models/STU3/bodysite_tests.py b/fhirclient/models/STU3/bodysite_tests.py new file mode 100644 index 000000000..d6638af5a --- /dev/null +++ b/fhirclient/models/STU3/bodysite_tests.py @@ -0,0 +1,93 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +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-tumor.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.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") + + def testBodySite3(self): + inst = self.instantiate_from("bodysite-example-skin-patch.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.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") + diff --git a/fhirclient/models/STU3/bundle.py b/fhirclient/models/STU3/bundle.py new file mode 100644 index 000000000..d007e24dc --- /dev/null +++ b/fhirclient/models/STU3/bundle.py @@ -0,0 +1,315 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Bundle) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import resource + +class Bundle(resource.Resource): + """ Contains a collection of resources. + + A container for a collection of resources. + """ + + resource_type = "Bundle" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.entry = None + """ Entry in the bundle - will have a resource, or information. + List of `BundleEntry` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Persistent identifier for the bundle. + Type `Identifier` (represented as `dict` in JSON). """ + + self.link = None + """ Links related to this Bundle. + List of `BundleLink` items (represented as `dict` in JSON). """ + + self.signature = None + """ Digital Signature. + Type `Signature` (represented as `dict` in JSON). """ + + self.total = None + """ If search, the total number of matches. + Type `int`. """ + + self.type = None + """ document | message | transaction | transaction-response | batch | + batch-response | history | searchset | collection. + Type `str`. """ + + super(Bundle, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Bundle, self).elementProperties() + js.extend([ + ("entry", "entry", BundleEntry, True, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("link", "link", BundleLink, True, None, False), + ("signature", "signature", signature.Signature, False, None, False), + ("total", "total", int, False, None, False), + ("type", "type", str, False, None, True), + ]) + return js + + +from . import backboneelement + +class BundleEntry(backboneelement.BackboneElement): + """ Entry in the bundle - will have a resource, or information. + + An entry in a bundle resource - will either contain a resource, or + information about a resource (transactions and history only). + """ + + resource_type = "BundleEntry" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.fullUrl = None + """ Absolute URL for resource (server address, or UUID/OID). + Type `str`. """ + + self.link = None + """ Links related to this entry. + List of `BundleLink` items (represented as `dict` in JSON). """ + + self.request = None + """ Transaction Related Information. + Type `BundleEntryRequest` (represented as `dict` in JSON). """ + + self.resource = None + """ A resource in the bundle. + Type `Resource` (represented as `dict` in JSON). """ + + self.response = None + """ Transaction Related Information. + Type `BundleEntryResponse` (represented as `dict` in JSON). """ + + self.search = None + """ Search related information. + Type `BundleEntrySearch` (represented as `dict` in JSON). """ + + super(BundleEntry, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(BundleEntry, self).elementProperties() + js.extend([ + ("fullUrl", "fullUrl", str, False, None, False), + ("link", "link", BundleLink, True, None, False), + ("request", "request", BundleEntryRequest, False, None, False), + ("resource", "resource", resource.Resource, False, None, False), + ("response", "response", BundleEntryResponse, False, None, False), + ("search", "search", BundleEntrySearch, False, None, False), + ]) + return js + + +class BundleEntryRequest(backboneelement.BackboneElement): + """ Transaction Related Information. + + Additional information about how this entry should be processed as part of + a transaction. + """ + + resource_type = "BundleEntryRequest" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.ifMatch = None + """ For managing update contention. + Type `str`. """ + + self.ifModifiedSince = None + """ For managing update contention. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.ifNoneExist = None + """ For conditional creates. + Type `str`. """ + + self.ifNoneMatch = None + """ For managing cache currency. + Type `str`. """ + + self.method = None + """ GET | POST | PUT | DELETE. + Type `str`. """ + + self.url = None + """ URL for HTTP equivalent of this entry. + Type `str`. """ + + super(BundleEntryRequest, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(BundleEntryRequest, self).elementProperties() + js.extend([ + ("ifMatch", "ifMatch", str, False, None, False), + ("ifModifiedSince", "ifModifiedSince", fhirdate.FHIRDate, False, None, False), + ("ifNoneExist", "ifNoneExist", str, False, None, False), + ("ifNoneMatch", "ifNoneMatch", str, False, None, False), + ("method", "method", str, False, None, True), + ("url", "url", str, False, None, True), + ]) + return js + + +class BundleEntryResponse(backboneelement.BackboneElement): + """ Transaction Related Information. + + Additional information about how this entry should be processed as part of + a transaction. + """ + + resource_type = "BundleEntryResponse" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.etag = None + """ The etag for the resource (if relevant). + Type `str`. """ + + self.lastModified = None + """ Server's date time modified. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.location = None + """ The location, if the operation returns a location. + Type `str`. """ + + self.outcome = None + """ OperationOutcome with hints and warnings (for batch/transaction). + Type `Resource` (represented as `dict` in JSON). """ + + self.status = None + """ Status response code (text optional). + Type `str`. """ + + super(BundleEntryResponse, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(BundleEntryResponse, self).elementProperties() + js.extend([ + ("etag", "etag", str, False, None, False), + ("lastModified", "lastModified", fhirdate.FHIRDate, False, None, False), + ("location", "location", str, False, None, False), + ("outcome", "outcome", resource.Resource, False, None, False), + ("status", "status", str, False, None, True), + ]) + return js + + +class BundleEntrySearch(backboneelement.BackboneElement): + """ Search related information. + + Information about the search process that lead to the creation of this + entry. + """ + + resource_type = "BundleEntrySearch" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ match | include | outcome - why this is in the result set. + Type `str`. """ + + self.score = None + """ Search ranking (between 0 and 1). + Type `float`. """ + + super(BundleEntrySearch, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(BundleEntrySearch, self).elementProperties() + js.extend([ + ("mode", "mode", str, False, None, False), + ("score", "score", float, False, None, False), + ]) + return js + + +class BundleLink(backboneelement.BackboneElement): + """ Links related to this Bundle. + + A series of links that provide context to this bundle. + """ + + resource_type = "BundleLink" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.relation = None + """ See http://www.iana.org/assignments/link-relations/link- + relations.xhtml#link-relations-1. + Type `str`. """ + + self.url = None + """ Reference details for the link. + Type `str`. """ + + super(BundleLink, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(BundleLink, self).elementProperties() + js.extend([ + ("relation", "relation", str, False, None, True), + ("url", "url", str, False, None, True), + ]) + return js + + +import sys +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 signature +except ImportError: + signature = sys.modules[__package__ + '.signature'] diff --git a/fhirclient/models/STU3/bundle_tests.py b/fhirclient/models/STU3/bundle_tests.py new file mode 100644 index 000000000..0c274ea42 --- /dev/null +++ b/fhirclient/models/STU3/bundle_tests.py @@ -0,0 +1,450 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import bundle +from .fhirdate import FHIRDate + + +class BundleTests(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("Bundle", js["resourceType"]) + return bundle.Bundle(js) + + def testBundle1(self): + inst = self.instantiate_from("xds-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Bundle instance") + self.implBundle1(inst) + + js = inst.as_json() + self.assertEqual("Bundle", js["resourceType"]) + inst2 = bundle.Bundle(js) + self.implBundle1(inst2) + + def implBundle1(self, inst): + 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, "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, "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, "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, "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, "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.type, "transaction") + + def testBundle2(self): + inst = self.instantiate_from("practitioner-examples-general.json") + self.assertIsNotNone(inst, "Must have instantiated a Bundle instance") + self.implBundle2(inst) + + js = inst.as_json() + self.assertEqual("Bundle", js["resourceType"]) + inst2 = bundle.Bundle(js) + self.implBundle2(inst2) + + def implBundle2(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") + self.assertEqual(inst.entry[1].resource.id, "13") + 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/Practitioner/14") + self.assertEqual(inst.entry[2].resource.id, "14") + 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/Practitioner/15") + self.assertEqual(inst.entry[3].resource.id, "15") + 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/Practitioner/16") + self.assertEqual(inst.entry[4].resource.id, "16") + 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/Practitioner/17") + self.assertEqual(inst.entry[5].resource.id, "17") + 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/Practitioner/18") + self.assertEqual(inst.entry[6].resource.id, "18") + 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/Practitioner/19") + self.assertEqual(inst.entry[7].resource.id, "19") + 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/Practitioner/20") + self.assertEqual(inst.entry[8].resource.id, "20") + 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/Practitioner/21") + self.assertEqual(inst.entry[9].resource.id, "21") + 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, "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.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].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, "Sequence") + 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, "Sequence") + 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, "Sequence") + 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, "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.type, "transaction") + + def testBundle4(self): + inst = self.instantiate_from("practitionerrole-examples-general.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://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") + self.assertEqual(inst.entry[1].resource.id, "example-0") + self.assertEqual(inst.entry[2].fullUrl, "http://hl7.org/fhir/PractitionerRole/example-1") + self.assertEqual(inst.entry[2].resource.id, "example-1") + self.assertEqual(inst.entry[3].fullUrl, "http://hl7.org/fhir/PractitionerRole/example-2") + self.assertEqual(inst.entry[3].resource.id, "example-2") + self.assertEqual(inst.entry[4].fullUrl, "http://hl7.org/fhir/PractitionerRole/f007-0") + self.assertEqual(inst.entry[4].resource.id, "f007-0") + self.assertEqual(inst.entry[5].fullUrl, "http://hl7.org/fhir/PractitionerRole/f004-0") + self.assertEqual(inst.entry[5].resource.id, "f004-0") + self.assertEqual(inst.entry[6].fullUrl, "http://hl7.org/fhir/PractitionerRole/xcda1-0") + self.assertEqual(inst.entry[6].resource.id, "xcda1-0") + self.assertEqual(inst.entry[7].fullUrl, "http://hl7.org/fhir/PractitionerRole/f202-0") + self.assertEqual(inst.entry[7].resource.id, "f202-0") + self.assertEqual(inst.entry[8].fullUrl, "http://hl7.org/fhir/PractitionerRole/f201-0") + self.assertEqual(inst.entry[8].resource.id, "f201-0") + 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.type, "collection") + + def testBundle5(self): + inst = self.instantiate_from("document-example-dischargesummary.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://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 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("questionnaire-profile-example-ussg-fht.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/us/sdc/ConceptMap/ussgfht-loincde") + self.assertEqual(inst.entry[0].request.method, "PUT") + self.assertEqual(inst.entry[0].request.url, "http://hl7.org/fhir/us/sdc/ConceptMap/ussgfht-loincde") + self.assertEqual(inst.entry[0].resource.id, "ussgfht-loincde") + self.assertEqual(inst.entry[1].fullUrl, "http://hl7.org/fhir/us/sdc/Questionnaire/54127-6") + self.assertEqual(inst.entry[1].request.method, "PUT") + self.assertEqual(inst.entry[1].request.url, "http://hl7.org/fhir/us/sdc/Questionnaire/54127-6") + self.assertEqual(inst.entry[1].resource.id, "54127-6") + self.assertEqual(inst.entry[1].resource.meta.profile[0], "http://hl7.org/fhir/us/sdc/StructureDefinition/sdc-questionnaire") + self.assertEqual(inst.entry[2].fullUrl, "http://hl7.org/fhir/us/sdc/ValueSet/LL1-9") + self.assertEqual(inst.entry[2].request.method, "PUT") + self.assertEqual(inst.entry[2].request.url, "http://hl7.org/fhir/us/sdc/ValueSet/LL1-9") + self.assertEqual(inst.entry[2].resource.id, "LL1-9") + self.assertEqual(inst.entry[2].resource.meta.profile[0], "http://hl7.org/fhir/us/sdc/StructureDefinition/sdc-valueset") + self.assertEqual(inst.entry[3].fullUrl, "http://hl7.org/fhir/us/sdc/ValueSet/LL623-0") + self.assertEqual(inst.entry[3].request.method, "PUT") + self.assertEqual(inst.entry[3].request.url, "http://hl7.org/fhir/us/sdc/ValueSet/LL623-0") + self.assertEqual(inst.entry[3].resource.id, "LL623-0") + self.assertEqual(inst.entry[3].resource.meta.profile[0], "http://hl7.org/fhir/us/sdc/StructureDefinition/sdc-valueset") + self.assertEqual(inst.entry[4].fullUrl, "http://hl7.org/fhir/us/sdc/ValueSet/LL361-7") + self.assertEqual(inst.entry[4].request.method, "PUT") + self.assertEqual(inst.entry[4].request.url, "http://hl7.org/fhir/us/sdc/ValueSet/LL361-7") + self.assertEqual(inst.entry[4].resource.id, "LL361-7") + self.assertEqual(inst.entry[4].resource.meta.profile[0], "http://hl7.org/fhir/us/sdc/StructureDefinition/sdc-valueset") + self.assertEqual(inst.entry[5].fullUrl, "http://hl7.org/fhir/us/sdc/ValueSet/LL629-7") + self.assertEqual(inst.entry[5].request.method, "PUT") + self.assertEqual(inst.entry[5].request.url, "http://hl7.org/fhir/us/sdc/ValueSet/LL629-7") + self.assertEqual(inst.entry[5].resource.id, "LL629-7") + self.assertEqual(inst.entry[5].resource.meta.profile[0], "http://hl7.org/fhir/us/sdc/StructureDefinition/sdc-valueset") + self.assertEqual(inst.entry[6].fullUrl, "http://hl7.org/fhir/us/sdc/ValueSet/LL628-9") + self.assertEqual(inst.entry[6].request.method, "PUT") + self.assertEqual(inst.entry[6].request.url, "http://hl7.org/fhir/us/sdc/ValueSet/LL628-9") + self.assertEqual(inst.entry[6].resource.id, "LL628-9") + self.assertEqual(inst.entry[6].resource.meta.profile[0], "http://hl7.org/fhir/us/sdc/StructureDefinition/sdc-valueset") + self.assertEqual(inst.entry[7].fullUrl, "http://hl7.org/fhir/us/sdc/ValueSet/LL626-3") + self.assertEqual(inst.entry[7].request.method, "PUT") + self.assertEqual(inst.entry[7].request.url, "http://hl7.org/fhir/us/sdc/ValueSet/LL626-3") + self.assertEqual(inst.entry[7].resource.id, "LL626-3") + self.assertEqual(inst.entry[7].resource.meta.profile[0], "http://hl7.org/fhir/us/sdc/StructureDefinition/sdc-valueset") + self.assertEqual(inst.entry[8].fullUrl, "http://hl7.org/fhir/us/sdc/ValueSet/LL619-8") + self.assertEqual(inst.entry[8].request.method, "PUT") + self.assertEqual(inst.entry[8].request.url, "http://hl7.org/fhir/us/sdc/ValueSet/LL619-8") + self.assertEqual(inst.entry[8].resource.id, "LL619-8") + self.assertEqual(inst.entry[8].resource.meta.profile[0], "http://hl7.org/fhir/us/sdc/StructureDefinition/sdc-valueset") + self.assertEqual(inst.entry[9].fullUrl, "http://hl7.org/fhir/us/sdc/ValueSet/LL621-4") + self.assertEqual(inst.entry[9].request.method, "PUT") + self.assertEqual(inst.entry[9].request.url, "http://hl7.org/fhir/us/sdc/ValueSet/LL621-4") + self.assertEqual(inst.entry[9].resource.id, "LL621-4") + self.assertEqual(inst.entry[9].resource.meta.profile[0], "http://hl7.org/fhir/us/sdc/StructureDefinition/sdc-valueset") + self.assertEqual(inst.id, "ussg-fht") + self.assertEqual(inst.type, "transaction") + + def testBundle8(self): + inst = self.instantiate_from("endpoint-examples-general-template.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, "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 testBundle9(self): + inst = self.instantiate_from("patient-examples-cypress-template.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://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 testBundle10(self): + inst = self.instantiate_from("bundle-example.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, "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") + diff --git a/fhirclient/models/STU3/capabilitystatement.py b/fhirclient/models/STU3/capabilitystatement.py new file mode 100644 index 000000000..14dcf8c83 --- /dev/null +++ b/fhirclient/models/STU3/capabilitystatement.py @@ -0,0 +1,901 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/CapabilityStatement) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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. + """ + + resource_type = "CapabilityStatement" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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). """ + + 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.description = None + """ Natural language description of the capability statement. + Type `str`. """ + + self.document = None + """ Document definition. + List of `CapabilityStatementDocument` items (represented as `dict` in JSON). """ + + self.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.fhirVersion = None + """ FHIR Version the system uses. + Type `str`. """ + + self.format = None + """ formats supported (xml | json | ttl | mime type). + List of `str` items. """ + + self.implementation = None + """ If this describes a specific instance. + Type `CapabilityStatementImplementation` (represented as `dict` in JSON). """ + + self.implementationGuide = None + """ Implementation guides supported. + List of `str` items. """ + + self.instantiates = None + """ Canonical URL of another capability statement this implements. + List of `str` items. """ + + self.jurisdiction = None + """ Intended jurisdiction for capability statement (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.kind = None + """ instance | capability | requirements. + Type `str`. """ + + self.messaging = None + """ If messaging is supported. + List of `CapabilityStatementMessaging` items (represented as `dict` in JSON). """ + + self.name = None + """ Name for this capability statement (computer friendly). + Type `str`. """ + + self.patchFormat = None + """ 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`. """ + + self.purpose = None + """ Why this capability statement is defined. + Type `str`. """ + + self.rest = None + """ If the endpoint is a RESTful one. + List of `CapabilityStatementRest` items (represented as `dict` in JSON). """ + + self.software = None + """ Software that is covered by this capability statement. + Type `CapabilityStatementSoftware` (represented as `dict` in JSON). """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.title = None + """ Name for this capability statement (human friendly). + Type `str`. """ + + self.url = None + """ Logical URI to reference this capability statement (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 capability statement. + Type `str`. """ + + super(CapabilityStatement, self).__init__(jsondict=jsondict, strict=strict) + + 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), + ("description", "description", str, False, None, False), + ("document", "document", CapabilityStatementDocument, True, None, False), + ("experimental", "experimental", bool, False, None, False), + ("fhirVersion", "fhirVersion", str, False, None, True), + ("format", "format", str, True, None, True), + ("implementation", "implementation", CapabilityStatementImplementation, False, None, False), + ("implementationGuide", "implementationGuide", 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), + ("software", "software", CapabilityStatementSoftware, False, None, False), + ("status", "status", str, False, None, True), + ("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 CapabilityStatementDocument(backboneelement.BackboneElement): + """ Document definition. + + A document definition. + """ + + resource_type = "CapabilityStatementDocument" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 document support. + Type `str`. """ + + self.mode = None + """ producer | consumer. + Type `str`. """ + + self.profile = None + """ Constraint on a resource used in the document. + Type `FHIRReference` referencing `StructureDefinition` (represented as `dict` in JSON). """ + + super(CapabilityStatementDocument, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CapabilityStatementDocument, self).elementProperties() + js.extend([ + ("documentation", "documentation", str, False, None, False), + ("mode", "mode", str, False, None, True), + ("profile", "profile", fhirreference.FHIRReference, False, None, True), + ]) + return js + + +class CapabilityStatementImplementation(backboneelement.BackboneElement): + """ If this describes a specific instance. + + Identifies a specific implementation instance that is described by the + capability statement - i.e. a particular installation, rather than the + capabilities of a software program. + """ + + resource_type = "CapabilityStatementImplementation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 installation. + Type `str`. """ + + super(CapabilityStatementImplementation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CapabilityStatementImplementation, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, True), + ("url", "url", str, False, None, False), + ]) + return js + + +class CapabilityStatementMessaging(backboneelement.BackboneElement): + """ If messaging is supported. + + A description of the messaging capabilities of the solution. + """ + + resource_type = "CapabilityStatementMessaging" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Messaging interface behavior details. + Type `str`. """ + + self.endpoint = None + """ 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`. """ + + self.supportedMessage = None + """ Messages supported by this system. + List of `CapabilityStatementMessagingSupportedMessage` items (represented as `dict` in JSON). """ + + super(CapabilityStatementMessaging, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CapabilityStatementMessaging, self).elementProperties() + 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), + ]) + return js + + +class CapabilityStatementMessagingEndpoint(backboneelement.BackboneElement): + """ Where messages should be sent. + + An endpoint (network accessible address) to which messages and/or replies + are to be sent. + """ + + resource_type = "CapabilityStatementMessagingEndpoint" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Network address or identifier of the end-point. + Type `str`. """ + + self.protocol = None + """ http | ftp | mllp +. + Type `Coding` (represented as `dict` in JSON). """ + + super(CapabilityStatementMessagingEndpoint, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CapabilityStatementMessagingEndpoint, self).elementProperties() + js.extend([ + ("address", "address", str, False, None, True), + ("protocol", "protocol", coding.Coding, False, None, True), + ]) + 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. + + References to message definitions for messages this system can send or + receive. + """ + + resource_type = "CapabilityStatementMessagingSupportedMessage" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Message supported by this system. + Type `FHIRReference` referencing `MessageDefinition` (represented as `dict` in JSON). """ + + self.mode = None + """ sender | receiver. + Type `str`. """ + + super(CapabilityStatementMessagingSupportedMessage, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CapabilityStatementMessagingSupportedMessage, self).elementProperties() + js.extend([ + ("definition", "definition", fhirreference.FHIRReference, False, None, True), + ("mode", "mode", str, False, None, True), + ]) + return js + + +class CapabilityStatementRest(backboneelement.BackboneElement): + """ If the endpoint is a RESTful one. + + A definition of the restful capabilities of the solution, if any. + """ + + resource_type = "CapabilityStatementRest" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.compartment = None + """ Compartments served/used by system. + List of `str` items. """ + + self.documentation = None + """ General description of implementation. + Type `str`. """ + + self.interaction = None + """ What operations are supported?. + List of `CapabilityStatementRestInteraction` items (represented as `dict` in JSON). """ + + self.mode = None + """ client | server. + Type `str`. """ + + self.operation = None + """ Definition of an operation or a custom query. + List of `CapabilityStatementRestOperation` items (represented as `dict` in JSON). """ + + self.resource = None + """ Resource served on the REST interface. + List of `CapabilityStatementRestResource` items (represented as `dict` in JSON). """ + + self.searchParam = None + """ Search parameters for searching all resources. + List of `CapabilityStatementRestResourceSearchParam` items (represented as `dict` in JSON). """ + + self.security = None + """ Information about security of implementation. + Type `CapabilityStatementRestSecurity` (represented as `dict` in JSON). """ + + super(CapabilityStatementRest, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CapabilityStatementRest, self).elementProperties() + js.extend([ + ("compartment", "compartment", str, True, None, False), + ("documentation", "documentation", str, False, None, False), + ("interaction", "interaction", CapabilityStatementRestInteraction, True, None, False), + ("mode", "mode", str, False, None, True), + ("operation", "operation", CapabilityStatementRestOperation, True, None, False), + ("resource", "resource", CapabilityStatementRestResource, True, None, False), + ("searchParam", "searchParam", CapabilityStatementRestResourceSearchParam, True, None, False), + ("security", "security", CapabilityStatementRestSecurity, False, None, False), + ]) + return js + + +class CapabilityStatementRestInteraction(backboneelement.BackboneElement): + """ What operations are supported?. + + A specification of restful operations supported by the system. + """ + + resource_type = "CapabilityStatementRestInteraction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ transaction | batch | search-system | history-system. + Type `str`. """ + + self.documentation = None + """ Anything special about operation behavior. + Type `str`. """ + + super(CapabilityStatementRestInteraction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CapabilityStatementRestInteraction, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("documentation", "documentation", str, False, None, False), + ]) + 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. + + A specification of the restful capabilities of the solution for a specific + resource type. + """ + + resource_type = "CapabilityStatementRestResource" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.conditionalCreate = None + """ If allows/uses conditional create. + Type `bool`. """ + + self.conditionalDelete = None + """ not-supported | single | multiple - how conditional delete is + supported. + Type `str`. """ + + self.conditionalRead = None + """ not-supported | modified-since | not-match | full-support. + Type `str`. """ + + self.conditionalUpdate = None + """ If allows/uses conditional update. + Type `bool`. """ + + self.documentation = None + """ Additional information about the use of the resource type. + Type `str`. """ + + self.interaction = None + """ What operations are supported?. + List of `CapabilityStatementRestResourceInteraction` 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). """ + + self.readHistory = None + """ Whether vRead can return past versions. + Type `bool`. """ + + self.referencePolicy = None + """ literal | logical | resolves | enforced | local. + List of `str` items. """ + + self.searchInclude = None + """ _include values supported by the server. + List of `str` items. """ + + self.searchParam = None + """ Search parameters supported by implementation. + List of `CapabilityStatementRestResourceSearchParam` items (represented as `dict` in JSON). """ + + self.searchRevInclude = None + """ _revinclude values supported by the server. + List of `str` items. """ + + self.type = None + """ A resource type that is supported. + Type `str`. """ + + self.updateCreate = None + """ If update can commit to a new identity. + Type `bool`. """ + + self.versioning = None + """ no-version | versioned | versioned-update. + Type `str`. """ + + super(CapabilityStatementRestResource, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CapabilityStatementRestResource, self).elementProperties() + js.extend([ + ("conditionalCreate", "conditionalCreate", bool, False, None, False), + ("conditionalDelete", "conditionalDelete", str, False, None, False), + ("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), + ("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), + ("type", "type", str, False, None, True), + ("updateCreate", "updateCreate", bool, False, None, False), + ("versioning", "versioning", str, False, None, False), + ]) + return js + + +class CapabilityStatementRestResourceInteraction(backboneelement.BackboneElement): + """ What operations are supported?. + + Identifies a restful operation supported by the solution. + """ + + resource_type = "CapabilityStatementRestResourceInteraction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ read | vread | update | patch | delete | history-instance | + history-type | create | search-type. + Type `str`. """ + + self.documentation = None + """ Anything special about operation behavior. + Type `str`. """ + + super(CapabilityStatementRestResourceInteraction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CapabilityStatementRestResourceInteraction, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("documentation", "documentation", str, False, None, False), + ]) + return js + + +class CapabilityStatementRestResourceSearchParam(backboneelement.BackboneElement): + """ Search parameters supported by implementation. + + Search parameters for implementations to support and/or make use of - + either references to ones defined in the specification, or additional ones + defined for/by the implementation. + """ + + resource_type = "CapabilityStatementRestResourceSearchParam" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Source of definition for parameter. + Type `str`. """ + + self.documentation = None + """ Server-specific usage. + Type `str`. """ + + self.name = None + """ Name of search parameter. + Type `str`. """ + + self.type = None + """ number | date | string | token | reference | composite | quantity | + uri. + Type `str`. """ + + super(CapabilityStatementRestResourceSearchParam, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CapabilityStatementRestResourceSearchParam, self).elementProperties() + js.extend([ + ("definition", "definition", str, False, None, False), + ("documentation", "documentation", str, False, None, False), + ("name", "name", str, False, None, True), + ("type", "type", str, False, None, True), + ]) + return js + + +class CapabilityStatementRestSecurity(backboneelement.BackboneElement): + """ Information about security of implementation. + + Information about security implementation from an interface perspective - + what a client needs to know. + """ + + resource_type = "CapabilityStatementRestSecurity" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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`. """ + + self.description = None + """ General description of how security works. + Type `str`. """ + + self.service = None + """ OAuth | SMART-on-FHIR | NTLM | Basic | Kerberos | Certificates. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(CapabilityStatementRestSecurity, self).__init__(jsondict=jsondict, strict=strict) + + 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), + ]) + 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. + + Software that is covered by this capability statement. It is used when the + capability statement describes the capabilities of a particular software + version, independent of an installation. + """ + + resource_type = "CapabilityStatementSoftware" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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.releaseDate = None + """ Date this version released. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.version = None + """ Version covered by this statement. + Type `str`. """ + + super(CapabilityStatementSoftware, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CapabilityStatementSoftware, self).elementProperties() + js.extend([ + ("name", "name", str, False, None, True), + ("releaseDate", "releaseDate", fhirdate.FHIRDate, False, 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 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 fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import usagecontext +except ImportError: + usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/STU3/capabilitystatement_tests.py b/fhirclient/models/STU3/capabilitystatement_tests.py new file mode 100644 index 000000000..f2992ffe2 --- /dev/null +++ b/fhirclient/models/STU3/capabilitystatement_tests.py @@ -0,0 +1,179 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import capabilitystatement +from .fhirdate import FHIRDate + + +class CapabilityStatementTests(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("CapabilityStatement", js["resourceType"]) + return capabilitystatement.CapabilityStatement(js) + + def testCapabilityStatement1(self): + inst = self.instantiate_from("capabilitystatement-example.json") + self.assertIsNotNone(inst, "Must have instantiated a CapabilityStatement instance") + self.implCapabilityStatement1(inst) + + js = inst.as_json() + self.assertEqual("CapabilityStatement", js["resourceType"]) + inst2 = capabilitystatement.CapabilityStatement(js) + 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") + self.assertEqual(inst.copyright, "Copyright © Acme Healthcare and GoodCorp EHR Systems") + 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.assertEqual(inst.document[0].documentation, "Basic rules for all documents in the EHR system") + self.assertEqual(inst.document[0].mode, "consumer") + self.assertTrue(inst.experimental) + self.assertEqual(inst.fhirVersion, "1.0.0") + self.assertEqual(inst.format[0], "xml") + self.assertEqual(inst.format[1], "json") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.implementation.description, "main EHR at ACME") + self.assertEqual(inst.implementation.url, "http://10.2.3.4/fhir") + self.assertEqual(inst.implementationGuide[0], "http://hl7.org/fhir/us/lab") + self.assertEqual(inst.instantiates[0], "http://ihe.org/fhir/CapabilityStatement/pixm-client") + 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.kind, "instance") + 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].reliableCache, 30) + self.assertEqual(inst.name, "ACME-EHR") + self.assertEqual(inst.patchFormat[0], "application/xml-patch+xml") + self.assertEqual(inst.patchFormat[1], "application/json-patch+json") + self.assertEqual(inst.publisher, "ACME Corporation") + self.assertEqual(inst.purpose, "Main EHR capability statement, published for contracting and operational support") + self.assertEqual(inst.rest[0].compartment[0], "http://hl7.org/fhir/CompartmentDefinition/patient") + self.assertEqual(inst.rest[0].documentation, "Main FHIR endpoint for acem health") + self.assertEqual(inst.rest[0].interaction[0].code, "transaction") + self.assertEqual(inst.rest[0].interaction[1].code, "history-system") + self.assertEqual(inst.rest[0].mode, "server") + self.assertTrue(inst.rest[0].resource[0].conditionalCreate) + self.assertEqual(inst.rest[0].resource[0].conditionalDelete, "not-supported") + self.assertEqual(inst.rest[0].resource[0].conditionalRead, "full-support") + self.assertFalse(inst.rest[0].resource[0].conditionalUpdate) + self.assertEqual(inst.rest[0].resource[0].documentation, "This server does not let the clients create identities.") + self.assertEqual(inst.rest[0].resource[0].interaction[0].code, "read") + self.assertEqual(inst.rest[0].resource[0].interaction[1].code, "vread") + self.assertEqual(inst.rest[0].resource[0].interaction[1].documentation, "Only supported for patient records since 12-Dec 2012") + self.assertEqual(inst.rest[0].resource[0].interaction[2].code, "update") + 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.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") + self.assertEqual(inst.rest[0].resource[0].searchParam[0].documentation, "Only supports search by institution MRN") + self.assertEqual(inst.rest[0].resource[0].searchParam[0].name, "identifier") + self.assertEqual(inst.rest[0].resource[0].searchParam[0].type, "token") + self.assertEqual(inst.rest[0].resource[0].searchParam[1].definition, "http://hl7.org/fhir/SearchParameter/Patient-general-practitioner") + 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].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.software.name, "EHR") + self.assertEqual(inst.software.releaseDate.date, FHIRDate("2012-01-04").date) + self.assertEqual(inst.software.releaseDate.as_json(), "2012-01-04") + self.assertEqual(inst.software.version, "0.00.020.2134") + 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.useContext[0].code.code, "focus") + self.assertEqual(inst.useContext[0].code.system, "http://hl7.org/fhir/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.version, "20130510") + + def testCapabilityStatement2(self): + inst = self.instantiate_from("capabilitystatement-phr-example.json") + self.assertIsNotNone(inst, "Must have instantiated a CapabilityStatement instance") + self.implCapabilityStatement2(inst) + + js = inst.as_json() + self.assertEqual("CapabilityStatement", js["resourceType"]) + inst2 = capabilitystatement.CapabilityStatement(js) + 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.format[0], "json") + self.assertEqual(inst.format[1], "xml") + self.assertEqual(inst.id, "phr") + self.assertEqual(inst.kind, "capability") + 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") + self.assertEqual(inst.rest[0].mode, "server") + self.assertEqual(inst.rest[0].resource[0].interaction[0].code, "read") + self.assertEqual(inst.rest[0].resource[0].interaction[1].code, "search-type") + self.assertEqual(inst.rest[0].resource[0].interaction[1].documentation, "When a client searches patients with no search criteria, they get a list of all patients they have access too. Servers may elect to offer additional search parameters, but this is not required") + self.assertEqual(inst.rest[0].resource[0].type, "Patient") + self.assertEqual(inst.rest[0].resource[1].interaction[0].code, "read") + self.assertEqual(inst.rest[0].resource[1].interaction[1].code, "search-type") + self.assertEqual(inst.rest[0].resource[1].searchParam[0].documentation, "_id parameter always supported. For the connectathon, servers may elect which search parameters are supported") + self.assertEqual(inst.rest[0].resource[1].searchParam[0].name, "_id") + self.assertEqual(inst.rest[0].resource[1].searchParam[0].type, "token") + self.assertEqual(inst.rest[0].resource[1].type, "DocumentReference") + self.assertEqual(inst.rest[0].resource[2].interaction[0].code, "read") + self.assertEqual(inst.rest[0].resource[2].interaction[1].code, "search-type") + self.assertEqual(inst.rest[0].resource[2].searchParam[0].documentation, "Standard _id parameter") + self.assertEqual(inst.rest[0].resource[2].searchParam[0].name, "_id") + self.assertEqual(inst.rest[0].resource[2].searchParam[0].type, "token") + self.assertEqual(inst.rest[0].resource[2].type, "Condition") + self.assertEqual(inst.rest[0].resource[3].interaction[0].code, "read") + self.assertEqual(inst.rest[0].resource[3].interaction[1].code, "search-type") + self.assertEqual(inst.rest[0].resource[3].searchParam[0].documentation, "Standard _id parameter") + self.assertEqual(inst.rest[0].resource[3].searchParam[0].name, "_id") + self.assertEqual(inst.rest[0].resource[3].searchParam[0].type, "token") + self.assertEqual(inst.rest[0].resource[3].searchParam[1].documentation, "which diagnostic discipline/department created the report") + self.assertEqual(inst.rest[0].resource[3].searchParam[1].name, "service") + self.assertEqual(inst.rest[0].resource[3].searchParam[1].type, "token") + self.assertEqual(inst.rest[0].resource[3].type, "DiagnosticReport") + self.assertEqual(inst.rest[0].security.service[0].text, "OAuth") + self.assertEqual(inst.software.name, "ACME PHR Server") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/STU3/careplan.py b/fhirclient/models/STU3/careplan.py new file mode 100644 index 000000000..38891230d --- /dev/null +++ b/fhirclient/models/STU3/careplan.py @@ -0,0 +1,343 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/CarePlan) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class CarePlan(domainresource.DomainResource): + """ Healthcare plan for patient or group. + + Describes the intention of how one or more practitioners intend to deliver + care for a particular patient, group or community for a period of time, + possibly limited to care for a specific condition or set of conditions. + """ + + resource_type = "CarePlan" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.activity = None + """ Action to occur as part of plan. + List of `CarePlanActivity` items (represented as `dict` in JSON). """ + + self.addresses = None + """ Health issues this plan addresses. + List of `FHIRReference` items referencing `Condition` (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). """ + + self.basedOn = None + """ Fulfills care plan. + List of `FHIRReference` items referencing `CarePlan` (represented as `dict` in JSON). """ + + self.careTeam = None + """ Who's involved in plan?. + List of `FHIRReference` items referencing `CareTeam` (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.definition = None + """ Protocol or definition. + List of `FHIRReference` items referencing `PlanDefinition, Questionnaire` (represented as `dict` in JSON). """ + + self.description = None + """ Summary of nature of plan. + Type `str`. """ + + self.goal = None + """ Desired outcome of plan. + List of `FHIRReference` items referencing `Goal` (represented as `dict` in JSON). """ + + self.identifier = None + """ External Ids for this plan. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.intent = None + """ proposal | plan | order | option. + Type `str`. """ + + self.note = None + """ Comments about the plan. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.partOf = None + """ Part of referenced CarePlan. + List of `FHIRReference` items referencing `CarePlan` (represented as `dict` in JSON). """ + + self.period = None + """ Time period plan covers. + Type `Period` (represented as `dict` in JSON). """ + + self.replaces = None + """ CarePlan replaced by this CarePlan. + List of `FHIRReference` items referencing `CarePlan` (represented as `dict` in JSON). """ + + self.status = None + """ draft | active | suspended | completed | entered-in-error | + cancelled | unknown. + Type `str`. """ + + self.subject = None + """ Who care plan is for. + Type `FHIRReference` referencing `Patient, Group` (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). """ + + self.title = None + """ Human-friendly name for the CarePlan. + Type `str`. """ + + super(CarePlan, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CarePlan, self).elementProperties() + js.extend([ + ("activity", "activity", CarePlanActivity, True, None, False), + ("addresses", "addresses", fhirreference.FHIRReference, True, None, False), + ("author", "author", fhirreference.FHIRReference, True, 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), + ("description", "description", str, False, None, False), + ("goal", "goal", fhirreference.FHIRReference, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("intent", "intent", str, False, None, True), + ("note", "note", annotation.Annotation, True, None, False), + ("partOf", "partOf", fhirreference.FHIRReference, True, None, False), + ("period", "period", period.Period, False, None, False), + ("replaces", "replaces", fhirreference.FHIRReference, True, None, False), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, True), + ("supportingInfo", "supportingInfo", fhirreference.FHIRReference, True, None, False), + ("title", "title", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class CarePlanActivity(backboneelement.BackboneElement): + """ Action to occur as part of plan. + + Identifies a planned action to occur as part of the plan. For example, a + medication to be used, lab tests to perform, self-monitoring, education, + etc. + """ + + resource_type = "CarePlanActivity" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.detail = None + """ In-line definition of activity. + Type `CarePlanActivityDetail` (represented as `dict` in JSON). """ + + self.outcomeCodeableConcept = None + """ Results of the activity. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.outcomeReference = None + """ Appointment, Encounter, Procedure, etc.. + List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + + self.progress = None + """ Comments about the activity status/progress. + List of `Annotation` items (represented as `dict` in JSON). """ + + 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). """ + + super(CarePlanActivity, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CarePlanActivity, self).elementProperties() + js.extend([ + ("detail", "detail", CarePlanActivityDetail, False, None, False), + ("outcomeCodeableConcept", "outcomeCodeableConcept", codeableconcept.CodeableConcept, True, None, False), + ("outcomeReference", "outcomeReference", fhirreference.FHIRReference, True, None, False), + ("progress", "progress", annotation.Annotation, True, None, False), + ("reference", "reference", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +class CarePlanActivityDetail(backboneelement.BackboneElement): + """ In-line definition of activity. + + A simple summary of a planned activity suitable for a general care plan + system (e.g. form driven) that doesn't know about specific resources such + as procedure etc. + """ + + resource_type = "CarePlanActivityDetail" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ 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). """ + + self.dailyAmount = None + """ 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.goal = None + """ Goals this activity relates to. + List of `FHIRReference` items referencing `Goal` (represented as `dict` in JSON). """ + + self.location = None + """ Where it should happen. + Type `FHIRReference` referencing `Location` (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). """ + + self.productCodeableConcept = None + """ What is to be administered/supplied. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + 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`. """ + + self.quantity = None + """ How much to administer/supply/consume. + Type `Quantity` (represented as `dict` in JSON). """ + + self.reasonCode = None + """ Why activity should be done or why activity was prohibited. + 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). """ + + self.scheduledPeriod = None + """ When activity is to occur. + Type `Period` (represented as `dict` in JSON). """ + + self.scheduledString = None + """ When activity is to occur. + Type `str`. """ + + self.scheduledTiming = None + """ When activity is to occur. + Type `Timing` (represented as `dict` in JSON). """ + + self.status = None + """ not-started | scheduled | in-progress | on-hold | completed | + cancelled | unknown. + Type `str`. """ + + self.statusReason = None + """ Reason for current status. + Type `str`. """ + + 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), + ("goal", "goal", fhirreference.FHIRReference, True, 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), + ("scheduledPeriod", "scheduledPeriod", period.Period, False, "scheduled", False), + ("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), + ]) + 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 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 quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] +try: + from . import timing +except ImportError: + timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/STU3/careplan_tests.py b/fhirclient/models/STU3/careplan_tests.py new file mode 100644 index 000000000..f98e972a0 --- /dev/null +++ b/fhirclient/models/STU3/careplan_tests.py @@ -0,0 +1,510 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import careplan +from .fhirdate import FHIRDate + + +class CarePlanTests(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("CarePlan", js["resourceType"]) + return careplan.CarePlan(js) + + def testCarePlan1(self): + inst = self.instantiate_from("careplan-example-f002-lung.json") + self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") + self.implCarePlan1(inst) + + js = inst.as_json() + self.assertEqual("CarePlan", js["resourceType"]) + inst2 = careplan.CarePlan(js) + 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, "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-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.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.text.status, "generated") + + def testCarePlan2(self): + inst = self.instantiate_from("careplan-example-f202-malignancy.json") + self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") + self.implCarePlan2(inst) + + js = inst.as_json() + self.assertEqual("CarePlan", js["resourceType"]) + inst2 = careplan.CarePlan(js) + 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, "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 testCarePlan3(self): + inst = self.instantiate_from("careplan-example-obesity-narrative.json") + self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") + self.implCarePlan3(inst) + + js = inst.as_json() + self.assertEqual("CarePlan", js["resourceType"]) + inst2 = careplan.CarePlan(js) + self.implCarePlan3(inst2) + + def implCarePlan3(self, inst): + self.assertEqual(inst.id, "obesity-narrative") + self.assertEqual(inst.intent, "plan") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "additional") + + def testCarePlan4(self): + inst = self.instantiate_from("careplan-example.json") + self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") + self.implCarePlan4(inst) + + js = inst.as_json() + self.assertEqual("CarePlan", js["resourceType"]) + inst2 = careplan.CarePlan(js) + self.implCarePlan4(inst2) + + def implCarePlan4(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, "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.prohibited) + 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, "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.description, "Manage obesity and weight loss") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier[0].value, "12345") + self.assertEqual(inst.intent, "plan") + 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.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, "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") + self.assertEqual(inst.activity[0].detail.dailyAmount.code, "258718000") + 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.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.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.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) + self.assertEqual(inst.period.start.as_json(), "2013-03-11") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + + def testCarePlan6(self): + inst = self.instantiate_from("careplan-example-GPVisit.json") + self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") + self.implCarePlan6(inst) + + js = inst.as_json() + self.assertEqual("CarePlan", js["resourceType"]) + inst2 = careplan.CarePlan(js) + self.implCarePlan6(inst2) + + def implCarePlan6(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.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.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.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 testCarePlan7(self): + inst = self.instantiate_from("careplan-example-integrated.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, "other") + self.assertEqual(inst.activity[0].detail.category.coding[0].system, "http://hl7.org/fhir/care-plan-activity-category") + self.assertEqual(inst.activity[0].detail.description, "Eve will review photos of high and low density foods and share with her parents") + 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.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.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.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.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") + self.assertEqual(inst.activity[3].progress[0].text, "Eve would like to try for 5 days a week.") + self.assertEqual(inst.activity[3].progress[0].time.date, FHIRDate("2012-08-27").date) + self.assertEqual(inst.activity[3].progress[0].time.as_json(), "2012-08-27") + 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.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") + self.assertEqual(inst.activity[4].progress[0].text, "Eve walked 4 times the last week.") + self.assertEqual(inst.activity[4].progress[0].time.date, FHIRDate("2012-08-13").date) + self.assertEqual(inst.activity[4].progress[0].time.as_json(), "2012-08-13") + 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.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.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") + self.assertEqual(inst.activity[6].progress[0].text, "After restarting the vinegar soaks the psoriasis is improved and Eve plans to treat the remainder with light treatments. She plans to start this week.") + self.assertEqual(inst.activity[6].progress[0].time.date, FHIRDate("2012-08-13").date) + self.assertEqual(inst.activity[6].progress[0].time.as_json(), "2012-08-13") + 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.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.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") + self.assertEqual(inst.activity[8].progress[0].text, "Will be able to esume exercise.") + self.assertEqual(inst.activity[8].progress[0].time.date, FHIRDate("2012-07-30").date) + self.assertEqual(inst.activity[8].progress[0].time.as_json(), "2012-07-30") + 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.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") + self.assertEqual(inst.contained[0].id, "p1") + self.assertEqual(inst.contained[1].id, "p2") + self.assertEqual(inst.contained[2].id, "p3") + self.assertEqual(inst.contained[3].id, "g1") + self.assertEqual(inst.contained[4].id, "g2") + self.assertEqual(inst.contained[5].id, "g3") + self.assertEqual(inst.contained[6].id, "g4") + self.assertEqual(inst.contained[7].id, "g5") + self.assertEqual(inst.id, "integrate") + self.assertEqual(inst.intent, "plan") + 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.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.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") + + def testCarePlan9(self): + inst = self.instantiate_from("careplan-example-f001-heart.json") + self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") + self.implCarePlan9(inst) + + js = inst.as_json() + self.assertEqual("CarePlan", js["resourceType"]) + inst2 = careplan.CarePlan(js) + self.implCarePlan9(inst2) + + def implCarePlan9(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].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, "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.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") + self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") + self.implCarePlan10(inst) + + js = inst.as_json() + self.assertEqual("CarePlan", js["resourceType"]) + inst2 = careplan.CarePlan(js) + 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.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) + self.assertEqual(inst.activity[1].detail.scheduledTiming.repeat.boundsPeriod.start.as_json(), "2013-02-14") + 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.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.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) + self.assertEqual(inst.activity[3].detail.scheduledTiming.repeat.boundsPeriod.start.as_json(), "2013-09-01") + self.assertEqual(inst.activity[3].detail.status, "not-started") + self.assertEqual(inst.contained[0].id, "p1") + self.assertEqual(inst.contained[1].id, "pr1") + self.assertEqual(inst.contained[2].id, "pr2") + self.assertEqual(inst.contained[3].id, "careteam") + self.assertEqual(inst.contained[4].id, "goal") + self.assertEqual(inst.extension[0].url, "http://example.org/fhir/StructureDefinition/careplan#lmp") + self.assertEqual(inst.extension[0].valueDateTime.date, FHIRDate("2013-01-01").date) + self.assertEqual(inst.extension[0].valueDateTime.as_json(), "2013-01-01") + self.assertEqual(inst.id, "preg") + self.assertEqual(inst.intent, "plan") + 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) + self.assertEqual(inst.period.start.as_json(), "2013-01-01") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "additional") + diff --git a/fhirclient/models/STU3/careteam.py b/fhirclient/models/STU3/careteam.py new file mode 100644 index 000000000..d454870c8 --- /dev/null +++ b/fhirclient/models/STU3/careteam.py @@ -0,0 +1,165 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/CareTeam) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class CareTeam(domainresource.DomainResource): + """ Planned participants in the coordination and delivery of care for a patient + or group. + + The Care Team includes all the people and organizations who plan to + participate in the coordination and delivery of care for a patient. + """ + + resource_type = "CareTeam" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ 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.identifier = None + """ External Ids for this team. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.managingOrganization = None + """ Organization responsible for the care team. + List of `FHIRReference` items referencing `Organization` (represented as `dict` in JSON). """ + + self.name = None + """ Name of the team, such as crisis assessment team. + Type `str`. """ + + self.note = None + """ Comments made about the CareTeam. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.participant = None + """ Members of the team. + List of `CareTeamParticipant` items (represented as `dict` in JSON). """ + + self.period = None + """ Time period team covers. + Type `Period` (represented as `dict` in JSON). """ + + self.reasonCode = None + """ Why the care team exists. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.reasonReference = None + """ Why the care team exists. + List of `FHIRReference` items referencing `Condition` (represented as `dict` in JSON). """ + + self.status = None + """ proposed | active | suspended | inactive | entered-in-error. + Type `str`. """ + + self.subject = None + """ Who care team is for. + Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ + + super(CareTeam, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CareTeam, self).elementProperties() + js.extend([ + ("category", "category", codeableconcept.CodeableConcept, True, None, False), + ("context", "context", 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), + ("note", "note", annotation.Annotation, True, None, False), + ("participant", "participant", CareTeamParticipant, True, None, False), + ("period", "period", period.Period, False, None, False), + ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), + ("reasonReference", "reasonReference", fhirreference.FHIRReference, True, None, False), + ("status", "status", str, False, None, False), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +from . import backboneelement + +class CareTeamParticipant(backboneelement.BackboneElement): + """ Members of the team. + + Identifies all people and organizations who are expected to be involved in + the care team. + """ + + resource_type = "CareTeamParticipant" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.member = None + """ Who is involved. + Type `FHIRReference` referencing `Practitioner, RelatedPerson, Patient, Organization, CareTeam` (represented as `dict` in JSON). """ + + self.onBehalfOf = None + """ Organization of the practitioner. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.period = None + """ Time period of participant. + Type `Period` (represented as `dict` in JSON). """ + + self.role = None + """ Type of involvement. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(CareTeamParticipant, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CareTeamParticipant, self).elementProperties() + js.extend([ + ("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), + ]) + 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 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/STU3/careteam_tests.py b/fhirclient/models/STU3/careteam_tests.py new file mode 100644 index 000000000..d4e27c4a7 --- /dev/null +++ b/fhirclient/models/STU3/careteam_tests.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import careteam +from .fhirdate import FHIRDate + + +class CareTeamTests(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("CareTeam", js["resourceType"]) + return careteam.CareTeam(js) + + def testCareTeam1(self): + inst = self.instantiate_from("careteam-example.json") + self.assertIsNotNone(inst, "Must have instantiated a CareTeam instance") + self.implCareTeam1(inst) + + js = inst.as_json() + self.assertEqual("CareTeam", js["resourceType"]) + inst2 = careteam.CareTeam(js) + 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.contained[0].id, "pr1") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier[0].value, "12345") + self.assertEqual(inst.name, "Peter James Charlmers Care Plan for Inpatient Encounter") + self.assertEqual(inst.participant[0].role.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.period.end.date, FHIRDate("2013-01-01").date) + self.assertEqual(inst.period.end.as_json(), "2013-01-01") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.div, "
Care Team
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/STU3/chargeitem.py b/fhirclient/models/STU3/chargeitem.py new file mode 100644 index 000000000..e80a96e98 --- /dev/null +++ b/fhirclient/models/STU3/chargeitem.py @@ -0,0 +1,240 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ChargeItem) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class ChargeItem(domainresource.DomainResource): + """ Item containing charge code(s) associated with the provision of healthcare + provider products. + + The resource ChargeItem describes the provision of healthcare provider + products for a certain patient, therefore referring not only to the + product, but containing in addition details of the provision, like date, + time, amounts and participating organizations and persons. Main Usage of + the ChargeItem is to enable the billing process and internal cost + allocation. + """ + + resource_type = "ChargeItem" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 to place this charge. + List of `FHIRReference` items referencing `Account` (represented as `dict` in JSON). """ + + self.bodysite = None + """ Anatomical location, if relevant. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.code = None + """ A code that identifies the charge, like a billing code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.context = None + """ Encounter / Episode associated with event. + Type `FHIRReference` referencing `Encounter, EpisodeOfCare` (represented as `dict` in JSON). """ + + self.definition = None + """ Defining information about the code of this charge item. + List of `str` items. """ + + self.enteredDate = None + """ Date the charge item was entered. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.enterer = None + """ Individual who was entering. + Type `FHIRReference` referencing `Practitioner, Organization, Patient, Device, RelatedPerson` (represented as `dict` in JSON). """ + + self.factorOverride = None + """ Factor overriding the associated rules. + Type `float`. """ + + self.identifier = None + """ Business Identifier for item. + Type `Identifier` (represented as `dict` in JSON). """ + + self.note = None + """ Comments made about the ChargeItem. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.occurrenceDateTime = None + """ When the charged service was applied. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.occurrencePeriod = None + """ When the charged service was applied. + Type `Period` (represented as `dict` in JSON). """ + + self.occurrenceTiming = None + """ When the charged service was applied. + Type `Timing` (represented as `dict` in JSON). """ + + self.overrideReason = None + """ Reason for overriding the list price/factor. + Type `str`. """ + + self.partOf = None + """ Part of referenced ChargeItem. + List of `FHIRReference` items referencing `ChargeItem` (represented as `dict` in JSON). """ + + self.participant = None + """ Who performed charged service. + List of `ChargeItemParticipant` items (represented as `dict` in JSON). """ + + self.performingOrganization = None + """ Organization providing the charged sevice. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.priceOverride = None + """ Price overriding the associated rules. + Type `Money` (represented as `dict` in JSON). """ + + self.quantity = None + """ Quantity of which the charge item has been serviced. + Type `Quantity` (represented as `dict` in JSON). """ + + self.reason = None + """ Why was the charged service rendered?. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.requestingOrganization = None + """ Organization requesting the charged service. + Type `FHIRReference` referencing `Organization` (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). """ + + self.status = None + """ planned | billable | not-billable | aborted | billed | entered-in- + error | unknown. + Type `str`. """ + + self.subject = None + """ Individual service was done for/to. + Type `FHIRReference` referencing `Patient, Group` (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). """ + + super(ChargeItem, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ChargeItem, self).elementProperties() + js.extend([ + ("account", "account", fhirreference.FHIRReference, True, None, False), + ("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), + ("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), + ("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), + ("performingOrganization", "performingOrganization", fhirreference.FHIRReference, False, None, False), + ("priceOverride", "priceOverride", money.Money, False, None, False), + ("quantity", "quantity", quantity.Quantity, False, None, False), + ("reason", "reason", codeableconcept.CodeableConcept, True, None, False), + ("requestingOrganization", "requestingOrganization", fhirreference.FHIRReference, False, None, False), + ("service", "service", fhirreference.FHIRReference, True, None, False), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, True), + ("supportingInformation", "supportingInformation", fhirreference.FHIRReference, True, None, False), + ]) + return js + + +from . import backboneelement + +class ChargeItemParticipant(backboneelement.BackboneElement): + """ Who performed charged service. + + Indicates who or what performed or participated in the charged service. + """ + + resource_type = "ChargeItemParticipant" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 performing. + Type `FHIRReference` referencing `Practitioner, Organization, Patient, Device, RelatedPerson` (represented as `dict` in JSON). """ + + self.role = None + """ What type of performance was done. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ChargeItemParticipant, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ChargeItemParticipant, 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'] +try: + from . import period +except ImportError: + period = sys.modules[__package__ + '.period'] +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] +try: + from . import timing +except ImportError: + timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/STU3/chargeitem_tests.py b/fhirclient/models/STU3/chargeitem_tests.py new file mode 100644 index 000000000..33b00af68 --- /dev/null +++ b/fhirclient/models/STU3/chargeitem_tests.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import chargeitem +from .fhirdate import FHIRDate + + +class ChargeItemTests(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("ChargeItem", js["resourceType"]) + return chargeitem.ChargeItem(js) + + def testChargeItem1(self): + inst = self.instantiate_from("chargeitem-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ChargeItem instance") + self.implChargeItem1(inst) + + js = inst.as_json() + self.assertEqual("ChargeItem", js["resourceType"]) + inst2 = chargeitem.ChargeItem(js) + self.implChargeItem1(inst2) + + 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.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.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") + self.assertEqual(inst.occurrencePeriod.end.date, FHIRDate("2017-01-25T12:35:00+01:00").date) + self.assertEqual(inst.occurrencePeriod.end.as_json(), "2017-01-25T12:35:00+01:00") + 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.priceOverride.value, 40) + self.assertEqual(inst.quantity.value, 1) + self.assertEqual(inst.reason[0].coding[0].code, "123456") + self.assertEqual(inst.reason[0].coding[0].display, "DIAG-1") + self.assertEqual(inst.reason[0].coding[0].system, "http://hl7.org/fhir/sid/icd-10") + self.assertEqual(inst.status, "billable") + self.assertEqual(inst.text.div, "
Example of ChargeItem Usage in Context of the German EBM Billing code system
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/STU3/claim.py b/fhirclient/models/STU3/claim.py new file mode 100644 index 000000000..ce74be86d --- /dev/null +++ b/fhirclient/models/STU3/claim.py @@ -0,0 +1,947 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Claim) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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. + """ + + resource_type = "Claim" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.accident = None + """ Details about an accident. + Type `ClaimAccident` (represented as `dict` in JSON). """ + + self.billablePeriod = None + """ Period for charge submission. + Type `Period` (represented as `dict` in JSON). """ + + self.careTeam = None + """ Members of the care team. + List of `ClaimCareTeam` items (represented as `dict` in JSON). """ + + self.created = None + """ Creation date. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.diagnosis = None + """ List of Diagnosis. + 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). """ + + self.facility = None + """ Servicing Facility. + Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + + self.fundsReserve = None + """ Funds requested to be reserved. + 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. + 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. + List of `ClaimInsurance` items (represented as `dict` in JSON). """ + + self.insurer = None + """ Target. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.item = None + """ Goods and Services. + 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). """ + + self.patient = None + """ The subject of the Products and Services. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.payee = None + """ Party to be paid any 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). """ + + self.priority = None + """ Desired processing priority. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.procedure = None + """ 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). """ + + self.referral = None + """ Treatment Referral. + Type `FHIRReference` referencing `ReferralRequest` (represented as `dict` in JSON). """ + + self.related = None + """ Related Claims which may be revelant to processing this claimn. + List of `ClaimRelated` items (represented as `dict` in JSON). """ + + self.status = None + """ active | cancelled | draft | entered-in-error. + Type `str`. """ + + self.subType = None + """ Finer grained claim type information. + List of `CodeableConcept` 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. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.use = None + """ complete | proposed | exploratory | other. + Type `str`. """ + + super(Claim, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Claim, self).elementProperties() + js.extend([ + ("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), + ("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), + ("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), + ("payee", "payee", ClaimPayee, False, None, False), + ("prescription", "prescription", fhirreference.FHIRReference, False, None, False), + ("priority", "priority", codeableconcept.CodeableConcept, False, None, False), + ("procedure", "procedure", ClaimProcedure, True, None, False), + ("provider", "provider", fhirreference.FHIRReference, False, None, False), + ("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), + ("total", "total", money.Money, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("use", "use", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class ClaimAccident(backboneelement.BackboneElement): + """ Details about an accident. + + An accident which resulted in the need for healthcare services. + """ + + resource_type = "ClaimAccident" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ When the accident occurred + see information codes + see information codes. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.locationAddress = None + """ Accident Place. + Type `Address` (represented as `dict` in JSON). """ + + self.locationReference = None + """ Accident Place. + Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + + self.type = None + """ The nature of the accident. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ClaimAccident, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimAccident, self).elementProperties() + js.extend([ + ("date", "date", fhirdate.FHIRDate, False, None, True), + ("locationAddress", "locationAddress", address.Address, False, "location", False), + ("locationReference", "locationReference", fhirreference.FHIRReference, False, "location", False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +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. + """ + + resource_type = "ClaimCareTeam" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.provider = None + """ Provider individual or organization. + Type `FHIRReference` referencing `Practitioner, Organization` (represented as `dict` in JSON). """ + + self.qualification = None + """ Type, classification or Specialization. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.responsible = None + """ Billing provider. + Type `bool`. """ + + self.role = None + """ Role on the team. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.sequence = None + """ Number to covey order of careTeam. + Type `int`. """ + + super(ClaimCareTeam, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimCareTeam, self).elementProperties() + js.extend([ + ("provider", "provider", fhirreference.FHIRReference, False, None, True), + ("qualification", "qualification", codeableconcept.CodeableConcept, False, None, False), + ("responsible", "responsible", bool, False, None, False), + ("role", "role", codeableconcept.CodeableConcept, False, None, False), + ("sequence", "sequence", int, False, None, True), + ]) + return js + + +class ClaimDiagnosis(backboneelement.BackboneElement): + """ List of Diagnosis. + + List of patient diagnosis for which care is sought. + """ + + resource_type = "ClaimDiagnosis" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Patient's diagnosis. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.diagnosisReference = None + """ Patient's diagnosis. + Type `FHIRReference` referencing `Condition` (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. + Type `int`. """ + + self.type = None + """ Timing or nature of the diagnosis. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(ClaimDiagnosis, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimDiagnosis, self).elementProperties() + js.extend([ + ("diagnosisCodeableConcept", "diagnosisCodeableConcept", codeableconcept.CodeableConcept, False, "diagnosis", True), + ("diagnosisReference", "diagnosisReference", fhirreference.FHIRReference, False, "diagnosis", True), + ("packageCode", "packageCode", codeableconcept.CodeableConcept, False, None, False), + ("sequence", "sequence", int, False, None, True), + ("type", "type", codeableconcept.CodeableConcept, True, None, False), + ]) + 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. + + Financial instrument by which payment information for health care. + """ + + resource_type = "ClaimInsurance" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Business agreement. + Type `str`. """ + + self.claimResponse = None + """ Adjudication results. + Type `FHIRReference` referencing `ClaimResponse` (represented as `dict` in JSON). """ + + self.coverage = None + """ Insurance information. + Type `FHIRReference` referencing `Coverage` (represented as `dict` in JSON). """ + + self.focal = None + """ Is the focal Coverage. + Type `bool`. """ + + self.preAuthRef = None + """ Pre-Authorization/Determination Reference. + List of `str` items. """ + + self.sequence = None + """ Service instance identifier. + Type `int`. """ + + super(ClaimInsurance, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimInsurance, self).elementProperties() + js.extend([ + ("businessArrangement", "businessArrangement", str, False, None, False), + ("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 ClaimItem(backboneelement.BackboneElement): + """ Goods and Services. + + First tier of goods and services. + """ + + resource_type = "ClaimItem" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.bodySite = None + """ Service Location. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.careTeamLinkId = None + """ Applicable careTeam members. + List of `int` items. """ + + self.category = None + """ Type of service or product. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.detail = None + """ Additional items. + List of `ClaimItemDetail` items (represented as `dict` in JSON). """ + + self.diagnosisLinkId = 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). """ + + self.factor = None + """ Price scaling factor. + Type `float`. """ + + self.informationLinkId = None + """ Applicable exception and supporting information. + List of `int` items. """ + + self.locationAddress = None + """ Place of service. + Type `Address` (represented as `dict` in JSON). """ + + self.locationCodeableConcept = None + """ Place of service. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.locationReference = None + """ Place of service. + Type `FHIRReference` referencing `Location` (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.procedureLinkId = None + """ Applicable procedures. + List of `int` items. """ + + self.programCode = None + """ Program specific reason for item inclusion. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.quantity = None + """ Count of Products or Services. + Type `Quantity` (represented as `dict` in JSON). """ + + self.revenue = None + """ Revenue or cost center code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.sequence = None + """ Service instance. + Type `int`. """ + + self.service = None + """ Billing Code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.servicedDate = None + """ Date or dates of Service. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.servicedPeriod = None + """ Date or dates of Service. + Type `Period` (represented as `dict` in JSON). """ + + self.subSite = None + """ Service 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). """ + + self.unitPrice = None + """ Fee, charge or cost per point. + Type `Money` (represented as `dict` in JSON). """ + + super(ClaimItem, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimItem, self).elementProperties() + js.extend([ + ("bodySite", "bodySite", codeableconcept.CodeableConcept, False, None, False), + ("careTeamLinkId", "careTeamLinkId", int, True, None, False), + ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("detail", "detail", ClaimItemDetail, True, None, False), + ("diagnosisLinkId", "diagnosisLinkId", int, True, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, True, None, False), + ("factor", "factor", float, False, None, False), + ("informationLinkId", "informationLinkId", 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), + ("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), + ("udi", "udi", fhirreference.FHIRReference, True, None, False), + ("unitPrice", "unitPrice", money.Money, False, None, False), + ]) + return js + + +class ClaimItemDetail(backboneelement.BackboneElement): + """ Additional items. + + Second tier of goods and services. + """ + + resource_type = "ClaimItemDetail" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Type of service or product. + Type `CodeableConcept` (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 additional item cost. + Type `Money` (represented as `dict` in JSON). """ + + self.programCode = None + """ Program specific reason for item inclusion. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.quantity = None + """ Count of Products or Services. + Type `Quantity` (represented as `dict` in JSON). """ + + self.revenue = None + """ Revenue or cost center code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.sequence = None + """ Service instance. + Type `int`. """ + + self.service = None + """ Billing Code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.subDetail = None + """ Additional items. + 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). """ + + self.unitPrice = None + """ Fee, charge or cost per point. + Type `Money` (represented as `dict` in JSON). """ + + super(ClaimItemDetail, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimItemDetail, self).elementProperties() + js.extend([ + ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("factor", "factor", float, False, None, False), + ("modifier", "modifier", codeableconcept.CodeableConcept, True, None, False), + ("net", "net", money.Money, False, None, False), + ("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), + ]) + return js + + +class ClaimItemDetailSubDetail(backboneelement.BackboneElement): + """ Additional items. + + Third tier of goods and services. + """ + + resource_type = "ClaimItemDetailSubDetail" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Type of service or product. + Type `CodeableConcept` (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 + """ Net additional item cost. + Type `Money` (represented as `dict` in JSON). """ + + self.programCode = None + """ Program specific reason for item inclusion. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.quantity = None + """ Count of Products or Services. + Type `Quantity` (represented as `dict` in JSON). """ + + self.revenue = None + """ Revenue or cost center code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.sequence = None + """ Service instance. + 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). """ + + self.unitPrice = None + """ Fee, charge or cost per point. + Type `Money` (represented as `dict` in JSON). """ + + super(ClaimItemDetailSubDetail, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimItemDetailSubDetail, self).elementProperties() + js.extend([ + ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("factor", "factor", float, False, None, False), + ("modifier", "modifier", codeableconcept.CodeableConcept, True, None, False), + ("net", "net", money.Money, False, None, False), + ("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), + ]) + return js + + +class ClaimPayee(backboneelement.BackboneElement): + """ Party to be paid any benefits payable. + + The party to be reimbursed for the services. + """ + + resource_type = "ClaimPayee" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + 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). """ + + self.type = None + """ Type of party: Subscriber, Provider, other. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ClaimPayee, self).__init__(jsondict=jsondict, strict=strict) + + 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. + + Ordered list of patient procedures performed to support the adjudication. + """ + + resource_type = "ClaimProcedure" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ When the procedure was performed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.procedureCodeableConcept = None + """ Patient's list of procedures performed. + 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). """ + + self.sequence = None + """ Procedure sequence for reference. + Type `int`. """ + + super(ClaimProcedure, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimProcedure, self).elementProperties() + js.extend([ + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("procedureCodeableConcept", "procedureCodeableConcept", codeableconcept.CodeableConcept, False, "procedure", True), + ("procedureReference", "procedureReference", fhirreference.FHIRReference, False, "procedure", True), + ("sequence", "sequence", int, False, None, True), + ]) + return js + + +class ClaimRelated(backboneelement.BackboneElement): + """ Related Claims which may be revelant to processing this claimn. + + Other claims which are related to this claim such as prior claim versions + or for related services. + """ + + resource_type = "ClaimRelated" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.claim = None + """ Reference to the related claim. + Type `FHIRReference` referencing `Claim` (represented as `dict` in JSON). """ + + self.reference = None + """ Related file or case reference. + Type `Identifier` (represented as `dict` in JSON). """ + + self.relationship = None + """ How the reference claim is related. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ClaimRelated, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimRelated, self).elementProperties() + js.extend([ + ("claim", "claim", fhirreference.FHIRReference, False, None, False), + ("reference", "reference", identifier.Identifier, False, None, False), + ("relationship", "relationship", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +import sys +try: + from . import address +except ImportError: + address = sys.modules[__package__ + '.address'] +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 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 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/STU3/claim_tests.py b/fhirclient/models/STU3/claim_tests.py new file mode 100644 index 000000000..3691bae7c --- /dev/null +++ b/fhirclient/models/STU3/claim_tests.py @@ -0,0 +1,808 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import claim +from .fhirdate import FHIRDate + + +class ClaimTests(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("Claim", js["resourceType"]) + return claim.Claim(js) + + def testClaim1(self): + inst = self.instantiate_from("claim-example-institutional-rich.json") + self.assertIsNotNone(inst, "Must have instantiated a Claim instance") + self.implClaim1(inst) + + js = inst.as_json() + self.assertEqual("Claim", js["resourceType"]) + inst2 = claim.Claim(js) + self.implClaim1(inst2) + + def implClaim1(self, inst): + self.assertEqual(inst.accident.date.date, FHIRDate("2014-07-09").date) + self.assertEqual(inst.accident.date.as_json(), "2014-07-09") + 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.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.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].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].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.id, "960151") + self.assertEqual(inst.identifier[0].system, "http://happyhospital.com/claim") + self.assertEqual(inst.identifier[0].value, "96123451") + self.assertEqual(inst.insurance[0].businessArrangement, "BA987123") + 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].net.value, 125.0) + 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.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 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") + + def testClaim2(self): + inst = self.instantiate_from("claim-example-professional.json") + self.assertIsNotNone(inst, "Must have instantiated a Claim instance") + self.implClaim2(inst) + + js = inst.as_json() + self.assertEqual("Claim", js["resourceType"]) + inst2 = claim.Claim(js) + self.implClaim2(inst2) + + def implClaim2(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, "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, 75.0) + 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, 75.0) + 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 Claim
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.coding[0].code, "professional") + self.assertEqual(inst.type.coding[0].system, "http://hl7.org/fhir/ex-claimtype") + self.assertEqual(inst.use, "complete") + + def testClaim3(self): + inst = self.instantiate_from("claim-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Claim instance") + self.implClaim3(inst) + + js = inst.as_json() + self.assertEqual("Claim", js["resourceType"]) + inst2 = claim.Claim(js) + self.implClaim3(inst2) + + def implClaim3(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, "123456") + self.assertEqual(inst.diagnosis[0].sequence, 1) + self.assertEqual(inst.id, "100150") + self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/claim") + self.assertEqual(inst.identifier[0].value, "12345") + 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].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.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") + + def testClaim4(self): + inst = self.instantiate_from("claim-example-vision.json") + self.assertIsNotNone(inst, "Must have instantiated a Claim instance") + self.implClaim4(inst) + + js = inst.as_json() + self.assertEqual("Claim", js["resourceType"]) + inst2 = claim.Claim(js) + self.implClaim4(inst2) + + def implClaim4(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, "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].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, 80.0) + 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-visionservice") + 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, 80.0) + 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 Vision Claim
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.coding[0].code, "vision") + self.assertEqual(inst.type.coding[0].system, "http://hl7.org/fhir/ex-claimtype") + self.assertEqual(inst.use, "complete") + + def testClaim5(self): + inst = self.instantiate_from("claim-example-vision-glasses-3tier.json") + self.assertIsNotNone(inst, "Must have instantiated a Claim instance") + self.implClaim5(inst) + + js = inst.as_json() + self.assertEqual("Claim", js["resourceType"]) + inst2 = claim.Claim(js) + self.implClaim5(inst2) + + def implClaim5(self, inst): + self.assertEqual(inst.careTeam[0].sequence, 1) + self.assertEqual(inst.contained[0].id, "claimresponse-1") + self.assertEqual(inst.contained[1].id, "device-frame") + self.assertEqual(inst.contained[2].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, "654321") + self.assertEqual(inst.diagnosis[0].sequence, 1) + 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.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].careTeamLinkId[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://hl7.org/fhir/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://hl7.org/fhir/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://hl7.org/fhir/modifiers") + 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, 110.0) + 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://hl7.org/fhir/ex-revenue-center") + self.assertEqual(inst.item[0].detail[0].sequence, 1) + self.assertEqual(inst.item[0].detail[0].service.coding[0].code, "frame") + self.assertEqual(inst.item[0].detail[0].service.coding[0].system, "http://hl7.org/fhir/ex-visionservice") + 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.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://hl7.org/fhir/benefit-subcategory") + 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, 110.0) + 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://hl7.org/fhir/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://hl7.org/fhir/ex-revenue-center") + self.assertEqual(inst.item[0].detail[1].sequence, 2) + self.assertEqual(inst.item[0].detail[1].service.coding[0].code, "lens") + self.assertEqual(inst.item[0].detail[1].service.coding[0].system, "http://hl7.org/fhir/ex-visionservice") + 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://hl7.org/fhir/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://hl7.org/fhir/modifiers") + 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, 66.0) + 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://hl7.org/fhir/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://hl7.org/fhir/ex-revenue-center") + self.assertEqual(inst.item[0].detail[1].subDetail[0].sequence, 1) + self.assertEqual(inst.item[0].detail[1].subDetail[0].service.coding[0].code, "lens") + self.assertEqual(inst.item[0].detail[1].subDetail[0].service.coding[0].system, "http://hl7.org/fhir/ex-visionservice") + self.assertEqual(inst.item[0].detail[1].subDetail[0].unitPrice.code, "USD") + self.assertEqual(inst.item[0].detail[1].subDetail[0].unitPrice.system, "urn:iso:std:iso:4217") + 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://hl7.org/fhir/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://hl7.org/fhir/modifiers") + self.assertEqual(inst.item[0].detail[1].subDetail[1].net.code, "USD") + self.assertEqual(inst.item[0].detail[1].subDetail[1].net.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[0].detail[1].subDetail[1].net.value, 33.0) + 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://hl7.org/fhir/ex-revenue-center") + self.assertEqual(inst.item[0].detail[1].subDetail[1].sequence, 2) + self.assertEqual(inst.item[0].detail[1].subDetail[1].service.coding[0].code, "hardening") + self.assertEqual(inst.item[0].detail[1].subDetail[1].service.coding[0].system, "http://hl7.org/fhir/ex-visionservice") + self.assertEqual(inst.item[0].detail[1].subDetail[1].unitPrice.code, "USD") + self.assertEqual(inst.item[0].detail[1].subDetail[1].unitPrice.system, "urn:iso:std:iso:4217") + 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://hl7.org/fhir/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://hl7.org/fhir/modifiers") + self.assertEqual(inst.item[0].detail[1].subDetail[2].net.code, "USD") + self.assertEqual(inst.item[0].detail[1].subDetail[2].net.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[0].detail[1].subDetail[2].net.value, 11.0) + 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://hl7.org/fhir/ex-revenue-center") + self.assertEqual(inst.item[0].detail[1].subDetail[2].sequence, 3) + self.assertEqual(inst.item[0].detail[1].subDetail[2].service.coding[0].code, "UV coating") + self.assertEqual(inst.item[0].detail[1].subDetail[2].service.coding[0].system, "http://hl7.org/fhir/ex-visionservice") + self.assertEqual(inst.item[0].detail[1].subDetail[2].unitPrice.code, "USD") + self.assertEqual(inst.item[0].detail[1].subDetail[2].unitPrice.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[0].detail[1].subDetail[2].unitPrice.value, 5.0) + 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.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://hl7.org/fhir/benefit-subcategory") + self.assertEqual(inst.item[0].detail[2].factor, 0.07) + 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, 15.4) + 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://hl7.org/fhir/ex-revenue-center") + self.assertEqual(inst.item[0].detail[2].sequence, 3) + self.assertEqual(inst.item[0].detail[2].service.coding[0].code, "fst") + self.assertEqual(inst.item[0].detail[2].service.coding[0].system, "http://hl7.org/fhir/ex-visionservice") + 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.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://hl7.org/fhir/modifiers") + 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, 235.4) + self.assertEqual(inst.item[0].programCode[0].coding[0].code, "none") + self.assertEqual(inst.item[0].programCode[0].coding[0].system, "http://hl7.org/fhir/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://hl7.org/fhir/ex-revenue-center") + self.assertEqual(inst.item[0].sequence, 1) + self.assertEqual(inst.item[0].service.coding[0].code, "glasses") + self.assertEqual(inst.item[0].service.coding[0].system, "http://hl7.org/fhir/ex-visionservice") + 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, 235.4) + 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 Vision Claim for Glasses
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.coding[0].code, "vision") + self.assertEqual(inst.type.coding[0].system, "http://hl7.org/fhir/ex-claimtype") + self.assertEqual(inst.use, "complete") + + def testClaim6(self): + inst = self.instantiate_from("claim-example-institutional.json") + self.assertIsNotNone(inst, "Must have instantiated a Claim instance") + self.implClaim6(inst) + + js = inst.as_json() + self.assertEqual("Claim", js["resourceType"]) + inst2 = claim.Claim(js) + self.implClaim6(inst2) + + def implClaim6(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, "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, 125.0) + 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.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") + + def testClaim7(self): + inst = self.instantiate_from("claim-example-oral-contained.json") + self.assertIsNotNone(inst, "Must have instantiated a Claim instance") + self.implClaim7(inst) + + js = inst.as_json() + self.assertEqual("Claim", js["resourceType"]) + inst2 = claim.Claim(js) + self.implClaim7(inst2) + + 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, "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].net.value, 135.57) + 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.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") + + def testClaim8(self): + inst = self.instantiate_from("claim-example-pharmacy-medication.json") + self.assertIsNotNone(inst, "Must have instantiated a Claim instance") + self.implClaim8(inst) + + js = inst.as_json() + self.assertEqual("Claim", js["resourceType"]) + inst2 = claim.Claim(js) + 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.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.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, 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].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.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, 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") + + 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") + self.assertEqual(inst.diagnosis[0].diagnosisCodeableConcept.coding[0].code, "123457") + 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.fundsReserve.coding[0].code, "provider") + self.assertEqual(inst.id, "100153") + self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/claim") + 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].detail[0].net.value, 1000.0) + 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.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.value, 1500.0) + 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.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.value, 500.0) + 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.value, 500.0) + 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.value, 250.0) + 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.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].net.value, 9000.0) + 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.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].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].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, 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.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.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 testClaim10(self): + inst = self.instantiate_from("claim-example-oral-average.json") + self.assertIsNotNone(inst, "Must have instantiated a Claim instance") + self.implClaim10(inst) + + js = inst.as_json() + self.assertEqual("Claim", js["resourceType"]) + inst2 = claim.Claim(js) + self.implClaim10(inst2) + + 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, "123456") + self.assertEqual(inst.diagnosis[0].sequence, 1) + self.assertEqual(inst.id, "100151") + 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.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].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.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.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") + diff --git a/fhirclient/models/STU3/claimresponse.py b/fhirclient/models/STU3/claimresponse.py new file mode 100644 index 000000000..cb5995b7b --- /dev/null +++ b/fhirclient/models/STU3/claimresponse.py @@ -0,0 +1,682 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ClaimResponse) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class ClaimResponse(domainresource.DomainResource): + """ Remittance resource. + + This resource provides the adjudication details from the processing of a + Claim resource. + """ + + resource_type = "ClaimResponse" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.addItem = None + """ Insurer added line items. + List of `ClaimResponseAddItem` items (represented as `dict` in JSON). """ + + 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 + """ Processing errors. + List of `ClaimResponseError` items (represented as `dict` in JSON). """ + + self.form = None + """ Printed Form Identifier. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.identifier = None + """ Response number. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.insurance = None + """ Insurance or medical plan. + List of `ClaimResponseInsurance` items (represented as `dict` in JSON). """ + + self.insurer = None + """ Insurance issuing organization. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.item = None + """ Line items. + List of `ClaimResponseItem` items (represented as `dict` in JSON). """ + + self.outcome = None + """ complete | error | partial. + Type `CodeableConcept` (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.payeeType = None + """ Party to be paid any benefits payable. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.payment = None + """ Payment details, if paid. + Type `ClaimResponsePayment` (represented as `dict` in JSON). """ + + self.processNote = None + """ Processing notes. + 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). """ + + self.reserved = None + """ Funds reserved status. + Type `Coding` (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.totalCost = None + """ Total Cost of service from the Claim. + Type `Money` (represented as `dict` in JSON). """ + + self.unallocDeductable = None + """ Unallocated deductible. + Type `Money` (represented as `dict` in JSON). """ + + super(ClaimResponse, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimResponse, self).elementProperties() + js.extend([ + ("addItem", "addItem", ClaimResponseAddItem, True, None, False), + ("communicationRequest", "communicationRequest", fhirreference.FHIRReference, True, None, False), + ("created", "created", fhirdate.FHIRDate, False, None, False), + ("disposition", "disposition", str, False, None, False), + ("error", "error", ClaimResponseError, True, None, False), + ("form", "form", 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), + ("item", "item", ClaimResponseItem, True, None, False), + ("outcome", "outcome", codeableconcept.CodeableConcept, False, None, False), + ("patient", "patient", fhirreference.FHIRReference, False, None, False), + ("payeeType", "payeeType", codeableconcept.CodeableConcept, False, None, False), + ("payment", "payment", ClaimResponsePayment, 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), + ]) + return js + + +from . import backboneelement + +class ClaimResponseAddItem(backboneelement.BackboneElement): + """ Insurer added line items. + + The first tier service adjudications for payor added services. + """ + + resource_type = "ClaimResponseAddItem" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 `ClaimResponseItemAdjudication` items (represented as `dict` in JSON). """ + + self.category = None + """ Type of service or product. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.detail = None + """ Added items 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.modifier = None + """ Service/Product billing modifiers. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.noteNumber = None + """ List of note numbers which apply. + List of `int` items. """ + + self.revenue = None + """ Revenue or cost center code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.sequenceLinkId = None + """ Service instances. + List of `int` items. """ + + self.service = None + """ Group, Service or Product. + Type `CodeableConcept` (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), + ("detail", "detail", ClaimResponseAddItemDetail, True, None, False), + ("fee", "fee", money.Money, False, None, False), + ("modifier", "modifier", codeableconcept.CodeableConcept, True, 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), + ]) + return js + + +class ClaimResponseAddItemDetail(backboneelement.BackboneElement): + """ Added items details. + + The second tier service adjudications for payor added services. + """ + + resource_type = "ClaimResponseAddItemDetail" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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.category = None + """ Type of service or product. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.fee = None + """ Professional fee or Product charge. + Type `Money` (represented as `dict` in JSON). """ + + self.modifier = None + """ Service/Product billing modifiers. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.noteNumber = None + """ List of note numbers which apply. + List of `int` items. """ + + self.revenue = None + """ Revenue or cost center code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.service = None + """ Service or Product. + Type `CodeableConcept` (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, False), + ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("fee", "fee", money.Money, False, None, False), + ("modifier", "modifier", codeableconcept.CodeableConcept, True, None, False), + ("noteNumber", "noteNumber", int, True, None, False), + ("revenue", "revenue", codeableconcept.CodeableConcept, False, None, False), + ("service", "service", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class ClaimResponseError(backboneelement.BackboneElement): + """ Processing errors. + + Mutually exclusive with Services Provided (Item). + """ + + resource_type = "ClaimResponseError" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Error code detailing processing issues. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.detailSequenceLinkId = None + """ Detail sequence number. + Type `int`. """ + + self.sequenceLinkId = None + """ Item sequence number. + Type `int`. """ + + self.subdetailSequenceLinkId = None + """ Subdetail sequence number. + Type `int`. """ + + super(ClaimResponseError, self).__init__(jsondict=jsondict, strict=strict) + + 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), + ]) + return js + + +class ClaimResponseInsurance(backboneelement.BackboneElement): + """ Insurance or medical plan. + + Financial instrument by which payment information for health care. + """ + + resource_type = "ClaimResponseInsurance" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Business agreement. + Type `str`. """ + + self.claimResponse = None + """ Adjudication results. + Type `FHIRReference` referencing `ClaimResponse` (represented as `dict` in JSON). """ + + self.coverage = None + """ Insurance information. + Type `FHIRReference` referencing `Coverage` (represented as `dict` in JSON). """ + + self.focal = None + """ Is the focal Coverage. + Type `bool`. """ + + self.preAuthRef = None + """ Pre-Authorization/Determination Reference. + List of `str` items. """ + + self.sequence = None + """ Service instance identifier. + Type `int`. """ + + super(ClaimResponseInsurance, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimResponseInsurance, self).elementProperties() + js.extend([ + ("businessArrangement", "businessArrangement", str, False, None, False), + ("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. + + The first tier service adjudications for submitted services. + """ + + resource_type = "ClaimResponseItem" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Adjudication details. + List of `ClaimResponseItemAdjudication` items (represented as `dict` in JSON). """ + + self.detail = None + """ Detail line items. + List of `ClaimResponseItemDetail` items (represented as `dict` in JSON). """ + + self.noteNumber = None + """ List of note numbers which apply. + 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), + ("detail", "detail", ClaimResponseItemDetail, True, None, False), + ("noteNumber", "noteNumber", int, True, None, False), + ("sequenceLinkId", "sequenceLinkId", int, False, None, True), + ]) + return js + + +class ClaimResponseItemAdjudication(backboneelement.BackboneElement): + """ Adjudication details. + + The adjudication results. + """ + + resource_type = "ClaimResponseItemAdjudication" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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. + Type `Money` (represented as `dict` in JSON). """ + + self.category = None + """ Adjudication category such as co-pay, eligible, benefit, etc.. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.reason = None + """ Explanation of Adjudication outcome. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.value = None + """ Non-monetary value. + Type `float`. """ + + super(ClaimResponseItemAdjudication, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimResponseItemAdjudication, self).elementProperties() + js.extend([ + ("amount", "amount", money.Money, False, None, False), + ("category", "category", codeableconcept.CodeableConcept, False, None, True), + ("reason", "reason", codeableconcept.CodeableConcept, False, None, False), + ("value", "value", float, False, None, False), + ]) + return js + + +class ClaimResponseItemDetail(backboneelement.BackboneElement): + """ Detail line items. + + The second tier service adjudications for submitted services. + """ + + resource_type = "ClaimResponseItemDetail" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Detail level adjudication details. + List of `ClaimResponseItemAdjudication` items (represented as `dict` in JSON). """ + + self.noteNumber = None + """ List of note numbers which apply. + List of `int` items. """ + + self.sequenceLinkId = None + """ Service instance. + Type `int`. """ + + self.subDetail = None + """ Subdetail line items. + List of `ClaimResponseItemDetailSubDetail` items (represented as `dict` in JSON). """ + + super(ClaimResponseItemDetail, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimResponseItemDetail, self).elementProperties() + js.extend([ + ("adjudication", "adjudication", ClaimResponseItemAdjudication, True, None, False), + ("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. + + The third tier service adjudications for submitted services. + """ + + resource_type = "ClaimResponseItemDetailSubDetail" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Subdetail level adjudication details. + List of `ClaimResponseItemAdjudication` items (represented as `dict` in JSON). """ + + self.noteNumber = None + """ List of note numbers which apply. + List of `int` items. """ + + self.sequenceLinkId = None + """ Service instance. + Type `int`. """ + + super(ClaimResponseItemDetailSubDetail, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimResponseItemDetailSubDetail, self).elementProperties() + js.extend([ + ("adjudication", "adjudication", ClaimResponseItemAdjudication, True, None, False), + ("noteNumber", "noteNumber", int, True, None, False), + ("sequenceLinkId", "sequenceLinkId", int, False, None, True), + ]) + return js + + +class ClaimResponsePayment(backboneelement.BackboneElement): + """ Payment details, if paid. + + Payment details for the claim if the claim has been paid. + """ + + resource_type = "ClaimResponsePayment" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.adjustment = None + """ Payment adjustment for non-Claim issues. + Type `Money` (represented as `dict` in JSON). """ + + self.adjustmentReason = None + """ Explanation for the non-claim adjustment. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.amount = None + """ Payable amount after adjustment. + Type `Money` (represented as `dict` in JSON). """ + + self.date = None + """ Expected data of Payment. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.identifier = None + """ Identifier of the payment instrument. + Type `Identifier` (represented as `dict` in JSON). """ + + self.type = None + """ Partial or Complete. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ClaimResponsePayment, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimResponsePayment, self).elementProperties() + js.extend([ + ("adjustment", "adjustment", money.Money, False, None, False), + ("adjustmentReason", "adjustmentReason", codeableconcept.CodeableConcept, False, None, False), + ("amount", "amount", money.Money, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class ClaimResponseProcessNote(backboneelement.BackboneElement): + """ Processing notes. + + Note text. + """ + + resource_type = "ClaimResponseProcessNote" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Language if different from the resource. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.number = None + """ Sequence Number for this note. + Type `int`. """ + + self.text = None + """ Note explanatory text. + Type `str`. """ + + self.type = None + """ display | print | printoper. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ClaimResponseProcessNote, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimResponseProcessNote, self).elementProperties() + 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), + ]) + 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 money +except ImportError: + money = sys.modules[__package__ + '.money'] diff --git a/fhirclient/models/STU3/claimresponse_tests.py b/fhirclient/models/STU3/claimresponse_tests.py new file mode 100644 index 000000000..01d54e8a6 --- /dev/null +++ b/fhirclient/models/STU3/claimresponse_tests.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import claimresponse +from .fhirdate import FHIRDate + + +class ClaimResponseTests(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("ClaimResponse", js["resourceType"]) + return claimresponse.ClaimResponse(js) + + def testClaimResponse1(self): + inst = self.instantiate_from("claimresponse-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ClaimResponse instance") + self.implClaimResponse1(inst) + + js = inst.as_json() + self.assertEqual("ClaimResponse", js["resourceType"]) + inst2 = claimresponse.ClaimResponse(js) + self.implClaimResponse1(inst2) + + def implClaimResponse1(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.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.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].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.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.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.status, "active") + 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) + diff --git a/fhirclient/models/STU3/clinicalimpression.py b/fhirclient/models/STU3/clinicalimpression.py new file mode 100644 index 000000000..89f96eb96 --- /dev/null +++ b/fhirclient/models/STU3/clinicalimpression.py @@ -0,0 +1,248 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ClinicalImpression) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class ClinicalImpression(domainresource.DomainResource): + """ A clinical assessment performed when planning treatments and management + strategies for a patient. + + A record of a clinical assessment performed to determine what problem(s) + may affect the patient and before planning the treatments or management + strategies that are best to manage a patient's condition. Assessments are + often 1:1 with a clinical consultation / encounter, but this varies + greatly depending on the clinical workflow. This resource is called + "ClinicalImpression" rather than "ClinicalAssessment" to avoid confusion + with the recording of assessment tools such as Apgar score. + """ + + resource_type = "ClinicalImpression" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ 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). """ + + 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). """ + + self.description = None + """ Why/how the assessment was performed. + Type `str`. """ + + self.effectiveDateTime = None + """ Time of assessment. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.effectivePeriod = None + """ Time of assessment. + Type `Period` (represented as `dict` in JSON). """ + + self.finding = None + """ Possible or likely findings and diagnoses. + List of `ClinicalImpressionFinding` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Business identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.investigation = None + """ One or more sets of investigations (signs, symptions, etc.). + List of `ClinicalImpressionInvestigation` items (represented as `dict` in JSON). """ + + self.note = None + """ Comments made about the ClinicalImpression. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.previous = None + """ Reference to last assessment. + Type `FHIRReference` referencing `ClinicalImpression` (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). """ + + self.prognosisCodeableConcept = None + """ Estimate of likely outcome. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.prognosisReference = None + """ RiskAssessment expressing likely outcome. + List of `FHIRReference` items referencing `RiskAssessment` (represented as `dict` in JSON). """ + + self.protocol = None + """ Clinical Protocol followed. + List of `str` items. """ + + self.status = None + """ draft | completed | entered-in-error. + Type `str`. """ + + self.subject = None + """ Patient or group assessed. + Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ + + self.summary = None + """ Summary of the assessment. + Type `str`. """ + + 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), + ("finding", "finding", ClinicalImpressionFinding, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("investigation", "investigation", ClinicalImpressionInvestigation, True, None, False), + ("note", "note", annotation.Annotation, True, None, False), + ("previous", "previous", fhirreference.FHIRReference, False, None, False), + ("problem", "problem", fhirreference.FHIRReference, True, None, False), + ("prognosisCodeableConcept", "prognosisCodeableConcept", codeableconcept.CodeableConcept, True, None, False), + ("prognosisReference", "prognosisReference", fhirreference.FHIRReference, True, None, False), + ("protocol", "protocol", str, True, None, False), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, True), + ("summary", "summary", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class ClinicalImpressionFinding(backboneelement.BackboneElement): + """ Possible or likely findings and diagnoses. + + Specific findings or diagnoses that was considered likely or relevant to + ongoing treatment. + """ + + resource_type = "ClinicalImpressionFinding" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.basis = None + """ Which investigations support finding. + Type `str`. """ + + self.itemCodeableConcept = None + """ What was found. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.itemReference = None + """ What was found. + Type `FHIRReference` referencing `Condition, Observation` (represented as `dict` in JSON). """ + + super(ClinicalImpressionFinding, self).__init__(jsondict=jsondict, strict=strict) + + 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), + ]) + return js + + +class ClinicalImpressionInvestigation(backboneelement.BackboneElement): + """ One or more sets of investigations (signs, symptions, etc.). + + One or more sets of investigations (signs, symptions, etc.). The actual + grouping of investigations vary 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. + """ + + resource_type = "ClinicalImpressionInvestigation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 name/code for the set. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.item = None + """ Record of a specific investigation. + List of `FHIRReference` items referencing `Observation, QuestionnaireResponse, FamilyMemberHistory, DiagnosticReport, RiskAssessment, ImagingStudy` (represented as `dict` in JSON). """ + + super(ClinicalImpressionInvestigation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClinicalImpressionInvestigation, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("item", "item", fhirreference.FHIRReference, 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 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/STU3/clinicalimpression_tests.py b/fhirclient/models/STU3/clinicalimpression_tests.py new file mode 100644 index 000000000..943472e87 --- /dev/null +++ b/fhirclient/models/STU3/clinicalimpression_tests.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import clinicalimpression +from .fhirdate import FHIRDate + + +class ClinicalImpressionTests(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("ClinicalImpression", js["resourceType"]) + return clinicalimpression.ClinicalImpression(js) + + def testClinicalImpression1(self): + inst = self.instantiate_from("clinicalimpression-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ClinicalImpression instance") + self.implClinicalImpression1(inst) + + js = inst.as_json() + self.assertEqual("ClinicalImpression", js["resourceType"]) + inst2 = clinicalimpression.ClinicalImpression(js) + self.implClinicalImpression1(inst2) + + def implClinicalImpression1(self, inst): + self.assertEqual(inst.date.date, FHIRDate("2014-12-06T22:33:00+11:00").date) + self.assertEqual(inst.date.as_json(), "2014-12-06T22:33:00+11:00") + self.assertEqual(inst.description, "This 26 yo male patient is brought into ER by ambulance after being involved in a motor vehicle accident") + self.assertEqual(inst.effectivePeriod.end.date, FHIRDate("2014-12-06T22:33:00+11:00").date) + self.assertEqual(inst.effectivePeriod.end.as_json(), "2014-12-06T22:33:00+11:00") + self.assertEqual(inst.effectivePeriod.start.date, FHIRDate("2014-12-06T20:00:00+11:00").date) + self.assertEqual(inst.effectivePeriod.start.as_json(), "2014-12-06T20:00:00+11:00") + self.assertEqual(inst.finding[0].itemCodeableConcept.coding[0].code, "850.0") + self.assertEqual(inst.finding[0].itemCodeableConcept.coding[0].system, "http://hl7.org/fhir/sid/icd-9") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier[0].value, "12345") + self.assertEqual(inst.investigation[0].code.text, "Initial Examination") + 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/STU3/codeableconcept.py b/fhirclient/models/STU3/codeableconcept.py new file mode 100644 index 000000000..75f21bc29 --- /dev/null +++ b/fhirclient/models/STU3/codeableconcept.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/CodeableConcept) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class CodeableConcept(element.Element): + """ Concept - reference to a terminology or just text. + + A concept that may be defined by a formal reference to a terminology or + ontology or may be provided by text. + """ + + resource_type = "CodeableConcept" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.coding = None + """ Code defined by a terminology system. + List of `Coding` items (represented as `dict` in JSON). """ + + self.text = None + """ Plain text representation of the concept. + Type `str`. """ + + super(CodeableConcept, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CodeableConcept, self).elementProperties() + js.extend([ + ("coding", "coding", coding.Coding, True, None, False), + ("text", "text", str, False, None, False), + ]) + return js + + +import sys +try: + from . import coding +except ImportError: + coding = sys.modules[__package__ + '.coding'] diff --git a/fhirclient/models/STU3/codesystem.py b/fhirclient/models/STU3/codesystem.py new file mode 100644 index 000000000..ee7357c81 --- /dev/null +++ b/fhirclient/models/STU3/codesystem.py @@ -0,0 +1,439 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/CodeSystem) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class CodeSystem(domainresource.DomainResource): + """ A set of codes drawn from one or more code systems. + + A code system resource specifies a set of codes drawn from one or more code + systems. + """ + + resource_type = "CodeSystem" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.caseSensitive = None + """ If code comparison is case sensitive. + Type `bool`. """ + + self.compositional = None + """ If code system defines a post-composition grammar. + Type `bool`. """ + + self.concept = None + """ Concepts in the code system. + List of `CodeSystemConcept` items (represented as `dict` in JSON). """ + + self.contact = None + """ Contact details for the publisher. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.content = None + """ not-present | example | fragment | complete. + Type `str`. """ + + self.copyright = None + """ Use and/or publishing restrictions. + Type `str`. """ + + self.count = None + """ Total concepts in the code system. + Type `int`. """ + + self.date = None + """ Date this was last changed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Natural language description of the code system. + Type `str`. """ + + self.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.filter = None + """ Filter that can be used in a value set. + List of `CodeSystemFilter` items (represented as `dict` in JSON). """ + + self.hierarchyMeaning = None + """ grouped-by | is-a | part-of | classified-with. + Type `str`. """ + + self.identifier = None + """ Additional identifier for the code system. + Type `Identifier` (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ Intended jurisdiction for code system (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.name = None + """ Name for this code system (computer friendly). + Type `str`. """ + + self.property = None + """ Additional information supplied about each concept. + List of `CodeSystemProperty` items (represented as `dict` in JSON). """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this code system is defined. + Type `str`. """ + + self.status = None + """ draft | active | retired | unknown. + 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). + Type `str`. """ + + self.useContext = None + """ Context 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. + Type `str`. """ + + self.version = None + """ Business version of the code system (Coding.version). + Type `str`. """ + + self.versionNeeded = None + """ If definitions are not stable. + Type `bool`. """ + + super(CodeSystem, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CodeSystem, self).elementProperties() + js.extend([ + ("caseSensitive", "caseSensitive", bool, False, None, False), + ("compositional", "compositional", bool, False, None, False), + ("concept", "concept", CodeSystemConcept, True, None, False), + ("contact", "contact", contactdetail.ContactDetail, True, None, False), + ("content", "content", str, False, None, True), + ("copyright", "copyright", str, False, None, False), + ("count", "count", int, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("description", "description", str, False, None, False), + ("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), + ("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), + ("title", "title", str, False, None, False), + ("url", "url", str, False, None, False), + ("useContext", "useContext", usagecontext.UsageContext, True, None, False), + ("valueSet", "valueSet", str, False, None, False), + ("version", "version", str, False, None, False), + ("versionNeeded", "versionNeeded", bool, False, None, False), + ]) + return js + + +from . import backboneelement + +class CodeSystemConcept(backboneelement.BackboneElement): + """ Concepts in the code system. + + 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. + """ + + resource_type = "CodeSystemConcept" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 that identifies concept. + Type `str`. """ + + self.concept = None + """ Child Concepts (is-a/contains/categorizes). + List of `CodeSystemConcept` items (represented as `dict` in JSON). """ + + self.definition = None + """ Formal definition. + Type `str`. """ + + self.designation = None + """ Additional representations for the concept. + List of `CodeSystemConceptDesignation` items (represented as `dict` in JSON). """ + + self.display = None + """ Text to display to the user. + Type `str`. """ + + self.property = None + """ Property value for the concept. + List of `CodeSystemConceptProperty` items (represented as `dict` in JSON). """ + + super(CodeSystemConcept, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CodeSystemConcept, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("concept", "concept", CodeSystemConcept, True, None, False), + ("definition", "definition", str, False, None, False), + ("designation", "designation", CodeSystemConceptDesignation, True, None, False), + ("display", "display", str, False, None, False), + ("property", "property", CodeSystemConceptProperty, True, None, False), + ]) + return js + + +class CodeSystemConceptDesignation(backboneelement.BackboneElement): + """ Additional representations for the concept. + + Additional representations for the concept - other languages, aliases, + specialized purposes, used for particular purposes, etc. + """ + + resource_type = "CodeSystemConceptDesignation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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. + Type `str`. """ + + self.use = None + """ Details how this designation would be used. + Type `Coding` (represented as `dict` in JSON). """ + + self.value = None + """ The text value for this designation. + Type `str`. """ + + super(CodeSystemConceptDesignation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CodeSystemConceptDesignation, self).elementProperties() + js.extend([ + ("language", "language", str, False, None, False), + ("use", "use", coding.Coding, False, None, False), + ("value", "value", str, False, None, True), + ]) + return js + + +class CodeSystemConceptProperty(backboneelement.BackboneElement): + """ Property value for the concept. + + A property value for this concept. + """ + + resource_type = "CodeSystemConceptProperty" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Reference to CodeSystem.property.code. + Type `str`. """ + + self.valueBoolean = None + """ Value of the property for this concept. + Type `bool`. """ + + self.valueCode = None + """ Value of the property for this concept. + Type `str`. """ + + self.valueCoding = None + """ Value of the property for this concept. + Type `Coding` (represented as `dict` in JSON). """ + + self.valueDateTime = None + """ Value of the property for this concept. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueInteger = None + """ Value of the property for this concept. + Type `int`. """ + + self.valueString = None + """ Value of the property for this concept. + Type `str`. """ + + super(CodeSystemConceptProperty, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CodeSystemConceptProperty, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("valueBoolean", "valueBoolean", bool, False, "value", True), + ("valueCode", "valueCode", str, False, "value", True), + ("valueCoding", "valueCoding", coding.Coding, False, "value", True), + ("valueDateTime", "valueDateTime", fhirdate.FHIRDate, False, "value", True), + ("valueInteger", "valueInteger", int, False, "value", True), + ("valueString", "valueString", str, False, "value", True), + ]) + return js + + +class CodeSystemFilter(backboneelement.BackboneElement): + """ Filter that can be used in a value set. + + A filter that can be used in a value set compose statement when selecting + concepts using a filter. + """ + + resource_type = "CodeSystemFilter" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 that identifies the filter. + Type `str`. """ + + self.description = None + """ How or why the filter is used. + Type `str`. """ + + self.operator = None + """ Operators that can be used with filter. + List of `str` items. """ + + self.value = None + """ What to use for the value. + Type `str`. """ + + super(CodeSystemFilter, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CodeSystemFilter, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("description", "description", str, False, None, False), + ("operator", "operator", str, True, None, True), + ("value", "value", str, False, None, True), + ]) + return js + + +class CodeSystemProperty(backboneelement.BackboneElement): + """ Additional information supplied about each concept. + + A property defines an additional slot through which additional information + can be provided about a concept. + """ + + resource_type = "CodeSystemProperty" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Identifies the property on the concepts, and when referred to in + operations. + Type `str`. """ + + self.description = None + """ Why the property is defined, and/or what it conveys. + Type `str`. """ + + self.type = None + """ code | Coding | string | integer | boolean | dateTime. + Type `str`. """ + + self.uri = None + """ Formal identifier for the property. + Type `str`. """ + + super(CodeSystemProperty, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CodeSystemProperty, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("description", "description", str, False, None, False), + ("type", "type", str, False, None, True), + ("uri", "uri", str, 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 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/STU3/codesystem_tests.py b/fhirclient/models/STU3/codesystem_tests.py new file mode 100644 index 000000000..48bf52c86 --- /dev/null +++ b/fhirclient/models/STU3/codesystem_tests.py @@ -0,0 +1,169 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import codesystem +from .fhirdate import FHIRDate + + +class CodeSystemTests(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("CodeSystem", js["resourceType"]) + return codesystem.CodeSystem(js) + + def testCodeSystem1(self): + inst = self.instantiate_from("codesystem-list-example-codes.json") + self.assertIsNotNone(inst, "Must have instantiated a CodeSystem instance") + self.implCodeSystem1(inst) + + js = inst.as_json() + self.assertEqual("CodeSystem", js["resourceType"]) + inst2 = codesystem.CodeSystem(js) + self.implCodeSystem1(inst2) + + def implCodeSystem1(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-04-19T07:44:43.294+10:00").date) + self.assertEqual(inst.meta.lastUpdated.as_json(), "2017-04-19T07:44:43.294+10: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.1") + + def testCodeSystem2(self): + inst = self.instantiate_from("codesystem-example-summary.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.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, "not-present") + self.assertEqual(inst.count, 92) + self.assertEqual(inst.description, "This is an example code system summary for the ACME codes for body site.") + self.assertTrue(inst.experimental) + self.assertEqual(inst.id, "summary") + self.assertEqual(inst.jurisdiction[0].coding[0].code, "CA") + self.assertEqual(inst.jurisdiction[0].coding[0].system, "urn:iso:std:iso:3166") + self.assertEqual(inst.name, "Code system summary example for ACME body sites") + 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/CodeSystem/summary") + self.assertEqual(inst.useContext[0].code.code, "species") + self.assertEqual(inst.useContext[0].code.system, "http://example.org/CodeSystem/contexttype") + 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") + + def testCodeSystem3(self): + inst = self.instantiate_from("codesystem-example.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, "chol-mmol") + self.assertEqual(inst.concept[0].definition, "Serum Cholesterol, in mmol/L") + self.assertEqual(inst.concept[0].designation[0].use.code, "internal-label") + self.assertEqual(inst.concept[0].designation[0].use.system, "http://acme.com/config/fhir/codesystems/internal") + self.assertEqual(inst.concept[0].designation[0].value, "From ACME POC Testing") + self.assertEqual(inst.concept[0].display, "SChol (mmol/L)") + self.assertEqual(inst.concept[1].code, "chol-mass") + self.assertEqual(inst.concept[1].definition, "Serum Cholesterol, in mg/L") + self.assertEqual(inst.concept[1].designation[0].use.code, "internal-label") + self.assertEqual(inst.concept[1].designation[0].use.system, "http://acme.com/config/fhir/codesystems/internal") + self.assertEqual(inst.concept[1].designation[0].value, "From Paragon Labs") + self.assertEqual(inst.concept[1].display, "SChol (mg/L)") + self.assertEqual(inst.concept[2].code, "chol") + self.assertEqual(inst.concept[2].definition, "Serum Cholesterol") + self.assertEqual(inst.concept[2].designation[0].use.code, "internal-label") + self.assertEqual(inst.concept[2].designation[0].use.system, "http://acme.com/config/fhir/codesystems/internal") + self.assertEqual(inst.concept[2].designation[0].value, "Obdurate Labs uses this with both kinds of units...") + self.assertEqual(inst.concept[2].display, "SChol") + 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, "complete") + self.assertEqual(inst.date.date, FHIRDate("2016-01-28").date) + 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.id, "example") + self.assertEqual(inst.identifier.system, "http://acme.com/identifiers/codesystems") + self.assertEqual(inst.identifier.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.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.url, "http://hl7.org/fhir/CodeSystem/example") + self.assertEqual(inst.version, "20160128") + diff --git a/fhirclient/models/STU3/coding.py b/fhirclient/models/STU3/coding.py new file mode 100644 index 000000000..db40bdfe0 --- /dev/null +++ b/fhirclient/models/STU3/coding.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Coding) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Coding(element.Element): + """ A reference to a code defined by a terminology system. + """ + + resource_type = "Coding" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Symbol in syntax defined by the system. + Type `str`. """ + + self.display = None + """ Representation defined by the system. + Type `str`. """ + + self.system = None + """ Identity of the terminology system. + Type `str`. """ + + self.userSelected = None + """ If this coding was chosen directly by the user. + Type `bool`. """ + + self.version = None + """ Version of the system - if relevant. + Type `str`. """ + + super(Coding, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Coding, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, False), + ("display", "display", str, False, None, False), + ("system", "system", str, False, None, False), + ("userSelected", "userSelected", bool, False, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + diff --git a/fhirclient/models/STU3/communication.py b/fhirclient/models/STU3/communication.py new file mode 100644 index 000000000..725f15fc8 --- /dev/null +++ b/fhirclient/models/STU3/communication.py @@ -0,0 +1,204 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Communication) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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 + reportable condition. + """ + + resource_type = "Communication" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.basedOn = None + """ Request fulfilled by this communication. + List of `FHIRReference` items referencing `Resource` (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.identifier = None + """ Unique identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + 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). """ + + self.payload = None + """ Message payload. + List of `CommunicationPayload` items (represented as `dict` in JSON). """ + + 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). """ + + self.received = None + """ When received. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.recipient = None + """ Message recipient. + List of `FHIRReference` items referencing `Device, Organization, Patient, Practitioner, RelatedPerson, Group` (represented as `dict` in JSON). """ + + self.sender = None + """ Message sender. + Type `FHIRReference` referencing `Device, Organization, Patient, Practitioner, RelatedPerson` (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. + Type `str`. """ + + 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). """ + + super(Communication, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Communication, self).elementProperties() + js.extend([ + ("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), + ("identifier", "identifier", identifier.Identifier, 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), + ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), + ("reasonReference", "reasonReference", fhirreference.FHIRReference, True, None, False), + ("received", "received", fhirdate.FHIRDate, False, None, False), + ("recipient", "recipient", fhirreference.FHIRReference, True, None, False), + ("sender", "sender", fhirreference.FHIRReference, False, None, False), + ("sent", "sent", fhirdate.FHIRDate, False, None, False), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ("topic", "topic", fhirreference.FHIRReference, True, None, False), + ]) + return js + + +from . import backboneelement + +class CommunicationPayload(backboneelement.BackboneElement): + """ Message payload. + + Text, attachment(s), or resource(s) that was communicated to the recipient. + """ + + resource_type = "CommunicationPayload" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.contentAttachment = None + """ Message part content. + Type `Attachment` (represented as `dict` in JSON). """ + + self.contentReference = None + """ Message part content. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.contentString = None + """ Message part content. + Type `str`. """ + + super(CommunicationPayload, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CommunicationPayload, self).elementProperties() + js.extend([ + ("contentAttachment", "contentAttachment", attachment.Attachment, False, "content", True), + ("contentReference", "contentReference", fhirreference.FHIRReference, False, "content", True), + ("contentString", "contentString", str, False, "content", True), + ]) + return js + + +import sys +try: + from . import annotation +except ImportError: + annotation = sys.modules[__package__ + '.annotation'] +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'] diff --git a/fhirclient/models/STU3/communication_tests.py b/fhirclient/models/STU3/communication_tests.py new file mode 100644 index 000000000..b9fdd374e --- /dev/null +++ b/fhirclient/models/STU3/communication_tests.py @@ -0,0 +1,123 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import communication +from .fhirdate import FHIRDate + + +class CommunicationTests(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("Communication", js["resourceType"]) + return communication.Communication(js) + + def testCommunication1(self): + inst = self.instantiate_from("communication-example-fm-attachment.json") + self.assertIsNotNone(inst, "Must have instantiated a Communication instance") + self.implCommunication1(inst) + + js = inst.as_json() + self.assertEqual("Communication", js["resourceType"]) + inst2 = communication.Communication(js) + self.implCommunication1(inst2) + + def implCommunication1(self, inst): + self.assertEqual(inst.category[0].coding[0].code, "SolicitedAttachment") + self.assertEqual(inst.category[0].coding[0].system, "http://acme.org/messagetypes") + 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.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") + self.assertEqual(inst.payload[0].contentAttachment.data, "SGVsbG8=") + self.assertEqual(inst.payload[0].contentAttachment.title, "accident notes 20100201.pdf") + self.assertEqual(inst.payload[1].contentAttachment.contentType, "application/pdf") + self.assertEqual(inst.payload[1].contentAttachment.creation.date, FHIRDate("2010-02-01T10:57:34+01:00").date) + 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.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") + self.assertEqual(inst.text.div, "
Attachment which is unsolicited
") + self.assertEqual(inst.text.status, "generated") + + def testCommunication2(self): + inst = self.instantiate_from("communication-example-fm-solicited-attachment.json") + self.assertIsNotNone(inst, "Must have instantiated a Communication instance") + self.implCommunication2(inst) + + js = inst.as_json() + self.assertEqual("Communication", js["resourceType"]) + inst2 = communication.Communication(js) + self.implCommunication2(inst2) + + def implCommunication2(self, inst): + self.assertEqual(inst.category[0].coding[0].code, "SolicitedAttachment") + self.assertEqual(inst.category[0].coding[0].system, "http://acme.org/messagetypes") + self.assertEqual(inst.contained[0].id, "provider") + self.assertEqual(inst.contained[1].id, "payor") + self.assertEqual(inst.contained[2].id, "request") + 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.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") + self.assertEqual(inst.payload[0].contentAttachment.data, "SGVsbG8=") + self.assertEqual(inst.payload[0].contentAttachment.title, "accident notes 20100201.pdf") + self.assertEqual(inst.payload[1].contentAttachment.contentType, "application/pdf") + self.assertEqual(inst.payload[1].contentAttachment.creation.date, FHIRDate("2010-02-01T10:57:34+01:00").date) + 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.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") + self.assertEqual(inst.text.div, "
Attachment in response to a Request
") + self.assertEqual(inst.text.status, "generated") + + def testCommunication3(self): + inst = self.instantiate_from("communication-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Communication instance") + self.implCommunication3(inst) + + js = inst.as_json() + self.assertEqual("Communication", js["resourceType"]) + inst2 = communication.Communication(js) + self.implCommunication3(inst2) + + def implCommunication3(self, inst): + self.assertEqual(inst.category[0].coding[0].code, "Alert") + self.assertEqual(inst.category[0].coding[0].system, "http://acme.org/messagetypes") + self.assertEqual(inst.category[0].text, "Alert") + self.assertEqual(inst.id, "example") + 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.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].text, "written") + 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") + self.assertEqual(inst.sent.date, FHIRDate("2014-12-12T18:01:10-08:00").date) + self.assertEqual(inst.sent.as_json(), "2014-12-12T18:01:10-08:00") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.div, "
Patient has very high serum potassium
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/STU3/communicationrequest.py b/fhirclient/models/STU3/communicationrequest.py new file mode 100644 index 000000000..4d52117ad --- /dev/null +++ b/fhirclient/models/STU3/communicationrequest.py @@ -0,0 +1,249 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/CommunicationRequest) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class CommunicationRequest(domainresource.DomainResource): + """ A request for information to be sent to a receiver. + + A request to convey information; e.g. the CDS system proposes that an alert + be sent to a responsible provider, the CDS system proposes that the public + health agency be notified about a reportable condition. + """ + + resource_type = "CommunicationRequest" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ 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). """ + + 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.groupIdentifier = None + """ Composite request this is part of. + Type `Identifier` (represented as `dict` in JSON). """ + + self.identifier = None + """ Unique identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.medium = None + """ A channel of communication. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.note = None + """ Comments made about communication request. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.occurrenceDateTime = None + """ When scheduled. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.occurrencePeriod = None + """ When scheduled. + Type `Period` (represented as `dict` in JSON). """ + + self.payload = None + """ Message payload. + List of `CommunicationRequestPayload` items (represented as `dict` in JSON). """ + + self.priority = None + """ Message urgency. + Type `str`. """ + + self.reasonCode = None + """ Why is communication needed?. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.reasonReference = None + """ Why is communication needed?. + List of `FHIRReference` items referencing `Condition, Observation` (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). """ + + self.replaces = None + """ Request(s) replaced by this request. + List of `FHIRReference` items referencing `CommunicationRequest` (represented as `dict` in JSON). """ + + self.requester = None + """ Who/what is requesting service. + Type `CommunicationRequestRequester` (represented as `dict` in JSON). """ + + self.sender = None + """ Message sender. + Type `FHIRReference` referencing `Device, Organization, Patient, Practitioner, RelatedPerson` (represented as `dict` in JSON). """ + + self.status = None + """ draft | active | suspended | cancelled | completed | entered-in- + error | unknown. + Type `str`. """ + + 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). """ + + super(CommunicationRequest, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CommunicationRequest, self).elementProperties() + js.extend([ + ("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), + ("groupIdentifier", "groupIdentifier", identifier.Identifier, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("medium", "medium", codeableconcept.CodeableConcept, True, None, False), + ("note", "note", annotation.Annotation, True, None, False), + ("occurrenceDateTime", "occurrenceDateTime", fhirdate.FHIRDate, False, "occurrence", False), + ("occurrencePeriod", "occurrencePeriod", period.Period, False, "occurrence", False), + ("payload", "payload", CommunicationRequestPayload, True, None, 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), + ("replaces", "replaces", fhirreference.FHIRReference, True, None, False), + ("requester", "requester", CommunicationRequestRequester, False, None, False), + ("sender", "sender", fhirreference.FHIRReference, False, None, False), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ("topic", "topic", fhirreference.FHIRReference, True, None, False), + ]) + return js + + +from . import backboneelement + +class CommunicationRequestPayload(backboneelement.BackboneElement): + """ Message payload. + + Text, attachment(s), or resource(s) to be communicated to the recipient. + """ + + resource_type = "CommunicationRequestPayload" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.contentAttachment = None + """ Message part content. + Type `Attachment` (represented as `dict` in JSON). """ + + self.contentReference = None + """ Message part content. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.contentString = None + """ Message part content. + Type `str`. """ + + super(CommunicationRequestPayload, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CommunicationRequestPayload, self).elementProperties() + js.extend([ + ("contentAttachment", "contentAttachment", attachment.Attachment, False, "content", True), + ("contentReference", "contentReference", fhirreference.FHIRReference, False, "content", True), + ("contentString", "contentString", str, False, "content", True), + ]) + 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 +except ImportError: + annotation = sys.modules[__package__ + '.annotation'] +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 period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/STU3/communicationrequest_tests.py b/fhirclient/models/STU3/communicationrequest_tests.py new file mode 100644 index 000000000..cbbd15401 --- /dev/null +++ b/fhirclient/models/STU3/communicationrequest_tests.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import communicationrequest +from .fhirdate import FHIRDate + + +class CommunicationRequestTests(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("CommunicationRequest", js["resourceType"]) + return communicationrequest.CommunicationRequest(js) + + def testCommunicationRequest1(self): + inst = self.instantiate_from("communicationrequest-example.json") + self.assertIsNotNone(inst, "Must have instantiated a CommunicationRequest instance") + self.implCommunicationRequest1(inst) + + js = inst.as_json() + self.assertEqual("CommunicationRequest", js["resourceType"]) + inst2 = communicationrequest.CommunicationRequest(js) + self.implCommunicationRequest1(inst2) + + def implCommunicationRequest1(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") + + 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") + self.assertEqual(inst.category[0].coding[0].system, "http://acme.org/messagetypes") + self.assertEqual(inst.contained[0].id, "provider") + self.assertEqual(inst.contained[1].id, "payor") + self.assertEqual(inst.contained[2].id, "requester") + self.assertEqual(inst.groupIdentifier.value, "12345") + self.assertEqual(inst.id, "fm-solicit") + self.assertEqual(inst.identifier[0].system, "http://www.jurisdiction.com/insurer/123456") + 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].text, "written") + 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.") + self.assertEqual(inst.priority, "routine") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.div, "
Request for Accident Report
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/STU3/compartmentdefinition.py b/fhirclient/models/STU3/compartmentdefinition.py new file mode 100644 index 000000000..109463d8f --- /dev/null +++ b/fhirclient/models/STU3/compartmentdefinition.py @@ -0,0 +1,170 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/CompartmentDefinition) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class CompartmentDefinition(domainresource.DomainResource): + """ Compartment Definition for a resource. + + A compartment definition that defines how resources are accessed on a + server. + """ + + resource_type = "CompartmentDefinition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Patient | Encounter | RelatedPerson | Practitioner | Device. + Type `str`. """ + + 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 compartment definition. + Type `str`. """ + + self.experimental = None + """ 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`. """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this compartment definition is defined. + Type `str`. """ + + self.resource = None + """ How a resource is related to the compartment. + List of `CompartmentDefinitionResource` items (represented as `dict` in JSON). """ + + self.search = None + """ Whether the search syntax is supported. + Type `bool`. """ + + self.status = None + """ 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). + Type `str`. """ + + self.useContext = None + """ Context the content is intended to support. + List of `UsageContext` items (represented as `dict` in JSON). """ + + super(CompartmentDefinition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CompartmentDefinition, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("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), + ("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), + ]) + return js + + +from . import backboneelement + +class CompartmentDefinitionResource(backboneelement.BackboneElement): + """ How a resource is related to the compartment. + + Information about how a resource is related to the compartment. + """ + + resource_type = "CompartmentDefinitionResource" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Name of resource type. + Type `str`. """ + + self.documentation = None + """ Additional documentation about the resource and compartment. + Type `str`. """ + + self.param = None + """ Search Parameter Name, or chained parameters. + List of `str` items. """ + + super(CompartmentDefinitionResource, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CompartmentDefinitionResource, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("documentation", "documentation", str, False, None, False), + ("param", "param", str, 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 fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] +try: + from . import usagecontext +except ImportError: + usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/STU3/compartmentdefinition_tests.py b/fhirclient/models/STU3/compartmentdefinition_tests.py new file mode 100644 index 000000000..2a080bc52 --- /dev/null +++ b/fhirclient/models/STU3/compartmentdefinition_tests.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import compartmentdefinition +from .fhirdate import FHIRDate + + +class CompartmentDefinitionTests(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("CompartmentDefinition", js["resourceType"]) + return compartmentdefinition.CompartmentDefinition(js) + + def testCompartmentDefinition1(self): + inst = self.instantiate_from("compartmentdefinition-example.json") + self.assertIsNotNone(inst, "Must have instantiated a CompartmentDefinition instance") + self.implCompartmentDefinition1(inst) + + js = inst.as_json() + self.assertEqual("CompartmentDefinition", js["resourceType"]) + inst2 = compartmentdefinition.CompartmentDefinition(js) + self.implCompartmentDefinition1(inst2) + + def implCompartmentDefinition1(self, inst): + self.assertEqual(inst.code, "Device") + self.assertEqual(inst.contact[0].name, "[string]") + 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-02-24").date) + self.assertEqual(inst.date.as_json(), "2017-02-24") + 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.") + self.assertEqual(inst.resource[0].code, "Communication") + self.assertEqual(inst.resource[0].documentation, "The device used as the message sender and recipient") + self.assertEqual(inst.resource[0].param[0], "sender") + self.assertEqual(inst.resource[0].param[1], "recipient") + self.assertEqual(inst.resource[1].code, "CommunicationRequest") + self.assertEqual(inst.resource[1].documentation, "The device used as the message sender and recipient") + self.assertEqual(inst.resource[1].param[0], "sender") + self.assertEqual(inst.resource[1].param[1], "recipient") + 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].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/STU3/composition.py b/fhirclient/models/STU3/composition.py new file mode 100644 index 000000000..f719c6ec2 --- /dev/null +++ b/fhirclient/models/STU3/composition.py @@ -0,0 +1,330 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Composition) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Composition(domainresource.DomainResource): + """ A set of resources composed into a single coherent clinical statement with + clinical attestation. + + A set of healthcare-related information that is assembled together into a + single logical document 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. + """ + + resource_type = "Composition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.attester = None + """ Attests to accuracy of composition. + List of `CompositionAttester` items (represented as `dict` in JSON). """ + + self.author = None + """ Who and/or what authored the composition. + List of `FHIRReference` items referencing `Practitioner, Device, Patient, RelatedPerson` (represented as `dict` in JSON). """ + + self.class_fhir = None + """ Categorization of Composition. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.confidentiality = None + """ As defined by affinity domain. + Type `str`. """ + + self.custodian = None + """ Organization which maintains the composition. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.date = None + """ Composition editing time. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.encounter = None + """ Context of the Composition. + Type `FHIRReference` referencing `Encounter` (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). + Type `Identifier` (represented as `dict` in JSON). """ + + self.relatesTo = None + """ Relationships to other compositions/documents. + List of `CompositionRelatesTo` items (represented as `dict` in JSON). """ + + self.section = None + """ Composition is broken into sections. + List of `CompositionSection` items (represented as `dict` in JSON). """ + + self.status = None + """ preliminary | final | amended | entered-in-error. + Type `str`. """ + + self.subject = None + """ Who and/or what the composition is about. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.title = None + """ Human Readable name/title. + Type `str`. """ + + self.type = None + """ Kind of composition (LOINC if possible). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(Composition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Composition, self).elementProperties() + js.extend([ + ("attester", "attester", CompositionAttester, True, None, False), + ("author", "author", fhirreference.FHIRReference, True, None, True), + ("class_fhir", "class", codeableconcept.CodeableConcept, False, None, False), + ("confidentiality", "confidentiality", str, False, None, False), + ("custodian", "custodian", fhirreference.FHIRReference, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, True), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), + ("event", "event", CompositionEvent, True, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("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), + ("title", "title", str, False, None, True), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +from . import backboneelement + +class CompositionAttester(backboneelement.BackboneElement): + """ Attests to accuracy of composition. + + A participant who has attested to the accuracy of the composition/document. + """ + + resource_type = "CompositionAttester" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ personal | professional | legal | official. + List of `str` items. """ + + self.party = None + """ Who attested the composition. + Type `FHIRReference` referencing `Patient, Practitioner, Organization` (represented as `dict` in JSON). """ + + self.time = None + """ When the composition was attested. + Type `FHIRDate` (represented as `str` in JSON). """ + + super(CompositionAttester, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CompositionAttester, self).elementProperties() + js.extend([ + ("mode", "mode", str, True, None, True), + ("party", "party", fhirreference.FHIRReference, False, None, False), + ("time", "time", fhirdate.FHIRDate, False, None, False), + ]) + return js + + +class CompositionEvent(backboneelement.BackboneElement): + """ The clinical service(s) being documented. + + The clinical service, such as a colonoscopy or an appendectomy, being + documented. + """ + + resource_type = "CompositionEvent" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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(s) that apply to the event being documented. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.detail = None + """ The event(s) being documented. + List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + + self.period = None + """ The period covered by the documentation. + Type `Period` (represented as `dict` in JSON). """ + + super(CompositionEvent, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CompositionEvent, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, True, None, False), + ("detail", "detail", fhirreference.FHIRReference, True, None, False), + ("period", "period", period.Period, False, None, False), + ]) + return js + + +class CompositionRelatesTo(backboneelement.BackboneElement): + """ Relationships to other compositions/documents. + + Relationships that this composition has with other compositions or + documents that already exist. + """ + + resource_type = "CompositionRelatesTo" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ replaces | transforms | signs | appends. + Type `str`. """ + + self.targetIdentifier = None + """ Target of the relationship. + Type `Identifier` (represented as `dict` in JSON). """ + + self.targetReference = None + """ Target of the relationship. + Type `FHIRReference` referencing `Composition` (represented as `dict` in JSON). """ + + super(CompositionRelatesTo, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CompositionRelatesTo, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("targetIdentifier", "targetIdentifier", identifier.Identifier, False, "target", True), + ("targetReference", "targetReference", fhirreference.FHIRReference, False, "target", True), + ]) + return js + + +class CompositionSection(backboneelement.BackboneElement): + """ Composition is broken into sections. + + The root of the sections that make up the composition. + """ + + resource_type = "CompositionSection" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Classification of section (recommended). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.emptyReason = None + """ Why the section is empty. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.entry = None + """ A reference to data that supports this section. + List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + + self.mode = None + """ working | snapshot | changes. + Type `str`. """ + + self.orderedBy = None + """ Order of section entries. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.section = None + """ Nested Section. + List of `CompositionSection` items (represented as `dict` in JSON). """ + + self.text = None + """ Text summary of the section, for human interpretation. + Type `Narrative` (represented as `dict` in JSON). """ + + self.title = None + """ Label for section (e.g. for ToC). + Type `str`. """ + + super(CompositionSection, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CompositionSection, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("emptyReason", "emptyReason", codeableconcept.CodeableConcept, False, None, False), + ("entry", "entry", fhirreference.FHIRReference, True, None, False), + ("mode", "mode", str, False, None, False), + ("orderedBy", "orderedBy", codeableconcept.CodeableConcept, False, None, False), + ("section", "section", CompositionSection, True, None, False), + ("text", "text", narrative.Narrative, False, None, False), + ("title", "title", 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 narrative +except ImportError: + narrative = sys.modules[__package__ + '.narrative'] +try: + from . import period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/STU3/composition_tests.py b/fhirclient/models/STU3/composition_tests.py new file mode 100644 index 000000000..229ac742d --- /dev/null +++ b/fhirclient/models/STU3/composition_tests.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import composition +from .fhirdate import FHIRDate + + +class CompositionTests(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("Composition", js["resourceType"]) + return composition.Composition(js) + + def testComposition1(self): + inst = self.instantiate_from("composition-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Composition instance") + self.implComposition1(inst) + + js = inst.as_json() + self.assertEqual("Composition", js["resourceType"]) + inst2 = composition.Composition(js) + self.implComposition1(inst2) + + def implComposition1(self, inst): + self.assertEqual(inst.attester[0].mode[0], "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.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].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) + self.assertEqual(inst.event[0].period.start.as_json(), "2010-07-18") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier.system, "http://healthintersections.com.au/test") + self.assertEqual(inst.identifier.value, "1") + 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") + self.assertEqual(inst.relatesTo[1].targetIdentifier.value, "ABC123") + self.assertEqual(inst.section[0].code.coding[0].code, "11348-0") + self.assertEqual(inst.section[0].code.coding[0].display, "History of past illness Narrative") + self.assertEqual(inst.section[0].code.coding[0].system, "http://loinc.org") + 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].text.status, "generated") + self.assertEqual(inst.section[0].title, "History of present illness") + self.assertEqual(inst.section[1].code.coding[0].code, "10157-6") + self.assertEqual(inst.section[1].code.coding[0].display, "History of family member diseases Narrative") + 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].mode, "snapshot") + self.assertEqual(inst.section[1].text.status, "generated") + self.assertEqual(inst.section[1].title, "History of family member diseases") + self.assertEqual(inst.status, "final") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "Consultation Note") + self.assertEqual(inst.type.coding[0].code, "11488-4") + self.assertEqual(inst.type.coding[0].display, "Consult note") + self.assertEqual(inst.type.coding[0].system, "http://loinc.org") + diff --git a/fhirclient/models/STU3/conceptmap.py b/fhirclient/models/STU3/conceptmap.py new file mode 100644 index 000000000..6681e6d08 --- /dev/null +++ b/fhirclient/models/STU3/conceptmap.py @@ -0,0 +1,407 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ConceptMap) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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. + """ + + resource_type = "ConceptMap" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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.description = None + """ Natural language description of the concept map. + Type `str`. """ + + self.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.group = None + """ Same source and target systems. + List of `ConceptMapGroup` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Additional identifier for the concept map. + Type `Identifier` (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ Intended jurisdiction for concept map (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.name = None + """ Name for this concept map (computer friendly). + Type `str`. """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ 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.sourceUri = None + """ Identifies the source of the concepts which 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.targetUri = None + """ Provides context to the mappings. + Type `str`. """ + + self.title = None + """ Name for this concept map (human friendly). + Type `str`. """ + + self.url = None + """ Logical URI to reference this concept map (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 concept map. + Type `str`. """ + + super(ConceptMap, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ConceptMap, self).elementProperties() + js.extend([ + ("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), + ("experimental", "experimental", bool, False, None, False), + ("group", "group", ConceptMapGroup, True, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("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), + ("sourceUri", "sourceUri", str, False, "source", False), + ("status", "status", str, False, None, True), + ("targetReference", "targetReference", fhirreference.FHIRReference, False, "target", False), + ("targetUri", "targetUri", str, False, "target", 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 ConceptMapGroup(backboneelement.BackboneElement): + """ Same source and target systems. + + A group of mappings that all have the same source and target system. + """ + + resource_type = "ConceptMapGroup" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Mappings for a concept from the source set. + List of `ConceptMapGroupElement` items (represented as `dict` in JSON). """ + + self.source = None + """ Code System (if value set crosses code systems). + Type `str`. """ + + self.sourceVersion = None + """ Specific version of the code system. + Type `str`. """ + + self.target = None + """ System of the target (if necessary). + Type `str`. """ + + self.targetVersion = None + """ Specific version of the code system. + Type `str`. """ + + self.unmapped = None + """ When no match in the mappings. + Type `ConceptMapGroupUnmapped` (represented as `dict` in JSON). """ + + super(ConceptMapGroup, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ConceptMapGroup, self).elementProperties() + js.extend([ + ("element", "element", ConceptMapGroupElement, True, None, True), + ("source", "source", str, False, None, False), + ("sourceVersion", "sourceVersion", str, False, None, False), + ("target", "target", str, False, None, False), + ("targetVersion", "targetVersion", str, False, None, False), + ("unmapped", "unmapped", ConceptMapGroupUnmapped, False, None, False), + ]) + return js + + +class ConceptMapGroupElement(backboneelement.BackboneElement): + """ Mappings for a concept from the source set. + + Mappings for an individual concept in the source to one or more concepts in + the target. + """ + + resource_type = "ConceptMapGroupElement" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Identifies element being mapped. + Type `str`. """ + + self.display = None + """ Display for the code. + Type `str`. """ + + self.target = None + """ Concept in target system for element. + List of `ConceptMapGroupElementTarget` items (represented as `dict` in JSON). """ + + super(ConceptMapGroupElement, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ConceptMapGroupElement, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, False), + ("display", "display", str, False, None, False), + ("target", "target", ConceptMapGroupElementTarget, True, None, False), + ]) + return js + + +class ConceptMapGroupElementTarget(backboneelement.BackboneElement): + """ Concept in target system for element. + + A concept from the target value set that this concept maps to. + """ + + resource_type = "ConceptMapGroupElementTarget" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 that identifies the target element. + Type `str`. """ + + self.comment = None + """ Description of status/issues in mapping. + Type `str`. """ + + self.dependsOn = None + """ Other elements required for this mapping (from context). + List of `ConceptMapGroupElementTargetDependsOn` items (represented as `dict` in JSON). """ + + self.display = None + """ Display for the code. + Type `str`. """ + + self.equivalence = None + """ relatedto | equivalent | equal | wider | subsumes | narrower | + specializes | inexact | unmatched | disjoint. + Type `str`. """ + + self.product = None + """ Other concepts that this mapping also produces. + List of `ConceptMapGroupElementTargetDependsOn` items (represented as `dict` in JSON). """ + + super(ConceptMapGroupElementTarget, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ConceptMapGroupElementTarget, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, False), + ("comment", "comment", str, False, None, False), + ("dependsOn", "dependsOn", ConceptMapGroupElementTargetDependsOn, True, None, False), + ("display", "display", str, False, None, False), + ("equivalence", "equivalence", str, False, None, False), + ("product", "product", ConceptMapGroupElementTargetDependsOn, True, None, False), + ]) + return js + + +class ConceptMapGroupElementTargetDependsOn(backboneelement.BackboneElement): + """ Other elements required for this mapping (from context). + + A set of additional dependencies for this mapping to hold. This mapping is + only applicable if the specified element can be resolved, and it has the + specified value. + """ + + resource_type = "ConceptMapGroupElementTargetDependsOn" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Value of the referenced element. + Type `str`. """ + + self.display = None + """ Display for the code. + Type `str`. """ + + self.property = None + """ Reference to property mapping depends on. + Type `str`. """ + + self.system = None + """ Code System (if necessary). + 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), + ]) + return js + + +class ConceptMapGroupUnmapped(backboneelement.BackboneElement): + """ When no match in the mappings. + + What to do when there is no match in the mappings in the group. + """ + + resource_type = "ConceptMapGroupUnmapped" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Fixed code when mode = fixed. + Type `str`. """ + + self.display = None + """ Display for the code. + Type `str`. """ + + self.mode = None + """ provided | fixed | other-map. + Type `str`. """ + + self.url = None + """ Canonical URL for other concept map. + Type `str`. """ + + super(ConceptMapGroupUnmapped, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ConceptMapGroupUnmapped, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, False), + ("display", "display", str, False, None, False), + ("mode", "mode", str, False, None, True), + ("url", "url", 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 usagecontext +except ImportError: + usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/STU3/conceptmap_tests.py b/fhirclient/models/STU3/conceptmap_tests.py new file mode 100644 index 000000000..0770baf08 --- /dev/null +++ b/fhirclient/models/STU3/conceptmap_tests.py @@ -0,0 +1,189 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import conceptmap +from .fhirdate import FHIRDate + + +class ConceptMapTests(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("ConceptMap", js["resourceType"]) + return conceptmap.ConceptMap(js) + + def testConceptMap1(self): + inst = self.instantiate_from("conceptmap-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ConceptMap instance") + self.implConceptMap1(inst) + + js = inst.as_json() + self.assertEqual("ConceptMap", js["resourceType"]) + inst2 = conceptmap.ConceptMap(js) + 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[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") + + 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") + self.assertEqual(inst.date.date, FHIRDate("2012-06-13").date) + self.assertEqual(inst.date.as_json(), "2012-06-13") + self.assertEqual(inst.description, "An example mapping") + self.assertTrue(inst.experimental) + 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].system, "http://example.org/fhir/example3") + 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") + self.assertEqual(inst.group[0].target, "http://example.org/fhir/example2") + self.assertEqual(inst.group[0].unmapped.mode, "other-map") + self.assertEqual(inst.group[0].unmapped.url, "http://example.org/fhir/ConceptMap/map2") + self.assertEqual(inst.id, "example2") + self.assertEqual(inst.name, "FHIR-exanple-2") + self.assertEqual(inst.publisher, "HL7, Inc") + self.assertEqual(inst.purpose, "To illustrate mapping features") + self.assertEqual(inst.sourceUri, "http://example.org/fhir/example1") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.targetUri, "http://example.org/fhir/example2") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "FHIR Example 2") + self.assertEqual(inst.url, "http://hl7.org/fhir/ConceptMap/example2") + + def testConceptMap3(self): + inst = self.instantiate_from("conceptmap-example-specimen-type.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].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") + self.assertEqual(inst.contact[1].telecom[0].value, "http://www.phconnect.org/group/laboratorymessagingcommunityofpractice/forum/attachment/download?id=3649725%3AUploadedFile%3A145786") + self.assertEqual(inst.date.date, FHIRDate("2013-07-25").date) + self.assertEqual(inst.date.as_json(), "2013-07-25") + 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[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].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[2].code, "AIRS") + self.assertEqual(inst.group[0].element[2].target[0].code, "446302006") + 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].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[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].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[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[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[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].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[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].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.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.url, "http://hl7.org/fhir/ConceptMap/102") + self.assertEqual(inst.version, "20130725") + diff --git a/fhirclient/models/STU3/condition.py b/fhirclient/models/STU3/condition.py new file mode 100644 index 000000000..716580ae4 --- /dev/null +++ b/fhirclient/models/STU3/condition.py @@ -0,0 +1,268 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Condition) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Condition(domainresource.DomainResource): + """ Detailed information about conditions, problems or diagnoses. + + A clinical condition, problem, diagnosis, or other event, situation, issue, + or clinical concept that has risen to a level of concern. + """ + + resource_type = "Condition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.abatementAge = None + """ If/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. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.abatementPeriod = None + """ If/when in resolution/remission. + Type `Period` (represented as `dict` in JSON). """ + + self.abatementRange = None + """ If/when in resolution/remission. + Type `Range` (represented as `dict` in JSON). """ + + self.abatementString = None + """ If/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). """ + + self.bodySite = None + """ Anatomical location, if relevant. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.category = None + """ problem-list-item | encounter-diagnosis. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.clinicalStatus = None + """ active | recurrence | inactive | remission | resolved. + Type `str`. """ + + 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.evidence = None + """ Supporting evidence. + List of `ConditionEvidence` items (represented as `dict` in JSON). """ + + self.identifier = None + """ External Ids for this condition. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.note = None + """ Additional information about the Condition. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.onsetAge = None + """ Estimated or actual date, date-time, or age. + Type `Age` (represented as `dict` in JSON). """ + + self.onsetDateTime = None + """ Estimated or actual date, date-time, or age. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.onsetPeriod = None + """ Estimated or actual date, date-time, or age. + Type `Period` (represented as `dict` in JSON). """ + + self.onsetRange = None + """ Estimated or actual date, date-time, or age. + Type `Range` (represented as `dict` in JSON). """ + + self.onsetString = None + """ Estimated or actual date, date-time, or age. + Type `str`. """ + + 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). """ + + self.subject = None + """ Who has the condition?. + Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ + + self.verificationStatus = None + """ provisional | differential | confirmed | refuted | entered-in-error + | unknown. + Type `str`. """ + + super(Condition, self).__init__(jsondict=jsondict, strict=strict) + + 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), + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("context", "context", 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), + ("onsetAge", "onsetAge", age.Age, False, "onset", False), + ("onsetDateTime", "onsetDateTime", fhirdate.FHIRDate, False, "onset", False), + ("onsetPeriod", "onsetPeriod", period.Period, False, "onset", False), + ("onsetRange", "onsetRange", range.Range, False, "onset", False), + ("onsetString", "onsetString", str, False, "onset", False), + ("severity", "severity", codeableconcept.CodeableConcept, False, None, False), + ("stage", "stage", ConditionStage, False, None, False), + ("subject", "subject", fhirreference.FHIRReference, False, None, True), + ("verificationStatus", "verificationStatus", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class ConditionEvidence(backboneelement.BackboneElement): + """ Supporting evidence. + + Supporting Evidence / manifestations that are the basis on which this + condition is suspected or confirmed. + """ + + resource_type = "ConditionEvidence" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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/symptom. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.detail = None + """ Supporting information found elsewhere. + List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + + super(ConditionEvidence, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ConditionEvidence, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, True, None, False), + ("detail", "detail", fhirreference.FHIRReference, True, None, False), + ]) + return js + + +class ConditionStage(backboneelement.BackboneElement): + """ Stage/grade, usually assessed formally. + + Clinical stage or grade of a condition. May include formal severity + assessments. + """ + + resource_type = "ConditionStage" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Formal record of assessment. + List of `FHIRReference` items referencing `ClinicalImpression, DiagnosticReport, Observation` (represented as `dict` in JSON). """ + + self.summary = None + """ Simple summary (disease specific). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ConditionStage, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ConditionStage, self).elementProperties() + js.extend([ + ("assessment", "assessment", fhirreference.FHIRReference, True, None, False), + ("summary", "summary", 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: + 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'] +try: + from . import range +except ImportError: + range = sys.modules[__package__ + '.range'] diff --git a/fhirclient/models/STU3/condition_tests.py b/fhirclient/models/STU3/condition_tests.py new file mode 100644 index 000000000..db352c6cf --- /dev/null +++ b/fhirclient/models/STU3/condition_tests.py @@ -0,0 +1,343 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import condition +from .fhirdate import FHIRDate + + +class ConditionTests(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("Condition", js["resourceType"]) + return condition.Condition(js) + + def testCondition1(self): + inst = self.instantiate_from("condition-example-f003-abscess.json") + self.assertIsNotNone(inst, "Must have instantiated a Condition instance") + self.implCondition1(inst) + + js = inst.as_json() + self.assertEqual("Condition", js["resourceType"]) + inst2 = condition.Condition(js) + self.implCondition1(inst2) + + def implCondition1(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.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.text.status, "generated") + self.assertEqual(inst.verificationStatus, "confirmed") + + def testCondition2(self): + inst = self.instantiate_from("condition-example-f203-sepsis.json") + self.assertIsNotNone(inst, "Must have instantiated a Condition instance") + self.implCondition2(inst) + + js = inst.as_json() + self.assertEqual("Condition", js["resourceType"]) + inst2 = condition.Condition(js) + self.implCondition2(inst2) + + def implCondition2(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.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.text.status, "generated") + self.assertEqual(inst.verificationStatus, "confirmed") + + def testCondition3(self): + inst = self.instantiate_from("condition-example-stroke.json") + self.assertIsNotNone(inst, "Must have instantiated a Condition instance") + self.implCondition3(inst) + + js = inst.as_json() + self.assertEqual("Condition", js["resourceType"]) + inst2 = condition.Condition(js) + self.implCondition3(inst2) + + def implCondition3(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.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.text.status, "generated") + self.assertEqual(inst.verificationStatus, "confirmed") + + def testCondition4(self): + inst = self.instantiate_from("condition-example-family-history.json") + self.assertIsNotNone(inst, "Must have instantiated a Condition instance") + self.implCondition4(inst) + + js = inst.as_json() + self.assertEqual("Condition", js["resourceType"]) + inst2 = condition.Condition(js) + self.implCondition4(inst2) + + def implCondition4(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.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.text.status, "generated") + + def testCondition5(self): + inst = self.instantiate_from("condition-example-f002-lung.json") + self.assertIsNotNone(inst, "Must have instantiated a Condition instance") + self.implCondition5(inst) + + js = inst.as_json() + self.assertEqual("Condition", js["resourceType"]) + inst2 = condition.Condition(js) + self.implCondition5(inst2) + + def implCondition5(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].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, "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.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.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") + + def testCondition6(self): + inst = self.instantiate_from("condition-example-f205-infection.json") + self.assertIsNotNone(inst, "Must have instantiated a Condition instance") + self.implCondition6(inst) + + js = inst.as_json() + self.assertEqual("Condition", js["resourceType"]) + inst2 = condition.Condition(js) + self.implCondition6(inst2) + + def implCondition6(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.text.status, "generated") + self.assertEqual(inst.verificationStatus, "differential") + + def testCondition7(self): + inst = self.instantiate_from("condition-example-f204-renal.json") + self.assertIsNotNone(inst, "Must have instantiated a Condition instance") + self.implCondition7(inst) + + js = inst.as_json() + self.assertEqual("Condition", js["resourceType"]) + inst2 = condition.Condition(js) + self.implCondition7(inst2) + + 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") + 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, "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.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.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.text.status, "generated") + self.assertEqual(inst.verificationStatus, "differential") + + def testCondition8(self): + inst = self.instantiate_from("condition-example2.json") + self.assertIsNotNone(inst, "Must have instantiated a Condition instance") + self.implCondition8(inst) + + js = inst.as_json() + self.assertEqual("Condition", js["resourceType"]) + inst2 = condition.Condition(js) + self.implCondition8(inst2) + + def implCondition8(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.text, "Asthma") + self.assertEqual(inst.id, "example2") + 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, "confirmed") + + def testCondition9(self): + inst = self.instantiate_from("condition-example-f202-malignancy.json") + self.assertIsNotNone(inst, "Must have instantiated a Condition instance") + self.implCondition9(inst) + + js = inst.as_json() + self.assertEqual("Condition", js["resourceType"]) + inst2 = condition.Condition(js) + self.implCondition9(inst2) + + def implCondition9(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].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.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.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, "confirmed") + + def testCondition10(self): + inst = self.instantiate_from("condition-example-f201-fever.json") + self.assertIsNotNone(inst, "Must have instantiated a Condition instance") + self.implCondition10(inst) + + js = inst.as_json() + self.assertEqual("Condition", js["resourceType"]) + inst2 = condition.Condition(js) + self.implCondition10(inst2) + + def implCondition10(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.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.text.status, "generated") + self.assertEqual(inst.verificationStatus, "confirmed") + diff --git a/fhirclient/models/STU3/consent.py b/fhirclient/models/STU3/consent.py new file mode 100644 index 000000000..04d359dd7 --- /dev/null +++ b/fhirclient/models/STU3/consent.py @@ -0,0 +1,425 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Consent) on 2019-10-12. +# 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 record of a healthcare consumer’s policy 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. + """ + + resource_type = "Consent" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ 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). """ + + self.organization = None + """ Custodian of the consent. + List of `FHIRReference` items referencing `Organization` (represented as `dict` in JSON). """ + + self.patient = None + """ Who the consent applies to. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.period = None + """ Period that this consent applies. + Type `Period` (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`. """ + + self.purpose = None + """ Context of activities for which the agreement is made. + List of `Coding` 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.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). """ + + self.status = None + """ draft | proposed | active | rejected | inactive | entered-in-error. + Type `str`. """ + + 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), + ("dateTime", "dateTime", fhirdate.FHIRDate, False, None, False), + ("except_fhir", "except", ConsentExcept, True, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("organization", "organization", fhirreference.FHIRReference, True, None, False), + ("patient", "patient", fhirreference.FHIRReference, False, None, True), + ("period", "period", period.Period, False, 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), + ("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), + ]) + 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. + + The resources controlled by this consent, if specific resources are + referenced. + """ + + resource_type = "ConsentData" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.meaning = None + """ instance | related | dependents | authoredby. + Type `str`. """ + + self.reference = None + """ The actual data reference. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + super(ConsentData, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ConsentData, self).elementProperties() + js.extend([ + ("meaning", "meaning", str, False, None, True), + ("reference", "reference", fhirreference.FHIRReference, False, None, True), + ]) + return js + + +class ConsentExcept(backboneelement.BackboneElement): + """ Additional rule - addition or removal of permissions. + + An exception to the base policy of this consent. An exception can be an + addition or removal of access permissions. + """ + + resource_type = "ConsentExcept" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Actions controlled by this exception. + 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). """ + + self.class_fhir = None + """ e.g. Resource Type, Profile, or 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). """ + + self.data = None + """ Data controlled by this exception. + List of `ConsentExceptData` items (represented as `dict` in JSON). """ + + self.dataPeriod = None + """ Timeframe for data controlled by this exception. + Type `Period` (represented as `dict` in JSON). """ + + self.period = None + """ Timeframe for this exception. + Type `Period` (represented as `dict` in JSON). """ + + self.purpose = None + """ Context of activities covered by this exception. + List of `Coding` 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.type = None + """ deny | permit. + Type `str`. """ + + super(ConsentExcept, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ConsentExcept, self).elementProperties() + js.extend([ + ("action", "action", codeableconcept.CodeableConcept, True, None, False), + ("actor", "actor", ConsentExceptActor, True, None, False), + ("class_fhir", "class", coding.Coding, True, None, False), + ("code", "code", coding.Coding, True, None, False), + ("data", "data", ConsentExceptData, True, None, False), + ("dataPeriod", "dataPeriod", period.Period, False, None, False), + ("period", "period", period.Period, False, None, False), + ("purpose", "purpose", coding.Coding, True, None, False), + ("securityLabel", "securityLabel", coding.Coding, True, None, False), + ("type", "type", str, False, None, True), + ]) + return js + + +class ConsentExceptActor(backboneelement.BackboneElement): + """ Who|what controlled by this exception (or group, by role). + + Who or what is controlled by this Exception. Use group to identify a set of + actors by some property they share (e.g. 'admitting officers'). + """ + + resource_type = "ConsentExceptActor" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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(ConsentExceptActor, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ConsentExceptActor, self).elementProperties() + js.extend([ + ("reference", "reference", fhirreference.FHIRReference, False, None, True), + ("role", "role", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +class ConsentExceptData(backboneelement.BackboneElement): + """ Data controlled by this exception. + + The resources controlled by this exception, if specific resources are + referenced. + """ + + resource_type = "ConsentExceptData" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.meaning = None + """ instance | related | dependents | authoredby. + Type `str`. """ + + self.reference = None + """ The actual data reference. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + super(ConsentExceptData, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ConsentExceptData, self).elementProperties() + js.extend([ + ("meaning", "meaning", str, False, None, True), + ("reference", "reference", fhirreference.FHIRReference, False, None, True), + ]) + return js + + +class ConsentPolicy(backboneelement.BackboneElement): + """ Policies covered by this consent. + + 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 = "ConsentPolicy" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Enforcement source for policy. + Type `str`. """ + + self.uri = None + """ Specific policy covered by this consent. + Type `str`. """ + + super(ConsentPolicy, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ConsentPolicy, self).elementProperties() + js.extend([ + ("authority", "authority", str, False, None, False), + ("uri", "uri", 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 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 period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/STU3/consent_tests.py b/fhirclient/models/STU3/consent_tests.py new file mode 100644 index 000000000..39a1ce606 --- /dev/null +++ b/fhirclient/models/STU3/consent_tests.py @@ -0,0 +1,343 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import consent +from .fhirdate import FHIRDate + + +class ConsentTests(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("Consent", js["resourceType"]) + return consent.Consent(js) + + def testConsent1(self): + inst = self.instantiate_from("consent-example-notThis.json") + self.assertIsNotNone(inst, "Must have instantiated a Consent instance") + self.implConsent1(inst) + + js = inst.as_json() + self.assertEqual("Consent", js["resourceType"]) + inst2 = consent.Consent(js) + self.implConsent1(inst2) + + def implConsent1(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].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.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-smartonfhir.json") + self.assertIsNotNone(inst, "Must have instantiated a Consent instance") + self.implConsent2(inst) + + js = inst.as_json() + self.assertEqual("Consent", js["resourceType"]) + inst2 = consent.Consent(js) + self.implConsent2(inst2) + + def implConsent2(self, inst): + 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.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].class_fhir[0].code, "MedicationRequest") + self.assertEqual(inst.except_fhir[0].class_fhir[0].system, "http://hl7.org/fhir/resource-types") + self.assertEqual(inst.except_fhir[0].type, "permit") + self.assertEqual(inst.id, "consent-example-smartonfhir") + self.assertEqual(inst.period.end.date, FHIRDate("2016-06-23T17:32:33+10:00").date) + self.assertEqual(inst.period.end.as_json(), "2016-06-23T17:32:33+10:00") + self.assertEqual(inst.period.start.date, FHIRDate("2016-06-23T17:02:33+10:00").date) + self.assertEqual(inst.period.start.as_json(), "2016-06-23T17:02:33+10:00") + self.assertEqual(inst.policyRule, "http://hl7.org/fhir/ConsentPolicy/opt-in") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + + def testConsent3(self): + inst = self.instantiate_from("consent-example-notAuthor.json") + self.assertIsNotNone(inst, "Must have instantiated a Consent instance") + self.implConsent3(inst) + + js = inst.as_json() + self.assertEqual("Consent", js["resourceType"]) + inst2 = consent.Consent(js) + self.implConsent3(inst2) + + def implConsent3(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].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.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-notTime.json") + self.assertIsNotNone(inst, "Must have instantiated a Consent instance") + self.implConsent4(inst) + + js = inst.as_json() + self.assertEqual("Consent", js["resourceType"]) + inst2 = consent.Consent(js) + self.implConsent4(inst2) + + def implConsent4(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].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.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-signature.json") + self.assertIsNotNone(inst, "Must have instantiated a Consent instance") + self.implConsent5(inst) + + js = inst.as_json() + self.assertEqual("Consent", js["resourceType"]) + inst2 = consent.Consent(js) + self.implConsent5(inst2) + + def implConsent5(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.status, "active") + self.assertEqual(inst.text.status, "generated") + + def testConsent6(self): + inst = self.instantiate_from("consent-example-notThem.json") + self.assertIsNotNone(inst, "Must have instantiated a Consent instance") + self.implConsent6(inst) + + js = inst.as_json() + self.assertEqual("Consent", js["resourceType"]) + inst2 = consent.Consent(js) + self.implConsent6(inst2) + + def implConsent6(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.status, "active") + self.assertEqual(inst.text.status, "generated") + + def testConsent7(self): + inst = self.instantiate_from("consent-example-grantor.json") + self.assertIsNotNone(inst, "Must have instantiated a Consent instance") + self.implConsent7(inst) + + js = inst.as_json() + self.assertEqual("Consent", js["resourceType"]) + inst2 = consent.Consent(js) + self.implConsent7(inst2) + + def implConsent7(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.status, "active") + self.assertEqual(inst.text.status, "generated") + + def testConsent8(self): + inst = self.instantiate_from("consent-example-notOrg.json") + self.assertIsNotNone(inst, "Must have instantiated a Consent instance") + self.implConsent8(inst) + + js = inst.as_json() + self.assertEqual("Consent", js["resourceType"]) + inst2 = consent.Consent(js) + self.implConsent8(inst2) + + def implConsent8(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-notOrg") + 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.status, "active") + self.assertEqual(inst.text.status, "generated") + + def testConsent9(self): + inst = self.instantiate_from("consent-example-pkb.json") + self.assertIsNotNone(inst, "Must have instantiated a Consent instance") + self.implConsent9(inst) + + js = inst.as_json() + self.assertEqual("Consent", js["resourceType"]) + inst2 = consent.Consent(js) + self.implConsent9(inst2) + + def implConsent9(self, inst): + 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.status, "active") + self.assertEqual(inst.text.status, "generated") + + def testConsent10(self): + inst = self.instantiate_from("consent-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Consent instance") + self.implConsent10(inst) + + js = inst.as_json() + self.assertEqual("Consent", js["resourceType"]) + inst2 = consent.Consent(js) + self.implConsent10(inst2) + + def implConsent10(self, inst): + 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.period.end.date, FHIRDate("2016-01-01").date) + self.assertEqual(inst.period.end.as_json(), "2016-01-01") + self.assertEqual(inst.period.start.date, FHIRDate("1964-01-01").date) + self.assertEqual(inst.period.start.as_json(), "1964-01-01") + self.assertEqual(inst.policyRule, "http://goodhealth.org/consent/policy/opt-in") + 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/STU3/contactdetail.py b/fhirclient/models/STU3/contactdetail.py new file mode 100644 index 000000000..0d6cf0296 --- /dev/null +++ b/fhirclient/models/STU3/contactdetail.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ContactDetail) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class ContactDetail(element.Element): + """ Contact information. + + Specifies contact information for a person or organization. + """ + + resource_type = "ContactDetail" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 an individual to contact. + Type `str`. """ + + self.telecom = None + """ Contact details for individual or organization. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(ContactDetail, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ContactDetail, self).elementProperties() + js.extend([ + ("name", "name", str, False, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ]) + return js + + +import sys +try: + from . import contactpoint +except ImportError: + contactpoint = sys.modules[__package__ + '.contactpoint'] diff --git a/fhirclient/models/STU3/contactpoint.py b/fhirclient/models/STU3/contactpoint.py new file mode 100644 index 000000000..153a00600 --- /dev/null +++ b/fhirclient/models/STU3/contactpoint.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ContactPoint) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class ContactPoint(element.Element): + """ Details of a Technology mediated contact point (phone, fax, email, etc.). + + Details for all kinds of technology mediated contact points for a person or + organization, including telephone, email, etc. + """ + + resource_type = "ContactPoint" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Time period when the contact point was/is in use. + Type `Period` (represented as `dict` in JSON). """ + + self.rank = None + """ Specify preferred order of use (1 = highest). + Type `int`. """ + + self.system = None + """ phone | fax | email | pager | url | sms | other. + Type `str`. """ + + self.use = None + """ home | work | temp | old | mobile - purpose of this contact point. + Type `str`. """ + + self.value = None + """ The actual contact point details. + Type `str`. """ + + super(ContactPoint, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ContactPoint, self).elementProperties() + js.extend([ + ("period", "period", period.Period, False, None, False), + ("rank", "rank", int, False, None, False), + ("system", "system", str, False, None, False), + ("use", "use", str, False, None, False), + ("value", "value", str, False, None, False), + ]) + return js + + +import sys +try: + from . import period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/STU3/contract.py b/fhirclient/models/STU3/contract.py new file mode 100644 index 000000000..ed802e448 --- /dev/null +++ b/fhirclient/models/STU3/contract.py @@ -0,0 +1,655 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Contract) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Contract(domainresource.DomainResource): + """ Legal Agreement. + + A formal agreement between parties regarding the conduct of business, + exchange of information or other matters. + """ + + resource_type = "Contract" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ 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.applies = None + """ Effective time. + Type `Period` (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). """ + + 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.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). """ + + self.friendly = None + """ Contract Friendly Language. + List of `ContractFriendly` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Contract number. + Type `Identifier` (represented as `dict` in JSON). """ + + self.issued = None + """ When this Contract was issued. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.legal = None + """ Contract Legal Language. + List of `ContractLegal` 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.signer = None + """ Contract Signatory. + List of `ContractSigner` 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. + Type `str`. """ + + self.subType = None + """ Subtype within the context of type. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.subject = None + """ Contract Target Entity. + List of `FHIRReference` items referencing `Resource` (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.type = None + """ Type or form. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valuedItem = None + """ Contract Valued Item List. + List of `ContractValuedItem` items (represented as `dict` in JSON). """ + + 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), + ("applies", "applies", period.Period, False, None, False), + ("authority", "authority", fhirreference.FHIRReference, True, None, False), + ("bindingAttachment", "bindingAttachment", attachment.Attachment, False, "binding", False), + ("bindingReference", "bindingReference", fhirreference.FHIRReference, False, "binding", False), + ("contentDerivative", "contentDerivative", codeableconcept.CodeableConcept, False, None, False), + ("decisionType", "decisionType", codeableconcept.CodeableConcept, False, None, False), + ("domain", "domain", fhirreference.FHIRReference, True, None, False), + ("friendly", "friendly", ContractFriendly, True, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("issued", "issued", fhirdate.FHIRDate, False, None, False), + ("legal", "legal", ContractLegal, True, None, False), + ("rule", "rule", ContractRule, True, None, False), + ("securityLabel", "securityLabel", coding.Coding, True, None, False), + ("signer", "signer", ContractSigner, True, None, False), + ("status", "status", str, False, None, False), + ("subType", "subType", codeableconcept.CodeableConcept, True, None, False), + ("subject", "subject", fhirreference.FHIRReference, True, None, False), + ("term", "term", ContractTerm, True, None, False), + ("topic", "topic", fhirreference.FHIRReference, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("valuedItem", "valuedItem", ContractValuedItem, True, None, False), + ]) + return js + + +from . import backboneelement + +class ContractAgent(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 = "ContractAgent" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Contract Agent Type. + Type `FHIRReference` referencing `Contract, Device, Group, Location, Organization, Patient, Practitioner, RelatedPerson, Substance` (represented as `dict` in JSON). """ + + self.role = None + """ Role type of the agent. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(ContractAgent, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ContractAgent, self).elementProperties() + js.extend([ + ("actor", "actor", fhirreference.FHIRReference, False, None, True), + ("role", "role", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +class ContractFriendly(backboneelement.BackboneElement): + """ Contract Friendly Language. + + The "patient friendly language" versionof the Contract in whole or in + parts. "Patient friendly language" means the representation of the Contract + and Contract Provisions in a manner that is readily accessible and + understandable by a layperson in accordance with best practices for + communication styles that ensure that those agreeing to or signing the + Contract understand the roles, actions, obligations, responsibilities, and + implication of the agreement. + """ + + resource_type = "ContractFriendly" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.contentAttachment = None + """ Easily comprehended representation of this Contract. + Type `Attachment` (represented as `dict` in JSON). """ + + self.contentReference = None + """ Easily comprehended representation of this Contract. + Type `FHIRReference` referencing `Composition, DocumentReference, QuestionnaireResponse` (represented as `dict` in JSON). """ + + super(ContractFriendly, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ContractFriendly, self).elementProperties() + js.extend([ + ("contentAttachment", "contentAttachment", attachment.Attachment, False, "content", True), + ("contentReference", "contentReference", fhirreference.FHIRReference, False, "content", True), + ]) + return js + + +class ContractLegal(backboneelement.BackboneElement): + """ Contract Legal Language. + + List of Legal expressions or representations of this Contract. + """ + + resource_type = "ContractLegal" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.contentAttachment = None + """ Contract Legal Text. + Type `Attachment` (represented as `dict` in JSON). """ + + self.contentReference = None + """ Contract Legal Text. + Type `FHIRReference` referencing `Composition, DocumentReference, QuestionnaireResponse` (represented as `dict` in JSON). """ + + super(ContractLegal, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ContractLegal, self).elementProperties() + js.extend([ + ("contentAttachment", "contentAttachment", attachment.Attachment, False, "content", True), + ("contentReference", "contentReference", fhirreference.FHIRReference, False, "content", True), + ]) + return js + + +class ContractRule(backboneelement.BackboneElement): + """ Computable Contract Language. + + List of Computable Policy Rule Language Representations of this Contract. + """ + + resource_type = "ContractRule" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.contentAttachment = None + """ Computable Contract Rules. + Type `Attachment` (represented as `dict` in JSON). """ + + self.contentReference = None + """ Computable Contract Rules. + Type `FHIRReference` referencing `DocumentReference` (represented as `dict` in JSON). """ + + super(ContractRule, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ContractRule, self).elementProperties() + js.extend([ + ("contentAttachment", "contentAttachment", attachment.Attachment, False, "content", True), + ("contentReference", "contentReference", fhirreference.FHIRReference, False, "content", True), + ]) + return js + + +class ContractSigner(backboneelement.BackboneElement): + """ Contract Signatory. + + Parties with legal standing in the Contract, including the principal + parties, the grantor(s) and grantee(s), which are any person or + organization bound by the contract, and any ancillary parties, which + facilitate the execution of the contract such as a notary or witness. + """ + + resource_type = "ContractSigner" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.party = None + """ Contract Signatory Party. + Type `FHIRReference` referencing `Organization, Patient, Practitioner, RelatedPerson` (represented as `dict` in JSON). """ + + self.signature = None + """ Contract Documentation Signature. + List of `Signature` items (represented as `dict` in JSON). """ + + self.type = None + """ Contract Signatory Role. + Type `Coding` (represented as `dict` in JSON). """ + + super(ContractSigner, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ContractSigner, self).elementProperties() + js.extend([ + ("party", "party", fhirreference.FHIRReference, False, None, True), + ("signature", "signature", signature.Signature, True, None, True), + ("type", "type", coding.Coding, False, None, True), + ]) + return js + + +class ContractTerm(backboneelement.BackboneElement): + """ Contract Term List. + + One or more Contract Provisions, which may be related and conveyed as a + group, and may contain nested groups. + """ + + resource_type = "ContractTerm" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ 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). """ + + self.applies = None + """ Contract Term Effective Time. + Type `Period` (represented as `dict` in JSON). """ + + self.group = None + """ Nested Contract Term Group. + List of `ContractTerm` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Contract Term Number. + Type `Identifier` (represented as `dict` in JSON). """ + + self.issued = None + """ Contract Term Issue Date Time. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.securityLabel = None + """ Security Labels that define affected terms. + List of `Coding` 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. + Type `str`. """ + + self.topic = None + """ Context of the Contract term. + List of `FHIRReference` items referencing `Resource` (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), + ("applies", "applies", period.Period, False, 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), + ("subType", "subType", codeableconcept.CodeableConcept, False, None, False), + ("text", "text", str, False, None, False), + ("topic", "topic", fhirreference.FHIRReference, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("valuedItem", "valuedItem", ContractTermValuedItem, True, None, False), + ]) + return js + + +class ContractTermAgent(backboneelement.BackboneElement): + """ Contract Term Agent List. + + 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Contract Term Agent Subject. + Type `FHIRReference` referencing `Contract, Device, Group, Location, Organization, Patient, Practitioner, RelatedPerson, Substance` (represented as `dict` in JSON). """ + + self.role = None + """ Type of the Contract Term Agent. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(ContractTermAgent, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ContractTermAgent, self).elementProperties() + js.extend([ + ("actor", "actor", fhirreference.FHIRReference, False, None, True), + ("role", "role", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +class ContractTermValuedItem(backboneelement.BackboneElement): + """ Contract Term Valued Item List. + + Contract Provision Valued Item List. + """ + + resource_type = "ContractTermValuedItem" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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.entityCodeableConcept = None + """ Contract Term Valued Item Type. + 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.factor = None + """ Contract Term Valued Item Price Scaling Factor. + Type `float`. """ + + self.identifier = None + """ Contract Term Valued Item Number. + Type `Identifier` (represented as `dict` in JSON). """ + + self.net = None + """ Total Contract Term Valued Item Value. + Type `Money` (represented as `dict` in JSON). """ + + self.points = None + """ Contract Term Valued Item Difficulty Scaling Factor. + Type `float`. """ + + self.quantity = None + """ Contract Term Valued Item Count. + Type `Quantity` (represented as `dict` in JSON). """ + + self.unitPrice = None + """ Contract Term Valued Item fee, charge, or cost. + Type `Money` (represented as `dict` in JSON). """ + + super(ContractTermValuedItem, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ContractTermValuedItem, 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), + ]) + return js + + +class ContractValuedItem(backboneelement.BackboneElement): + """ Contract Valued Item List. + """ + + resource_type = "ContractValuedItem" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.effectiveTime = None + """ Contract Valued Item Effective Tiem. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.entityCodeableConcept = None + """ Contract Valued Item Type. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.entityReference = None + """ Contract Valued Item Type. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.factor = None + """ Contract Valued Item Price Scaling Factor. + Type `float`. """ + + self.identifier = None + """ Contract Valued Item Number. + Type `Identifier` (represented as `dict` in JSON). """ + + self.net = None + """ Total Contract Valued Item Value. + Type `Money` (represented as `dict` in JSON). """ + + self.points = None + """ Contract Valued Item Difficulty Scaling Factor. + Type `float`. """ + + self.quantity = None + """ Count of Contract Valued Items. + Type `Quantity` (represented as `dict` in JSON). """ + + 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) + + def elementProperties(self): + js = super(ContractValuedItem, 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), + ]) + 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 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 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'] +try: + from . import signature +except ImportError: + signature = sys.modules[__package__ + '.signature'] diff --git a/fhirclient/models/STU3/contract_tests.py b/fhirclient/models/STU3/contract_tests.py new file mode 100644 index 000000000..309e6ef93 --- /dev/null +++ b/fhirclient/models/STU3/contract_tests.py @@ -0,0 +1,256 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import contract +from .fhirdate import FHIRDate + + +class ContractTests(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("Contract", js["resourceType"]) + return contract.Contract(js) + + def testContract1(self): + inst = self.instantiate_from("pcd-example-notOrg.json") + self.assertIsNotNone(inst, "Must have instantiated a Contract instance") + self.implContract1(inst) + + js = inst.as_json() + self.assertEqual("Contract", js["resourceType"]) + inst2 = contract.Contract(js) + self.implContract1(inst2) + + def implContract1(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.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 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, "57016-8") + self.assertEqual(inst.type.coding[0].system, "http://loinc.org") + + def testContract2(self): + inst = self.instantiate_from("contract-example-42cfr-part2.json") + self.assertIsNotNone(inst, "Must have instantiated a Contract instance") + self.implContract2(inst) + + js = inst.as_json() + self.assertEqual("Contract", js["resourceType"]) + inst2 = contract.Contract(js) + self.implContract2(inst2) + + def implContract2(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.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") + + def testContract3(self): + inst = self.instantiate_from("pcd-example-notLabs.json") + self.assertIsNotNone(inst, "Must have instantiated a Contract instance") + self.implContract3(inst) + + js = inst.as_json() + self.assertEqual("Contract", js["resourceType"]) + inst2 = contract.Contract(js) + 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-notLabs") + 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.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.text.status, "generated") + self.assertEqual(inst.type.coding[0].code, "57016-8") + self.assertEqual(inst.type.coding[0].system, "http://loinc.org") + + def testContract4(self): + inst = self.instantiate_from("pcd-example-notThem.json") + self.assertIsNotNone(inst, "Must have instantiated a Contract instance") + self.implContract4(inst) + + js = inst.as_json() + self.assertEqual("Contract", js["resourceType"]) + inst2 = contract.Contract(js) + self.implContract4(inst2) + + def implContract4(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.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.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].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 testContract5(self): + inst = self.instantiate_from("pcd-example-notAuthor.json") + self.assertIsNotNone(inst, "Must have instantiated a Contract instance") + self.implContract5(inst) + + js = inst.as_json() + self.assertEqual("Contract", js["resourceType"]) + inst2 = contract.Contract(js) + self.implContract5(inst2) + + 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-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.text.status, "generated") + self.assertEqual(inst.type.coding[0].code, "57016-8") + self.assertEqual(inst.type.coding[0].system, "http://loinc.org") + + def testContract6(self): + inst = self.instantiate_from("contract-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Contract instance") + self.implContract6(inst) + + js = inst.as_json() + self.assertEqual("Contract", js["resourceType"]) + inst2 = contract.Contract(js) + self.implContract6(inst2) + + def implContract6(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.text.status, "generated") + + def testContract7(self): + inst = self.instantiate_from("pcd-example-notThis.json") + self.assertIsNotNone(inst, "Must have instantiated a Contract instance") + self.implContract7(inst) + + js = inst.as_json() + self.assertEqual("Contract", js["resourceType"]) + inst2 = contract.Contract(js) + self.implContract7(inst2) + + def implContract7(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.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].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") + 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") + diff --git a/fhirclient/models/STU3/contributor.py b/fhirclient/models/STU3/contributor.py new file mode 100644 index 000000000..ebfb2b313 --- /dev/null +++ b/fhirclient/models/STU3/contributor.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Contributor) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Contributor(element.Element): + """ Contributor information. + + A contributor to the content of a knowledge asset, including authors, + editors, reviewers, and endorsers. + """ + + resource_type = "Contributor" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 of the contributor. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.name = None + """ Who contributed the content. + Type `str`. """ + + self.type = None + """ author | editor | reviewer | endorser. + Type `str`. """ + + super(Contributor, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Contributor, self).elementProperties() + js.extend([ + ("contact", "contact", contactdetail.ContactDetail, True, None, False), + ("name", "name", str, False, None, True), + ("type", "type", str, False, None, True), + ]) + return js + + +import sys +try: + from . import contactdetail +except ImportError: + contactdetail = sys.modules[__package__ + '.contactdetail'] diff --git a/fhirclient/models/STU3/count.py b/fhirclient/models/STU3/count.py new file mode 100644 index 000000000..864a6b506 --- /dev/null +++ b/fhirclient/models/STU3/count.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Count) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import quantity + +class Count(quantity.Quantity): + """ A measured or measurable amount. + + A measured amount (or an amount that can potentially be measured). Note + that measured amounts include amounts that are not precisely quantified, + including amounts involving arbitrary units and floating currencies. + """ + + resource_type = "Count" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + super(Count, self).__init__(jsondict=jsondict, strict=strict) + + diff --git a/fhirclient/models/STU3/coverage.py b/fhirclient/models/STU3/coverage.py new file mode 100644 index 000000000..7147fdb34 --- /dev/null +++ b/fhirclient/models/STU3/coverage.py @@ -0,0 +1,220 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Coverage) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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. + """ + + resource_type = "Coverage" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.beneficiary = None + """ Plan Beneficiary. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.contract = None + """ Contract details. + List of `FHIRReference` items referencing `Contract` (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. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.network = None + """ Insurer network. + Type `str`. """ + + self.order = None + """ Relative order of the coverage. + 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). """ + + self.period = None + """ Coverage start and end dates. + Type `Period` (represented as `dict` in JSON). """ + + self.policyHolder = None + """ Owner of the policy. + Type `FHIRReference` referencing `Patient, RelatedPerson, Organization` (represented as `dict` in JSON). """ + + self.relationship = None + """ 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.subscriber = None + """ Subscriber to the policy. + Type `FHIRReference` referencing `Patient, RelatedPerson` (represented as `dict` in JSON). """ + + self.subscriberId = None + """ ID assigned to the Subscriber. + Type `str`. """ + + self.type = None + """ Type of coverage such as medical or accident. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(Coverage, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Coverage, self).elementProperties() + js.extend([ + ("beneficiary", "beneficiary", fhirreference.FHIRReference, False, None, False), + ("contract", "contract", fhirreference.FHIRReference, 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), + ("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), + ("subscriber", "subscriber", fhirreference.FHIRReference, False, None, False), + ("subscriberId", "subscriberId", str, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import backboneelement + +class CoverageGrouping(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. + """ + + resource_type = "CoverageGrouping" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.classDisplay = None + """ Display text for the class. + Type `str`. """ + + self.class_fhir = None + """ An identifier for the class. + Type `str`. """ + + self.group = None + """ An identifier for the group. + Type `str`. """ + + self.groupDisplay = None + """ Display text for an identifier for the group. + Type `str`. """ + + self.plan = None + """ An identifier for the plan. + Type `str`. """ + + self.planDisplay = None + """ Display text for the plan. + Type `str`. """ + + self.subClass = None + """ An identifier for the subsection of the class. + Type `str`. """ + + self.subClassDisplay = None + """ Display text for the subsection of the subclass. + Type `str`. """ + + self.subGroup = None + """ An identifier for the subsection of the group. + Type `str`. """ + + self.subGroupDisplay = None + """ Display text for the subsection of the group. + Type `str`. """ + + self.subPlan = None + """ An identifier for the subsection of the plan. + Type `str`. """ + + self.subPlanDisplay = None + """ Display text for the subsection of the plan. + Type `str`. """ + + super(CoverageGrouping, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CoverageGrouping, 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), + ]) + 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 period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/STU3/coverage_tests.py b/fhirclient/models/STU3/coverage_tests.py new file mode 100644 index 000000000..6c298ad1c --- /dev/null +++ b/fhirclient/models/STU3/coverage_tests.py @@ -0,0 +1,147 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import coverage +from .fhirdate import FHIRDate + + +class CoverageTests(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("Coverage", js["resourceType"]) + return coverage.Coverage(js) + + def testCoverage1(self): + inst = self.instantiate_from("coverage-example-2.json") + self.assertIsNotNone(inst, "Must have instantiated a Coverage instance") + self.implCoverage1(inst) + + js = inst.as_json() + self.assertEqual("Coverage", js["resourceType"]) + inst2 = coverage.Coverage(js) + self.implCoverage1(inst2) + + def implCoverage1(self, inst): + 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.network, "5") + self.assertEqual(inst.order, 2) + self.assertEqual(inst.period.end.date, FHIRDate("2012-03-17").date) + self.assertEqual(inst.period.end.as_json(), "2012-03-17") + self.assertEqual(inst.period.start.date, FHIRDate("2011-03-17").date) + self.assertEqual(inst.period.start.as_json(), "2011-03-17") + self.assertEqual(inst.relationship.coding[0].code, "self") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.subscriberId, "AB9876") + 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") + + def testCoverage2(self): + inst = self.instantiate_from("coverage-example-selfpay.json") + self.assertIsNotNone(inst, "Must have instantiated a Coverage instance") + self.implCoverage2(inst) + + js = inst.as_json() + self.assertEqual("Coverage", js["resourceType"]) + inst2 = coverage.Coverage(js) + self.implCoverage2(inst2) + + def implCoverage2(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.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.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") + + def testCoverage3(self): + inst = self.instantiate_from("coverage-example-ehic.json") + self.assertIsNotNone(inst, "Must have instantiated a Coverage instance") + self.implCoverage3(inst) + + js = inst.as_json() + self.assertEqual("Coverage", js["resourceType"]) + inst2 = coverage.Coverage(js) + self.implCoverage3(inst2) + + def implCoverage3(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.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.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") + + def testCoverage4(self): + inst = self.instantiate_from("coverage-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Coverage instance") + self.implCoverage4(inst) + + js = inst.as_json() + self.assertEqual("Coverage", js["resourceType"]) + inst2 = coverage.Coverage(js) + self.implCoverage4(inst2) + + def implCoverage4(self, inst): + 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.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") + diff --git a/fhirclient/models/STU3/dataelement.py b/fhirclient/models/STU3/dataelement.py new file mode 100644 index 000000000..f5628756b --- /dev/null +++ b/fhirclient/models/STU3/dataelement.py @@ -0,0 +1,189 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/DataElement) on 2019-10-12. +# 2019, 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/STU3/dataelement_tests.py b/fhirclient/models/STU3/dataelement_tests.py new file mode 100644 index 000000000..06be5ec0a --- /dev/null +++ b/fhirclient/models/STU3/dataelement_tests.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +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/STU3/datarequirement.py b/fhirclient/models/STU3/datarequirement.py new file mode 100644 index 000000000..deac52061 --- /dev/null +++ b/fhirclient/models/STU3/datarequirement.py @@ -0,0 +1,188 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/DataRequirement) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class DataRequirement(element.Element): + """ Describes a required data item. + + Describes a required data item for evaluation in terms of the type of data, + and optional code or date-based filters of the data. + """ + + resource_type = "DataRequirement" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.codeFilter = None + """ What codes are expected. + List of `DataRequirementCodeFilter` items (represented as `dict` in JSON). """ + + self.dateFilter = None + """ What dates/date ranges are expected. + List of `DataRequirementDateFilter` items (represented as `dict` in JSON). """ + + self.mustSupport = None + """ Indicates that specific structure elements are referenced by the + knowledge module. + List of `str` items. """ + + self.profile = None + """ The profile of the required data. + List of `str` items. """ + + self.type = None + """ The type of the required data. + Type `str`. """ + + super(DataRequirement, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DataRequirement, self).elementProperties() + js.extend([ + ("codeFilter", "codeFilter", DataRequirementCodeFilter, True, None, False), + ("dateFilter", "dateFilter", DataRequirementDateFilter, True, None, False), + ("mustSupport", "mustSupport", str, True, None, False), + ("profile", "profile", str, True, None, False), + ("type", "type", str, False, None, True), + ]) + return js + + +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. + """ + + resource_type = "DataRequirementCodeFilter" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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 + """ 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.valueSetString = None + """ Valueset for the filter. + Type `str`. """ + + super(DataRequirementCodeFilter, self).__init__(jsondict=jsondict, strict=strict) + + 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), + ]) + return js + + +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. + """ + + resource_type = "DataRequirementDateFilter" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.path = None + """ The date-valued attribute of the filter. + Type `str`. """ + + self.valueDateTime = None + """ The value of the filter, as a Period, DateTime, or Duration value. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueDuration = None + """ The value of the filter, as a Period, DateTime, or Duration value. + Type `Duration` (represented as `dict` in JSON). """ + + self.valuePeriod = None + """ The value of the filter, as a Period, DateTime, or Duration value. + Type `Period` (represented as `dict` in JSON). """ + + super(DataRequirementDateFilter, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DataRequirementDateFilter, self).elementProperties() + js.extend([ + ("path", "path", str, False, None, True), + ("valueDateTime", "valueDateTime", fhirdate.FHIRDate, False, "value", False), + ("valueDuration", "valueDuration", duration.Duration, False, "value", False), + ("valuePeriod", "valuePeriod", period.Period, False, "value", 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 duration +except ImportError: + duration = sys.modules[__package__ + '.duration'] +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 period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/STU3/detectedissue.py b/fhirclient/models/STU3/detectedissue.py new file mode 100644 index 000000000..0d3f2e15b --- /dev/null +++ b/fhirclient/models/STU3/detectedissue.py @@ -0,0 +1,154 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/DetectedIssue) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class DetectedIssue(domainresource.DomainResource): + """ Clinical issue with action. + + Indicates an actual or potential clinical issue with or between one or more + active or proposed clinical actions for a patient; e.g. Drug-drug + interaction, Ineffective treatment frequency, Procedure-condition conflict, + etc. + """ + + resource_type = "DetectedIssue" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ The provider or device that identified the issue. + Type `FHIRReference` referencing `Practitioner, Device` (represented as `dict` in JSON). """ + + self.category = 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.identifier = None + """ Unique id for the detected issue. + Type `Identifier` (represented as `dict` in JSON). """ + + self.implicated = None + """ Problem resource. + List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + + self.mitigation = None + """ Step taken to address. + List of `DetectedIssueMitigation` items (represented as `dict` in JSON). """ + + self.patient = None + """ Associated patient. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.reference = None + """ Authority for issue. + Type `str`. """ + + self.severity = None + """ high | moderate | low. + Type `str`. """ + + self.status = None + """ registered | preliminary | final | amended +. + Type `str`. """ + + super(DetectedIssue, self).__init__(jsondict=jsondict, strict=strict) + + 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), + ("detail", "detail", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("implicated", "implicated", fhirreference.FHIRReference, True, None, False), + ("mitigation", "mitigation", DetectedIssueMitigation, True, None, False), + ("patient", "patient", fhirreference.FHIRReference, False, None, False), + ("reference", "reference", str, False, None, False), + ("severity", "severity", str, False, None, False), + ("status", "status", str, False, None, True), + ]) + return js + + +from . import backboneelement + +class DetectedIssueMitigation(backboneelement.BackboneElement): + """ Step taken to address. + + Indicates an action that has been taken or is committed to 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. + """ + + resource_type = "DetectedIssueMitigation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ What mitigation?. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.author = None + """ Who is committing?. + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + self.date = None + """ Date committed. + Type `FHIRDate` (represented as `str` in JSON). """ + + super(DetectedIssueMitigation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DetectedIssueMitigation, self).elementProperties() + js.extend([ + ("action", "action", codeableconcept.CodeableConcept, False, None, True), + ("author", "author", fhirreference.FHIRReference, False, None, False), + ("date", "date", fhirdate.FHIRDate, 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/STU3/detectedissue_tests.py b/fhirclient/models/STU3/detectedissue_tests.py new file mode 100644 index 000000000..df3dc3cab --- /dev/null +++ b/fhirclient/models/STU3/detectedissue_tests.py @@ -0,0 +1,107 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import detectedissue +from .fhirdate import FHIRDate + + +class DetectedIssueTests(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("DetectedIssue", js["resourceType"]) + return detectedissue.DetectedIssue(js) + + def testDetectedIssue1(self): + inst = self.instantiate_from("detectedissue-example-allergy.json") + self.assertIsNotNone(inst, "Must have instantiated a DetectedIssue instance") + self.implDetectedIssue1(inst) + + js = inst.as_json() + self.assertEqual("DetectedIssue", js["resourceType"]) + inst2 = detectedissue.DetectedIssue(js) + self.implDetectedIssue1(inst2) + + def implDetectedIssue1(self, inst): + self.assertEqual(inst.id, "allergy") + self.assertEqual(inst.status, "final") + self.assertEqual(inst.text.div, "
[Put rendering here]
") + self.assertEqual(inst.text.status, "generated") + + def testDetectedIssue2(self): + inst = self.instantiate_from("detectedissue-example-dup.json") + self.assertIsNotNone(inst, "Must have instantiated a DetectedIssue instance") + self.implDetectedIssue2(inst) + + js = inst.as_json() + self.assertEqual("DetectedIssue", js["resourceType"]) + inst2 = detectedissue.DetectedIssue(js) + 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.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.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.json") + self.assertIsNotNone(inst, "Must have instantiated a DetectedIssue instance") + self.implDetectedIssue3(inst) + + js = inst.as_json() + self.assertEqual("DetectedIssue", js["resourceType"]) + inst2 = detectedissue.DetectedIssue(js) + self.implDetectedIssue3(inst2) + + def implDetectedIssue3(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.status, "final") + self.assertEqual(inst.text.status, "generated") + + def testDetectedIssue4(self): + inst = self.instantiate_from("detectedissue-example-lab.json") + self.assertIsNotNone(inst, "Must have instantiated a DetectedIssue instance") + self.implDetectedIssue4(inst) + + js = inst.as_json() + self.assertEqual("DetectedIssue", js["resourceType"]) + inst2 = detectedissue.DetectedIssue(js) + self.implDetectedIssue4(inst2) + + def implDetectedIssue4(self, inst): + self.assertEqual(inst.id, "lab") + self.assertEqual(inst.status, "final") + self.assertEqual(inst.text.div, "
[Put rendering here]
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/STU3/device.py b/fhirclient/models/STU3/device.py new file mode 100644 index 000000000..48dfff695 --- /dev/null +++ b/fhirclient/models/STU3/device.py @@ -0,0 +1,213 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Device) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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. + """ + + resource_type = "Device" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Details for human/organization for support. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + self.expirationDate = None + """ Date and time of expiry of this device (if applicable). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.identifier = None + """ Instance identifier. + 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). """ + + self.lotNumber = None + """ Lot number of manufacture. + Type `str`. """ + + self.manufactureDate = None + """ Date when the device was made. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.manufacturer = None + """ Name of device manufacturer. + Type `str`. """ + + self.model = None + """ Model id assigned by the manufacturer. + Type `str`. """ + + self.note = None + """ Device notes and comments. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.owner = None + """ Organization responsible for device. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.patient = None + """ Patient to whom Device is affixed. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.safety = None + """ Safety Characteristics of Device. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.status = None + """ active | inactive | entered-in-error | unknown. + Type `str`. """ + + self.type = None + """ What kind of device this is. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.udi = None + """ Unique Device Identifier (UDI) Barcode string. + Type `DeviceUdi` (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`. """ + + super(Device, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Device, self).elementProperties() + js.extend([ + ("contact", "contact", contactpoint.ContactPoint, True, 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), + ("note", "note", annotation.Annotation, True, None, False), + ("owner", "owner", fhirreference.FHIRReference, False, None, False), + ("patient", "patient", fhirreference.FHIRReference, False, None, False), + ("safety", "safety", codeableconcept.CodeableConcept, True, None, False), + ("status", "status", str, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("udi", "udi", DeviceUdi, False, None, False), + ("url", "url", str, False, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class DeviceUdi(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. + """ + + resource_type = "DeviceUdi" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.carrierAIDC = None + """ UDI Machine Readable Barcode String. + Type `str`. """ + + self.carrierHRF = None + """ UDI Human Readable Barcode String. + Type `str`. """ + + self.deviceIdentifier = None + """ Mandatory fixed portion of UDI. + Type `str`. """ + + self.entryType = None + """ barcode | rfid | manual +. + Type `str`. """ + + self.issuer = None + """ UDI Issuing Organization. + Type `str`. """ + + self.jurisdiction = None + """ 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) + + def elementProperties(self): + js = super(DeviceUdi, self).elementProperties() + js.extend([ + ("carrierAIDC", "carrierAIDC", str, False, None, False), + ("carrierHRF", "carrierHRF", str, False, None, False), + ("deviceIdentifier", "deviceIdentifier", str, False, None, False), + ("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 + + +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 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/STU3/device_tests.py b/fhirclient/models/STU3/device_tests.py new file mode 100644 index 000000000..3a03c060a --- /dev/null +++ b/fhirclient/models/STU3/device_tests.py @@ -0,0 +1,265 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import device +from .fhirdate import FHIRDate + + +class DeviceTests(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("Device", js["resourceType"]) + return device.Device(js) + + def testDevice1(self): + inst = self.instantiate_from("device-example-software.json") + self.assertIsNotNone(inst, "Must have instantiated a Device instance") + self.implDevice1(inst) + + js = inst.as_json() + self.assertEqual("Device", js["resourceType"]) + inst2 = device.Device(js) + self.implDevice1(inst2) + + def implDevice1(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 testDevice2(self): + inst = self.instantiate_from("device-example-udi3.json") + self.assertIsNotNone(inst, "Must have instantiated a Device instance") + self.implDevice2(inst) + + js = inst.as_json() + self.assertEqual("Device", js["resourceType"]) + inst2 = device.Device(js) + self.implDevice2(inst2) + + def implDevice2(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 testDevice3(self): + inst = self.instantiate_from("device-example-udi2.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.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 testDevice4(self): + inst = self.instantiate_from("device-example-f001-feedingtube.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.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.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 testDevice5(self): + inst = self.instantiate_from("device-example-pacemaker.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.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 testDevice6(self): + inst = self.instantiate_from("device-example-udi4.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.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 testDevice7(self): + inst = self.instantiate_from("device-example-ihe-pcd.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.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 testDevice8(self): + inst = self.instantiate_from("device-example.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.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.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") + + def testDevice9(self): + inst = self.instantiate_from("device-example-udi1.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.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") + diff --git a/fhirclient/models/STU3/devicecomponent.py b/fhirclient/models/STU3/devicecomponent.py new file mode 100644 index 000000000..6e930788b --- /dev/null +++ b/fhirclient/models/STU3/devicecomponent.py @@ -0,0 +1,150 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/DeviceComponent) on 2019-10-12. +# 2019, 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/STU3/devicecomponent_tests.py b/fhirclient/models/STU3/devicecomponent_tests.py new file mode 100644 index 000000000..2324cf1ac --- /dev/null +++ b/fhirclient/models/STU3/devicecomponent_tests.py @@ -0,0 +1,88 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +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.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") + 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") + + def testDeviceComponent2(self): + inst = self.instantiate_from("devicecomponent-example-prodspec.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-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") + diff --git a/fhirclient/models/STU3/devicemetric.py b/fhirclient/models/STU3/devicemetric.py new file mode 100644 index 000000000..af0cb5576 --- /dev/null +++ b/fhirclient/models/STU3/devicemetric.py @@ -0,0 +1,148 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/DeviceMetric) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class DeviceMetric(domainresource.DomainResource): + """ Measurement, calculation or setting capability of a medical device. + + Describes a measurement, calculation or setting capability of a medical + device. + """ + + resource_type = "DeviceMetric" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.calibration = None + """ Describes the calibrations that have been performed or that are + required to be performed. + List of `DeviceMetricCalibration` items (represented as `dict` in JSON). """ + + self.category = None + """ measurement | setting | calculation | unspecified. + Type `str`. """ + + self.color = None + """ black | red | green | yellow | blue | magenta | cyan | white. + Type `str`. """ + + self.identifier = None + """ Unique identifier of this DeviceMetric. + Type `Identifier` (represented as `dict` in JSON). """ + + self.measurementPeriod = None + """ Describes the measurement repetition time. + Type `Timing` (represented as `dict` in JSON). """ + + self.operationalStatus = None + """ on | off | standby | entered-in-error. + Type `str`. """ + + self.parent = None + """ Describes the link to the parent DeviceComponent. + Type `FHIRReference` referencing `DeviceComponent` (represented as `dict` in JSON). """ + + self.source = None + """ Describes the link to the source Device. + Type `FHIRReference` referencing `Device` (represented as `dict` in JSON). """ + + self.type = None + """ Identity of metric, for example Heart Rate or PEEP Setting. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.unit = None + """ Unit of Measure for the Metric. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(DeviceMetric, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DeviceMetric, self).elementProperties() + js.extend([ + ("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), + ("measurementPeriod", "measurementPeriod", timing.Timing, False, None, False), + ("operationalStatus", "operationalStatus", str, False, None, False), + ("parent", "parent", fhirreference.FHIRReference, False, None, False), + ("source", "source", fhirreference.FHIRReference, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ("unit", "unit", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import backboneelement + +class DeviceMetricCalibration(backboneelement.BackboneElement): + """ Describes the calibrations that have been performed or that are required to + be performed. + """ + + resource_type = "DeviceMetricCalibration" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.state = None + """ not-calibrated | calibration-required | calibrated | unspecified. + Type `str`. """ + + self.time = None + """ Describes the time last calibration has been performed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.type = None + """ unspecified | offset | gain | two-point. + Type `str`. """ + + super(DeviceMetricCalibration, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DeviceMetricCalibration, self).elementProperties() + js.extend([ + ("state", "state", str, False, None, False), + ("time", "time", fhirdate.FHIRDate, 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 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 timing +except ImportError: + timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/STU3/devicemetric_tests.py b/fhirclient/models/STU3/devicemetric_tests.py new file mode 100644 index 000000000..a59340fa1 --- /dev/null +++ b/fhirclient/models/STU3/devicemetric_tests.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import devicemetric +from .fhirdate import FHIRDate + + +class DeviceMetricTests(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("DeviceMetric", js["resourceType"]) + return devicemetric.DeviceMetric(js) + + def testDeviceMetric1(self): + inst = self.instantiate_from("devicemetric-example.json") + self.assertIsNotNone(inst, "Must have instantiated a DeviceMetric instance") + self.implDeviceMetric1(inst) + + js = inst.as_json() + self.assertEqual("DeviceMetric", js["resourceType"]) + inst2 = devicemetric.DeviceMetric(js) + self.implDeviceMetric1(inst2) + + def implDeviceMetric1(self, inst): + self.assertEqual(inst.calibration[0].state, "calibrated") + self.assertEqual(inst.calibration[0].time.date, FHIRDate("2016-12-28T09:03:04-05:00").date) + self.assertEqual(inst.calibration[0].time.as_json(), "2016-12-28T09:03:04-05:00") + self.assertEqual(inst.calibration[0].type, "two-point") + 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.measurementPeriod.repeat.frequency, 1) + self.assertEqual(inst.measurementPeriod.repeat.period, 1) + self.assertEqual(inst.measurementPeriod.repeat.periodUnit, "s") + 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.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") + diff --git a/fhirclient/models/STU3/devicerequest.py b/fhirclient/models/STU3/devicerequest.py new file mode 100644 index 000000000..d3b60ba26 --- /dev/null +++ b/fhirclient/models/STU3/devicerequest.py @@ -0,0 +1,225 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/DeviceRequest) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class DeviceRequest(domainresource.DomainResource): + """ Medical device request. + + Represents a request for a patient to employ a medical device. The device + may be an implantable device, or an external assistive device, such as a + walker. + """ + + resource_type = "DeviceRequest" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ When recorded. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.basedOn = None + """ What request fulfills. + List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + + self.codeCodeableConcept = None + """ Device requested. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.codeReference = None + """ Device requested. + Type `FHIRReference` referencing `Device` (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.groupIdentifier = None + """ Identifier of composite request. + Type `Identifier` (represented as `dict` in JSON). """ + + self.identifier = None + """ External Request identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.intent = None + """ proposal | plan | original-order | encoded | reflex-order. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.note = None + """ Notes or comments. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.occurrenceDateTime = None + """ Desired time or schedule for use. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.occurrencePeriod = None + """ Desired time or schedule for use. + Type `Period` (represented as `dict` in JSON). """ + + self.occurrenceTiming = None + """ Desired time or schedule for use. + Type `Timing` (represented as `dict` in JSON). """ + + self.performer = None + """ Requested Filler. + Type `FHIRReference` referencing `Practitioner, Organization, Patient, Device, RelatedPerson, HealthcareService` (represented as `dict` in JSON). """ + + self.performerType = None + """ Fille 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). """ + + self.priority = None + """ Indicates how quickly the {{title}} should be addressed with + respect to other requests. + Type `str`. """ + + self.reasonCode = None + """ Coded Reason for request. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.reasonReference = None + """ Linked Reason for request. + List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + + self.relevantHistory = None + """ Request provenance. + List of `FHIRReference` items referencing `Provenance` (represented as `dict` in JSON). """ + + self.requester = None + """ Who/what is requesting diagnostics. + Type `DeviceRequestRequester` (represented as `dict` in JSON). """ + + self.status = None + """ draft | active | suspended | completed | entered-in-error | + cancelled. + Type `str`. """ + + self.subject = None + """ Focus of request. + Type `FHIRReference` referencing `Patient, Group, Location, Device` (represented as `dict` in JSON). """ + + self.supportingInfo = None + """ Additional clinical information. + List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + + super(DeviceRequest, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DeviceRequest, self).elementProperties() + js.extend([ + ("authoredOn", "authoredOn", fhirdate.FHIRDate, False, None, False), + ("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), + ("groupIdentifier", "groupIdentifier", identifier.Identifier, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("intent", "intent", codeableconcept.CodeableConcept, 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), + ("performer", "performer", fhirreference.FHIRReference, False, None, False), + ("performerType", "performerType", codeableconcept.CodeableConcept, False, None, False), + ("priorRequest", "priorRequest", fhirreference.FHIRReference, True, None, False), + ("priority", "priority", str, False, None, False), + ("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), + ("status", "status", str, False, None, False), + ("subject", "subject", fhirreference.FHIRReference, False, None, True), + ("supportingInfo", "supportingInfo", fhirreference.FHIRReference, True, None, False), + ]) + return js + + +from . import backboneelement + +class DeviceRequestRequester(backboneelement.BackboneElement): + """ Who/what is requesting diagnostics. + + The individual who initiated the request and has responsibility for its + activation. + """ + + resource_type = "DeviceRequestRequester" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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(DeviceRequestRequester, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DeviceRequestRequester, 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'] +try: + from . import timing +except ImportError: + timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/STU3/devicerequest_tests.py b/fhirclient/models/STU3/devicerequest_tests.py new file mode 100644 index 000000000..42acf697e --- /dev/null +++ b/fhirclient/models/STU3/devicerequest_tests.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import devicerequest +from .fhirdate import FHIRDate + + +class DeviceRequestTests(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("DeviceRequest", js["resourceType"]) + return devicerequest.DeviceRequest(js) + + def testDeviceRequest1(self): + inst = self.instantiate_from("devicerequest-example-insulinpump.json") + self.assertIsNotNone(inst, "Must have instantiated a DeviceRequest instance") + self.implDeviceRequest1(inst) + + js = inst.as_json() + self.assertEqual("DeviceRequest", js["resourceType"]) + inst2 = devicerequest.DeviceRequest(js) + self.implDeviceRequest1(inst2) + + def implDeviceRequest1(self, inst): + self.assertEqual(inst.authoredOn.date, FHIRDate("2013-05-08T09:33:27+07:00").date) + self.assertEqual(inst.authoredOn.as_json(), "2013-05-08T09:33:27+07:00") + self.assertEqual(inst.codeCodeableConcept.coding[0].code, "43148-6") + self.assertEqual(inst.codeCodeableConcept.coding[0].system, "http://loinc.org") + self.assertEqual(inst.codeCodeableConcept.text, "Insulin delivery device panel") + 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.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") + self.assertEqual(inst.performerType.coding[0].display, "Qualified nurse") + self.assertEqual(inst.performerType.text, "Nurse") + self.assertEqual(inst.priority, "routine") + self.assertEqual(inst.reasonCode[0].text, "gastroparesis") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + + def testDeviceRequest2(self): + inst = self.instantiate_from("devicerequest-example.json") + self.assertIsNotNone(inst, "Must have instantiated a DeviceRequest instance") + self.implDeviceRequest2(inst) + + js = inst.as_json() + self.assertEqual("DeviceRequest", js["resourceType"]) + inst2 = devicerequest.DeviceRequest(js) + self.implDeviceRequest2(inst2) + + def implDeviceRequest2(self, inst): + self.assertEqual(inst.id, "example") + self.assertEqual(inst.intent.coding[0].code, "original-order") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/STU3/deviceusestatement.py b/fhirclient/models/STU3/deviceusestatement.py new file mode 100644 index 000000000..9c06f42e3 --- /dev/null +++ b/fhirclient/models/STU3/deviceusestatement.py @@ -0,0 +1,129 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/DeviceUseStatement) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class DeviceUseStatement(domainresource.DomainResource): + """ Record of use of a device. + + A record of a device being used by a patient where the record is the result + of a report from the patient or another clinician. + """ + + resource_type = "DeviceUseStatement" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.bodySite = None + """ Target body site. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.device = None + """ Reference to device used. + Type `FHIRReference` referencing `Device` (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.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). """ + + self.status = None + """ active | completed | entered-in-error +. + Type `str`. """ + + self.subject = None + """ Patient using device. + Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ + + self.timingDateTime = None + """ How often the device was used. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.timingPeriod = None + """ How often the device was used. + Type `Period` (represented as `dict` in JSON). """ + + self.timingTiming = None + """ 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([ + ("bodySite", "bodySite", codeableconcept.CodeableConcept, False, 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), + ("recordedOn", "recordedOn", fhirdate.FHIRDate, False, None, False), + ("source", "source", fhirreference.FHIRReference, False, None, False), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, True), + ("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 + + +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'] +try: + from . import timing +except ImportError: + timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/STU3/deviceusestatement_tests.py b/fhirclient/models/STU3/deviceusestatement_tests.py new file mode 100644 index 000000000..9688b9023 --- /dev/null +++ b/fhirclient/models/STU3/deviceusestatement_tests.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import deviceusestatement +from .fhirdate import FHIRDate + + +class DeviceUseStatementTests(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("DeviceUseStatement", js["resourceType"]) + return deviceusestatement.DeviceUseStatement(js) + + def testDeviceUseStatement1(self): + inst = self.instantiate_from("deviceusestatement-example.json") + self.assertIsNotNone(inst, "Must have instantiated a DeviceUseStatement instance") + self.implDeviceUseStatement1(inst) + + js = inst.as_json() + self.assertEqual("DeviceUseStatement", js["resourceType"]) + inst2 = deviceusestatement.DeviceUseStatement(js) + self.implDeviceUseStatement1(inst2) + + 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.status, "active") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/STU3/diagnosticreport.py b/fhirclient/models/STU3/diagnosticreport.py new file mode 100644 index 000000000..61a50f415 --- /dev/null +++ b/fhirclient/models/STU3/diagnosticreport.py @@ -0,0 +1,229 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/DiagnosticReport) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class DiagnosticReport(domainresource.DomainResource): + """ A Diagnostic report - a combination of request information, atomic results, + images, interpretation, as well as formatted reports. + + The findings and interpretation of diagnostic tests performed on patients, + groups of patients, devices, and locations, and/or specimens derived from + these. The report includes clinical context such as requesting and provider + information, and some mix of atomic results, images, textual and coded + interpretations, and formatted representation of diagnostic reports. + """ + + resource_type = "DiagnosticReport" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.basedOn = None + """ What was requested. + List of `FHIRReference` items referencing `CarePlan, ImmunizationRecommendation, MedicationRequest, NutritionOrder, ProcedureRequest, ReferralRequest` (represented as `dict` in JSON). """ + + self.category = None + """ Service category. + Type `CodeableConcept` (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. + Type `str`. """ + + self.context = None + """ Health care event when test ordered. + Type `FHIRReference` referencing `Encounter, EpisodeOfCare` (represented as `dict` in JSON). """ + + self.effectiveDateTime = None + """ Clinically relevant time/time-period for report. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.effectivePeriod = None + """ Clinically relevant time/time-period for report. + Type `Period` (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). """ + + self.issued = None + """ DateTime this version was released. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.performer = None + """ Participants in producing the report. + List of `DiagnosticReportPerformer` 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). """ + + self.specimen = None + """ Specimens this report is based on. + List of `FHIRReference` items referencing `Specimen` (represented as `dict` in JSON). """ + + self.status = None + """ registered | partial | preliminary | final +. + Type `str`. """ + + 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). """ + + super(DiagnosticReport, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DiagnosticReport, self).elementProperties() + js.extend([ + ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), + ("category", "category", codeableconcept.CodeableConcept, False, 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), + ("effectiveDateTime", "effectiveDateTime", fhirdate.FHIRDate, False, "effective", False), + ("effectivePeriod", "effectivePeriod", period.Period, False, "effective", 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), + ("presentedForm", "presentedForm", attachment.Attachment, True, None, False), + ("result", "result", 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), + ]) + return js + + +from . import backboneelement + +class DiagnosticReportImage(backboneelement.BackboneElement): + """ Key images associated with this report. + + A list of key images associated with this report. The images are generally + created during the diagnostic process, and may be directly of the patient, + or of treated specimens (i.e. slides of interest). + """ + + resource_type = "DiagnosticReportImage" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Comment about the image (e.g. explanation). + Type `str`. """ + + self.link = None + """ Reference to the image source. + Type `FHIRReference` referencing `Media` (represented as `dict` in JSON). """ + + super(DiagnosticReportImage, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DiagnosticReportImage, self).elementProperties() + js.extend([ + ("comment", "comment", str, False, None, False), + ("link", "link", fhirreference.FHIRReference, False, None, True), + ]) + 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 +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 period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/STU3/diagnosticreport_tests.py b/fhirclient/models/STU3/diagnosticreport_tests.py new file mode 100644 index 000000000..28cb98343 --- /dev/null +++ b/fhirclient/models/STU3/diagnosticreport_tests.py @@ -0,0 +1,339 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import diagnosticreport +from .fhirdate import FHIRDate + + +class DiagnosticReportTests(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("DiagnosticReport", js["resourceType"]) + return diagnosticreport.DiagnosticReport(js) + + def testDiagnosticReport1(self): + inst = self.instantiate_from("diagnosticreport-example-f202-bloodculture.json") + self.assertIsNotNone(inst, "Must have instantiated a DiagnosticReport instance") + self.implDiagnosticReport1(inst) + + js = inst.as_json() + self.assertEqual("DiagnosticReport", js["resourceType"]) + inst2 = diagnosticreport.DiagnosticReport(js) + self.implDiagnosticReport1(inst2) + + def implDiagnosticReport1(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 testDiagnosticReport2(self): + inst = self.instantiate_from("diagnosticreport-example-ghp.json") + self.assertIsNotNone(inst, "Must have instantiated a DiagnosticReport instance") + self.implDiagnosticReport2(inst) + + js = inst.as_json() + self.assertEqual("DiagnosticReport", js["resourceType"]) + inst2 = diagnosticreport.DiagnosticReport(js) + self.implDiagnosticReport2(inst2) + + def implDiagnosticReport2(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") + self.assertEqual(inst.status, "final") + self.assertEqual(inst.text.status, "generated") + + def testDiagnosticReport3(self): + inst = self.instantiate_from("diagnosticreport-example-lipids.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, "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 testDiagnosticReport4(self): + inst = self.instantiate_from("diagnosticreport-example-f001-bloodexam.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, "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 testDiagnosticReport5(self): + inst = self.instantiate_from("diagnosticreport-example-ultrasound.json") + self.assertIsNotNone(inst, "Must have instantiated a DiagnosticReport instance") + self.implDiagnosticReport5(inst) + + js = inst.as_json() + self.assertEqual("DiagnosticReport", js["resourceType"]) + inst2 = diagnosticreport.DiagnosticReport(js) + self.implDiagnosticReport5(inst2) + + def implDiagnosticReport5(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") + self.assertEqual(inst.status, "final") + self.assertEqual(inst.text.status, "generated") + + def testDiagnosticReport6(self): + inst = self.instantiate_from("diagnosticreport-example-f201-brainct.json") + self.assertIsNotNone(inst, "Must have instantiated a DiagnosticReport instance") + self.implDiagnosticReport6(inst) + + js = inst.as_json() + self.assertEqual("DiagnosticReport", js["resourceType"]) + inst2 = diagnosticreport.DiagnosticReport(js) + self.implDiagnosticReport6(inst2) + + def implDiagnosticReport6(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, "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.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.status, "final") + self.assertEqual(inst.text.status, "generated") + + def testDiagnosticReport7(self): + inst = self.instantiate_from("diagnosticreport-genetics-example-2-familyhistory.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, "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, "55233-1") + self.assertEqual(inst.code.coding[0].display, "Genetic analysis master panel") + self.assertEqual(inst.code.coding[0].system, "http://loinc.org") + self.assertEqual(inst.contained[0].id, "f1-genetics") + self.assertEqual(inst.effectiveDateTime.date, FHIRDate("2015-05-26T15:30:10+01:00").date) + self.assertEqual(inst.effectiveDateTime.as_json(), "2015-05-26T15:30:10+01:00") + self.assertEqual(inst.extension[0].url, "http://hl7.org/fhir/StructureDefinition/DiagnosticReport-geneticsFamilyMemberHistory") + self.assertEqual(inst.id, "dg2") + self.assertEqual(inst.issued.date, FHIRDate("2014-05-16T10:28:00+01:00").date) + self.assertEqual(inst.issued.as_json(), "2014-05-16T10:28:00+01:00") + self.assertEqual(inst.status, "final") + self.assertEqual(inst.text.status, "generated") + + def testDiagnosticReport8(self): + inst = self.instantiate_from("diagnosticreport-example.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.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, "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.code.coding[1].code, "CBC") + self.assertEqual(inst.code.coding[1].display, "MASTER FULL BLOOD COUNT") + self.assertEqual(inst.code.text, "Complete Blood Count") + self.assertEqual(inst.contained[0].id, "r1") + self.assertEqual(inst.contained[1].id, "r2") + self.assertEqual(inst.contained[2].id, "r3") + self.assertEqual(inst.contained[3].id, "r4") + self.assertEqual(inst.contained[4].id, "r5") + self.assertEqual(inst.contained[5].id, "r6") + self.assertEqual(inst.contained[6].id, "r7") + self.assertEqual(inst.contained[7].id, "r8") + self.assertEqual(inst.contained[8].id, "r9") + self.assertEqual(inst.contained[9].id, "r10") + 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, "101") + self.assertEqual(inst.identifier[0].system, "http://acme.com/lab/reports") + self.assertEqual(inst.identifier[0].value, "5234342") + self.assertEqual(inst.issued.date, FHIRDate("2011-03-04T11:45:33+11:00").date) + self.assertEqual(inst.issued.as_json(), "2011-03-04T11:45:33+11:00") + self.assertEqual(inst.meta.tag[0].code, "01") + self.assertEqual(inst.meta.tag[0].display, "Needs Review") + self.assertEqual(inst.meta.tag[0].system, "http://example.org/fhir/CodeSystem/workflow-codes") + self.assertEqual(inst.presentedForm[0].contentType, "application/pdf") + self.assertEqual(inst.presentedForm[0].language, "en-AU") + self.assertEqual(inst.presentedForm[0].title, "HTML Report") + self.assertEqual(inst.status, "final") + self.assertEqual(inst.text.status, "generated") + + def testDiagnosticReport9(self): + inst = self.instantiate_from("diagnosticreport-example-papsmear.json") + self.assertIsNotNone(inst, "Must have instantiated a DiagnosticReport instance") + self.implDiagnosticReport9(inst) + + js = inst.as_json() + self.assertEqual("DiagnosticReport", js["resourceType"]) + inst2 = diagnosticreport.DiagnosticReport(js) + self.implDiagnosticReport9(inst2) + + def implDiagnosticReport9(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 testDiagnosticReport10(self): + inst = self.instantiate_from("diagnosticreport-example-gingival-mass.json") + self.assertIsNotNone(inst, "Must have instantiated a DiagnosticReport instance") + self.implDiagnosticReport10(inst) + + js = inst.as_json() + self.assertEqual("DiagnosticReport", js["resourceType"]) + inst2 = diagnosticreport.DiagnosticReport(js) + self.implDiagnosticReport10(inst2) + + def implDiagnosticReport10(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") + 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") + self.assertEqual(inst.code.text, "Biopsy without Microscopic Description (1 Site/Lesion)-Standard") + self.assertEqual(inst.effectiveDateTime.date, FHIRDate("2017-03-02").date) + self.assertEqual(inst.effectiveDateTime.as_json(), "2017-03-02") + self.assertEqual(inst.id, "gingival-mass") + self.assertEqual(inst.identifier[0].system, "https://www.acmeonline.com") + 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.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") + diff --git a/fhirclient/models/STU3/distance.py b/fhirclient/models/STU3/distance.py new file mode 100644 index 000000000..bef19972c --- /dev/null +++ b/fhirclient/models/STU3/distance.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Distance) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import quantity + +class Distance(quantity.Quantity): + """ A length - a value with a unit that is a physical distance. + """ + + resource_type = "Distance" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + super(Distance, self).__init__(jsondict=jsondict, strict=strict) + + diff --git a/fhirclient/models/STU3/documentmanifest.py b/fhirclient/models/STU3/documentmanifest.py new file mode 100644 index 000000000..91adf82f2 --- /dev/null +++ b/fhirclient/models/STU3/documentmanifest.py @@ -0,0 +1,188 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/DocumentManifest) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class DocumentManifest(domainresource.DomainResource): + """ A list that defines a set of documents. + + A collection of documents compiled for a purpose together with metadata + that applies to the collection. + """ + + resource_type = "DocumentManifest" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Who and/or what authored the manifest. + List of `FHIRReference` items referencing `Practitioner, Organization, Device, Patient, RelatedPerson` (represented as `dict` in JSON). """ + + self.content = None + """ The items included. + List of `DocumentManifestContent` items (represented as `dict` in JSON). """ + + self.created = None + """ When this document manifest created. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Human-readable description (title). + Type `str`. """ + + self.identifier = None + """ Other identifiers for the manifest. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.masterIdentifier = None + """ Unique Identifier for the set of documents. + Type `Identifier` (represented as `dict` in JSON). """ + + 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). """ + + self.related = None + """ Related things. + List of `DocumentManifestRelated` items (represented as `dict` in JSON). """ + + self.source = None + """ The source system/application/software. + Type `str`. """ + + self.status = None + """ current | superseded | entered-in-error. + Type `str`. """ + + self.subject = None + """ The subject of the set of documents. + Type `FHIRReference` referencing `Patient, Practitioner, Group, Device` (represented as `dict` in JSON). """ + + self.type = None + """ Kind of document set. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(DocumentManifest, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DocumentManifest, self).elementProperties() + js.extend([ + ("author", "author", fhirreference.FHIRReference, True, None, False), + ("content", "content", DocumentManifestContent, True, None, True), + ("created", "created", fhirdate.FHIRDate, False, None, False), + ("description", "description", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("masterIdentifier", "masterIdentifier", identifier.Identifier, False, None, False), + ("recipient", "recipient", fhirreference.FHIRReference, True, None, False), + ("related", "related", DocumentManifestRelated, True, None, False), + ("source", "source", str, False, None, False), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +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. + + Related identifiers or resources associated with the DocumentManifest. + """ + + resource_type = "DocumentManifestRelated" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Identifiers of things that are related. + Type `Identifier` (represented as `dict` in JSON). """ + + self.ref = None + """ Related Resource. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + super(DocumentManifestRelated, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DocumentManifestRelated, self).elementProperties() + js.extend([ + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("ref", "ref", fhirreference.FHIRReference, 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'] diff --git a/fhirclient/models/STU3/documentmanifest_tests.py b/fhirclient/models/STU3/documentmanifest_tests.py new file mode 100644 index 000000000..1e448b313 --- /dev/null +++ b/fhirclient/models/STU3/documentmanifest_tests.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import documentmanifest +from .fhirdate import FHIRDate + + +class DocumentManifestTests(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("DocumentManifest", js["resourceType"]) + return documentmanifest.DocumentManifest(js) + + def testDocumentManifest1(self): + inst = self.instantiate_from("documentmanifest-example.json") + self.assertIsNotNone(inst, "Must have instantiated a DocumentManifest instance") + self.implDocumentManifest1(inst) + + js = inst.as_json() + self.assertEqual("DocumentManifest", js["resourceType"]) + inst2 = documentmanifest.DocumentManifest(js) + self.implDocumentManifest1(inst2) + + def implDocumentManifest1(self, inst): + self.assertEqual(inst.contained[0].id, "a1") + self.assertEqual(inst.created.date, FHIRDate("2004-12-25T23:50:50-05:00").date) + self.assertEqual(inst.created.as_json(), "2004-12-25T23:50:50-05:00") + self.assertEqual(inst.description, "Physical") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier[0].system, "http://example.org/documents") + 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.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") + self.assertEqual(inst.status, "current") + self.assertEqual(inst.text.div, "
Text
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.text, "History and Physical") + diff --git a/fhirclient/models/STU3/documentreference.py b/fhirclient/models/STU3/documentreference.py new file mode 100644 index 000000000..948fd8d07 --- /dev/null +++ b/fhirclient/models/STU3/documentreference.py @@ -0,0 +1,316 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/DocumentReference) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class DocumentReference(domainresource.DomainResource): + """ A reference to a document. + """ + + resource_type = "DocumentReference" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.authenticator = None + """ Who/what authenticated the document. + Type `FHIRReference` referencing `Practitioner, Organization` (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). """ + + self.class_fhir = None + """ Categorization of document. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.content = None + """ Document referenced. + List of `DocumentReferenceContent` items (represented as `dict` in JSON). """ + + self.context = None + """ 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). """ + + self.description = None + """ Human-readable description (title). + Type `str`. """ + + self.docStatus = None + """ preliminary | final | appended | amended | entered-in-error. + Type `str`. """ + + self.identifier = None + """ 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). """ + + self.relatesTo = None + """ Relationships to other documents. + List of `DocumentReferenceRelatesTo` items (represented as `dict` in JSON). """ + + self.securityLabel = None + """ Document security-tags. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.status = None + """ current | superseded | entered-in-error. + Type `str`. """ + + self.subject = None + """ Who/what is the subject of the document. + Type `FHIRReference` referencing `Patient, Practitioner, Group, Device` (represented as `dict` in JSON). """ + + self.type = None + """ Kind of document (LOINC if possible). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(DocumentReference, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DocumentReference, self).elementProperties() + js.extend([ + ("authenticator", "authenticator", fhirreference.FHIRReference, False, None, False), + ("author", "author", fhirreference.FHIRReference, True, None, False), + ("class_fhir", "class", codeableconcept.CodeableConcept, False, 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), + ("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), + ]) + return js + + +from . import backboneelement + +class DocumentReferenceContent(backboneelement.BackboneElement): + """ Document referenced. + + The document and format referenced. There may be multiple content element + repetitions, each with a different format. + """ + + resource_type = "DocumentReferenceContent" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Where to access the document. + Type `Attachment` (represented as `dict` in JSON). """ + + self.format = None + """ Format/content rules for the document. + Type `Coding` (represented as `dict` in JSON). """ + + super(DocumentReferenceContent, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DocumentReferenceContent, self).elementProperties() + js.extend([ + ("attachment", "attachment", attachment.Attachment, False, None, True), + ("format", "format", coding.Coding, False, None, False), + ]) + return js + + +class DocumentReferenceContext(backboneelement.BackboneElement): + """ Clinical context of document. + + The clinical context in which the document was prepared. + """ + + resource_type = "DocumentReferenceContext" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.encounter = None + """ Context of the document content. + Type `FHIRReference` referencing `Encounter` (represented as `dict` in JSON). """ + + self.event = None + """ Main clinical acts documented. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.facilityType = None + """ Kind of facility where patient was seen. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.period = None + """ Time of service that is being documented. + Type `Period` (represented as `dict` in JSON). """ + + self.practiceSetting = None + """ Additional details about where the content was created (e.g. + clinical specialty). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.related = None + """ Related identifiers or resources. + List of `DocumentReferenceContextRelated` items (represented as `dict` in JSON). """ + + self.sourcePatientInfo = None + """ Patient demographics from source. + Type `FHIRReference` referencing `Patient` (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), + ("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), + ("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. + + Relationships that this document has with other document references that + already exist. + """ + + resource_type = "DocumentReferenceRelatesTo" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ replaces | transforms | signs | appends. + Type `str`. """ + + self.target = None + """ Target of the relationship. + Type `FHIRReference` referencing `DocumentReference` (represented as `dict` in JSON). """ + + super(DocumentReferenceRelatesTo, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DocumentReferenceRelatesTo, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("target", "target", fhirreference.FHIRReference, False, None, True), + ]) + 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 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 period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/STU3/documentreference_tests.py b/fhirclient/models/STU3/documentreference_tests.py new file mode 100644 index 000000000..2990b8f56 --- /dev/null +++ b/fhirclient/models/STU3/documentreference_tests.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import documentreference +from .fhirdate import FHIRDate + + +class DocumentReferenceTests(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("DocumentReference", js["resourceType"]) + return documentreference.DocumentReference(js) + + def testDocumentReference1(self): + inst = self.instantiate_from("documentreference-example.json") + self.assertIsNotNone(inst, "Must have instantiated a DocumentReference instance") + self.implDocumentReference1(inst) + + js = inst.as_json() + self.assertEqual("DocumentReference", js["resourceType"]) + inst2 = documentreference.DocumentReference(js) + 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.contained[0].id, "a2") + self.assertEqual(inst.content[0].attachment.contentType, "application/hl7-v3+xml") + 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.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") + self.assertEqual(inst.content[0].format.system, "urn:oid:1.3.6.1.4.1.19376.1.2.3") + self.assertEqual(inst.context.event[0].coding[0].code, "T-D8200") + self.assertEqual(inst.context.event[0].coding[0].display, "Arm") + self.assertEqual(inst.context.event[0].coding[0].system, "http://ihe.net/xds/connectathon/eventCodes") + self.assertEqual(inst.context.facilityType.coding[0].code, "Outpatient") + self.assertEqual(inst.context.facilityType.coding[0].display, "Outpatient") + self.assertEqual(inst.context.facilityType.coding[0].system, "http://www.ihe.net/xds/connectathon/healthcareFacilityTypeCodes") + self.assertEqual(inst.context.period.end.date, FHIRDate("2004-12-23T08:01:00+11:00").date) + self.assertEqual(inst.context.period.end.as_json(), "2004-12-23T08:01:00+11:00") + self.assertEqual(inst.context.period.start.date, FHIRDate("2004-12-23T08:00:00+11:00").date) + self.assertEqual(inst.context.period.start.as_json(), "2004-12-23T08:00:00+11:00") + 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.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.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.status, "current") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.coding[0].code, "34108-1") + self.assertEqual(inst.type.coding[0].display, "Outpatient Note") + self.assertEqual(inst.type.coding[0].system, "http://loinc.org") + diff --git a/fhirclient/models/STU3/domainresource.py b/fhirclient/models/STU3/domainresource.py new file mode 100644 index 000000000..f7f6822e0 --- /dev/null +++ b/fhirclient/models/STU3/domainresource.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/DomainResource) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import resource + +class DomainResource(resource.Resource): + """ A resource with narrative, extensions, and contained resources. + + A resource that includes narrative, extensions, and contained resources. + """ + + resource_type = "DomainResource" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.contained = None + """ Contained, inline Resources. + List of `Resource` items (represented as `dict` in JSON). """ + + self.extension = None + """ Additional Content defined by implementations. + List of `Extension` items (represented as `dict` in JSON). """ + + self.modifierExtension = None + """ Extensions that cannot be ignored. + List of `Extension` items (represented as `dict` in JSON). """ + + self.text = None + """ Text summary of the resource, for human interpretation. + Type `Narrative` (represented as `dict` in JSON). """ + + super(DomainResource, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DomainResource, self).elementProperties() + js.extend([ + ("contained", "contained", resource.Resource, True, None, False), + ("extension", "extension", extension.Extension, True, None, False), + ("modifierExtension", "modifierExtension", extension.Extension, True, None, False), + ("text", "text", narrative.Narrative, False, None, False), + ]) + return js + + +import sys +try: + from . import extension +except ImportError: + extension = sys.modules[__package__ + '.extension'] +try: + from . import narrative +except ImportError: + narrative = sys.modules[__package__ + '.narrative'] diff --git a/fhirclient/models/STU3/dosage.py b/fhirclient/models/STU3/dosage.py new file mode 100644 index 000000000..4b809e8af --- /dev/null +++ b/fhirclient/models/STU3/dosage.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Dosage) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Dosage(element.Element): + """ How the medication is/was taken or should be taken. + + Indicates how the medication is/was taken or should be taken by the + patient. + """ + + resource_type = "Dosage" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.additionalInstruction = None + """ Supplemental instruction - e.g. "with meals". + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.asNeededBoolean = None + """ Take "as needed" (for x). + Type `bool`. """ + + self.asNeededCodeableConcept = None + """ 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.maxDosePerAdministration = None + """ Upper limit on medication per administration. + Type `Quantity` (represented as `dict` in JSON). """ + + self.maxDosePerLifetime = None + """ Upper limit on medication per lifetime of the patient. + Type `Quantity` (represented as `dict` in JSON). """ + + self.maxDosePerPeriod = None + """ Upper limit on medication per unit of time. + Type `Ratio` (represented as `dict` in JSON). """ + + self.method = None + """ Technique for administering medication. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.patientInstruction = None + """ 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). """ + + self.sequence = None + """ The order of the dosage instructions. + Type `int`. """ + + self.site = None + """ Body site to administer to. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.text = None + """ Free text dosage instructions e.g. SIG. + Type `str`. """ + + self.timing = None + """ When medication should be administered. + Type `Timing` (represented as `dict` in JSON). """ + + super(Dosage, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Dosage, self).elementProperties() + js.extend([ + ("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), + ("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), + ("text", "text", str, False, None, False), + ("timing", "timing", timing.Timing, 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'] +try: + from . import ratio +except ImportError: + ratio = sys.modules[__package__ + '.ratio'] +try: + from . import timing +except ImportError: + timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/STU3/duration.py b/fhirclient/models/STU3/duration.py new file mode 100644 index 000000000..f0bf3e66c --- /dev/null +++ b/fhirclient/models/STU3/duration.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Duration) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import quantity + +class Duration(quantity.Quantity): + """ A length of time. + """ + + resource_type = "Duration" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + super(Duration, self).__init__(jsondict=jsondict, strict=strict) + + diff --git a/fhirclient/models/STU3/element.py b/fhirclient/models/STU3/element.py new file mode 100644 index 000000000..c2edb03af --- /dev/null +++ b/fhirclient/models/STU3/element.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Element) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import fhirabstractbase + +class Element(fhirabstractbase.FHIRAbstractBase): + """ Base for all elements. + + Base definition for all elements in a resource. + """ + + resource_type = "Element" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.extension = None + """ Additional Content defined by implementations. + List of `Extension` items (represented as `dict` in JSON). """ + + self.id = None + """ xml:id (or equivalent in JSON). + Type `str`. """ + + super(Element, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Element, self).elementProperties() + from . import extension + js.extend([ + ("extension", "extension", extension.Extension, True, None, False), + ("id", "id", str, False, None, False), + ]) + return js + + diff --git a/fhirclient/models/STU3/elementdefinition.py b/fhirclient/models/STU3/elementdefinition.py new file mode 100644 index 000000000..518664231 --- /dev/null +++ b/fhirclient/models/STU3/elementdefinition.py @@ -0,0 +1,1483 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ElementDefinition) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class ElementDefinition(element.Element): + """ Definition of an element in a resource or extension. + + Captures constraints on each element within the resource, profile, or + extension. + """ + + resource_type = "ElementDefinition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.alias = None + """ Other names. + List of `str` items. """ + + self.base = None + """ Base definition information for tools. + Type `ElementDefinitionBase` (represented as `dict` in JSON). """ + + self.binding = None + """ ValueSet details if this is coded. + Type `ElementDefinitionBinding` (represented as `dict` in JSON). """ + + self.code = None + """ Corresponding codes in terminologies. + List of `Coding` items (represented as `dict` in JSON). """ + + self.comment = None + """ Comments about the use of this element. + Type `str`. """ + + self.condition = None + """ Reference to invariant about presence. + List of `str` items. """ + + self.constraint = None + """ Condition that must evaluate to true. + List of `ElementDefinitionConstraint` items (represented as `dict` in JSON). """ + + self.contentReference = None + """ Reference to definition of content for the element. + Type `str`. """ + + self.defaultValueAddress = None + """ Specified value if missing from instance. + Type `Address` (represented as `dict` in JSON). """ + + self.defaultValueAge = None + """ Specified value if missing from instance. + Type `Age` (represented as `dict` in JSON). """ + + self.defaultValueAnnotation = None + """ Specified value if missing from instance. + Type `Annotation` (represented as `dict` in JSON). """ + + self.defaultValueAttachment = None + """ Specified value if missing from instance. + Type `Attachment` (represented as `dict` in JSON). """ + + self.defaultValueBase64Binary = None + """ Specified value if missing from instance. + Type `str`. """ + + self.defaultValueBoolean = None + """ Specified value if missing from instance. + Type `bool`. """ + + self.defaultValueCode = None + """ Specified value if missing from instance. + Type `str`. """ + + self.defaultValueCodeableConcept = None + """ Specified value if missing from instance. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.defaultValueCoding = None + """ Specified value if missing from instance. + Type `Coding` (represented as `dict` in JSON). """ + + self.defaultValueContactPoint = None + """ Specified value if missing from instance. + Type `ContactPoint` (represented as `dict` in JSON). """ + + self.defaultValueCount = None + """ Specified value if missing from instance. + Type `Count` (represented as `dict` in JSON). """ + + self.defaultValueDate = None + """ Specified value if missing from instance. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.defaultValueDateTime = None + """ Specified value if missing from instance. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.defaultValueDecimal = None + """ Specified value if missing from instance. + Type `float`. """ + + self.defaultValueDistance = None + """ Specified value if missing from instance. + Type `Distance` (represented as `dict` in JSON). """ + + self.defaultValueDuration = None + """ Specified value if missing from instance. + Type `Duration` (represented as `dict` in JSON). """ + + self.defaultValueHumanName = None + """ Specified value if missing from instance. + Type `HumanName` (represented as `dict` in JSON). """ + + self.defaultValueId = None + """ Specified value if missing from instance. + Type `str`. """ + + self.defaultValueIdentifier = None + """ Specified value if missing from instance. + Type `Identifier` (represented as `dict` in JSON). """ + + self.defaultValueInstant = None + """ Specified value if missing from instance. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.defaultValueInteger = None + """ Specified value if missing from instance. + Type `int`. """ + + self.defaultValueMarkdown = None + """ 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). """ + + self.defaultValueOid = None + """ Specified value if missing from instance. + Type `str`. """ + + self.defaultValuePeriod = None + """ Specified value if missing from instance. + Type `Period` (represented as `dict` in JSON). """ + + self.defaultValuePositiveInt = None + """ Specified value if missing from instance. + Type `int`. """ + + self.defaultValueQuantity = None + """ Specified value if missing from instance. + Type `Quantity` (represented as `dict` in JSON). """ + + self.defaultValueRange = None + """ Specified value if missing from instance. + Type `Range` (represented as `dict` in JSON). """ + + self.defaultValueRatio = None + """ Specified value if missing from instance. + Type `Ratio` (represented as `dict` in JSON). """ + + self.defaultValueReference = None + """ Specified value if missing from instance. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.defaultValueSampledData = None + """ Specified value if missing from instance. + Type `SampledData` (represented as `dict` in JSON). """ + + self.defaultValueSignature = None + """ Specified value if missing from instance. + Type `Signature` (represented as `dict` in JSON). """ + + self.defaultValueString = None + """ Specified value if missing from instance. + Type `str`. """ + + self.defaultValueTime = None + """ Specified value if missing from instance. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.defaultValueTiming = None + """ Specified value if missing from instance. + Type `Timing` (represented as `dict` in JSON). """ + + self.defaultValueUnsignedInt = None + """ Specified value if missing from instance. + Type `int`. """ + + self.defaultValueUri = None + """ Specified value if missing from instance. + Type `str`. """ + + self.definition = None + """ Full formal definition as narrative text. + Type `str`. """ + + self.example = None + """ Example value (as defined for type). + List of `ElementDefinitionExample` items (represented as `dict` in JSON). """ + + self.fixedAddress = None + """ Value must be exactly this. + Type `Address` (represented as `dict` in JSON). """ + + self.fixedAge = None + """ Value must be exactly this. + Type `Age` (represented as `dict` in JSON). """ + + self.fixedAnnotation = None + """ Value must be exactly this. + Type `Annotation` (represented as `dict` in JSON). """ + + self.fixedAttachment = None + """ Value must be exactly this. + Type `Attachment` (represented as `dict` in JSON). """ + + self.fixedBase64Binary = None + """ Value must be exactly this. + Type `str`. """ + + self.fixedBoolean = None + """ Value must be exactly this. + Type `bool`. """ + + self.fixedCode = None + """ Value must be exactly this. + Type `str`. """ + + self.fixedCodeableConcept = None + """ Value must be exactly this. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.fixedCoding = None + """ Value must be exactly this. + Type `Coding` (represented as `dict` in JSON). """ + + self.fixedContactPoint = None + """ Value must be exactly this. + Type `ContactPoint` (represented as `dict` in JSON). """ + + self.fixedCount = None + """ Value must be exactly this. + Type `Count` (represented as `dict` in JSON). """ + + self.fixedDate = None + """ Value must be exactly this. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.fixedDateTime = None + """ Value must be exactly this. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.fixedDecimal = None + """ Value must be exactly this. + Type `float`. """ + + self.fixedDistance = None + """ Value must be exactly this. + Type `Distance` (represented as `dict` in JSON). """ + + self.fixedDuration = None + """ Value must be exactly this. + Type `Duration` (represented as `dict` in JSON). """ + + self.fixedHumanName = None + """ Value must be exactly this. + Type `HumanName` (represented as `dict` in JSON). """ + + self.fixedId = None + """ Value must be exactly this. + Type `str`. """ + + self.fixedIdentifier = None + """ Value must be exactly this. + Type `Identifier` (represented as `dict` in JSON). """ + + self.fixedInstant = None + """ Value must be exactly this. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.fixedInteger = None + """ Value must be exactly this. + Type `int`. """ + + self.fixedMarkdown = None + """ 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). """ + + self.fixedOid = None + """ Value must be exactly this. + Type `str`. """ + + self.fixedPeriod = None + """ Value must be exactly this. + Type `Period` (represented as `dict` in JSON). """ + + self.fixedPositiveInt = None + """ Value must be exactly this. + Type `int`. """ + + self.fixedQuantity = None + """ Value must be exactly this. + Type `Quantity` (represented as `dict` in JSON). """ + + self.fixedRange = None + """ Value must be exactly this. + Type `Range` (represented as `dict` in JSON). """ + + self.fixedRatio = None + """ Value must be exactly this. + Type `Ratio` (represented as `dict` in JSON). """ + + self.fixedReference = None + """ Value must be exactly this. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.fixedSampledData = None + """ Value must be exactly this. + Type `SampledData` (represented as `dict` in JSON). """ + + self.fixedSignature = None + """ Value must be exactly this. + Type `Signature` (represented as `dict` in JSON). """ + + self.fixedString = None + """ Value must be exactly this. + Type `str`. """ + + self.fixedTime = None + """ Value must be exactly this. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.fixedTiming = None + """ Value must be exactly this. + Type `Timing` (represented as `dict` in JSON). """ + + self.fixedUnsignedInt = None + """ Value must be exactly this. + Type `int`. """ + + self.fixedUri = None + """ Value must be exactly this. + Type `str`. """ + + self.isModifier = None + """ If this modifies the meaning of other elements. + Type `bool`. """ + + self.isSummary = None + """ Include when _summary = true?. + Type `bool`. """ + + self.label = None + """ Name for element to display with or prompt for element. + Type `str`. """ + + self.mapping = None + """ Map element to another set of definitions. + List of `ElementDefinitionMapping` items (represented as `dict` in JSON). """ + + self.max = None + """ Maximum Cardinality (a number or *). + Type `str`. """ + + self.maxLength = None + """ Max length for strings. + Type `int`. """ + + self.maxValueDate = None + """ Maximum Allowed Value (for some types). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.maxValueDateTime = None + """ Maximum Allowed Value (for some types). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.maxValueDecimal = None + """ Maximum Allowed Value (for some types). + Type `float`. """ + + self.maxValueInstant = None + """ Maximum Allowed Value (for some types). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.maxValueInteger = None + """ Maximum Allowed Value (for some types). + Type `int`. """ + + self.maxValuePositiveInt = None + """ Maximum Allowed Value (for some types). + Type `int`. """ + + self.maxValueQuantity = None + """ Maximum Allowed Value (for some types). + Type `Quantity` (represented as `dict` in JSON). """ + + self.maxValueTime = None + """ Maximum Allowed Value (for some types). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.maxValueUnsignedInt = None + """ Maximum Allowed Value (for some types). + Type `int`. """ + + self.meaningWhenMissing = None + """ Implicit meaning when this element is missing. + Type `str`. """ + + self.min = None + """ Minimum Cardinality. + Type `int`. """ + + self.minValueDate = None + """ Minimum Allowed Value (for some types). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.minValueDateTime = None + """ Minimum Allowed Value (for some types). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.minValueDecimal = None + """ Minimum Allowed Value (for some types). + Type `float`. """ + + self.minValueInstant = None + """ Minimum Allowed Value (for some types). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.minValueInteger = None + """ Minimum Allowed Value (for some types). + Type `int`. """ + + self.minValuePositiveInt = None + """ Minimum Allowed Value (for some types). + Type `int`. """ + + self.minValueQuantity = None + """ Minimum Allowed Value (for some types). + Type `Quantity` (represented as `dict` in JSON). """ + + self.minValueTime = None + """ Minimum Allowed Value (for some types). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.minValueUnsignedInt = None + """ Minimum Allowed Value (for some types). + Type `int`. """ + + self.mustSupport = None + """ If the element must supported. + Type `bool`. """ + + self.orderMeaning = None + """ What the order of the elements means. + Type `str`. """ + + self.path = None + """ Path of the element in the hierarchy of elements. + Type `str`. """ + + self.patternAddress = None + """ Value must have at least these property values. + Type `Address` (represented as `dict` in JSON). """ + + self.patternAge = None + """ Value must have at least these property values. + Type `Age` (represented as `dict` in JSON). """ + + self.patternAnnotation = None + """ Value must have at least these property values. + Type `Annotation` (represented as `dict` in JSON). """ + + self.patternAttachment = None + """ Value must have at least these property values. + Type `Attachment` (represented as `dict` in JSON). """ + + self.patternBase64Binary = None + """ Value must have at least these property values. + Type `str`. """ + + self.patternBoolean = None + """ Value must have at least these property values. + Type `bool`. """ + + self.patternCode = None + """ Value must have at least these property values. + Type `str`. """ + + self.patternCodeableConcept = None + """ Value must have at least these property values. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.patternCoding = None + """ Value must have at least these property values. + Type `Coding` (represented as `dict` in JSON). """ + + self.patternContactPoint = None + """ Value must have at least these property values. + Type `ContactPoint` (represented as `dict` in JSON). """ + + self.patternCount = None + """ Value must have at least these property values. + Type `Count` (represented as `dict` in JSON). """ + + self.patternDate = None + """ Value must have at least these property values. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.patternDateTime = None + """ Value must have at least these property values. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.patternDecimal = None + """ Value must have at least these property values. + Type `float`. """ + + self.patternDistance = None + """ Value must have at least these property values. + Type `Distance` (represented as `dict` in JSON). """ + + self.patternDuration = None + """ Value must have at least these property values. + Type `Duration` (represented as `dict` in JSON). """ + + self.patternHumanName = None + """ Value must have at least these property values. + Type `HumanName` (represented as `dict` in JSON). """ + + self.patternId = None + """ Value must have at least these property values. + Type `str`. """ + + self.patternIdentifier = None + """ Value must have at least these property values. + Type `Identifier` (represented as `dict` in JSON). """ + + self.patternInstant = None + """ Value must have at least these property values. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.patternInteger = None + """ Value must have at least these property values. + Type `int`. """ + + self.patternMarkdown = None + """ 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). """ + + self.patternOid = None + """ Value must have at least these property values. + Type `str`. """ + + self.patternPeriod = None + """ Value must have at least these property values. + Type `Period` (represented as `dict` in JSON). """ + + self.patternPositiveInt = None + """ Value must have at least these property values. + Type `int`. """ + + self.patternQuantity = None + """ Value must have at least these property values. + Type `Quantity` (represented as `dict` in JSON). """ + + self.patternRange = None + """ Value must have at least these property values. + Type `Range` (represented as `dict` in JSON). """ + + self.patternRatio = None + """ Value must have at least these property values. + Type `Ratio` (represented as `dict` in JSON). """ + + self.patternReference = None + """ Value must have at least these property values. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.patternSampledData = None + """ Value must have at least these property values. + Type `SampledData` (represented as `dict` in JSON). """ + + self.patternSignature = None + """ Value must have at least these property values. + Type `Signature` (represented as `dict` in JSON). """ + + self.patternString = None + """ Value must have at least these property values. + Type `str`. """ + + self.patternTime = None + """ Value must have at least these property values. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.patternTiming = None + """ Value must have at least these property values. + Type `Timing` (represented as `dict` in JSON). """ + + self.patternUnsignedInt = None + """ Value must have at least these property values. + Type `int`. """ + + self.patternUri = None + """ Value must have at least these property values. + Type `str`. """ + + self.representation = None + """ xmlAttr | xmlText | typeAttr | cdaText | xhtml. + List of `str` items. """ + + self.requirements = None + """ Why this resource has been created. + Type `str`. """ + + self.short = None + """ Concise definition for space-constrained presentation. + Type `str`. """ + + self.sliceName = None + """ Name for this particular element (in a set of slices). + Type `str`. """ + + self.slicing = None + """ This element is sliced - slices follow. + Type `ElementDefinitionSlicing` (represented as `dict` in JSON). """ + + self.type = None + """ Data type and Profile for this element. + List of `ElementDefinitionType` items (represented as `dict` in JSON). """ + + super(ElementDefinition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ElementDefinition, self).elementProperties() + js.extend([ + ("alias", "alias", str, True, None, False), + ("base", "base", ElementDefinitionBase, False, None, False), + ("binding", "binding", ElementDefinitionBinding, False, None, False), + ("code", "code", coding.Coding, True, None, False), + ("comment", "comment", str, False, None, False), + ("condition", "condition", str, True, None, False), + ("constraint", "constraint", ElementDefinitionConstraint, True, None, False), + ("contentReference", "contentReference", str, False, None, False), + ("defaultValueAddress", "defaultValueAddress", address.Address, False, "defaultValue", False), + ("defaultValueAge", "defaultValueAge", age.Age, False, "defaultValue", False), + ("defaultValueAnnotation", "defaultValueAnnotation", annotation.Annotation, False, "defaultValue", False), + ("defaultValueAttachment", "defaultValueAttachment", attachment.Attachment, False, "defaultValue", False), + ("defaultValueBase64Binary", "defaultValueBase64Binary", str, False, "defaultValue", False), + ("defaultValueBoolean", "defaultValueBoolean", bool, False, "defaultValue", False), + ("defaultValueCode", "defaultValueCode", str, False, "defaultValue", False), + ("defaultValueCodeableConcept", "defaultValueCodeableConcept", codeableconcept.CodeableConcept, False, "defaultValue", False), + ("defaultValueCoding", "defaultValueCoding", coding.Coding, False, "defaultValue", False), + ("defaultValueContactPoint", "defaultValueContactPoint", contactpoint.ContactPoint, False, "defaultValue", False), + ("defaultValueCount", "defaultValueCount", count.Count, 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), + ("defaultValueDuration", "defaultValueDuration", duration.Duration, 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), + ("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), + ("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), + ("defaultValueUnsignedInt", "defaultValueUnsignedInt", int, False, "defaultValue", False), + ("defaultValueUri", "defaultValueUri", str, False, "defaultValue", False), + ("definition", "definition", str, False, None, False), + ("example", "example", ElementDefinitionExample, True, None, False), + ("fixedAddress", "fixedAddress", address.Address, False, "fixed", False), + ("fixedAge", "fixedAge", age.Age, False, "fixed", False), + ("fixedAnnotation", "fixedAnnotation", annotation.Annotation, False, "fixed", False), + ("fixedAttachment", "fixedAttachment", attachment.Attachment, False, "fixed", False), + ("fixedBase64Binary", "fixedBase64Binary", str, False, "fixed", False), + ("fixedBoolean", "fixedBoolean", bool, False, "fixed", False), + ("fixedCode", "fixedCode", str, False, "fixed", False), + ("fixedCodeableConcept", "fixedCodeableConcept", codeableconcept.CodeableConcept, False, "fixed", False), + ("fixedCoding", "fixedCoding", coding.Coding, False, "fixed", False), + ("fixedContactPoint", "fixedContactPoint", contactpoint.ContactPoint, False, "fixed", False), + ("fixedCount", "fixedCount", count.Count, 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), + ("fixedDuration", "fixedDuration", duration.Duration, 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), + ("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), + ("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), + ("fixedUnsignedInt", "fixedUnsignedInt", int, False, "fixed", False), + ("fixedUri", "fixedUri", str, False, "fixed", False), + ("isModifier", "isModifier", bool, False, None, False), + ("isSummary", "isSummary", bool, False, None, False), + ("label", "label", str, False, None, False), + ("mapping", "mapping", ElementDefinitionMapping, True, None, False), + ("max", "max", str, False, None, False), + ("maxLength", "maxLength", int, False, None, False), + ("maxValueDate", "maxValueDate", fhirdate.FHIRDate, False, "maxValue", False), + ("maxValueDateTime", "maxValueDateTime", fhirdate.FHIRDate, False, "maxValue", False), + ("maxValueDecimal", "maxValueDecimal", float, False, "maxValue", False), + ("maxValueInstant", "maxValueInstant", fhirdate.FHIRDate, False, "maxValue", False), + ("maxValueInteger", "maxValueInteger", int, False, "maxValue", False), + ("maxValuePositiveInt", "maxValuePositiveInt", int, False, "maxValue", False), + ("maxValueQuantity", "maxValueQuantity", quantity.Quantity, False, "maxValue", False), + ("maxValueTime", "maxValueTime", fhirdate.FHIRDate, False, "maxValue", False), + ("maxValueUnsignedInt", "maxValueUnsignedInt", int, False, "maxValue", False), + ("meaningWhenMissing", "meaningWhenMissing", str, False, None, False), + ("min", "min", int, False, None, False), + ("minValueDate", "minValueDate", fhirdate.FHIRDate, False, "minValue", False), + ("minValueDateTime", "minValueDateTime", fhirdate.FHIRDate, False, "minValue", False), + ("minValueDecimal", "minValueDecimal", float, False, "minValue", False), + ("minValueInstant", "minValueInstant", fhirdate.FHIRDate, False, "minValue", False), + ("minValueInteger", "minValueInteger", int, False, "minValue", False), + ("minValuePositiveInt", "minValuePositiveInt", int, False, "minValue", False), + ("minValueQuantity", "minValueQuantity", quantity.Quantity, False, "minValue", False), + ("minValueTime", "minValueTime", fhirdate.FHIRDate, False, "minValue", False), + ("minValueUnsignedInt", "minValueUnsignedInt", int, False, "minValue", False), + ("mustSupport", "mustSupport", bool, False, None, False), + ("orderMeaning", "orderMeaning", str, False, None, False), + ("path", "path", str, False, None, True), + ("patternAddress", "patternAddress", address.Address, False, "pattern", False), + ("patternAge", "patternAge", age.Age, False, "pattern", False), + ("patternAnnotation", "patternAnnotation", annotation.Annotation, False, "pattern", False), + ("patternAttachment", "patternAttachment", attachment.Attachment, False, "pattern", False), + ("patternBase64Binary", "patternBase64Binary", str, False, "pattern", False), + ("patternBoolean", "patternBoolean", bool, False, "pattern", False), + ("patternCode", "patternCode", str, False, "pattern", False), + ("patternCodeableConcept", "patternCodeableConcept", codeableconcept.CodeableConcept, False, "pattern", False), + ("patternCoding", "patternCoding", coding.Coding, False, "pattern", False), + ("patternContactPoint", "patternContactPoint", contactpoint.ContactPoint, False, "pattern", False), + ("patternCount", "patternCount", count.Count, 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), + ("patternDuration", "patternDuration", duration.Duration, 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), + ("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), + ("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), + ("patternUnsignedInt", "patternUnsignedInt", int, False, "pattern", False), + ("patternUri", "patternUri", str, False, "pattern", False), + ("representation", "representation", str, True, None, False), + ("requirements", "requirements", str, False, None, False), + ("short", "short", str, False, None, False), + ("sliceName", "sliceName", str, False, None, False), + ("slicing", "slicing", ElementDefinitionSlicing, False, None, False), + ("type", "type", ElementDefinitionType, True, None, False), + ]) + return js + + +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. + """ + + resource_type = "ElementDefinitionBase" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.max = None + """ Max cardinality of the base element. + Type `str`. """ + + self.min = None + """ Min cardinality of the base element. + Type `int`. """ + + self.path = None + """ Path that identifies the base element. + Type `str`. """ + + super(ElementDefinitionBase, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ElementDefinitionBase, self).elementProperties() + js.extend([ + ("max", "max", str, False, None, True), + ("min", "min", int, False, None, True), + ("path", "path", str, False, None, True), + ]) + return js + + +class ElementDefinitionBinding(element.Element): + """ ValueSet details if this is coded. + + Binds to a value set if this element is coded (code, Coding, + CodeableConcept, Quantity), or the data types (string, uri). + """ + + resource_type = "ElementDefinitionBinding" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Human explanation of the value set. + Type `str`. """ + + self.strength = None + """ 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 + """ Source of value set. + Type `str`. """ + + super(ElementDefinitionBinding, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ElementDefinitionBinding, self).elementProperties() + 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), + ]) + return js + + +class ElementDefinitionConstraint(element.Element): + """ Condition that must evaluate to true. + + Formal constraints such as co-occurrence and other constraints that can be + computationally evaluated within the context of the instance. + """ + + resource_type = "ElementDefinitionConstraint" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ FHIRPath expression of constraint. + Type `str`. """ + + self.human = None + """ Human description of constraint. + Type `str`. """ + + self.key = None + """ Target of 'condition' reference above. + Type `str`. """ + + self.requirements = None + """ Why this constraint is necessary or appropriate. + Type `str`. """ + + self.severity = None + """ error | warning. + Type `str`. """ + + self.source = None + """ Reference to original source of constraint. + Type `str`. """ + + self.xpath = None + """ XPath expression of constraint. + Type `str`. """ + + super(ElementDefinitionConstraint, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ElementDefinitionConstraint, self).elementProperties() + js.extend([ + ("expression", "expression", str, False, None, True), + ("human", "human", str, False, None, True), + ("key", "key", str, False, None, True), + ("requirements", "requirements", str, False, None, False), + ("severity", "severity", str, False, None, True), + ("source", "source", str, False, None, False), + ("xpath", "xpath", str, False, None, False), + ]) + return js + + +class ElementDefinitionExample(element.Element): + """ Example value (as defined for type). + + A sample value for this element demonstrating the type of information that + would typically be found in the element. + """ + + resource_type = "ElementDefinitionExample" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.label = None + """ Describes the purpose of this example. + Type `str`. """ + + self.valueAddress = None + """ Value of Example (one of allowed types). + Type `Address` (represented as `dict` in JSON). """ + + self.valueAge = None + """ Value of Example (one of allowed types). + Type `Age` (represented as `dict` in JSON). """ + + self.valueAnnotation = None + """ Value of Example (one of allowed types). + Type `Annotation` (represented as `dict` in JSON). """ + + self.valueAttachment = None + """ Value of Example (one of allowed types). + Type `Attachment` (represented as `dict` in JSON). """ + + self.valueBase64Binary = None + """ Value of Example (one of allowed types). + Type `str`. """ + + self.valueBoolean = None + """ Value of Example (one of allowed types). + Type `bool`. """ + + self.valueCode = None + """ Value of Example (one of allowed types). + Type `str`. """ + + self.valueCodeableConcept = None + """ Value of Example (one of allowed types). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueCoding = None + """ Value of Example (one of allowed types). + Type `Coding` (represented as `dict` in JSON). """ + + self.valueContactPoint = None + """ Value of Example (one of allowed types). + Type `ContactPoint` (represented as `dict` in JSON). """ + + self.valueCount = None + """ Value of Example (one of allowed types). + Type `Count` (represented as `dict` in JSON). """ + + self.valueDate = None + """ Value of Example (one of allowed types). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueDateTime = None + """ Value of Example (one of allowed types). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueDecimal = None + """ Value of Example (one of allowed types). + Type `float`. """ + + self.valueDistance = None + """ Value of Example (one of allowed types). + Type `Distance` (represented as `dict` in JSON). """ + + self.valueDuration = None + """ Value of Example (one of allowed types). + Type `Duration` (represented as `dict` in JSON). """ + + self.valueHumanName = None + """ Value of Example (one of allowed types). + Type `HumanName` (represented as `dict` in JSON). """ + + self.valueId = None + """ Value of Example (one of allowed types). + Type `str`. """ + + self.valueIdentifier = None + """ Value of Example (one of allowed types). + Type `Identifier` (represented as `dict` in JSON). """ + + self.valueInstant = None + """ Value of Example (one of allowed types). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueInteger = None + """ Value of Example (one of allowed types). + Type `int`. """ + + self.valueMarkdown = None + """ 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). """ + + self.valueOid = None + """ Value of Example (one of allowed types). + Type `str`. """ + + self.valuePeriod = None + """ Value of Example (one of allowed types). + Type `Period` (represented as `dict` in JSON). """ + + self.valuePositiveInt = None + """ Value of Example (one of allowed types). + Type `int`. """ + + self.valueQuantity = None + """ Value of Example (one of allowed types). + Type `Quantity` (represented as `dict` in JSON). """ + + self.valueRange = None + """ Value of Example (one of allowed types). + Type `Range` (represented as `dict` in JSON). """ + + self.valueRatio = None + """ Value of Example (one of allowed types). + Type `Ratio` (represented as `dict` in JSON). """ + + self.valueReference = None + """ Value of Example (one of allowed types). + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.valueSampledData = None + """ Value of Example (one of allowed types). + Type `SampledData` (represented as `dict` in JSON). """ + + self.valueSignature = None + """ Value of Example (one of allowed types). + Type `Signature` (represented as `dict` in JSON). """ + + self.valueString = None + """ Value of Example (one of allowed types). + Type `str`. """ + + self.valueTime = None + """ Value of Example (one of allowed types). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueTiming = None + """ Value of Example (one of allowed types). + Type `Timing` (represented as `dict` in JSON). """ + + self.valueUnsignedInt = None + """ Value of Example (one of allowed types). + Type `int`. """ + + self.valueUri = None + """ Value of Example (one of allowed types). + Type `str`. """ + + super(ElementDefinitionExample, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ElementDefinitionExample, self).elementProperties() + js.extend([ + ("label", "label", str, False, None, True), + ("valueAddress", "valueAddress", address.Address, False, "value", True), + ("valueAge", "valueAge", age.Age, False, "value", True), + ("valueAnnotation", "valueAnnotation", annotation.Annotation, False, "value", True), + ("valueAttachment", "valueAttachment", attachment.Attachment, False, "value", True), + ("valueBase64Binary", "valueBase64Binary", str, False, "value", True), + ("valueBoolean", "valueBoolean", bool, False, "value", True), + ("valueCode", "valueCode", str, False, "value", True), + ("valueCodeableConcept", "valueCodeableConcept", codeableconcept.CodeableConcept, False, "value", True), + ("valueCoding", "valueCoding", coding.Coding, False, "value", True), + ("valueContactPoint", "valueContactPoint", contactpoint.ContactPoint, False, "value", True), + ("valueCount", "valueCount", count.Count, 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), + ("valueDuration", "valueDuration", duration.Duration, 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), + ("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), + ("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), + ("valueUnsignedInt", "valueUnsignedInt", int, False, "value", True), + ("valueUri", "valueUri", str, False, "value", True), + ]) + return js + + +class ElementDefinitionMapping(element.Element): + """ Map element to another set of definitions. + + Identifies a concept from an external specification that roughly + corresponds to this element. + """ + + resource_type = "ElementDefinitionMapping" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Comments about the mapping or its use. + Type `str`. """ + + self.identity = None + """ Reference to mapping declaration. + Type `str`. """ + + self.language = None + """ Computable language of mapping. + Type `str`. """ + + self.map = None + """ Details of the mapping. + Type `str`. """ + + super(ElementDefinitionMapping, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ElementDefinitionMapping, self).elementProperties() + js.extend([ + ("comment", "comment", str, False, None, False), + ("identity", "identity", str, False, None, True), + ("language", "language", str, False, None, False), + ("map", "map", str, False, None, True), + ]) + return js + + +class ElementDefinitionSlicing(element.Element): + """ This element is sliced - slices follow. + + Indicates that the element is sliced into a set of alternative definitions + (i.e. in a structure definition, there are multiple different constraints + on a single element in the base resource). Slicing can be used in any + resource that has cardinality ..* on the base resource, or any resource + with a choice of types. The set of slices is any elements that come after + this in the element sequence that have the same path, until a shorter path + occurs (the shorter path terminates the set). + """ + + resource_type = "ElementDefinitionSlicing" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Text description of how slicing works (or not). + Type `str`. """ + + self.discriminator = None + """ Element values that are used to distinguish the slices. + List of `ElementDefinitionSlicingDiscriminator` items (represented as `dict` in JSON). """ + + self.ordered = None + """ If elements must be in same order as slices. + Type `bool`. """ + + self.rules = None + """ closed | open | openAtEnd. + Type `str`. """ + + super(ElementDefinitionSlicing, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ElementDefinitionSlicing, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, False), + ("discriminator", "discriminator", ElementDefinitionSlicingDiscriminator, True, None, False), + ("ordered", "ordered", bool, False, None, False), + ("rules", "rules", str, False, None, True), + ]) + return js + + +class ElementDefinitionSlicingDiscriminator(element.Element): + """ Element values that are used to distinguish the slices. + + Designates which child elements are used to discriminate between the slices + when processing an instance. If one or more discriminators are provided, + the value of the child elements in the instance data SHALL completely + distinguish which slice the element in the resource matches based on the + allowed values for those elements in each of the slices. + """ + + resource_type = "ElementDefinitionSlicingDiscriminator" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.path = None + """ Path to element value. + Type `str`. """ + + self.type = None + """ value | exists | pattern | type | profile. + Type `str`. """ + + super(ElementDefinitionSlicingDiscriminator, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ElementDefinitionSlicingDiscriminator, self).elementProperties() + js.extend([ + ("path", "path", str, False, None, True), + ("type", "type", str, False, None, True), + ]) + return js + + +class ElementDefinitionType(element.Element): + """ Data type and Profile for this element. + + The data type or resource that the value of this element is permitted to + be. + """ + + resource_type = "ElementDefinitionType" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.aggregation = None + """ contained | referenced | bundled - how aggregated. + List of `str` items. """ + + self.code = None + """ Data type or Resource (reference to definition). + Type `str`. """ + + self.profile = None + """ Profile (StructureDefinition) to apply (or IG). + Type `str`. """ + + self.targetProfile = None + """ Profile (StructureDefinition) to apply to reference target (or IG). + Type `str`. """ + + self.versioning = None + """ either | independent | specific. + Type `str`. """ + + super(ElementDefinitionType, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ElementDefinitionType, self).elementProperties() + 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), + ("versioning", "versioning", str, False, None, False), + ]) + return js + + +import sys +try: + from . import address +except ImportError: + address = sys.modules[__package__ + '.address'] +try: + from . import age +except ImportError: + age = sys.modules[__package__ + '.age'] +try: + from . import annotation +except ImportError: + annotation = sys.modules[__package__ + '.annotation'] +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 coding +except ImportError: + coding = sys.modules[__package__ + '.coding'] +try: + from . import contactpoint +except ImportError: + contactpoint = sys.modules[__package__ + '.contactpoint'] +try: + from . import count +except ImportError: + count = sys.modules[__package__ + '.count'] +try: + from . import distance +except ImportError: + distance = sys.modules[__package__ + '.distance'] +try: + from . import duration +except ImportError: + duration = sys.modules[__package__ + '.duration'] +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 humanname +except ImportError: + humanname = sys.modules[__package__ + '.humanname'] +try: + 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 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 sampleddata +except ImportError: + sampleddata = sys.modules[__package__ + '.sampleddata'] +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/STU3/eligibilityrequest.py b/fhirclient/models/STU3/eligibilityrequest.py new file mode 100644 index 000000000..94318c5b9 --- /dev/null +++ b/fhirclient/models/STU3/eligibilityrequest.py @@ -0,0 +1,138 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/EligibilityRequest) on 2019-10-12. +# 2019, 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/STU3/eligibilityrequest_tests.py b/fhirclient/models/STU3/eligibilityrequest_tests.py new file mode 100644 index 000000000..4f312eb6e --- /dev/null +++ b/fhirclient/models/STU3/eligibilityrequest_tests.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +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/STU3/eligibilityresponse.py b/fhirclient/models/STU3/eligibilityresponse.py new file mode 100644 index 000000000..0b8f79ac8 --- /dev/null +++ b/fhirclient/models/STU3/eligibilityresponse.py @@ -0,0 +1,319 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/EligibilityResponse) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class EligibilityResponse(domainresource.DomainResource): + """ EligibilityResponse resource. + + This resource provides eligibility and plan details from the processing of + an Eligibility resource. + """ + + resource_type = "EligibilityResponse" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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.disposition = None + """ Disposition Message. + Type `str`. """ + + self.error = None + """ Processing errors. + List of `EligibilityResponseError` 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.inforce = None + """ Coverage inforce indicator. + Type `bool`. """ + + self.insurance = None + """ Details by insurance coverage. + List of `EligibilityResponseInsurance` items (represented as `dict` in JSON). """ + + self.insurer = None + """ Insurer issuing the coverage. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.outcome = None + """ complete | error | partial. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.request = None + """ Eligibility reference. + Type `FHIRReference` referencing `EligibilityRequest` (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(EligibilityResponse, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EligibilityResponse, self).elementProperties() + js.extend([ + ("created", "created", fhirdate.FHIRDate, False, None, False), + ("disposition", "disposition", str, False, None, False), + ("error", "error", EligibilityResponseError, 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), + ]) + return js + + +from . import backboneelement + +class EligibilityResponseError(backboneelement.BackboneElement): + """ Processing errors. + + Mutually exclusive with Services Provided (Item). + """ + + resource_type = "EligibilityResponseError" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Error code detailing processing issues. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(EligibilityResponseError, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EligibilityResponseError, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +class EligibilityResponseInsurance(backboneelement.BackboneElement): + """ Details by insurance coverage. + + The insurer may provide both the details for the requested coverage as well + as details for additional coverages known to the insurer. + """ + + resource_type = "EligibilityResponseInsurance" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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.coverage = None + """ Updated Coverage details. + Type `FHIRReference` referencing `Coverage` (represented as `dict` in JSON). """ + + super(EligibilityResponseInsurance, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EligibilityResponseInsurance, self).elementProperties() + js.extend([ + ("benefitBalance", "benefitBalance", EligibilityResponseInsuranceBenefitBalance, True, None, False), + ("contract", "contract", fhirreference.FHIRReference, False, None, False), + ("coverage", "coverage", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +class EligibilityResponseInsuranceBenefitBalance(backboneelement.BackboneElement): + """ Benefits by Category. + + Benefits and optionally current balances by Category. + """ + + resource_type = "EligibilityResponseInsuranceBenefitBalance" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Type of services covered. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.description = None + """ Description of the benefit or services covered. + Type `str`. """ + + self.excluded = None + """ Excluded from the plan. + Type `bool`. """ + + self.financial = None + """ Benefit Summary. + List of `EligibilityResponseInsuranceBenefitBalanceFinancial` items (represented as `dict` in JSON). """ + + self.name = None + """ Short name for the benefit. + Type `str`. """ + + self.network = None + """ 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). """ + + self.unit = None + """ Individual or family. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(EligibilityResponseInsuranceBenefitBalance, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EligibilityResponseInsuranceBenefitBalance, self).elementProperties() + js.extend([ + ("category", "category", codeableconcept.CodeableConcept, False, None, True), + ("description", "description", str, False, None, False), + ("excluded", "excluded", bool, False, None, False), + ("financial", "financial", EligibilityResponseInsuranceBenefitBalanceFinancial, 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), + ]) + return js + + +class EligibilityResponseInsuranceBenefitBalanceFinancial(backboneelement.BackboneElement): + """ Benefit Summary. + + Benefits Used to date. + """ + + resource_type = "EligibilityResponseInsuranceBenefitBalanceFinancial" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.allowedMoney = None + """ Benefits allowed. + Type `Money` (represented as `dict` in JSON). """ + + self.allowedString = None + """ Benefits allowed. + Type `str`. """ + + self.allowedUnsignedInt = None + """ Benefits allowed. + Type `int`. """ + + self.type = None + """ Deductable, visits, benefit amount. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.usedMoney = None + """ Benefits used. + Type `Money` (represented as `dict` in JSON). """ + + self.usedUnsignedInt = None + """ Benefits used. + Type `int`. """ + + super(EligibilityResponseInsuranceBenefitBalanceFinancial, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EligibilityResponseInsuranceBenefitBalanceFinancial, 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), + ("usedUnsignedInt", "usedUnsignedInt", int, False, "used", 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 money +except ImportError: + money = sys.modules[__package__ + '.money'] diff --git a/fhirclient/models/STU3/eligibilityresponse_tests.py b/fhirclient/models/STU3/eligibilityresponse_tests.py new file mode 100644 index 000000000..3f464508c --- /dev/null +++ b/fhirclient/models/STU3/eligibilityresponse_tests.py @@ -0,0 +1,271 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +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-error.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-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 testEligibilityResponse3(self): + inst = self.instantiate_from("eligibilityresponse-example.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-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") + + def testEligibilityResponse4(self): + inst = self.instantiate_from("eligibilityresponse-example-benefits.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, "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") + diff --git a/fhirclient/models/STU3/encounter.py b/fhirclient/models/STU3/encounter.py new file mode 100644 index 000000000..f957b4f46 --- /dev/null +++ b/fhirclient/models/STU3/encounter.py @@ -0,0 +1,438 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Encounter) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Encounter(domainresource.DomainResource): + """ An interaction during which services are provided to the patient. + + An interaction between a patient and healthcare provider(s) for the purpose + of providing healthcare service(s) or assessing the health status of a + patient. + """ + + resource_type = "Encounter" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ The set of accounts that may be used for billing for this Encounter. + List of `FHIRReference` items referencing `Account` (represented as `dict` in JSON). """ + + self.appointment = None + """ The appointment that scheduled this encounter. + Type `FHIRReference` referencing `Appointment` (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 +. + Type `Coding` (represented as `dict` in JSON). """ + + self.diagnosis = None + """ The list of diagnosis relevant to this encounter. + List of `EncounterDiagnosis` items (represented as `dict` in JSON). """ + + 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). """ + + self.hospitalization = None + """ Details about the admission to a healthcare service. + Type `EncounterHospitalization` (represented as `dict` in JSON). """ + + self.identifier = None + """ 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). """ + + self.location = None + """ List of locations where the patient has been. + List of `EncounterLocation` items (represented as `dict` in JSON). """ + + self.partOf = None + """ Another Encounter this encounter is part of. + Type `FHIRReference` referencing `Encounter` (represented as `dict` in JSON). """ + + self.participant = None + """ List of participants involved in the encounter. + List of `EncounterParticipant` items (represented as `dict` in JSON). """ + + self.period = None + """ The start and end time of the encounter. + Type `Period` (represented as `dict` in JSON). """ + + self.priority = None + """ Indicates the urgency of the encounter. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.reason = None + """ Reason the encounter takes place (code). + List of `CodeableConcept` 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). """ + + self.status = None + """ planned | arrived | triaged | in-progress | onleave | finished | + cancelled +. + Type `str`. """ + + self.statusHistory = None + """ List of past encounter statuses. + 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). """ + + self.type = None + """ Specific type of encounter. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(Encounter, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Encounter, self).elementProperties() + js.extend([ + ("account", "account", fhirreference.FHIRReference, True, None, False), + ("appointment", "appointment", fhirreference.FHIRReference, False, None, False), + ("classHistory", "classHistory", EncounterClassHistory, True, None, False), + ("class_fhir", "class", coding.Coding, False, None, False), + ("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), + ("serviceProvider", "serviceProvider", fhirreference.FHIRReference, False, None, False), + ("status", "status", str, False, None, True), + ("statusHistory", "statusHistory", EncounterStatusHistory, True, None, False), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +from . import backboneelement + +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. + """ + + resource_type = "EncounterClassHistory" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ inpatient | outpatient | ambulatory | emergency +. + Type `Coding` (represented as `dict` in JSON). """ + + self.period = None + """ The time that the episode was in the specified class. + Type `Period` (represented as `dict` in JSON). """ + + super(EncounterClassHistory, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EncounterClassHistory, self).elementProperties() + js.extend([ + ("class_fhir", "class", coding.Coding, False, None, True), + ("period", "period", period.Period, False, None, True), + ]) + return js + + +class EncounterDiagnosis(backboneelement.BackboneElement): + """ The list of diagnosis relevant to this encounter. + """ + + resource_type = "EncounterDiagnosis" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.condition = None + """ Reason the encounter takes place (resource). + Type `FHIRReference` referencing `Condition, Procedure` (represented as `dict` in JSON). """ + + self.rank = None + """ Ranking of the diagnosis (for each role type). + Type `int`. """ + + self.role = None + """ Role that this diagnosis has within the encounter (e.g. admission, + billing, discharge …). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(EncounterDiagnosis, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EncounterDiagnosis, self).elementProperties() + js.extend([ + ("condition", "condition", fhirreference.FHIRReference, False, None, True), + ("rank", "rank", int, False, None, False), + ("role", "role", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class EncounterHospitalization(backboneelement.BackboneElement): + """ Details about the admission to a healthcare service. + """ + + resource_type = "EncounterHospitalization" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.admitSource = None + """ From where patient was admitted (physician referral, transfer). + 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). """ + + self.dietPreference = None + """ Diet preferences reported by the patient. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.dischargeDisposition = None + """ Category or kind of location after discharge. + 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). """ + + self.preAdmissionIdentifier = None + """ Pre-admission identifier. + Type `Identifier` (represented as `dict` in JSON). """ + + self.reAdmission = None + """ The type of hospital re-admission that has occurred (if any). If + the value is absent, then this is not identified as a readmission. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.specialArrangement = None + """ Wheelchair, translator, stretcher, etc.. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.specialCourtesy = None + """ Special courtesies (VIP, board member). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(EncounterHospitalization, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EncounterHospitalization, self).elementProperties() + js.extend([ + ("admitSource", "admitSource", codeableconcept.CodeableConcept, False, None, False), + ("destination", "destination", fhirreference.FHIRReference, False, None, False), + ("dietPreference", "dietPreference", codeableconcept.CodeableConcept, True, None, False), + ("dischargeDisposition", "dischargeDisposition", codeableconcept.CodeableConcept, False, None, False), + ("origin", "origin", fhirreference.FHIRReference, False, None, False), + ("preAdmissionIdentifier", "preAdmissionIdentifier", identifier.Identifier, False, None, False), + ("reAdmission", "reAdmission", codeableconcept.CodeableConcept, False, None, False), + ("specialArrangement", "specialArrangement", codeableconcept.CodeableConcept, True, None, False), + ("specialCourtesy", "specialCourtesy", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +class EncounterLocation(backboneelement.BackboneElement): + """ List of locations where the patient has been. + + List of locations where the patient has been during this encounter. + """ + + resource_type = "EncounterLocation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.location = None + """ Location the encounter takes place. + Type `FHIRReference` referencing `Location` (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.status = None + """ planned | active | reserved | completed. + Type `str`. """ + + super(EncounterLocation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EncounterLocation, self).elementProperties() + js.extend([ + ("location", "location", fhirreference.FHIRReference, False, None, True), + ("period", "period", period.Period, False, None, False), + ("status", "status", str, False, None, False), + ]) + return js + + +class EncounterParticipant(backboneelement.BackboneElement): + """ List of participants involved in the encounter. + + The list of people responsible for providing the service. + """ + + resource_type = "EncounterParticipant" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.individual = None + """ Persons involved in the encounter other than the patient. + Type `FHIRReference` referencing `Practitioner, RelatedPerson` (represented as `dict` in JSON). """ + + self.period = None + """ Period of time during the encounter that the participant + participated. + Type `Period` (represented as `dict` in JSON). """ + + self.type = None + """ Role of participant in encounter. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(EncounterParticipant, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EncounterParticipant, self).elementProperties() + js.extend([ + ("individual", "individual", fhirreference.FHIRReference, False, None, False), + ("period", "period", period.Period, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +class EncounterStatusHistory(backboneelement.BackboneElement): + """ List of past encounter statuses. + + The status history permits the encounter resource to contain the status + history without needing to read through the historical versions of the + resource, or even have the server store them. + """ + + resource_type = "EncounterStatusHistory" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 time that the episode was in the specified status. + Type `Period` (represented as `dict` in JSON). """ + + self.status = None + """ planned | arrived | triaged | in-progress | onleave | finished | + cancelled +. + Type `str`. """ + + super(EncounterStatusHistory, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EncounterStatusHistory, self).elementProperties() + js.extend([ + ("period", "period", period.Period, False, None, True), + ("status", "status", 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 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 period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/STU3/encounter_tests.py b/fhirclient/models/STU3/encounter_tests.py new file mode 100644 index 000000000..919033c37 --- /dev/null +++ b/fhirclient/models/STU3/encounter_tests.py @@ -0,0 +1,432 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import encounter +from .fhirdate import FHIRDate + + +class EncounterTests(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("Encounter", js["resourceType"]) + return encounter.Encounter(js) + + def testEncounter1(self): + inst = self.instantiate_from("encounter-example-home.json") + self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") + self.implEncounter1(inst) + + js = inst.as_json() + self.assertEqual("Encounter", js["resourceType"]) + inst2 = encounter.Encounter(js) + self.implEncounter1(inst2) + + def implEncounter1(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.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-f201-20130404.json") + self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") + self.implEncounter2(inst) + + js = inst.as_json() + self.assertEqual("Encounter", js["resourceType"]) + inst2 = encounter.Encounter(js) + self.implEncounter2(inst2) + + 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.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 testEncounter3(self): + inst = self.instantiate_from("encounter-example-f003-abscess.json") + self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") + self.implEncounter3(inst) + + js = inst.as_json() + self.assertEqual("Encounter", js["resourceType"]) + inst2 = encounter.Encounter(js) + self.implEncounter3(inst2) + + 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, "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, "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, "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, 90) + 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].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.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 testEncounter4(self): + inst = self.instantiate_from("encounter-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") + self.implEncounter4(inst) + + js = inst.as_json() + self.assertEqual("Encounter", js["resourceType"]) + inst2 = encounter.Encounter(js) + 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://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.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, "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, "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, "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, 140) + 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].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.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 testEncounter6(self): + inst = self.instantiate_from("encounter-example-f203-20130311.json") + self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") + self.implEncounter6(inst) + + js = inst.as_json() + self.assertEqual("Encounter", js["resourceType"]) + inst2 = encounter.Encounter(js) + self.implEncounter6(inst2) + + def implEncounter6(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.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.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") + self.assertEqual(inst.hospitalization.dietPreference[0].coding[0].code, "276026009") + self.assertEqual(inst.hospitalization.dietPreference[0].coding[0].display, "Fluid balance regulation") + self.assertEqual(inst.hospitalization.dietPreference[0].coding[0].system, "http://snomed.info/sct") + 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.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.id, "f203") + self.assertEqual(inst.identifier[0].use, "temp") + self.assertEqual(inst.identifier[0].value, "Encounter_Roel_20130311") + 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.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) + self.assertEqual(inst.period.start.as_json(), "2013-03-11") + 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.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") + self.assertEqual(inst.statusHistory[0].status, "arrived") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type[0].coding[0].code, "183807002") + 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://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.text.status, "generated") + + def testEncounter8(self): + inst = self.instantiate_from("encounter-example-f202-20130128.json") + self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") + self.implEncounter8(inst) + + js = inst.as_json() + self.assertEqual("Encounter", js["resourceType"]) + inst2 = encounter.Encounter(js) + self.implEncounter8(inst2) + + def implEncounter8(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 testEncounter9(self): + inst = self.instantiate_from("encounter-example-emerg.json") + self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") + self.implEncounter9(inst) + + js = inst.as_json() + self.assertEqual("Encounter", js["resourceType"]) + inst2 = encounter.Encounter(js) + self.implEncounter9(inst2) + + def implEncounter9(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.text.status, "generated") + + def testEncounter10(self): + inst = self.instantiate_from("encounter-example-f001-heart.json") + self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") + self.implEncounter10(inst) + + js = inst.as_json() + self.assertEqual("Encounter", js["resourceType"]) + inst2 = encounter.Encounter(js) + self.implEncounter10(inst2) + + def implEncounter10(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.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.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/STU3/endpoint.py b/fhirclient/models/STU3/endpoint.py new file mode 100644 index 000000000..a0693fbf6 --- /dev/null +++ b/fhirclient/models/STU3/endpoint.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Endpoint) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Endpoint(domainresource.DomainResource): + """ The technical details of an endpoint that can be used for electronic + services. + + The technical details of an endpoint that can be used for electronic + services, such as for web services providing XDS.b or a REST endpoint for + another FHIR server. This may include any security context information. + """ + + resource_type = "Endpoint" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ The technical base address for connecting to this endpoint. + Type `str`. """ + + self.connectionType = None + """ Protocol/Profile/Standard to be used with this endpoint connection. + Type `Coding` (represented as `dict` in JSON). """ + + self.contact = None + """ Contact details for source (e.g. troubleshooting). + List of `ContactPoint` items (represented as `dict` in JSON). """ + + self.header = None + """ Usage depends on the channel type. + List of `str` items. """ + + self.identifier = None + """ Identifies this endpoint across multiple systems. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.managingOrganization = None + """ Organization that manages this endpoint (may not be the + organization that exposes the endpoint). + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.name = None + """ A name that this endpoint can be identified by. + Type `str`. """ + + self.payloadMimeType = None + """ Mimetype to send. If not specified, the content could be anything + (including no payload, if the connectionType defined this). + List of `str` items. """ + + self.payloadType = None + """ The type of content that may be used at this endpoint (e.g. XDS + Discharge summaries). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.period = None + """ Interval the endpoint is expected to be operational. + Type `Period` (represented as `dict` in JSON). """ + + self.status = None + """ active | suspended | error | off | entered-in-error | test. + Type `str`. """ + + super(Endpoint, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Endpoint, self).elementProperties() + js.extend([ + ("address", "address", str, False, None, True), + ("connectionType", "connectionType", coding.Coding, False, None, True), + ("contact", "contact", contactpoint.ContactPoint, True, None, False), + ("header", "header", str, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("managingOrganization", "managingOrganization", fhirreference.FHIRReference, False, None, False), + ("name", "name", str, False, None, False), + ("payloadMimeType", "payloadMimeType", str, True, None, False), + ("payloadType", "payloadType", codeableconcept.CodeableConcept, True, None, True), + ("period", "period", period.Period, False, None, False), + ("status", "status", 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 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/STU3/endpoint_tests.py b/fhirclient/models/STU3/endpoint_tests.py new file mode 100644 index 000000000..b6f0c551f --- /dev/null +++ b/fhirclient/models/STU3/endpoint_tests.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import endpoint +from .fhirdate import FHIRDate + + +class EndpointTests(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("Endpoint", js["resourceType"]) + return endpoint.Endpoint(js) + + def testEndpoint1(self): + inst = self.instantiate_from("endpoint-example-iid.json") + self.assertIsNotNone(inst, "Must have instantiated a Endpoint instance") + self.implEndpoint1(inst) + + js = inst.as_json() + self.assertEqual("Endpoint", js["resourceType"]) + inst2 = endpoint.Endpoint(js) + self.implEndpoint1(inst2) + + 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.id, "example-iid") + 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") + self.assertIsNotNone(inst, "Must have instantiated a Endpoint instance") + self.implEndpoint2(inst) + + js = inst.as_json() + self.assertEqual("Endpoint", js["resourceType"]) + inst2 = endpoint.Endpoint(js) + self.implEndpoint2(inst2) + + def implEndpoint2(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.id, "example-wadors") + 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): + inst = self.instantiate_from("endpoint-example.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, "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.contact[0].system, "email") + self.assertEqual(inst.contact[0].use, "work") + self.assertEqual(inst.contact[0].value, "endpointmanager@example.org") + self.assertEqual(inst.header[0], "bearer-code BASGS534s4") + 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.name, "Health Intersections CarePlan Hub") + self.assertEqual(inst.payloadMimeType[0], "application/fhir+xml") + self.assertEqual(inst.payloadType[0].coding[0].code, "CarePlan") + self.assertEqual(inst.payloadType[0].coding[0].system, "http://hl7.org/fhir/resource-types") + 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") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/STU3/enrollmentrequest.py b/fhirclient/models/STU3/enrollmentrequest.py new file mode 100644 index 000000000..ed2adb00f --- /dev/null +++ b/fhirclient/models/STU3/enrollmentrequest.py @@ -0,0 +1,88 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/EnrollmentRequest) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class EnrollmentRequest(domainresource.DomainResource): + """ Enrollment request. + + This resource provides the insurance enrollment details to the insurer + regarding a specified coverage. + """ + + resource_type = "EnrollmentRequest" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.coverage = None + """ Insurance information. + Type `FHIRReference` referencing `Coverage` (represented as `dict` in JSON). """ + + self.created = None + """ Creation date. + Type `FHIRDate` (represented as `str` 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.provider = None + """ Responsible practitioner. + Type `FHIRReference` referencing `Practitioner` (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([ + ("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 + + +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/STU3/enrollmentrequest_tests.py b/fhirclient/models/STU3/enrollmentrequest_tests.py new file mode 100644 index 000000000..6f4c7d649 --- /dev/null +++ b/fhirclient/models/STU3/enrollmentrequest_tests.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import enrollmentrequest +from .fhirdate import FHIRDate + + +class EnrollmentRequestTests(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("EnrollmentRequest", js["resourceType"]) + return enrollmentrequest.EnrollmentRequest(js) + + def testEnrollmentRequest1(self): + inst = self.instantiate_from("enrollmentrequest-example.json") + self.assertIsNotNone(inst, "Must have instantiated a EnrollmentRequest instance") + self.implEnrollmentRequest1(inst) + + js = inst.as_json() + self.assertEqual("EnrollmentRequest", js["resourceType"]) + inst2 = enrollmentrequest.EnrollmentRequest(js) + self.implEnrollmentRequest1(inst2) + + def implEnrollmentRequest1(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, "22345") + self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/enrollmentrequest") + self.assertEqual(inst.identifier[0].value, "EN22345") + 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/STU3/enrollmentresponse.py b/fhirclient/models/STU3/enrollmentresponse.py new file mode 100644 index 000000000..f4807a5e9 --- /dev/null +++ b/fhirclient/models/STU3/enrollmentresponse.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/EnrollmentResponse) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class EnrollmentResponse(domainresource.DomainResource): + """ EnrollmentResponse resource. + + This resource provides enrollment and plan details from the processing of + an Enrollment resource. + """ + + resource_type = "EnrollmentResponse" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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.disposition = None + """ Disposition Message. + Type `str`. """ + + self.identifier = None + """ Business Identifier. + 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). """ + + 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). """ + + 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(EnrollmentResponse, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EnrollmentResponse, self).elementProperties() + js.extend([ + ("created", "created", fhirdate.FHIRDate, False, None, False), + ("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), + ("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 + + +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/STU3/enrollmentresponse_tests.py b/fhirclient/models/STU3/enrollmentresponse_tests.py new file mode 100644 index 000000000..b3ffcc6e5 --- /dev/null +++ b/fhirclient/models/STU3/enrollmentresponse_tests.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import enrollmentresponse +from .fhirdate import FHIRDate + + +class EnrollmentResponseTests(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("EnrollmentResponse", js["resourceType"]) + return enrollmentresponse.EnrollmentResponse(js) + + def testEnrollmentResponse1(self): + inst = self.instantiate_from("enrollmentresponse-example.json") + self.assertIsNotNone(inst, "Must have instantiated a EnrollmentResponse instance") + self.implEnrollmentResponse1(inst) + + js = inst.as_json() + self.assertEqual("EnrollmentResponse", js["resourceType"]) + inst2 = enrollmentresponse.EnrollmentResponse(js) + self.implEnrollmentResponse1(inst2) + + def implEnrollmentResponse1(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, "Dependant added to policy.") + 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.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/STU3/episodeofcare.py b/fhirclient/models/STU3/episodeofcare.py new file mode 100644 index 000000000..da34b73da --- /dev/null +++ b/fhirclient/models/STU3/episodeofcare.py @@ -0,0 +1,198 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/EpisodeOfCare) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class EpisodeOfCare(domainresource.DomainResource): + """ An association of a Patient with an Organization and Healthcare + Provider(s) for a period of time that the Organization assumes some level + of responsibility. + + An association between a patient and an organization / healthcare + provider(s) during which time encounters may occur. The managing + organization assumes a level of responsibility for the patient during this + time. + """ + + resource_type = "EpisodeOfCare" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ The set of accounts that may be used for billing for this + EpisodeOfCare. + List of `FHIRReference` items referencing `Account` (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). """ + + self.diagnosis = None + """ The list of diagnosis relevant to this episode of care. + List of `EpisodeOfCareDiagnosis` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Business Identifier(s) relevant for this EpisodeOfCare. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.managingOrganization = None + """ Organization that assumes care. + Type `FHIRReference` referencing `Organization` (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). """ + + self.period = None + """ Interval during responsibility is assumed. + Type `Period` (represented as `dict` in JSON). """ + + self.referralRequest = None + """ Originating Referral Request(s). + List of `FHIRReference` items referencing `ReferralRequest` (represented as `dict` in JSON). """ + + self.status = None + """ planned | waitlist | active | onhold | finished | cancelled | + entered-in-error. + Type `str`. """ + + self.statusHistory = None + """ Past list of status codes (the current status may be included to + cover the start date of the status). + List of `EpisodeOfCareStatusHistory` items (represented as `dict` in JSON). """ + + self.team = None + """ Other practitioners facilitating this episode of care. + List of `FHIRReference` items referencing `CareTeam` (represented as `dict` in JSON). """ + + self.type = None + """ Type/class - e.g. specialist referral, disease management. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(EpisodeOfCare, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EpisodeOfCare, self).elementProperties() + js.extend([ + ("account", "account", fhirreference.FHIRReference, True, None, False), + ("careManager", "careManager", fhirreference.FHIRReference, False, None, False), + ("diagnosis", "diagnosis", EpisodeOfCareDiagnosis, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("managingOrganization", "managingOrganization", fhirreference.FHIRReference, False, None, False), + ("patient", "patient", fhirreference.FHIRReference, False, None, True), + ("period", "period", period.Period, False, None, False), + ("referralRequest", "referralRequest", fhirreference.FHIRReference, True, None, False), + ("status", "status", str, False, None, True), + ("statusHistory", "statusHistory", EpisodeOfCareStatusHistory, True, None, False), + ("team", "team", fhirreference.FHIRReference, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +from . import backboneelement + +class EpisodeOfCareDiagnosis(backboneelement.BackboneElement): + """ The list of diagnosis relevant to this episode of care. + """ + + resource_type = "EpisodeOfCareDiagnosis" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.condition = None + """ Conditions/problems/diagnoses this episode of care is for. + Type `FHIRReference` referencing `Condition` (represented as `dict` in JSON). """ + + self.rank = None + """ Ranking of the diagnosis (for each role type). + Type `int`. """ + + self.role = None + """ Role that this diagnosis has within the episode of care (e.g. + admission, billing, discharge …). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(EpisodeOfCareDiagnosis, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EpisodeOfCareDiagnosis, self).elementProperties() + js.extend([ + ("condition", "condition", fhirreference.FHIRReference, False, None, True), + ("rank", "rank", int, False, None, False), + ("role", "role", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class EpisodeOfCareStatusHistory(backboneelement.BackboneElement): + """ Past list of status codes (the current status may be included to cover the + start date of the status). + + The history of statuses that the EpisodeOfCare has been through (without + requiring processing the history of the resource). + """ + + resource_type = "EpisodeOfCareStatusHistory" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Duration the EpisodeOfCare was in the specified status. + Type `Period` (represented as `dict` in JSON). """ + + self.status = None + """ planned | waitlist | active | onhold | finished | cancelled | + entered-in-error. + Type `str`. """ + + super(EpisodeOfCareStatusHistory, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EpisodeOfCareStatusHistory, self).elementProperties() + js.extend([ + ("period", "period", period.Period, False, None, True), + ("status", "status", str, 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 period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/STU3/episodeofcare_tests.py b/fhirclient/models/STU3/episodeofcare_tests.py new file mode 100644 index 000000000..489ec2bde --- /dev/null +++ b/fhirclient/models/STU3/episodeofcare_tests.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import episodeofcare +from .fhirdate import FHIRDate + + +class EpisodeOfCareTests(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("EpisodeOfCare", js["resourceType"]) + return episodeofcare.EpisodeOfCare(js) + + def testEpisodeOfCare1(self): + inst = self.instantiate_from("episodeofcare-example.json") + self.assertIsNotNone(inst, "Must have instantiated a EpisodeOfCare instance") + self.implEpisodeOfCare1(inst) + + js = inst.as_json() + self.assertEqual("EpisodeOfCare", js["resourceType"]) + inst2 = episodeofcare.EpisodeOfCare(js) + self.implEpisodeOfCare1(inst2) + + 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.id, "example") + self.assertEqual(inst.identifier[0].system, "http://example.org/sampleepisodeofcare-identifier") + self.assertEqual(inst.identifier[0].value, "123") + 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") + self.assertEqual(inst.statusHistory[0].period.end.date, FHIRDate("2014-09-14").date) + self.assertEqual(inst.statusHistory[0].period.end.as_json(), "2014-09-14") + self.assertEqual(inst.statusHistory[0].period.start.date, FHIRDate("2014-09-01").date) + self.assertEqual(inst.statusHistory[0].period.start.as_json(), "2014-09-01") + self.assertEqual(inst.statusHistory[0].status, "planned") + self.assertEqual(inst.statusHistory[1].period.end.date, FHIRDate("2014-09-21").date) + self.assertEqual(inst.statusHistory[1].period.end.as_json(), "2014-09-21") + self.assertEqual(inst.statusHistory[1].period.start.date, FHIRDate("2014-09-15").date) + self.assertEqual(inst.statusHistory[1].period.start.as_json(), "2014-09-15") + self.assertEqual(inst.statusHistory[1].status, "active") + self.assertEqual(inst.statusHistory[2].period.end.date, FHIRDate("2014-09-24").date) + self.assertEqual(inst.statusHistory[2].period.end.as_json(), "2014-09-24") + self.assertEqual(inst.statusHistory[2].period.start.date, FHIRDate("2014-09-22").date) + self.assertEqual(inst.statusHistory[2].period.start.as_json(), "2014-09-22") + self.assertEqual(inst.statusHistory[2].status, "onhold") + self.assertEqual(inst.statusHistory[3].period.start.date, FHIRDate("2014-09-25").date) + self.assertEqual(inst.statusHistory[3].period.start.as_json(), "2014-09-25") + self.assertEqual(inst.statusHistory[3].status, "active") + 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") + diff --git a/fhirclient/models/STU3/expansionprofile.py b/fhirclient/models/STU3/expansionprofile.py new file mode 100644 index 000000000..2133d9383 --- /dev/null +++ b/fhirclient/models/STU3/expansionprofile.py @@ -0,0 +1,418 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ExpansionProfile) on 2019-10-12. +# 2019, 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/STU3/expansionprofile_tests.py b/fhirclient/models/STU3/expansionprofile_tests.py new file mode 100644 index 000000000..16ce49d60 --- /dev/null +++ b/fhirclient/models/STU3/expansionprofile_tests.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +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/STU3/explanationofbenefit.py b/fhirclient/models/STU3/explanationofbenefit.py new file mode 100644 index 000000000..41250cb8c --- /dev/null +++ b/fhirclient/models/STU3/explanationofbenefit.py @@ -0,0 +1,1408 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ExplanationOfBenefit) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class ExplanationOfBenefit(domainresource.DomainResource): + """ Explanation of Benefit resource. + + This resource provides: the claim details; adjudication details from the + processing of a Claim; and optionally account balance information, for + informing the subscriber of the benefits provided. + """ + + resource_type = "ExplanationOfBenefit" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.accident = None + """ Details of an accident. + Type `ExplanationOfBenefitAccident` (represented as `dict` in JSON). """ + + self.addItem = None + """ Insurer added line items. + List of `ExplanationOfBenefitAddItem` items (represented as `dict` in JSON). """ + + self.benefitBalance = None + """ Balance by Benefit Category. + List of `ExplanationOfBenefitBenefitBalance` items (represented as `dict` in JSON). """ + + self.billablePeriod = None + """ Period for charge submission. + Type `Period` (represented as `dict` in JSON). """ + + self.careTeam = None + """ Care Team members. + List of `ExplanationOfBenefitCareTeam` items (represented as `dict` in JSON). """ + + self.claim = None + """ Claim reference. + Type `FHIRReference` referencing `Claim` (represented as `dict` in JSON). """ + + self.claimResponse = None + """ Claim response reference. + Type `FHIRReference` referencing `ClaimResponse` (represented as `dict` in JSON). """ + + self.created = None + """ Creation date. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.diagnosis = None + """ List of Diagnosis. + 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). """ + + self.facility = None + """ Servicing Facility. + Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + + self.form = 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.identifier = None + """ Business Identifier. + 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). """ + + self.insurer = None + """ Insurer responsible for the EOB. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.item = None + """ Goods and Services. + 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). """ + + self.outcome = None + """ complete | error | partial. + Type `CodeableConcept` (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.payee = None + """ Party to be paid any benefits payable. + Type `ExplanationOfBenefitPayee` (represented as `dict` in JSON). """ + + self.payment = None + """ Payment (if paid). + Type `ExplanationOfBenefitPayment` (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). """ + + self.procedure = None + """ Procedures performed. + List of `ExplanationOfBenefitProcedure` items (represented as `dict` in JSON). """ + + self.processNote = None + """ Processing notes. + 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). """ + + self.referral = None + """ Treatment Referral. + Type `FHIRReference` referencing `ReferralRequest` (represented as `dict` in JSON). """ + + self.related = None + """ Related Claims which may be revelant to processing this claim. + List of `ExplanationOfBenefitRelated` items (represented as `dict` in JSON). """ + + self.status = None + """ active | cancelled | draft | entered-in-error. + Type `str`. """ + + self.subType = None + """ Finer grained claim type information. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.totalBenefit = None + """ Total benefit payable for the Claim. + Type `Money` (represented as `dict` in JSON). """ + + self.totalCost = None + """ Total Cost of service from the Claim. + Type `Money` (represented as `dict` in JSON). """ + + self.type = None + """ Type or discipline. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.unallocDeductable = None + """ Unallocated deductable. + Type `Money` (represented as `dict` in JSON). """ + + super(ExplanationOfBenefit, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefit, self).elementProperties() + js.extend([ + ("accident", "accident", ExplanationOfBenefitAccident, False, None, False), + ("addItem", "addItem", ExplanationOfBenefitAddItem, True, None, False), + ("benefitBalance", "benefitBalance", ExplanationOfBenefitBenefitBalance, True, 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), + ("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), + ("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), + ("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), + ("payee", "payee", ExplanationOfBenefitPayee, False, None, False), + ("payment", "payment", ExplanationOfBenefitPayment, False, None, False), + ("precedence", "precedence", int, False, None, False), + ("prescription", "prescription", fhirreference.FHIRReference, False, None, False), + ("procedure", "procedure", ExplanationOfBenefitProcedure, True, None, False), + ("processNote", "processNote", ExplanationOfBenefitProcessNote, True, None, False), + ("provider", "provider", fhirreference.FHIRReference, False, None, False), + ("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), + ]) + return js + + +from . import backboneelement + +class ExplanationOfBenefitAccident(backboneelement.BackboneElement): + """ Details of an accident. + + An accident which resulted in the need for healthcare services. + """ + + resource_type = "ExplanationOfBenefitAccident" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ When the accident occurred. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.locationAddress = None + """ Accident Place. + Type `Address` (represented as `dict` in JSON). """ + + self.locationReference = None + """ Accident Place. + Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + + self.type = None + """ The nature of the accident. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ExplanationOfBenefitAccident, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitAccident, self).elementProperties() + js.extend([ + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("locationAddress", "locationAddress", address.Address, False, "location", False), + ("locationReference", "locationReference", fhirreference.FHIRReference, False, "location", False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class ExplanationOfBenefitAddItem(backboneelement.BackboneElement): + """ Insurer added line items. + + The first tier service adjudications for payor added services. + """ + + resource_type = "ExplanationOfBenefitAddItem" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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.category = None + """ Type of service or product. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.detail = None + """ Added items details. + 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.modifier = None + """ Service/Product billing modifiers. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.noteNumber = None + """ List of note numbers which apply. + List of `int` items. """ + + self.revenue = None + """ Revenue or cost center code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.sequenceLinkId = None + """ Service instances. + List of `int` items. """ + + self.service = None + """ Billing Code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ExplanationOfBenefitAddItem, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitAddItem, self).elementProperties() + js.extend([ + ("adjudication", "adjudication", ExplanationOfBenefitItemAdjudication, True, None, False), + ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("detail", "detail", ExplanationOfBenefitAddItemDetail, True, None, False), + ("fee", "fee", money.Money, False, None, False), + ("modifier", "modifier", codeableconcept.CodeableConcept, True, 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), + ]) + return js + + +class ExplanationOfBenefitAddItemDetail(backboneelement.BackboneElement): + """ Added items details. + + The second tier service adjudications for payor added services. + """ + + resource_type = "ExplanationOfBenefitAddItemDetail" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 `ExplanationOfBenefitItemAdjudication` items (represented as `dict` in JSON). """ + + self.category = None + """ Type of service or product. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.fee = None + """ Professional fee or Product charge. + Type `Money` (represented as `dict` in JSON). """ + + self.modifier = None + """ Service/Product billing modifiers. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.noteNumber = None + """ List of note numbers which apply. + List of `int` items. """ + + self.revenue = None + """ Revenue or cost center code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.service = None + """ Billing Code. + Type `CodeableConcept` (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), + ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("fee", "fee", money.Money, False, None, False), + ("modifier", "modifier", codeableconcept.CodeableConcept, True, None, False), + ("noteNumber", "noteNumber", int, True, None, False), + ("revenue", "revenue", codeableconcept.CodeableConcept, False, None, False), + ("service", "service", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class ExplanationOfBenefitBenefitBalance(backboneelement.BackboneElement): + """ Balance by Benefit Category. + """ + + resource_type = "ExplanationOfBenefitBenefitBalance" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Type of services covered. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.description = None + """ Description of the benefit or services covered. + Type `str`. """ + + self.excluded = None + """ Excluded from the plan. + Type `bool`. """ + + self.financial = None + """ Benefit Summary. + List of `ExplanationOfBenefitBenefitBalanceFinancial` items (represented as `dict` in JSON). """ + + self.name = None + """ Short name for the benefit. + Type `str`. """ + + self.network = None + """ 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). """ + + self.unit = None + """ Individual or family. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ExplanationOfBenefitBenefitBalance, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitBenefitBalance, self).elementProperties() + js.extend([ + ("category", "category", codeableconcept.CodeableConcept, False, None, True), + ("description", "description", str, False, None, False), + ("excluded", "excluded", bool, False, None, False), + ("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), + ]) + return js + + +class ExplanationOfBenefitBenefitBalanceFinancial(backboneelement.BackboneElement): + """ Benefit Summary. + + Benefits Used to date. + """ + + resource_type = "ExplanationOfBenefitBenefitBalanceFinancial" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.allowedMoney = None + """ Benefits allowed. + Type `Money` (represented as `dict` in JSON). """ + + self.allowedString = None + """ Benefits allowed. + Type `str`. """ + + self.allowedUnsignedInt = None + """ Benefits allowed. + Type `int`. """ + + self.type = None + """ Deductable, visits, benefit amount. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.usedMoney = None + """ Benefits used. + Type `Money` (represented as `dict` in JSON). """ + + self.usedUnsignedInt = None + """ Benefits used. + Type `int`. """ + + super(ExplanationOfBenefitBenefitBalanceFinancial, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitBenefitBalanceFinancial, 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), + ("usedUnsignedInt", "usedUnsignedInt", int, False, "used", False), + ]) + return js + + +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. + """ + + resource_type = "ExplanationOfBenefitCareTeam" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.provider = None + """ Member of the Care Team. + Type `FHIRReference` referencing `Practitioner, Organization` (represented as `dict` in JSON). """ + + self.qualification = None + """ Type, classification or Specialization. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.responsible = None + """ Billing practitioner. + Type `bool`. """ + + self.role = None + """ Role on the team. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.sequence = None + """ Number to covey order of careteam. + Type `int`. """ + + super(ExplanationOfBenefitCareTeam, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitCareTeam, self).elementProperties() + js.extend([ + ("provider", "provider", fhirreference.FHIRReference, False, None, True), + ("qualification", "qualification", codeableconcept.CodeableConcept, False, None, False), + ("responsible", "responsible", bool, False, None, False), + ("role", "role", codeableconcept.CodeableConcept, False, None, False), + ("sequence", "sequence", int, False, None, True), + ]) + return js + + +class ExplanationOfBenefitDiagnosis(backboneelement.BackboneElement): + """ List of Diagnosis. + + Ordered list of patient diagnosis for which care is sought. + """ + + resource_type = "ExplanationOfBenefitDiagnosis" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Patient's diagnosis. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.diagnosisReference = None + """ Patient's diagnosis. + Type `FHIRReference` referencing `Condition` (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. + Type `int`. """ + + self.type = None + """ Timing or nature of the diagnosis. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(ExplanationOfBenefitDiagnosis, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitDiagnosis, self).elementProperties() + js.extend([ + ("diagnosisCodeableConcept", "diagnosisCodeableConcept", codeableconcept.CodeableConcept, False, "diagnosis", True), + ("diagnosisReference", "diagnosisReference", fhirreference.FHIRReference, False, "diagnosis", True), + ("packageCode", "packageCode", codeableconcept.CodeableConcept, False, None, False), + ("sequence", "sequence", int, False, None, True), + ("type", "type", codeableconcept.CodeableConcept, True, None, False), + ]) + 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. + + Financial instrument by which payment information for health care. + """ + + resource_type = "ExplanationOfBenefitInsurance" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.coverage = None + """ Insurance information. + Type `FHIRReference` referencing `Coverage` (represented as `dict` in JSON). """ + + self.preAuthRef = None + """ Pre-Authorization/Determination Reference. + List of `str` items. """ + + super(ExplanationOfBenefitInsurance, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitInsurance, self).elementProperties() + js.extend([ + ("coverage", "coverage", fhirreference.FHIRReference, False, None, False), + ("preAuthRef", "preAuthRef", str, True, None, False), + ]) + return js + + +class ExplanationOfBenefitItem(backboneelement.BackboneElement): + """ Goods and Services. + + First tier of goods and services. + """ + + resource_type = "ExplanationOfBenefitItem" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Adjudication details. + List of `ExplanationOfBenefitItemAdjudication` items (represented as `dict` in JSON). """ + + self.bodySite = None + """ Service Location. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.careTeamLinkId = None + """ Applicable careteam members. + List of `int` items. """ + + self.category = None + """ Type of service or product. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.detail = None + """ Additional items. + List of `ExplanationOfBenefitItemDetail` items (represented as `dict` in JSON). """ + + self.diagnosisLinkId = 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). """ + + self.factor = None + """ Price scaling factor. + Type `float`. """ + + self.informationLinkId = None + """ Applicable exception and supporting information. + List of `int` items. """ + + self.locationAddress = None + """ Place of service. + Type `Address` (represented as `dict` in JSON). """ + + self.locationCodeableConcept = None + """ Place of service. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.locationReference = None + """ Place of service. + Type `FHIRReference` referencing `Location` (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. + List of `int` items. """ + + self.procedureLinkId = None + """ Applicable procedures. + List of `int` items. """ + + self.programCode = None + """ Program specific reason for item inclusion. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.quantity = None + """ Count of Products or Services. + Type `Quantity` (represented as `dict` in JSON). """ + + self.revenue = None + """ Revenue or cost center code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.sequence = None + """ Service instance. + Type `int`. """ + + self.service = None + """ Billing Code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.servicedDate = None + """ Date or dates of Service. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.servicedPeriod = None + """ Date or dates of Service. + Type `Period` (represented as `dict` in JSON). """ + + self.subSite = None + """ Service 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). """ + + self.unitPrice = None + """ Fee, charge or cost per point. + Type `Money` (represented as `dict` in JSON). """ + + super(ExplanationOfBenefitItem, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitItem, self).elementProperties() + js.extend([ + ("adjudication", "adjudication", ExplanationOfBenefitItemAdjudication, True, None, False), + ("bodySite", "bodySite", codeableconcept.CodeableConcept, False, None, False), + ("careTeamLinkId", "careTeamLinkId", int, True, None, False), + ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("detail", "detail", ExplanationOfBenefitItemDetail, True, None, False), + ("diagnosisLinkId", "diagnosisLinkId", int, True, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, True, None, False), + ("factor", "factor", float, False, None, False), + ("informationLinkId", "informationLinkId", 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), + ("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), + ("udi", "udi", fhirreference.FHIRReference, True, None, False), + ("unitPrice", "unitPrice", money.Money, False, None, False), + ]) + return js + + +class ExplanationOfBenefitItemAdjudication(backboneelement.BackboneElement): + """ Adjudication details. + + The adjudications results. + """ + + resource_type = "ExplanationOfBenefitItemAdjudication" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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. + Type `Money` (represented as `dict` in JSON). """ + + self.category = None + """ Adjudication category such as co-pay, eligible, benefit, etc.. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.reason = None + """ Explanation of Adjudication outcome. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.value = None + """ Non-monitory value. + Type `float`. """ + + super(ExplanationOfBenefitItemAdjudication, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitItemAdjudication, self).elementProperties() + js.extend([ + ("amount", "amount", money.Money, False, None, False), + ("category", "category", codeableconcept.CodeableConcept, False, None, True), + ("reason", "reason", codeableconcept.CodeableConcept, False, None, False), + ("value", "value", float, False, None, False), + ]) + return js + + +class ExplanationOfBenefitItemDetail(backboneelement.BackboneElement): + """ Additional items. + + Second tier of goods and services. + """ + + resource_type = "ExplanationOfBenefitItemDetail" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Detail level adjudication details. + List of `ExplanationOfBenefitItemAdjudication` items (represented as `dict` in JSON). """ + + self.category = None + """ Type of service or product. + Type `CodeableConcept` (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 additional item cost. + Type `Money` (represented as `dict` in JSON). """ + + self.noteNumber = None + """ List of note numbers which apply. + List of `int` items. """ + + self.programCode = None + """ Program specific reason for item inclusion. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.quantity = None + """ Count of Products or Services. + Type `Quantity` (represented as `dict` in JSON). """ + + self.revenue = None + """ Revenue or cost center code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.sequence = None + """ Service instance. + 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). """ + + self.unitPrice = None + """ Fee, charge or cost per point. + Type `Money` (represented as `dict` in JSON). """ + + super(ExplanationOfBenefitItemDetail, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitItemDetail, self).elementProperties() + js.extend([ + ("adjudication", "adjudication", ExplanationOfBenefitItemAdjudication, True, None, False), + ("category", "category", codeableconcept.CodeableConcept, 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), + ("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), + ]) + return js + + +class ExplanationOfBenefitItemDetailSubDetail(backboneelement.BackboneElement): + """ Additional items. + + Third tier of goods and services. + """ + + resource_type = "ExplanationOfBenefitItemDetailSubDetail" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Language if different from the resource. + List of `ExplanationOfBenefitItemAdjudication` items (represented as `dict` in JSON). """ + + self.category = None + """ Type of service or product. + Type `CodeableConcept` (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 + """ Net additional item cost. + Type `Money` (represented as `dict` in JSON). """ + + self.noteNumber = None + """ List of note numbers which apply. + List of `int` items. """ + + self.programCode = None + """ Program specific reason for item inclusion. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.quantity = None + """ Count of Products or Services. + Type `Quantity` (represented as `dict` in JSON). """ + + self.revenue = None + """ Revenue or cost center code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.sequence = None + """ Service instance. + 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). """ + + self.unitPrice = None + """ Fee, charge or cost per point. + Type `Money` (represented as `dict` in JSON). """ + + super(ExplanationOfBenefitItemDetailSubDetail, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitItemDetailSubDetail, self).elementProperties() + js.extend([ + ("adjudication", "adjudication", ExplanationOfBenefitItemAdjudication, True, None, False), + ("category", "category", codeableconcept.CodeableConcept, 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), + ("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), + ]) + return js + + +class ExplanationOfBenefitPayee(backboneelement.BackboneElement): + """ Party to be paid any benefits payable. + + The party to be reimbursed for the services. + """ + + resource_type = "ExplanationOfBenefitPayee" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + 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). """ + + self.type = None + """ Type of party: Subscriber, Provider, other. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ExplanationOfBenefitPayee, self).__init__(jsondict=jsondict, strict=strict) + + 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 for the claim if the claim has been paid. + """ + + resource_type = "ExplanationOfBenefitPayment" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.adjustment = None + """ Payment adjustment for non-Claim issues. + Type `Money` (represented as `dict` in JSON). """ + + self.adjustmentReason = None + """ Explanation for the non-claim adjustment. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.amount = None + """ Payable amount after adjustment. + Type `Money` (represented as `dict` in JSON). """ + + self.date = None + """ Expected date of Payment. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.identifier = None + """ Identifier of the payment instrument. + Type `Identifier` (represented as `dict` in JSON). """ + + self.type = None + """ Partial or Complete. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ExplanationOfBenefitPayment, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitPayment, self).elementProperties() + js.extend([ + ("adjustment", "adjustment", money.Money, False, None, False), + ("adjustmentReason", "adjustmentReason", codeableconcept.CodeableConcept, False, None, False), + ("amount", "amount", money.Money, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class ExplanationOfBenefitProcedure(backboneelement.BackboneElement): + """ Procedures performed. + + Ordered list of patient procedures performed to support the adjudication. + """ + + resource_type = "ExplanationOfBenefitProcedure" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ When the procedure was performed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.procedureCodeableConcept = None + """ Patient's list of procedures performed. + 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). """ + + self.sequence = None + """ Procedure sequence for reference. + Type `int`. """ + + super(ExplanationOfBenefitProcedure, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitProcedure, self).elementProperties() + js.extend([ + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("procedureCodeableConcept", "procedureCodeableConcept", codeableconcept.CodeableConcept, False, "procedure", True), + ("procedureReference", "procedureReference", fhirreference.FHIRReference, False, "procedure", True), + ("sequence", "sequence", int, False, None, True), + ]) + return js + + +class ExplanationOfBenefitProcessNote(backboneelement.BackboneElement): + """ Processing notes. + + Note text. + """ + + resource_type = "ExplanationOfBenefitProcessNote" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Language if different from the resource. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.number = None + """ Sequence number for this note. + Type `int`. """ + + self.text = None + """ Note explanitory text. + Type `str`. """ + + self.type = None + """ display | print | printoper. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ExplanationOfBenefitProcessNote, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitProcessNote, self).elementProperties() + 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), + ]) + return js + + +class ExplanationOfBenefitRelated(backboneelement.BackboneElement): + """ Related Claims which may be revelant to processing this claim. + + Other claims which are related to this claim such as prior claim versions + or for related services. + """ + + resource_type = "ExplanationOfBenefitRelated" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.claim = None + """ Reference to the related claim. + Type `FHIRReference` referencing `Claim` (represented as `dict` in JSON). """ + + self.reference = None + """ Related file or case reference. + Type `Identifier` (represented as `dict` in JSON). """ + + self.relationship = None + """ How the reference claim is related. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ExplanationOfBenefitRelated, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitRelated, self).elementProperties() + js.extend([ + ("claim", "claim", fhirreference.FHIRReference, False, None, False), + ("reference", "reference", identifier.Identifier, False, None, False), + ("relationship", "relationship", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +import sys +try: + from . import address +except ImportError: + address = sys.modules[__package__ + '.address'] +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 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 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/STU3/explanationofbenefit_tests.py b/fhirclient/models/STU3/explanationofbenefit_tests.py new file mode 100644 index 000000000..5056dd8a8 --- /dev/null +++ b/fhirclient/models/STU3/explanationofbenefit_tests.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import explanationofbenefit +from .fhirdate import FHIRDate + + +class ExplanationOfBenefitTests(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("ExplanationOfBenefit", js["resourceType"]) + return explanationofbenefit.ExplanationOfBenefit(js) + + def testExplanationOfBenefit1(self): + inst = self.instantiate_from("explanationofbenefit-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ExplanationOfBenefit instance") + self.implExplanationOfBenefit1(inst) + + js = inst.as_json() + self.assertEqual("ExplanationOfBenefit", js["resourceType"]) + inst2 = explanationofbenefit.ExplanationOfBenefit(js) + self.implExplanationOfBenefit1(inst2) + + def implExplanationOfBenefit1(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.disposition, "Claim settled as per contract.") + 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.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.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].net.value, 135.57) + 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.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.payee.type.coding[0].code, "provider") + self.assertEqual(inst.payee.type.coding[0].system, "http://hl7.org/fhir/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.type.coding[0].code, "oral") + self.assertEqual(inst.type.coding[0].system, "http://hl7.org/fhir/ex-claimtype") + diff --git a/fhirclient/models/STU3/extension.py b/fhirclient/models/STU3/extension.py new file mode 100644 index 000000000..71e9fdf24 --- /dev/null +++ b/fhirclient/models/STU3/extension.py @@ -0,0 +1,322 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Extension) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Extension(element.Element): + """ Optional Extensions Element. + + Optional Extension Element - found in all resources. + """ + + resource_type = "Extension" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.url = None + """ identifies the meaning of the extension. + Type `str`. """ + + self.valueAddress = None + """ Value of extension. + Type `Address` (represented as `dict` in JSON). """ + + self.valueAge = None + """ Value of extension. + Type `Age` (represented as `dict` in JSON). """ + + self.valueAnnotation = None + """ Value of extension. + Type `Annotation` (represented as `dict` in JSON). """ + + self.valueAttachment = None + """ Value of extension. + Type `Attachment` (represented as `dict` in JSON). """ + + self.valueBase64Binary = None + """ Value of extension. + Type `str`. """ + + self.valueBoolean = None + """ Value of extension. + Type `bool`. """ + + self.valueCode = None + """ Value of extension. + Type `str`. """ + + self.valueCodeableConcept = None + """ Value of extension. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueCoding = None + """ Value of extension. + Type `Coding` (represented as `dict` in JSON). """ + + self.valueContactPoint = None + """ Value of extension. + Type `ContactPoint` (represented as `dict` in JSON). """ + + self.valueCount = None + """ Value of extension. + Type `Count` (represented as `dict` in JSON). """ + + self.valueDate = None + """ Value of extension. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueDateTime = None + """ Value of extension. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueDecimal = None + """ Value of extension. + Type `float`. """ + + self.valueDistance = None + """ Value of extension. + Type `Distance` (represented as `dict` in JSON). """ + + self.valueDuration = None + """ Value of extension. + Type `Duration` (represented as `dict` in JSON). """ + + self.valueHumanName = None + """ Value of extension. + Type `HumanName` (represented as `dict` in JSON). """ + + self.valueId = None + """ Value of extension. + Type `str`. """ + + self.valueIdentifier = None + """ Value of extension. + Type `Identifier` (represented as `dict` in JSON). """ + + self.valueInstant = None + """ Value of extension. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueInteger = None + """ Value of extension. + Type `int`. """ + + self.valueMarkdown = None + """ 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). """ + + self.valueOid = None + """ Value of extension. + Type `str`. """ + + self.valuePeriod = None + """ Value of extension. + Type `Period` (represented as `dict` in JSON). """ + + self.valuePositiveInt = None + """ Value of extension. + Type `int`. """ + + self.valueQuantity = None + """ Value of extension. + Type `Quantity` (represented as `dict` in JSON). """ + + self.valueRange = None + """ Value of extension. + Type `Range` (represented as `dict` in JSON). """ + + self.valueRatio = None + """ Value of extension. + Type `Ratio` (represented as `dict` in JSON). """ + + self.valueReference = None + """ Value of extension. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.valueSampledData = None + """ Value of extension. + Type `SampledData` (represented as `dict` in JSON). """ + + self.valueSignature = None + """ Value of extension. + Type `Signature` (represented as `dict` in JSON). """ + + self.valueString = None + """ Value of extension. + Type `str`. """ + + self.valueTime = None + """ Value of extension. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueTiming = None + """ Value of extension. + Type `Timing` (represented as `dict` in JSON). """ + + self.valueUnsignedInt = None + """ Value of extension. + Type `int`. """ + + self.valueUri = None + """ Value of extension. + Type `str`. """ + + super(Extension, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Extension, self).elementProperties() + js.extend([ + ("url", "url", str, False, None, True), + ("valueAddress", "valueAddress", address.Address, False, "value", False), + ("valueAge", "valueAge", age.Age, False, "value", False), + ("valueAnnotation", "valueAnnotation", annotation.Annotation, False, "value", False), + ("valueAttachment", "valueAttachment", attachment.Attachment, False, "value", False), + ("valueBase64Binary", "valueBase64Binary", str, False, "value", False), + ("valueBoolean", "valueBoolean", bool, False, "value", False), + ("valueCode", "valueCode", str, False, "value", False), + ("valueCodeableConcept", "valueCodeableConcept", codeableconcept.CodeableConcept, False, "value", False), + ("valueCoding", "valueCoding", coding.Coding, False, "value", False), + ("valueContactPoint", "valueContactPoint", contactpoint.ContactPoint, False, "value", False), + ("valueCount", "valueCount", count.Count, 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), + ("valueDuration", "valueDuration", duration.Duration, 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), + ("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), + ("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), + ("valueUnsignedInt", "valueUnsignedInt", int, False, "value", False), + ("valueUri", "valueUri", str, False, "value", False), + ]) + return js + + +import sys +try: + from . import address +except ImportError: + address = sys.modules[__package__ + '.address'] +try: + from . import age +except ImportError: + age = sys.modules[__package__ + '.age'] +try: + from . import annotation +except ImportError: + annotation = sys.modules[__package__ + '.annotation'] +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 coding +except ImportError: + coding = sys.modules[__package__ + '.coding'] +try: + from . import contactpoint +except ImportError: + contactpoint = sys.modules[__package__ + '.contactpoint'] +try: + from . import count +except ImportError: + count = sys.modules[__package__ + '.count'] +try: + from . import distance +except ImportError: + distance = sys.modules[__package__ + '.distance'] +try: + from . import duration +except ImportError: + duration = sys.modules[__package__ + '.duration'] +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 humanname +except ImportError: + humanname = sys.modules[__package__ + '.humanname'] +try: + 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 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 sampleddata +except ImportError: + sampleddata = sys.modules[__package__ + '.sampleddata'] +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/STU3/familymemberhistory.py b/fhirclient/models/STU3/familymemberhistory.py new file mode 100644 index 000000000..18f809622 --- /dev/null +++ b/fhirclient/models/STU3/familymemberhistory.py @@ -0,0 +1,263 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/FamilyMemberHistory) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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. + """ + + resource_type = "FamilyMemberHistory" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.ageAge = None + """ (approximate) age. + Type `Age` (represented as `dict` in JSON). """ + + self.ageRange = None + """ (approximate) age. + Type `Range` (represented as `dict` in JSON). """ + + self.ageString = None + """ (approximate) age. + Type `str`. """ + + self.bornDate = None + """ (approximate) date of birth. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.bornPeriod = None + """ (approximate) date of birth. + Type `Period` (represented as `dict` in JSON). """ + + self.bornString = None + """ (approximate) date of birth. + Type `str`. """ + + self.condition = None + """ Condition that the related person had. + List of `FamilyMemberHistoryCondition` items (represented as `dict` in JSON). """ + + self.date = None + """ When history was captured/updated. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.deceasedAge = None + """ Dead? How old/when?. + Type `Age` (represented as `dict` in JSON). """ + + self.deceasedBoolean = None + """ Dead? How old/when?. + Type `bool`. """ + + self.deceasedDate = None + """ Dead? How old/when?. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.deceasedRange = None + """ Dead? How old/when?. + Type `Range` (represented as `dict` in JSON). """ + + self.deceasedString = None + """ 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.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). """ + + self.reasonCode = None + """ Why was family member history performed?. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.reasonReference = None + """ Why was family member history performed?. + List of `FHIRReference` items referencing `Condition, Observation, AllergyIntolerance, QuestionnaireResponse` (represented as `dict` in JSON). """ + + self.relationship = None + """ Relationship to the subject. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.status = None + """ partial | completed | entered-in-error | health-unknown. + Type `str`. """ + + super(FamilyMemberHistory, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(FamilyMemberHistory, self).elementProperties() + js.extend([ + ("ageAge", "ageAge", age.Age, False, "age", False), + ("ageRange", "ageRange", range.Range, False, "age", False), + ("ageString", "ageString", str, False, "age", False), + ("bornDate", "bornDate", fhirdate.FHIRDate, False, "born", False), + ("bornPeriod", "bornPeriod", period.Period, False, "born", False), + ("bornString", "bornString", str, False, "born", False), + ("condition", "condition", FamilyMemberHistoryCondition, True, 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), + ("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), + ("status", "status", str, False, None, True), + ]) + return js + + +from . import backboneelement + +class FamilyMemberHistoryCondition(backboneelement.BackboneElement): + """ Condition that the related person had. + + The significant Conditions (or condition) that the family member had. This + is a repeating section to allow a system to represent more than one + condition per resource, though there is nothing stopping multiple resources + - one per condition. + """ + + resource_type = "FamilyMemberHistoryCondition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Condition suffered by relation. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.note = None + """ Extra information about condition. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.onsetAge = None + """ When condition first manifested. + Type `Age` (represented as `dict` in JSON). """ + + self.onsetPeriod = None + """ When condition first manifested. + Type `Period` (represented as `dict` in JSON). """ + + self.onsetRange = None + """ When condition first manifested. + Type `Range` (represented as `dict` in JSON). """ + + self.onsetString = None + """ When condition first manifested. + Type `str`. """ + + self.outcome = None + """ deceased | permanent disability | etc.. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(FamilyMemberHistoryCondition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(FamilyMemberHistoryCondition, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("note", "note", annotation.Annotation, True, None, False), + ("onsetAge", "onsetAge", age.Age, False, "onset", False), + ("onsetPeriod", "onsetPeriod", period.Period, False, "onset", False), + ("onsetRange", "onsetRange", range.Range, False, "onset", False), + ("onsetString", "onsetString", str, False, "onset", False), + ("outcome", "outcome", 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: + 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'] +try: + from . import range +except ImportError: + range = sys.modules[__package__ + '.range'] diff --git a/fhirclient/models/STU3/familymemberhistory_tests.py b/fhirclient/models/STU3/familymemberhistory_tests.py new file mode 100644 index 000000000..9c6a728ef --- /dev/null +++ b/fhirclient/models/STU3/familymemberhistory_tests.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import familymemberhistory +from .fhirdate import FHIRDate + + +class FamilyMemberHistoryTests(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("FamilyMemberHistory", js["resourceType"]) + return familymemberhistory.FamilyMemberHistory(js) + + def testFamilyMemberHistory1(self): + inst = self.instantiate_from("familymemberhistory-example.json") + self.assertIsNotNone(inst, "Must have instantiated a FamilyMemberHistory instance") + self.implFamilyMemberHistory1(inst) + + js = inst.as_json() + self.assertEqual("FamilyMemberHistory", js["resourceType"]) + inst2 = familymemberhistory.FamilyMemberHistory(js) + self.implFamilyMemberHistory1(inst2) + + def implFamilyMemberHistory1(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].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].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.status, "completed") + 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-mother.json") + self.assertIsNotNone(inst, "Must have instantiated a FamilyMemberHistory instance") + self.implFamilyMemberHistory2(inst) + + js = inst.as_json() + self.assertEqual("FamilyMemberHistory", js["resourceType"]) + inst2 = familymemberhistory.FamilyMemberHistory(js) + self.implFamilyMemberHistory2(inst2) + + def implFamilyMemberHistory2(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].system, "http://snomed.info/sct") + 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, 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.status, "completed") + self.assertEqual(inst.text.div, "
Mother died of a stroke aged 56
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/STU3/fhirabstractbase.py b/fhirclient/models/STU3/fhirabstractbase.py new file mode 100644 index 000000000..27ce44f28 --- /dev/null +++ b/fhirclient/models/STU3/fhirabstractbase.py @@ -0,0 +1,357 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Base class for all FHIR elements. + +import sys +import logging + +logger = logging.getLogger(__name__) + + +class FHIRValidationError(Exception): + """ Exception raised when one or more errors occurred during model + validation. + """ + + def __init__(self, errors, path=None): + """ Initializer. + + :param errors: List of Exception instances. Also accepts a string, + which is converted to a TypeError. + :param str path: The property path on the object where errors occurred + """ + if not isinstance(errors, list): + errors = [TypeError(errors)] + msgs = "\n ".join([str(e).replace("\n", "\n ") for e in errors]) + message = "{}:\n {}".format(path or "{root}", msgs) + + super(FHIRValidationError, self).__init__(message) + + self.errors = errors + """ A list of validation errors encountered. Typically contains + TypeError, KeyError, possibly AttributeError and others. """ + + self.path = path + """ The path on the object where the errors occurred. """ + + def prefixed(self, path_prefix): + """ Creates a new instance of the receiver, with the given path prefix + applied. """ + path = '{}.{}'.format(path_prefix, self.path) if self.path is not None else path_prefix + return self.__class__(self.errors, path) + + +class FHIRAbstractBase(object): + """ Abstract base class for all FHIR elements. + """ + + def __init__(self, jsondict=None, strict=True): + """ Initializer. If strict is true, raises on errors, otherwise uses + `logger.warning()`. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self._resolved = None + """ Dictionary of resolved resources. """ + + self._owner = None + """ Points to the parent resource, if there is one. """ + + if jsondict is not None: + if strict: + self.update_with_json(jsondict) + else: + try: + self.update_with_json(jsondict) + except FHIRValidationError as e: + for err in e.errors: + logger.warning(err) + + + # MARK: Instantiation from JSON + + @classmethod + def with_json(cls, jsonobj): + """ Initialize an element from a JSON dictionary or array. + + If the JSON dictionary has a "resourceType" entry and the specified + resource type is not the receiving classes type, uses + `FHIRElementFactory` to return a correct class instance. + + :raises: TypeError on anything but dict or list of dicts + :raises: FHIRValidationError if instantiation fails + :param jsonobj: A dict or list of dicts to instantiate from + :returns: An instance or a list of instances created from JSON data + """ + if isinstance(jsonobj, dict): + return cls._with_json_dict(jsonobj) + + if isinstance(jsonobj, list): + arr = [] + for jsondict in jsonobj: + try: + arr.append(cls._with_json_dict(jsondict)) + except FHIRValidationError as e: + raise e.prefixed(str(len(arr))) + return arr + + raise TypeError("`with_json()` on {} only takes dict or list of dict, but you provided {}" + .format(cls, type(jsonobj))) + + @classmethod + def _with_json_dict(cls, jsondict): + """ Internal method to instantiate from JSON dictionary. + + :raises: TypeError on anything but dict + :raises: FHIRValidationError if instantiation fails + :returns: An instance created from dictionary data + """ + if not isinstance(jsondict, dict): + raise TypeError("Can only use `_with_json_dict()` on {} with a dictionary, got {}" + .format(type(self), type(jsondict))) + return cls(jsondict) + + @classmethod + def with_json_and_owner(cls, jsonobj, owner): + """ Instantiates by forwarding to `with_json()`, then remembers the + "owner" of the instantiated elements. The "owner" is the resource + containing the receiver and is used to resolve contained resources. + + :raises: TypeError on anything but dict or list of dicts + :raises: FHIRValidationError if instantiation fails + :param dict jsonobj: Decoded JSON dictionary (or list thereof) + :param FHIRElement owner: The owning parent + :returns: An instance or a list of instances created from JSON data + """ + instance = cls.with_json(jsonobj) + if isinstance(instance, list): + for inst in instance: + inst._owner = owner + else: + instance._owner = owner + + return instance + + + # MARK: (De)Serialization + + def elementProperties(self): + """ Returns a list of tuples, one tuple for each property that should + be serialized, as: ("name", "json_name", type, is_list, "of_many", not_optional) + """ + return [] + + def update_with_json(self, jsondict): + """ Update the receiver with data in a JSON dictionary. + + :raises: FHIRValidationError on validation errors + :param dict jsondict: The JSON dictionary to use to update the receiver + :returns: None on success, a list of errors if there were errors + """ + if jsondict is None: + return + + if not isinstance(jsondict, dict): + raise FHIRValidationError("Non-dict type {} fed to `update_with_json` on {}" + .format(type(jsondict), type(self))) + + # loop all registered properties and instantiate + errs = [] + valid = set(['resourceType']) # used to also contain `fhir_comments` until STU-3 + found = set() + nonoptionals = set() + for name, jsname, typ, is_list, of_many, not_optional in self.elementProperties(): + valid.add(jsname) + if of_many is not None: + valid.add(of_many) + + # bring the value in shape + err = None + value = jsondict.get(jsname) + if value is not None and hasattr(typ, 'with_json_and_owner'): + try: + value = typ.with_json_and_owner(value, self) + except Exception as e: + value = None + err = e + + # got a value, test if it is of required type and assign + if value is not None: + testval = value + if is_list: + if not isinstance(value, list): + err = TypeError("Wrong type {} for list property \"{}\" on {}, expecting a list of {}" + .format(type(value), name, type(self), typ)) + testval = None + else: + testval = value[0] if value and len(value) > 0 else None + + if testval is not None and not self._matches_type(testval, typ): + err = TypeError("Wrong type {} for property \"{}\" on {}, expecting {}" + .format(type(testval), name, type(self), typ)) + else: + setattr(self, name, value) + + found.add(jsname) + if of_many is not None: + found.add(of_many) + + # not optional and missing, report (we clean `of_many` later on) + elif not_optional: + nonoptionals.add(of_many or jsname) + + # TODO: look at `_name` only if this is a primitive! + _jsname = '_'+jsname + _value = jsondict.get(_jsname) + if _value is not None: + valid.add(_jsname) + found.add(_jsname) + + # report errors + if err is not None: + errs.append(err.prefixed(name) if isinstance(err, FHIRValidationError) else FHIRValidationError([err], name)) + + # were there missing non-optional entries? + if len(nonoptionals) > 0: + for miss in nonoptionals - found: + errs.append(KeyError("Non-optional property \"{}\" on {} is missing" + .format(miss, self))) + + # were there superfluous dictionary keys? + if len(set(jsondict.keys()) - valid) > 0: + for supflu in set(jsondict.keys()) - valid: + errs.append(AttributeError("Superfluous entry \"{}\" in data for {}" + .format(supflu, self))) + + if len(errs) > 0: + raise FHIRValidationError(errs) + + def as_json(self): + """ Serializes to JSON by inspecting `elementProperties()` and creating + a JSON dictionary of all registered properties. Checks: + + - whether required properties are not None (and lists not empty) + - whether not-None properties are of the correct type + + :raises: FHIRValidationError if properties have the wrong type or if + required properties are empty + :returns: A validated dict object that can be JSON serialized + """ + js = {} + errs = [] + + # JSONify all registered properties + found = set() + nonoptionals = set() + for name, jsname, typ, is_list, of_many, not_optional in self.elementProperties(): + if not_optional: + nonoptionals.add(of_many or jsname) + + err = None + value = getattr(self, name) + if value is None: + continue + + if is_list: + if not isinstance(value, list): + err = TypeError("Expecting property \"{}\" on {} to be list, but is {}" + .format(name, type(self), type(value))) + elif len(value) > 0: + if not self._matches_type(value[0], typ): + err = TypeError("Expecting property \"{}\" on {} to be {}, but is {}" + .format(name, type(self), typ, type(value[0]))) + else: + lst = [] + for v in value: + try: + lst.append(v.as_json() if hasattr(v, 'as_json') else v) + except FHIRValidationError as e: + err = e.prefixed(str(len(lst))).prefixed(name) + found.add(of_many or jsname) + js[jsname] = lst + else: + if not self._matches_type(value, typ): + err = TypeError("Expecting property \"{}\" on {} to be {}, but is {}" + .format(name, type(self), typ, type(value))) + else: + try: + found.add(of_many or jsname) + js[jsname] = value.as_json() if hasattr(value, 'as_json') else value + except FHIRValidationError as e: + err = e.prefixed(name) + + if err is not None: + errs.append(err if isinstance(err, FHIRValidationError) else FHIRValidationError([err], name)) + + # any missing non-optionals? + if len(nonoptionals - found) > 0: + for nonop in nonoptionals - found: + errs.append(KeyError("Property \"{}\" on {} is not optional, you must provide a value for it" + .format(nonop, self))) + + if len(errs) > 0: + raise FHIRValidationError(errs) + return js + + def _matches_type(self, value, typ): + if value is None: + return True + if isinstance(value, typ): + return True + if int == typ or float == typ: + return (isinstance(value, int) or isinstance(value, float)) + if (sys.version_info < (3, 0)) and (str == typ or unicode == typ): + return (isinstance(value, str) or isinstance(value, unicode)) + return False + + + # MARK: Handling References + + def owningResource(self): + """ Walks the owner hierarchy and returns the next parent that is a + `DomainResource` instance. + """ + owner = self._owner + while owner is not None and not hasattr(owner, "contained"): + owner = owner._owner + return owner + + def owningBundle(self): + """ Walks the owner hierarchy and returns the next parent that is a + `Bundle` instance. + """ + owner = self._owner + while owner is not None and not 'Bundle' == owner.resource_type: + owner = owner._owner + return owner + + def resolvedReference(self, refid): + """ Returns the resolved reference with the given id, if it has been + resolved already. If it hasn't, forwards the call to its owner if it + has one. + + You should probably use `resolve()` on the `FHIRReference` itself. + + :param refid: The id of the resource to resolve + :returns: An instance of `Resource`, if it was found + """ + if self._resolved and refid in self._resolved: + return self._resolved[refid] + return self._owner.resolvedReference(refid) if self._owner is not None else None + + def didResolveReference(self, refid, resolved): + """ Called by `FHIRResource` when it resolves a reference. Stores the + resolved reference into the `_resolved` dictionary. + + :param refid: The id of the resource that was resolved + :param refid: The resolved resource, ready to be cached + """ + if self._resolved is not None: + self._resolved[refid] = resolved + else: + self._resolved = {refid: resolved} + diff --git a/fhirclient/models/STU3/fhirabstractresource.py b/fhirclient/models/STU3/fhirabstractresource.py new file mode 100644 index 000000000..74aac5e2c --- /dev/null +++ b/fhirclient/models/STU3/fhirabstractresource.py @@ -0,0 +1,204 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Base class for FHIR resources. +# 2014, SMART Health IT. + +from . import fhirabstractbase + + +class FHIRAbstractResource(fhirabstractbase.FHIRAbstractBase): + """ Extends the FHIRAbstractBase with server talking capabilities. + """ + resource_type = 'FHIRAbstractResource' + + def __init__(self, jsondict=None, strict=True): + self._server = None + """ The server the instance was read from. """ + + # raise if "resourceType" does not match + if jsondict is not None and 'resourceType' in jsondict \ + and jsondict['resourceType'] != self.resource_type: + raise Exception("Attempting to instantiate {} with resource data that defines a resourceType of \"{}\"" + .format(self.__class__, jsondict['resourceType'])) + + super(FHIRAbstractResource, self).__init__(jsondict=jsondict, strict=strict) + + @classmethod + def _with_json_dict(cls, jsondict): + """ Overridden to use a factory if called when "resourceType" is + defined in the JSON but does not match the receiver's resource_type. + """ + if not isinstance(jsondict, dict): + raise Exception("Cannot use this method with anything but a JSON dictionary, got {}" + .format(jsondict)) + + res_type = jsondict.get('resourceType') + if res_type and res_type != cls.resource_type: + return fhirelementfactory.FHIRElementFactory.instantiate(res_type, jsondict) + return super(FHIRAbstractResource, cls)._with_json_dict(jsondict) + + def as_json(self): + js = super(FHIRAbstractResource, self).as_json() + js['resourceType'] = self.resource_type + return js + + + # MARK: Handling Paths + + def relativeBase(self): + return self.__class__.resource_type + + def relativePath(self): + if self.id is None: + return self.relativeBase() + return "{}/{}".format(self.relativeBase(), self.id) + + + # MARK: - Server Connection + + @property + def origin_server(self): + """ Walks the owner hierarchy until it finds an owner with a server. + """ + server = self._server + owner = self._owner + while server is None and owner is not None: + server = getattr(owner, '_server', None) + owner = owner._owner + return server + + @origin_server.setter + def origin_server(self, server): + """ Sets the server on an element. """ + self._server = server + + @classmethod + def read(cls, rem_id, server): + """ Read the resource with the given id from the given server. The + passed-in server instance must support a `request_json()` method call, + taking a relative path as first (and only mandatory) argument. + + :param str rem_id: The id of the resource on the remote server + :param FHIRServer server: An instance of a FHIR server or compatible class + :returns: An instance of the receiving class + """ + if not rem_id: + raise Exception("Cannot read resource without remote id") + + path = '{}/{}'.format(cls.resource_type, rem_id) + instance = cls.read_from(path, server) + instance._local_id = rem_id + + return instance + + @classmethod + def read_from(cls, path, server): + """ Requests data from the given REST path on the server and creates + an instance of the receiving class. + + :param str path: The REST path to read from + :param FHIRServer server: An instance of a FHIR server or compatible class + :returns: An instance of the receiving class + """ + if not path: + raise Exception("Cannot read resource without REST path") + if server is None: + raise Exception("Cannot read resource without server instance") + + ret = server.request_json(path) + instance = cls(jsondict=ret) + instance.origin_server = server + return instance + + def create(self, server): + """ Attempt to create the receiver on the given server, using a POST + command. + + :param FHIRServer server: The server to create the receiver on + :returns: None or the response JSON on success + """ + srv = server or self.origin_server + if srv is None: + raise Exception("Cannot create a resource without a server") + if self.id: + raise Exception("This resource already has an id, cannot create") + + ret = srv.post_json(self.relativeBase(), self.as_json()) + if len(ret.text) > 0: + return ret.json() + return None + + def update(self, server=None): + """ Update the receiver's representation on the given server, issuing + a PUT command. + + :param FHIRServer server: The server to update the receiver on; + optional, will use the instance's `server` if needed. + :returns: None or the response JSON on success + """ + srv = server or self.origin_server + if srv is None: + raise Exception("Cannot update a resource that does not have a server") + if not self.id: + raise Exception("Cannot update a resource that does not have an id") + + ret = srv.put_json(self.relativePath(), self.as_json()) + if len(ret.text) > 0: + return ret.json() + return None + + def delete(self, server=None): + """ Delete the receiver from the given server with a DELETE command. + + :param FHIRServer server: The server to update the receiver on; + optional, will use the instance's `server` if needed. + :returns: None or the response JSON on success + """ + srv = server or self.origin_server + if srv is None: + raise Exception("Cannot delete a resource that does not have a server") + if not self.id: + raise Exception("Cannot delete a resource that does not have an id") + + ret = srv.delete_json(self.relativePath()) + if len(ret.text) > 0: + return ret.json() + return None + + + # MARK: - Search + + def search(self, struct=None): + """ Search can be started via a dictionary containing a search + construct. + + Calling this method with a search struct will return a `FHIRSearch` + object representing the search struct, with "$type" and "id" added. + + :param dict struct: An optional search structure + :returns: A FHIRSearch instance + """ + if struct is None: + struct = {'$type': self.__class__.resource_type} + if self._local_id is not None or self.id is not None: + struct['id'] = self._local_id or self.id + return self.__class__.where(struct) + + @classmethod + def where(cls, struct): + """ Search can be started via a dictionary containing a search + construct. + + Calling this method with a search struct will return a `FHIRSearch` + object representing the search struct + + :param dict struct: A search structure + :returns: A FHIRSearch instance + """ + return fhirsearch.FHIRSearch(cls, struct) + + +from . import fhirdate +from . import fhirsearch +from . import fhirelementfactory diff --git a/fhirclient/models/STU3/fhirdate.py b/fhirclient/models/STU3/fhirdate.py new file mode 100644 index 000000000..1ac29e8b6 --- /dev/null +++ b/fhirclient/models/STU3/fhirdate.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Facilitate working with dates. +# 2014, SMART Health IT. + +import sys +import logging +import isodate +import datetime + +logger = logging.getLogger(__name__) + + +class FHIRDate(object): + """ Facilitate working with dates. + + - `date`: datetime object representing the receiver's date-time + """ + + def __init__(self, jsonval=None): + self.date = None + if jsonval is not None: + isstr = isinstance(jsonval, str) + if not isstr and sys.version_info[0] < 3: # Python 2.x has 'str' and 'unicode' + isstr = isinstance(jsonval, basestring) + if not isstr: + raise TypeError("Expecting string when initializing {}, but got {}" + .format(type(self), type(jsonval))) + try: + if 'T' in jsonval: + self.date = isodate.parse_datetime(jsonval) + else: + self.date = isodate.parse_date(jsonval) + except Exception as e: + logger.warning("Failed to initialize FHIRDate from \"{}\": {}" + .format(jsonval, e)) + + self.origval = jsonval + + def __setattr__(self, prop, value): + if 'date' == prop: + self.origval = None + object.__setattr__(self, prop, value) + + @property + def isostring(self): + if self.date is None: + return None + if isinstance(self.date, datetime.datetime): + return isodate.datetime_isoformat(self.date) + return isodate.date_isoformat(self.date) + + @classmethod + def with_json(cls, jsonobj): + """ Initialize a date from an ISO date string. + """ + isstr = isinstance(jsonobj, str) + if not isstr and sys.version_info[0] < 3: # Python 2.x has 'str' and 'unicode' + isstr = isinstance(jsonobj, basestring) + if isstr: + return cls(jsonobj) + + if isinstance(jsonobj, list): + return [cls(jsonval) for jsonval in jsonobj] + + raise TypeError("`cls.with_json()` only takes string or list of strings, but you provided {}" + .format(type(jsonobj))) + + @classmethod + def with_json_and_owner(cls, jsonobj, owner): + """ Added for compatibility reasons to FHIRElement; "owner" is + discarded. + """ + return cls.with_json(jsonobj) + + def as_json(self): + if self.origval is not None: + return self.origval + return self.isostring + diff --git a/fhirclient/models/STU3/fhirelementfactory.py b/fhirclient/models/STU3/fhirelementfactory.py new file mode 100644 index 000000000..1f4abb88b --- /dev/null +++ b/fhirclient/models/STU3/fhirelementfactory.py @@ -0,0 +1,1491 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + + +class FHIRElementFactory(object): + """ Factory class to instantiate resources by resource name. + """ + + @classmethod + def instantiate(cls, resource_type, jsondict): + """ Instantiate a resource of the type correlating to "resource_type". + + :param str resource_type: The name/type of the resource to instantiate + :param dict jsondict: The JSON dictionary to use for data + :returns: A resource of the respective type or `Element` + """ + if "Account" == resource_type: + from . import account + return account.Account(jsondict) + if "AccountCoverage" == resource_type: + from . import account + return account.AccountCoverage(jsondict) + if "AccountGuarantor" == resource_type: + from . import account + return account.AccountGuarantor(jsondict) + if "ActivityDefinition" == resource_type: + from . import activitydefinition + return activitydefinition.ActivityDefinition(jsondict) + if "ActivityDefinitionDynamicValue" == resource_type: + from . import activitydefinition + return activitydefinition.ActivityDefinitionDynamicValue(jsondict) + if "ActivityDefinitionParticipant" == resource_type: + from . import activitydefinition + return activitydefinition.ActivityDefinitionParticipant(jsondict) + if "Address" == resource_type: + from . import address + return address.Address(jsondict) + if "AdverseEvent" == resource_type: + from . import adverseevent + return adverseevent.AdverseEvent(jsondict) + if "AdverseEventSuspectEntity" == resource_type: + from . import adverseevent + return adverseevent.AdverseEventSuspectEntity(jsondict) + if "Age" == resource_type: + from . import age + return age.Age(jsondict) + if "AllergyIntolerance" == resource_type: + from . import allergyintolerance + return allergyintolerance.AllergyIntolerance(jsondict) + if "AllergyIntoleranceReaction" == resource_type: + from . import allergyintolerance + return allergyintolerance.AllergyIntoleranceReaction(jsondict) + if "Annotation" == resource_type: + from . import annotation + return annotation.Annotation(jsondict) + if "Appointment" == resource_type: + from . import appointment + return appointment.Appointment(jsondict) + if "AppointmentParticipant" == resource_type: + from . import appointment + return appointment.AppointmentParticipant(jsondict) + if "AppointmentResponse" == resource_type: + from . import appointmentresponse + return appointmentresponse.AppointmentResponse(jsondict) + if "Attachment" == resource_type: + from . import attachment + return attachment.Attachment(jsondict) + if "AuditEvent" == resource_type: + from . import auditevent + return auditevent.AuditEvent(jsondict) + if "AuditEventAgent" == resource_type: + from . import auditevent + return auditevent.AuditEventAgent(jsondict) + if "AuditEventAgentNetwork" == resource_type: + from . import auditevent + return auditevent.AuditEventAgentNetwork(jsondict) + if "AuditEventEntity" == resource_type: + from . import auditevent + return auditevent.AuditEventEntity(jsondict) + if "AuditEventEntityDetail" == resource_type: + from . import auditevent + return auditevent.AuditEventEntityDetail(jsondict) + if "AuditEventSource" == resource_type: + from . import auditevent + return auditevent.AuditEventSource(jsondict) + if "BackboneElement" == resource_type: + from . import backboneelement + return backboneelement.BackboneElement(jsondict) + if "Basic" == resource_type: + from . import basic + return basic.Basic(jsondict) + if "Binary" == resource_type: + from . import binary + return binary.Binary(jsondict) + if "BodySite" == resource_type: + from . import bodysite + return bodysite.BodySite(jsondict) + if "Bundle" == resource_type: + from . import bundle + return bundle.Bundle(jsondict) + if "BundleEntry" == resource_type: + from . import bundle + return bundle.BundleEntry(jsondict) + if "BundleEntryRequest" == resource_type: + from . import bundle + return bundle.BundleEntryRequest(jsondict) + if "BundleEntryResponse" == resource_type: + from . import bundle + return bundle.BundleEntryResponse(jsondict) + if "BundleEntrySearch" == resource_type: + from . import bundle + return bundle.BundleEntrySearch(jsondict) + if "BundleLink" == resource_type: + from . import bundle + return bundle.BundleLink(jsondict) + if "CapabilityStatement" == resource_type: + from . import capabilitystatement + return capabilitystatement.CapabilityStatement(jsondict) + if "CapabilityStatementDocument" == resource_type: + from . import capabilitystatement + return capabilitystatement.CapabilityStatementDocument(jsondict) + if "CapabilityStatementImplementation" == resource_type: + from . import capabilitystatement + return capabilitystatement.CapabilityStatementImplementation(jsondict) + if "CapabilityStatementMessaging" == resource_type: + from . import capabilitystatement + return capabilitystatement.CapabilityStatementMessaging(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) + if "CapabilityStatementRest" == resource_type: + from . import capabilitystatement + return capabilitystatement.CapabilityStatementRest(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 "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) + if "CarePlan" == resource_type: + from . import careplan + return careplan.CarePlan(jsondict) + if "CarePlanActivity" == resource_type: + from . import careplan + return careplan.CarePlanActivity(jsondict) + if "CarePlanActivityDetail" == resource_type: + from . import careplan + return careplan.CarePlanActivityDetail(jsondict) + if "CareTeam" == resource_type: + from . import careteam + return careteam.CareTeam(jsondict) + if "CareTeamParticipant" == resource_type: + from . import careteam + return careteam.CareTeamParticipant(jsondict) + if "ChargeItem" == resource_type: + from . import chargeitem + return chargeitem.ChargeItem(jsondict) + if "ChargeItemParticipant" == resource_type: + from . import chargeitem + return chargeitem.ChargeItemParticipant(jsondict) + if "Claim" == resource_type: + from . import claim + return claim.Claim(jsondict) + if "ClaimAccident" == resource_type: + from . import claim + return claim.ClaimAccident(jsondict) + if "ClaimCareTeam" == resource_type: + from . import claim + return claim.ClaimCareTeam(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) + if "ClaimItem" == resource_type: + from . import claim + return claim.ClaimItem(jsondict) + if "ClaimItemDetail" == resource_type: + from . import claim + return claim.ClaimItemDetail(jsondict) + if "ClaimItemDetailSubDetail" == resource_type: + from . import claim + return claim.ClaimItemDetailSubDetail(jsondict) + if "ClaimPayee" == resource_type: + from . import claim + return claim.ClaimPayee(jsondict) + if "ClaimProcedure" == resource_type: + from . import claim + return claim.ClaimProcedure(jsondict) + if "ClaimRelated" == resource_type: + from . import claim + return claim.ClaimRelated(jsondict) + if "ClaimResponse" == resource_type: + from . import claimresponse + return claimresponse.ClaimResponse(jsondict) + if "ClaimResponseAddItem" == resource_type: + from . import claimresponse + return claimresponse.ClaimResponseAddItem(jsondict) + if "ClaimResponseAddItemDetail" == resource_type: + from . import claimresponse + return claimresponse.ClaimResponseAddItemDetail(jsondict) + if "ClaimResponseError" == resource_type: + from . import claimresponse + return claimresponse.ClaimResponseError(jsondict) + if "ClaimResponseInsurance" == resource_type: + from . import claimresponse + return claimresponse.ClaimResponseInsurance(jsondict) + if "ClaimResponseItem" == resource_type: + from . import claimresponse + return claimresponse.ClaimResponseItem(jsondict) + if "ClaimResponseItemAdjudication" == resource_type: + from . import claimresponse + return claimresponse.ClaimResponseItemAdjudication(jsondict) + if "ClaimResponseItemDetail" == resource_type: + from . import claimresponse + return claimresponse.ClaimResponseItemDetail(jsondict) + if "ClaimResponseItemDetailSubDetail" == resource_type: + from . import claimresponse + return claimresponse.ClaimResponseItemDetailSubDetail(jsondict) + if "ClaimResponsePayment" == resource_type: + from . import claimresponse + return claimresponse.ClaimResponsePayment(jsondict) + if "ClaimResponseProcessNote" == resource_type: + from . import claimresponse + return claimresponse.ClaimResponseProcessNote(jsondict) + if "ClinicalImpression" == resource_type: + from . import clinicalimpression + return clinicalimpression.ClinicalImpression(jsondict) + if "ClinicalImpressionFinding" == resource_type: + from . import clinicalimpression + return clinicalimpression.ClinicalImpressionFinding(jsondict) + if "ClinicalImpressionInvestigation" == resource_type: + from . import clinicalimpression + return clinicalimpression.ClinicalImpressionInvestigation(jsondict) + if "CodeSystem" == resource_type: + from . import codesystem + return codesystem.CodeSystem(jsondict) + if "CodeSystemConcept" == resource_type: + from . import codesystem + return codesystem.CodeSystemConcept(jsondict) + if "CodeSystemConceptDesignation" == resource_type: + from . import codesystem + return codesystem.CodeSystemConceptDesignation(jsondict) + if "CodeSystemConceptProperty" == resource_type: + from . import codesystem + return codesystem.CodeSystemConceptProperty(jsondict) + if "CodeSystemFilter" == resource_type: + from . import codesystem + return codesystem.CodeSystemFilter(jsondict) + if "CodeSystemProperty" == resource_type: + from . import codesystem + return codesystem.CodeSystemProperty(jsondict) + if "CodeableConcept" == resource_type: + from . import codeableconcept + return codeableconcept.CodeableConcept(jsondict) + if "Coding" == resource_type: + from . import coding + return coding.Coding(jsondict) + if "Communication" == resource_type: + from . import communication + return communication.Communication(jsondict) + if "CommunicationPayload" == resource_type: + from . import communication + return communication.CommunicationPayload(jsondict) + if "CommunicationRequest" == resource_type: + from . import communicationrequest + return communicationrequest.CommunicationRequest(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) + if "CompartmentDefinitionResource" == resource_type: + from . import compartmentdefinition + return compartmentdefinition.CompartmentDefinitionResource(jsondict) + if "Composition" == resource_type: + from . import composition + return composition.Composition(jsondict) + if "CompositionAttester" == resource_type: + from . import composition + return composition.CompositionAttester(jsondict) + if "CompositionEvent" == resource_type: + from . import composition + return composition.CompositionEvent(jsondict) + if "CompositionRelatesTo" == resource_type: + from . import composition + return composition.CompositionRelatesTo(jsondict) + if "CompositionSection" == resource_type: + from . import composition + return composition.CompositionSection(jsondict) + if "ConceptMap" == resource_type: + from . import conceptmap + return conceptmap.ConceptMap(jsondict) + if "ConceptMapGroup" == resource_type: + from . import conceptmap + return conceptmap.ConceptMapGroup(jsondict) + if "ConceptMapGroupElement" == resource_type: + from . import conceptmap + return conceptmap.ConceptMapGroupElement(jsondict) + if "ConceptMapGroupElementTarget" == resource_type: + from . import conceptmap + return conceptmap.ConceptMapGroupElementTarget(jsondict) + if "ConceptMapGroupElementTargetDependsOn" == resource_type: + from . import conceptmap + return conceptmap.ConceptMapGroupElementTargetDependsOn(jsondict) + if "ConceptMapGroupUnmapped" == resource_type: + from . import conceptmap + return conceptmap.ConceptMapGroupUnmapped(jsondict) + if "Condition" == resource_type: + from . import condition + return condition.Condition(jsondict) + if "ConditionEvidence" == resource_type: + from . import condition + return condition.ConditionEvidence(jsondict) + if "ConditionStage" == resource_type: + from . import condition + return condition.ConditionStage(jsondict) + if "Consent" == resource_type: + from . import consent + return consent.Consent(jsondict) + if "ConsentActor" == resource_type: + from . import consent + return consent.ConsentActor(jsondict) + if "ConsentData" == resource_type: + from . import consent + return consent.ConsentData(jsondict) + if "ConsentExcept" == resource_type: + from . import consent + return consent.ConsentExcept(jsondict) + if "ConsentExceptActor" == resource_type: + from . import consent + return consent.ConsentExceptActor(jsondict) + if "ConsentExceptData" == resource_type: + from . import consent + return consent.ConsentExceptData(jsondict) + if "ConsentPolicy" == resource_type: + from . import consent + return consent.ConsentPolicy(jsondict) + if "ContactDetail" == resource_type: + from . import contactdetail + return contactdetail.ContactDetail(jsondict) + if "ContactPoint" == resource_type: + from . import contactpoint + return contactpoint.ContactPoint(jsondict) + if "Contract" == resource_type: + from . import contract + return contract.Contract(jsondict) + if "ContractAgent" == resource_type: + from . import contract + return contract.ContractAgent(jsondict) + if "ContractFriendly" == resource_type: + from . import contract + return contract.ContractFriendly(jsondict) + if "ContractLegal" == resource_type: + from . import contract + return contract.ContractLegal(jsondict) + if "ContractRule" == resource_type: + from . import contract + return contract.ContractRule(jsondict) + if "ContractSigner" == resource_type: + from . import contract + return contract.ContractSigner(jsondict) + if "ContractTerm" == resource_type: + from . import contract + return contract.ContractTerm(jsondict) + if "ContractTermAgent" == resource_type: + from . import contract + return contract.ContractTermAgent(jsondict) + if "ContractTermValuedItem" == resource_type: + from . import contract + return contract.ContractTermValuedItem(jsondict) + if "ContractValuedItem" == resource_type: + from . import contract + return contract.ContractValuedItem(jsondict) + if "Contributor" == resource_type: + from . import contributor + return contributor.Contributor(jsondict) + if "Count" == resource_type: + from . import count + return count.Count(jsondict) + if "Coverage" == resource_type: + from . import coverage + return coverage.Coverage(jsondict) + if "CoverageGrouping" == 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) + if "DataRequirement" == resource_type: + from . import datarequirement + return datarequirement.DataRequirement(jsondict) + if "DataRequirementCodeFilter" == resource_type: + from . import datarequirement + return datarequirement.DataRequirementCodeFilter(jsondict) + if "DataRequirementDateFilter" == resource_type: + from . import datarequirement + return datarequirement.DataRequirementDateFilter(jsondict) + if "DetectedIssue" == resource_type: + from . import detectedissue + return detectedissue.DetectedIssue(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 "DeviceMetric" == resource_type: + from . import devicemetric + return devicemetric.DeviceMetric(jsondict) + if "DeviceMetricCalibration" == resource_type: + from . import devicemetric + return devicemetric.DeviceMetricCalibration(jsondict) + if "DeviceRequest" == resource_type: + from . import devicerequest + return devicerequest.DeviceRequest(jsondict) + if "DeviceRequestRequester" == resource_type: + from . import devicerequest + return devicerequest.DeviceRequestRequester(jsondict) + if "DeviceUdi" == resource_type: + from . import device + return device.DeviceUdi(jsondict) + if "DeviceUseStatement" == resource_type: + from . import deviceusestatement + return deviceusestatement.DeviceUseStatement(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: + from . import diagnosticreport + return diagnosticreport.DiagnosticReportPerformer(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) + if "DocumentReference" == resource_type: + from . import documentreference + return documentreference.DocumentReference(jsondict) + if "DocumentReferenceContent" == resource_type: + from . import documentreference + return documentreference.DocumentReferenceContent(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) + if "DomainResource" == resource_type: + from . import domainresource + return domainresource.DomainResource(jsondict) + if "Dosage" == resource_type: + from . import dosage + return dosage.Dosage(jsondict) + if "Duration" == resource_type: + from . import duration + return duration.Duration(jsondict) + if "Element" == resource_type: + from . import element + return element.Element(jsondict) + if "ElementDefinition" == resource_type: + from . import elementdefinition + return elementdefinition.ElementDefinition(jsondict) + if "ElementDefinitionBase" == resource_type: + from . import elementdefinition + return elementdefinition.ElementDefinitionBase(jsondict) + if "ElementDefinitionBinding" == resource_type: + from . import elementdefinition + return elementdefinition.ElementDefinitionBinding(jsondict) + if "ElementDefinitionConstraint" == resource_type: + from . import elementdefinition + return elementdefinition.ElementDefinitionConstraint(jsondict) + if "ElementDefinitionExample" == resource_type: + from . import elementdefinition + return elementdefinition.ElementDefinitionExample(jsondict) + if "ElementDefinitionMapping" == resource_type: + from . import elementdefinition + return elementdefinition.ElementDefinitionMapping(jsondict) + if "ElementDefinitionSlicing" == resource_type: + from . import elementdefinition + return elementdefinition.ElementDefinitionSlicing(jsondict) + if "ElementDefinitionSlicingDiscriminator" == resource_type: + from . import elementdefinition + return elementdefinition.ElementDefinitionSlicingDiscriminator(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) + if "EncounterClassHistory" == resource_type: + from . import encounter + return encounter.EncounterClassHistory(jsondict) + if "EncounterDiagnosis" == resource_type: + from . import encounter + return encounter.EncounterDiagnosis(jsondict) + if "EncounterHospitalization" == resource_type: + from . import encounter + return encounter.EncounterHospitalization(jsondict) + if "EncounterLocation" == resource_type: + from . import encounter + return encounter.EncounterLocation(jsondict) + if "EncounterParticipant" == resource_type: + from . import encounter + return encounter.EncounterParticipant(jsondict) + if "EncounterStatusHistory" == resource_type: + from . import encounter + return encounter.EncounterStatusHistory(jsondict) + if "Endpoint" == resource_type: + from . import endpoint + return endpoint.Endpoint(jsondict) + if "EnrollmentRequest" == resource_type: + from . import enrollmentrequest + return enrollmentrequest.EnrollmentRequest(jsondict) + if "EnrollmentResponse" == resource_type: + from . import enrollmentresponse + return enrollmentresponse.EnrollmentResponse(jsondict) + if "EpisodeOfCare" == resource_type: + from . import episodeofcare + return episodeofcare.EpisodeOfCare(jsondict) + if "EpisodeOfCareDiagnosis" == resource_type: + from . import episodeofcare + return episodeofcare.EpisodeOfCareDiagnosis(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 "ExplanationOfBenefit" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefit(jsondict) + if "ExplanationOfBenefitAccident" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitAccident(jsondict) + if "ExplanationOfBenefitAddItem" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitAddItem(jsondict) + if "ExplanationOfBenefitAddItemDetail" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitAddItemDetail(jsondict) + if "ExplanationOfBenefitBenefitBalance" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitBenefitBalance(jsondict) + if "ExplanationOfBenefitBenefitBalanceFinancial" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitBenefitBalanceFinancial(jsondict) + if "ExplanationOfBenefitCareTeam" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitCareTeam(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) + if "ExplanationOfBenefitItem" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitItem(jsondict) + if "ExplanationOfBenefitItemAdjudication" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitItemAdjudication(jsondict) + if "ExplanationOfBenefitItemDetail" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitItemDetail(jsondict) + if "ExplanationOfBenefitItemDetailSubDetail" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitItemDetailSubDetail(jsondict) + if "ExplanationOfBenefitPayee" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitPayee(jsondict) + if "ExplanationOfBenefitPayment" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitPayment(jsondict) + if "ExplanationOfBenefitProcedure" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitProcedure(jsondict) + if "ExplanationOfBenefitProcessNote" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitProcessNote(jsondict) + if "ExplanationOfBenefitRelated" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitRelated(jsondict) + if "Extension" == resource_type: + from . import extension + return extension.Extension(jsondict) + if "FamilyMemberHistory" == resource_type: + from . import familymemberhistory + return familymemberhistory.FamilyMemberHistory(jsondict) + if "FamilyMemberHistoryCondition" == resource_type: + from . import familymemberhistory + return familymemberhistory.FamilyMemberHistoryCondition(jsondict) + if "Flag" == resource_type: + from . import flag + return flag.Flag(jsondict) + if "Goal" == resource_type: + from . import goal + return goal.Goal(jsondict) + if "GoalTarget" == resource_type: + from . import goal + return goal.GoalTarget(jsondict) + if "GraphDefinition" == resource_type: + from . import graphdefinition + return graphdefinition.GraphDefinition(jsondict) + if "GraphDefinitionLink" == resource_type: + from . import graphdefinition + return graphdefinition.GraphDefinitionLink(jsondict) + if "GraphDefinitionLinkTarget" == resource_type: + from . import graphdefinition + return graphdefinition.GraphDefinitionLinkTarget(jsondict) + if "GraphDefinitionLinkTargetCompartment" == resource_type: + from . import graphdefinition + return graphdefinition.GraphDefinitionLinkTargetCompartment(jsondict) + if "Group" == resource_type: + from . import group + return group.Group(jsondict) + if "GroupCharacteristic" == resource_type: + from . import group + return group.GroupCharacteristic(jsondict) + if "GroupMember" == resource_type: + from . import group + return group.GroupMember(jsondict) + if "GuidanceResponse" == resource_type: + from . import guidanceresponse + return guidanceresponse.GuidanceResponse(jsondict) + if "HealthcareService" == resource_type: + from . import healthcareservice + return healthcareservice.HealthcareService(jsondict) + if "HealthcareServiceAvailableTime" == resource_type: + from . import healthcareservice + return healthcareservice.HealthcareServiceAvailableTime(jsondict) + if "HealthcareServiceNotAvailable" == resource_type: + from . import healthcareservice + return healthcareservice.HealthcareServiceNotAvailable(jsondict) + if "HumanName" == resource_type: + from . import humanname + return humanname.HumanName(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) + if "ImagingStudySeries" == resource_type: + from . import imagingstudy + return imagingstudy.ImagingStudySeries(jsondict) + if "ImagingStudySeriesInstance" == resource_type: + from . import imagingstudy + return imagingstudy.ImagingStudySeriesInstance(jsondict) + if "Immunization" == resource_type: + from . import immunization + return immunization.Immunization(jsondict) + if "ImmunizationExplanation" == resource_type: + from . import immunization + return immunization.ImmunizationExplanation(jsondict) + if "ImmunizationPractitioner" == resource_type: + from . import immunization + return immunization.ImmunizationPractitioner(jsondict) + if "ImmunizationReaction" == resource_type: + from . import immunization + return immunization.ImmunizationReaction(jsondict) + if "ImmunizationRecommendation" == resource_type: + from . import immunizationrecommendation + return immunizationrecommendation.ImmunizationRecommendation(jsondict) + if "ImmunizationRecommendationRecommendation" == resource_type: + from . import immunizationrecommendation + return immunizationrecommendation.ImmunizationRecommendationRecommendation(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: + from . import implementationguide + return implementationguide.ImplementationGuideDependency(jsondict) + if "ImplementationGuideGlobal" == resource_type: + from . import implementationguide + return implementationguide.ImplementationGuideGlobal(jsondict) + if "ImplementationGuidePackage" == resource_type: + from . import implementationguide + return implementationguide.ImplementationGuidePackage(jsondict) + if "ImplementationGuidePackageResource" == resource_type: + from . import implementationguide + return implementationguide.ImplementationGuidePackageResource(jsondict) + if "ImplementationGuidePage" == resource_type: + from . import implementationguide + return implementationguide.ImplementationGuidePage(jsondict) + if "Library" == resource_type: + from . import library + return library.Library(jsondict) + if "Linkage" == resource_type: + from . import linkage + return linkage.Linkage(jsondict) + if "LinkageItem" == resource_type: + from . import linkage + return linkage.LinkageItem(jsondict) + if "List" == resource_type: + from . import list + return list.List(jsondict) + if "ListEntry" == resource_type: + from . import list + return list.ListEntry(jsondict) + if "Location" == resource_type: + from . import location + return location.Location(jsondict) + if "LocationPosition" == resource_type: + from . import location + return location.LocationPosition(jsondict) + if "Measure" == resource_type: + from . import measure + return measure.Measure(jsondict) + if "MeasureGroup" == resource_type: + from . import measure + return measure.MeasureGroup(jsondict) + if "MeasureGroupPopulation" == resource_type: + from . import measure + return measure.MeasureGroupPopulation(jsondict) + if "MeasureGroupStratifier" == resource_type: + from . import measure + return measure.MeasureGroupStratifier(jsondict) + if "MeasureReport" == resource_type: + from . import measurereport + return measurereport.MeasureReport(jsondict) + if "MeasureReportGroup" == resource_type: + from . import measurereport + return measurereport.MeasureReportGroup(jsondict) + if "MeasureReportGroupPopulation" == resource_type: + from . import measurereport + return measurereport.MeasureReportGroupPopulation(jsondict) + if "MeasureReportGroupStratifier" == resource_type: + from . import measurereport + return measurereport.MeasureReportGroupStratifier(jsondict) + if "MeasureReportGroupStratifierStratum" == resource_type: + from . import measurereport + return measurereport.MeasureReportGroupStratifierStratum(jsondict) + if "MeasureReportGroupStratifierStratumPopulation" == resource_type: + from . import measurereport + return measurereport.MeasureReportGroupStratifierStratumPopulation(jsondict) + if "MeasureSupplementalData" == resource_type: + from . import measure + return measure.MeasureSupplementalData(jsondict) + if "Media" == resource_type: + from . import media + return media.Media(jsondict) + if "Medication" == resource_type: + from . import medication + return medication.Medication(jsondict) + if "MedicationAdministration" == resource_type: + from . import medicationadministration + return medicationadministration.MedicationAdministration(jsondict) + if "MedicationAdministrationDosage" == resource_type: + from . import medicationadministration + return medicationadministration.MedicationAdministrationDosage(jsondict) + if "MedicationAdministrationPerformer" == resource_type: + from . import medicationadministration + return medicationadministration.MedicationAdministrationPerformer(jsondict) + if "MedicationDispense" == resource_type: + from . import medicationdispense + return medicationdispense.MedicationDispense(jsondict) + if "MedicationDispensePerformer" == resource_type: + from . import medicationdispense + return medicationdispense.MedicationDispensePerformer(jsondict) + if "MedicationDispenseSubstitution" == resource_type: + from . import medicationdispense + return medicationdispense.MedicationDispenseSubstitution(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 "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: + from . import medicationrequest + return medicationrequest.MedicationRequestRequester(jsondict) + if "MedicationRequestSubstitution" == resource_type: + from . import medicationrequest + return medicationrequest.MedicationRequestSubstitution(jsondict) + if "MedicationStatement" == resource_type: + from . import medicationstatement + return medicationstatement.MedicationStatement(jsondict) + if "MessageDefinition" == resource_type: + from . import messagedefinition + return messagedefinition.MessageDefinition(jsondict) + if "MessageDefinitionAllowedResponse" == resource_type: + from . import messagedefinition + return messagedefinition.MessageDefinitionAllowedResponse(jsondict) + if "MessageDefinitionFocus" == resource_type: + from . import messagedefinition + return messagedefinition.MessageDefinitionFocus(jsondict) + if "MessageHeader" == resource_type: + from . import messageheader + return messageheader.MessageHeader(jsondict) + if "MessageHeaderDestination" == resource_type: + from . import messageheader + return messageheader.MessageHeaderDestination(jsondict) + if "MessageHeaderResponse" == resource_type: + from . import messageheader + return messageheader.MessageHeaderResponse(jsondict) + if "MessageHeaderSource" == resource_type: + from . import messageheader + return messageheader.MessageHeaderSource(jsondict) + if "Meta" == resource_type: + from . import meta + return meta.Meta(jsondict) + if "MetadataResource" == resource_type: + from . import metadataresource + return metadataresource.MetadataResource(jsondict) + if "Money" == resource_type: + from . import money + return money.Money(jsondict) + if "NamingSystem" == resource_type: + from . import namingsystem + return namingsystem.NamingSystem(jsondict) + if "NamingSystemUniqueId" == resource_type: + from . import namingsystem + return namingsystem.NamingSystemUniqueId(jsondict) + if "Narrative" == resource_type: + from . import narrative + return narrative.Narrative(jsondict) + if "NutritionOrder" == resource_type: + from . import nutritionorder + return nutritionorder.NutritionOrder(jsondict) + if "NutritionOrderEnteralFormula" == resource_type: + from . import nutritionorder + return nutritionorder.NutritionOrderEnteralFormula(jsondict) + if "NutritionOrderEnteralFormulaAdministration" == resource_type: + from . import nutritionorder + return nutritionorder.NutritionOrderEnteralFormulaAdministration(jsondict) + if "NutritionOrderOralDiet" == resource_type: + from . import nutritionorder + return nutritionorder.NutritionOrderOralDiet(jsondict) + if "NutritionOrderOralDietNutrient" == resource_type: + from . import nutritionorder + return nutritionorder.NutritionOrderOralDietNutrient(jsondict) + if "NutritionOrderOralDietTexture" == resource_type: + from . import nutritionorder + return nutritionorder.NutritionOrderOralDietTexture(jsondict) + if "NutritionOrderSupplement" == resource_type: + from . import nutritionorder + return nutritionorder.NutritionOrderSupplement(jsondict) + if "Observation" == resource_type: + from . import observation + return observation.Observation(jsondict) + if "ObservationComponent" == resource_type: + from . import observation + return observation.ObservationComponent(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) + if "OperationDefinitionOverload" == resource_type: + from . import operationdefinition + return operationdefinition.OperationDefinitionOverload(jsondict) + if "OperationDefinitionParameter" == resource_type: + from . import operationdefinition + return operationdefinition.OperationDefinitionParameter(jsondict) + if "OperationDefinitionParameterBinding" == resource_type: + from . import operationdefinition + return operationdefinition.OperationDefinitionParameterBinding(jsondict) + if "OperationOutcome" == resource_type: + from . import operationoutcome + return operationoutcome.OperationOutcome(jsondict) + if "OperationOutcomeIssue" == resource_type: + from . import operationoutcome + return operationoutcome.OperationOutcomeIssue(jsondict) + if "Organization" == resource_type: + from . import organization + return organization.Organization(jsondict) + if "OrganizationContact" == resource_type: + from . import organization + return organization.OrganizationContact(jsondict) + if "ParameterDefinition" == resource_type: + from . import parameterdefinition + return parameterdefinition.ParameterDefinition(jsondict) + if "Parameters" == resource_type: + from . import parameters + return parameters.Parameters(jsondict) + if "ParametersParameter" == resource_type: + from . import parameters + return parameters.ParametersParameter(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) + if "PatientContact" == resource_type: + from . import patient + return patient.PatientContact(jsondict) + if "PatientLink" == resource_type: + from . import patient + return patient.PatientLink(jsondict) + if "PaymentNotice" == resource_type: + from . import paymentnotice + return paymentnotice.PaymentNotice(jsondict) + if "PaymentReconciliation" == resource_type: + from . import paymentreconciliation + return paymentreconciliation.PaymentReconciliation(jsondict) + if "PaymentReconciliationDetail" == resource_type: + from . import paymentreconciliation + return paymentreconciliation.PaymentReconciliationDetail(jsondict) + if "PaymentReconciliationProcessNote" == resource_type: + from . import paymentreconciliation + return paymentreconciliation.PaymentReconciliationProcessNote(jsondict) + if "Period" == resource_type: + from . import period + return period.Period(jsondict) + if "Person" == resource_type: + from . import person + return person.Person(jsondict) + if "PersonLink" == resource_type: + from . import person + return person.PersonLink(jsondict) + if "PlanDefinition" == resource_type: + from . import plandefinition + return plandefinition.PlanDefinition(jsondict) + if "PlanDefinitionAction" == resource_type: + from . import plandefinition + return plandefinition.PlanDefinitionAction(jsondict) + if "PlanDefinitionActionCondition" == resource_type: + from . import plandefinition + return plandefinition.PlanDefinitionActionCondition(jsondict) + if "PlanDefinitionActionDynamicValue" == resource_type: + from . import plandefinition + return plandefinition.PlanDefinitionActionDynamicValue(jsondict) + if "PlanDefinitionActionParticipant" == resource_type: + from . import plandefinition + return plandefinition.PlanDefinitionActionParticipant(jsondict) + if "PlanDefinitionActionRelatedAction" == resource_type: + from . import plandefinition + return plandefinition.PlanDefinitionActionRelatedAction(jsondict) + if "PlanDefinitionGoal" == resource_type: + from . import plandefinition + return plandefinition.PlanDefinitionGoal(jsondict) + if "PlanDefinitionGoalTarget" == resource_type: + from . import plandefinition + return plandefinition.PlanDefinitionGoalTarget(jsondict) + if "Practitioner" == resource_type: + from . import practitioner + return practitioner.Practitioner(jsondict) + if "PractitionerQualification" == resource_type: + from . import practitioner + return practitioner.PractitionerQualification(jsondict) + if "PractitionerRole" == resource_type: + from . import practitionerrole + return practitionerrole.PractitionerRole(jsondict) + if "PractitionerRoleAvailableTime" == resource_type: + from . import practitionerrole + return practitionerrole.PractitionerRoleAvailableTime(jsondict) + if "PractitionerRoleNotAvailable" == resource_type: + from . import practitionerrole + return practitionerrole.PractitionerRoleNotAvailable(jsondict) + if "Procedure" == resource_type: + from . import procedure + return procedure.Procedure(jsondict) + if "ProcedureFocalDevice" == resource_type: + from . import procedure + return procedure.ProcedureFocalDevice(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 "Provenance" == resource_type: + from . import provenance + return provenance.Provenance(jsondict) + if "ProvenanceAgent" == resource_type: + from . import provenance + return provenance.ProvenanceAgent(jsondict) + if "ProvenanceEntity" == resource_type: + from . import provenance + return provenance.ProvenanceEntity(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 "QuestionnaireItemEnableWhen" == resource_type: + from . import questionnaire + return questionnaire.QuestionnaireItemEnableWhen(jsondict) + if "QuestionnaireItemOption" == resource_type: + from . import questionnaire + return questionnaire.QuestionnaireItemOption(jsondict) + if "QuestionnaireResponse" == resource_type: + from . import questionnaireresponse + return questionnaireresponse.QuestionnaireResponse(jsondict) + if "QuestionnaireResponseItem" == resource_type: + from . import questionnaireresponse + return questionnaireresponse.QuestionnaireResponseItem(jsondict) + if "QuestionnaireResponseItemAnswer" == resource_type: + from . import questionnaireresponse + return questionnaireresponse.QuestionnaireResponseItemAnswer(jsondict) + if "Range" == resource_type: + from . import range + return range.Range(jsondict) + if "Ratio" == resource_type: + from . import ratio + return ratio.Ratio(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 "RequestGroup" == resource_type: + from . import requestgroup + return requestgroup.RequestGroup(jsondict) + if "RequestGroupAction" == resource_type: + from . import requestgroup + return requestgroup.RequestGroupAction(jsondict) + if "RequestGroupActionCondition" == resource_type: + from . import requestgroup + return requestgroup.RequestGroupActionCondition(jsondict) + if "RequestGroupActionRelatedAction" == resource_type: + from . import requestgroup + return requestgroup.RequestGroupActionRelatedAction(jsondict) + if "ResearchStudy" == resource_type: + from . import researchstudy + return researchstudy.ResearchStudy(jsondict) + if "ResearchStudyArm" == resource_type: + from . import researchstudy + return researchstudy.ResearchStudyArm(jsondict) + if "ResearchSubject" == resource_type: + from . import researchsubject + return researchsubject.ResearchSubject(jsondict) + if "Resource" == resource_type: + from . import resource + return resource.Resource(jsondict) + if "RiskAssessment" == resource_type: + from . import riskassessment + return riskassessment.RiskAssessment(jsondict) + if "RiskAssessmentPrediction" == resource_type: + from . import riskassessment + return riskassessment.RiskAssessmentPrediction(jsondict) + if "SampledData" == resource_type: + from . import sampleddata + return sampleddata.SampledData(jsondict) + if "Schedule" == resource_type: + from . import schedule + return schedule.Schedule(jsondict) + if "SearchParameter" == resource_type: + from . import searchparameter + return searchparameter.SearchParameter(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 "Signature" == resource_type: + from . import signature + return signature.Signature(jsondict) + if "Slot" == resource_type: + from . import slot + return slot.Slot(jsondict) + if "Specimen" == resource_type: + from . import specimen + return specimen.Specimen(jsondict) + if "SpecimenCollection" == resource_type: + from . import specimen + return specimen.SpecimenCollection(jsondict) + if "SpecimenContainer" == resource_type: + from . import specimen + return specimen.SpecimenContainer(jsondict) + if "SpecimenProcessing" == resource_type: + from . import specimen + return specimen.SpecimenProcessing(jsondict) + if "StructureDefinition" == resource_type: + from . import structuredefinition + return structuredefinition.StructureDefinition(jsondict) + if "StructureDefinitionDifferential" == resource_type: + from . import structuredefinition + return structuredefinition.StructureDefinitionDifferential(jsondict) + if "StructureDefinitionMapping" == resource_type: + from . import structuredefinition + return structuredefinition.StructureDefinitionMapping(jsondict) + if "StructureDefinitionSnapshot" == resource_type: + from . import structuredefinition + return structuredefinition.StructureDefinitionSnapshot(jsondict) + if "StructureMap" == resource_type: + from . import structuremap + return structuremap.StructureMap(jsondict) + if "StructureMapGroup" == resource_type: + from . import structuremap + return structuremap.StructureMapGroup(jsondict) + if "StructureMapGroupInput" == resource_type: + from . import structuremap + return structuremap.StructureMapGroupInput(jsondict) + if "StructureMapGroupRule" == resource_type: + from . import structuremap + return structuremap.StructureMapGroupRule(jsondict) + if "StructureMapGroupRuleDependent" == resource_type: + from . import structuremap + return structuremap.StructureMapGroupRuleDependent(jsondict) + if "StructureMapGroupRuleSource" == resource_type: + from . import structuremap + return structuremap.StructureMapGroupRuleSource(jsondict) + if "StructureMapGroupRuleTarget" == resource_type: + from . import structuremap + return structuremap.StructureMapGroupRuleTarget(jsondict) + if "StructureMapGroupRuleTargetParameter" == resource_type: + from . import structuremap + return structuremap.StructureMapGroupRuleTargetParameter(jsondict) + if "StructureMapStructure" == resource_type: + from . import structuremap + return structuremap.StructureMapStructure(jsondict) + if "Subscription" == resource_type: + from . import subscription + return subscription.Subscription(jsondict) + if "SubscriptionChannel" == resource_type: + from . import subscription + return subscription.SubscriptionChannel(jsondict) + if "Substance" == resource_type: + from . import substance + return substance.Substance(jsondict) + if "SubstanceIngredient" == resource_type: + from . import substance + return substance.SubstanceIngredient(jsondict) + if "SubstanceInstance" == resource_type: + from . import substance + return substance.SubstanceInstance(jsondict) + if "SupplyDelivery" == resource_type: + from . import supplydelivery + return supplydelivery.SupplyDelivery(jsondict) + if "SupplyDeliverySuppliedItem" == resource_type: + from . import supplydelivery + return supplydelivery.SupplyDeliverySuppliedItem(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: + from . import supplyrequest + return supplyrequest.SupplyRequestRequester(jsondict) + if "Task" == resource_type: + from . import task + return task.Task(jsondict) + if "TaskInput" == resource_type: + from . import task + return task.TaskInput(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 "TestReport" == resource_type: + from . import testreport + return testreport.TestReport(jsondict) + if "TestReportParticipant" == resource_type: + from . import testreport + return testreport.TestReportParticipant(jsondict) + if "TestReportSetup" == resource_type: + from . import testreport + return testreport.TestReportSetup(jsondict) + if "TestReportSetupAction" == resource_type: + from . import testreport + return testreport.TestReportSetupAction(jsondict) + if "TestReportSetupActionAssert" == resource_type: + from . import testreport + return testreport.TestReportSetupActionAssert(jsondict) + if "TestReportSetupActionOperation" == resource_type: + from . import testreport + return testreport.TestReportSetupActionOperation(jsondict) + if "TestReportTeardown" == resource_type: + from . import testreport + return testreport.TestReportTeardown(jsondict) + if "TestReportTeardownAction" == resource_type: + from . import testreport + return testreport.TestReportTeardownAction(jsondict) + if "TestReportTest" == resource_type: + from . import testreport + return testreport.TestReportTest(jsondict) + if "TestReportTestAction" == resource_type: + from . import testreport + return testreport.TestReportTestAction(jsondict) + if "TestScript" == resource_type: + from . import testscript + return testscript.TestScript(jsondict) + if "TestScriptDestination" == resource_type: + from . import testscript + return testscript.TestScriptDestination(jsondict) + if "TestScriptFixture" == resource_type: + from . import testscript + return testscript.TestScriptFixture(jsondict) + if "TestScriptMetadata" == resource_type: + from . import testscript + return testscript.TestScriptMetadata(jsondict) + if "TestScriptMetadataCapability" == resource_type: + from . import testscript + return testscript.TestScriptMetadataCapability(jsondict) + if "TestScriptMetadataLink" == resource_type: + from . import testscript + return testscript.TestScriptMetadataLink(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) + if "TestScriptSetupAction" == resource_type: + from . import testscript + return testscript.TestScriptSetupAction(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) + if "TestScriptSetupActionOperationRequestHeader" == resource_type: + from . import testscript + return testscript.TestScriptSetupActionOperationRequestHeader(jsondict) + if "TestScriptTeardown" == resource_type: + from . import testscript + return testscript.TestScriptTeardown(jsondict) + if "TestScriptTeardownAction" == resource_type: + from . import testscript + return testscript.TestScriptTeardownAction(jsondict) + if "TestScriptTest" == resource_type: + from . import testscript + return testscript.TestScriptTest(jsondict) + if "TestScriptTestAction" == resource_type: + from . import testscript + return testscript.TestScriptTestAction(jsondict) + if "TestScriptVariable" == resource_type: + from . import testscript + return testscript.TestScriptVariable(jsondict) + if "Timing" == resource_type: + from . import timing + return timing.Timing(jsondict) + if "TimingRepeat" == resource_type: + from . import timing + return timing.TimingRepeat(jsondict) + if "TriggerDefinition" == resource_type: + from . import triggerdefinition + return triggerdefinition.TriggerDefinition(jsondict) + if "UsageContext" == resource_type: + from . import usagecontext + return usagecontext.UsageContext(jsondict) + if "ValueSet" == resource_type: + from . import valueset + return valueset.ValueSet(jsondict) + if "ValueSetCompose" == resource_type: + from . import valueset + return valueset.ValueSetCompose(jsondict) + if "ValueSetComposeInclude" == resource_type: + from . import valueset + return valueset.ValueSetComposeInclude(jsondict) + if "ValueSetComposeIncludeConcept" == resource_type: + from . import valueset + return valueset.ValueSetComposeIncludeConcept(jsondict) + if "ValueSetComposeIncludeConceptDesignation" == resource_type: + from . import valueset + return valueset.ValueSetComposeIncludeConceptDesignation(jsondict) + if "ValueSetComposeIncludeFilter" == resource_type: + from . import valueset + return valueset.ValueSetComposeIncludeFilter(jsondict) + if "ValueSetExpansion" == resource_type: + from . import valueset + return valueset.ValueSetExpansion(jsondict) + if "ValueSetExpansionContains" == resource_type: + from . import valueset + return valueset.ValueSetExpansionContains(jsondict) + if "ValueSetExpansionParameter" == resource_type: + from . import valueset + return valueset.ValueSetExpansionParameter(jsondict) + if "VisionPrescription" == resource_type: + from . import visionprescription + return visionprescription.VisionPrescription(jsondict) + if "VisionPrescriptionDispense" == resource_type: + from . import visionprescription + return visionprescription.VisionPrescriptionDispense(jsondict) + from . import element + return element.Element(jsondict) diff --git a/fhirclient/models/STU3/fhirreference.py b/fhirclient/models/STU3/fhirreference.py new file mode 100644 index 000000000..9740f6a2a --- /dev/null +++ b/fhirclient/models/STU3/fhirreference.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Subclassing FHIR's reference to add resolving capabilities + +import logging +from . import reference + +logger = logging.getLogger(__name__) + + +class FHIRReference(reference.Reference): + """ Subclassing FHIR's `Reference` resource to add resolving capabilities. + """ + + def resolved(self, klass): + """ Resolves the reference and caches the result, returning instance(s) + of the referenced classes. + + :param klass: The expected class of the resource + :returns: An instance (or list thereof) of the resolved reference if + dereferencing was successful, `None` otherwise + """ + owning_resource = self.owningResource() + if owning_resource is None: + raise Exception("Cannot resolve reference without having an owner (which must be a `DomainResource`)") + if klass is None: + raise Exception("Cannot resolve reference without knowing the class") + + refid = self.processedReferenceIdentifier() + if not refid: + logger.warning("No `reference` set, cannot resolve") + return None + + # already resolved and cached? + resolved = owning_resource.resolvedReference(refid) + if resolved is not None: + if isinstance(resolved, klass): + return resolved + logger.warning("Referenced resource {} is not a {} but a {}".format(refid, klass, resolved.__class__)) + return None + + # not yet resolved, see if it's a contained resource + if owning_resource.contained is not None: + for contained in owning_resource.contained: + if contained.id == refid: + owning_resource.didResolveReference(refid, contained) + if isinstance(contained, klass): + return contained + logger.warning("Contained resource {} is not a {} but a {}".format(refid, klass, contained.__class__)) + return None + + # are we in a bundle? + ref_is_relative = '://' not in self.reference and 'urn:' != self.reference[:4] + bundle = self.owningBundle() + while bundle is not None: + if bundle.entry is not None: + fullUrl = self.reference + if ref_is_relative: + base = bundle.origin_server.base_uri if bundle.origin_server else '' + fullUrl = base + self.reference + + for entry in bundle.entry: + if entry.fullUrl == fullUrl: + found = entry.resource + if isinstance(found, klass): + return found + logger.warning("Bundled resource {} is not a {} but a {}".format(refid, klass, found.__class__)) + return None + bundle = bundle.owningBundle() + + # relative references, use the same server + server = None + if ref_is_relative: + server = owning_resource.origin_server if owning_resource else None + + # TODO: instantiate server for absolute resource + if server is None: + logger.warning("Not implemented: resolving absolute reference to resource {}" + .format(self.reference)) + return None + + # fetch remote resource; unable to verify klass since we use klass.read_from() + relative = klass.read_from(self.reference, server) + owning_resource.didResolveReference(refid, relative) + return relative + + def processedReferenceIdentifier(self): + """ Normalizes the reference-id. + """ + if self.reference and '#' == self.reference[0]: + return self.reference[1:] + return self.reference + diff --git a/fhirclient/models/STU3/fhirsearch.py b/fhirclient/models/STU3/fhirsearch.py new file mode 100644 index 000000000..4ce28a4d7 --- /dev/null +++ b/fhirclient/models/STU3/fhirsearch.py @@ -0,0 +1,270 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Create FHIR search params from NoSQL-like query structures. +# 2014, SMART Health IT. + +try: + from urllib import quote_plus +except Exception as e: + from urllib.parse import quote_plus + + +class FHIRSearch(object): + """ Create a FHIR search from NoSQL-like query structures. + """ + + def __init__(self, resource_type, struct=None): + self.resource_type = resource_type + """ The resource type class. """ + + self.params = [] + """ FHIRSearchParam instances. """ + + self.wants_expand = False + """ Used internally; whether or not `params` must be expanded first. """ + + if struct is not None: + if dict != type(struct): + raise Exception("Must pass a Python dictionary, but got a {}".format(type(struct))) + self.wants_expand = True + for key, val in struct.items(): + self.params.append(FHIRSearchParam(key, val)) + + + # MARK: Execution + + def construct(self): + """ Constructs the URL with query string from the receiver's params. + """ + if self.resource_type is None: + raise Exception("Need resource_type set to construct a search query") + + parts = [] + if self.params is not None: + for param in self.params: + if self.wants_expand: + for expanded in param.handle(): + parts.append(expanded.as_parameter()) + else: + parts.append(param.as_parameter()) + + return '{}?{}'.format(self.resource_type.resource_type, '&'.join(parts)) + + def perform(self, server): + """ Construct the search URL and execute it against the given server. + + :param server: The server against which to perform the search + :returns: A Bundle resource + """ + if server is None: + raise Exception("Need a server to perform search") + + from . import bundle + res = server.request_json(self.construct()) + bundle = bundle.Bundle(res) + bundle.origin_server = server + return bundle + + def perform_resources(self, server): + """ Performs the search by calling `perform`, then extracts all Bundle + entries and returns a list of Resource instances. + + :param server: The server against which to perform the search + :returns: A list of Resource instances + """ + bundle = self.perform(server) + resources = [] + if bundle is not None and bundle.entry is not None: + for entry in bundle.entry: + resources.append(entry.resource) + + return resources + + +class FHIRSearchParam(object): + """ Holds one search parameter. + + The instance's `value` can either be a string value or a search construct + dictionary. In the latter case the class's `handle` method must be called + to arrive at search parameter instances that can be converted into a URL + query. + """ + + def __init__(self, name, value): + self.name = name + self.value = value + + def copy(self): + clone = object.__new__(self.__class__) + clone.__dict__ = self.__dict__.copy() + return clone + + def handle(self): + """ Parses the receiver's value and returns a list of FHIRSearchParam + instances. Needs only be called if the param needs to be handled, i.e. + its value is a query structure. + + :returns: A list with one or more FHIRSearchParam instances, not + altering the receiver + """ + handler = FHIRSearchParamHandler.handler_for(self.name)(None, self.value) + return handler.handle(self.copy()) + + def as_parameter(self): + """ Return a string that represents the reciever as "key=value". + """ + return '{}={}'.format(self.name, quote_plus(self.value, safe=',<=>')) + + +class FHIRSearchParamHandler(object): + handles = None + handlers = [] + + @classmethod + def announce_handler(cls, handler): + cls.handlers.append(handler) + + @classmethod + def handler_for(cls, key): + for handler in cls.handlers: + if handler.can_handle(key): + return handler + return cls + + @classmethod + def can_handle(cls, key): + if cls.handles is not None: + return key in cls.handles + return True # base class handles everything else, so be sure to test it last! + + + def __init__(self, key, value): + self.key = key + self.value = value + self.modifier = [] + self.multiplier = [] + + def handle(self, param): + """ Applies all handlers to the given search parameter. + :returns: A list of one or more new `FHIRSearchParam` instances + """ + self.prepare() + return self.expand(param) + + def prepare(self, parent=None): + """ Creates sub-handlers as needed, then prepares the receiver. + """ + if dict == type(self.value): + for key, val in self.value.items(): + handler = FHIRSearchParamHandler.handler_for(key)(key, val) + handler.prepare(self) + + if parent is not None: + parent.multiplier.append(self) + + def expand(self, param): + """ Executes the receiver's modifier and multiplier on itself, applying + changes to the given search param instance. + + :returns: A list of one or more FHIRSearchParam instances + """ + for handler in self.modifier: + handler.expand(param) + + self.apply(param) + + # if we have multiplier, expand sequentially + if len(self.multiplier) > 0: + expanded = [] + for handler in self.multiplier: + clone = param.copy() + expanded.extend(handler.expand(clone)) + + return expanded + + # no multiplier, just return the passed-in paramater + return [param] + + def apply(self, param): + if self.key is not None: + param.name = '{}.{}'.format(param.name, self.key) + if 0 == len(self.multiplier): + param.value = self.value + + +class FHIRSearchParamModifierHandler(FHIRSearchParamHandler): + modifiers = { + '$asc': ':asc', + '$desc': ':desc', + '$exact': ':exact', + '$missing': ':missing', + '$null': ':missing', + '$text': ':text', + } + handles = modifiers.keys() + + def apply(self, param): + if self.key not in self.__class__.modifiers: + raise Exception('Unknown modifier "{}" for "{}"'.format(self.key, param.name)) + param.name += self.__class__.modifiers[self.key] + param.value = self.value + + +class FHIRSearchParamOperatorHandler(FHIRSearchParamHandler): + operators = { + '$gt': '>', + '$lt': '<', + '$lte': '<=', + '$gte': '>=', + } + handles = operators.keys() + + def apply(self, param): + if self.key not in self.__class__.operators: + raise Exception('Unknown operator "{}" for "{}"'.format(self.key, parent.name)) + param.value = self.__class__.operators[self.key] + self.value + + +class FHIRSearchParamMultiHandler(FHIRSearchParamHandler): + handles = ['$and', '$or'] + + def prepare(self, parent): + if list != type(self.value): + raise Exception('Expecting a list argument for "{}" but got {}'.format(parent.key, self.value)) + + handlers = [] + for val in self.value: + if dict == type(val): + for kkey, vval in val.items(): + handlers.append(FHIRSearchParamHandler.handler_for(kkey)(kkey, vval)) + else: + handlers.append(FHIRSearchParamHandler.handler_for(parent.key)(None, val)) + + if '$and' == self.key: + for handler in handlers: + handler.prepare(parent) + elif '$or' == self.key: + ors = [h.value for h in handlers] + handler = FHIRSearchParamHandler.handler_for(parent.key)(None, ','.join(ors)) + handler.prepare(parent) + else: + raise Exception('I cannot handle "{}"'.format(self.key)) + + +class FHIRSearchParamTypeHandler(FHIRSearchParamHandler): + handles = ['$type'] + + def prepare(self, parent): + parent.modifier.append(self) + + def apply(self, param): + param.name = '{}:{}'.format(param.name, self.value) + + +# announce all handlers +FHIRSearchParamHandler.announce_handler(FHIRSearchParamModifierHandler) +FHIRSearchParamHandler.announce_handler(FHIRSearchParamOperatorHandler) +FHIRSearchParamHandler.announce_handler(FHIRSearchParamMultiHandler) +FHIRSearchParamHandler.announce_handler(FHIRSearchParamTypeHandler) + diff --git a/fhirclient/models/STU3/flag.py b/fhirclient/models/STU3/flag.py new file mode 100644 index 000000000..83f5b3e8d --- /dev/null +++ b/fhirclient/models/STU3/flag.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Flag) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Flag(domainresource.DomainResource): + """ Key information to flag to healthcare providers. + + Prospective warnings of potential issues when providing care to the + patient. + """ + + resource_type = "Flag" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Flag creator. + Type `FHIRReference` referencing `Device, Organization, Patient, Practitioner` (represented as `dict` in JSON). """ + + self.category = None + """ Clinical, administrative, etc.. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.code = None + """ Coded or textual message to display to user. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.encounter = None + """ Alert relevant during encounter. + Type `FHIRReference` referencing `Encounter` (represented as `dict` in JSON). """ + + self.identifier = None + """ Business identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.period = None + """ Time period when flag is active. + Type `Period` (represented as `dict` in JSON). """ + + self.status = None + """ active | inactive | entered-in-error. + Type `str`. """ + + self.subject = None + """ Who/What is flag about?. + Type `FHIRReference` referencing `Patient, Location, Group, Organization, Practitioner, PlanDefinition, Medication, Procedure` (represented as `dict` in JSON). """ + + super(Flag, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Flag, self).elementProperties() + js.extend([ + ("author", "author", fhirreference.FHIRReference, False, None, False), + ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("period", "period", period.Period, False, None, False), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, 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 period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/STU3/flag_tests.py b/fhirclient/models/STU3/flag_tests.py new file mode 100644 index 000000000..e5ab18f8b --- /dev/null +++ b/fhirclient/models/STU3/flag_tests.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import flag +from .fhirdate import FHIRDate + + +class FlagTests(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("Flag", js["resourceType"]) + return flag.Flag(js) + + def testFlag1(self): + inst = self.instantiate_from("flag-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Flag instance") + self.implFlag1(inst) + + js = inst.as_json() + self.assertEqual("Flag", js["resourceType"]) + inst2 = flag.Flag(js) + self.implFlag1(inst2) + + def implFlag1(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.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.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) + self.assertEqual(inst.period.start.as_json(), "2015-01-17") + 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.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") + diff --git a/fhirclient/models/STU3/goal.py b/fhirclient/models/STU3/goal.py new file mode 100644 index 000000000..fedba4117 --- /dev/null +++ b/fhirclient/models/STU3/goal.py @@ -0,0 +1,209 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Goal) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Goal(domainresource.DomainResource): + """ Describes the intended objective(s) for a patient, group or organization. + + Describes the intended objective(s) for a patient, group or organization + care, for example, weight loss, restoring an activity of daily living, + obtaining herd immunity via immunization, meeting a process improvement + objective, etc. + """ + + resource_type = "Goal" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.addresses = None + """ Issues addressed by this goal. + List of `FHIRReference` items referencing `Condition, Observation, MedicationStatement, NutritionOrder, ProcedureRequest, RiskAssessment` (represented as `dict` in JSON). """ + + self.category = None + """ E.g. Treatment, dietary, behavioral, etc.. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.description = None + """ Code or text describing goal. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.expressedBy = None + """ Who's responsible for creating Goal?. + Type `FHIRReference` referencing `Patient, Practitioner, RelatedPerson` (represented as `dict` in JSON). """ + + self.identifier = None + """ External Ids for this goal. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.note = None + """ Comments about the goal. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.outcomeCode = None + """ What result was achieved regarding the goal?. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.outcomeReference = None + """ Observation that resulted from goal. + List of `FHIRReference` items referencing `Observation` (represented as `dict` in JSON). """ + + self.priority = None + """ high-priority | medium-priority | low-priority. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.startCodeableConcept = None + """ When goal pursuit begins. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.startDate = None + """ 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). """ + + self.statusReason = None + """ Reason for current status. + Type `str`. """ + + self.subject = None + """ Who this goal is intended for. + Type `FHIRReference` referencing `Patient, Group, Organization` (represented as `dict` in JSON). """ + + self.target = None + """ Target outcome for the goal. + Type `GoalTarget` (represented as `dict` in JSON). """ + + super(Goal, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Goal, self).elementProperties() + js.extend([ + ("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), + ("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), + ]) + return js + + +from . import backboneelement + +class GoalTarget(backboneelement.BackboneElement): + """ Target outcome for the goal. + + Indicates what should be done by when. + """ + + resource_type = "GoalTarget" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.detailCodeableConcept = None + """ The target value to be achieved. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.detailQuantity = None + """ The target value to be achieved. + Type `Quantity` (represented as `dict` in JSON). """ + + self.detailRange = None + """ The target value to be achieved. + Type `Range` (represented as `dict` in JSON). """ + + self.dueDate = None + """ Reach goal on or before. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.dueDuration = None + """ Reach goal on or before. + Type `Duration` (represented as `dict` in JSON). """ + + self.measure = None + """ The parameter whose value is being tracked. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(GoalTarget, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(GoalTarget, self).elementProperties() + js.extend([ + ("detailCodeableConcept", "detailCodeableConcept", codeableconcept.CodeableConcept, False, "detail", False), + ("detailQuantity", "detailQuantity", quantity.Quantity, False, "detail", False), + ("detailRange", "detailRange", range.Range, False, "detail", False), + ("dueDate", "dueDate", fhirdate.FHIRDate, False, "due", False), + ("dueDuration", "dueDuration", duration.Duration, False, "due", False), + ("measure", "measure", 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 duration +except ImportError: + duration = sys.modules[__package__ + '.duration'] +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'] diff --git a/fhirclient/models/STU3/goal_tests.py b/fhirclient/models/STU3/goal_tests.py new file mode 100644 index 000000000..ebcca1f9b --- /dev/null +++ b/fhirclient/models/STU3/goal_tests.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import goal +from .fhirdate import FHIRDate + + +class GoalTests(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("Goal", js["resourceType"]) + return goal.Goal(js) + + def testGoal1(self): + inst = self.instantiate_from("goal-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Goal instance") + self.implGoal1(inst) + + js = inst.as_json() + self.assertEqual("Goal", js["resourceType"]) + inst2 = goal.Goal(js) + self.implGoal1(inst2) + + def implGoal1(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.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.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") + + def testGoal2(self): + inst = self.instantiate_from("goal-example-stop-smoking.json") + self.assertIsNotNone(inst, "Must have instantiated a Goal instance") + self.implGoal2(inst) + + js = inst.as_json() + self.assertEqual("Goal", js["resourceType"]) + inst2 = goal.Goal(js) + self.implGoal2(inst2) + + def implGoal2(self, inst): + self.assertEqual(inst.description.text, "Stop smoking") + self.assertEqual(inst.id, "stop-smoking") + 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.startDate.date, FHIRDate("2015-04-05").date) + self.assertEqual(inst.startDate.as_json(), "2015-04-05") + self.assertEqual(inst.status, "achieved") + self.assertEqual(inst.text.status, "additional") + diff --git a/fhirclient/models/STU3/graphdefinition.py b/fhirclient/models/STU3/graphdefinition.py new file mode 100644 index 000000000..dd55cf156 --- /dev/null +++ b/fhirclient/models/STU3/graphdefinition.py @@ -0,0 +1,269 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/GraphDefinition) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class GraphDefinition(domainresource.DomainResource): + """ Definition of an 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 + Graph Definition resource defines a set and makes rules about the set. + """ + + resource_type = "GraphDefinition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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.date = None + """ Date this was last changed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Natural language description of the graph definition. + Type `str`. """ + + self.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.jurisdiction = None + """ Intended jurisdiction for graph definition (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.link = None + """ Links this graph makes rules about. + List of `GraphDefinitionLink` items (represented as `dict` in JSON). """ + + self.name = None + """ Name for this graph definition (computer friendly). + Type `str`. """ + + self.profile = None + """ Profile on base resource. + Type `str`. """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this graph definition is defined. + Type `str`. """ + + self.start = None + """ Type of resource at which the graph starts. + Type `str`. """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.url = None + """ Logical URI to reference this graph definition (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 graph definition. + Type `str`. """ + + super(GraphDefinition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(GraphDefinition, self).elementProperties() + js.extend([ + ("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), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("link", "link", GraphDefinitionLink, True, None, False), + ("name", "name", str, False, None, True), + ("profile", "profile", str, False, None, False), + ("publisher", "publisher", str, False, None, False), + ("purpose", "purpose", str, False, None, False), + ("start", "start", str, False, None, True), + ("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 GraphDefinitionLink(backboneelement.BackboneElement): + """ Links this graph makes rules about. + """ + + resource_type = "GraphDefinitionLink" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Why this link is specified. + Type `str`. """ + + self.max = None + """ Maximum occurrences for this link. + Type `str`. """ + + self.min = None + """ Minimum occurrences for this link. + Type `int`. """ + + self.path = None + """ Path in the resource that contains the link. + Type `str`. """ + + self.sliceName = None + """ Which slice (if profiled). + Type `str`. """ + + self.target = None + """ Potential target for the link. + List of `GraphDefinitionLinkTarget` items (represented as `dict` in JSON). """ + + super(GraphDefinitionLink, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(GraphDefinitionLink, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, False), + ("max", "max", str, False, None, False), + ("min", "min", int, False, None, False), + ("path", "path", str, False, None, True), + ("sliceName", "sliceName", str, False, None, False), + ("target", "target", GraphDefinitionLinkTarget, True, None, True), + ]) + return js + + +class GraphDefinitionLinkTarget(backboneelement.BackboneElement): + """ Potential target for the link. + """ + + resource_type = "GraphDefinitionLinkTarget" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.compartment = None + """ Compartment Consistency Rules. + List of `GraphDefinitionLinkTargetCompartment` items (represented as `dict` in JSON). """ + + self.link = None + """ Additional links from target resource. + List of `GraphDefinitionLink` items (represented as `dict` in JSON). """ + + self.profile = None + """ Profile for the target resource. + Type `str`. """ + + self.type = None + """ Type of resource this link refers to. + Type `str`. """ + + super(GraphDefinitionLinkTarget, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(GraphDefinitionLinkTarget, self).elementProperties() + js.extend([ + ("compartment", "compartment", GraphDefinitionLinkTargetCompartment, True, None, False), + ("link", "link", GraphDefinitionLink, True, None, False), + ("profile", "profile", str, False, None, False), + ("type", "type", str, False, None, True), + ]) + return js + + +class GraphDefinitionLinkTargetCompartment(backboneelement.BackboneElement): + """ Compartment Consistency Rules. + """ + + resource_type = "GraphDefinitionLinkTargetCompartment" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Identifies the compartment. + Type `str`. """ + + self.description = None + """ Documentation for FHIRPath expression. + Type `str`. """ + + self.expression = None + """ Custom rule, as a FHIRPath expression. + Type `str`. """ + + self.rule = None + """ identical | matching | different | custom. + Type `str`. """ + + super(GraphDefinitionLinkTargetCompartment, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(GraphDefinitionLinkTargetCompartment, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("description", "description", str, False, None, False), + ("expression", "expression", str, False, None, False), + ("rule", "rule", 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 usagecontext +except ImportError: + usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/STU3/graphdefinition_tests.py b/fhirclient/models/STU3/graphdefinition_tests.py new file mode 100644 index 000000000..9efe173f0 --- /dev/null +++ b/fhirclient/models/STU3/graphdefinition_tests.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import graphdefinition +from .fhirdate import FHIRDate + + +class GraphDefinitionTests(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("GraphDefinition", js["resourceType"]) + return graphdefinition.GraphDefinition(js) + + def testGraphDefinition1(self): + inst = self.instantiate_from("graphdefinition-example.json") + self.assertIsNotNone(inst, "Must have instantiated a GraphDefinition instance") + self.implGraphDefinition1(inst) + + js = inst.as_json() + self.assertEqual("GraphDefinition", js["resourceType"]) + inst2 = graphdefinition.GraphDefinition(js) + self.implGraphDefinition1(inst2) + + def implGraphDefinition1(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.date.date, FHIRDate("2015-08-04").date) + self.assertEqual(inst.date.as_json(), "2015-08-04") + self.assertEqual(inst.description, "Specify to include list references when generating a document using the $document operation") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.link[0].description, "Link to List") + 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].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].type, "Resource") + self.assertEqual(inst.link[0].target[0].type, "List") + self.assertEqual(inst.name, "Document Generation Template") + self.assertEqual(inst.publisher, "FHIR Project") + self.assertEqual(inst.start, "Composition") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.url, "http://h7.org/fhir/GraphDefinition/example") + diff --git a/fhirclient/models/STU3/group.py b/fhirclient/models/STU3/group.py new file mode 100644 index 000000000..53caada97 --- /dev/null +++ b/fhirclient/models/STU3/group.py @@ -0,0 +1,209 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Group) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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 + not formally or legally recognized; i.e. a collection of entities that + isn't an Organization. + """ + + resource_type = "Group" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 group's record is in active use. + Type `bool`. """ + + self.actual = None + """ Descriptive or actual. + Type `bool`. """ + + self.characteristic = None + """ Trait of group members. + List of `GroupCharacteristic` items (represented as `dict` in JSON). """ + + self.code = None + """ Kind of Group members. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.identifier = None + """ Unique id. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.member = None + """ Who or what is in group. + List of `GroupMember` items (represented as `dict` in JSON). """ + + self.name = None + """ Label for Group. + Type `str`. """ + + self.quantity = None + """ Number of members. + Type `int`. """ + + self.type = None + """ person | animal | practitioner | device | medication | substance. + Type `str`. """ + + super(Group, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Group, self).elementProperties() + js.extend([ + ("active", "active", bool, False, None, False), + ("actual", "actual", bool, False, None, True), + ("characteristic", "characteristic", GroupCharacteristic, True, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("member", "member", GroupMember, True, None, False), + ("name", "name", str, False, None, False), + ("quantity", "quantity", int, False, None, False), + ("type", "type", str, False, None, True), + ]) + return js + + +from . import backboneelement + +class GroupCharacteristic(backboneelement.BackboneElement): + """ Trait of group members. + + Identifies the traits shared by members of the group. + """ + + resource_type = "GroupCharacteristic" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Kind of characteristic. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.exclude = None + """ Group includes or excludes. + Type `bool`. """ + + self.period = None + """ Period over which characteristic is tested. + Type `Period` (represented as `dict` in JSON). """ + + self.valueBoolean = None + """ Value held by characteristic. + Type `bool`. """ + + self.valueCodeableConcept = None + """ Value held by characteristic. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueQuantity = None + """ Value held by characteristic. + Type `Quantity` (represented as `dict` in JSON). """ + + self.valueRange = None + """ Value held by characteristic. + Type `Range` (represented as `dict` in JSON). """ + + super(GroupCharacteristic, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(GroupCharacteristic, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("exclude", "exclude", bool, False, None, True), + ("period", "period", period.Period, False, None, False), + ("valueBoolean", "valueBoolean", bool, False, "value", True), + ("valueCodeableConcept", "valueCodeableConcept", codeableconcept.CodeableConcept, False, "value", True), + ("valueQuantity", "valueQuantity", quantity.Quantity, False, "value", True), + ("valueRange", "valueRange", range.Range, False, "value", True), + ]) + return js + + +class GroupMember(backboneelement.BackboneElement): + """ Who or what is in group. + + Identifies the resource instances that are members of the group. + """ + + resource_type = "GroupMember" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.entity = None + """ Reference to the group member. + Type `FHIRReference` referencing `Patient, Practitioner, Device, Medication, Substance` (represented as `dict` in JSON). """ + + self.inactive = None + """ If member is no longer in group. + Type `bool`. """ + + self.period = None + """ Period member belonged to the group. + Type `Period` (represented as `dict` in JSON). """ + + super(GroupMember, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(GroupMember, self).elementProperties() + js.extend([ + ("entity", "entity", fhirreference.FHIRReference, False, None, True), + ("inactive", "inactive", bool, False, None, False), + ("period", "period", period.Period, 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 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'] diff --git a/fhirclient/models/STU3/group_tests.py b/fhirclient/models/STU3/group_tests.py new file mode 100644 index 000000000..7152bcf32 --- /dev/null +++ b/fhirclient/models/STU3/group_tests.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import group +from .fhirdate import FHIRDate + + +class GroupTests(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("Group", js["resourceType"]) + return group.Group(js) + + def testGroup1(self): + inst = self.instantiate_from("group-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Group instance") + self.implGroup1(inst) + + js = inst.as_json() + self.assertEqual("Group", js["resourceType"]) + inst2 = group.Group(js) + 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.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) + self.assertEqual(inst.member[0].period.start.as_json(), "2014-10-08") + self.assertTrue(inst.member[1].inactive) + self.assertEqual(inst.member[1].period.start.date, FHIRDate("2015-04-02").date) + self.assertEqual(inst.member[1].period.start.as_json(), "2015-04-02") + self.assertEqual(inst.member[2].period.start.date, FHIRDate("2015-08-06").date) + 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.text.status, "additional") + self.assertEqual(inst.type, "person") + diff --git a/fhirclient/models/STU3/guidanceresponse.py b/fhirclient/models/STU3/guidanceresponse.py new file mode 100644 index 000000000..117bafe14 --- /dev/null +++ b/fhirclient/models/STU3/guidanceresponse.py @@ -0,0 +1,137 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/GuidanceResponse) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class GuidanceResponse(domainresource.DomainResource): + """ The formal response to a guidance request. + + A guidance response is the formal response to a guidance request, including + any output parameters returned by the evaluation, as well as the + description of any proposed actions to be taken. + """ + + resource_type = "GuidanceResponse" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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.evaluationMessage = None + """ Messages resulting from the evaluation of the artifact or artifacts. + List of `FHIRReference` items referencing `OperationOutcome` (represented as `dict` in JSON). """ + + self.identifier = None + """ Business identifier. + Type `Identifier` (represented as `dict` in JSON). """ + + self.module = None + """ A reference to a knowledge module. + Type `FHIRReference` referencing `ServiceDefinition` (represented as `dict` in JSON). """ + + self.note = None + """ Additional notes about the response. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.occurrenceDateTime = None + """ When the guidance response was processed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.outputParameters = None + """ The output parameters of the evaluation, if any. + Type `FHIRReference` referencing `Parameters` (represented as `dict` in JSON). """ + + self.performer = None + """ Device returning the guidance. + Type `FHIRReference` referencing `Device` (represented as `dict` in JSON). """ + + self.reasonCodeableConcept = None + """ Reason for the response. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.reasonReference = None + """ Reason for the response. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.requestId = None + """ The id of the request associated with this response, if any. + Type `str`. """ + + self.result = None + """ Proposed actions, if any. + Type `FHIRReference` referencing `CarePlan, RequestGroup` (represented as `dict` in JSON). """ + + self.status = None + """ success | data-requested | data-required | in-progress | failure | + entered-in-error. + Type `str`. """ + + self.subject = None + """ Patient the request was performed for. + Type `FHIRReference` referencing `Patient, Group` (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), + ("evaluationMessage", "evaluationMessage", fhirreference.FHIRReference, True, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("module", "module", fhirreference.FHIRReference, False, None, 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), + ("result", "result", fhirreference.FHIRReference, False, None, False), + ("status", "status", str, False, None, True), + ("subject", "subject", 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 datarequirement +except ImportError: + datarequirement = sys.modules[__package__ + '.datarequirement'] +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/STU3/guidanceresponse_tests.py b/fhirclient/models/STU3/guidanceresponse_tests.py new file mode 100644 index 000000000..8a5b6cc77 --- /dev/null +++ b/fhirclient/models/STU3/guidanceresponse_tests.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import guidanceresponse +from .fhirdate import FHIRDate + + +class GuidanceResponseTests(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("GuidanceResponse", js["resourceType"]) + return guidanceresponse.GuidanceResponse(js) + + def testGuidanceResponse1(self): + inst = self.instantiate_from("guidanceresponse-example.json") + self.assertIsNotNone(inst, "Must have instantiated a GuidanceResponse instance") + self.implGuidanceResponse1(inst) + + js = inst.as_json() + self.assertEqual("GuidanceResponse", js["resourceType"]) + inst2 = guidanceresponse.GuidanceResponse(js) + self.implGuidanceResponse1(inst2) + + 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.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.status, "success") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/STU3/healthcareservice.py b/fhirclient/models/STU3/healthcareservice.py new file mode 100644 index 000000000..66ff11ae0 --- /dev/null +++ b/fhirclient/models/STU3/healthcareservice.py @@ -0,0 +1,267 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/HealthcareService) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class HealthcareService(domainresource.DomainResource): + """ The details of a healthcare service available at a location. + """ + + resource_type = "HealthcareService" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 healthcareservice is in active use. + Type `bool`. """ + + self.appointmentRequired = None + """ If an appointment is required for access to this service. + Type `bool`. """ + + self.availabilityExceptions = None + """ Description of availability exceptions. + Type `str`. """ + + self.availableTime = None + """ Times the Service Site is available. + List of `HealthcareServiceAvailableTime` items (represented as `dict` in JSON). """ + + self.category = None + """ Broad category of service being performed or delivered. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.characteristic = None + """ Collection of characteristics (attributes). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.comment = None + """ Additional description and/or any specific issues not covered + elsewhere. + Type `str`. """ + + self.coverageArea = None + """ Location(s) service is inteded for/available to. + List of `FHIRReference` items referencing `Location` (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`. """ + + self.endpoint = None + """ Technical endpoints providing access to services operated for the + location. + List of `FHIRReference` items referencing `Endpoint` (represented as `dict` in JSON). """ + + self.extraDetails = None + """ Extra details about the service that can't be placed in the other + fields. + Type `str`. """ + + self.identifier = None + """ External identifiers for this item. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.location = None + """ Location(s) where service may be provided. + List of `FHIRReference` items referencing `Location` (represented as `dict` in JSON). """ + + self.name = None + """ Description of service as presented to a consumer while searching. + Type `str`. """ + + self.notAvailable = None + """ Not available during this time due to provided reason. + List of `HealthcareServiceNotAvailable` items (represented as `dict` in JSON). """ + + self.photo = None + """ 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.providedBy = None + """ Organization that provides this service. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.referralMethod = None + """ Ways that the service accepts referrals. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.serviceProvisionCode = None + """ Conditions under which service is available/offered. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.specialty = None + """ Specialties handled by the HealthcareService. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.telecom = None + """ Contacts related to the healthcare service. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + self.type = None + """ Type of service that may be delivered or performed. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(HealthcareService, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(HealthcareService, self).elementProperties() + js.extend([ + ("active", "active", bool, False, None, False), + ("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), + ("characteristic", "characteristic", codeableconcept.CodeableConcept, True, None, False), + ("comment", "comment", str, False, None, False), + ("coverageArea", "coverageArea", fhirreference.FHIRReference, True, None, False), + ("eligibility", "eligibility", codeableconcept.CodeableConcept, False, None, False), + ("eligibilityNote", "eligibilityNote", str, False, None, False), + ("endpoint", "endpoint", fhirreference.FHIRReference, True, None, False), + ("extraDetails", "extraDetails", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("location", "location", fhirreference.FHIRReference, True, None, False), + ("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), + ("providedBy", "providedBy", fhirreference.FHIRReference, False, None, False), + ("referralMethod", "referralMethod", codeableconcept.CodeableConcept, True, None, False), + ("serviceProvisionCode", "serviceProvisionCode", codeableconcept.CodeableConcept, True, None, False), + ("specialty", "specialty", codeableconcept.CodeableConcept, True, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +from . import backboneelement + +class HealthcareServiceAvailableTime(backboneelement.BackboneElement): + """ Times the Service Site is available. + + A collection of times that the Service Site is available. + """ + + resource_type = "HealthcareServiceAvailableTime" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Always available? e.g. 24 hour service. + Type `bool`. """ + + self.availableEndTime = None + """ Closing time of day (ignored if allDay = true). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.availableStartTime = None + """ Opening time of day (ignored if allDay = true). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.daysOfWeek = None + """ mon | tue | wed | thu | fri | sat | sun. + List of `str` items. """ + + super(HealthcareServiceAvailableTime, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(HealthcareServiceAvailableTime, self).elementProperties() + js.extend([ + ("allDay", "allDay", bool, False, None, False), + ("availableEndTime", "availableEndTime", fhirdate.FHIRDate, False, None, False), + ("availableStartTime", "availableStartTime", fhirdate.FHIRDate, False, None, False), + ("daysOfWeek", "daysOfWeek", str, True, None, False), + ]) + return js + + +class HealthcareServiceNotAvailable(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. + """ + + resource_type = "HealthcareServiceNotAvailable" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Reason presented to the user explaining why time not available. + Type `str`. """ + + self.during = None + """ Service not availablefrom this date. + Type `Period` (represented as `dict` in JSON). """ + + super(HealthcareServiceNotAvailable, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(HealthcareServiceNotAvailable, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, True), + ("during", "during", period.Period, 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 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: + 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/STU3/healthcareservice_tests.py b/fhirclient/models/STU3/healthcareservice_tests.py new file mode 100644 index 000000000..b942018d3 --- /dev/null +++ b/fhirclient/models/STU3/healthcareservice_tests.py @@ -0,0 +1,105 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import healthcareservice +from .fhirdate import FHIRDate + + +class HealthcareServiceTests(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("HealthcareService", js["resourceType"]) + return healthcareservice.HealthcareService(js) + + def testHealthcareService1(self): + inst = self.instantiate_from("healthcareservice-example.json") + self.assertIsNotNone(inst, "Must have instantiated a HealthcareService instance") + self.implHealthcareService1(inst) + + js = inst.as_json() + self.assertEqual("HealthcareService", js["resourceType"]) + inst2 = healthcareservice.HealthcareService(js) + self.implHealthcareService1(inst2) + + def implHealthcareService1(self, inst): + self.assertTrue(inst.active) + self.assertFalse(inst.appointmentRequired) + self.assertEqual(inst.availabilityExceptions, "Reduced capacity is available during the Christmas period") + self.assertTrue(inst.availableTime[0].allDay) + self.assertEqual(inst.availableTime[0].daysOfWeek[0], "wed") + self.assertEqual(inst.availableTime[1].availableEndTime.date, FHIRDate("05:30:00").date) + self.assertEqual(inst.availableTime[1].availableEndTime.as_json(), "05:30:00") + self.assertEqual(inst.availableTime[1].availableStartTime.date, FHIRDate("08:30:00").date) + self.assertEqual(inst.availableTime[1].availableStartTime.as_json(), "08:30:00") + self.assertEqual(inst.availableTime[1].daysOfWeek[0], "mon") + self.assertEqual(inst.availableTime[1].daysOfWeek[1], "tue") + self.assertEqual(inst.availableTime[1].daysOfWeek[2], "thu") + self.assertEqual(inst.availableTime[1].daysOfWeek[3], "fri") + self.assertEqual(inst.availableTime[2].availableEndTime.date, FHIRDate("04:30:00").date) + self.assertEqual(inst.availableTime[2].availableEndTime.as_json(), "04:30:00") + self.assertEqual(inst.availableTime[2].availableStartTime.date, FHIRDate("09:30:00").date) + 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.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.id, "example") + self.assertEqual(inst.identifier[0].system, "http://example.org/shared-ids") + self.assertEqual(inst.identifier[0].value, "HS-12") + 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) + self.assertEqual(inst.notAvailable[0].during.end.as_json(), "2015-12-26") + self.assertEqual(inst.notAvailable[0].during.start.date, FHIRDate("2015-12-25").date) + self.assertEqual(inst.notAvailable[0].during.start.as_json(), "2015-12-25") + self.assertEqual(inst.notAvailable[1].description, "New Years Day") + self.assertEqual(inst.notAvailable[1].during.end.date, FHIRDate("2016-01-01").date) + 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.referralMethod[0].coding[0].code, "phone") + self.assertEqual(inst.referralMethod[0].coding[0].display, "Phone") + self.assertEqual(inst.referralMethod[1].coding[0].code, "fax") + self.assertEqual(inst.referralMethod[1].coding[0].display, "Fax") + self.assertEqual(inst.referralMethod[2].coding[0].code, "elec") + self.assertEqual(inst.referralMethod[2].coding[0].display, "Secure Messaging") + self.assertEqual(inst.referralMethod[3].coding[0].code, "semail") + 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.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") + self.assertEqual(inst.telecom[0].system, "phone") + self.assertEqual(inst.telecom[0].use, "work") + self.assertEqual(inst.telecom[0].value, "(555) silent") + self.assertEqual(inst.telecom[1].system, "email") + self.assertEqual(inst.telecom[1].use, "work") + self.assertEqual(inst.telecom[1].value, "directaddress@example.com") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type[0].coding[0].code, "394913002") + self.assertEqual(inst.type[0].coding[0].display, "Psychotherapy") + self.assertEqual(inst.type[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.type[1].coding[0].code, "394587001") + self.assertEqual(inst.type[1].coding[0].display, "Psychiatry") + self.assertEqual(inst.type[1].coding[0].system, "http://snomed.info/sct") + diff --git a/fhirclient/models/STU3/humanname.py b/fhirclient/models/STU3/humanname.py new file mode 100644 index 000000000..9e7ccdd4a --- /dev/null +++ b/fhirclient/models/STU3/humanname.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/HumanName) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class HumanName(element.Element): + """ Name of a human - parts and usage. + + A human's name with the ability to identify parts and usage. + """ + + resource_type = "HumanName" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.family = None + """ Family name (often called 'Surname'). + Type `str`. """ + + self.given = None + """ Given names (not always 'first'). Includes middle names. + List of `str` items. """ + + self.period = None + """ Time period when name was/is in use. + Type `Period` (represented as `dict` in JSON). """ + + self.prefix = None + """ Parts that come before the name. + List of `str` items. """ + + self.suffix = None + """ Parts that come after the name. + List of `str` items. """ + + self.text = None + """ Text representation of the full name. + Type `str`. """ + + self.use = None + """ usual | official | temp | nickname | anonymous | old | maiden. + Type `str`. """ + + super(HumanName, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(HumanName, self).elementProperties() + js.extend([ + ("family", "family", str, False, None, False), + ("given", "given", str, True, None, False), + ("period", "period", period.Period, False, None, False), + ("prefix", "prefix", str, True, None, False), + ("suffix", "suffix", str, True, None, False), + ("text", "text", str, False, None, False), + ("use", "use", str, False, None, False), + ]) + return js + + +import sys +try: + from . import period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/STU3/identifier.py b/fhirclient/models/STU3/identifier.py new file mode 100644 index 000000000..6d725421e --- /dev/null +++ b/fhirclient/models/STU3/identifier.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Identifier) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Identifier(element.Element): + """ An identifier intended for computation. + + A technical identifier - identifies some entity uniquely and unambiguously. + """ + + resource_type = "Identifier" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.assigner = None + """ Organization that issued id (may be just text). + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.period = None + """ Time period when id is/was valid for use. + Type `Period` (represented as `dict` in JSON). """ + + self.system = None + """ The namespace for the identifier value. + Type `str`. """ + + self.type = None + """ Description of identifier. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.use = None + """ usual | official | temp | secondary (If known). + Type `str`. """ + + self.value = None + """ The value that is unique. + Type `str`. """ + + super(Identifier, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Identifier, self).elementProperties() + js.extend([ + ("assigner", "assigner", fhirreference.FHIRReference, False, None, False), + ("period", "period", period.Period, False, None, False), + ("system", "system", str, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("use", "use", str, False, None, False), + ("value", "value", str, 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 period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/STU3/imagingmanifest.py b/fhirclient/models/STU3/imagingmanifest.py new file mode 100644 index 000000000..37ed8cefe --- /dev/null +++ b/fhirclient/models/STU3/imagingmanifest.py @@ -0,0 +1,202 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ImagingManifest) on 2019-10-12. +# 2019, 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/STU3/imagingmanifest_tests.py b/fhirclient/models/STU3/imagingmanifest_tests.py new file mode 100644 index 000000000..1bf4a0b9c --- /dev/null +++ b/fhirclient/models/STU3/imagingmanifest_tests.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +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/STU3/imagingstudy.py b/fhirclient/models/STU3/imagingstudy.py new file mode 100644 index 000000000..0fac69029 --- /dev/null +++ b/fhirclient/models/STU3/imagingstudy.py @@ -0,0 +1,288 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ImagingStudy) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class ImagingStudy(domainresource.DomainResource): + """ A set of images produced in single study (one or more series of references + images). + + Representation of the content produced in a DICOM imaging study. A study + comprises a set of series, each of which includes a set of Service-Object + Pair Instances (SOP Instances - images or other data) acquired or produced + in a common context. A series is of only one modality (e.g. X-ray, CT, MR, + ultrasound), but a study may have multiple series of different modalities. + """ + + resource_type = "ImagingStudy" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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). """ + + self.description = None + """ Institution-generated description. + Type `str`. """ + + self.endpoint = None + """ Study access endpoint. + List of `FHIRReference` items referencing `Endpoint` (represented as `dict` in JSON). """ + + self.identifier = None + """ Other identifiers for the 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). """ + + self.modalityList = None + """ All series modality if actual acquisition modalities. + List of `Coding` items (represented as `dict` in JSON). """ + + self.numberOfInstances = None + """ Number of Study Related Instances. + Type `int`. """ + + self.numberOfSeries = None + """ 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). """ + + self.reason = None + """ Why the study was requested. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.referrer = None + """ Referring physician. + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + self.series = None + """ Each study has one or more series of instances. + List of `ImagingStudySeries` items (represented as `dict` in JSON). """ + + self.started = None + """ When the study was started. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.uid = None + """ Formal DICOM identifier for the study. + Type `str`. """ + + 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), + ("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), + ("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), + ("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), + ]) + return js + + +from . import backboneelement + +class ImagingStudySeries(backboneelement.BackboneElement): + """ Each study has one or more series of instances. + + Each study has one or more series of images or other content. + """ + + resource_type = "ImagingStudySeries" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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). """ + + self.description = None + """ A short human readable summary of the series. + Type `str`. """ + + self.endpoint = None + """ Series access endpoint. + List of `FHIRReference` items referencing `Endpoint` (represented as `dict` in JSON). """ + + self.instance = None + """ A single SOP instance from the series. + List of `ImagingStudySeriesInstance` items (represented as `dict` in JSON). """ + + self.laterality = None + """ Body part laterality. + Type `Coding` (represented as `dict` in JSON). """ + + self.modality = None + """ The modality of the instances in the series. + Type `Coding` (represented as `dict` in JSON). """ + + self.number = None + """ Numeric identifier of this series. + Type `int`. """ + + self.numberOfInstances = None + """ Number of Series Related Instances. + Type `int`. """ + + self.performer = None + """ Who performed the series. + List of `FHIRReference` items referencing `Practitioner` (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. + Type `str`. """ + + super(ImagingStudySeries, self).__init__(jsondict=jsondict, strict=strict) + + 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), + ("instance", "instance", ImagingStudySeriesInstance, True, None, False), + ("laterality", "laterality", coding.Coding, False, None, False), + ("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), + ("started", "started", fhirdate.FHIRDate, False, None, False), + ("uid", "uid", str, False, None, True), + ]) + return js + + +class ImagingStudySeriesInstance(backboneelement.BackboneElement): + """ A single SOP instance from the series. + + A single SOP instance within the series, e.g. an image, or presentation + state. + """ + + resource_type = "ImagingStudySeriesInstance" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.number = None + """ The number of this instance in the series. + Type `int`. """ + + self.sopClass = None + """ DICOM class type. + Type `str`. """ + + self.title = None + """ Description of instance. + Type `str`. """ + + self.uid = None + """ Formal DICOM identifier for this instance. + Type `str`. """ + + super(ImagingStudySeriesInstance, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ImagingStudySeriesInstance, self).elementProperties() + js.extend([ + ("number", "number", int, False, None, False), + ("sopClass", "sopClass", str, False, None, True), + ("title", "title", str, False, None, False), + ("uid", "uid", 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 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/STU3/imagingstudy_tests.py b/fhirclient/models/STU3/imagingstudy_tests.py new file mode 100644 index 000000000..97a7e3561 --- /dev/null +++ b/fhirclient/models/STU3/imagingstudy_tests.py @@ -0,0 +1,115 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import imagingstudy +from .fhirdate import FHIRDate + + +class ImagingStudyTests(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("ImagingStudy", js["resourceType"]) + return imagingstudy.ImagingStudy(js) + + def testImagingStudy1(self): + inst = self.instantiate_from("imagingstudy-example-xr.json") + self.assertIsNotNone(inst, "Must have instantiated a ImagingStudy instance") + self.implImagingStudy1(inst) + + js = inst.as_json() + self.assertEqual("ImagingStudy", js["resourceType"]) + inst2 = imagingstudy.ImagingStudy(js) + 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.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.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].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[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].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].laterality.code, "419161000") + self.assertEqual(inst.series[0].laterality.display, "Unilateral left") + self.assertEqual(inst.series[0].laterality.system, "http://snomed.info/sct") + self.assertEqual(inst.series[0].modality.code, "DX") + 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].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.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.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") + self.assertIsNotNone(inst, "Must have instantiated a ImagingStudy instance") + self.implImagingStudy2(inst) + + js = inst.as_json() + self.assertEqual("ImagingStudy", js["resourceType"]) + inst2 = imagingstudy.ImagingStudy(js) + self.implImagingStudy2(inst2) + + def implImagingStudy2(self, inst): + self.assertEqual(inst.id, "example") + self.assertEqual(inst.numberOfInstances, 1) + self.assertEqual(inst.numberOfSeries, 1) + self.assertEqual(inst.series[0].bodySite.code, "67734004") + self.assertEqual(inst.series[0].bodySite.display, "Upper Trunk Structure") + 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].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.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.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/STU3/immunization.py b/fhirclient/models/STU3/immunization.py new file mode 100644 index 000000000..237173920 --- /dev/null +++ b/fhirclient/models/STU3/immunization.py @@ -0,0 +1,346 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Immunization) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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. + """ + + resource_type = "Immunization" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ 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.encounter = None + """ Encounter administered as part of. + Type `FHIRReference` referencing `Encounter` (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.identifier = None + """ Business identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.location = None + """ Where vaccination occurred. + Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + + self.lotNumber = None + """ Vaccine lot number. + Type `str`. """ + + 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`. """ + + self.note = None + """ Vaccination notes. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.patient = None + """ Who was immunized. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.practitioner = None + """ Who performed event. + List of `ImmunizationPractitioner` items (represented as `dict` in JSON). """ + + self.primarySource = None + """ Indicates context the data was recorded in. + Type `bool`. """ + + self.reaction = None + """ Details of a reaction that follows immunization. + List of `ImmunizationReaction` items (represented as `dict` in JSON). """ + + self.reportOrigin = None + """ Indicates the source of a secondarily reported record. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.route = None + """ How vaccine entered body. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.site = None + """ Body site vaccine was administered. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.status = None + """ completed | entered-in-error. + Type `str`. """ + + self.vaccinationProtocol = None + """ What protocol was followed. + List of `ImmunizationVaccinationProtocol` items (represented as `dict` in JSON). """ + + self.vaccineCode = None + """ Vaccine product administered. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(Immunization, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Immunization, self).elementProperties() + js.extend([ + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("doseQuantity", "doseQuantity", quantity.Quantity, False, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), + ("expirationDate", "expirationDate", fhirdate.FHIRDate, False, None, False), + ("explanation", "explanation", ImmunizationExplanation, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, 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), + ("patient", "patient", fhirreference.FHIRReference, False, None, True), + ("practitioner", "practitioner", ImmunizationPractitioner, True, None, False), + ("primarySource", "primarySource", bool, False, None, True), + ("reaction", "reaction", ImmunizationReaction, True, 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), + ("vaccineCode", "vaccineCode", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +from . import backboneelement + +class ImmunizationExplanation(backboneelement.BackboneElement): + """ Administration/non-administration reasons. + + Reasons why a vaccine was or was not administered. + """ + + resource_type = "ImmunizationExplanation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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.reasonNotGiven = None + """ Why immunization did not occur. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(ImmunizationExplanation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ImmunizationExplanation, self).elementProperties() + js.extend([ + ("reason", "reason", codeableconcept.CodeableConcept, True, None, False), + ("reasonNotGiven", "reasonNotGiven", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +class ImmunizationPractitioner(backboneelement.BackboneElement): + """ Who performed event. + + Indicates who or what performed the event. + """ + + resource_type = "ImmunizationPractitioner" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 performing. + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + self.role = None + """ What type of performance was done. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ImmunizationPractitioner, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ImmunizationPractitioner, self).elementProperties() + js.extend([ + ("actor", "actor", fhirreference.FHIRReference, False, None, True), + ("role", "role", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class ImmunizationReaction(backboneelement.BackboneElement): + """ Details of a reaction that follows immunization. + + Categorical data indicating that an adverse event is associated in time to + an immunization. + """ + + resource_type = "ImmunizationReaction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ When reaction started. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.detail = None + """ Additional information on reaction. + Type `FHIRReference` referencing `Observation` (represented as `dict` in JSON). """ + + self.reported = None + """ Indicates self-reported reaction. + Type `bool`. """ + + super(ImmunizationReaction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ImmunizationReaction, self).elementProperties() + js.extend([ + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("detail", "detail", fhirreference.FHIRReference, False, None, False), + ("reported", "reported", bool, False, None, False), + ]) + return js + + +class ImmunizationVaccinationProtocol(backboneelement.BackboneElement): + """ What protocol was followed. + + Contains information about the protocol(s) under which the vaccine was + administered. + """ + + resource_type = "ImmunizationVaccinationProtocol" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ 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.seriesDoses = None + """ Recommended number of doses for immunity. + Type `int`. """ + + self.targetDisease = None + """ Disease immunized against. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(ImmunizationVaccinationProtocol, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ImmunizationVaccinationProtocol, 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), + ]) + 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 quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/STU3/immunization_tests.py b/fhirclient/models/STU3/immunization_tests.py new file mode 100644 index 000000000..bb9f3c168 --- /dev/null +++ b/fhirclient/models/STU3/immunization_tests.py @@ -0,0 +1,134 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import immunization +from .fhirdate import FHIRDate + + +class ImmunizationTests(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("Immunization", js["resourceType"]) + return immunization.Immunization(js) + + def testImmunization1(self): + inst = self.instantiate_from("immunization-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Immunization instance") + self.implImmunization1(inst) + + js = inst.as_json() + self.assertEqual("Immunization", js["resourceType"]) + inst2 = immunization.Immunization(js) + self.implImmunization1(inst2) + + def implImmunization1(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") + 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.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.lotNumber, "AAJN11K") + self.assertFalse(inst.notGiven) + 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.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.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.status, "completed") + 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].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.date.date, FHIRDate("2012-01-15").date) + self.assertEqual(inst.date.as_json(), "2012-01-15") + 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.note[0].text, "Notes on adminstration of a historical vaccine") + 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.text, "Written Record") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.vaccineCode.coding[0].code, "GNFLU") + self.assertEqual(inst.vaccineCode.coding[0].system, "urn:oid:1.2.36.1.2001.1005.17") + self.assertEqual(inst.vaccineCode.text, "Influenza") + + def testImmunization3(self): + inst = self.instantiate_from("immunization-example-refused.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.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") + self.assertEqual(inst.id, "notGiven") + self.assertTrue(inst.notGiven) + self.assertTrue(inst.primarySource) + self.assertEqual(inst.status, "completed") + 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") + diff --git a/fhirclient/models/STU3/immunizationrecommendation.py b/fhirclient/models/STU3/immunizationrecommendation.py new file mode 100644 index 000000000..8aca0214a --- /dev/null +++ b/fhirclient/models/STU3/immunizationrecommendation.py @@ -0,0 +1,220 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ImmunizationRecommendation) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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. + """ + + resource_type = "ImmunizationRecommendation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ 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). """ + + self.recommendation = None + """ Vaccine administration recommendations. + List of `ImmunizationRecommendationRecommendation` items (represented as `dict` in JSON). """ + + super(ImmunizationRecommendation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ImmunizationRecommendation, self).elementProperties() + js.extend([ + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("patient", "patient", fhirreference.FHIRReference, False, None, True), + ("recommendation", "recommendation", ImmunizationRecommendationRecommendation, True, None, True), + ]) + return js + + +from . import backboneelement + +class ImmunizationRecommendationRecommendation(backboneelement.BackboneElement): + """ Vaccine administration recommendations. + """ + + resource_type = "ImmunizationRecommendationRecommendation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 recommendation created. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.dateCriterion = None + """ Dates governing proposed immunization. + List of `ImmunizationRecommendationRecommendationDateCriterion` items (represented as `dict` in JSON). """ + + self.doseNumber = None + """ Recommended dose number. + Type `int`. """ + + self.forecastStatus = None + """ Vaccine administration status. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.protocol = None + """ Protocol used by recommendation. + Type `ImmunizationRecommendationRecommendationProtocol` (represented as `dict` in JSON). """ + + self.supportingImmunization = None + """ Past immunizations supporting recommendation. + List of `FHIRReference` items referencing `Immunization` (represented as `dict` in JSON). """ + + self.supportingPatientInformation = None + """ Patient observations supporting recommendation. + List of `FHIRReference` items referencing `Observation, AllergyIntolerance` (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). """ + + 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), + ("dateCriterion", "dateCriterion", ImmunizationRecommendationRecommendationDateCriterion, True, None, False), + ("doseNumber", "doseNumber", int, False, None, False), + ("forecastStatus", "forecastStatus", codeableconcept.CodeableConcept, False, None, True), + ("protocol", "protocol", ImmunizationRecommendationRecommendationProtocol, False, None, 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), + ]) + return js + + +class ImmunizationRecommendationRecommendationDateCriterion(backboneelement.BackboneElement): + """ Dates governing proposed immunization. + + Vaccine date recommendations. For example, earliest date to administer, + latest date to administer, etc. + """ + + resource_type = "ImmunizationRecommendationRecommendationDateCriterion" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 date. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.value = None + """ Recommended date. + Type `FHIRDate` (represented as `str` in JSON). """ + + super(ImmunizationRecommendationRecommendationDateCriterion, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ImmunizationRecommendationRecommendationDateCriterion, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("value", "value", fhirdate.FHIRDate, False, None, True), + ]) + 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 +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/STU3/immunizationrecommendation_tests.py b/fhirclient/models/STU3/immunizationrecommendation_tests.py new file mode 100644 index 000000000..862719d6d --- /dev/null +++ b/fhirclient/models/STU3/immunizationrecommendation_tests.py @@ -0,0 +1,106 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import immunizationrecommendation +from .fhirdate import FHIRDate + + +class ImmunizationRecommendationTests(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("ImmunizationRecommendation", js["resourceType"]) + return immunizationrecommendation.ImmunizationRecommendation(js) + + def testImmunizationRecommendation1(self): + inst = self.instantiate_from("immunizationrecommendation-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ImmunizationRecommendation instance") + self.implImmunizationRecommendation1(inst) + + js = inst.as_json() + self.assertEqual("ImmunizationRecommendation", js["resourceType"]) + inst2 = immunizationrecommendation.ImmunizationRecommendation(js) + self.implImmunizationRecommendation1(inst2) + + def implImmunizationRecommendation1(self, inst): + 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.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].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].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].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.text.div, "
Authored by Joginder Madra
") + self.assertEqual(inst.text.status, "generated") + + def testImmunizationRecommendation2(self): + inst = self.instantiate_from("immunizationrecommendation-target-disease-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ImmunizationRecommendation instance") + self.implImmunizationRecommendation2(inst) + + js = inst.as_json() + self.assertEqual("ImmunizationRecommendation", js["resourceType"]) + inst2 = immunizationrecommendation.ImmunizationRecommendation(js) + self.implImmunizationRecommendation2(inst2) + + def implImmunizationRecommendation2(self, inst): + 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.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].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].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].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].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
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/STU3/implementationguide.py b/fhirclient/models/STU3/implementationguide.py new file mode 100644 index 000000000..983a9035c --- /dev/null +++ b/fhirclient/models/STU3/implementationguide.py @@ -0,0 +1,389 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ImplementationGuide) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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. + """ + + resource_type = "ImplementationGuide" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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). """ + + 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.dependency = None + """ Another Implementation guide this depends on. + List of `ImplementationGuideDependency` items (represented as `dict` in JSON). """ + + self.description = None + """ Natural language description of the implementation guide. + Type `str`. """ + + self.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.fhirVersion = None + """ FHIR Version this Implementation Guide targets. + Type `str`. """ + + self.global_fhir = None + """ Profiles that apply globally. + List of `ImplementationGuideGlobal` items (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ Intended jurisdiction for implementation guide (if applicable). + List of `CodeableConcept` items (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.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 implementation guide (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 implementation guide. + Type `str`. """ + + super(ImplementationGuide, self).__init__(jsondict=jsondict, strict=strict) + + 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), + ("description", "description", str, False, None, False), + ("experimental", "experimental", bool, False, None, False), + ("fhirVersion", "fhirVersion", str, False, None, False), + ("global_fhir", "global", ImplementationGuideGlobal, True, None, False), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("name", "name", str, False, None, True), + ("package", "package", ImplementationGuidePackage, True, None, False), + ("page", "page", ImplementationGuidePage, False, None, False), + ("publisher", "publisher", str, False, None, False), + ("status", "status", str, False, None, True), + ("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 ImplementationGuideDependency(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 = "ImplementationGuideDependency" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ reference | inclusion. + Type `str`. """ + + self.uri = None + """ Where to find dependency. + Type `str`. """ + + super(ImplementationGuideDependency, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ImplementationGuideDependency, self).elementProperties() + js.extend([ + ("type", "type", str, False, None, True), + ("uri", "uri", str, False, None, True), + ]) + 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 `FHIRReference` referencing `StructureDefinition` (represented as `dict` in JSON). """ + + self.type = None + """ Type this profiles applies to. + Type `str`. """ + + super(ImplementationGuideGlobal, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ImplementationGuideGlobal, self).elementProperties() + js.extend([ + ("profile", "profile", fhirreference.FHIRReference, False, None, True), + ("type", "type", str, False, None, True), + ]) + return js + + +class ImplementationGuidePackage(backboneelement.BackboneElement): + """ Group of resources as used in .page.package. + + A logical group of resources. Logical groups can be used when building + pages. + """ + + resource_type = "ImplementationGuidePackage" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Human readable text describing the package. + Type `str`. """ + + self.name = None + """ Name used .page.package. + Type `str`. """ + + self.resource = None + """ Resource in the implementation guide. + List of `ImplementationGuidePackageResource` items (represented as `dict` in JSON). """ + + super(ImplementationGuidePackage, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ImplementationGuidePackage, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, False), + ("name", "name", str, False, None, True), + ("resource", "resource", ImplementationGuidePackageResource, True, None, True), + ]) + return js + + +class ImplementationGuidePackageResource(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 = "ImplementationGuidePackageResource" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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. + Type `bool`. """ + + self.exampleFor = None + """ Resource this is an example of (if applicable). + Type `FHIRReference` referencing `StructureDefinition` (represented as `dict` in JSON). """ + + self.name = None + """ Human Name for the resource. + Type `str`. """ + + self.sourceReference = None + """ Location of the resource. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.sourceUri = None + """ Location of the resource. + Type `str`. """ + + super(ImplementationGuidePackageResource, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ImplementationGuidePackageResource, 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), + ("name", "name", str, False, None, False), + ("sourceReference", "sourceReference", fhirreference.FHIRReference, False, "source", True), + ("sourceUri", "sourceUri", str, False, "source", True), + ]) + return js + + +class ImplementationGuidePage(backboneelement.BackboneElement): + """ Page/Section in the Guide. + + A page / section in the implementation guide. The root page is the + implementation guide home page. + """ + + resource_type = "ImplementationGuidePage" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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.). + Type `str`. """ + + self.kind = None + """ page | example | list | include | directory | dictionary | toc | + resource. + Type `str`. """ + + self.package = None + """ Name of package to include. + List of `str` items. """ + + self.page = None + """ Nested Pages / Sections. + List of `ImplementationGuidePage` items (represented as `dict` in JSON). """ + + self.source = None + """ Where to find that page. + Type `str`. """ + + self.title = None + """ Short title shown for navigational assistance. + Type `str`. """ + + self.type = None + """ Kind of resource to include in the list. + List of `str` items. """ + + super(ImplementationGuidePage, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ImplementationGuidePage, 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), + ]) + 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 usagecontext +except ImportError: + usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/STU3/implementationguide_tests.py b/fhirclient/models/STU3/implementationguide_tests.py new file mode 100644 index 000000000..fd842170e --- /dev/null +++ b/fhirclient/models/STU3/implementationguide_tests.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import implementationguide +from .fhirdate import FHIRDate + + +class ImplementationGuideTests(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("ImplementationGuide", js["resourceType"]) + return implementationguide.ImplementationGuide(js) + + def testImplementationGuide1(self): + inst = self.instantiate_from("implementationguide-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ImplementationGuide instance") + self.implImplementationGuide1(inst) + + js = inst.as_json() + self.assertEqual("ImplementationGuide", js["resourceType"]) + inst2 = implementationguide.ImplementationGuide(js) + 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") + self.assertEqual(inst.contact[1].name, "HL7") + self.assertEqual(inst.contact[1].telecom[0].system, "url") + self.assertEqual(inst.contact[1].telecom[0].value, "http://hl7.org/fhir") + 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.assertFalse(inst.experimental) + self.assertEqual(inst.fhirVersion, "1.0.0") + 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.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.publisher, "ONC / HL7 Joint project") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.url, "http://hl7.org/fhir/us/daf") + self.assertEqual(inst.version, "0") + diff --git a/fhirclient/models/STU3/library.py b/fhirclient/models/STU3/library.py new file mode 100644 index 000000000..69e75f6a5 --- /dev/null +++ b/fhirclient/models/STU3/library.py @@ -0,0 +1,213 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Library) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Library(domainresource.DomainResource): + """ Represents a library of quality improvement components. + + The Library resource is a general-purpose container for knowledge asset + definitions. It can be used to describe and expose existing knowledge + assets such as logic libraries and information model descriptions, as well + as to describe a collection of knowledge assets. + """ + + resource_type = "Library" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 library was approved by publisher. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.contact = None + """ Contact details for the publisher. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.content = None + """ 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`. """ + + self.dataRequirement = None + """ What data is referenced by this library. + List of `DataRequirement` 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 library. + Type `str`. """ + + self.effectivePeriod = None + """ When the library 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 library. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ Intended jurisdiction for library (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.lastReviewDate = None + """ When the library was last reviewed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.name = None + """ Name for this library (computer friendly). + Type `str`. """ + + self.parameter = None + """ Parameters defined by the library. + List of `ParameterDefinition` items (represented as `dict` in JSON). """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this library is defined. + Type `str`. """ + + self.relatedArtifact = None + """ Additional documentation, citations, etc.. + List of `RelatedArtifact` items (represented as `dict` in JSON). """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.title = None + """ Name for this library (human friendly). + Type `str`. """ + + self.topic = None + """ E.g. Education, Treatment, Assessment, etc. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.type = None + """ logic-library | model-definition | asset-collection | module- + definition. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.url = None + """ Logical URI to reference this library (globally unique). + Type `str`. """ + + self.usage = None + """ Describes the clinical usage of the library. + 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 library. + Type `str`. """ + + super(Library, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Library, self).elementProperties() + js.extend([ + ("approvalDate", "approvalDate", fhirdate.FHIRDate, False, 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), + ("effectivePeriod", "effectivePeriod", period.Period, False, 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), + ("parameter", "parameter", parameterdefinition.ParameterDefinition, True, None, False), + ("publisher", "publisher", str, False, None, False), + ("purpose", "purpose", str, False, None, False), + ("relatedArtifact", "relatedArtifact", relatedartifact.RelatedArtifact, True, None, False), + ("status", "status", str, False, None, True), + ("title", "title", str, False, None, False), + ("topic", "topic", codeableconcept.CodeableConcept, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ("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 attachment +except ImportError: + attachment = sys.modules[__package__ + '.attachment'] +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 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: + fhirdate = sys.modules[__package__ + '.fhirdate'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] +try: + from . import parameterdefinition +except ImportError: + parameterdefinition = sys.modules[__package__ + '.parameterdefinition'] +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/STU3/library_tests.py b/fhirclient/models/STU3/library_tests.py new file mode 100644 index 000000000..7ffae3470 --- /dev/null +++ b/fhirclient/models/STU3/library_tests.py @@ -0,0 +1,180 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import library +from .fhirdate import FHIRDate + + +class LibraryTests(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("Library", js["resourceType"]) + return library.Library(js) + + def testLibrary1(self): + inst = self.instantiate_from("library-predecessor-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Library instance") + self.implLibrary1(inst) + + js = inst.as_json() + self.assertEqual("Library", js["resourceType"]) + inst2 = library.Library(js) + 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.relatedArtifact[0].type, "depends-on") + 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].path, "category") + self.assertEqual(inst.dataRequirement[1].codeFilter[0].valueCode[0], "diagnosis") + 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].type, "Condition") + 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].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].type, "Condition") + 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].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].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].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].type, "Medication") + 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].type, "MedicationRequest") + 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].type, "MedicationStatement") + self.assertEqual(inst.date.date, FHIRDate("2015-07-22").date) + self.assertEqual(inst.date.as_json(), "2015-07-22") + self.assertEqual(inst.description, "Logic for CMS 146: Appropriate Testing for Children with Pharyngitis") + self.assertEqual(inst.id, "library-cms146-example") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "CMS146") + self.assertEqual(inst.relatedArtifact[0].type, "depends-on") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "Appropriate Testing for Children with Pharyngitis") + self.assertEqual(inst.type.coding[0].code, "logic-library") + self.assertEqual(inst.version, "2.0.0") + + def testLibrary3(self): + inst = self.instantiate_from("library-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Library instance") + self.implLibrary3(inst) + + js = inst.as_json() + self.assertEqual("Library", js["resourceType"]) + inst2 = library.Library(js) + self.implLibrary3(inst2) + + 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].type, "Condition") + self.assertEqual(inst.date.date, FHIRDate("2015-07-22").date) + self.assertEqual(inst.date.as_json(), "2015-07-22") + self.assertEqual(inst.description, "Common Logic for adherence to Chlamydia Screening guidelines") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "ChalmydiaScreening_Common") + self.assertEqual(inst.relatedArtifact[0].type, "depends-on") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "Chlamydia Screening Common Library") + self.assertEqual(inst.topic[0].text, "Chlamydia Screening") + self.assertEqual(inst.type.coding[0].code, "logic-library") + self.assertEqual(inst.version, "2.0.0") + + def testLibrary4(self): + inst = self.instantiate_from("library-composition-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Library instance") + self.implLibrary4(inst) + + js = inst.as_json() + self.assertEqual("Library", js["resourceType"]) + inst2 = library.Library(js) + self.implLibrary4(inst2) + + def implLibrary4(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") + diff --git a/fhirclient/models/STU3/linkage.py b/fhirclient/models/STU3/linkage.py new file mode 100644 index 000000000..593a28a23 --- /dev/null +++ b/fhirclient/models/STU3/linkage.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Linkage) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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". + """ + + resource_type = "Linkage" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 linkage assertion is active or not. + Type `bool`. """ + + self.author = None + """ Who is responsible for linkages. + Type `FHIRReference` referencing `Practitioner, Organization` (represented as `dict` in JSON). """ + + self.item = None + """ Item to be linked. + List of `LinkageItem` items (represented as `dict` in JSON). """ + + super(Linkage, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Linkage, self).elementProperties() + js.extend([ + ("active", "active", bool, False, None, False), + ("author", "author", fhirreference.FHIRReference, False, None, False), + ("item", "item", LinkageItem, True, None, True), + ]) + return js + + +from . import backboneelement + +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 + collection of linked items. + """ + + resource_type = "LinkageItem" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Resource being linked. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.type = None + """ source | alternate | historical. + Type `str`. """ + + super(LinkageItem, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(LinkageItem, self).elementProperties() + js.extend([ + ("resource", "resource", fhirreference.FHIRReference, False, None, True), + ("type", "type", str, False, None, True), + ]) + return js + + +import sys +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] diff --git a/fhirclient/models/STU3/linkage_tests.py b/fhirclient/models/STU3/linkage_tests.py new file mode 100644 index 000000000..dbd1380fa --- /dev/null +++ b/fhirclient/models/STU3/linkage_tests.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import linkage +from .fhirdate import FHIRDate + + +class LinkageTests(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("Linkage", js["resourceType"]) + return linkage.Linkage(js) + + def testLinkage1(self): + inst = self.instantiate_from("linkage-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Linkage instance") + self.implLinkage1(inst) + + js = inst.as_json() + self.assertEqual("Linkage", js["resourceType"]) + inst2 = linkage.Linkage(js) + self.implLinkage1(inst2) + + 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.text.status, "generated") + diff --git a/fhirclient/models/STU3/list.py b/fhirclient/models/STU3/list.py new file mode 100644 index 000000000..291cd1b24 --- /dev/null +++ b/fhirclient/models/STU3/list.py @@ -0,0 +1,167 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/List) on 2019-10-12. +# 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. + """ + + resource_type = "List" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 the purpose of this list is. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.date = None + """ When the list was prepared. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.emptyReason = None + """ Why list is empty. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.encounter = None + """ Context in which list created. + Type `FHIRReference` referencing `Encounter` (represented as `dict` in JSON). """ + + self.entry = None + """ Entries in the list. + List of `ListEntry` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Business identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.mode = None + """ working | snapshot | changes. + Type `str`. """ + + self.note = None + """ Comments about the list. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.orderedBy = None + """ What order the list has. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.source = None + """ Who and/or what defined the list contents (aka Author). + Type `FHIRReference` referencing `Practitioner, Patient, Device` (represented as `dict` in JSON). """ + + self.status = None + """ current | retired | entered-in-error. + Type `str`. """ + + self.subject = None + """ If all resources have the same subject. + Type `FHIRReference` referencing `Patient, Group, Device, Location` (represented as `dict` in JSON). """ + + self.title = None + """ Descriptive name for the list. + Type `str`. """ + + super(List, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(List, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("emptyReason", "emptyReason", codeableconcept.CodeableConcept, False, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), + ("entry", "entry", ListEntry, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("mode", "mode", str, False, None, True), + ("note", "note", annotation.Annotation, True, None, False), + ("orderedBy", "orderedBy", codeableconcept.CodeableConcept, False, None, False), + ("source", "source", fhirreference.FHIRReference, False, None, False), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ("title", "title", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class ListEntry(backboneelement.BackboneElement): + """ Entries in the list. + + Entries in this list. + """ + + resource_type = "ListEntry" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ When item added to list. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.deleted = None + """ If this item is actually marked as deleted. + Type `bool`. """ + + self.flag = None + """ Status/Workflow information about this item. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.item = None + """ Actual entry. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + super(ListEntry, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ListEntry, self).elementProperties() + js.extend([ + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("deleted", "deleted", bool, False, None, False), + ("flag", "flag", codeableconcept.CodeableConcept, False, None, False), + ("item", "item", fhirreference.FHIRReference, 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 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/STU3/list_tests.py b/fhirclient/models/STU3/list_tests.py new file mode 100644 index 000000000..24c35fa40 --- /dev/null +++ b/fhirclient/models/STU3/list_tests.py @@ -0,0 +1,253 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import list +from .fhirdate import FHIRDate + + +class ListTests(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("List", js["resourceType"]) + return list.List(js) + + def testList1(self): + inst = self.instantiate_from("list-example-medlist.json") + self.assertIsNotNone(inst, "Must have instantiated a List instance") + self.implList1(inst) + + js = inst.as_json() + self.assertEqual("List", js["resourceType"]) + inst2 = list.List(js) + self.implList1(inst2) + + def implList1(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.mode, "changes") + self.assertEqual(inst.status, "current") + self.assertEqual(inst.text.status, "generated") + + def testList2(self): + inst = self.instantiate_from("list-example-familyhistory-genetics-profile-annie.json") + self.assertIsNotNone(inst, "Must have instantiated a List instance") + self.implList2(inst) + + js = inst.as_json() + self.assertEqual("List", js["resourceType"]) + inst2 = list.List(js) + self.implList2(inst2) + + def implList2(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.mode, "snapshot") + self.assertEqual(inst.status, "current") + self.assertEqual(inst.text.status, "generated") + + def testList3(self): + inst = self.instantiate_from("list-example-simple-empty.json") + self.assertIsNotNone(inst, "Must have instantiated a List instance") + self.implList3(inst) + + js = inst.as_json() + self.assertEqual("List", js["resourceType"]) + inst2 = list.List(js) + self.implList3(inst2) + + def implList3(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.status, "current") + self.assertEqual(inst.text.status, "generated") + + def testList4(self): + inst = self.instantiate_from("list-example-empty.json") + self.assertIsNotNone(inst, "Must have instantiated a List instance") + self.implList4(inst) + + js = inst.as_json() + self.assertEqual("List", js["resourceType"]) + inst2 = list.List(js) + self.implList4(inst2) + + def implList4(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.mode, "snapshot") + self.assertEqual(inst.status, "current") + self.assertEqual(inst.text.status, "generated") + + def testList5(self): + inst = self.instantiate_from("list-example-familyhistory-genetics-profile.json") + self.assertIsNotNone(inst, "Must have instantiated a List instance") + self.implList5(inst) + + js = inst.as_json() + self.assertEqual("List", js["resourceType"]) + inst2 = list.List(js) + self.implList5(inst2) + + 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, "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.mode, "snapshot") + self.assertEqual(inst.status, "current") + self.assertEqual(inst.text.status, "generated") + + def testList6(self): + inst = self.instantiate_from("list-example-familyhistory-f201-roel.json") + self.assertIsNotNone(inst, "Must have instantiated a List instance") + self.implList6(inst) + + js = inst.as_json() + self.assertEqual("List", js["resourceType"]) + inst2 = list.List(js) + self.implList6(inst2) + + 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, "fmh-1") + self.assertEqual(inst.contained[1].id, "fmh-2") + self.assertEqual(inst.id, "f201") + 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.json") + self.assertIsNotNone(inst, "Must have instantiated a List instance") + self.implList7(inst) + + js = inst.as_json() + self.assertEqual("List", js["resourceType"]) + inst2 = list.List(js) + self.implList7(inst2) + + def implList7(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.mode, "changes") + self.assertEqual(inst.status, "current") + self.assertEqual(inst.text.status, "generated") + + def testList8(self): + inst = self.instantiate_from("list-example-allergies.json") + self.assertIsNotNone(inst, "Must have instantiated a List instance") + self.implList8(inst) + + js = inst.as_json() + self.assertEqual("List", js["resourceType"]) + inst2 = list.List(js) + self.implList8(inst2) + + def implList8(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.status, "current") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "Current Allergy List") + + def testList9(self): + inst = self.instantiate_from("list-example-double-cousin-relationship-pedigree.json") + self.assertIsNotNone(inst, "Must have instantiated a List instance") + self.implList9(inst) + + js = inst.as_json() + self.assertEqual("List", js["resourceType"]) + inst2 = list.List(js) + self.implList9(inst2) + + def implList9(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].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.mode, "snapshot") + self.assertEqual(inst.status, "current") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/STU3/location.py b/fhirclient/models/STU3/location.py new file mode 100644 index 000000000..197086872 --- /dev/null +++ b/fhirclient/models/STU3/location.py @@ -0,0 +1,183 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Location) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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 + accommodated. + """ + + resource_type = "Location" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Physical location. + 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. + List of `str` items. """ + + self.description = None + """ Additional details about the location that could be displayed as + further information to identify the location beyond its name. + Type `str`. """ + + self.endpoint = None + """ Technical endpoints providing access to services operated for the + location. + List of `FHIRReference` items referencing `Endpoint` (represented as `dict` in JSON). """ + + self.identifier = None + """ Unique code or number identifying the location to its users. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.managingOrganization = None + """ Organization responsible for provisioning and upkeep. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.mode = None + """ instance | kind. + Type `str`. """ + + self.name = None + """ Name of the location as used by humans. + Type `str`. """ + + self.operationalStatus = None + """ 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). """ + + self.physicalType = None + """ Physical form of the location. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.position = None + """ The absolute geographic location. + Type `LocationPosition` (represented as `dict` in JSON). """ + + self.status = None + """ active | suspended | inactive. + Type `str`. """ + + self.telecom = None + """ Contact details of the location. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + self.type = None + """ Type of function performed. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(Location, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Location, self).elementProperties() + js.extend([ + ("address", "address", address.Address, False, None, False), + ("alias", "alias", str, True, None, False), + ("description", "description", str, False, None, False), + ("endpoint", "endpoint", fhirreference.FHIRReference, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("managingOrganization", "managingOrganization", fhirreference.FHIRReference, False, None, False), + ("mode", "mode", str, False, None, False), + ("name", "name", str, False, None, False), + ("operationalStatus", "operationalStatus", coding.Coding, False, None, False), + ("partOf", "partOf", fhirreference.FHIRReference, False, None, False), + ("physicalType", "physicalType", codeableconcept.CodeableConcept, False, None, False), + ("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), + ]) + return js + + +from . import backboneelement + +class LocationPosition(backboneelement.BackboneElement): + """ The absolute geographic location. + + The absolute geographic location of the Location, expressed using the WGS84 + datum (This is the same co-ordinate system used in KML). + """ + + resource_type = "LocationPosition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.altitude = None + """ Altitude with WGS84 datum. + Type `float`. """ + + self.latitude = None + """ Latitude with WGS84 datum. + Type `float`. """ + + self.longitude = None + """ Longitude with WGS84 datum. + Type `float`. """ + + super(LocationPosition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(LocationPosition, self).elementProperties() + js.extend([ + ("altitude", "altitude", float, False, None, False), + ("latitude", "latitude", float, False, None, True), + ("longitude", "longitude", float, False, None, True), + ]) + 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 coding +except ImportError: + coding = sys.modules[__package__ + '.coding'] +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'] diff --git a/fhirclient/models/STU3/location_tests.py b/fhirclient/models/STU3/location_tests.py new file mode 100644 index 000000000..4a141717f --- /dev/null +++ b/fhirclient/models/STU3/location_tests.py @@ -0,0 +1,217 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import location +from .fhirdate import FHIRDate + + +class LocationTests(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("Location", js["resourceType"]) + return location.Location(js) + + def testLocation1(self): + inst = self.instantiate_from("location-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Location instance") + self.implLocation1(inst) + + js = inst.as_json() + self.assertEqual("Location", js["resourceType"]) + inst2 = location.Location(js) + self.implLocation1(inst2) + + def implLocation1(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.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.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[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") + + def testLocation2(self): + inst = self.instantiate_from("location-example-room.json") + self.assertIsNotNone(inst, "Must have instantiated a Location instance") + self.implLocation2(inst) + + js = inst.as_json() + self.assertEqual("Location", js["resourceType"]) + inst2 = location.Location(js) + self.implLocation2(inst2) + + def implLocation2(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.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") + + def testLocation3(self): + inst = self.instantiate_from("location-example-ambulance.json") + self.assertIsNotNone(inst, "Must have instantiated a Location instance") + self.implLocation3(inst) + + js = inst.as_json() + self.assertEqual("Location", js["resourceType"]) + inst2 = location.Location(js) + self.implLocation3(inst2) + + def implLocation3(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.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.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 testLocation4(self): + inst = self.instantiate_from("location-example-ukpharmacy.json") + self.assertIsNotNone(inst, "Must have instantiated a Location instance") + self.implLocation4(inst) + + js = inst.as_json() + self.assertEqual("Location", js["resourceType"]) + inst2 = location.Location(js) + self.implLocation4(inst2) + + def implLocation4(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.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.status, "active") + self.assertEqual(inst.text.div, "
UK Pharmacies
") + 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") + + def testLocation5(self): + inst = self.instantiate_from("location-example-patients-home.json") + self.assertIsNotNone(inst, "Must have instantiated a Location instance") + self.implLocation5(inst) + + js = inst.as_json() + self.assertEqual("Location", js["resourceType"]) + inst2 = location.Location(js) + self.implLocation5(inst2) + + def implLocation5(self, inst): + self.assertEqual(inst.description, "Patient's Home") + self.assertEqual(inst.id, "ph") + 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.status, "active") + self.assertEqual(inst.text.div, "
Patient's Home
") + 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") + + def testLocation6(self): + inst = self.instantiate_from("location-example-hl7hq.json") + self.assertIsNotNone(inst, "Must have instantiated a Location instance") + self.implLocation6(inst) + + js = inst.as_json() + self.assertEqual("Location", js["resourceType"]) + inst2 = location.Location(js) + self.implLocation6(inst2) + + def implLocation6(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.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.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.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") + diff --git a/fhirclient/models/STU3/measure.py b/fhirclient/models/STU3/measure.py new file mode 100644 index 000000000..4e6f14ff2 --- /dev/null +++ b/fhirclient/models/STU3/measure.py @@ -0,0 +1,453 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Measure) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Measure(domainresource.DomainResource): + """ A quality measure definition. + + The Measure resource provides the definition of a quality measure. + """ + + resource_type = "Measure" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 measure was approved by publisher. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.clinicalRecommendationStatement = None + """ Summary of clinical guidelines. + Type `str`. """ + + self.compositeScoring = None + """ opportunity | all-or-nothing | linear | weighted. + 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.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. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.definition = None + """ Defined terms used in the measure documentation. + List of `str` items. """ + + self.description = None + """ Natural language description of the measure. + Type `str`. """ + + self.disclaimer = None + """ Disclaimer for use of the measure or its referenced content. + Type `str`. """ + + self.effectivePeriod = None + """ When the measure is expected to be used. + Type `Period` (represented as `dict` in JSON). """ + + self.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.group = None + """ Population criteria group. + List of `MeasureGroup` items (represented as `dict` in JSON). """ + + self.guidance = None + """ Additional guidance for implementers. + Type `str`. """ + + self.identifier = None + """ Additional identifier for the measure. + 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`. """ + + self.jurisdiction = None + """ Intended jurisdiction for measure (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.lastReviewDate = None + """ When the measure was last reviewed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.library = None + """ Logic used by the measure. + List of `FHIRReference` items referencing `Library` (represented as `dict` in JSON). """ + + self.name = None + """ Name for this measure (computer friendly). + Type `str`. """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this measure is defined. + Type `str`. """ + + self.rateAggregation = None + """ How is rate aggregation performed for this measure. + Type `str`. """ + + self.rationale = None + """ Why does this measure exist. + Type `str`. """ + + self.relatedArtifact = None + """ Additional documentation, citations, etc. + List of `RelatedArtifact` items (represented as `dict` in JSON). """ + + self.riskAdjustment = None + """ How is risk adjustment 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.supplementalData = None + """ What other data should be reported with the measure. + List of `MeasureSupplementalData` items (represented as `dict` in JSON). """ + + self.title = None + """ Name for this measure (human friendly). + Type `str`. """ + + self.topic = None + """ E.g. Education, Treatment, Assessment, etc. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.type = None + """ process | outcome | structure | patient-reported-outcome | + composite. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.url = None + """ Logical URI to reference this measure (globally unique). + Type `str`. """ + + self.usage = None + """ Describes the clinical usage of the measure. + 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 measure. + Type `str`. """ + + super(Measure, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Measure, self).elementProperties() + js.extend([ + ("approvalDate", "approvalDate", fhirdate.FHIRDate, False, 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), + ("effectivePeriod", "effectivePeriod", period.Period, False, 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), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("lastReviewDate", "lastReviewDate", fhirdate.FHIRDate, False, None, False), + ("library", "library", fhirreference.FHIRReference, 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), + ("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), + ("supplementalData", "supplementalData", MeasureSupplementalData, True, None, False), + ("title", "title", str, False, None, False), + ("topic", "topic", codeableconcept.CodeableConcept, True, None, False), + ("type", "type", 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 + + +from . import backboneelement + +class MeasureGroup(backboneelement.BackboneElement): + """ Population criteria group. + + A group of population criteria for the measure. + """ + + resource_type = "MeasureGroup" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ 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). """ + + self.stratifier = None + """ Stratifier criteria for the measure. + List of `MeasureGroupStratifier` items (represented as `dict` in JSON). """ + + super(MeasureGroup, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MeasureGroup, self).elementProperties() + js.extend([ + ("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), + ]) + return js + + +class MeasureGroupPopulation(backboneelement.BackboneElement): + """ Population criteria. + + A population criteria for the measure. + """ + + resource_type = "MeasureGroupPopulation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ initial-population | numerator | numerator-exclusion | denominator + | denominator-exclusion | denominator-exception | measure- + population | measure-population-exclusion | measure-observation. + 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`. """ + + 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), + ("description", "description", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("name", "name", str, False, None, False), + ]) + return js + + +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 + valid FHIR Resource Path. + """ + + resource_type = "MeasureGroupStratifier" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + 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). """ + + self.path = None + """ Path to the stratifier. + Type `str`. """ + + super(MeasureGroupStratifier, self).__init__(jsondict=jsondict, strict=strict) + + 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), + ]) + return js + + +class MeasureSupplementalData(backboneelement.BackboneElement): + """ What other data should be reported with the measure. + + The supplemental data criteria for the measure report, specified as either + the name of a valid CQL expression within a referenced library, or a valid + FHIR Resource Path. + """ + + resource_type = "MeasureSupplementalData" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.criteria = None + """ Expression describing additional data to be reported. + Type `str`. """ + + self.identifier = None + """ Identifier, unique within the measure. + Type `Identifier` (represented as `dict` in JSON). """ + + self.path = None + """ Path to the supplemental data element. + Type `str`. """ + + self.usage = None + """ supplemental-data | risk-adjustment-factor. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(MeasureSupplementalData, self).__init__(jsondict=jsondict, strict=strict) + + 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), + ("usage", "usage", codeableconcept.CodeableConcept, 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 contributor +except ImportError: + contributor = sys.modules[__package__ + '.contributor'] +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/STU3/measure_tests.py b/fhirclient/models/STU3/measure_tests.py new file mode 100644 index 000000000..00af7a71b --- /dev/null +++ b/fhirclient/models/STU3/measure_tests.py @@ -0,0 +1,238 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import measure +from .fhirdate import FHIRDate + + +class MeasureTests(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("Measure", js["resourceType"]) + return measure.Measure(js) + + def testMeasure1(self): + inst = self.instantiate_from("measure-component-b-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Measure instance") + self.implMeasure1(inst) + + js = inst.as_json() + self.assertEqual("Measure", js["resourceType"]) + inst2 = measure.Measure(js) + self.implMeasure1(inst2) + + def implMeasure1(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 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].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.1") + + 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.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.") + 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-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].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[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[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[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.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") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "146") + 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.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.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].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].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.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.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.version, "1.0.0") + + def testMeasure4(self): + inst = self.instantiate_from("measure-component-a-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Measure instance") + self.implMeasure4(inst) + + js = inst.as_json() + self.assertEqual("Measure", js["resourceType"]) + inst2 = measure.Measure(js) + self.implMeasure4(inst2) + + def implMeasure4(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-a-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 Alcohol Misuse") + + def testMeasure5(self): + inst = self.instantiate_from("measure-composite-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.compositeScoring.coding[0].code, "opportunity") + self.assertEqual(inst.id, "composite-example") + self.assertEqual(inst.relatedArtifact[0].type, "composed-of") + 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") + diff --git a/fhirclient/models/STU3/measurereport.py b/fhirclient/models/STU3/measurereport.py new file mode 100644 index 000000000..6d02f13dc --- /dev/null +++ b/fhirclient/models/STU3/measurereport.py @@ -0,0 +1,327 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/MeasureReport) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class MeasureReport(domainresource.DomainResource): + """ Results of a measure evaluation. + + The MeasureReport resource contains the results of evaluating a measure. + """ + + resource_type = "MeasureReport" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ 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.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). """ + + self.measure = None + """ What measure was evaluated. + Type `FHIRReference` referencing `Measure` (represented as `dict` in JSON). """ + + self.patient = None + """ What patient the report is for. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.period = None + """ What period the report covers. + Type `Period` (represented as `dict` in JSON). """ + + self.reportingOrganization = None + """ Who is reporting the data. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.status = None + """ complete | pending | error. + Type `str`. """ + + self.type = None + """ individual | patient-list | summary. + Type `str`. """ + + super(MeasureReport, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MeasureReport, self).elementProperties() + js.extend([ + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("evaluatedResources", "evaluatedResources", fhirreference.FHIRReference, False, 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), + ("period", "period", period.Period, False, None, True), + ("reportingOrganization", "reportingOrganization", fhirreference.FHIRReference, False, None, False), + ("status", "status", str, False, None, True), + ("type", "type", str, False, None, True), + ]) + return js + + +from . import backboneelement + +class MeasureReportGroup(backboneelement.BackboneElement): + """ Measure results for each group. + + The results of the calculation, one for each population group in the + measure. + """ + + resource_type = "MeasureReportGroup" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ What group of the measure. + Type `Identifier` (represented as `dict` in JSON). """ + + self.measureScore = None + """ What score this group achieved. + Type `float`. """ + + self.population = None + """ The populations in the group. + List of `MeasureReportGroupPopulation` items (represented as `dict` in JSON). """ + + self.stratifier = None + """ Stratification results. + List of `MeasureReportGroupStratifier` items (represented as `dict` in JSON). """ + + super(MeasureReportGroup, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MeasureReportGroup, self).elementProperties() + js.extend([ + ("identifier", "identifier", identifier.Identifier, False, None, True), + ("measureScore", "measureScore", float, False, None, False), + ("population", "population", MeasureReportGroupPopulation, True, None, False), + ("stratifier", "stratifier", MeasureReportGroupStratifier, True, None, False), + ]) + return js + + +class MeasureReportGroupPopulation(backboneelement.BackboneElement): + """ The populations in the group. + + The populations that make up the population group, one for each type of + population appropriate for the measure. + """ + + resource_type = "MeasureReportGroupPopulation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ initial-population | numerator | numerator-exclusion | denominator + | denominator-exclusion | denominator-exception | measure- + population | measure-population-exclusion | measure-score. + 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). """ + + super(MeasureReportGroupPopulation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MeasureReportGroupPopulation, self).elementProperties() + 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), + ]) + return js + + +class MeasureReportGroupStratifier(backboneelement.BackboneElement): + """ Stratification results. + + When a measure includes multiple stratifiers, there will be a stratifier + group for each stratifier defined by the measure. + """ + + resource_type = "MeasureReportGroupStratifier" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ What stratifier of the group. + Type `Identifier` (represented as `dict` in JSON). """ + + self.stratum = None + """ Stratum results, one for each unique value in the stratifier. + List of `MeasureReportGroupStratifierStratum` items (represented as `dict` in JSON). """ + + super(MeasureReportGroupStratifier, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MeasureReportGroupStratifier, self).elementProperties() + js.extend([ + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("stratum", "stratum", MeasureReportGroupStratifierStratum, True, None, False), + ]) + return js + + +class MeasureReportGroupStratifierStratum(backboneelement.BackboneElement): + """ Stratum results, one for each unique value in the stratifier. + + This element contains the results for a single stratum within the + stratifier. For example, when stratifying on administrative gender, there + will be four strata, one for each possible gender value. + """ + + resource_type = "MeasureReportGroupStratifierStratum" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.measureScore = None + """ What score this stratum achieved. + Type `float`. """ + + self.population = None + """ Population results in this stratum. + List of `MeasureReportGroupStratifierStratumPopulation` items (represented as `dict` in JSON). """ + + self.value = None + """ The stratum value, e.g. male. + Type `str`. """ + + super(MeasureReportGroupStratifierStratum, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MeasureReportGroupStratifierStratum, self).elementProperties() + js.extend([ + ("measureScore", "measureScore", float, False, None, False), + ("population", "population", MeasureReportGroupStratifierStratumPopulation, True, None, False), + ("value", "value", str, False, None, True), + ]) + return js + + +class MeasureReportGroupStratifierStratumPopulation(backboneelement.BackboneElement): + """ Population results in this stratum. + + The populations that make up the stratum, one for each type of population + appropriate to the measure. + """ + + resource_type = "MeasureReportGroupStratifierStratumPopulation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ initial-population | numerator | numerator-exclusion | denominator + | denominator-exclusion | denominator-exception | measure- + population | measure-population-exclusion | measure-score. + 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). """ + + super(MeasureReportGroupStratifierStratumPopulation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MeasureReportGroupStratifierStratumPopulation, self).elementProperties() + 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), + ]) + 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/STU3/measurereport_tests.py b/fhirclient/models/STU3/measurereport_tests.py new file mode 100644 index 000000000..6b61ed759 --- /dev/null +++ b/fhirclient/models/STU3/measurereport_tests.py @@ -0,0 +1,341 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import measurereport +from .fhirdate import FHIRDate + + +class MeasureReportTests(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("MeasureReport", js["resourceType"]) + return measurereport.MeasureReport(js) + + def testMeasureReport1(self): + inst = self.instantiate_from("measurereport-cms146-cat1-example.json") + self.assertIsNotNone(inst, "Must have instantiated a MeasureReport instance") + self.implMeasureReport1(inst) + + js = inst.as_json() + self.assertEqual("MeasureReport", js["resourceType"]) + inst2 = measurereport.MeasureReport(js) + self.implMeasureReport1(inst2) + + def implMeasureReport1(self, inst): + self.assertEqual(inst.contained[0].id, "reporter") + self.assertEqual(inst.group[0].identifier.value, "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") + self.assertEqual(inst.group[0].population[1].count, 1) + self.assertEqual(inst.group[0].population[2].code.coding[0].code, "denominator") + 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].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") + self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[1].count, 1) + self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[2].code.coding[0].code, "denominator") + 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[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") + self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[1].count, 0) + self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[2].code.coding[0].code, "denominator") + 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[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") + self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[1].count, 0) + self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[2].code.coding[0].code, "denominator") + 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[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") + self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[1].count, 1) + self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[2].code.coding[0].code, "denominator") + 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[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") + self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[1].count, 1) + self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[2].code.coding[0].code, "denominator") + 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[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") + self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[1].count, 0) + self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[2].code.coding[0].code, "denominator") + 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[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") + self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[1].count, 0) + self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[2].code.coding[0].code, "denominator") + 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[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") + self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[1].count, 0) + self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[2].code.coding[0].code, "denominator") + 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.id, "measurereport-cms146-cat1-example") + self.assertEqual(inst.identifier.value, "measurereport-cms146-cat1-example-2017-03-13") + 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, "individual") + + def testMeasureReport2(self): + inst = self.instantiate_from("measurereport-cms146-cat2-example.json") + self.assertIsNotNone(inst, "Must have instantiated a MeasureReport instance") + self.implMeasureReport2(inst) + + js = inst.as_json() + self.assertEqual("MeasureReport", js["resourceType"]) + inst2 = measurereport.MeasureReport(js) + self.implMeasureReport2(inst2) + + def implMeasureReport2(self, inst): + self.assertEqual(inst.contained[0].id, "reporter") + self.assertEqual(inst.group[0].identifier.value, "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") + self.assertEqual(inst.group[0].population[1].count, 200) + self.assertEqual(inst.group[0].population[2].code.coding[0].code, "denominator") + 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].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") + self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[1].count, 100) + self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[2].code.coding[0].code, "denominator") + 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[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") + self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[1].count, 100) + self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[2].code.coding[0].code, "denominator") + 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[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") + self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[1].count, 100) + self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[2].code.coding[0].code, "denominator") + 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[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") + self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[1].count, 100) + self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[2].code.coding[0].code, "denominator") + 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[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") + self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[1].count, 100) + self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[2].code.coding[0].code, "denominator") + 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[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") + self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[1].count, 100) + self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[2].code.coding[0].code, "denominator") + 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[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") + self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[1].count, 0) + self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[2].code.coding[0].code, "denominator") + 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[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") + self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[1].count, 0) + self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[2].code.coding[0].code, "denominator") + 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.id, "measurereport-cms146-cat2-example") + self.assertEqual(inst.identifier.value, "measurereport-cms146-cat2-example-2017-03-13") + 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") + + def testMeasureReport3(self): + inst = self.instantiate_from("measurereport-cms146-cat3-example.json") + self.assertIsNotNone(inst, "Must have instantiated a MeasureReport instance") + self.implMeasureReport3(inst) + + js = inst.as_json() + self.assertEqual("MeasureReport", js["resourceType"]) + inst2 = measurereport.MeasureReport(js) + self.implMeasureReport3(inst2) + + def implMeasureReport3(self, inst): + self.assertEqual(inst.contained[0].id, "reporter") + self.assertEqual(inst.group[0].identifier.value, "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") + self.assertEqual(inst.group[0].population[1].count, 200) + self.assertEqual(inst.group[0].population[2].code.coding[0].code, "denominator") + 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].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") + self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[1].count, 100) + self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[2].code.coding[0].code, "denominator") + 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[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") + self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[1].count, 100) + self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[2].code.coding[0].code, "denominator") + 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[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") + self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[1].count, 100) + self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[2].code.coding[0].code, "denominator") + 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[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") + self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[1].count, 100) + self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[2].code.coding[0].code, "denominator") + 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[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") + self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[1].count, 100) + self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[2].code.coding[0].code, "denominator") + 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[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") + self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[1].count, 100) + self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[2].code.coding[0].code, "denominator") + 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[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") + self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[1].count, 0) + self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[2].code.coding[0].code, "denominator") + 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[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") + self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[1].count, 0) + self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[2].code.coding[0].code, "denominator") + 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.id, "measurereport-cms146-cat3-example") + self.assertEqual(inst.identifier.value, "measurereport-cms146-cat3-example-2017-03-13") + 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, "summary") + diff --git a/fhirclient/models/STU3/media.py b/fhirclient/models/STU3/media.py new file mode 100644 index 000000000..9234ccdbf --- /dev/null +++ b/fhirclient/models/STU3/media.py @@ -0,0 +1,157 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Media) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Media(domainresource.DomainResource): + """ A photo, video, or audio recording acquired or used in healthcare. The + actual content may be inline or provided by direct reference. + """ + + resource_type = "Media" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.basedOn = None + """ Procedure that caused this media to be created. + List of `FHIRReference` items referencing `ProcedureRequest` (represented as `dict` in JSON). """ + + self.bodySite = None + """ Body part in media. + 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.device = None + """ Observing Device. + Type `FHIRReference` referencing `Device, DeviceMetric` (represented as `dict` in JSON). """ + + self.duration = None + """ Length in seconds (audio / video). + Type `int`. """ + + self.frames = None + """ Number of frames if > 1 (photo). + Type `int`. """ + + self.height = None + """ Height of the image in pixels (photo/video). + Type `int`. """ + + self.identifier = None + """ Identifier(s) for the image. + List of `Identifier` items (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). """ + + self.reasonCode = None + """ Why was event performed?. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + 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). """ + + self.type = None + """ photo | video | audio. + Type `str`. """ + + self.view = None + """ Imaging view, e.g. Lateral or Antero-posterior. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.width = None + """ Width of the image in pixels (photo/video). + Type `int`. """ + + super(Media, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Media, self).elementProperties() + js.extend([ + ("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), + ("device", "device", fhirreference.FHIRReference, False, None, False), + ("duration", "duration", int, False, None, False), + ("frames", "frames", int, False, None, False), + ("height", "height", int, 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), + ("operator", "operator", fhirreference.FHIRReference, False, None, False), + ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ("subtype", "subtype", codeableconcept.CodeableConcept, False, None, False), + ("type", "type", str, False, None, True), + ("view", "view", codeableconcept.CodeableConcept, False, None, False), + ("width", "width", int, False, None, False), + ]) + return js + + +import sys +try: + from . import annotation +except ImportError: + annotation = sys.modules[__package__ + '.annotation'] +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 period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/STU3/media_tests.py b/fhirclient/models/STU3/media_tests.py new file mode 100644 index 000000000..555e6f618 --- /dev/null +++ b/fhirclient/models/STU3/media_tests.py @@ -0,0 +1,137 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import media +from .fhirdate import FHIRDate + + +class MediaTests(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("Media", js["resourceType"]) + return media.Media(js) + + def testMedia1(self): + inst = self.instantiate_from("media-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Media instance") + self.implMedia1(inst) + + js = inst.as_json() + self.assertEqual("Media", js["resourceType"]) + inst2 = media.Media(js) + 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.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.text.status, "generated") + self.assertEqual(inst.type, "photo") + 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.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[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].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].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.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 testMedia3(self): + inst = self.instantiate_from("media-example-xray.json") + self.assertIsNotNone(inst, "Must have instantiated a Media instance") + self.implMedia3(inst) + + js = inst.as_json() + self.assertEqual("Media", js["resourceType"]) + inst2 = media.Media(js) + self.implMedia3(inst2) + + 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.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.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.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-sound.json") + self.assertIsNotNone(inst, "Must have instantiated a Media instance") + self.implMedia4(inst) + + js = inst.as_json() + self.assertEqual("Media", js["resourceType"]) + inst2 = media.Media(js) + self.implMedia4(inst2) + + def implMedia4(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") + diff --git a/fhirclient/models/STU3/medication.py b/fhirclient/models/STU3/medication.py new file mode 100644 index 000000000..a0f630104 --- /dev/null +++ b/fhirclient/models/STU3/medication.py @@ -0,0 +1,268 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Medication) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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. + """ + + resource_type = "Medication" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 that identify this medication. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.form = None + """ 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.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). """ + + self.status = None + """ active | inactive | entered-in-error. + Type `str`. """ + + super(Medication, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Medication, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("form", "form", codeableconcept.CodeableConcept, False, None, False), + ("image", "image", attachment.Attachment, 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 + + +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): + """ 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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.expirationDate = None + """ When batch will expire. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.lotNumber = None + """ Identifier assigned to batch. + Type `str`. """ + + super(MedicationPackageBatch, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationPackageBatch, self).elementProperties() + js.extend([ + ("expirationDate", "expirationDate", fhirdate.FHIRDate, False, None, False), + ("lotNumber", "lotNumber", str, False, None, False), + ]) + return js + + +class MedicationPackageContent(backboneelement.BackboneElement): + """ What is in the package. + + A set of components that go to make up the described item. + """ + + resource_type = "MedicationPackageContent" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 present in the package. + Type `Quantity` (represented as `dict` in JSON). """ + + self.itemCodeableConcept = None + """ The item in the package. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.itemReference = None + """ The item in the package. + Type `FHIRReference` referencing `Medication` (represented as `dict` in JSON). """ + + super(MedicationPackageContent, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationPackageContent, self).elementProperties() + js.extend([ + ("amount", "amount", quantity.Quantity, False, None, False), + ("itemCodeableConcept", "itemCodeableConcept", codeableconcept.CodeableConcept, False, "item", True), + ("itemReference", "itemReference", fhirreference.FHIRReference, False, "item", True), + ]) + 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 quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] +try: + from . import ratio +except ImportError: + ratio = sys.modules[__package__ + '.ratio'] diff --git a/fhirclient/models/STU3/medicationadministration.py b/fhirclient/models/STU3/medicationadministration.py new file mode 100644 index 000000000..0942222ae --- /dev/null +++ b/fhirclient/models/STU3/medicationadministration.py @@ -0,0 +1,282 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/MedicationAdministration) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class MedicationAdministration(domainresource.DomainResource): + """ Administration of medication to a patient. + + Describes the event of a patient consuming or otherwise being administered + a medication. This may be as simple as swallowing a tablet or it may be a + long running infusion. Related resources tie this event to the authorizing + prescription, and the specific encounter between patient and health care + practitioner. + """ + + resource_type = "MedicationAdministration" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Type of medication usage. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + 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). """ + + self.device = None + """ Device used to administer. + List of `FHIRReference` items referencing `Device` (represented as `dict` in JSON). """ + + self.dosage = None + """ Details of how medication was taken. + Type `MedicationAdministrationDosage` (represented as `dict` in JSON). """ + + self.effectiveDateTime = None + """ Start and end time of administration. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.effectivePeriod = None + """ Start and end time of administration. + Type `Period` (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). """ + + self.identifier = None + """ External identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + 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`. """ + + self.note = None + """ Information about the administration. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.partOf = None + """ Part of referenced event. + List of `FHIRReference` items referencing `MedicationAdministration, Procedure` (represented as `dict` in JSON). """ + + self.performer = None + """ Who administered substance. + 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 + administered. + List of `FHIRReference` items referencing `Condition, Observation` (represented as `dict` in JSON). """ + + self.status = None + """ in-progress | on-hold | completed | entered-in-error | stopped | + unknown. + Type `str`. """ + + self.subject = None + """ Who received medication. + Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ + + self.supportingInformation = None + """ Additional information to support administration. + List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + + super(MedicationAdministration, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationAdministration, self).elementProperties() + 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), + ("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), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, True), + ("supportingInformation", "supportingInformation", fhirreference.FHIRReference, True, None, False), + ]) + return js + + +from . import backboneelement + +class MedicationAdministrationDosage(backboneelement.BackboneElement): + """ Details of how medication was taken. + + Describes the medication dosage information details e.g. dose, rate, site, + route, etc. + """ + + resource_type = "MedicationAdministrationDosage" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.dose = None + """ Amount of medication per dose. + Type `Quantity` (represented as `dict` in JSON). """ + + self.method = None + """ How drug was administered. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.rateQuantity = None + """ Dose quantity per unit of time. + Type `Quantity` (represented as `dict` in JSON). """ + + self.rateRatio = None + """ Dose quantity per unit of time. + Type `Ratio` (represented as `dict` in JSON). """ + + self.route = None + """ Path of substance into body. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.site = None + """ Body site administered to. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.text = None + """ Free text dosage instructions e.g. SIG. + Type `str`. """ + + super(MedicationAdministrationDosage, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationAdministrationDosage, self).elementProperties() + js.extend([ + ("dose", "dose", quantity.Quantity, False, None, False), + ("method", "method", codeableconcept.CodeableConcept, False, None, False), + ("rateQuantity", "rateQuantity", quantity.Quantity, False, "rate", False), + ("rateRatio", "rateRatio", ratio.Ratio, False, "rate", False), + ("route", "route", codeableconcept.CodeableConcept, False, None, False), + ("site", "site", codeableconcept.CodeableConcept, False, None, False), + ("text", "text", str, False, None, False), + ]) + return js + + +class MedicationAdministrationPerformer(backboneelement.BackboneElement): + """ Who administered substance. + + The individual who was responsible for giving the medication to the + patient. + """ + + resource_type = "MedicationAdministrationPerformer" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 performing. + Type `FHIRReference` referencing `Practitioner, Patient, RelatedPerson, Device` (represented as `dict` in JSON). """ + + self.onBehalfOf = None + """ Organization organization was acting for. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + super(MedicationAdministrationPerformer, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationAdministrationPerformer, self).elementProperties() + js.extend([ + ("actor", "actor", 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'] +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/STU3/medicationdispense.py b/fhirclient/models/STU3/medicationdispense.py new file mode 100644 index 000000000..9f7d1025e --- /dev/null +++ b/fhirclient/models/STU3/medicationdispense.py @@ -0,0 +1,287 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/MedicationDispense) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class MedicationDispense(domainresource.DomainResource): + """ Dispensing a medication to a named patient. + + Indicates that a medication product is to be or has been dispensed for a + named person/patient. This includes a description of the medication + product (supply) provided and the instructions for administering the + medication. The medication dispense is the result of a pharmacy system + responding to a medication order. + """ + + resource_type = "MedicationDispense" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.authorizingPrescription = None + """ Medication order that authorizes the dispense. + List of `FHIRReference` items referencing `MedicationRequest` (represented as `dict` in JSON). """ + + self.category = None + """ Type of medication dispense. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.context = None + """ Encounter / Episode associated with event. + Type `FHIRReference` referencing `Encounter, EpisodeOfCare` (represented as `dict` in JSON). """ + + self.daysSupply = None + """ Amount of medication expressed as a timing amount. + Type `Quantity` (represented as `dict` in JSON). """ + + self.destination = None + """ Where the medication was sent. + Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + + self.detectedIssue = None + """ Clinical issue with action. + List of `FHIRReference` items referencing `DetectedIssue` (represented as `dict` in JSON). """ + + self.dosageInstruction = None + """ How the medication is to be used by the patient or administered by + the caregiver. + 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). """ + + self.identifier = None + """ External identifier. + List of `Identifier` items (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). """ + + self.note = None + """ Information about the dispense. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.partOf = None + """ Event that dispense is part of. + List of `FHIRReference` items referencing `Procedure` (represented as `dict` in JSON). """ + + self.performer = None + """ Who performed event. + List of `MedicationDispensePerformer` items (represented as `dict` in JSON). """ + + self.quantity = None + """ Amount dispensed. + Type `Quantity` (represented as `dict` in JSON). """ + + self.receiver = None + """ Who collected the medication. + List of `FHIRReference` items referencing `Patient, Practitioner` (represented as `dict` in JSON). """ + + self.status = None + """ preparation | in-progress | on-hold | completed | entered-in-error + | stopped. + Type `str`. """ + + self.subject = None + """ Who the dispense is for. + Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ + + self.substitution = None + """ Whether a substitution was performed on the dispense. + Type `MedicationDispenseSubstitution` (represented as `dict` in JSON). """ + + self.supportingInformation = None + """ Information that supports the dispensing of the medication. + List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + + self.type = None + """ Trial fill, partial fill, emergency fill, etc.. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.whenHandedOver = None + """ When product was given out. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.whenPrepared = None + """ When product was packaged and reviewed. + Type `FHIRDate` (represented as `str` in JSON). """ + + super(MedicationDispense, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationDispense, self).elementProperties() + js.extend([ + ("authorizingPrescription", "authorizingPrescription", fhirreference.FHIRReference, True, None, False), + ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("context", "context", fhirreference.FHIRReference, False, None, False), + ("daysSupply", "daysSupply", quantity.Quantity, False, None, False), + ("destination", "destination", fhirreference.FHIRReference, False, None, False), + ("detectedIssue", "detectedIssue", fhirreference.FHIRReference, True, None, False), + ("dosageInstruction", "dosageInstruction", dosage.Dosage, True, None, False), + ("eventHistory", "eventHistory", fhirreference.FHIRReference, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, 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), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ("substitution", "substitution", MedicationDispenseSubstitution, False, None, False), + ("supportingInformation", "supportingInformation", fhirreference.FHIRReference, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("whenHandedOver", "whenHandedOver", fhirdate.FHIRDate, False, None, False), + ("whenPrepared", "whenPrepared", fhirdate.FHIRDate, False, None, False), + ]) + return js + + +from . import backboneelement + +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. + """ + + resource_type = "MedicationDispensePerformer" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 performing. + Type `FHIRReference` referencing `Practitioner, Organization, Patient, Device, RelatedPerson` (represented as `dict` in JSON). """ + + self.onBehalfOf = None + """ Organization organization was acting for. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + super(MedicationDispensePerformer, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationDispensePerformer, self).elementProperties() + js.extend([ + ("actor", "actor", fhirreference.FHIRReference, False, None, True), + ("onBehalfOf", "onBehalfOf", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +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 + 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. + """ + + resource_type = "MedicationDispenseSubstitution" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.reason = None + """ Why was substitution made. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.responsibleParty = None + """ Who is responsible for the substitution. + List of `FHIRReference` items referencing `Practitioner` (represented as `dict` in JSON). """ + + self.type = None + """ Code signifying whether a different drug was dispensed from what + was prescribed. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.wasSubstituted = None + """ Whether a substitution was or was not performed on the dispense. + Type `bool`. """ + + super(MedicationDispenseSubstitution, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationDispenseSubstitution, self).elementProperties() + js.extend([ + ("reason", "reason", codeableconcept.CodeableConcept, True, None, False), + ("responsibleParty", "responsibleParty", fhirreference.FHIRReference, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("wasSubstituted", "wasSubstituted", bool, 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 dosage +except ImportError: + dosage = sys.modules[__package__ + '.dosage'] +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'] diff --git a/fhirclient/models/STU3/medicationrequest.py b/fhirclient/models/STU3/medicationrequest.py new file mode 100644 index 000000000..1fd5a893b --- /dev/null +++ b/fhirclient/models/STU3/medicationrequest.py @@ -0,0 +1,334 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/MedicationRequest) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class MedicationRequest(domainresource.DomainResource): + """ Ordering of medication for patient or group. + + An order or request for both supply of the medication and the instructions + for administration of the medication to a patient. The resource is called + "MedicationRequest" rather than "MedicationPrescription" or + "MedicationOrder" to generalize the use across inpatient and outpatient + settings, including care plans, etc., and to harmonize with workflow + patterns. + """ + + resource_type = "MedicationRequest" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ When request was initially authored. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.basedOn = None + """ What request fulfills. + List of `FHIRReference` items referencing `CarePlan, MedicationRequest, ProcedureRequest, ReferralRequest` (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). """ + + self.definition = None + """ Protocol or definition. + List of `FHIRReference` items referencing `ActivityDefinition, PlanDefinition` (represented as `dict` in JSON). """ + + self.detectedIssue = None + """ Clinical Issue with action. + List of `FHIRReference` items referencing `DetectedIssue` (represented as `dict` in JSON). """ + + self.dispenseRequest = None + """ Medication supply authorization. + Type `MedicationRequestDispenseRequest` (represented as `dict` in JSON). """ + + self.dosageInstruction = None + """ How the medication should be taken. + List of `Dosage` items (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). """ + + self.groupIdentifier = None + """ Composite request this is part of. + Type `Identifier` (represented as `dict` in JSON). """ + + self.identifier = None + """ External ids for this request. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.intent = None + """ proposal | plan | order | instance-order. + Type `str`. """ + + self.medicationCodeableConcept = None + """ Medication to be taken. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.medicationReference = None + """ Medication to be taken. + Type `FHIRReference` referencing `Medication` (represented as `dict` in JSON). """ + + self.note = None + """ Information about the prescription. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.priorPrescription = None + """ An order/prescription that is being replaced. + Type `FHIRReference` referencing `MedicationRequest` (represented as `dict` in JSON). """ + + self.priority = None + """ routine | urgent | stat | asap. + Type `str`. """ + + self.reasonCode = None + """ Reason or indication for writing the prescription. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.reasonReference = None + """ Condition or Observation that supports why the prescription is + being written. + List of `FHIRReference` items referencing `Condition, Observation` (represented as `dict` in JSON). """ + + self.recorder = None + """ Person who entered the request. + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + self.requester = None + """ Who/What requested the Request. + Type `MedicationRequestRequester` (represented as `dict` in JSON). """ + + self.status = None + """ active | on-hold | cancelled | completed | entered-in-error | + stopped | draft | unknown. + Type `str`. """ + + self.subject = None + """ Who or group medication request is for. + Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ + + self.substitution = None + """ Any restrictions on medication substitution. + Type `MedicationRequestSubstitution` (represented as `dict` in JSON). """ + + self.supportingInformation = None + """ Information to support ordering of the medication. + List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + + super(MedicationRequest, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationRequest, self).elementProperties() + 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), + ("detectedIssue", "detectedIssue", fhirreference.FHIRReference, True, None, False), + ("dispenseRequest", "dispenseRequest", MedicationRequestDispenseRequest, False, None, False), + ("dosageInstruction", "dosageInstruction", dosage.Dosage, True, None, False), + ("eventHistory", "eventHistory", fhirreference.FHIRReference, True, None, False), + ("groupIdentifier", "groupIdentifier", identifier.Identifier, False, None, False), + ("identifier", "identifier", identifier.Identifier, 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), + ("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), + ("subject", "subject", fhirreference.FHIRReference, False, None, True), + ("substitution", "substitution", MedicationRequestSubstitution, False, None, False), + ("supportingInformation", "supportingInformation", fhirreference.FHIRReference, True, None, False), + ]) + return js + + +from . import backboneelement + +class MedicationRequestDispenseRequest(backboneelement.BackboneElement): + """ Medication supply authorization. + + Indicates the specific details for the dispense or medication supply part + of a medication request (also known as a Medication Prescription or + Medication Order). Note that this information is not always sent with the + order. There may be in some settings (e.g. hospitals) institutional or + system support for completing the dispense details in the pharmacy + department. + """ + + resource_type = "MedicationRequestDispenseRequest" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.expectedSupplyDuration = None + """ Number of days supply per dispense. + Type `Duration` (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). """ + + self.quantity = None + """ Amount of medication to supply per dispense. + Type `Quantity` (represented as `dict` in JSON). """ + + self.validityPeriod = None + """ Time period supply is authorized for. + Type `Period` (represented as `dict` in JSON). """ + + super(MedicationRequestDispenseRequest, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationRequestDispenseRequest, self).elementProperties() + js.extend([ + ("expectedSupplyDuration", "expectedSupplyDuration", duration.Duration, False, None, False), + ("numberOfRepeatsAllowed", "numberOfRepeatsAllowed", int, False, None, False), + ("performer", "performer", fhirreference.FHIRReference, False, None, False), + ("quantity", "quantity", quantity.Quantity, False, None, False), + ("validityPeriod", "validityPeriod", period.Period, False, None, False), + ]) + return js + + +class MedicationRequestRequester(backboneelement.BackboneElement): + """ Who/What requested the Request. + + The individual, organization or device that initiated the request and has + responsibility for its activation. + """ + + resource_type = "MedicationRequestRequester" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Who ordered the initial medication(s). + 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(MedicationRequestRequester, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationRequestRequester, self).elementProperties() + js.extend([ + ("agent", "agent", fhirreference.FHIRReference, False, None, True), + ("onBehalfOf", "onBehalfOf", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +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 + substitution must not happen. This block explains the prescriber's intent. + If nothing is specified substitution may be done. + """ + + resource_type = "MedicationRequestSubstitution" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Whether substitution is allowed or not. + Type `bool`. """ + + self.reason = None + """ Why should (not) substitution be made. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(MedicationRequestSubstitution, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationRequestSubstitution, self).elementProperties() + js.extend([ + ("allowed", "allowed", bool, False, None, True), + ("reason", "reason", 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 dosage +except ImportError: + dosage = sys.modules[__package__ + '.dosage'] +try: + from . import duration +except ImportError: + duration = sys.modules[__package__ + '.duration'] +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 quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/STU3/medicationstatement.py b/fhirclient/models/STU3/medicationstatement.py new file mode 100644 index 000000000..3216fb4c1 --- /dev/null +++ b/fhirclient/models/STU3/medicationstatement.py @@ -0,0 +1,189 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/MedicationStatement) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class MedicationStatement(domainresource.DomainResource): + """ Record of medication being taken by a patient. + + 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 + 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 + + The primary difference between a medication statement and a medication + administration is that the medication administration has complete + administration information and is based on actual administration + information from the person who administered the medication. A medication + statement is often, if not always, less specific. There is no required + date/time when the medication was administered, in fact we only know that a + source has reported the patient is taking this medication, where details + such as time, quantity, or rate or even medication product may be + incomplete or missing or less precise. As stated earlier, the medication + statement information may come from the patient's memory, from a + prescription bottle or from a list of medications the patient, clinician or + other party maintains. Medication administration is more formal and is not + missing detailed information. + """ + + resource_type = "MedicationStatement" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.basedOn = None + """ Fulfils plan, proposal or order. + List of `FHIRReference` items referencing `MedicationRequest, CarePlan, ProcedureRequest, ReferralRequest` (represented as `dict` in JSON). """ + + self.category = None + """ Type of medication usage. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.context = None + """ Encounter / Episode associated with MedicationStatement. + Type `FHIRReference` referencing `Encounter, EpisodeOfCare` (represented as `dict` in JSON). """ + + self.dateAsserted = None + """ When the statement was asserted?. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.derivedFrom = None + """ Additional supporting information. + List of `FHIRReference` items referencing `Resource` (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. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.effectivePeriod = None + """ The date/time or interval when the medication was taken. + Type `Period` (represented as `dict` in JSON). """ + + self.identifier = None + """ External identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + 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). """ + + self.medicationCodeableConcept = None + """ What medication was taken. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.medicationReference = None + """ What medication was taken. + Type `FHIRReference` referencing `Medication` (represented as `dict` in JSON). """ + + self.note = None + """ Further information about the statement. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.partOf = None + """ Part of referenced event. + List of `FHIRReference` items referencing `MedicationAdministration, MedicationDispense, MedicationStatement, Procedure, Observation` (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). """ + + self.status = None + """ active | completed | entered-in-error | intended | stopped | on- + hold. + Type `str`. """ + + 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`. """ + + super(MedicationStatement, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationStatement, self).elementProperties() + js.extend([ + ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), + ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("context", "context", fhirreference.FHIRReference, False, None, False), + ("dateAsserted", "dateAsserted", fhirdate.FHIRDate, False, None, False), + ("derivedFrom", "derivedFrom", fhirreference.FHIRReference, True, None, False), + ("dosage", "dosage", dosage.Dosage, True, None, False), + ("effectiveDateTime", "effectiveDateTime", fhirdate.FHIRDate, False, "effective", False), + ("effectivePeriod", "effectivePeriod", period.Period, False, "effective", False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("informationSource", "informationSource", fhirreference.FHIRReference, False, None, False), + ("medicationCodeableConcept", "medicationCodeableConcept", codeableconcept.CodeableConcept, False, "medication", True), + ("medicationReference", "medicationReference", fhirreference.FHIRReference, False, "medication", True), + ("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), + ("subject", "subject", fhirreference.FHIRReference, False, None, True), + ("taken", "taken", 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 dosage +except ImportError: + dosage = sys.modules[__package__ + '.dosage'] +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/STU3/messagedefinition.py b/fhirclient/models/STU3/messagedefinition.py new file mode 100644 index 000000000..7bc772b68 --- /dev/null +++ b/fhirclient/models/STU3/messagedefinition.py @@ -0,0 +1,266 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/MessageDefinition) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class MessageDefinition(domainresource.DomainResource): + """ A resource that defines a type of message that can be exchanged between + systems. + + Defines the characteristics of a message that can be shared between + systems, including the type of event that initiates the message, the + content to be transmitted and what response(s), if any, are permitted. + """ + + resource_type = "MessageDefinition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.allowedResponse = None + """ Responses to this message. + List of `MessageDefinitionAllowedResponse` items (represented as `dict` in JSON). """ + + self.base = None + """ Definition this one is based on. + Type `FHIRReference` referencing `MessageDefinition` (represented as `dict` in JSON). """ + + self.category = None + """ Consequence | Currency | Notification. + Type `str`. """ + + 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.description = None + """ Natural language description of the message definition. + Type `str`. """ + + self.event = None + """ Event type. + Type `Coding` (represented as `dict` in JSON). """ + + self.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.focus = None + """ Resource(s) that are the subject of the event. + List of `MessageDefinitionFocus` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Additional identifier for the message definition. + Type `Identifier` (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ Intended jurisdiction for message definition (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.name = None + """ Name for this message definition (computer friendly). + Type `str`. """ + + self.parent = None + """ Protocol/workflow this is part of. + List of `FHIRReference` items referencing `ActivityDefinition, PlanDefinition` (represented as `dict` in JSON). """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this message definition is defined. + Type `str`. """ + + self.replaces = None + """ Takes the place of. + List of `FHIRReference` items referencing `MessageDefinition` (represented as `dict` in JSON). """ + + self.responseRequired = None + """ Is a response required?. + Type `bool`. """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.title = None + """ Name for this message definition (human friendly). + Type `str`. """ + + self.url = None + """ Logical URI to reference this message definition (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 message definition. + Type `str`. """ + + super(MessageDefinition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MessageDefinition, self).elementProperties() + js.extend([ + ("allowedResponse", "allowedResponse", MessageDefinitionAllowedResponse, True, None, False), + ("base", "base", fhirreference.FHIRReference, 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), + ("experimental", "experimental", bool, False, None, False), + ("focus", "focus", MessageDefinitionFocus, True, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("name", "name", str, False, None, False), + ("parent", "parent", fhirreference.FHIRReference, 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), + ("status", "status", str, False, None, True), + ("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 MessageDefinitionAllowedResponse(backboneelement.BackboneElement): + """ Responses to this message. + + Indicates what types of messages may be sent as an application-level + response to this message. + """ + + resource_type = "MessageDefinitionAllowedResponse" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.message = None + """ Reference to allowed message definition response. + Type `FHIRReference` referencing `MessageDefinition` (represented as `dict` in JSON). """ + + self.situation = None + """ When should this response be used. + Type `str`. """ + + super(MessageDefinitionAllowedResponse, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MessageDefinitionAllowedResponse, self).elementProperties() + js.extend([ + ("message", "message", fhirreference.FHIRReference, False, None, True), + ("situation", "situation", str, False, None, False), + ]) + return js + + +class MessageDefinitionFocus(backboneelement.BackboneElement): + """ Resource(s) that are the subject of the event. + + Identifies the resource (or resources) that are being addressed by the + event. For example, the Encounter for an admit message or two Account + records for a merge. + """ + + resource_type = "MessageDefinitionFocus" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 resource. + Type `str`. """ + + self.max = None + """ Maximum number of focuses of this type. + Type `str`. """ + + self.min = None + """ Minimum number of focuses of this type. + Type `int`. """ + + self.profile = None + """ Profile that must be adhered to by focus. + Type `FHIRReference` referencing `StructureDefinition` (represented as `dict` in JSON). """ + + super(MessageDefinitionFocus, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MessageDefinitionFocus, self).elementProperties() + 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), + ]) + 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 fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +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/STU3/messagedefinition_tests.py b/fhirclient/models/STU3/messagedefinition_tests.py new file mode 100644 index 000000000..2dd319152 --- /dev/null +++ b/fhirclient/models/STU3/messagedefinition_tests.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import messagedefinition +from .fhirdate import FHIRDate + + +class MessageDefinitionTests(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("MessageDefinition", js["resourceType"]) + return messagedefinition.MessageDefinition(js) + + def testMessageDefinition1(self): + inst = self.instantiate_from("messagedefinition-example.json") + self.assertIsNotNone(inst, "Must have instantiated a MessageDefinition instance") + self.implMessageDefinition1(inst) + + js = inst.as_json() + self.assertEqual("MessageDefinition", js["resourceType"]) + inst2 = messagedefinition.MessageDefinition(js) + self.implMessageDefinition1(inst2) + + def implMessageDefinition1(self, inst): + 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.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.status, "draft") + self.assertEqual(inst.text.div, "
Message definition base example
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "Message definition base example") + self.assertEqual(inst.url, "http://hl7.org/fhir/MessageDefinition/example") + diff --git a/fhirclient/models/STU3/messageheader.py b/fhirclient/models/STU3/messageheader.py new file mode 100644 index 000000000..c7fe4715f --- /dev/null +++ b/fhirclient/models/STU3/messageheader.py @@ -0,0 +1,252 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/MessageHeader) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class MessageHeader(domainresource.DomainResource): + """ A resource that describes a message that is exchanged between systems. + + The header for a message exchange that is either requesting or responding + to an action. The reference(s) that are the subject of the action as well + as other information related to the action are typically transmitted in a + bundle in which the MessageHeader resource instance is the first resource + in the bundle. + """ + + resource_type = "MessageHeader" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ The source of the decision. + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + self.destination = None + """ Message destination application(s). + List of `MessageHeaderDestination` items (represented as `dict` in JSON). """ + + self.enterer = None + """ The source of the data entry. + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + self.event = None + """ Code for the event this message represents. + Type `Coding` (represented as `dict` in JSON). """ + + self.focus = None + """ The actual content of the message. + List of `FHIRReference` items referencing `Resource` (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). """ + + self.sender = None + """ Real world sender of the message. + Type `FHIRReference` referencing `Practitioner, Organization` (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), + ("destination", "destination", MessageHeaderDestination, True, None, False), + ("enterer", "enterer", fhirreference.FHIRReference, False, None, False), + ("event", "event", coding.Coding, False, None, 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 + + +from . import backboneelement + +class MessageHeaderDestination(backboneelement.BackboneElement): + """ Message destination application(s). + + The destination application which the message is intended for. + """ + + resource_type = "MessageHeaderDestination" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Actual destination address or id. + Type `str`. """ + + self.name = None + """ Name of system. + Type `str`. """ + + self.target = None + """ Particular delivery destination within the destination. + Type `FHIRReference` referencing `Device` (represented as `dict` in JSON). """ + + super(MessageHeaderDestination, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MessageHeaderDestination, self).elementProperties() + js.extend([ + ("endpoint", "endpoint", str, False, None, True), + ("name", "name", str, False, None, False), + ("target", "target", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +class MessageHeaderResponse(backboneelement.BackboneElement): + """ If this is a reply to prior message. + + Information about the message that this message is a response to. Only + present if this message is a response. + """ + + resource_type = "MessageHeaderResponse" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ ok | transient-error | fatal-error. + Type `str`. """ + + self.details = None + """ Specific list of hints/warnings/errors. + Type `FHIRReference` referencing `OperationOutcome` (represented as `dict` in JSON). """ + + self.identifier = None + """ Id of original message. + Type `str`. """ + + super(MessageHeaderResponse, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MessageHeaderResponse, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("details", "details", fhirreference.FHIRReference, False, None, False), + ("identifier", "identifier", str, False, None, True), + ]) + return js + + +class MessageHeaderSource(backboneelement.BackboneElement): + """ Message source application. + + The source application from which this message originated. + """ + + resource_type = "MessageHeaderSource" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Human contact for problems. + Type `ContactPoint` (represented as `dict` in JSON). """ + + self.endpoint = None + """ Actual message source address or id. + Type `str`. """ + + self.name = None + """ Name of system. + Type `str`. """ + + self.software = None + """ Name of software running the system. + Type `str`. """ + + self.version = None + """ Version of software running. + Type `str`. """ + + super(MessageHeaderSource, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MessageHeaderSource, self).elementProperties() + js.extend([ + ("contact", "contact", contactpoint.ContactPoint, False, None, False), + ("endpoint", "endpoint", str, False, None, True), + ("name", "name", str, False, None, False), + ("software", "software", str, False, 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 coding +except ImportError: + coding = sys.modules[__package__ + '.coding'] +try: + 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: + fhirreference = sys.modules[__package__ + '.fhirreference'] diff --git a/fhirclient/models/STU3/messageheader_tests.py b/fhirclient/models/STU3/messageheader_tests.py new file mode 100644 index 000000000..d95507772 --- /dev/null +++ b/fhirclient/models/STU3/messageheader_tests.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import messageheader +from .fhirdate import FHIRDate + + +class MessageHeaderTests(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("MessageHeader", js["resourceType"]) + return messageheader.MessageHeader(js) + + def testMessageHeader1(self): + inst = self.instantiate_from("messageheader-example.json") + self.assertIsNotNone(inst, "Must have instantiated a MessageHeader instance") + self.implMessageHeader1(inst) + + js = inst.as_json() + self.assertEqual("MessageHeader", js["resourceType"]) + inst2 = messageheader.MessageHeader(js) + self.implMessageHeader1(inst2) + + def implMessageHeader1(self, inst): + 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.id, "1cbdfb97-5859-48a4-8301-d54eab818d68") + 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.response.code, "ok") + self.assertEqual(inst.response.identifier, "5015fe84-8e76-4526-89d8-44b322e8d4fb") + self.assertEqual(inst.source.contact.system, "phone") + self.assertEqual(inst.source.contact.value, "+1 (555) 123 4567") + self.assertEqual(inst.source.endpoint, "llp:10.11.12.13:5432") + self.assertEqual(inst.source.name, "Acme Central Patient Registry") + 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/STU3/meta.py b/fhirclient/models/STU3/meta.py new file mode 100644 index 000000000..3d0027993 --- /dev/null +++ b/fhirclient/models/STU3/meta.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Meta) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +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. + """ + + resource_type = "Meta" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.lastUpdated = None + """ When the resource version last changed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.profile = None + """ Profiles this resource claims to conform to. + List of `str` items. """ + + self.security = None + """ Security Labels applied to this resource. + List of `Coding` items (represented as `dict` in JSON). """ + + self.tag = None + """ Tags applied to this resource. + List of `Coding` items (represented as `dict` in JSON). """ + + self.versionId = None + """ Version specific identifier. + Type `str`. """ + + super(Meta, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Meta, self).elementProperties() + js.extend([ + ("lastUpdated", "lastUpdated", fhirdate.FHIRDate, False, None, False), + ("profile", "profile", str, True, None, False), + ("security", "security", coding.Coding, True, None, False), + ("tag", "tag", coding.Coding, True, None, False), + ("versionId", "versionId", str, False, None, False), + ]) + return js + + +import sys +try: + from . import coding +except ImportError: + coding = sys.modules[__package__ + '.coding'] +try: + from . import fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] diff --git a/fhirclient/models/STU3/metadataresource.py b/fhirclient/models/STU3/metadataresource.py new file mode 100644 index 000000000..006347eaf --- /dev/null +++ b/fhirclient/models/STU3/metadataresource.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/MetadataResource) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class MetadataResource(domainresource.DomainResource): + """ Common Ancestor declaration for definitional resources. + + Common Ancestor declaration for conformance and knowledge artifact + resources. + """ + + resource_type = "MetadataResource" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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.date = None + """ Date this was last changed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Natural language description of the metadata resource. + Type `str`. """ + + self.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.jurisdiction = None + """ Intended jurisdiction for metadata resource (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.name = None + """ Name for this metadata resource (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.title = None + """ Name for this metadata resource (human friendly). + Type `str`. """ + + self.url = None + """ Logical URI to reference this metadata resource (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 metadata resource. + Type `str`. """ + + super(MetadataResource, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MetadataResource, self).elementProperties() + js.extend([ + ("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), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("name", "name", str, False, None, False), + ("publisher", "publisher", str, False, None, False), + ("status", "status", str, False, None, True), + ("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 + + +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/STU3/money.py b/fhirclient/models/STU3/money.py new file mode 100644 index 000000000..7dbc6309a --- /dev/null +++ b/fhirclient/models/STU3/money.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Money) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import quantity + +class Money(quantity.Quantity): + """ An amount of economic utility in some recognized currency. + """ + + resource_type = "Money" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + super(Money, self).__init__(jsondict=jsondict, strict=strict) + + diff --git a/fhirclient/models/STU3/namingsystem.py b/fhirclient/models/STU3/namingsystem.py new file mode 100644 index 000000000..c3a19408c --- /dev/null +++ b/fhirclient/models/STU3/namingsystem.py @@ -0,0 +1,184 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/NamingSystem) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class NamingSystem(domainresource.DomainResource): + """ System of unique identification. + + A curated namespace that issues unique symbols within that namespace for + the identification of concepts, people, devices, etc. Represents a + "System" used within the Identifier and Coding data types. + """ + + resource_type = "NamingSystem" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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.date = None + """ Date this was last changed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Natural language description of the naming system. + Type `str`. """ + + self.jurisdiction = None + """ Intended jurisdiction for naming system (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.kind = None + """ codesystem | identifier | root. + Type `str`. """ + + self.name = None + """ Name for this naming system (computer friendly). + Type `str`. """ + + self.publisher = None + """ 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`. """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.type = None + """ e.g. driver, provider, patient, bank etc.. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.uniqueId = None + """ Unique identifiers used for system. + List of `NamingSystemUniqueId` items (represented as `dict` in JSON). """ + + self.usage = None + """ How/where is it used. + Type `str`. """ + + self.useContext = None + """ Context the content is intended to support. + List of `UsageContext` items (represented as `dict` in JSON). """ + + super(NamingSystem, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(NamingSystem, self).elementProperties() + js.extend([ + ("contact", "contact", contactdetail.ContactDetail, True, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, True), + ("description", "description", str, False, None, False), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("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), + ("uniqueId", "uniqueId", NamingSystemUniqueId, True, None, True), + ("usage", "usage", str, False, None, False), + ("useContext", "useContext", usagecontext.UsageContext, True, None, False), + ]) + return js + + +from . import backboneelement + +class NamingSystemUniqueId(backboneelement.BackboneElement): + """ Unique identifiers used for system. + + Indicates how the system may be identified when referenced in electronic + exchange. + """ + + resource_type = "NamingSystemUniqueId" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Notes about identifier usage. + Type `str`. """ + + self.period = None + """ When is identifier valid?. + Type `Period` (represented as `dict` in JSON). """ + + self.preferred = None + """ Is this the id that should be used for this type. + Type `bool`. """ + + self.type = None + """ oid | uuid | uri | other. + Type `str`. """ + + self.value = None + """ The unique identifier. + Type `str`. """ + + super(NamingSystemUniqueId, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(NamingSystemUniqueId, self).elementProperties() + js.extend([ + ("comment", "comment", str, False, None, False), + ("period", "period", period.Period, False, None, False), + ("preferred", "preferred", bool, False, None, False), + ("type", "type", str, False, None, True), + ("value", "value", 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 period +except ImportError: + period = sys.modules[__package__ + '.period'] +try: + from . import usagecontext +except ImportError: + usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/STU3/namingsystem_tests.py b/fhirclient/models/STU3/namingsystem_tests.py new file mode 100644 index 000000000..72d1f6aa1 --- /dev/null +++ b/fhirclient/models/STU3/namingsystem_tests.py @@ -0,0 +1,115 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import namingsystem +from .fhirdate import FHIRDate + + +class NamingSystemTests(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("NamingSystem", js["resourceType"]) + return namingsystem.NamingSystem(js) + + def testNamingSystem1(self): + inst = self.instantiate_from("namingsystem-example-id.json") + self.assertIsNotNone(inst, "Must have instantiated a NamingSystem instance") + self.implNamingSystem1(inst) + + js = inst.as_json() + self.assertEqual("NamingSystem", js["resourceType"]) + inst2 = namingsystem.NamingSystem(js) + self.implNamingSystem1(inst2) + + def implNamingSystem1(self, inst): + self.assertEqual(inst.contact[0].name, "HL7 Australia FHIR Team") + self.assertEqual(inst.contact[0].telecom[0].system, "url") + 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.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.name, "Austalian Healthcare Identifier - Individual") + self.assertEqual(inst.publisher, "HL7 Australia on behalf of NEHTA") + self.assertEqual(inst.responsible, "HI Service Operator / NEHTA") + self.assertEqual(inst.status, "active") + 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.text, "IHI") + self.assertEqual(inst.uniqueId[0].comment, "This value is used in Australian CDA documents") + self.assertEqual(inst.uniqueId[0].type, "oid") + self.assertEqual(inst.uniqueId[0].value, "1.2.36.1.2001.1003.0") + self.assertEqual(inst.uniqueId[1].period.start.date, FHIRDate("2015-08-21").date) + self.assertEqual(inst.uniqueId[1].period.start.as_json(), "2015-08-21") + self.assertTrue(inst.uniqueId[1].preferred) + self.assertEqual(inst.uniqueId[1].type, "uri") + self.assertEqual(inst.uniqueId[1].value, "http://ns.electronichealth.net.au/id/hi/ihi/1.0") + self.assertEqual(inst.usage, "Used in Australia for identifying patients") + + def testNamingSystem2(self): + inst = self.instantiate_from("namingsystem-example-replaced.json") + self.assertIsNotNone(inst, "Must have instantiated a NamingSystem instance") + self.implNamingSystem2(inst) + + js = inst.as_json() + self.assertEqual("NamingSystem", js["resourceType"]) + inst2 = namingsystem.NamingSystem(js) + 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") + self.assertEqual(inst.date.date, FHIRDate("2014-12-13").date) + self.assertEqual(inst.date.as_json(), "2014-12-13") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.kind, "codesystem") + self.assertEqual(inst.name, "SNOMED CT") + self.assertEqual(inst.publisher, "HL7 International on behalf of IHTSDO") + self.assertEqual(inst.responsible, "IHTSDO & affiliates") + self.assertEqual(inst.status, "active") + 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") + self.assertTrue(inst.uniqueId[1].preferred) + self.assertEqual(inst.uniqueId[1].type, "uri") + self.assertEqual(inst.uniqueId[1].value, "http://snomed.info/sct") + diff --git a/fhirclient/models/STU3/narrative.py b/fhirclient/models/STU3/narrative.py new file mode 100644 index 000000000..beab8322f --- /dev/null +++ b/fhirclient/models/STU3/narrative.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Narrative) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Narrative(element.Element): + """ A human-readable formatted text, including images. + """ + + resource_type = "Narrative" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.div = None + """ Limited xhtml content. + Type `str`. """ + + self.status = None + """ generated | extensions | additional | empty. + Type `str`. """ + + super(Narrative, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Narrative, self).elementProperties() + js.extend([ + ("div", "div", str, False, None, True), + ("status", "status", str, False, None, True), + ]) + return js + + diff --git a/fhirclient/models/STU3/nutritionorder.py b/fhirclient/models/STU3/nutritionorder.py new file mode 100644 index 000000000..806cc9115 --- /dev/null +++ b/fhirclient/models/STU3/nutritionorder.py @@ -0,0 +1,429 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/NutritionOrder) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class NutritionOrder(domainresource.DomainResource): + """ Diet, formula or nutritional supplement request. + + A request to supply a diet, formula feeding (enteral) or oral nutritional + supplement to a patient/resident. + """ + + resource_type = "NutritionOrder" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + 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). """ + + self.dateTime = None + """ Date and time the nutrition order was requested. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.encounter = None + """ The encounter associated with this nutrition order. + Type `FHIRReference` referencing `Encounter` (represented as `dict` in JSON). """ + + self.enteralFormula = None + """ Enteral formula components. + Type `NutritionOrderEnteralFormula` (represented as `dict` in JSON). """ + + self.excludeFoodModifier = None + """ Order-specific modifier about the type of food that should not be + given. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.foodPreferenceModifier = None + """ Order-specific modifier about the type of food that should be given. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Identifiers assigned to this order. + List of `Identifier` 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). """ + + self.patient = None + """ The person who requires the diet, formula or nutritional supplement. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.status = None + """ proposed | draft | planned | requested | active | on-hold | + completed | cancelled | entered-in-error. + Type `str`. """ + + self.supplement = None + """ Supplement components. + List of `NutritionOrderSupplement` items (represented as `dict` in JSON). """ + + super(NutritionOrder, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(NutritionOrder, self).elementProperties() + js.extend([ + ("allergyIntolerance", "allergyIntolerance", fhirreference.FHIRReference, True, None, False), + ("dateTime", "dateTime", fhirdate.FHIRDate, False, None, True), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), + ("enteralFormula", "enteralFormula", NutritionOrderEnteralFormula, False, None, False), + ("excludeFoodModifier", "excludeFoodModifier", codeableconcept.CodeableConcept, True, None, False), + ("foodPreferenceModifier", "foodPreferenceModifier", codeableconcept.CodeableConcept, True, None, False), + ("identifier", "identifier", identifier.Identifier, 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), + ("supplement", "supplement", NutritionOrderSupplement, True, None, False), + ]) + return js + + +from . import backboneelement + +class NutritionOrderEnteralFormula(backboneelement.BackboneElement): + """ Enteral formula components. + + Feeding provided through the gastrointestinal tract via a tube, catheter, + or stoma that delivers nutrition distal to the oral cavity. + """ + + resource_type = "NutritionOrderEnteralFormula" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.additiveProductName = None + """ Product or brand name of the modular additive. + Type `str`. """ + + self.additiveType = None + """ Type of modular component to add to the feeding. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.administration = None + """ Formula feeding instruction as structured data. + List of `NutritionOrderEnteralFormulaAdministration` items (represented as `dict` in JSON). """ + + self.administrationInstruction = None + """ Formula feeding instructions expressed as text. + Type `str`. """ + + self.baseFormulaProductName = None + """ Product or brand name of the enteral or infant formula. + Type `str`. """ + + self.baseFormulaType = None + """ Type of enteral or infant formula. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.caloricDensity = None + """ Amount of energy per specified volume that is required. + Type `Quantity` (represented as `dict` in JSON). """ + + self.maxVolumeToDeliver = None + """ Upper limit on formula volume per unit of time. + Type `Quantity` (represented as `dict` in JSON). """ + + self.routeofAdministration = None + """ How the formula should enter the patient's gastrointestinal tract. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(NutritionOrderEnteralFormula, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(NutritionOrderEnteralFormula, self).elementProperties() + js.extend([ + ("additiveProductName", "additiveProductName", str, False, None, False), + ("additiveType", "additiveType", codeableconcept.CodeableConcept, False, None, False), + ("administration", "administration", NutritionOrderEnteralFormulaAdministration, True, None, False), + ("administrationInstruction", "administrationInstruction", str, False, None, False), + ("baseFormulaProductName", "baseFormulaProductName", str, False, None, False), + ("baseFormulaType", "baseFormulaType", codeableconcept.CodeableConcept, False, None, False), + ("caloricDensity", "caloricDensity", quantity.Quantity, False, None, False), + ("maxVolumeToDeliver", "maxVolumeToDeliver", quantity.Quantity, False, None, False), + ("routeofAdministration", "routeofAdministration", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class NutritionOrderEnteralFormulaAdministration(backboneelement.BackboneElement): + """ Formula feeding instruction as structured data. + + Formula administration instructions as structured data. This repeating + structure allows for changing the administration rate or volume over time + for both bolus and continuous feeding. An example of this would be an + instruction to increase the rate of continuous feeding every 2 hours. + """ + + resource_type = "NutritionOrderEnteralFormulaAdministration" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 volume of formula to provide. + Type `Quantity` (represented as `dict` in JSON). """ + + self.rateQuantity = None + """ Speed with which the formula is provided per period of time. + Type `Quantity` (represented as `dict` in JSON). """ + + self.rateRatio = None + """ Speed with which the formula is provided per period of time. + Type `Ratio` (represented as `dict` in JSON). """ + + self.schedule = None + """ Scheduled frequency of enteral feeding. + Type `Timing` (represented as `dict` in JSON). """ + + super(NutritionOrderEnteralFormulaAdministration, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(NutritionOrderEnteralFormulaAdministration, self).elementProperties() + js.extend([ + ("quantity", "quantity", quantity.Quantity, False, None, False), + ("rateQuantity", "rateQuantity", quantity.Quantity, False, "rate", False), + ("rateRatio", "rateRatio", ratio.Ratio, False, "rate", False), + ("schedule", "schedule", timing.Timing, False, None, False), + ]) + return js + + +class NutritionOrderOralDiet(backboneelement.BackboneElement): + """ Oral diet components. + + Diet given orally in contrast to enteral (tube) feeding. + """ + + resource_type = "NutritionOrderOralDiet" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.fluidConsistencyType = None + """ The required consistency of fluids and liquids provided to the + patient. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.instruction = None + """ Instructions or additional information about the oral diet. + Type `str`. """ + + self.nutrient = None + """ Required nutrient modifications. + List of `NutritionOrderOralDietNutrient` items (represented as `dict` in JSON). """ + + self.schedule = None + """ Scheduled frequency of diet. + List of `Timing` items (represented as `dict` in JSON). """ + + self.texture = None + """ Required texture modifications. + List of `NutritionOrderOralDietTexture` items (represented as `dict` in JSON). """ + + self.type = None + """ Type of oral diet or diet restrictions that describe what can be + consumed orally. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(NutritionOrderOralDiet, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(NutritionOrderOralDiet, self).elementProperties() + js.extend([ + ("fluidConsistencyType", "fluidConsistencyType", codeableconcept.CodeableConcept, True, None, False), + ("instruction", "instruction", str, False, None, False), + ("nutrient", "nutrient", NutritionOrderOralDietNutrient, True, None, False), + ("schedule", "schedule", timing.Timing, True, None, False), + ("texture", "texture", NutritionOrderOralDietTexture, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +class NutritionOrderOralDietNutrient(backboneelement.BackboneElement): + """ Required nutrient modifications. + + Class that defines the quantity and type of nutrient modifications (for + example carbohydrate, fiber or sodium) required for the oral diet. + """ + + resource_type = "NutritionOrderOralDietNutrient" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 the specified nutrient. + Type `Quantity` (represented as `dict` in JSON). """ + + self.modifier = None + """ Type of nutrient that is being modified. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(NutritionOrderOralDietNutrient, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(NutritionOrderOralDietNutrient, self).elementProperties() + js.extend([ + ("amount", "amount", quantity.Quantity, False, None, False), + ("modifier", "modifier", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class NutritionOrderOralDietTexture(backboneelement.BackboneElement): + """ Required texture modifications. + + Class that describes any texture modifications required for the patient to + safely consume various types of solid foods. + """ + + resource_type = "NutritionOrderOralDietTexture" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.foodType = None + """ Concepts that are used to identify an entity that is ingested for + nutritional purposes. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.modifier = None + """ Code to indicate how to alter the texture of the foods, e.g. pureed. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(NutritionOrderOralDietTexture, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(NutritionOrderOralDietTexture, self).elementProperties() + js.extend([ + ("foodType", "foodType", codeableconcept.CodeableConcept, False, None, False), + ("modifier", "modifier", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class NutritionOrderSupplement(backboneelement.BackboneElement): + """ Supplement components. + + Oral nutritional products given in order to add further nutritional value + to the patient's diet. + """ + + resource_type = "NutritionOrderSupplement" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Instructions or additional information about the oral supplement. + Type `str`. """ + + self.productName = None + """ Product or brand name of the nutritional supplement. + Type `str`. """ + + self.quantity = None + """ Amount of the nutritional supplement. + Type `Quantity` (represented as `dict` in JSON). """ + + self.schedule = None + """ Scheduled frequency of supplement. + List of `Timing` items (represented as `dict` in JSON). """ + + self.type = None + """ Type of supplement product requested. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(NutritionOrderSupplement, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(NutritionOrderSupplement, self).elementProperties() + js.extend([ + ("instruction", "instruction", str, False, None, False), + ("productName", "productName", str, False, None, False), + ("quantity", "quantity", quantity.Quantity, False, None, False), + ("schedule", "schedule", timing.Timing, True, 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'] +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] +try: + from . import ratio +except ImportError: + ratio = sys.modules[__package__ + '.ratio'] +try: + from . import timing +except ImportError: + timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/STU3/nutritionorder_tests.py b/fhirclient/models/STU3/nutritionorder_tests.py new file mode 100644 index 000000000..8e400026f --- /dev/null +++ b/fhirclient/models/STU3/nutritionorder_tests.py @@ -0,0 +1,503 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import nutritionorder +from .fhirdate import FHIRDate + + +class NutritionOrderTests(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("NutritionOrder", js["resourceType"]) + return nutritionorder.NutritionOrder(js) + + def testNutritionOrder1(self): + inst = self.instantiate_from("nutritionorder-example-diabeticsupplement.json") + self.assertIsNotNone(inst, "Must have instantiated a NutritionOrder instance") + self.implNutritionOrder1(inst) + + js = inst.as_json() + self.assertEqual("NutritionOrder", js["resourceType"]) + inst2 = nutritionorder.NutritionOrder(js) + 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, "kosher") + self.assertEqual(inst.foodPreferenceModifier[0].coding[0].system, "http://hl7.org/fhir/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.status, "active") + self.assertEqual(inst.supplement[0].productName, "Glucerna") + self.assertEqual(inst.supplement[0].quantity.unit, "8 oz bottle") + self.assertEqual(inst.supplement[0].quantity.value, 1) + self.assertEqual(inst.supplement[0].schedule[0].repeat.boundsPeriod.start.date, FHIRDate("2015-02-10T15:00:00Z").date) + self.assertEqual(inst.supplement[0].schedule[0].repeat.boundsPeriod.start.as_json(), "2015-02-10T15:00:00Z") + self.assertEqual(inst.supplement[0].schedule[0].repeat.frequency, 1) + self.assertEqual(inst.supplement[0].schedule[0].repeat.period, 24) + self.assertEqual(inst.supplement[0].schedule[0].repeat.periodUnit, "h") + self.assertEqual(inst.supplement[0].schedule[1].repeat.duration, 1) + self.assertEqual(inst.supplement[0].schedule[1].repeat.durationUnit, "h") + self.assertEqual(inst.supplement[0].schedule[1].repeat.when[0], "HS") + self.assertEqual(inst.supplement[0].type.coding[0].code, "443051000124104") + self.assertEqual(inst.supplement[0].type.coding[0].display, "Adult diabetes specialty 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 diabetic formula") + self.assertEqual(inst.supplement[0].type.coding[1].system, "http://goodhealthhospital.org/supplement-type-codes") + self.assertEqual(inst.supplement[0].type.text, "Adult diabetic formula") + self.assertEqual(inst.text.status, "generated") + + def testNutritionOrder2(self): + inst = self.instantiate_from("nutritionorder-example-enteralbolus.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.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.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") + self.assertEqual(inst.enteralFormula.administration[0].quantity.unit, "milliliters") + self.assertEqual(inst.enteralFormula.administration[0].quantity.value, 240) + self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.boundsPeriod.start.date, FHIRDate("2014-09-17T16:00:00Z").date) + self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.boundsPeriod.start.as_json(), "2014-09-17T16:00:00Z") + self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.frequency, 1) + 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].display, "Adult high protein formula") + self.assertEqual(inst.enteralFormula.baseFormulaType.coding[0].system, "http://usextension/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.5) + 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, 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.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, "enteralbolus") + 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 testNutritionOrder3(self): + inst = self.instantiate_from("nutritionorder-example-fiberrestricteddiet.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") + 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, "fiberrestricteddiet") + 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, 50) + self.assertEqual(inst.oralDiet.nutrient[0].modifier.coding[0].code, "256674009") + self.assertEqual(inst.oralDiet.nutrient[0].modifier.coding[0].display, "Fat") + 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, "15108003") + self.assertEqual(inst.oralDiet.type[0].coding[0].display, "Restricted fiber diet") + self.assertEqual(inst.oralDiet.type[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.oralDiet.type[0].coding[1].code, "1000") + self.assertEqual(inst.oralDiet.type[0].coding[1].display, "Fiber restricted") + self.assertEqual(inst.oralDiet.type[0].coding[1].system, "http://goodhealthhospital.org/diet-type-codes") + self.assertEqual(inst.oralDiet.type[0].text, "Fiber restricted diet") + self.assertEqual(inst.oralDiet.type[1].coding[0].code, "16208003") + self.assertEqual(inst.oralDiet.type[1].coding[0].display, "Low fat diet") + self.assertEqual(inst.oralDiet.type[1].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.oralDiet.type[1].coding[1].code, "1100") + self.assertEqual(inst.oralDiet.type[1].coding[1].display, "Low Fat") + self.assertEqual(inst.oralDiet.type[1].coding[1].system, "http://goodhealthhospital.org/diet-type-codes") + self.assertEqual(inst.oralDiet.type[1].text, "Low fat diet") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + + 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.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.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.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.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.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") + self.assertEqual(inst.enteralFormula.administration[0].quantity.unit, "ounces") + self.assertEqual(inst.enteralFormula.administration[0].quantity.value, 4) + self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.boundsPeriod.start.date, FHIRDate("2014-09-17").date) + self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.boundsPeriod.start.as_json(), "2014-09-17") + self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.frequency, 1) + self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.period, 3) + self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.periodUnit, "h") + self.assertEqual(inst.enteralFormula.baseFormulaProductName, "Acme Infant Formula + Iron") + self.assertEqual(inst.enteralFormula.baseFormulaType.coding[0].code, "412414007") + self.assertEqual(inst.enteralFormula.baseFormulaType.coding[0].display, "infant formula + iron") + self.assertEqual(inst.enteralFormula.baseFormulaType.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.enteralFormula.caloricDensity.code, "cal/[foz_us]") + self.assertEqual(inst.enteralFormula.caloricDensity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.enteralFormula.caloricDensity.unit, "calories per ounce") + self.assertEqual(inst.enteralFormula.caloricDensity.value, 20) + self.assertEqual(inst.enteralFormula.maxVolumeToDeliver.code, "[foz_us]") + self.assertEqual(inst.enteralFormula.maxVolumeToDeliver.system, "http://unitsofmeasure.org") + self.assertEqual(inst.enteralFormula.maxVolumeToDeliver.unit, "ounces") + 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.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.status, "active") + self.assertEqual(inst.text.status, "generated") + + def testNutritionOrder7(self): + inst = self.instantiate_from("nutritionorder-example-enteralcontinuous.json") + self.assertIsNotNone(inst, "Must have instantiated a NutritionOrder instance") + self.implNutritionOrder7(inst) + + js = inst.as_json() + self.assertEqual("NutritionOrder", js["resourceType"]) + inst2 = nutritionorder.NutritionOrder(js) + self.implNutritionOrder7(inst2) + + 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.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 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://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 testNutritionOrder9(self): + inst = self.instantiate_from("nutritionorder-example-pureeddiet.json") + self.assertIsNotNone(inst, "Must have instantiated a NutritionOrder instance") + self.implNutritionOrder9(inst) + + js = inst.as_json() + self.assertEqual("NutritionOrder", js["resourceType"]) + inst2 = nutritionorder.NutritionOrder(js) + self.implNutritionOrder9(inst2) + + 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.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, "pureeddiet") + self.assertEqual(inst.identifier[0].system, "http://goodhealthhospital.org/nutrition-requests") + self.assertEqual(inst.identifier[0].value, "123") + 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.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://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") + diff --git a/fhirclient/models/STU3/observation.py b/fhirclient/models/STU3/observation.py new file mode 100644 index 000000000..7b0c5abb6 --- /dev/null +++ b/fhirclient/models/STU3/observation.py @@ -0,0 +1,430 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Observation) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Observation(domainresource.DomainResource): + """ Measurements and simple assertions. + + Measurements and simple assertions made about a patient, device or other + subject. + """ + + resource_type = "Observation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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 referencing `CarePlan, DeviceRequest, ImmunizationRecommendation, MedicationRequest, NutritionOrder, ProcedureRequest, ReferralRequest` (represented as `dict` in JSON). """ + + self.bodySite = None + """ Observed body part. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.category = None + """ Classification of type 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.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.device = None + """ (Measurement) Device. + Type `FHIRReference` referencing `Device, DeviceMetric` (represented as `dict` in JSON). """ + + self.effectiveDateTime = 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.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). """ + + self.issued = None + """ Date/Time this 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.performer = None + """ Who is responsible for the observation. + List of `FHIRReference` items referencing `Practitioner, Organization, Patient, RelatedPerson` (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). """ + + 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). """ + + self.valueBoolean = None + """ Actual result. + Type `bool`. """ + + self.valueCodeableConcept = None + """ Actual result. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueDateTime = None + """ Actual result. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valuePeriod = None + """ Actual result. + Type `Period` (represented as `dict` in JSON). """ + + self.valueQuantity = None + """ Actual result. + Type `Quantity` (represented as `dict` in JSON). """ + + self.valueRange = None + """ Actual result. + Type `Range` (represented as `dict` in JSON). """ + + self.valueRatio = None + """ Actual result. + Type `Ratio` (represented as `dict` in JSON). """ + + self.valueSampledData = None + """ Actual result. + Type `SampledData` (represented as `dict` in JSON). """ + + self.valueString = None + """ Actual result. + Type `str`. """ + + self.valueTime = None + """ Actual result. + Type `FHIRDate` (represented as `str` in JSON). """ + + super(Observation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Observation, self).elementProperties() + js.extend([ + ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), + ("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), + ("device", "device", fhirreference.FHIRReference, False, None, False), + ("effectiveDateTime", "effectiveDateTime", fhirdate.FHIRDate, False, "effective", False), + ("effectivePeriod", "effectivePeriod", period.Period, False, "effective", False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("interpretation", "interpretation", codeableconcept.CodeableConcept, False, None, False), + ("issued", "issued", fhirdate.FHIRDate, False, None, False), + ("method", "method", codeableconcept.CodeableConcept, False, 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), + ("valuePeriod", "valuePeriod", period.Period, False, "value", False), + ("valueQuantity", "valueQuantity", quantity.Quantity, False, "value", False), + ("valueRange", "valueRange", range.Range, False, "value", False), + ("valueRatio", "valueRatio", ratio.Ratio, False, "value", False), + ("valueSampledData", "valueSampledData", sampleddata.SampledData, False, "value", False), + ("valueString", "valueString", str, False, "value", False), + ("valueTime", "valueTime", fhirdate.FHIRDate, False, "value", False), + ]) + return js + + +from . import backboneelement + +class ObservationComponent(backboneelement.BackboneElement): + """ Component results. + + Some observations have multiple component observations. These component + observations are expressed as separate code value pairs that share the same + attributes. Examples include systolic and diastolic component observations + for blood pressure measurement and multiple component observations for + genetics observations. + """ + + resource_type = "ObservationComponent" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 component observation (code / type). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.dataAbsentReason = None + """ Why the component result is missing. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.interpretation = None + """ High, low, normal, etc.. + Type `CodeableConcept` (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 + """ Actual component result. + Type `Attachment` (represented as `dict` in JSON). """ + + self.valueCodeableConcept = None + """ Actual component result. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueDateTime = None + """ Actual component result. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valuePeriod = None + """ Actual component result. + Type `Period` (represented as `dict` in JSON). """ + + self.valueQuantity = None + """ Actual component result. + Type `Quantity` (represented as `dict` in JSON). """ + + self.valueRange = None + """ Actual component result. + Type `Range` (represented as `dict` in JSON). """ + + self.valueRatio = None + """ Actual component result. + Type `Ratio` (represented as `dict` in JSON). """ + + self.valueSampledData = None + """ Actual component result. + Type `SampledData` (represented as `dict` in JSON). """ + + self.valueString = None + """ Actual component result. + Type `str`. """ + + self.valueTime = None + """ Actual component result. + Type `FHIRDate` (represented as `str` in JSON). """ + + super(ObservationComponent, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ObservationComponent, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("dataAbsentReason", "dataAbsentReason", codeableconcept.CodeableConcept, False, None, False), + ("interpretation", "interpretation", codeableconcept.CodeableConcept, False, None, False), + ("referenceRange", "referenceRange", ObservationReferenceRange, True, None, False), + ("valueAttachment", "valueAttachment", attachment.Attachment, False, "value", False), + ("valueCodeableConcept", "valueCodeableConcept", codeableconcept.CodeableConcept, False, "value", False), + ("valueDateTime", "valueDateTime", fhirdate.FHIRDate, False, "value", False), + ("valuePeriod", "valuePeriod", period.Period, False, "value", False), + ("valueQuantity", "valueQuantity", quantity.Quantity, False, "value", False), + ("valueRange", "valueRange", range.Range, False, "value", False), + ("valueRatio", "valueRatio", ratio.Ratio, False, "value", False), + ("valueSampledData", "valueSampledData", sampleddata.SampledData, False, "value", False), + ("valueString", "valueString", str, False, "value", False), + ("valueTime", "valueTime", fhirdate.FHIRDate, False, "value", False), + ]) + return js + + +class ObservationReferenceRange(backboneelement.BackboneElement): + """ Provides guide for interpretation. + + Guidance on how to interpret the value by comparison to a normal or + recommended range. + """ + + resource_type = "ObservationReferenceRange" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Reference range population. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.high = None + """ High Range, if relevant. + Type `Quantity` (represented as `dict` in JSON). """ + + self.low = None + """ Low Range, if relevant. + Type `Quantity` (represented as `dict` in JSON). """ + + self.text = None + """ Text based reference range in an observation. + Type `str`. """ + + self.type = None + """ Reference range qualifier. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ObservationReferenceRange, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ObservationReferenceRange, self).elementProperties() + js.extend([ + ("age", "age", range.Range, False, None, False), + ("appliesTo", "appliesTo", codeableconcept.CodeableConcept, True, None, False), + ("high", "high", quantity.Quantity, False, None, False), + ("low", "low", quantity.Quantity, False, None, False), + ("text", "text", str, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + 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 +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 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 sampleddata +except ImportError: + sampleddata = sys.modules[__package__ + '.sampleddata'] diff --git a/fhirclient/models/STU3/observation_tests.py b/fhirclient/models/STU3/observation_tests.py new file mode 100644 index 000000000..7fd29d5f0 --- /dev/null +++ b/fhirclient/models/STU3/observation_tests.py @@ -0,0 +1,319 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import observation +from .fhirdate import FHIRDate + + +class ObservationTests(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("Observation", js["resourceType"]) + return observation.Observation(js) + + def testObservation1(self): + inst = self.instantiate_from("observation-example-genetics-1.json") + self.assertIsNotNone(inst, "Must have instantiated a Observation instance") + self.implObservation1(inst) + + js = inst.as_json() + self.assertEqual("Observation", js["resourceType"]) + inst2 = observation.Observation(js) + self.implObservation1(inst2) + + def implObservation1(self, inst): + 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.extension[0].url, "http://hl7.org/fhir/StructureDefinition/observation-geneticsDNASequenceVariantName") + self.assertEqual(inst.extension[0].valueCodeableConcept.text, "NG_007726.3:g.146252T>G") + self.assertEqual(inst.extension[1].url, "http://hl7.org/fhir/StructureDefinition/observation-geneticsGene") + self.assertEqual(inst.extension[1].valueCodeableConcept.coding[0].code, "3236") + self.assertEqual(inst.extension[1].valueCodeableConcept.coding[0].display, "EGFR") + self.assertEqual(inst.extension[1].valueCodeableConcept.coding[0].system, "http://www.genenames.org") + self.assertEqual(inst.extension[2].url, "http://hl7.org/fhir/StructureDefinition/observation-geneticsDNARegionName") + self.assertEqual(inst.extension[2].valueString, "Exon 21") + self.assertEqual(inst.extension[3].url, "http://hl7.org/fhir/StructureDefinition/observation-geneticsGenomicSourceClass") + self.assertEqual(inst.extension[3].valueCodeableConcept.coding[0].code, "LA6684-0") + self.assertEqual(inst.extension[3].valueCodeableConcept.coding[0].display, "somatic") + self.assertEqual(inst.extension[3].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.status, "final") + self.assertEqual(inst.text.status, "generated") + 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-bmd.json") + self.assertIsNotNone(inst, "Must have instantiated a Observation instance") + self.implObservation2(inst) + + js = inst.as_json() + self.assertEqual("Observation", js["resourceType"]) + inst2 = observation.Observation(js) + self.implObservation2(inst2) + + def implObservation2(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.code.coding[0].system, "http://loinc.org") + self.assertEqual(inst.code.text, "BMD - Left Femur") + self.assertEqual(inst.id, "bmd") + self.assertEqual(inst.status, "final") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.valueQuantity.code, "g/cm-2") + self.assertEqual(inst.valueQuantity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.valueQuantity.unit, "g/cm²") + self.assertEqual(inst.valueQuantity.value, 0.887) + + def testObservation3(self): + inst = self.instantiate_from("observation-example-respiratory-rate.json") + self.assertIsNotNone(inst, "Must have instantiated a Observation instance") + self.implObservation3(inst) + + js = inst.as_json() + self.assertEqual("Observation", js["resourceType"]) + inst2 = observation.Observation(js) + self.implObservation3(inst2) + + def implObservation3(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, "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.status, "final") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.valueQuantity.code, "/min") + self.assertEqual(inst.valueQuantity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.valueQuantity.unit, "breaths/minute") + self.assertEqual(inst.valueQuantity.value, 26) + + def testObservation4(self): + inst = self.instantiate_from("observation-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Observation instance") + self.implObservation4(inst) + + js = inst.as_json() + self.assertEqual("Observation", js["resourceType"]) + inst2 = observation.Observation(js) + self.implObservation4(inst2) + + def implObservation4(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.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.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.status, "final") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.valueQuantity.code, "[lb_av]") + self.assertEqual(inst.valueQuantity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.valueQuantity.unit, "lbs") + self.assertEqual(inst.valueQuantity.value, 185) + + def testObservation5(self): + inst = self.instantiate_from("observation-example-haplotype2.json") + self.assertIsNotNone(inst, "Must have instantiated a Observation instance") + self.implObservation5(inst) + + js = inst.as_json() + self.assertEqual("Observation", js["resourceType"]) + inst2 = observation.Observation(js) + self.implObservation5(inst2) + + def implObservation5(self, inst): + 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.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.extension[1].url, "http://hl7.org/fhir/StructureDefinition/observation-geneticsSequence") + self.assertEqual(inst.extension[2].url, "http://hl7.org/fhir/StructureDefinition/observation-geneticsSequence") + 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.related[0].type, "derived-from") + self.assertEqual(inst.related[1].type, "derived-from") + self.assertEqual(inst.status, "unknown") + self.assertEqual(inst.text.status, "generated") + 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-mbp.json") + self.assertIsNotNone(inst, "Must have instantiated a Observation instance") + self.implObservation6(inst) + + js = inst.as_json() + self.assertEqual("Observation", js["resourceType"]) + inst2 = observation.Observation(js) + self.implObservation6(inst2) + + def implObservation6(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, "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, "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.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-bmi.json") + self.assertIsNotNone(inst, "Must have instantiated a Observation instance") + self.implObservation7(inst) + + js = inst.as_json() + self.assertEqual("Observation", js["resourceType"]) + inst2 = observation.Observation(js) + self.implObservation7(inst2) + + def implObservation7(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.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 testObservation8(self): + inst = self.instantiate_from("observation-example-body-height.json") + self.assertIsNotNone(inst, "Must have instantiated a Observation instance") + self.implObservation8(inst) + + js = inst.as_json() + self.assertEqual("Observation", js["resourceType"]) + inst2 = observation.Observation(js) + self.implObservation8(inst2) + + def implObservation8(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, "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, "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.status, "final") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.valueQuantity.code, "[in_i]") + self.assertEqual(inst.valueQuantity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.valueQuantity.unit, "in") + self.assertEqual(inst.valueQuantity.value, 66.89999999999999) + + def testObservation9(self): + inst = self.instantiate_from("observation-example-eye-color.json") + self.assertIsNotNone(inst, "Must have instantiated a Observation instance") + self.implObservation9(inst) + + js = inst.as_json() + self.assertEqual("Observation", js["resourceType"]) + inst2 = observation.Observation(js) + self.implObservation9(inst2) + + def implObservation9(self, inst): + 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.status, "final") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.valueString, "blue") + + def testObservation10(self): + inst = self.instantiate_from("observation-example-body-temperature.json") + self.assertIsNotNone(inst, "Must have instantiated a Observation instance") + self.implObservation10(inst) + + js = inst.as_json() + self.assertEqual("Observation", js["resourceType"]) + inst2 = observation.Observation(js) + 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, "8310-5") + self.assertEqual(inst.code.coding[0].display, "Body temperature") + self.assertEqual(inst.code.coding[0].system, "http://loinc.org") + self.assertEqual(inst.code.text, "Body temperature") + self.assertEqual(inst.effectiveDateTime.date, FHIRDate("1999-07-02").date) + self.assertEqual(inst.effectiveDateTime.as_json(), "1999-07-02") + self.assertEqual(inst.id, "body-temperature") + self.assertEqual(inst.meta.profile[0], "http://hl7.org/fhir/StructureDefinition/vitalsigns") + self.assertEqual(inst.status, "final") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.valueQuantity.code, "Cel") + self.assertEqual(inst.valueQuantity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.valueQuantity.unit, "C") + self.assertEqual(inst.valueQuantity.value, 36.5) + diff --git a/fhirclient/models/STU3/operationdefinition.py b/fhirclient/models/STU3/operationdefinition.py new file mode 100644 index 000000000..42c3da7f6 --- /dev/null +++ b/fhirclient/models/STU3/operationdefinition.py @@ -0,0 +1,328 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/OperationDefinition) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class OperationDefinition(domainresource.DomainResource): + """ Definition of an operation or a named query. + + A formal computable definition of an operation (on the RESTful interface) + or a named query (using the search interaction). + """ + + resource_type = "OperationDefinition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.base = None + """ Marks this as a profile of the base. + Type `FHIRReference` referencing `OperationDefinition` (represented as `dict` in JSON). """ + + self.code = None + """ Name used to invoke the operation. + Type `str`. """ + + self.comment = None + """ Additional information about use. + Type `str`. """ + + 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 operation definition. + Type `str`. """ + + self.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.idempotent = None + """ Whether content is unchanged by the operation. + Type `bool`. """ + + self.instance = None + """ Invoke on an instance?. + Type `bool`. """ + + self.jurisdiction = None + """ Intended jurisdiction for operation definition (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.kind = None + """ operation | query. + Type `str`. """ + + self.name = None + """ Name for this operation definition (computer friendly). + Type `str`. """ + + self.overload = None + """ Define overloaded variants for when generating code. + List of `OperationDefinitionOverload` items (represented as `dict` in JSON). """ + + self.parameter = None + """ Parameters for the operation/query. + List of `OperationDefinitionParameter` items (represented as `dict` in JSON). """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this operation definition is defined. + Type `str`. """ + + self.resource = None + """ Types this operation applies to. + List of `str` items. """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.system = None + """ Invoke at the system level?. + Type `bool`. """ + + self.type = None + """ Invole at the type level?. + Type `bool`. """ + + self.url = None + """ Logical URI to reference this operation definition (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 operation definition. + Type `str`. """ + + super(OperationDefinition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(OperationDefinition, self).elementProperties() + js.extend([ + ("base", "base", fhirreference.FHIRReference, 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), + ("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), + ("overload", "overload", OperationDefinitionOverload, True, None, False), + ("parameter", "parameter", OperationDefinitionParameter, True, None, False), + ("publisher", "publisher", str, False, None, False), + ("purpose", "purpose", str, False, None, False), + ("resource", "resource", str, True, None, False), + ("status", "status", str, False, None, True), + ("system", "system", bool, False, None, True), + ("type", "type", bool, 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 OperationDefinitionOverload(backboneelement.BackboneElement): + """ Define overloaded variants for when generating code. + + Defines an appropriate combination of parameters to use when invoking this + operation, to help code generators when generating overloaded parameter + sets for this operation. + """ + + resource_type = "OperationDefinitionOverload" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Comments to go on overload. + Type `str`. """ + + self.parameterName = None + """ Name of parameter to include in overload. + List of `str` items. """ + + super(OperationDefinitionOverload, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(OperationDefinitionOverload, self).elementProperties() + js.extend([ + ("comment", "comment", str, False, None, False), + ("parameterName", "parameterName", str, True, None, False), + ]) + return js + + +class OperationDefinitionParameter(backboneelement.BackboneElement): + """ Parameters for the operation/query. + + The parameters for the operation/query. + """ + + resource_type = "OperationDefinitionParameter" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.binding = None + """ ValueSet details if this is coded. + Type `OperationDefinitionParameterBinding` (represented as `dict` in JSON). """ + + self.documentation = None + """ Description of meaning/use. + Type `str`. """ + + self.max = None + """ Maximum Cardinality (a number or *). + Type `str`. """ + + self.min = None + """ Minimum Cardinality. + Type `int`. """ + + self.name = None + """ Name in Parameters.parameter.name or in URL. + Type `str`. """ + + self.part = None + """ 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.searchType = None + """ number | date | string | token | reference | composite | quantity | + uri. + Type `str`. """ + + self.type = None + """ What type this parameter has. + Type `str`. """ + + self.use = None + """ in | out. + Type `str`. """ + + super(OperationDefinitionParameter, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(OperationDefinitionParameter, self).elementProperties() + js.extend([ + ("binding", "binding", OperationDefinitionParameterBinding, False, None, False), + ("documentation", "documentation", str, False, None, False), + ("max", "max", str, False, None, True), + ("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), + ("searchType", "searchType", str, False, None, False), + ("type", "type", str, False, None, False), + ("use", "use", str, False, None, True), + ]) + return js + + +class OperationDefinitionParameterBinding(backboneelement.BackboneElement): + """ ValueSet details if this is coded. + + Binds to a value set if this parameter is coded (code, Coding, + CodeableConcept). + """ + + resource_type = "OperationDefinitionParameterBinding" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.strength = None + """ 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 + """ Source of value set. + Type `str`. """ + + super(OperationDefinitionParameterBinding, self).__init__(jsondict=jsondict, strict=strict) + + 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), + ]) + 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 usagecontext +except ImportError: + usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/STU3/operationdefinition_tests.py b/fhirclient/models/STU3/operationdefinition_tests.py new file mode 100644 index 000000000..12d8d53b6 --- /dev/null +++ b/fhirclient/models/STU3/operationdefinition_tests.py @@ -0,0 +1,85 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import operationdefinition +from .fhirdate import FHIRDate + + +class OperationDefinitionTests(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("OperationDefinition", js["resourceType"]) + return operationdefinition.OperationDefinition(js) + + def testOperationDefinition1(self): + inst = self.instantiate_from("operationdefinition-example.json") + self.assertIsNotNone(inst, "Must have instantiated a OperationDefinition instance") + self.implOperationDefinition1(inst) + + js = inst.as_json() + self.assertEqual("OperationDefinition", js["resourceType"]) + inst2 = operationdefinition.OperationDefinition(js) + self.implOperationDefinition1(inst2) + + def implOperationDefinition1(self, inst): + 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") + self.assertEqual(inst.contact[0].telecom[0].system, "email") + 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.id, "example") + self.assertTrue(inst.instance) + self.assertEqual(inst.jurisdiction[0].coding[0].code, "GB") + self.assertEqual(inst.jurisdiction[0].coding[0].display, "United Kingdom of Great Britain and Northern Ireland (the)") + self.assertEqual(inst.jurisdiction[0].coding[0].system, "urn:iso:std:iso:3166") + self.assertEqual(inst.kind, "operation") + self.assertEqual(inst.name, "Populate Questionnaire") + self.assertEqual(inst.overload[0].parameterName[0], "subject") + self.assertEqual(inst.overload[0].parameterName[1], "local") + self.assertEqual(inst.overload[1].comment, "local defaults to false when not passed as a parameter") + self.assertEqual(inst.overload[1].parameterName[0], "subject") + self.assertEqual(inst.parameter[0].max, "1") + self.assertEqual(inst.parameter[0].min, 1) + self.assertEqual(inst.parameter[0].name, "subject") + self.assertEqual(inst.parameter[0].type, "Reference") + self.assertEqual(inst.parameter[0].use, "in") + self.assertEqual(inst.parameter[1].documentation, "If the *local* parameter is set to true, server information about the specified subject will be used to populate the instance.") + self.assertEqual(inst.parameter[1].max, "1") + self.assertEqual(inst.parameter[1].min, 0) + self.assertEqual(inst.parameter[1].name, "local") + self.assertEqual(inst.parameter[1].type, "Reference") + self.assertEqual(inst.parameter[1].use, "in") + self.assertEqual(inst.parameter[2].documentation, "The partially (or fully)-populated set of answers for the specified Questionnaire") + self.assertEqual(inst.parameter[2].max, "1") + self.assertEqual(inst.parameter[2].min, 1) + self.assertEqual(inst.parameter[2].name, "return") + self.assertEqual(inst.parameter[2].type, "QuestionnaireResponse") + self.assertEqual(inst.parameter[2].use, "out") + self.assertEqual(inst.publisher, "Acme Healthcare Services") + self.assertEqual(inst.resource[0], "Questionnaire") + self.assertEqual(inst.status, "draft") + self.assertFalse(inst.system) + self.assertEqual(inst.text.status, "generated") + self.assertFalse(inst.type) + self.assertEqual(inst.url, "http://h7.org/fhir/OperationDefinition/example") + self.assertEqual(inst.useContext[0].code.code, "venue") + self.assertEqual(inst.useContext[0].code.display, "Clinical Venue") + 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.version, "B") + diff --git a/fhirclient/models/STU3/operationoutcome.py b/fhirclient/models/STU3/operationoutcome.py new file mode 100644 index 000000000..158ca3ed8 --- /dev/null +++ b/fhirclient/models/STU3/operationoutcome.py @@ -0,0 +1,102 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/OperationOutcome) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class OperationOutcome(domainresource.DomainResource): + """ Information about the success/failure of an action. + + A collection of error, warning or information messages that result from a + system action. + """ + + resource_type = "OperationOutcome" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.issue = None + """ A single issue associated with the action. + List of `OperationOutcomeIssue` items (represented as `dict` in JSON). """ + + super(OperationOutcome, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(OperationOutcome, self).elementProperties() + js.extend([ + ("issue", "issue", OperationOutcomeIssue, True, None, True), + ]) + return js + + +from . import backboneelement + +class OperationOutcomeIssue(backboneelement.BackboneElement): + """ A single issue associated with the action. + + An error, warning or information message that results from a system action. + """ + + resource_type = "OperationOutcomeIssue" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Error or warning code. + Type `str`. """ + + self.details = None + """ Additional details about the error. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.diagnostics = None + """ Additional diagnostic information about the issue. + Type `str`. """ + + self.expression = None + """ FHIRPath of element(s) related to issue. + List of `str` items. """ + + self.location = None + """ Path of element(s) related to issue. + List of `str` items. """ + + self.severity = None + """ fatal | error | warning | information. + Type `str`. """ + + super(OperationOutcomeIssue, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(OperationOutcomeIssue, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("details", "details", codeableconcept.CodeableConcept, False, None, False), + ("diagnostics", "diagnostics", str, False, None, False), + ("expression", "expression", str, True, None, False), + ("location", "location", str, True, None, False), + ("severity", "severity", str, False, None, True), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] diff --git a/fhirclient/models/STU3/operationoutcome_tests.py b/fhirclient/models/STU3/operationoutcome_tests.py new file mode 100644 index 000000000..421973626 --- /dev/null +++ b/fhirclient/models/STU3/operationoutcome_tests.py @@ -0,0 +1,134 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import operationoutcome +from .fhirdate import FHIRDate + + +class OperationOutcomeTests(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("OperationOutcome", js["resourceType"]) + return operationoutcome.OperationOutcome(js) + + def testOperationOutcome1(self): + inst = self.instantiate_from("operationoutcome-example-validationfail.json") + self.assertIsNotNone(inst, "Must have instantiated a OperationOutcome instance") + self.implOperationOutcome1(inst) + + js = inst.as_json() + self.assertEqual("OperationOutcome", js["resourceType"]) + inst2 = operationoutcome.OperationOutcome(js) + self.implOperationOutcome1(inst2) + + def implOperationOutcome1(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.issue[0].severity, "error") + self.assertEqual(inst.text.status, "generated") + + def testOperationOutcome2(self): + inst = self.instantiate_from("operationoutcome-example-break-the-glass.json") + self.assertIsNotNone(inst, "Must have instantiated a OperationOutcome instance") + self.implOperationOutcome2(inst) + + js = inst.as_json() + self.assertEqual("OperationOutcome", js["resourceType"]) + inst2 = operationoutcome.OperationOutcome(js) + self.implOperationOutcome2(inst2) + + def implOperationOutcome2(self, inst): + self.assertEqual(inst.id, "break-the-glass") + 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.text, "Additional information may be available using the Break-The-Glass Protocol") + self.assertEqual(inst.issue[0].severity, "information") + self.assertEqual(inst.text.status, "generated") + + def testOperationOutcome3(self): + inst = self.instantiate_from("operationoutcome-example-searchfail.json") + self.assertIsNotNone(inst, "Must have instantiated a OperationOutcome instance") + self.implOperationOutcome3(inst) + + js = inst.as_json() + self.assertEqual("OperationOutcome", js["resourceType"]) + inst2 = operationoutcome.OperationOutcome(js) + self.implOperationOutcome3(inst2) + + def implOperationOutcome3(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.text.status, "generated") + + def testOperationOutcome4(self): + inst = self.instantiate_from("operationoutcome-example-exception.json") + self.assertIsNotNone(inst, "Must have instantiated a OperationOutcome instance") + self.implOperationOutcome4(inst) + + js = inst.as_json() + self.assertEqual("OperationOutcome", js["resourceType"]) + inst2 = operationoutcome.OperationOutcome(js) + self.implOperationOutcome4(inst2) + + def implOperationOutcome4(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") + + def testOperationOutcome5(self): + inst = self.instantiate_from("operationoutcome-example.json") + self.assertIsNotNone(inst, "Must have instantiated a OperationOutcome instance") + self.implOperationOutcome5(inst) + + js = inst.as_json() + self.assertEqual("OperationOutcome", js["resourceType"]) + inst2 = operationoutcome.OperationOutcome(js) + self.implOperationOutcome5(inst2) + + def implOperationOutcome5(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") + + def testOperationOutcome6(self): + inst = self.instantiate_from("operationoutcome-example-allok.json") + self.assertIsNotNone(inst, "Must have instantiated a OperationOutcome instance") + self.implOperationOutcome6(inst) + + js = inst.as_json() + self.assertEqual("OperationOutcome", js["resourceType"]) + inst2 = operationoutcome.OperationOutcome(js) + self.implOperationOutcome6(inst2) + + def implOperationOutcome6(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") + diff --git a/fhirclient/models/STU3/organization.py b/fhirclient/models/STU3/organization.py new file mode 100644 index 000000000..f2672d703 --- /dev/null +++ b/fhirclient/models/STU3/organization.py @@ -0,0 +1,159 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Organization) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Organization(domainresource.DomainResource): + """ A grouping of people or organizations with a common purpose. + + 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. + """ + + resource_type = "Organization" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 the organization's record is still in active use. + Type `bool`. """ + + self.address = None + """ An address for the organization. + 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 + known as in the past. + List of `str` items. """ + + self.contact = None + """ Contact for the organization for a certain purpose. + List of `OrganizationContact` items (represented as `dict` in JSON). """ + + self.endpoint = None + """ Technical endpoints providing access to services operated for the + organization. + List of `FHIRReference` items referencing `Endpoint` (represented as `dict` in JSON). """ + + self.identifier = None + """ Identifies this organization across multiple systems. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.name = None + """ Name used for the organization. + Type `str`. """ + + self.partOf = None + """ The organization of which this organization forms a part. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.telecom = None + """ A contact detail for the organization. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + self.type = None + """ Kind of organization. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(Organization, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Organization, self).elementProperties() + js.extend([ + ("active", "active", bool, False, None, False), + ("address", "address", address.Address, True, None, False), + ("alias", "alias", str, True, None, False), + ("contact", "contact", OrganizationContact, True, None, False), + ("endpoint", "endpoint", fhirreference.FHIRReference, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("name", "name", str, False, None, False), + ("partOf", "partOf", fhirreference.FHIRReference, False, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +from . import backboneelement + +class OrganizationContact(backboneelement.BackboneElement): + """ Contact for the organization for a certain purpose. + """ + + resource_type = "OrganizationContact" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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(OrganizationContact, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(OrganizationContact, 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 + + +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'] diff --git a/fhirclient/models/STU3/organization_tests.py b/fhirclient/models/STU3/organization_tests.py new file mode 100644 index 000000000..775f6bdd0 --- /dev/null +++ b/fhirclient/models/STU3/organization_tests.py @@ -0,0 +1,311 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import organization +from .fhirdate import FHIRDate + + +class OrganizationTests(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("Organization", js["resourceType"]) + return organization.Organization(js) + + def testOrganization1(self): + inst = self.instantiate_from("organization-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Organization instance") + self.implOrganization1(inst) + + js = inst.as_json() + self.assertEqual("Organization", js["resourceType"]) + inst2 = organization.Organization(js) + self.implOrganization1(inst2) + + def implOrganization1(self, inst): + 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.extension[0].url, "http://hl7.org/fhir/StructureDefinition/organization-alias") + self.assertEqual(inst.extension[0].valueString, "HL7 International") + self.assertEqual(inst.id, "hl7") + self.assertEqual(inst.name, "Health Level Seven International") + 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.text.status, "generated") + + def testOrganization2(self): + inst = self.instantiate_from("organization-example-mmanu.json") + self.assertIsNotNone(inst, "Must have instantiated a Organization instance") + self.implOrganization2(inst) + + js = inst.as_json() + self.assertEqual("Organization", js["resourceType"]) + inst2 = organization.Organization(js) + self.implOrganization2(inst2) + + def implOrganization2(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.text.status, "generated") + + def testOrganization3(self): + inst = self.instantiate_from("organization-example-gastro.json") + self.assertIsNotNone(inst, "Must have instantiated a Organization instance") + self.implOrganization3(inst) + + js = inst.as_json() + self.assertEqual("Organization", js["resourceType"]) + inst2 = organization.Organization(js) + 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.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-lab.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.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.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 testOrganization5(self): + inst = self.instantiate_from("organization-example-f002-burgers-card.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].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.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 testOrganization6(self): + inst = self.instantiate_from("organization-example-f201-aumc.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].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.contact[0].address.city, "Den helder") + self.assertEqual(inst.contact[0].address.country, "NLD") + self.assertEqual(inst.contact[0].address.line[0], "Walvisbaai 3") + self.assertEqual(inst.contact[0].address.line[1], "Gebouw 2") + self.assertEqual(inst.contact[0].address.postalCode, "2333ZA") + self.assertEqual(inst.contact[0].name.family, "Brand") + self.assertEqual(inst.contact[0].name.given[0], "Ronald") + self.assertEqual(inst.contact[0].name.prefix[0], "Prof.Dr.") + self.assertEqual(inst.contact[0].name.text, "Professor Brand") + self.assertEqual(inst.contact[0].name.use, "official") + 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, "+31715269702") + self.assertEqual(inst.id, "f201") + 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.name, "Artis University Medical Center (AUMC)") + 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") + 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, "V6") + self.assertEqual(inst.type[0].coding[1].display, "University Medical Hospital") + 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 testOrganization7(self): + inst = self.instantiate_from("organization-example-good-health-care.json") + self.assertIsNotNone(inst, "Must have instantiated a Organization instance") + self.implOrganization7(inst) + + js = inst.as_json() + self.assertEqual("Organization", js["resourceType"]) + inst2 = organization.Organization(js) + self.implOrganization7(inst2) + + def implOrganization7(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.name, "Good Health Clinic") + self.assertEqual(inst.text.status, "generated") + + def testOrganization8(self): + inst = self.instantiate_from("organization-example-f001-burgers.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.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.telecom[0].system, "phone") + self.assertEqual(inst.telecom[0].use, "work") + 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://hl7.org/fhir/organization-type") + + def testOrganization9(self): + inst = self.instantiate_from("organization-example-insurer.json") + self.assertIsNotNone(inst, "Must have instantiated a Organization instance") + self.implOrganization9(inst) + + js = inst.as_json() + self.assertEqual("Organization", js["resourceType"]) + inst2 = organization.Organization(js) + self.implOrganization9(inst2) + + def implOrganization9(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 testOrganization10(self): + inst = self.instantiate_from("organization-example-f203-bumc.json") + self.assertIsNotNone(inst, "Must have instantiated a Organization instance") + self.implOrganization10(inst) + + js = inst.as_json() + self.assertEqual("Organization", js["resourceType"]) + inst2 = organization.Organization(js) + self.implOrganization10(inst2) + + def implOrganization10(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") + diff --git a/fhirclient/models/STU3/parameterdefinition.py b/fhirclient/models/STU3/parameterdefinition.py new file mode 100644 index 000000000..8dc40ffc2 --- /dev/null +++ b/fhirclient/models/STU3/parameterdefinition.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ParameterDefinition) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class ParameterDefinition(element.Element): + """ Definition of a parameter to a module. + + The parameters to the module. This collection specifies both the input and + output parameters. Input parameters are provided by the caller as part of + the $evaluate operation. Output parameters are included in the + GuidanceResponse. + """ + + resource_type = "ParameterDefinition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ A brief description of the parameter. + Type `str`. """ + + self.max = None + """ Maximum cardinality (a number of *). + Type `str`. """ + + self.min = None + """ Minimum cardinality. + Type `int`. """ + + self.name = None + """ Name used to access the parameter value. + Type `str`. """ + + self.profile = None + """ What profile the value is expected to be. + Type `FHIRReference` referencing `StructureDefinition` (represented as `dict` in JSON). """ + + self.type = None + """ What type of value. + Type `str`. """ + + self.use = None + """ in | out. + Type `str`. """ + + super(ParameterDefinition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ParameterDefinition, self).elementProperties() + js.extend([ + ("documentation", "documentation", str, False, None, False), + ("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), + ("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/STU3/parameters.py b/fhirclient/models/STU3/parameters.py new file mode 100644 index 000000000..fc9d8c6a1 --- /dev/null +++ b/fhirclient/models/STU3/parameters.py @@ -0,0 +1,366 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Parameters) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import resource + +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. + """ + + resource_type = "Parameters" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.parameter = None + """ Operation Parameter. + List of `ParametersParameter` items (represented as `dict` in JSON). """ + + super(Parameters, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Parameters, self).elementProperties() + js.extend([ + ("parameter", "parameter", ParametersParameter, True, None, False), + ]) + return js + + +from . import backboneelement + +class ParametersParameter(backboneelement.BackboneElement): + """ Operation Parameter. + + A parameter passed to or received from the operation. + """ + + resource_type = "ParametersParameter" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 from the definition. + Type `str`. """ + + self.part = None + """ Named part of a multi-part parameter. + List of `ParametersParameter` items (represented as `dict` in JSON). """ + + self.resource = None + """ If parameter is a whole resource. + Type `Resource` (represented as `dict` in JSON). """ + + self.valueAddress = None + """ If parameter is a data type. + Type `Address` (represented as `dict` in JSON). """ + + self.valueAge = None + """ If parameter is a data type. + Type `Age` (represented as `dict` in JSON). """ + + self.valueAnnotation = None + """ If parameter is a data type. + Type `Annotation` (represented as `dict` in JSON). """ + + self.valueAttachment = None + """ If parameter is a data type. + Type `Attachment` (represented as `dict` in JSON). """ + + self.valueBase64Binary = None + """ If parameter is a data type. + Type `str`. """ + + self.valueBoolean = None + """ If parameter is a data type. + Type `bool`. """ + + self.valueCode = None + """ If parameter is a data type. + Type `str`. """ + + self.valueCodeableConcept = None + """ If parameter is a data type. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueCoding = None + """ If parameter is a data type. + Type `Coding` (represented as `dict` in JSON). """ + + self.valueContactPoint = None + """ If parameter is a data type. + Type `ContactPoint` (represented as `dict` in JSON). """ + + self.valueCount = None + """ If parameter is a data type. + Type `Count` (represented as `dict` in JSON). """ + + self.valueDate = None + """ If parameter is a data type. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueDateTime = None + """ If parameter is a data type. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueDecimal = None + """ If parameter is a data type. + Type `float`. """ + + self.valueDistance = None + """ If parameter is a data type. + Type `Distance` (represented as `dict` in JSON). """ + + self.valueDuration = None + """ If parameter is a data type. + Type `Duration` (represented as `dict` in JSON). """ + + self.valueHumanName = None + """ If parameter is a data type. + Type `HumanName` (represented as `dict` in JSON). """ + + self.valueId = None + """ If parameter is a data type. + Type `str`. """ + + self.valueIdentifier = None + """ If parameter is a data type. + Type `Identifier` (represented as `dict` in JSON). """ + + self.valueInstant = None + """ If parameter is a data type. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueInteger = None + """ If parameter is a data type. + Type `int`. """ + + self.valueMarkdown = None + """ 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). """ + + self.valueOid = None + """ If parameter is a data type. + Type `str`. """ + + self.valuePeriod = None + """ If parameter is a data type. + Type `Period` (represented as `dict` in JSON). """ + + self.valuePositiveInt = None + """ If parameter is a data type. + Type `int`. """ + + self.valueQuantity = None + """ If parameter is a data type. + Type `Quantity` (represented as `dict` in JSON). """ + + self.valueRange = None + """ If parameter is a data type. + Type `Range` (represented as `dict` in JSON). """ + + self.valueRatio = None + """ If parameter is a data type. + Type `Ratio` (represented as `dict` in JSON). """ + + self.valueReference = None + """ If parameter is a data type. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.valueSampledData = None + """ If parameter is a data type. + Type `SampledData` (represented as `dict` in JSON). """ + + self.valueSignature = None + """ If parameter is a data type. + Type `Signature` (represented as `dict` in JSON). """ + + self.valueString = None + """ If parameter is a data type. + Type `str`. """ + + self.valueTime = None + """ If parameter is a data type. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueTiming = None + """ If parameter is a data type. + Type `Timing` (represented as `dict` in JSON). """ + + self.valueUnsignedInt = None + """ If parameter is a data type. + Type `int`. """ + + self.valueUri = None + """ If parameter is a data type. + Type `str`. """ + + super(ParametersParameter, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ParametersParameter, self).elementProperties() + js.extend([ + ("name", "name", str, False, None, True), + ("part", "part", ParametersParameter, True, None, False), + ("resource", "resource", resource.Resource, False, None, False), + ("valueAddress", "valueAddress", address.Address, False, "value", False), + ("valueAge", "valueAge", age.Age, False, "value", False), + ("valueAnnotation", "valueAnnotation", annotation.Annotation, False, "value", False), + ("valueAttachment", "valueAttachment", attachment.Attachment, False, "value", False), + ("valueBase64Binary", "valueBase64Binary", str, False, "value", False), + ("valueBoolean", "valueBoolean", bool, False, "value", False), + ("valueCode", "valueCode", str, False, "value", False), + ("valueCodeableConcept", "valueCodeableConcept", codeableconcept.CodeableConcept, False, "value", False), + ("valueCoding", "valueCoding", coding.Coding, False, "value", False), + ("valueContactPoint", "valueContactPoint", contactpoint.ContactPoint, False, "value", False), + ("valueCount", "valueCount", count.Count, 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), + ("valueDuration", "valueDuration", duration.Duration, 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), + ("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), + ("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), + ("valueUnsignedInt", "valueUnsignedInt", int, False, "value", False), + ("valueUri", "valueUri", str, False, "value", False), + ]) + return js + + +import sys +try: + from . import address +except ImportError: + address = sys.modules[__package__ + '.address'] +try: + from . import age +except ImportError: + age = sys.modules[__package__ + '.age'] +try: + from . import annotation +except ImportError: + annotation = sys.modules[__package__ + '.annotation'] +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 coding +except ImportError: + coding = sys.modules[__package__ + '.coding'] +try: + from . import contactpoint +except ImportError: + contactpoint = sys.modules[__package__ + '.contactpoint'] +try: + from . import count +except ImportError: + count = sys.modules[__package__ + '.count'] +try: + from . import distance +except ImportError: + distance = sys.modules[__package__ + '.distance'] +try: + from . import duration +except ImportError: + duration = sys.modules[__package__ + '.duration'] +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 humanname +except ImportError: + humanname = sys.modules[__package__ + '.humanname'] +try: + 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 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 sampleddata +except ImportError: + sampleddata = sys.modules[__package__ + '.sampleddata'] +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/STU3/parameters_tests.py b/fhirclient/models/STU3/parameters_tests.py new file mode 100644 index 000000000..94e19422b --- /dev/null +++ b/fhirclient/models/STU3/parameters_tests.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import parameters +from .fhirdate import FHIRDate + + +class ParametersTests(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("Parameters", js["resourceType"]) + return parameters.Parameters(js) + + def testParameters1(self): + inst = self.instantiate_from("parameters-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Parameters instance") + self.implParameters1(inst) + + js = inst.as_json() + self.assertEqual("Parameters", js["resourceType"]) + inst2 = parameters.Parameters(js) + 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") + diff --git a/fhirclient/models/STU3/patient.py b/fhirclient/models/STU3/patient.py new file mode 100644 index 000000000..efc387549 --- /dev/null +++ b/fhirclient/models/STU3/patient.py @@ -0,0 +1,344 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Patient) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Patient(domainresource.DomainResource): + """ Information about an individual or animal receiving health care services. + + Demographics and other administrative information about an individual or + animal receiving care or other health-related services. + """ + + resource_type = "Patient" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 patient's record is in active use. + Type `bool`. """ + + self.address = None + """ Addresses 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. + List of `PatientCommunication` items (represented as `dict` in JSON). """ + + self.contact = None + """ A contact party (e.g. guardian, partner, friend) for the patient. + List of `PatientContact` items (represented as `dict` in JSON). """ + + self.deceasedBoolean = None + """ Indicates if the individual is deceased or not. + Type `bool`. """ + + self.deceasedDateTime = None + """ Indicates if the individual is deceased or not. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.gender = None + """ male | female | other | unknown. + Type `str`. """ + + self.generalPractitioner = None + """ Patient's nominated primary care provider. + List of `FHIRReference` items referencing `Organization, Practitioner` (represented as `dict` in JSON). """ + + self.identifier = None + """ An identifier for this patient. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.link = None + """ Link to another patient resource that concerns the same actual + person. + List of `PatientLink` items (represented as `dict` in JSON). """ + + self.managingOrganization = None + """ Organization that is the custodian of the patient record. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.maritalStatus = None + """ Marital (civil) status of a patient. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.multipleBirthBoolean = None + """ Whether patient is part of a multiple birth. + Type `bool`. """ + + self.multipleBirthInteger = None + """ Whether patient is part of a multiple birth. + Type `int`. """ + + self.name = None + """ A name associated with the patient. + List of `HumanName` items (represented as `dict` in JSON). """ + + self.photo = None + """ Image of the patient. + List of `Attachment` items (represented as `dict` in JSON). """ + + self.telecom = None + """ A contact detail for the individual. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(Patient, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Patient, self).elementProperties() + 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), + ("deceasedBoolean", "deceasedBoolean", bool, False, "deceased", False), + ("deceasedDateTime", "deceasedDateTime", fhirdate.FHIRDate, False, "deceased", False), + ("gender", "gender", str, False, None, False), + ("generalPractitioner", "generalPractitioner", fhirreference.FHIRReference, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("link", "link", PatientLink, True, None, False), + ("managingOrganization", "managingOrganization", fhirreference.FHIRReference, False, None, False), + ("maritalStatus", "maritalStatus", codeableconcept.CodeableConcept, False, None, False), + ("multipleBirthBoolean", "multipleBirthBoolean", bool, False, "multipleBirth", False), + ("multipleBirthInteger", "multipleBirthInteger", int, False, "multipleBirth", False), + ("name", "name", humanname.HumanName, True, None, False), + ("photo", "photo", attachment.Attachment, True, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ]) + return js + + +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 + her health. + """ + + resource_type = "PatientCommunication" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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(PatientCommunication, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PatientCommunication, self).elementProperties() + js.extend([ + ("language", "language", codeableconcept.CodeableConcept, False, None, True), + ("preferred", "preferred", bool, False, None, False), + ]) + return js + + +class PatientContact(backboneelement.BackboneElement): + """ A contact party (e.g. guardian, partner, friend) for the patient. + """ + + resource_type = "PatientContact" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Address for the contact person. + Type `Address` (represented as `dict` in JSON). """ + + self.gender = None + """ male | female | other | unknown. + Type `str`. """ + + self.name = None + """ A name associated with the contact person. + Type `HumanName` (represented as `dict` in JSON). """ + + self.organization = None + """ Organization that is associated with the contact. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.period = None + """ The period during which this contact person or organization is + valid to be contacted relating to this patient. + Type `Period` (represented as `dict` in JSON). """ + + self.relationship = None + """ The kind of relationship. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.telecom = None + """ A contact detail for the person. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(PatientContact, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PatientContact, self).elementProperties() + js.extend([ + ("address", "address", address.Address, False, None, False), + ("gender", "gender", str, False, None, False), + ("name", "name", humanname.HumanName, False, None, False), + ("organization", "organization", fhirreference.FHIRReference, False, None, False), + ("period", "period", period.Period, False, None, False), + ("relationship", "relationship", codeableconcept.CodeableConcept, True, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ]) + return js + + +class PatientLink(backboneelement.BackboneElement): + """ Link to another patient resource that concerns the same actual person. + + Link to another patient resource that concerns the same actual patient. + """ + + resource_type = "PatientLink" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + 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). """ + + self.type = None + """ replaced-by | replaces | refer | seealso - type of link. + Type `str`. """ + + super(PatientLink, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PatientLink, self).elementProperties() + js.extend([ + ("other", "other", fhirreference.FHIRReference, False, None, True), + ("type", "type", str, False, None, True), + ]) + return js + + +import sys +try: + from . import address +except ImportError: + address = sys.modules[__package__ + '.address'] +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 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: + 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 period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/STU3/patient_tests.py b/fhirclient/models/STU3/patient_tests.py new file mode 100644 index 000000000..f29ca9bad --- /dev/null +++ b/fhirclient/models/STU3/patient_tests.py @@ -0,0 +1,415 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import patient +from .fhirdate import FHIRDate + + +class PatientTests(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("Patient", js["resourceType"]) + return patient.Patient(js) + + def testPatient1(self): + inst = self.instantiate_from("patient-example-xds.json") + self.assertIsNotNone(inst, "Must have instantiated a Patient instance") + self.implPatient1(inst) + + js = inst.as_json() + self.assertEqual("Patient", js["resourceType"]) + inst2 = patient.Patient(js) + self.implPatient1(inst2) + + def implPatient1(self, inst): + self.assertTrue(inst.active) + 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, "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].use, "usual") + self.assertEqual(inst.identifier[0].value, "89765a87b") + 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-f001-pieter.json") + self.assertIsNotNone(inst, "Must have instantiated a Patient instance") + self.implPatient2(inst) + + js = inst.as_json() + self.assertEqual("Patient", js["resourceType"]) + inst2 = patient.Patient(js) + self.implPatient2(inst2) + + def implPatient2(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].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.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-d.json") + self.assertIsNotNone(inst, "Must have instantiated a Patient instance") + self.implPatient3(inst) + + js = inst.as_json() + self.assertEqual("Patient", js["resourceType"]) + inst2 = patient.Patient(js) + self.implPatient3(inst2) + + def implPatient3(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.text.status, "generated") + + def testPatient4(self): + inst = self.instantiate_from("patient-genetics-example1.json") + self.assertIsNotNone(inst, "Must have instantiated a Patient instance") + self.implPatient4(inst) + + js = inst.as_json() + self.assertEqual("Patient", js["resourceType"]) + inst2 = patient.Patient(js) + self.implPatient4(inst2) + + def implPatient4(self, inst): + self.assertTrue(inst.active) + self.assertEqual(inst.address[0].line[0], "2222 Home Street") + self.assertEqual(inst.address[0].use, "home") + 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://hl7.org/fhir/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.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, "work") + self.assertEqual(inst.telecom[0].value, "555-555-2003") + self.assertEqual(inst.text.status, "generated") + + def testPatient5(self): + inst = self.instantiate_from("patient-example-b.json") + self.assertIsNotNone(inst, "Must have instantiated a Patient instance") + self.implPatient5(inst) + + js = inst.as_json() + self.assertEqual("Patient", js["resourceType"]) + inst2 = patient.Patient(js) + self.implPatient5(inst2) + + def implPatient5(self, inst): + self.assertTrue(inst.active) + 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://hl7.org/fhir/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.name[0].use, "official") + self.assertEqual(inst.photo[0].contentType, "image/gif") + self.assertEqual(inst.text.status, "generated") + + def testPatient6(self): + inst = self.instantiate_from("patient-example-c.json") + self.assertIsNotNone(inst, "Must have instantiated a Patient instance") + self.implPatient6(inst) + + js = inst.as_json() + self.assertEqual("Patient", js["resourceType"]) + inst2 = patient.Patient(js) + self.implPatient6(inst2) + + def implPatient6(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.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.name[0].use, "official") + self.assertEqual(inst.text.status, "generated") + + def testPatient7(self): + inst = self.instantiate_from("patient-example-ihe-pcd.json") + self.assertIsNotNone(inst, "Must have instantiated a Patient instance") + self.implPatient7(inst) + + js = inst.as_json() + self.assertEqual("Patient", js["resourceType"]) + inst2 = patient.Patient(js) + self.implPatient7(inst2) + + def implPatient7(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.text.status, "generated") + + def testPatient8(self): + inst = self.instantiate_from("patient-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Patient instance") + self.implPatient8(inst) + + js = inst.as_json() + self.assertEqual("Patient", js["resourceType"]) + inst2 = patient.Patient(js) + self.implPatient8(inst2) + + def implPatient8(self, inst): + self.assertTrue(inst.active) + self.assertEqual(inst.address[0].city, "PleasantVille") + self.assertEqual(inst.address[0].district, "Rainbow") + self.assertEqual(inst.address[0].line[0], "534 Erewhon St") + 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, "3999") + self.assertEqual(inst.address[0].state, "Vic") + self.assertEqual(inst.address[0].text, "534 Erewhon St PeasantVille, Rainbow, Vic 3999") + 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.assertEqual(inst.contact[0].address.city, "PleasantVille") + self.assertEqual(inst.contact[0].address.district, "Rainbow") + self.assertEqual(inst.contact[0].address.line[0], "534 Erewhon St") + self.assertEqual(inst.contact[0].address.period.start.date, FHIRDate("1974-12-25").date) + self.assertEqual(inst.contact[0].address.period.start.as_json(), "1974-12-25") + self.assertEqual(inst.contact[0].address.postalCode, "3999") + self.assertEqual(inst.contact[0].address.state, "Vic") + self.assertEqual(inst.contact[0].address.type, "both") + self.assertEqual(inst.contact[0].address.use, "home") + self.assertEqual(inst.contact[0].gender, "female") + self.assertEqual(inst.contact[0].name.family, "du Marché") + self.assertEqual(inst.contact[0].name.given[0], "Bénédicte") + self.assertEqual(inst.contact[0].period.start.date, FHIRDate("2012").date) + self.assertEqual(inst.contact[0].period.start.as_json(), "2012") + self.assertEqual(inst.contact[0].relationship[0].coding[0].code, "N") + 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].value, "+33 (237) 998327") + self.assertFalse(inst.deceasedBoolean) + self.assertEqual(inst.gender, "male") + self.assertEqual(inst.id, "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, "12345") + 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.name[1].given[0], "Jim") + self.assertEqual(inst.name[1].use, "usual") + self.assertEqual(inst.name[2].family, "Windsor") + self.assertEqual(inst.name[2].given[0], "Peter") + self.assertEqual(inst.name[2].given[1], "James") + self.assertEqual(inst.name[2].period.end.date, FHIRDate("2002").date) + self.assertEqual(inst.name[2].period.end.as_json(), "2002") + self.assertEqual(inst.name[2].use, "maiden") + self.assertEqual(inst.telecom[0].use, "home") + self.assertEqual(inst.telecom[1].rank, 1) + self.assertEqual(inst.telecom[1].system, "phone") + self.assertEqual(inst.telecom[1].use, "work") + self.assertEqual(inst.telecom[1].value, "(03) 5555 6473") + self.assertEqual(inst.telecom[2].rank, 2) + self.assertEqual(inst.telecom[2].system, "phone") + self.assertEqual(inst.telecom[2].use, "mobile") + self.assertEqual(inst.telecom[2].value, "(03) 3410 5613") + self.assertEqual(inst.telecom[3].period.end.date, FHIRDate("2014").date) + self.assertEqual(inst.telecom[3].period.end.as_json(), "2014") + self.assertEqual(inst.telecom[3].system, "phone") + self.assertEqual(inst.telecom[3].use, "old") + self.assertEqual(inst.telecom[3].value, "(03) 5555 8834") + self.assertEqual(inst.text.status, "generated") + + def testPatient9(self): + inst = self.instantiate_from("patient-example-proband.json") + self.assertIsNotNone(inst, "Must have instantiated a Patient instance") + self.implPatient9(inst) + + js = inst.as_json() + self.assertEqual("Patient", js["resourceType"]) + inst2 = patient.Patient(js) + self.implPatient9(inst2) + + def implPatient9(self, inst): + self.assertTrue(inst.active) + self.assertEqual(inst.birthDate.date, FHIRDate("1966-04-04").date) + self.assertEqual(inst.birthDate.as_json(), "1966-04-04") + self.assertFalse(inst.deceasedBoolean) + self.assertEqual(inst.gender, "female") + self.assertEqual(inst.id, "proband") + self.assertEqual(inst.identifier[0].system, "urn:oid:2.16.840.1.113883.6.117") + self.assertEqual(inst.identifier[0].type.text, "Computer-Stored Abulatory Records (COSTAR)") + self.assertEqual(inst.identifier[0].use, "usual") + self.assertEqual(inst.identifier[0].value, "999999999") + self.assertEqual(inst.text.status, "generated") + + def testPatient10(self): + inst = self.instantiate_from("patient-example-f201-roel.json") + self.assertIsNotNone(inst, "Must have instantiated a Patient instance") + self.implPatient10(inst) + + js = inst.as_json() + self.assertEqual("Patient", js["resourceType"]) + inst2 = patient.Patient(js) + self.implPatient10(inst2) + + def implPatient10(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.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.text.status, "generated") + diff --git a/fhirclient/models/STU3/paymentnotice.py b/fhirclient/models/STU3/paymentnotice.py new file mode 100644 index 000000000..12918aba8 --- /dev/null +++ b/fhirclient/models/STU3/paymentnotice.py @@ -0,0 +1,102 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/PaymentNotice) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class PaymentNotice(domainresource.DomainResource): + """ PaymentNotice request. + + This resource provides the status of the payment for goods and services + rendered, and the request and response resource references. + """ + + resource_type = "PaymentNotice" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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.identifier = None + """ Business Identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.organization = None + """ Responsible organization. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.paymentStatus = None + """ Whether payment has been sent or cleared. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.provider = None + """ Responsible practitioner. + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + self.request = None + """ Request reference. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.response = None + """ Response reference. + Type `FHIRReference` referencing `Resource` (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), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("organization", "organization", fhirreference.FHIRReference, False, None, False), + ("paymentStatus", "paymentStatus", codeableconcept.CodeableConcept, False, None, False), + ("provider", "provider", fhirreference.FHIRReference, False, None, False), + ("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), + ]) + 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/STU3/paymentnotice_tests.py b/fhirclient/models/STU3/paymentnotice_tests.py new file mode 100644 index 000000000..14dc09d9d --- /dev/null +++ b/fhirclient/models/STU3/paymentnotice_tests.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import paymentnotice +from .fhirdate import FHIRDate + + +class PaymentNoticeTests(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("PaymentNotice", js["resourceType"]) + return paymentnotice.PaymentNotice(js) + + def testPaymentNotice1(self): + inst = self.instantiate_from("paymentnotice-example.json") + self.assertIsNotNone(inst, "Must have instantiated a PaymentNotice instance") + self.implPaymentNotice1(inst) + + js = inst.as_json() + self.assertEqual("PaymentNotice", js["resourceType"]) + inst2 = paymentnotice.PaymentNotice(js) + self.implPaymentNotice1(inst2) + + def implPaymentNotice1(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, "77654") + self.assertEqual(inst.identifier[0].system, "http://benefitsinc.com/paymentnotice") + self.assertEqual(inst.identifier[0].value, "776543") + self.assertEqual(inst.paymentStatus.coding[0].code, "paid") + self.assertEqual(inst.paymentStatus.coding[0].system, "http://hl7.org/fhir/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/STU3/paymentreconciliation.py b/fhirclient/models/STU3/paymentreconciliation.py new file mode 100644 index 000000000..096c9033e --- /dev/null +++ b/fhirclient/models/STU3/paymentreconciliation.py @@ -0,0 +1,227 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/PaymentReconciliation) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class PaymentReconciliation(domainresource.DomainResource): + """ PaymentReconciliation resource. + + This resource provides payment details and claim references supporting a + bulk payment. + """ + + resource_type = "PaymentReconciliation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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.detail = None + """ List of settlements. + List of `PaymentReconciliationDetail` items (represented as `dict` in JSON). """ + + self.disposition = None + """ Disposition Message. + Type `str`. """ + + 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 + """ Insurer. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.outcome = None + """ complete | error | partial. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.period = None + """ Period covered. + Type `Period` (represented as `dict` in JSON). """ + + self.processNote = None + """ Processing comments. + List of `PaymentReconciliationProcessNote` items (represented as `dict` in JSON). """ + + self.request = None + """ Claim reference. + Type `FHIRReference` referencing `ProcessRequest` (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`. """ + + 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), + ("detail", "detail", PaymentReconciliationDetail, True, None, False), + ("disposition", "disposition", str, False, 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), + ("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), + ]) + return js + + +from . import backboneelement + +class PaymentReconciliationDetail(backboneelement.BackboneElement): + """ List of settlements. + + List of individual settlement amounts and the corresponding transaction. + """ + + resource_type = "PaymentReconciliationDetail" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 being paid. + Type `Money` (represented as `dict` in JSON). """ + + self.date = None + """ Invoice date. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.payee = None + """ Organization which is receiving the payment. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.request = None + """ Claim. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.response = None + """ Claim Response. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.submitter = None + """ Organization which submitted the claim. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.type = None + """ Type code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(PaymentReconciliationDetail, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PaymentReconciliationDetail, self).elementProperties() + js.extend([ + ("amount", "amount", money.Money, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("payee", "payee", fhirreference.FHIRReference, False, None, False), + ("request", "request", fhirreference.FHIRReference, False, None, False), + ("response", "response", fhirreference.FHIRReference, False, None, False), + ("submitter", "submitter", fhirreference.FHIRReference, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +class PaymentReconciliationProcessNote(backboneelement.BackboneElement): + """ Processing comments. + + Suite of notes. + """ + + resource_type = "PaymentReconciliationProcessNote" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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(PaymentReconciliationProcessNote, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PaymentReconciliationProcessNote, 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'] +try: + 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/STU3/paymentreconciliation_tests.py b/fhirclient/models/STU3/paymentreconciliation_tests.py new file mode 100644 index 000000000..dbeab30cc --- /dev/null +++ b/fhirclient/models/STU3/paymentreconciliation_tests.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import paymentreconciliation +from .fhirdate import FHIRDate + + +class PaymentReconciliationTests(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("PaymentReconciliation", js["resourceType"]) + return paymentreconciliation.PaymentReconciliation(js) + + def testPaymentReconciliation1(self): + inst = self.instantiate_from("paymentreconciliation-example.json") + self.assertIsNotNone(inst, "Must have instantiated a PaymentReconciliation instance") + self.implPaymentReconciliation1(inst) + + js = inst.as_json() + self.assertEqual("PaymentReconciliation", js["resourceType"]) + inst2 = paymentreconciliation.PaymentReconciliation(js) + self.implPaymentReconciliation1(inst2) + + 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].date.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.detail[0].date.as_json(), "2014-08-16") + 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[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].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[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].type.coding[0].code, "advance") + self.assertEqual(inst.detail[2].type.coding[0].system, "http://hl7.org/fhir/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.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.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.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/STU3/period.py b/fhirclient/models/STU3/period.py new file mode 100644 index 000000000..b0c2895d4 --- /dev/null +++ b/fhirclient/models/STU3/period.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Period) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Period(element.Element): + """ Time range defined by start and end date/time. + + A time period defined by a start and end date and optionally time. + """ + + resource_type = "Period" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ End time with inclusive boundary, if not ongoing. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.start = None + """ Starting time with inclusive boundary. + Type `FHIRDate` (represented as `str` in JSON). """ + + super(Period, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Period, self).elementProperties() + js.extend([ + ("end", "end", fhirdate.FHIRDate, False, None, False), + ("start", "start", fhirdate.FHIRDate, False, None, False), + ]) + return js + + +import sys +try: + from . import fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] diff --git a/fhirclient/models/STU3/person.py b/fhirclient/models/STU3/person.py new file mode 100644 index 000000000..599816ab0 --- /dev/null +++ b/fhirclient/models/STU3/person.py @@ -0,0 +1,149 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Person) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Person(domainresource.DomainResource): + """ A generic person record. + + Demographics and administrative information about a person independent of a + specific health-related context. + """ + + resource_type = "Person" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ This person's record is in active use. + Type `bool`. """ + + self.address = None + """ One or more addresses for the person. + List of `Address` items (represented as `dict` in JSON). """ + + self.birthDate = None + """ The date on which the person was born. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.gender = None + """ male | female | other | unknown. + Type `str`. """ + + self.identifier = None + """ A human identifier for this person. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.link = None + """ Link to a resource that concerns the same actual person. + List of `PersonLink` items (represented as `dict` in JSON). """ + + self.managingOrganization = None + """ The organization that is the custodian of the person record. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.name = None + """ A name associated with the person. + List of `HumanName` items (represented as `dict` in JSON). """ + + self.photo = None + """ Image of the person. + Type `Attachment` (represented as `dict` in JSON). """ + + self.telecom = None + """ A contact detail for the person. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(Person, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Person, self).elementProperties() + js.extend([ + ("active", "active", bool, False, None, False), + ("address", "address", address.Address, True, None, False), + ("birthDate", "birthDate", fhirdate.FHIRDate, False, None, False), + ("gender", "gender", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("link", "link", PersonLink, True, None, False), + ("managingOrganization", "managingOrganization", fhirreference.FHIRReference, False, None, False), + ("name", "name", humanname.HumanName, True, None, False), + ("photo", "photo", attachment.Attachment, False, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ]) + return js + + +from . import backboneelement + +class PersonLink(backboneelement.BackboneElement): + """ Link to a resource that concerns the same actual person. + """ + + resource_type = "PersonLink" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.assurance = None + """ level1 | level2 | level3 | level4. + Type `str`. """ + + self.target = None + """ The resource to which this actual person is associated. + Type `FHIRReference` referencing `Patient, Practitioner, RelatedPerson, Person` (represented as `dict` in JSON). """ + + super(PersonLink, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PersonLink, self).elementProperties() + js.extend([ + ("assurance", "assurance", str, False, None, False), + ("target", "target", fhirreference.FHIRReference, False, None, True), + ]) + return js + + +import sys +try: + from . import address +except ImportError: + address = sys.modules[__package__ + '.address'] +try: + from . import attachment +except ImportError: + attachment = sys.modules[__package__ + '.attachment'] +try: + 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: + 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'] diff --git a/fhirclient/models/STU3/person_tests.py b/fhirclient/models/STU3/person_tests.py new file mode 100644 index 000000000..6d750e56b --- /dev/null +++ b/fhirclient/models/STU3/person_tests.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import person +from .fhirdate import FHIRDate + + +class PersonTests(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("Person", js["resourceType"]) + return person.Person(js) + + def testPerson1(self): + inst = self.instantiate_from("person-example-f002-ariadne.json") + self.assertIsNotNone(inst, "Must have instantiated a Person instance") + self.implPerson1(inst) + + js = inst.as_json() + self.assertEqual("Person", js["resourceType"]) + inst2 = person.Person(js) + self.implPerson1(inst2) + + def implPerson1(self, inst): + self.assertTrue(inst.active) + 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.name[0].use, "usual") + self.assertEqual(inst.photo.contentType, "image/jpeg") + 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") + + def testPerson2(self): + inst = self.instantiate_from("person-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Person instance") + self.implPerson2(inst) + + js = inst.as_json() + self.assertEqual("Person", js["resourceType"]) + inst2 = person.Person(js) + self.implPerson2(inst2) + + def implPerson2(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.birthDate.date, FHIRDate("1974-12-25").date) + self.assertEqual(inst.birthDate.as_json(), "1974-12-25") + self.assertEqual(inst.gender, "male") + self.assertEqual(inst.id, "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, "12345") + 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.name[1].given[0], "Jim") + self.assertEqual(inst.name[1].use, "usual") + 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, "(03) 5555 6473") + self.assertEqual(inst.telecom[2].system, "email") + self.assertEqual(inst.telecom[2].use, "home") + self.assertEqual(inst.telecom[2].value, "Jim@example.org") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/STU3/plandefinition.py b/fhirclient/models/STU3/plandefinition.py new file mode 100644 index 000000000..ed1c01623 --- /dev/null +++ b/fhirclient/models/STU3/plandefinition.py @@ -0,0 +1,696 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/PlanDefinition) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class PlanDefinition(domainresource.DomainResource): + """ The definition of a plan for a series of actions, independent of any + specific patient or context. + + This resource allows for the definition of various types of plans as a + sharable, consumable, and executable artifact. The resource is general + enough to support the description of a broad range of clinical artifacts + such as clinical decision support rules, order sets and protocols. + """ + + resource_type = "PlanDefinition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Action defined by the plan. + List of `PlanDefinitionAction` items (represented as `dict` in JSON). """ + + self.approvalDate = None + """ When the plan definition was approved by publisher. + Type `FHIRDate` (represented as `str` 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. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Natural language description of the plan definition. + Type `str`. """ + + self.effectivePeriod = None + """ When the plan 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.goal = None + """ What the plan is trying to accomplish. + List of `PlanDefinitionGoal` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Additional identifier for the plan definition. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ Intended jurisdiction for plan definition (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.lastReviewDate = None + """ When the plan definition was last reviewed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.library = None + """ Logic used by the plan definition. + List of `FHIRReference` items referencing `Library` (represented as `dict` in JSON). """ + + self.name = None + """ Name for this plan definition (computer friendly). + Type `str`. """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this plan definition is defined. + Type `str`. """ + + self.relatedArtifact = None + """ Related artifacts for the asset. + List of `RelatedArtifact` items (represented as `dict` in JSON). """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.title = None + """ Name for this plan definition (human friendly). + Type `str`. """ + + self.topic = None + """ E.g. Education, Treatment, Assessment, etc. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.type = None + """ order-set | protocol | eca-rule. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.url = None + """ Logical URI to reference this plan definition (globally unique). + Type `str`. """ + + self.usage = None + """ Describes the clinical usage of the asset. + 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 plan definition. + Type `str`. """ + + super(PlanDefinition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PlanDefinition, self).elementProperties() + js.extend([ + ("action", "action", PlanDefinitionAction, True, None, False), + ("approvalDate", "approvalDate", fhirdate.FHIRDate, 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), + ("effectivePeriod", "effectivePeriod", period.Period, False, 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), + ("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), + ("status", "status", str, False, None, True), + ("title", "title", str, False, None, False), + ("topic", "topic", codeableconcept.CodeableConcept, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, 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 + + +from . import backboneelement + +class PlanDefinitionAction(backboneelement.BackboneElement): + """ Action defined by the plan. + + An action to be taken as part of the plan. + """ + + resource_type = "PlanDefinitionAction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ A sub-action. + List of `PlanDefinitionAction` items (represented as `dict` in JSON). """ + + self.cardinalityBehavior = None + """ single | multiple. + Type `str`. """ + + self.code = None + """ Code representing the meaning of the action or sub-actions. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.condition = None + """ Whether or not the action is applicable. + List of `PlanDefinitionActionCondition` items (represented as `dict` in JSON). """ + + self.definition = None + """ Description of the activity to be performed. + Type `FHIRReference` referencing `ActivityDefinition, PlanDefinition` (represented as `dict` in JSON). """ + + self.description = None + """ Short description of the action. + Type `str`. """ + + self.documentation = None + """ Supporting documentation for the intended performer of the action. + List of `RelatedArtifact` items (represented as `dict` in JSON). """ + + self.dynamicValue = None + """ Dynamic aspects of the definition. + List of `PlanDefinitionActionDynamicValue` items (represented as `dict` in JSON). """ + + self.goalId = None + """ What goals this action supports. + List of `str` items. """ + + self.groupingBehavior = None + """ visual-group | logical-group | sentence-group. + Type `str`. """ + + self.input = None + """ 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). """ + + self.participant = None + """ Who should participate in the action. + List of `PlanDefinitionActionParticipant` items (represented as `dict` in JSON). """ + + self.precheckBehavior = None + """ yes | no. + Type `str`. """ + + self.reason = None + """ Why the action should be performed. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.relatedAction = None + """ Relationship to another action. + List of `PlanDefinitionActionRelatedAction` items (represented as `dict` in JSON). """ + + self.requiredBehavior = None + """ must | could | must-unless-documented. + Type `str`. """ + + self.selectionBehavior = None + """ any | all | all-or-none | exactly-one | at-most-one | one-or-more. + Type `str`. """ + + self.textEquivalent = None + """ Static text equivalent of the action, used if the dynamic aspects + cannot be interpreted by the receiving system. + Type `str`. """ + + self.timingDateTime = None + """ When the action should take place. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.timingDuration = None + """ When the action should take place. + Type `Duration` (represented as `dict` in JSON). """ + + self.timingPeriod = None + """ When the action should take place. + Type `Period` (represented as `dict` in JSON). """ + + self.timingRange = None + """ When the action should take place. + Type `Range` (represented as `dict` in JSON). """ + + self.timingTiming = None + """ When the action should take place. + Type `Timing` (represented as `dict` in JSON). """ + + self.title = None + """ User-visible title. + Type `str`. """ + + self.transform = None + """ Transform to apply the template. + Type `FHIRReference` referencing `StructureMap` (represented as `dict` in JSON). """ + + self.triggerDefinition = 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). """ + + super(PlanDefinitionAction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PlanDefinitionAction, self).elementProperties() + js.extend([ + ("action", "action", PlanDefinitionAction, True, None, False), + ("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), + ("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), + ("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), + ("textEquivalent", "textEquivalent", str, False, None, 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), + ]) + return js + + +class PlanDefinitionActionCondition(backboneelement.BackboneElement): + """ Whether or not the action is applicable. + + An expression that describes applicability criteria, or start/stop + conditions for the action. + """ + + resource_type = "PlanDefinitionActionCondition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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.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), + ("kind", "kind", str, False, None, True), + ("language", "language", str, False, None, False), + ]) + return js + + +class PlanDefinitionActionDynamicValue(backboneelement.BackboneElement): + """ Dynamic aspects of the definition. + + Customizations that should be applied to the statically defined resource. + For example, if the dosage of a medication must be computed based on the + patient's weight, a customization would be used to specify an expression + that calculated the weight, and the path on the resource that would contain + the result. + """ + + resource_type = "PlanDefinitionActionDynamicValue" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 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`. """ + + self.path = None + """ The path to the element to be set dynamically. + Type `str`. """ + + super(PlanDefinitionActionDynamicValue, self).__init__(jsondict=jsondict, strict=strict) + + 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), + ("path", "path", str, False, None, False), + ]) + return js + + +class PlanDefinitionActionParticipant(backboneelement.BackboneElement): + """ Who should participate in the action. + + Indicates who should participate in performing the action described. + """ + + resource_type = "PlanDefinitionActionParticipant" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.role = None + """ E.g. Nurse, Surgeon, Parent, etc. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.type = None + """ patient | practitioner | related-person. + Type `str`. """ + + super(PlanDefinitionActionParticipant, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PlanDefinitionActionParticipant, self).elementProperties() + js.extend([ + ("role", "role", codeableconcept.CodeableConcept, False, None, False), + ("type", "type", str, False, None, True), + ]) + return js + + +class PlanDefinitionActionRelatedAction(backboneelement.BackboneElement): + """ Relationship to another action. + + A relationship to another action such as "before" or "30-60 minutes after + start of". + """ + + resource_type = "PlanDefinitionActionRelatedAction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.actionId = None + """ What action is this related to. + Type `str`. """ + + self.offsetDuration = None + """ Time offset for the relationship. + Type `Duration` (represented as `dict` in JSON). """ + + self.offsetRange = None + """ Time offset for the relationship. + Type `Range` (represented as `dict` in JSON). """ + + self.relationship = None + """ before-start | before | before-end | concurrent-with-start | + concurrent | concurrent-with-end | after-start | after | after-end. + Type `str`. """ + + super(PlanDefinitionActionRelatedAction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PlanDefinitionActionRelatedAction, self).elementProperties() + js.extend([ + ("actionId", "actionId", str, False, None, True), + ("offsetDuration", "offsetDuration", duration.Duration, False, "offset", False), + ("offsetRange", "offsetRange", range.Range, False, "offset", False), + ("relationship", "relationship", str, False, None, True), + ]) + return js + + +class PlanDefinitionGoal(backboneelement.BackboneElement): + """ What the plan is trying to accomplish. + + Goals that describe what the activities within the plan are intended to + achieve. For example, weight loss, restoring an activity of daily living, + obtaining herd immunity via immunization, meeting a process improvement + objective, etc. + """ + + resource_type = "PlanDefinitionGoal" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.addresses = None + """ What does the goal address. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.category = None + """ E.g. Treatment, dietary, behavioral, etc. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.description = None + """ Code or text describing the goal. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.documentation = None + """ Supporting documentation for the goal. + List of `RelatedArtifact` items (represented as `dict` in JSON). """ + + self.priority = None + """ high-priority | medium-priority | low-priority. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.start = None + """ When goal pursuit begins. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.target = None + """ Target outcome for the goal. + List of `PlanDefinitionGoalTarget` items (represented as `dict` in JSON). """ + + super(PlanDefinitionGoal, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PlanDefinitionGoal, self).elementProperties() + js.extend([ + ("addresses", "addresses", codeableconcept.CodeableConcept, True, None, False), + ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("description", "description", codeableconcept.CodeableConcept, False, None, True), + ("documentation", "documentation", relatedartifact.RelatedArtifact, True, None, False), + ("priority", "priority", codeableconcept.CodeableConcept, False, None, False), + ("start", "start", codeableconcept.CodeableConcept, False, None, False), + ("target", "target", PlanDefinitionGoalTarget, True, None, False), + ]) + return js + + +class PlanDefinitionGoalTarget(backboneelement.BackboneElement): + """ Target outcome for the goal. + + Indicates what should be done and within what timeframe. + """ + + resource_type = "PlanDefinitionGoalTarget" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.detailCodeableConcept = None + """ The target value to be achieved. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.detailQuantity = None + """ The target value to be achieved. + Type `Quantity` (represented as `dict` in JSON). """ + + self.detailRange = None + """ The target value to be achieved. + Type `Range` (represented as `dict` in JSON). """ + + self.due = None + """ Reach goal within. + Type `Duration` (represented as `dict` in JSON). """ + + self.measure = None + """ The parameter whose value is to be tracked. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(PlanDefinitionGoalTarget, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PlanDefinitionGoalTarget, self).elementProperties() + js.extend([ + ("detailCodeableConcept", "detailCodeableConcept", codeableconcept.CodeableConcept, False, "detail", False), + ("detailQuantity", "detailQuantity", quantity.Quantity, False, "detail", False), + ("detailRange", "detailRange", range.Range, False, "detail", False), + ("due", "due", duration.Duration, False, None, False), + ("measure", "measure", 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 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 duration +except ImportError: + duration = sys.modules[__package__ + '.duration'] +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 quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] +try: + from . import range +except ImportError: + range = sys.modules[__package__ + '.range'] +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/STU3/plandefinition_tests.py b/fhirclient/models/STU3/plandefinition_tests.py new file mode 100644 index 000000000..e824cb1a4 --- /dev/null +++ b/fhirclient/models/STU3/plandefinition_tests.py @@ -0,0 +1,399 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import plandefinition +from .fhirdate import FHIRDate + + +class PlanDefinitionTests(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("PlanDefinition", js["resourceType"]) + return plandefinition.PlanDefinition(js) + + def testPlanDefinition1(self): + inst = self.instantiate_from("plandefinition-example-kdn5-simplified.json") + self.assertIsNotNone(inst, "Must have instantiated a PlanDefinition instance") + self.implPlanDefinition1(inst) + + js = inst.as_json() + self.assertEqual("PlanDefinition", js["resourceType"]) + inst2 = plandefinition.PlanDefinition(js) + self.implPlanDefinition1(inst2) + + def implPlanDefinition1(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") + self.assertEqual(inst.action[0].action[0].action[0].action[0].action[0].extension[0].extension[1].valueInteger, 8) + 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].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") + self.assertEqual(inst.action[0].action[0].action[0].action[0].action[1].id, "action-2") + self.assertEqual(inst.action[0].action[0].action[0].action[0].action[1].relatedAction[0].actionId, "action-1") + self.assertEqual(inst.action[0].action[0].action[0].action[0].action[1].relatedAction[0].relationship, "concurrent-with-start") + self.assertEqual(inst.action[0].action[0].action[0].action[0].action[1].textEquivalent, "CARBOplatin AUC 5 IV over 30 minutes on Day 1") + self.assertEqual(inst.action[0].action[0].action[0].action[0].id, "cycle-definition-1") + self.assertEqual(inst.action[0].action[0].action[0].action[0].textEquivalent, "21-day cycle for 6 cycles") + self.assertEqual(inst.action[0].action[0].action[0].action[0].timingTiming.repeat.count, 6) + self.assertEqual(inst.action[0].action[0].action[0].action[0].timingTiming.repeat.duration, 21) + self.assertEqual(inst.action[0].action[0].action[0].action[0].timingTiming.repeat.durationUnit, "d") + self.assertEqual(inst.action[0].action[0].action[0].groupingBehavior, "sentence-group") + self.assertEqual(inst.action[0].action[0].action[0].selectionBehavior, "exactly-one") + self.assertEqual(inst.action[0].action[0].selectionBehavior, "all") + 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.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") + self.assertEqual(inst.identifier[0].system, "http://example.org/ordertemplates") + 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.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") + self.assertEqual(inst.relatedArtifact[0].url, "http://www.example.org/professionals/physician_gls/PDF/kidney.pdf") + self.assertEqual(inst.relatedArtifact[1].citation, "Oudard S, et al. J Urol. 2007;177(5):1698-702") + self.assertEqual(inst.relatedArtifact[1].type, "citation") + self.assertEqual(inst.relatedArtifact[1].url, "http://www.ncbi.nlm.nih.gov/pubmed/17437788") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "additional") + self.assertEqual(inst.title, "Gemcitabine/CARBOplatin") + self.assertEqual(inst.type.text, "Chemotherapy Order Template") + self.assertEqual(inst.useContext[0].code.code, "treamentSetting-or-diseaseStatus") + self.assertEqual(inst.useContext[0].code.system, "http://example.org/fhir/CodeSystem/indications") + self.assertEqual(inst.useContext[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/usagecontext-group") + self.assertEqual(inst.useContext[0].extension[0].valueString, "A") + self.assertEqual(inst.useContext[0].valueCodeableConcept.text, "Metastatic") + self.assertEqual(inst.useContext[1].code.code, "disease-or-histology") + self.assertEqual(inst.useContext[1].code.system, "http://example.org/fhir/CodeSystem/indications") + self.assertEqual(inst.useContext[1].extension[0].url, "http://hl7.org/fhir/StructureDefinition/usagecontext-group") + 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].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") + self.assertEqual(inst.useContext[3].code.code, "treatmentSetting-or-diseaseStatus") + self.assertEqual(inst.useContext[3].code.system, "http://example.org/fhir/CodeSystem/indications") + self.assertEqual(inst.useContext[3].extension[0].url, "http://hl7.org/fhir/StructureDefinition/usagecontext-group") + self.assertEqual(inst.useContext[3].extension[0].valueString, "B") + self.assertEqual(inst.useContext[3].valueCodeableConcept.text, "Relapsed") + self.assertEqual(inst.useContext[4].code.code, "disease-or-histology") + self.assertEqual(inst.useContext[4].code.system, "http://example.org/fhir/CodeSystem/indications") + self.assertEqual(inst.useContext[4].extension[0].url, "http://hl7.org/fhir/StructureDefinition/usagecontext-group") + 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].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-options-example.json") + self.assertIsNotNone(inst, "Must have instantiated a PlanDefinition instance") + self.implPlanDefinition2(inst) + + js = inst.as_json() + self.assertEqual("PlanDefinition", js["resourceType"]) + inst2 = plandefinition.PlanDefinition(js) + self.implPlanDefinition2(inst2) + + def implPlanDefinition2(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 testPlanDefinition3(self): + inst = self.instantiate_from("plandefinition-protocol-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].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") + + def testPlanDefinition4(self): + inst = self.instantiate_from("plandefinition-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].action[0].action[0].dynamicValue[0].expression, "Now()") + 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].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].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].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].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].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].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].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].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].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].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].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)") + self.assertEqual(inst.action[0].action[1].action[0].action[0].action[2].textEquivalent, "fluoxetine 20 mg capsule 1 capsule oral 1 time daily now (30 tablet; 3 refills)") + self.assertEqual(inst.action[0].action[1].action[0].action[0].action[3].textEquivalent, "paroxetine 20 mg tablet 1 tablet oral 1 time daily now (30 tablet; 3 refills)") + self.assertEqual(inst.action[0].action[1].action[0].action[0].action[4].textEquivalent, "sertraline 50 mg tablet 1 tablet oral 1 time daily now (30 tablet; 3 refills)") + self.assertEqual(inst.action[0].action[1].action[0].action[0].documentation[0].document.contentType, "text/html") + self.assertEqual(inst.action[0].action[1].action[0].action[0].documentation[0].document.title, "National Library of Medicine. DailyMed website. CITALOPRAM- citalopram hydrobromide tablet, film coated.") + self.assertEqual(inst.action[0].action[1].action[0].action[0].documentation[0].document.url, "http://dailymed.nlm.nih.gov/dailymed/drugInfo.cfm?setid=6daeb45c-451d-b135-bf8f-2d6dff4b6b01") + self.assertEqual(inst.action[0].action[1].action[0].action[0].documentation[0].type, "citation") + self.assertEqual(inst.action[0].action[1].action[0].action[0].groupingBehavior, "logical-group") + self.assertEqual(inst.action[0].action[1].action[0].action[0].selectionBehavior, "at-most-one") + self.assertEqual(inst.action[0].action[1].action[0].action[0].title, "Selective Serotonin Reuptake Inhibitors (Choose a mazimum of one or document reasons for exception)") + self.assertEqual(inst.action[0].action[1].action[0].action[1].textEquivalent, "Dopamine Norepinephrine Reuptake Inhibitors (Choose a maximum of one or document reasons for exception)") + 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].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.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") + self.assertEqual(inst.action[0].action[1].action[0].documentation[0].type, "citation") + 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[0].title, "First-Line Antidepressants") + self.assertEqual(inst.action[0].action[1].groupingBehavior, "logical-group") + self.assertEqual(inst.action[0].action[1].selectionBehavior, "at-most-one") + self.assertEqual(inst.action[0].action[1].title, "Medications") + 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.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") + 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.contained[0].id, "referralToMentalHealthCare") + 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") + self.assertEqual(inst.description, "Orders to be applied to a patient characterized as low suicide risk.") + 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.assertTrue(inst.experimental) + self.assertEqual(inst.id, "low-suicide-risk-order-set") + self.assertEqual(inst.identifier[0].system, "http://motivemi.com/artifacts") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "mmi:low-suicide-risk-order-set") + 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-08-15").date) + self.assertEqual(inst.lastReviewDate.as_json(), "2016-08-15") + 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].type, "composed-of") + self.assertEqual(inst.relatedArtifact[2].type, "composed-of") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "Low Suicide Risk Order Set") + self.assertEqual(inst.topic[0].text, "Suicide risk assessment") + 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].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].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].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].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].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].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].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 testPlanDefinition5(self): + inst = self.instantiate_from("plandefinition-predecessor-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].condition[0].expression, "Should Administer Zika Virus Exposure Assessment") + 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[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[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[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[4].condition[0].kind, "applicability") + self.assertEqual(inst.action[0].condition[0].expression, "Is Patient Pregnant") + 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.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.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].type, "successor") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "Example Zika Virus Intervention") + 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") + diff --git a/fhirclient/models/STU3/practitioner.py b/fhirclient/models/STU3/practitioner.py new file mode 100644 index 000000000..690c28b86 --- /dev/null +++ b/fhirclient/models/STU3/practitioner.py @@ -0,0 +1,169 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Practitioner) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Practitioner(domainresource.DomainResource): + """ A person with a formal responsibility in the provisioning of healthcare or + related services. + + A person who is directly or indirectly involved in the provisioning of + healthcare. + """ + + resource_type = "Practitioner" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 practitioner's record is in active use. + Type `bool`. """ + + self.address = None + """ Address(es) of the practitioner that are not role specific + (typically home address). + List of `Address` items (represented as `dict` in JSON). """ + + self.birthDate = None + """ The date on which the practitioner was born. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.communication = None + """ A language the practitioner is able to use in patient communication. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.gender = None + """ male | female | other | unknown. + Type `str`. """ + + self.identifier = None + """ A identifier for the person as this agent. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.name = None + """ The name(s) associated with the practitioner. + List of `HumanName` items (represented as `dict` in JSON). """ + + self.photo = None + """ Image of the person. + List of `Attachment` items (represented as `dict` in JSON). """ + + self.qualification = None + """ Qualifications obtained by training and certification. + List of `PractitionerQualification` items (represented as `dict` in JSON). """ + + self.telecom = None + """ A contact detail for the practitioner (that apply to all roles). + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(Practitioner, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Practitioner, self).elementProperties() + js.extend([ + ("active", "active", bool, False, None, False), + ("address", "address", address.Address, True, None, False), + ("birthDate", "birthDate", fhirdate.FHIRDate, False, None, False), + ("communication", "communication", codeableconcept.CodeableConcept, True, None, False), + ("gender", "gender", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("name", "name", humanname.HumanName, True, None, False), + ("photo", "photo", attachment.Attachment, True, None, False), + ("qualification", "qualification", PractitionerQualification, True, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ]) + return js + + +from . import backboneelement + +class PractitionerQualification(backboneelement.BackboneElement): + """ Qualifications obtained by training and certification. + """ + + resource_type = "PractitionerQualification" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 representation of the qualification. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.identifier = None + """ An identifier for this qualification for the practitioner. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.issuer = None + """ Organization that regulates and issues the qualification. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.period = None + """ Period during which the qualification is valid. + Type `Period` (represented as `dict` in JSON). """ + + super(PractitionerQualification, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PractitionerQualification, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("issuer", "issuer", fhirreference.FHIRReference, False, None, False), + ("period", "period", period.Period, False, None, False), + ]) + return js + + +import sys +try: + from . import address +except ImportError: + address = sys.modules[__package__ + '.address'] +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 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: + 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 period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/STU3/practitioner_tests.py b/fhirclient/models/STU3/practitioner_tests.py new file mode 100644 index 000000000..4487d0760 --- /dev/null +++ b/fhirclient/models/STU3/practitioner_tests.py @@ -0,0 +1,366 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import practitioner +from .fhirdate import FHIRDate + + +class PractitionerTests(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("Practitioner", js["resourceType"]) + return practitioner.Practitioner(js) + + def testPractitioner1(self): + inst = self.instantiate_from("practitioner-example-f203-jvg.json") + self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") + self.implPractitioner1(inst) + + js = inst.as_json() + self.assertEqual("Practitioner", js["resourceType"]) + inst2 = practitioner.Practitioner(js) + self.implPractitioner1(inst2) + + def implPractitioner1(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.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.text.status, "generated") + + def testPractitioner2(self): + inst = self.instantiate_from("practitioner-example-f201-ab.json") + self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") + self.implPractitioner2(inst) + + js = inst.as_json() + self.assertEqual("Practitioner", js["resourceType"]) + inst2 = practitioner.Practitioner(js) + self.implPractitioner2(inst2) + + def implPractitioner2(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 testPractitioner3(self): + inst = self.instantiate_from("practitioner-example-f202-lm.json") + self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") + self.implPractitioner3(inst) + + js = inst.as_json() + self.assertEqual("Practitioner", js["resourceType"]) + inst2 = practitioner.Practitioner(js) + self.implPractitioner3(inst2) + + def implPractitioner3(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.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.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 testPractitioner4(self): + inst = self.instantiate_from("practitioner-example-xcda-author.json") + self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") + self.implPractitioner4(inst) + + js = inst.as_json() + self.assertEqual("Practitioner", js["resourceType"]) + inst2 = practitioner.Practitioner(js) + self.implPractitioner4(inst2) + + def implPractitioner4(self, inst): + self.assertEqual(inst.id, "xcda-author") + 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.text.status, "generated") + + def testPractitioner5(self): + inst = self.instantiate_from("practitioner-example-f003-mv.json") + self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") + self.implPractitioner5(inst) + + js = inst.as_json() + self.assertEqual("Practitioner", js["resourceType"]) + inst2 = practitioner.Practitioner(js) + self.implPractitioner5(inst2) + + 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 91") + self.assertEqual(inst.address[0].postalCode, "1105 AZ") + 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.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, "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.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.text.status, "generated") + + def testPractitioner6(self): + inst = self.instantiate_from("practitioner-example-f002-pv.json") + self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") + self.implPractitioner6(inst) + + js = inst.as_json() + self.assertEqual("Practitioner", js["resourceType"]) + inst2 = practitioner.Practitioner(js) + self.implPractitioner6(inst2) + + def implPractitioner6(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.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, "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, "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.name[0].use, "official") + 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.text.status, "generated") + + def testPractitioner7(self): + inst = self.instantiate_from("practitioner-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") + self.implPractitioner7(inst) + + js = inst.as_json() + self.assertEqual("Practitioner", js["resourceType"]) + inst2 = practitioner.Practitioner(js) + 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.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://hl7.org/fhir/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") + self.assertEqual(inst.address[0].postalCode, "9105 PZ") + self.assertEqual(inst.address[0].use, "work") + self.assertEqual(inst.birthDate.date, FHIRDate("1971-11-07").date) + self.assertEqual(inst.birthDate.as_json(), "1971-11-07") + self.assertEqual(inst.gender, "female") + self.assertEqual(inst.id, "f007") + 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, "874635264") + 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.name[0].family, "Heps") + self.assertEqual(inst.name[0].given[0], "Simone") + 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, "020556936") + self.assertEqual(inst.telecom[1].system, "email") + self.assertEqual(inst.telecom[1].use, "work") + self.assertEqual(inst.telecom[1].value, "S.M.Heps@bmc.nl") + self.assertEqual(inst.telecom[2].system, "fax") + self.assertEqual(inst.telecom[2].use, "work") + self.assertEqual(inst.telecom[2].value, "0205669283") + self.assertEqual(inst.text.status, "generated") + + def testPractitioner9(self): + inst = self.instantiate_from("practitioner-example-f204-ce.json") + self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") + self.implPractitioner9(inst) + + js = inst.as_json() + self.assertEqual("Practitioner", js["resourceType"]) + inst2 = practitioner.Practitioner(js) + self.implPractitioner9(inst2) + + def implPractitioner9(self, inst): + 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("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, "12345678904") + 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, "+31715262169") + self.assertEqual(inst.text.status, "generated") + + def testPractitioner10(self): + inst = self.instantiate_from("practitioner-example-xcda1.json") + self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") + self.implPractitioner10(inst) + + js = inst.as_json() + self.assertEqual("Practitioner", js["resourceType"]) + inst2 = practitioner.Practitioner(js) + self.implPractitioner10(inst2) + + def implPractitioner10(self, inst): + 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, "D234123") + 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/STU3/practitionerrole.py b/fhirclient/models/STU3/practitionerrole.py new file mode 100644 index 000000000..73710b3bb --- /dev/null +++ b/fhirclient/models/STU3/practitionerrole.py @@ -0,0 +1,217 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/PractitionerRole) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class PractitionerRole(domainresource.DomainResource): + """ Roles/organizations the practitioner is associated with. + + A specific set of Roles/Locations/specialties/services that a practitioner + may perform at an organization for a period of time. + """ + + resource_type = "PractitionerRole" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 practitioner's record is in active use. + Type `bool`. """ + + self.availabilityExceptions = None + """ Description of availability exceptions. + Type `str`. """ + + self.availableTime = None + """ Times the Service Site is available. + List of `PractitionerRoleAvailableTime` items (represented as `dict` in JSON). """ + + self.code = None + """ Roles which this practitioner may perform. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + 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). """ + + 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). """ + + self.identifier = None + """ Business Identifiers that are specific to a role/location. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.location = None + """ The location(s) at which this practitioner provides care. + List of `FHIRReference` items referencing `Location` (represented as `dict` in JSON). """ + + self.notAvailable = None + """ Not available during this time due to provided reason. + List of `PractitionerRoleNotAvailable` items (represented as `dict` in JSON). """ + + self.organization = None + """ Organization where the roles are available. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.period = None + """ The period during which the practitioner is authorized to perform + in these role(s). + Type `Period` (represented as `dict` in JSON). """ + + self.practitioner = None + """ Practitioner that is able to provide the defined services for the + organation. + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + self.specialty = None + """ Specific specialty of the practitioner. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.telecom = None + """ Contact details that are specific to the role/location/service. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(PractitionerRole, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PractitionerRole, self).elementProperties() + js.extend([ + ("active", "active", bool, False, None, False), + ("availabilityExceptions", "availabilityExceptions", str, False, None, False), + ("availableTime", "availableTime", PractitionerRoleAvailableTime, True, 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), + ("notAvailable", "notAvailable", PractitionerRoleNotAvailable, True, None, False), + ("organization", "organization", fhirreference.FHIRReference, False, None, False), + ("period", "period", period.Period, False, None, False), + ("practitioner", "practitioner", fhirreference.FHIRReference, False, None, False), + ("specialty", "specialty", codeableconcept.CodeableConcept, True, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ]) + return js + + +from . import backboneelement + +class PractitionerRoleAvailableTime(backboneelement.BackboneElement): + """ Times the Service Site is available. + + A collection of times that the Service Site is available. + """ + + resource_type = "PractitionerRoleAvailableTime" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Always available? e.g. 24 hour service. + Type `bool`. """ + + self.availableEndTime = None + """ Closing time of day (ignored if allDay = true). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.availableStartTime = None + """ Opening time of day (ignored if allDay = true). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.daysOfWeek = None + """ mon | tue | wed | thu | fri | sat | sun. + List of `str` items. """ + + super(PractitionerRoleAvailableTime, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PractitionerRoleAvailableTime, self).elementProperties() + js.extend([ + ("allDay", "allDay", bool, False, None, False), + ("availableEndTime", "availableEndTime", fhirdate.FHIRDate, False, None, False), + ("availableStartTime", "availableStartTime", fhirdate.FHIRDate, False, None, False), + ("daysOfWeek", "daysOfWeek", str, True, None, False), + ]) + return js + + +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. + """ + + resource_type = "PractitionerRoleNotAvailable" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Reason presented to the user explaining why time not available. + Type `str`. """ + + self.during = None + """ Service not availablefrom this date. + Type `Period` (represented as `dict` in JSON). """ + + super(PractitionerRoleNotAvailable, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(PractitionerRoleNotAvailable, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, True), + ("during", "during", period.Period, False, 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 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/STU3/practitionerrole_tests.py b/fhirclient/models/STU3/practitionerrole_tests.py new file mode 100644 index 000000000..9420fa2bd --- /dev/null +++ b/fhirclient/models/STU3/practitionerrole_tests.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import practitionerrole +from .fhirdate import FHIRDate + + +class PractitionerRoleTests(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("PractitionerRole", js["resourceType"]) + return practitionerrole.PractitionerRole(js) + + def testPractitionerRole1(self): + inst = self.instantiate_from("practitionerrole-example.json") + self.assertIsNotNone(inst, "Must have instantiated a PractitionerRole instance") + self.implPractitionerRole1(inst) + + js = inst.as_json() + self.assertEqual("PractitionerRole", js["resourceType"]) + inst2 = practitionerrole.PractitionerRole(js) + self.implPractitionerRole1(inst2) + + def implPractitionerRole1(self, inst): + self.assertTrue(inst.active) + self.assertEqual(inst.availabilityExceptions, "Adam is generally unavailable on public holidays and during the Christmas/New Year break") + self.assertEqual(inst.availableTime[0].availableEndTime.date, FHIRDate("16:30:00").date) + self.assertEqual(inst.availableTime[0].availableEndTime.as_json(), "16:30:00") + self.assertEqual(inst.availableTime[0].availableStartTime.date, FHIRDate("09:00:00").date) + self.assertEqual(inst.availableTime[0].availableStartTime.as_json(), "09:00:00") + self.assertEqual(inst.availableTime[0].daysOfWeek[0], "mon") + self.assertEqual(inst.availableTime[0].daysOfWeek[1], "tue") + self.assertEqual(inst.availableTime[0].daysOfWeek[2], "wed") + self.assertEqual(inst.availableTime[1].availableEndTime.date, FHIRDate("12:00:00").date) + self.assertEqual(inst.availableTime[1].availableEndTime.as_json(), "12:00:00") + self.assertEqual(inst.availableTime[1].availableStartTime.date, FHIRDate("09:00:00").date) + self.assertEqual(inst.availableTime[1].availableStartTime.as_json(), "09:00:00") + 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.id, "example") + self.assertEqual(inst.identifier[0].system, "http://www.acme.org/practitioners") + self.assertEqual(inst.identifier[0].value, "23") + 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") + self.assertEqual(inst.notAvailable[0].during.start.date, FHIRDate("2017-05-01").date) + self.assertEqual(inst.notAvailable[0].during.start.as_json(), "2017-05-01") + 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, "phone") + self.assertEqual(inst.telecom[0].use, "work") + self.assertEqual(inst.telecom[0].value, "(03) 5555 6473") + self.assertEqual(inst.telecom[1].system, "email") + self.assertEqual(inst.telecom[1].use, "work") + self.assertEqual(inst.telecom[1].value, "adam.southern@example.org") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/STU3/procedure.py b/fhirclient/models/STU3/procedure.py new file mode 100644 index 000000000..93bbc9b73 --- /dev/null +++ b/fhirclient/models/STU3/procedure.py @@ -0,0 +1,276 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Procedure) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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. + """ + + resource_type = "Procedure" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.basedOn = None + """ A request for this procedure. + List of `FHIRReference` items referencing `CarePlan, ProcedureRequest, ReferralRequest` (represented as `dict` in JSON). """ + + self.bodySite = None + """ Target body sites. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.category = None + """ Classification of the procedure. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.code = None + """ Identification of the procedure. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.complication = None + """ Complication following the procedure. + 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). """ + + self.definition = None + """ Instantiates protocol or definition. + List of `FHIRReference` items referencing `PlanDefinition, ActivityDefinition, HealthcareService` (represented as `dict` in JSON). """ + + self.focalDevice = None + """ Device changed in procedure. + List of `ProcedureFocalDevice` items (represented as `dict` in JSON). """ + + self.followUp = None + """ Instructions for follow up. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.identifier = None + """ 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.notDone = None + """ True if procedure was not performed as scheduled. + Type `bool`. """ + + self.notDoneReason = None + """ Reason procedure was not performed. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.note = None + """ Additional information about the procedure. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.outcome = None + """ The result of procedure. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.partOf = None + """ Part of referenced event. + List of `FHIRReference` items referencing `Procedure, Observation, MedicationAdministration` (represented as `dict` in JSON). """ + + self.performedDateTime = None + """ Date/Period the procedure was performed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.performedPeriod = None + """ Date/Period the procedure was performed. + Type `Period` (represented as `dict` in JSON). """ + + self.performer = None + """ The people who performed the procedure. + List of `ProcedurePerformer` items (represented as `dict` in JSON). """ + + self.reasonCode = None + """ Coded reason procedure performed. + 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). """ + + self.report = None + """ Any report resulting from the procedure. + List of `FHIRReference` items referencing `DiagnosticReport` (represented as `dict` in JSON). """ + + self.status = None + """ preparation | in-progress | suspended | aborted | completed | + entered-in-error | unknown. + Type `str`. """ + + self.subject = None + """ Who the procedure was performed on. + Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ + + self.usedCode = None + """ Coded items used during the procedure. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.usedReference = None + """ Items used during procedure. + List of `FHIRReference` items referencing `Device, Medication, Substance` (represented as `dict` in JSON). """ + + super(Procedure, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Procedure, self).elementProperties() + js.extend([ + ("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), + ("focalDevice", "focalDevice", ProcedureFocalDevice, True, None, False), + ("followUp", "followUp", codeableconcept.CodeableConcept, True, None, False), + ("identifier", "identifier", identifier.Identifier, 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), + ("performedDateTime", "performedDateTime", fhirdate.FHIRDate, False, "performed", False), + ("performedPeriod", "performedPeriod", period.Period, False, "performed", False), + ("performer", "performer", ProcedurePerformer, True, None, False), + ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), + ("reasonReference", "reasonReference", fhirreference.FHIRReference, True, None, False), + ("report", "report", fhirreference.FHIRReference, True, None, False), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, True), + ("usedCode", "usedCode", codeableconcept.CodeableConcept, True, None, False), + ("usedReference", "usedReference", fhirreference.FHIRReference, True, None, False), + ]) + return js + + +from . import backboneelement + +class ProcedureFocalDevice(backboneelement.BackboneElement): + """ Device changed in procedure. + + A device that is implanted, removed or otherwise manipulated (calibration, + battery replacement, fitting a prosthesis, attaching a wound-vac, etc.) as + a focal portion of the Procedure. + """ + + resource_type = "ProcedureFocalDevice" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Kind of change to device. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.manipulated = None + """ Device that was changed. + Type `FHIRReference` referencing `Device` (represented as `dict` in JSON). """ + + super(ProcedureFocalDevice, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ProcedureFocalDevice, self).elementProperties() + js.extend([ + ("action", "action", codeableconcept.CodeableConcept, False, None, False), + ("manipulated", "manipulated", fhirreference.FHIRReference, False, None, True), + ]) + return js + + +class ProcedurePerformer(backboneelement.BackboneElement): + """ The people who performed the procedure. + + Limited to 'real' people rather than equipment. + """ + + resource_type = "ProcedurePerformer" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ The reference to the practitioner. + Type `FHIRReference` referencing `Practitioner, Organization, Patient, RelatedPerson, Device` (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). """ + + super(ProcedurePerformer, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ProcedurePerformer, self).elementProperties() + js.extend([ + ("actor", "actor", fhirreference.FHIRReference, False, None, True), + ("onBehalfOf", "onBehalfOf", fhirreference.FHIRReference, False, None, False), + ("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 period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/STU3/procedure_tests.py b/fhirclient/models/STU3/procedure_tests.py new file mode 100644 index 000000000..81a5bc19f --- /dev/null +++ b/fhirclient/models/STU3/procedure_tests.py @@ -0,0 +1,296 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import procedure +from .fhirdate import FHIRDate + + +class ProcedureTests(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("Procedure", js["resourceType"]) + return procedure.Procedure(js) + + def testProcedure1(self): + inst = self.instantiate_from("procedure-example-f201-tpf.json") + self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") + self.implProcedure1(inst) + + js = inst.as_json() + self.assertEqual("Procedure", js["resourceType"]) + inst2 = procedure.Procedure(js) + self.implProcedure1(inst2) + + def implProcedure1(self, inst): + 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.id, "f201") + 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].role.coding[0].code, "310512001") + self.assertEqual(inst.performer[0].role.coding[0].display, "Medical oncologist") + self.assertEqual(inst.performer[0].role.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-ambulation.json") + self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") + self.implProcedure2(inst) + + js = inst.as_json() + self.assertEqual("Procedure", js["resourceType"]) + inst2 = procedure.Procedure(js) + self.implProcedure2(inst2) + + def implProcedure2(self, inst): + 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.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.text.status, "generated") + + def testProcedure3(self): + inst = self.instantiate_from("procedure-example-implant.json") + self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") + self.implProcedure3(inst) + + js = inst.as_json() + self.assertEqual("Procedure", js["resourceType"]) + inst2 = procedure.Procedure(js) + self.implProcedure3(inst2) + + def implProcedure3(self, inst): + 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.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.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.status, "generated") + + def testProcedure4(self): + inst = self.instantiate_from("procedure-example-colon-biopsy.json") + self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") + self.implProcedure4(inst) + + js = inst.as_json() + self.assertEqual("Procedure", js["resourceType"]) + inst2 = procedure.Procedure(js) + self.implProcedure4(inst2) + + def implProcedure4(self, inst): + 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.assertFalse(inst.notDone) + 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-f004-tracheotomy.json") + self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") + self.implProcedure5(inst) + + js = inst.as_json() + self.assertEqual("Procedure", js["resourceType"]) + inst2 = procedure.Procedure(js) + self.implProcedure5(inst2) + + def implProcedure5(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].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.status, "completed") + self.assertEqual(inst.text.status, "generated") + + def testProcedure6(self): + inst = self.instantiate_from("procedure-example-education.json") + self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") + self.implProcedure6(inst) + + js = inst.as_json() + self.assertEqual("Procedure", js["resourceType"]) + inst2 = procedure.Procedure(js) + self.implProcedure6(inst2) + + def implProcedure6(self, inst): + self.assertEqual(inst.category.coding[0].code, "311401005") + self.assertEqual(inst.category.coding[0].display, "Patient education (procedure)") + self.assertEqual(inst.category.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.category.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.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") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.div, "
Health education - breast examination for early detection of breast mass
") + self.assertEqual(inst.text.status, "generated") + + def testProcedure7(self): + inst = self.instantiate_from("procedure-example-colonoscopy.json") + self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") + self.implProcedure7(inst) + + js = inst.as_json() + self.assertEqual("Procedure", js["resourceType"]) + inst2 = procedure.Procedure(js) + self.implProcedure7(inst2) + + def implProcedure7(self, inst): + 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, "12345") + self.assertFalse(inst.notDone) + 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-physical-therapy.json") + self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") + self.implProcedure8(inst) + + js = inst.as_json() + self.assertEqual("Procedure", js["resourceType"]) + inst2 = procedure.Procedure(js) + self.implProcedure8(inst2) + + def implProcedure8(self, inst): + 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.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.code.text, "Assessment of passive range of motion") + self.assertEqual(inst.id, "physical-therapy") + 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): + inst = self.instantiate_from("procedure-example-f003-abscess.json") + self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") + self.implProcedure9(inst) + + js = inst.as_json() + self.assertEqual("Procedure", js["resourceType"]) + inst2 = procedure.Procedure(js) + self.implProcedure9(inst2) + + def implProcedure9(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, "172960003") + self.assertEqual(inst.code.coding[0].display, "Incision of retropharyngeal abscess") + 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.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.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.json") + self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") + self.implProcedure10(inst) + + js = inst.as_json() + self.assertEqual("Procedure", js["resourceType"]) + inst2 = procedure.Procedure(js) + self.implProcedure10(inst2) + + def implProcedure10(self, inst): + 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.code.text, "Appendectomy") + self.assertEqual(inst.followUp[0].text, "ROS 5 days - 2013-04-10") + self.assertEqual(inst.id, "example") + 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/STU3/procedurerequest.py b/fhirclient/models/STU3/procedurerequest.py new file mode 100644 index 000000000..9fe6d64f6 --- /dev/null +++ b/fhirclient/models/STU3/procedurerequest.py @@ -0,0 +1,248 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ProcedureRequest) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class ProcedureRequest(domainresource.DomainResource): + """ A request for a procedure or diagnostic to be performed. + + A record of a request for diagnostic investigations, treatments, or + operations to be performed. + """ + + resource_type = "ProcedureRequest" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.asNeededBoolean = None + """ Preconditions for procedure or diagnostic. + Type `bool`. """ + + self.asNeededCodeableConcept = None + """ Preconditions for procedure or diagnostic. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.authoredOn = None + """ Date request signed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.basedOn = None + """ What request fulfills. + List of `FHIRReference` items referencing `Resource` (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. + 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. + Type `bool`. """ + + self.identifier = None + """ Identifiers assigned to this order. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.intent = None + """ proposal | plan | order +. + Type `str`. """ + + self.note = None + """ Comments. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.occurrenceDateTime = None + """ When procedure should occur. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.occurrencePeriod = None + """ When procedure should occur. + Type `Period` (represented as `dict` in JSON). """ + + self.occurrenceTiming = None + """ When procedure should occur. + Type `Timing` (represented as `dict` in JSON). """ + + self.performer = None + """ Requested perfomer. + Type `FHIRReference` referencing `Practitioner, Organization, Patient, Device, RelatedPerson, HealthcareService` (represented as `dict` in JSON). """ + + self.performerType = None + """ Performer role. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.priority = None + """ routine | urgent | asap | stat. + Type `str`. """ + + self.reasonCode = None + """ Explanation/Justification for test. + 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). """ + + self.relevantHistory = None + """ Request provenance. + List of `FHIRReference` items referencing `Provenance` (represented as `dict` in JSON). """ + + self.replaces = None + """ What request replaces. + List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + + self.requester = None + """ Who/what is requesting procedure or diagnostic. + Type `ProcedureRequestRequester` (represented as `dict` in JSON). """ + + self.requisition = None + """ Composite Request ID. + Type `Identifier` (represented as `dict` in JSON). """ + + self.specimen = None + """ Procedure Samples. + List of `FHIRReference` items referencing `Specimen` (represented as `dict` in JSON). """ + + self.status = None + """ draft | active | suspended | completed | entered-in-error | + cancelled. + Type `str`. """ + + self.subject = None + """ Individual the service is ordered for. + Type `FHIRReference` referencing `Patient, Group, Location, Device` (represented as `dict` in JSON). """ + + self.supportingInfo = None + """ Additional clinical information. + List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + + super(ProcedureRequest, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ProcedureRequest, self).elementProperties() + js.extend([ + ("asNeededBoolean", "asNeededBoolean", bool, False, "asNeeded", False), + ("asNeededCodeableConcept", "asNeededCodeableConcept", codeableconcept.CodeableConcept, False, "asNeeded", False), + ("authoredOn", "authoredOn", fhirdate.FHIRDate, False, None, False), + ("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), + ("doNotPerform", "doNotPerform", bool, 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), + ("occurrenceTiming", "occurrenceTiming", timing.Timing, False, "occurrence", False), + ("performer", "performer", fhirreference.FHIRReference, False, None, False), + ("performerType", "performerType", codeableconcept.CodeableConcept, False, None, False), + ("priority", "priority", str, False, None, 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), + ("requisition", "requisition", identifier.Identifier, False, None, False), + ("specimen", "specimen", fhirreference.FHIRReference, True, None, False), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, True), + ("supportingInfo", "supportingInfo", fhirreference.FHIRReference, True, None, False), + ]) + 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 +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'] +try: + from . import timing +except ImportError: + timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/STU3/procedurerequest_tests.py b/fhirclient/models/STU3/procedurerequest_tests.py new file mode 100644 index 000000000..f43410dfc --- /dev/null +++ b/fhirclient/models/STU3/procedurerequest_tests.py @@ -0,0 +1,298 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +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-lipid.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.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 testProcedureRequest2(self): + inst = self.instantiate_from("procedurerequest-example4.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.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.note[0].text, "Start with 30kg and increase in increments of 5kg when you feel ready") + 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.status, "active") + self.assertEqual(inst.text.status, "generated") + + def testProcedureRequest3(self): + inst = self.instantiate_from("procedurerequest-example-edu.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("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 testProcedureRequest4(self): + inst = self.instantiate_from("procedurerequest-example-pt.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("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.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 testProcedureRequest5(self): + inst = self.instantiate_from("procedurerequest-genetics-example-1.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, "49874-1") + self.assertEqual(inst.code.coding[0].system, "http://loinc.org") + self.assertEqual(inst.code.text, "ABCB4 gene mutation analysis") + self.assertEqual(inst.id, "og-example1") + self.assertEqual(inst.intent, "original-order") + self.assertEqual(inst.occurrenceDateTime.date, FHIRDate("2014-05-12T16:16:00-07:00").date) + self.assertEqual(inst.occurrenceDateTime.as_json(), "2014-05-12T16:16:00-07:00") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + + def testProcedureRequest6(self): + inst = self.instantiate_from("procedurerequest-example-di.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.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 testProcedureRequest7(self): + inst = self.instantiate_from("procedurerequest-example-subrequest.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.bodySite[0].coding[0].display, "Right arm") + self.assertEqual(inst.bodySite[0].text, "Right arm") + self.assertEqual(inst.code.coding[0].code, "35542-0") + self.assertEqual(inst.code.coding[0].system, "http://loinc.org") + self.assertEqual(inst.code.text, "Peanut IgG") + self.assertEqual(inst.id, "subrequest") + self.assertEqual(inst.intent, "instance-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.performerType.coding[0].display, "Qualified nurse") + self.assertEqual(inst.performerType.text, "Nurse") + self.assertEqual(inst.priority, "routine") + self.assertEqual(inst.reasonCode[0].text, "Check for Peanut Allergy") + self.assertEqual(inst.requisition.value, "A13848392") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + + def testProcedureRequest8(self): + inst = self.instantiate_from("procedurerequest-example2.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.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://hl7.org/fhir/identifier-type") + self.assertEqual(inst.identifier[0].type.text, "Placer") + self.assertEqual(inst.identifier[0].value, "20170201-0001") + self.assertEqual(inst.intent, "order") + 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 testProcedureRequest9(self): + inst = self.instantiate_from("procedurerequest-example3.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.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.priority, "stat") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + + def testProcedureRequest10(self): + inst = self.instantiate_from("procedurerequest-example-ambulation.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.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") + diff --git a/fhirclient/models/STU3/processrequest.py b/fhirclient/models/STU3/processrequest.py new file mode 100644 index 000000000..258dac72c --- /dev/null +++ b/fhirclient/models/STU3/processrequest.py @@ -0,0 +1,160 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ProcessRequest) on 2019-10-12. +# 2019, 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/STU3/processrequest_tests.py b/fhirclient/models/STU3/processrequest_tests.py new file mode 100644 index 000000000..2c9847f89 --- /dev/null +++ b/fhirclient/models/STU3/processrequest_tests.py @@ -0,0 +1,224 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +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-exclusive.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.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 testProcessRequest2(self): + inst = self.instantiate_from("processrequest-example-poll-eob.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.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 testProcessRequest3(self): + inst = self.instantiate_from("processrequest-example-poll-specific.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, "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 testProcessRequest4(self): + inst = self.instantiate_from("processrequest-example-poll-inclusive.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, "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 testProcessRequest5(self): + inst = self.instantiate_from("processrequest-example-poll-payrec.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, "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 testProcessRequest6(self): + inst = self.instantiate_from("processrequest-example.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, "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") + + 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-reprocess.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, "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 testProcessRequest9(self): + inst = self.instantiate_from("processrequest-example-status.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, "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") + diff --git a/fhirclient/models/STU3/processresponse.py b/fhirclient/models/STU3/processresponse.py new file mode 100644 index 000000000..a210d60e0 --- /dev/null +++ b/fhirclient/models/STU3/processresponse.py @@ -0,0 +1,155 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ProcessResponse) on 2019-10-12. +# 2019, 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/STU3/processresponse_tests.py b/fhirclient/models/STU3/processresponse_tests.py new file mode 100644 index 000000000..b730fb070 --- /dev/null +++ b/fhirclient/models/STU3/processresponse_tests.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +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.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-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") + + def testProcessResponse2(self): + inst = self.instantiate_from("processresponse-example-error.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.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 testProcessResponse3(self): + inst = self.instantiate_from("processresponse-example-pended.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.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") + diff --git a/fhirclient/models/STU3/provenance.py b/fhirclient/models/STU3/provenance.py new file mode 100644 index 000000000..5936f212c --- /dev/null +++ b/fhirclient/models/STU3/provenance.py @@ -0,0 +1,228 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Provenance) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Provenance(domainresource.DomainResource): + """ Who, What, When for a set of resources. + + Provenance of a resource is a record that describes entities and processes + involved in producing and delivering or otherwise influencing that + resource. Provenance provides a critical foundation for assessing + authenticity, enabling trust, and allowing reproducibility. Provenance + assertions are a form of contextual metadata and can themselves become + important records with their own provenance. Provenance statement indicates + clinical significance in terms of confidence in authenticity, reliability, + and trustworthiness, integrity, and stage in lifecycle (e.g. Document + Completion - has the artifact been legally authenticated), all of which may + impact security, privacy, and trust policies. + """ + + resource_type = "Provenance" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.activity = None + """ Activity that occurred. + Type `Coding` (represented as `dict` in JSON). """ + + self.agent = None + """ Actor involved. + List of `ProvenanceAgent` items (represented as `dict` in JSON). """ + + self.entity = None + """ An entity used in this activity. + List of `ProvenanceEntity` items (represented as `dict` in JSON). """ + + self.location = None + """ Where the activity occurred, if relevant. + Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + + self.period = None + """ When the activity occurred. + Type `Period` (represented as `dict` in JSON). """ + + self.policy = None + """ Policy or plan the activity was defined by. + List of `str` items. """ + + self.reason = None + """ Reason the activity is occurring. + List of `Coding` items (represented as `dict` in JSON). """ + + self.recorded = None + """ When the activity was recorded / updated. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.signature = None + """ Signature on target. + List of `Signature` items (represented as `dict` in JSON). """ + + self.target = None + """ Target Reference(s) (usually version specific). + List of `FHIRReference` items referencing `Resource` (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), + ("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), + ("policy", "policy", str, True, None, False), + ("reason", "reason", coding.Coding, True, None, False), + ("recorded", "recorded", fhirdate.FHIRDate, False, None, True), + ("signature", "signature", signature.Signature, True, None, False), + ("target", "target", fhirreference.FHIRReference, True, None, True), + ]) + return js + + +from . import backboneelement + +class ProvenanceAgent(backboneelement.BackboneElement): + """ Actor involved. + + 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 = "ProvenanceAgent" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.onBehalfOfReference = 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). """ + + 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.whoUri = None + """ Who participated. + Type `str`. """ + + 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), + ("role", "role", codeableconcept.CodeableConcept, True, None, False), + ("whoReference", "whoReference", fhirreference.FHIRReference, False, "who", True), + ("whoUri", "whoUri", str, False, "who", True), + ]) + return js + + +class ProvenanceEntity(backboneelement.BackboneElement): + """ An entity used in this activity. + """ + + resource_type = "ProvenanceEntity" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Entity is attributed to this agent. + List of `ProvenanceAgent` items (represented as `dict` in JSON). """ + + self.role = None + """ derivation | revision | quotation | source | removal. + Type `str`. """ + + self.whatIdentifier = None + """ Identity of entity. + Type `Identifier` (represented as `dict` in JSON). """ + + self.whatReference = None + """ Identity of entity. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.whatUri = None + """ Identity of entity. + Type `str`. """ + + super(ProvenanceEntity, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ProvenanceEntity, self).elementProperties() + 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), + ]) + 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 period +except ImportError: + period = sys.modules[__package__ + '.period'] +try: + from . import signature +except ImportError: + signature = sys.modules[__package__ + '.signature'] diff --git a/fhirclient/models/STU3/provenance_tests.py b/fhirclient/models/STU3/provenance_tests.py new file mode 100644 index 000000000..7931b486c --- /dev/null +++ b/fhirclient/models/STU3/provenance_tests.py @@ -0,0 +1,141 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import provenance +from .fhirdate import FHIRDate + + +class ProvenanceTests(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("Provenance", js["resourceType"]) + return provenance.Provenance(js) + + def testProvenance1(self): + inst = self.instantiate_from("provenance-example-sig.json") + self.assertIsNotNone(inst, "Must have instantiated a Provenance instance") + self.implProvenance1(inst) + + js = inst.as_json() + self.assertEqual("Provenance", js["resourceType"]) + inst2 = provenance.Provenance(js) + self.implProvenance1(inst2) + + def implProvenance1(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.text.status, "generated") + + def testProvenance2(self): + inst = self.instantiate_from("provenance-example-cwl.json") + self.assertIsNotNone(inst, "Must have instantiated a Provenance instance") + self.implProvenance2(inst) + + js = inst.as_json() + self.assertEqual("Provenance", js["resourceType"]) + inst2 = provenance.Provenance(js) + 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.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.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-biocompute-object.json") + self.assertIsNotNone(inst, "Must have instantiated a Provenance instance") + self.implProvenance3(inst) + + js = inst.as_json() + self.assertEqual("Provenance", js["resourceType"]) + inst2 = provenance.Provenance(js) + self.implProvenance3(inst2) + + def implProvenance3(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.text.status, "generated") + + def testProvenance4(self): + inst = self.instantiate_from("provenance-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Provenance instance") + self.implProvenance4(inst) + + js = inst.as_json() + self.assertEqual("Provenance", js["resourceType"]) + inst2 = provenance.Provenance(js) + 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[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.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.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.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/STU3/quantity.py b/fhirclient/models/STU3/quantity.py new file mode 100644 index 000000000..2f39b4fb3 --- /dev/null +++ b/fhirclient/models/STU3/quantity.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Quantity) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Quantity(element.Element): + """ A measured or measurable amount. + + A measured amount (or an amount that can potentially be measured). Note + that measured amounts include amounts that are not precisely quantified, + including amounts involving arbitrary units and floating currencies. + """ + + resource_type = "Quantity" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 form of the unit. + Type `str`. """ + + self.comparator = None + """ < | <= | >= | > - how to understand the value. + Type `str`. """ + + self.system = None + """ System that defines coded unit form. + Type `str`. """ + + self.unit = None + """ Unit representation. + Type `str`. """ + + self.value = None + """ Numerical value (with implicit precision). + Type `float`. """ + + super(Quantity, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Quantity, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, False), + ("comparator", "comparator", str, False, None, False), + ("system", "system", str, False, None, False), + ("unit", "unit", str, False, None, False), + ("value", "value", float, False, None, False), + ]) + return js + + diff --git a/fhirclient/models/STU3/questionnaire.py b/fhirclient/models/STU3/questionnaire.py new file mode 100644 index 000000000..85cb91aec --- /dev/null +++ b/fhirclient/models/STU3/questionnaire.py @@ -0,0 +1,488 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Questionnaire) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Questionnaire(domainresource.DomainResource): + """ A structured set of questions. + + A structured set of questions intended to guide the collection of answers + from end-users. Questionnaires provide detailed control over order, + presentation, phraseology and grouping to allow coherent, consistent data + collection. + """ + + resource_type = "Questionnaire" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 questionnaire was approved by publisher. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.code = None + """ Concept that represents the overall questionnaire. + List of `Coding` 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 this was last changed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Natural language description of the questionnaire. + Type `str`. """ + + self.effectivePeriod = None + """ When the questionnaire 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 questionnaire. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.item = None + """ Questions and sections within the Questionnaire. + List of `QuestionnaireItem` items (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ Intended jurisdiction for questionnaire (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.lastReviewDate = None + """ When the questionnaire was last reviewed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.name = None + """ Name for this questionnaire (computer friendly). + Type `str`. """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this questionnaire is defined. + Type `str`. """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.subjectType = None + """ Resource that can be subject of QuestionnaireResponse. + List of `str` items. """ + + self.title = None + """ Name for this questionnaire (human friendly). + Type `str`. """ + + self.url = None + """ Logical URI to reference this questionnaire (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 questionnaire. + Type `str`. """ + + super(Questionnaire, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Questionnaire, self).elementProperties() + js.extend([ + ("approvalDate", "approvalDate", fhirdate.FHIRDate, False, None, False), + ("code", "code", coding.Coding, 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), + ("effectivePeriod", "effectivePeriod", period.Period, False, None, False), + ("experimental", "experimental", bool, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("item", "item", QuestionnaireItem, True, None, False), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("lastReviewDate", "lastReviewDate", fhirdate.FHIRDate, False, None, False), + ("name", "name", str, False, None, False), + ("publisher", "publisher", str, False, None, False), + ("purpose", "purpose", str, False, None, False), + ("status", "status", str, False, None, True), + ("subjectType", "subjectType", str, True, 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 QuestionnaireItem(backboneelement.BackboneElement): + """ Questions and sections within the Questionnaire. + + A particular question, question grouping or display text that is part of + the questionnaire. + """ + + resource_type = "QuestionnaireItem" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Corresponding concept for this item in a terminology. + List of `Coding` items (represented as `dict` in JSON). """ + + self.definition = None + """ ElementDefinition - details for the item. + 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.item = None + """ Nested questionnaire items. + List of `QuestionnaireItem` items (represented as `dict` in JSON). """ + + self.linkId = None + """ Unique id for item in questionnaire. + Type `str`. """ + + self.maxLength = None + """ 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`. """ + + self.readOnly = None + """ Don't allow human editing. + Type `bool`. """ + + self.repeats = None + """ Whether the item may repeat. + Type `bool`. """ + + self.required = None + """ Whether the item must be included in data results. + Type `bool`. """ + + self.text = None + """ Primary text for the item. + Type `str`. """ + + self.type = None + """ group | display | boolean | decimal | integer | date | dateTime +. + Type `str`. """ + + super(QuestionnaireItem, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(QuestionnaireItem, self).elementProperties() + js.extend([ + ("code", "code", coding.Coding, True, None, False), + ("definition", "definition", 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), + ("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), + ("required", "required", bool, False, None, False), + ("text", "text", str, False, None, False), + ("type", "type", str, False, None, True), + ]) + return js + + +class QuestionnaireItemEnableWhen(backboneelement.BackboneElement): + """ Only allow data when. + + A constraint indicating that this item should only be enabled + (displayed/allow answers to be captured) when the specified condition is + true. + """ + + resource_type = "QuestionnaireItemEnableWhen" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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. + Type `bool`. """ + + self.answerCoding = None + """ Value question must have. + Type `Coding` (represented as `dict` in JSON). """ + + self.answerDate = None + """ Value question must have. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.answerDateTime = None + """ Value question must have. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.answerDecimal = None + """ Value question must have. + Type `float`. """ + + self.answerInteger = None + """ Value question must have. + Type `int`. """ + + self.answerQuantity = None + """ Value question must have. + Type `Quantity` (represented as `dict` in JSON). """ + + self.answerReference = None + """ Value question must have. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.answerString = None + """ Value question must have. + Type `str`. """ + + self.answerTime = None + """ Value question must have. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.answerUri = None + """ Value question must have. + Type `str`. """ + + self.hasAnswer = None + """ Enable when answered or not. + Type `bool`. """ + + self.question = None + """ Question that determines whether item is enabled. + Type `str`. """ + + super(QuestionnaireItemEnableWhen, self).__init__(jsondict=jsondict, strict=strict) + + 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), + ("question", "question", str, False, None, True), + ]) + return js + + +class QuestionnaireItemOption(backboneelement.BackboneElement): + """ Permitted answer. + + One of the permitted answers for a "choice" or "open-choice" question. + """ + + resource_type = "QuestionnaireItemOption" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + 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.valueString = None + """ Answer value. + Type `str`. """ + + self.valueTime = None + """ Answer value. + Type `FHIRDate` (represented as `str` in JSON). """ + + super(QuestionnaireItemOption, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(QuestionnaireItemOption, self).elementProperties() + js.extend([ + ("valueCoding", "valueCoding", coding.Coding, False, "value", True), + ("valueDate", "valueDate", fhirdate.FHIRDate, False, "value", True), + ("valueInteger", "valueInteger", int, False, "value", True), + ("valueString", "valueString", str, False, "value", True), + ("valueTime", "valueTime", fhirdate.FHIRDate, False, "value", True), + ]) + 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 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 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 quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] +try: + from . import usagecontext +except ImportError: + usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/STU3/questionnaire_tests.py b/fhirclient/models/STU3/questionnaire_tests.py new file mode 100644 index 000000000..f11da4e71 --- /dev/null +++ b/fhirclient/models/STU3/questionnaire_tests.py @@ -0,0 +1,254 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import questionnaire +from .fhirdate import FHIRDate + + +class QuestionnaireTests(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("Questionnaire", js["resourceType"]) + return questionnaire.Questionnaire(js) + + def testQuestionnaire1(self): + inst = self.instantiate_from("questionnaire-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Questionnaire instance") + self.implQuestionnaire1(inst) + + js = inst.as_json() + self.assertEqual("Questionnaire", js["resourceType"]) + inst2 = questionnaire.Questionnaire(js) + self.implQuestionnaire1(inst2) + + def implQuestionnaire1(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") + 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 testQuestionnaire2(self): + inst = self.instantiate_from("questionnaire-example-f201-lifelines.json") + self.assertIsNotNone(inst, "Must have instantiated a Questionnaire instance") + self.implQuestionnaire2(inst) + + js = inst.as_json() + self.assertEqual("Questionnaire", js["resourceType"]) + inst2 = questionnaire.Questionnaire(js) + self.implQuestionnaire2(inst2) + + def implQuestionnaire2(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") + self.assertEqual(inst.date.date, FHIRDate("2010").date) + self.assertEqual(inst.date.as_json(), "2010") + self.assertEqual(inst.id, "f201") + self.assertEqual(inst.item[0].linkId, "1") + self.assertEqual(inst.item[0].text, "Do you have allergies?") + self.assertEqual(inst.item[0].type, "boolean") + 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[0].type, "string") + 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[1].type, "date") + 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[2].type, "string") + 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].item[3].type, "string") + self.assertEqual(inst.item[1].linkId, "2") + self.assertEqual(inst.item[1].text, "General questions") + self.assertEqual(inst.item[1].type, "group") + 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[0].type, "boolean") + 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].item[1].type, "boolean") + self.assertEqual(inst.item[2].linkId, "3") + self.assertEqual(inst.item[2].text, "Intoxications") + self.assertEqual(inst.item[2].type, "group") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.subjectType[0], "Patient") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.url, "http://hl7.org/fhir/Questionnaire/f201") + + def testQuestionnaire3(self): + inst = self.instantiate_from("questionnaire-example-gcs.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, "9269-2") + self.assertEqual(inst.code[0].system, "http://loinc.org") + self.assertEqual(inst.contained[0].id, "motor") + self.assertEqual(inst.contained[1].id, "verbal") + self.assertEqual(inst.contained[2].id, "eye") + 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].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].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].code[0].code, "9267-6") + self.assertEqual(inst.item[2].code[0].system, "http://loinc.org") + self.assertEqual(inst.item[2].linkId, "1.3") + self.assertEqual(inst.item[2].type, "choice") + self.assertEqual(inst.publisher, "FHIR Project team") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.subjectType[0], "Patient") + self.assertEqual(inst.text.status, "generated") + 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-bluebook.json") + self.assertIsNotNone(inst, "Must have instantiated a Questionnaire instance") + self.implQuestionnaire4(inst) + + js = inst.as_json() + self.assertEqual("Questionnaire", js["resourceType"]) + inst2 = questionnaire.Questionnaire(js) + self.implQuestionnaire4(inst2) + + def implQuestionnaire4(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.status, "draft") + self.assertEqual(inst.subjectType[0], "Patient") + 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") + diff --git a/fhirclient/models/STU3/questionnaireresponse.py b/fhirclient/models/STU3/questionnaireresponse.py new file mode 100644 index 000000000..ba92c50f0 --- /dev/null +++ b/fhirclient/models/STU3/questionnaireresponse.py @@ -0,0 +1,264 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class QuestionnaireResponse(domainresource.DomainResource): + """ A structured set of questions and their answers. + + A structured set of questions and their answers. The questions are ordered + and grouped into coherent subsets, corresponding to the structure of the + grouping of the questionnaire being responded to. + """ + + resource_type = "QuestionnaireResponse" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Person who received and recorded the answers. + Type `FHIRReference` referencing `Device, Practitioner, Patient, RelatedPerson` (represented as `dict` in JSON). """ + + self.authored = None + """ Date the answers were gathered. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.basedOn = None + """ Request fulfilled by this QuestionnaireResponse. + List of `FHIRReference` items referencing `ReferralRequest, CarePlan, ProcedureRequest` (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.identifier = None + """ Unique id for this set of answers. + Type `Identifier` (represented as `dict` in JSON). """ + + self.item = None + """ Groups and questions. + List of `QuestionnaireResponseItem` items (represented as `dict` in JSON). """ + + self.parent = None + """ Part of this action. + List of `FHIRReference` items referencing `Observation, Procedure` (represented as `dict` in JSON). """ + + self.questionnaire = None + """ Form being answered. + Type `FHIRReference` referencing `Questionnaire` (represented as `dict` in JSON). """ + + self.source = None + """ The person who answered the questions. + Type `FHIRReference` referencing `Patient, Practitioner, RelatedPerson` (represented as `dict` in JSON). """ + + self.status = None + """ in-progress | completed | amended | entered-in-error | stopped. + Type `str`. """ + + self.subject = None + """ The subject of the questions. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + super(QuestionnaireResponse, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(QuestionnaireResponse, self).elementProperties() + js.extend([ + ("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), + ("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), + ("source", "source", fhirreference.FHIRReference, False, None, False), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +from . import backboneelement + +class QuestionnaireResponseItem(backboneelement.BackboneElement): + """ Groups and questions. + + A group or question item from the original questionnaire for which answers + are provided. + """ + + resource_type = "QuestionnaireResponseItem" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ The response(s) to the question. + List of `QuestionnaireResponseItemAnswer` items (represented as `dict` in JSON). """ + + self.definition = None + """ ElementDefinition - details for the item. + Type `str`. """ + + self.item = None + """ Nested questionnaire response items. + List of `QuestionnaireResponseItem` items (represented as `dict` in JSON). """ + + self.linkId = None + """ 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`. """ + + super(QuestionnaireResponseItem, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(QuestionnaireResponseItem, self).elementProperties() + js.extend([ + ("answer", "answer", QuestionnaireResponseItemAnswer, True, None, False), + ("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 + + +class QuestionnaireResponseItemAnswer(backboneelement.BackboneElement): + """ The response(s) to the question. + + The respondent's answer(s) to the question. + """ + + resource_type = "QuestionnaireResponseItemAnswer" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Nested groups and questions. + List of `QuestionnaireResponseItem` items (represented as `dict` in JSON). """ + + self.valueAttachment = None + """ Single-valued answer to the question. + Type `Attachment` (represented as `dict` in JSON). """ + + self.valueBoolean = None + """ Single-valued answer to the question. + Type `bool`. """ + + self.valueCoding = None + """ Single-valued answer to the question. + Type `Coding` (represented as `dict` in JSON). """ + + self.valueDate = None + """ Single-valued answer to the question. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueDateTime = None + """ Single-valued answer to the question. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueDecimal = None + """ Single-valued answer to the question. + Type `float`. """ + + self.valueInteger = None + """ Single-valued answer to the question. + Type `int`. """ + + self.valueQuantity = None + """ Single-valued answer to the question. + Type `Quantity` (represented as `dict` in JSON). """ + + self.valueReference = None + """ Single-valued answer to the question. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.valueString = None + """ Single-valued answer to the question. + Type `str`. """ + + self.valueTime = None + """ Single-valued answer to the question. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueUri = None + """ Single-valued answer to the question. + Type `str`. """ + + super(QuestionnaireResponseItemAnswer, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(QuestionnaireResponseItemAnswer, self).elementProperties() + js.extend([ + ("item", "item", QuestionnaireResponseItem, True, None, False), + ("valueAttachment", "valueAttachment", attachment.Attachment, False, "value", False), + ("valueBoolean", "valueBoolean", bool, False, "value", False), + ("valueCoding", "valueCoding", coding.Coding, False, "value", False), + ("valueDate", "valueDate", fhirdate.FHIRDate, False, "value", False), + ("valueDateTime", "valueDateTime", fhirdate.FHIRDate, False, "value", False), + ("valueDecimal", "valueDecimal", float, False, "value", False), + ("valueInteger", "valueInteger", int, False, "value", False), + ("valueQuantity", "valueQuantity", quantity.Quantity, False, "value", False), + ("valueReference", "valueReference", fhirreference.FHIRReference, False, "value", False), + ("valueString", "valueString", str, False, "value", False), + ("valueTime", "valueTime", fhirdate.FHIRDate, False, "value", False), + ("valueUri", "valueUri", str, False, "value", False), + ]) + return js + + +import sys +try: + from . import attachment +except ImportError: + attachment = sys.modules[__package__ + '.attachment'] +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 quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/STU3/questionnaireresponse_tests.py b/fhirclient/models/STU3/questionnaireresponse_tests.py new file mode 100644 index 000000000..6b3f8209b --- /dev/null +++ b/fhirclient/models/STU3/questionnaireresponse_tests.py @@ -0,0 +1,759 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import questionnaireresponse +from .fhirdate import FHIRDate + + +class QuestionnaireResponseTests(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("QuestionnaireResponse", js["resourceType"]) + return questionnaireresponse.QuestionnaireResponse(js) + + def testQuestionnaireResponse1(self): + inst = self.instantiate_from("questionnaireresponse-example.json") + self.assertIsNotNone(inst, "Must have instantiated a QuestionnaireResponse instance") + self.implQuestionnaireResponse1(inst) + + js = inst.as_json() + self.assertEqual("QuestionnaireResponse", js["resourceType"]) + inst2 = questionnaireresponse.QuestionnaireResponse(js) + self.implQuestionnaireResponse1(inst2) + + def implQuestionnaireResponse1(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.status, "completed") + self.assertEqual(inst.text.status, "generated") + + def testQuestionnaireResponse2(self): + inst = self.instantiate_from("questionnaireresponse-example-ussg-fht-answers.json") + self.assertIsNotNone(inst, "Must have instantiated a QuestionnaireResponse instance") + self.implQuestionnaireResponse2(inst) + + js = inst.as_json() + self.assertEqual("QuestionnaireResponse", js["resourceType"]) + inst2 = questionnaireresponse.QuestionnaireResponse(js) + self.implQuestionnaireResponse2(inst2) + + def implQuestionnaireResponse2(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") + self.assertEqual(inst.item[0].item[0].answer[0].valueDate.date, FHIRDate("2008-01-17").date) + self.assertEqual(inst.item[0].item[0].answer[0].valueDate.as_json(), "2008-01-17") + self.assertEqual(inst.item[0].item[0].linkId, "0.1") + self.assertEqual(inst.item[0].item[0].text, "Date Done") + self.assertEqual(inst.item[0].linkId, "0") + self.assertEqual(inst.item[1].definition, "http://loinc.org/fhir/DataElement/54126-8") + self.assertEqual(inst.item[1].item[0].item[0].answer[0].valueString, "Annie Proband") + self.assertEqual(inst.item[1].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54125-0") + self.assertEqual(inst.item[1].item[0].item[0].linkId, "1.1.1") + self.assertEqual(inst.item[1].item[0].item[0].text, "Name") + self.assertEqual(inst.item[1].item[0].item[1].answer[0].valueCoding.code, "LA3-6") + self.assertEqual(inst.item[1].item[0].item[1].answer[0].valueCoding.display, "Female") + self.assertEqual(inst.item[1].item[0].item[1].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[1].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54131-8") + self.assertEqual(inst.item[1].item[0].item[1].linkId, "1.1.2") + self.assertEqual(inst.item[1].item[0].item[1].text, "Gender") + self.assertEqual(inst.item[1].item[0].item[2].answer[0].valueDate.date, FHIRDate("1966-04-04").date) + self.assertEqual(inst.item[1].item[0].item[2].answer[0].valueDate.as_json(), "1966-04-04") + self.assertEqual(inst.item[1].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/21112-8") + self.assertEqual(inst.item[1].item[0].item[2].linkId, "1.1.3") + self.assertEqual(inst.item[1].item[0].item[2].text, "Date of Birth") + self.assertEqual(inst.item[1].item[0].item[3].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[1].item[0].item[3].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[1].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[1].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54132-6") + self.assertEqual(inst.item[1].item[0].item[3].linkId, "1.1.4") + self.assertEqual(inst.item[1].item[0].item[3].text, "Were you born a twin?") + self.assertEqual(inst.item[1].item[0].item[4].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[1].item[0].item[4].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[1].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[1].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54128-4") + self.assertEqual(inst.item[1].item[0].item[4].linkId, "1.1.5") + self.assertEqual(inst.item[1].item[0].item[4].text, "Were you adopted?") + self.assertEqual(inst.item[1].item[0].item[5].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[1].item[0].item[5].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[1].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[1].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54135-9") + self.assertEqual(inst.item[1].item[0].item[5].linkId, "1.1.6") + self.assertEqual(inst.item[1].item[0].item[5].text, "Are your parents related to each other in any way other than marriage?") + self.assertEqual(inst.item[1].item[0].item[6].answer[0].item[0].item[0].answer[0].valueCoding.code, "[in_i]") + self.assertEqual(inst.item[1].item[0].item[6].answer[0].item[0].item[0].answer[0].valueCoding.display, "inches") + self.assertEqual(inst.item[1].item[0].item[6].answer[0].item[0].item[0].answer[0].valueCoding.system, "http://unitsofmeasure.org") + self.assertEqual(inst.item[1].item[0].item[6].answer[0].item[0].item[0].linkId, "1.1.7.1.1") + self.assertEqual(inst.item[1].item[0].item[6].answer[0].item[0].item[0].text, "Units") + self.assertEqual(inst.item[1].item[0].item[6].answer[0].item[0].linkId, "1.1.7.1") + self.assertEqual(inst.item[1].item[0].item[6].answer[0].valueDecimal, 63) + 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.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") + self.assertEqual(inst.item[1].item[0].item[7].answer[0].item[0].item[0].text, "Units") + self.assertEqual(inst.item[1].item[0].item[7].answer[0].item[0].linkId, "1.1.8.1") + self.assertEqual(inst.item[1].item[0].item[7].answer[0].valueDecimal, 127) + self.assertEqual(inst.item[1].item[0].item[7].definition, "http://loinc.org/fhir/DataElement/29463-7") + self.assertEqual(inst.item[1].item[0].item[7].linkId, "1.1.8") + self.assertEqual(inst.item[1].item[0].item[7].text, "Weight") + self.assertEqual(inst.item[1].item[0].item[8].answer[0].valueDecimal, 22.5) + self.assertEqual(inst.item[1].item[0].item[8].definition, "http://loinc.org/fhir/DataElement/39156-5") + self.assertEqual(inst.item[1].item[0].item[8].linkId, "1.1.9") + self.assertEqual(inst.item[1].item[0].item[8].text, "Body mass index (BMI) [Ratio]") + self.assertEqual(inst.item[1].item[0].item[9].answer[0].valueCoding.code, "LA4457-3") + self.assertEqual(inst.item[1].item[0].item[9].answer[0].valueCoding.display, "White") + self.assertEqual(inst.item[1].item[0].item[9].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[1].item[0].item[9].definition, "http://loinc.org/fhir/DataElement/54134-2") + self.assertEqual(inst.item[1].item[0].item[9].linkId, "1.1.10") + self.assertEqual(inst.item[1].item[0].item[9].text, "Race") + self.assertEqual(inst.item[1].item[0].linkId, "1.1") + 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].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") + self.assertEqual(inst.item[2].item[1].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[1].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54136-7") + self.assertEqual(inst.item[2].item[1].item[0].item[0].linkId, "2.1.1.1") + self.assertEqual(inst.item[2].item[1].item[0].item[0].text, "Relationship to you") + self.assertEqual(inst.item[2].item[1].item[0].item[1].answer[0].valueString, "Brian") + self.assertEqual(inst.item[2].item[1].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54138-3") + self.assertEqual(inst.item[2].item[1].item[0].item[1].linkId, "2.1.1.2") + self.assertEqual(inst.item[2].item[1].item[0].item[1].text, "Name") + self.assertEqual(inst.item[2].item[1].item[0].item[2].answer[0].valueCoding.code, "LA2-8") + self.assertEqual(inst.item[2].item[1].item[0].item[2].answer[0].valueCoding.display, "Male") + self.assertEqual(inst.item[2].item[1].item[0].item[2].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[1].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/54123-5") + self.assertEqual(inst.item[2].item[1].item[0].item[2].linkId, "2.1.1.3") + self.assertEqual(inst.item[2].item[1].item[0].item[2].text, "Gender") + self.assertEqual(inst.item[2].item[1].item[0].item[3].answer[0].item[0].item[0].answer[0].valueDecimal, 32) + self.assertEqual(inst.item[2].item[1].item[0].item[3].answer[0].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54141-7") + self.assertEqual(inst.item[2].item[1].item[0].item[3].answer[0].item[0].item[0].linkId, "2.1.1.4.2.2") + self.assertEqual(inst.item[2].item[1].item[0].item[3].answer[0].item[0].item[0].text, "Age") + self.assertEqual(inst.item[2].item[1].item[0].item[3].answer[0].item[0].linkId, "2.1.1.4.2") + self.assertEqual(inst.item[2].item[1].item[0].item[3].answer[0].valueCoding.code, "LA33-6") + self.assertEqual(inst.item[2].item[1].item[0].item[3].answer[0].valueCoding.display, "Yes") + self.assertEqual(inst.item[2].item[1].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[1].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54139-1") + self.assertEqual(inst.item[2].item[1].item[0].item[3].linkId, "2.1.1.4") + self.assertEqual(inst.item[2].item[1].item[0].item[3].text, "Living?") + self.assertEqual(inst.item[2].item[1].item[0].item[4].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[1].item[0].item[4].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[1].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[1].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54121-9") + self.assertEqual(inst.item[2].item[1].item[0].item[4].linkId, "2.1.1.5") + self.assertEqual(inst.item[2].item[1].item[0].item[4].text, "Was this person born a twin?") + self.assertEqual(inst.item[2].item[1].item[0].item[5].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[1].item[0].item[5].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[1].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[1].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54122-7") + self.assertEqual(inst.item[2].item[1].item[0].item[5].linkId, "2.1.1.6") + self.assertEqual(inst.item[2].item[1].item[0].item[5].text, "Was this person adopted?") + self.assertEqual(inst.item[2].item[1].item[0].linkId, "2.1.1") + self.assertEqual(inst.item[2].item[1].item[1].item[0].answer[0].valueCoding.code, "LA10550-4") + self.assertEqual(inst.item[2].item[1].item[1].item[0].answer[0].valueCoding.display, "-- Other Cancer") + self.assertEqual(inst.item[2].item[1].item[1].item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[1].item[1].item[0].linkId, "2.1.2.1") + self.assertEqual(inst.item[2].item[1].item[1].item[0].text, "Disease or Condition") + self.assertEqual(inst.item[2].item[1].item[1].item[1].answer[0].valueCoding.code, "LA10397-0") + self.assertEqual(inst.item[2].item[1].item[1].item[1].answer[0].valueCoding.display, "30-39") + self.assertEqual(inst.item[2].item[1].item[1].item[1].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[1].item[1].item[1].linkId, "2.1.2.2") + self.assertEqual(inst.item[2].item[1].item[1].item[1].text, "Age at Diagnosis") + self.assertEqual(inst.item[2].item[1].item[1].linkId, "2.1.2") + self.assertEqual(inst.item[2].item[1].item[1].text, "This family member's history of disease") + self.assertEqual(inst.item[2].item[1].linkId, "2.1") + self.assertEqual(inst.item[2].item[2].item[0].item[0].answer[0].valueCoding.code, "LA10418-4") + self.assertEqual(inst.item[2].item[2].item[0].item[0].answer[0].valueCoding.display, "Sister") + self.assertEqual(inst.item[2].item[2].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[2].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54136-7") + self.assertEqual(inst.item[2].item[2].item[0].item[0].linkId, "2.1.1.1") + self.assertEqual(inst.item[2].item[2].item[0].item[0].text, "Relationship to you") + self.assertEqual(inst.item[2].item[2].item[0].item[1].answer[0].valueString, "Janet") + self.assertEqual(inst.item[2].item[2].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54138-3") + self.assertEqual(inst.item[2].item[2].item[0].item[1].linkId, "2.1.1.2") + self.assertEqual(inst.item[2].item[2].item[0].item[1].text, "Name") + self.assertEqual(inst.item[2].item[2].item[0].item[2].answer[0].valueCoding.code, "LA3-6") + self.assertEqual(inst.item[2].item[2].item[0].item[2].answer[0].valueCoding.display, "Female") + self.assertEqual(inst.item[2].item[2].item[0].item[2].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[2].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/54123-5") + self.assertEqual(inst.item[2].item[2].item[0].item[2].linkId, "2.1.1.3") + self.assertEqual(inst.item[2].item[2].item[0].item[2].text, "Gender") + self.assertEqual(inst.item[2].item[2].item[0].item[3].answer[0].item[0].item[0].answer[0].valueDecimal, 36) + self.assertEqual(inst.item[2].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[2].item[0].item[3].answer[0].item[0].item[0].linkId, "2.1.1.4.2.2") + self.assertEqual(inst.item[2].item[2].item[0].item[3].answer[0].item[0].item[0].text, "Age") + self.assertEqual(inst.item[2].item[2].item[0].item[3].answer[0].item[0].linkId, "2.1.1.4.2") + self.assertEqual(inst.item[2].item[2].item[0].item[3].answer[0].valueCoding.code, "LA33-6") + self.assertEqual(inst.item[2].item[2].item[0].item[3].answer[0].valueCoding.display, "Yes") + self.assertEqual(inst.item[2].item[2].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[2].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54139-1") + self.assertEqual(inst.item[2].item[2].item[0].item[3].linkId, "2.1.1.4") + self.assertEqual(inst.item[2].item[2].item[0].item[3].text, "Living?") + self.assertEqual(inst.item[2].item[2].item[0].item[4].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[2].item[0].item[4].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[2].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[2].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54121-9") + self.assertEqual(inst.item[2].item[2].item[0].item[4].linkId, "2.1.1.5") + self.assertEqual(inst.item[2].item[2].item[0].item[4].text, "Was this person born a twin?") + self.assertEqual(inst.item[2].item[2].item[0].item[5].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[2].item[0].item[5].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[2].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[2].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54122-7") + self.assertEqual(inst.item[2].item[2].item[0].item[5].linkId, "2.1.1.6") + self.assertEqual(inst.item[2].item[2].item[0].item[5].text, "Was this person adopted?") + self.assertEqual(inst.item[2].item[2].item[0].linkId, "2.1.1") + self.assertEqual(inst.item[2].item[2].item[1].item[0].answer[0].valueCoding.code, "LA10536-3") + self.assertEqual(inst.item[2].item[2].item[1].item[0].answer[0].valueCoding.display, "-- Breast Cancer") + self.assertEqual(inst.item[2].item[2].item[1].item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[2].item[1].item[0].linkId, "2.1.2.1") + self.assertEqual(inst.item[2].item[2].item[1].item[0].text, "Disease or Condition") + self.assertEqual(inst.item[2].item[2].item[1].item[1].answer[0].valueCoding.code, "LA10397-0") + self.assertEqual(inst.item[2].item[2].item[1].item[1].answer[0].valueCoding.display, "30-39") + self.assertEqual(inst.item[2].item[2].item[1].item[1].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[2].item[1].item[1].linkId, "2.1.2.2") + self.assertEqual(inst.item[2].item[2].item[1].item[1].text, "Age at Diagnosis") + self.assertEqual(inst.item[2].item[2].item[1].linkId, "2.1.2") + self.assertEqual(inst.item[2].item[2].item[1].text, "This family member's history of disease") + self.assertEqual(inst.item[2].item[2].linkId, "2.1") + self.assertEqual(inst.item[2].item[3].item[0].item[0].answer[0].valueCoding.code, "LA10419-2") + self.assertEqual(inst.item[2].item[3].item[0].item[0].answer[0].valueCoding.display, "Nephew") + self.assertEqual(inst.item[2].item[3].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[3].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54136-7") + self.assertEqual(inst.item[2].item[3].item[0].item[0].linkId, "2.1.1.1") + self.assertEqual(inst.item[2].item[3].item[0].item[0].text, "Relationship to you") + self.assertEqual(inst.item[2].item[3].item[0].item[1].answer[0].valueString, "Ian") + self.assertEqual(inst.item[2].item[3].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54138-3") + self.assertEqual(inst.item[2].item[3].item[0].item[1].linkId, "2.1.1.2") + self.assertEqual(inst.item[2].item[3].item[0].item[1].text, "Name") + self.assertEqual(inst.item[2].item[3].item[0].item[2].answer[0].valueCoding.code, "LA2-8") + self.assertEqual(inst.item[2].item[3].item[0].item[2].answer[0].valueCoding.display, "Male") + self.assertEqual(inst.item[2].item[3].item[0].item[2].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[3].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/54123-5") + self.assertEqual(inst.item[2].item[3].item[0].item[2].linkId, "2.1.1.3") + self.assertEqual(inst.item[2].item[3].item[0].item[2].text, "Gender") + self.assertEqual(inst.item[2].item[3].item[0].item[3].answer[0].item[0].item[0].answer[0].valueDecimal, 16) + self.assertEqual(inst.item[2].item[3].item[0].item[3].answer[0].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54141-7") + self.assertEqual(inst.item[2].item[3].item[0].item[3].answer[0].item[0].item[0].linkId, "2.1.1.4.2.2") + self.assertEqual(inst.item[2].item[3].item[0].item[3].answer[0].item[0].item[0].text, "Age") + self.assertEqual(inst.item[2].item[3].item[0].item[3].answer[0].item[0].linkId, "2.1.1.4.2") + self.assertEqual(inst.item[2].item[3].item[0].item[3].answer[0].valueCoding.code, "LA33-6") + self.assertEqual(inst.item[2].item[3].item[0].item[3].answer[0].valueCoding.display, "Yes") + self.assertEqual(inst.item[2].item[3].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[3].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54139-1") + self.assertEqual(inst.item[2].item[3].item[0].item[3].linkId, "2.1.1.4") + self.assertEqual(inst.item[2].item[3].item[0].item[3].text, "Living?") + self.assertEqual(inst.item[2].item[3].item[0].item[4].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[3].item[0].item[4].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[3].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[3].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54121-9") + self.assertEqual(inst.item[2].item[3].item[0].item[4].linkId, "2.1.1.5") + self.assertEqual(inst.item[2].item[3].item[0].item[4].text, "Was this person born a twin?") + self.assertEqual(inst.item[2].item[3].item[0].item[5].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[3].item[0].item[5].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[3].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[3].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54122-7") + self.assertEqual(inst.item[2].item[3].item[0].item[5].linkId, "2.1.1.6") + self.assertEqual(inst.item[2].item[3].item[0].item[5].text, "Was this person adopted?") + self.assertEqual(inst.item[2].item[3].item[0].linkId, "2.1.1") + self.assertEqual(inst.item[2].item[3].linkId, "2.1") + self.assertEqual(inst.item[2].item[4].item[0].item[0].answer[0].valueCoding.code, "LA10420-0") + self.assertEqual(inst.item[2].item[4].item[0].item[0].answer[0].valueCoding.display, "Niece") + self.assertEqual(inst.item[2].item[4].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[4].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54136-7") + self.assertEqual(inst.item[2].item[4].item[0].item[0].linkId, "2.1.1.1") + self.assertEqual(inst.item[2].item[4].item[0].item[0].text, "Relationship to you") + self.assertEqual(inst.item[2].item[4].item[0].item[1].answer[0].valueString, "Helen") + self.assertEqual(inst.item[2].item[4].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54138-3") + self.assertEqual(inst.item[2].item[4].item[0].item[1].linkId, "2.1.1.2") + self.assertEqual(inst.item[2].item[4].item[0].item[1].text, "Name") + self.assertEqual(inst.item[2].item[4].item[0].item[2].answer[0].valueCoding.code, "LA3-6") + self.assertEqual(inst.item[2].item[4].item[0].item[2].answer[0].valueCoding.display, "Female") + self.assertEqual(inst.item[2].item[4].item[0].item[2].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[4].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/54123-5") + self.assertEqual(inst.item[2].item[4].item[0].item[2].linkId, "2.1.1.3") + self.assertEqual(inst.item[2].item[4].item[0].item[2].text, "Gender") + self.assertEqual(inst.item[2].item[4].item[0].item[3].answer[0].item[0].item[0].answer[0].valueDecimal, 15) + self.assertEqual(inst.item[2].item[4].item[0].item[3].answer[0].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54141-7") + self.assertEqual(inst.item[2].item[4].item[0].item[3].answer[0].item[0].item[0].linkId, "2.1.1.4.2.2") + self.assertEqual(inst.item[2].item[4].item[0].item[3].answer[0].item[0].item[0].text, "Age") + self.assertEqual(inst.item[2].item[4].item[0].item[3].answer[0].item[0].linkId, "2.1.1.4.2") + self.assertEqual(inst.item[2].item[4].item[0].item[3].answer[0].valueCoding.code, "LA33-6") + self.assertEqual(inst.item[2].item[4].item[0].item[3].answer[0].valueCoding.display, "Yes") + self.assertEqual(inst.item[2].item[4].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[4].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54139-1") + self.assertEqual(inst.item[2].item[4].item[0].item[3].linkId, "2.1.1.4") + self.assertEqual(inst.item[2].item[4].item[0].item[3].text, "Living?") + self.assertEqual(inst.item[2].item[4].item[0].item[4].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[4].item[0].item[4].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[4].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[4].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54121-9") + self.assertEqual(inst.item[2].item[4].item[0].item[4].linkId, "2.1.1.5") + self.assertEqual(inst.item[2].item[4].item[0].item[4].text, "Was this person born a twin?") + self.assertEqual(inst.item[2].item[4].item[0].item[5].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[4].item[0].item[5].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[4].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[4].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54122-7") + self.assertEqual(inst.item[2].item[4].item[0].item[5].linkId, "2.1.1.6") + self.assertEqual(inst.item[2].item[4].item[0].item[5].text, "Was this person adopted?") + self.assertEqual(inst.item[2].item[4].item[0].linkId, "2.1.1") + self.assertEqual(inst.item[2].item[4].linkId, "2.1") + self.assertEqual(inst.item[2].item[5].item[0].item[0].answer[0].valueCoding.code, "LA10416-8") + self.assertEqual(inst.item[2].item[5].item[0].item[0].answer[0].valueCoding.display, "Father") + self.assertEqual(inst.item[2].item[5].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[5].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54136-7") + self.assertEqual(inst.item[2].item[5].item[0].item[0].linkId, "2.1.1.1") + self.assertEqual(inst.item[2].item[5].item[0].item[0].text, "Relationship to you") + self.assertEqual(inst.item[2].item[5].item[0].item[1].answer[0].valueString, "Donald") + self.assertEqual(inst.item[2].item[5].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54138-3") + self.assertEqual(inst.item[2].item[5].item[0].item[1].linkId, "2.1.1.2") + self.assertEqual(inst.item[2].item[5].item[0].item[1].text, "Name") + self.assertEqual(inst.item[2].item[5].item[0].item[2].answer[0].valueCoding.code, "LA2-8") + self.assertEqual(inst.item[2].item[5].item[0].item[2].answer[0].valueCoding.display, "Male") + self.assertEqual(inst.item[2].item[5].item[0].item[2].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[5].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/54123-5") + self.assertEqual(inst.item[2].item[5].item[0].item[2].linkId, "2.1.1.3") + self.assertEqual(inst.item[2].item[5].item[0].item[2].text, "Gender") + self.assertEqual(inst.item[2].item[5].item[0].item[3].answer[0].item[0].item[0].answer[0].valueDecimal, 52) + self.assertEqual(inst.item[2].item[5].item[0].item[3].answer[0].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54141-7") + self.assertEqual(inst.item[2].item[5].item[0].item[3].answer[0].item[0].item[0].linkId, "2.1.1.4.2.2") + self.assertEqual(inst.item[2].item[5].item[0].item[3].answer[0].item[0].item[0].text, "Age") + self.assertEqual(inst.item[2].item[5].item[0].item[3].answer[0].item[0].linkId, "2.1.1.4.2") + self.assertEqual(inst.item[2].item[5].item[0].item[3].answer[0].valueCoding.code, "LA33-6") + self.assertEqual(inst.item[2].item[5].item[0].item[3].answer[0].valueCoding.display, "Yes") + self.assertEqual(inst.item[2].item[5].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[5].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54139-1") + self.assertEqual(inst.item[2].item[5].item[0].item[3].linkId, "2.1.1.4") + self.assertEqual(inst.item[2].item[5].item[0].item[3].text, "Living?") + self.assertEqual(inst.item[2].item[5].item[0].item[4].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[5].item[0].item[4].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[5].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[5].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54121-9") + self.assertEqual(inst.item[2].item[5].item[0].item[4].linkId, "2.1.1.5") + self.assertEqual(inst.item[2].item[5].item[0].item[4].text, "Was this person born a twin?") + self.assertEqual(inst.item[2].item[5].item[0].item[5].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[5].item[0].item[5].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[5].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[5].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54122-7") + self.assertEqual(inst.item[2].item[5].item[0].item[5].linkId, "2.1.1.6") + self.assertEqual(inst.item[2].item[5].item[0].item[5].text, "Was this person adopted?") + self.assertEqual(inst.item[2].item[5].item[0].linkId, "2.1.1") + self.assertEqual(inst.item[2].item[5].linkId, "2.1") + self.assertEqual(inst.item[2].item[6].item[0].item[0].answer[0].valueCoding.code, "LA10425-9") + self.assertEqual(inst.item[2].item[6].item[0].item[0].answer[0].valueCoding.display, "Paternal Uncle") + self.assertEqual(inst.item[2].item[6].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[6].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54136-7") + self.assertEqual(inst.item[2].item[6].item[0].item[0].linkId, "2.1.1.1") + self.assertEqual(inst.item[2].item[6].item[0].item[0].text, "Relationship to you") + self.assertEqual(inst.item[2].item[6].item[0].item[1].answer[0].valueString, "Eric") + self.assertEqual(inst.item[2].item[6].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54138-3") + self.assertEqual(inst.item[2].item[6].item[0].item[1].linkId, "2.1.1.2") + self.assertEqual(inst.item[2].item[6].item[0].item[1].text, "Name") + self.assertEqual(inst.item[2].item[6].item[0].item[2].answer[0].valueCoding.code, "LA2-8") + self.assertEqual(inst.item[2].item[6].item[0].item[2].answer[0].valueCoding.display, "Male") + self.assertEqual(inst.item[2].item[6].item[0].item[2].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[6].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/54123-5") + self.assertEqual(inst.item[2].item[6].item[0].item[2].linkId, "2.1.1.3") + self.assertEqual(inst.item[2].item[6].item[0].item[2].text, "Gender") + self.assertEqual(inst.item[2].item[6].item[0].item[3].answer[0].item[0].item[0].answer[0].valueDecimal, 56) + self.assertEqual(inst.item[2].item[6].item[0].item[3].answer[0].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54141-7") + self.assertEqual(inst.item[2].item[6].item[0].item[3].answer[0].item[0].item[0].linkId, "2.1.1.4.2.2") + self.assertEqual(inst.item[2].item[6].item[0].item[3].answer[0].item[0].item[0].text, "Age") + self.assertEqual(inst.item[2].item[6].item[0].item[3].answer[0].item[0].linkId, "2.1.1.4.2") + self.assertEqual(inst.item[2].item[6].item[0].item[3].answer[0].valueCoding.code, "LA33-6") + self.assertEqual(inst.item[2].item[6].item[0].item[3].answer[0].valueCoding.display, "Yes") + self.assertEqual(inst.item[2].item[6].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[6].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54139-1") + self.assertEqual(inst.item[2].item[6].item[0].item[3].linkId, "2.1.1.4") + self.assertEqual(inst.item[2].item[6].item[0].item[3].text, "Living?") + self.assertEqual(inst.item[2].item[6].item[0].item[4].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[6].item[0].item[4].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[6].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[6].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54121-9") + self.assertEqual(inst.item[2].item[6].item[0].item[4].linkId, "2.1.1.5") + self.assertEqual(inst.item[2].item[6].item[0].item[4].text, "Was this person born a twin?") + self.assertEqual(inst.item[2].item[6].item[0].item[5].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[6].item[0].item[5].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[6].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[6].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54122-7") + self.assertEqual(inst.item[2].item[6].item[0].item[5].linkId, "2.1.1.6") + self.assertEqual(inst.item[2].item[6].item[0].item[5].text, "Was this person adopted?") + self.assertEqual(inst.item[2].item[6].item[0].linkId, "2.1.1") + self.assertEqual(inst.item[2].item[6].linkId, "2.1") + self.assertEqual(inst.item[2].item[7].item[0].item[0].answer[0].valueCoding.code, "LA10421-8") + self.assertEqual(inst.item[2].item[7].item[0].item[0].answer[0].valueCoding.display, "Paternal Aunt") + self.assertEqual(inst.item[2].item[7].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[7].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54136-7") + self.assertEqual(inst.item[2].item[7].item[0].item[0].linkId, "2.1.1.1") + self.assertEqual(inst.item[2].item[7].item[0].item[0].text, "Relationship to you") + self.assertEqual(inst.item[2].item[7].item[0].item[1].answer[0].valueString, "Fiona") + self.assertEqual(inst.item[2].item[7].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54138-3") + self.assertEqual(inst.item[2].item[7].item[0].item[1].linkId, "2.1.1.2") + self.assertEqual(inst.item[2].item[7].item[0].item[1].text, "Name") + self.assertEqual(inst.item[2].item[7].item[0].item[2].answer[0].valueCoding.code, "LA3-6") + self.assertEqual(inst.item[2].item[7].item[0].item[2].answer[0].valueCoding.display, "Female") + self.assertEqual(inst.item[2].item[7].item[0].item[2].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[7].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/54123-5") + self.assertEqual(inst.item[2].item[7].item[0].item[2].linkId, "2.1.1.3") + self.assertEqual(inst.item[2].item[7].item[0].item[2].text, "Gender") + self.assertEqual(inst.item[2].item[7].item[0].item[3].answer[0].item[0].item[0].answer[0].valueDecimal, 57) + self.assertEqual(inst.item[2].item[7].item[0].item[3].answer[0].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54141-7") + self.assertEqual(inst.item[2].item[7].item[0].item[3].answer[0].item[0].item[0].linkId, "2.1.1.4.2.2") + self.assertEqual(inst.item[2].item[7].item[0].item[3].answer[0].item[0].item[0].text, "Age") + self.assertEqual(inst.item[2].item[7].item[0].item[3].answer[0].item[0].linkId, "2.1.1.4.2") + self.assertEqual(inst.item[2].item[7].item[0].item[3].answer[0].valueCoding.code, "LA33-6") + self.assertEqual(inst.item[2].item[7].item[0].item[3].answer[0].valueCoding.display, "Yes") + self.assertEqual(inst.item[2].item[7].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[7].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54139-1") + self.assertEqual(inst.item[2].item[7].item[0].item[3].linkId, "2.1.1.4") + self.assertEqual(inst.item[2].item[7].item[0].item[3].text, "Living?") + self.assertEqual(inst.item[2].item[7].item[0].item[4].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[7].item[0].item[4].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[7].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[7].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54121-9") + self.assertEqual(inst.item[2].item[7].item[0].item[4].linkId, "2.1.1.5") + self.assertEqual(inst.item[2].item[7].item[0].item[4].text, "Was this person born a twin?") + self.assertEqual(inst.item[2].item[7].item[0].item[5].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[7].item[0].item[5].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[7].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[7].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54122-7") + self.assertEqual(inst.item[2].item[7].item[0].item[5].linkId, "2.1.1.6") + self.assertEqual(inst.item[2].item[7].item[0].item[5].text, "Was this person adopted?") + self.assertEqual(inst.item[2].item[7].item[0].linkId, "2.1.1") + self.assertEqual(inst.item[2].item[7].item[1].item[0].answer[0].valueCoding.code, "LA10543-9") + self.assertEqual(inst.item[2].item[7].item[1].item[0].answer[0].valueCoding.display, "-- Skin Cancer") + self.assertEqual(inst.item[2].item[7].item[1].item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[7].item[1].item[0].linkId, "2.1.2.1") + self.assertEqual(inst.item[2].item[7].item[1].item[0].text, "Disease or Condition") + self.assertEqual(inst.item[2].item[7].item[1].linkId, "2.1.2") + self.assertEqual(inst.item[2].item[7].item[1].text, "This family member's history of disease") + self.assertEqual(inst.item[2].item[7].linkId, "2.1") + self.assertEqual(inst.item[2].item[8].item[0].item[0].answer[0].valueCoding.code, "LA10423-4") + self.assertEqual(inst.item[2].item[8].item[0].item[0].answer[0].valueCoding.display, "Paternal Grandfather") + self.assertEqual(inst.item[2].item[8].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[8].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54136-7") + self.assertEqual(inst.item[2].item[8].item[0].item[0].linkId, "2.1.1.1") + self.assertEqual(inst.item[2].item[8].item[0].item[0].text, "Relationship to you") + self.assertEqual(inst.item[2].item[8].item[0].item[1].answer[0].valueString, "Bob") + self.assertEqual(inst.item[2].item[8].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54138-3") + self.assertEqual(inst.item[2].item[8].item[0].item[1].linkId, "2.1.1.2") + self.assertEqual(inst.item[2].item[8].item[0].item[1].text, "Name") + self.assertEqual(inst.item[2].item[8].item[0].item[2].answer[0].valueCoding.code, "LA2-8") + self.assertEqual(inst.item[2].item[8].item[0].item[2].answer[0].valueCoding.display, "Male") + self.assertEqual(inst.item[2].item[8].item[0].item[2].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[8].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/54123-5") + self.assertEqual(inst.item[2].item[8].item[0].item[2].linkId, "2.1.1.3") + self.assertEqual(inst.item[2].item[8].item[0].item[2].text, "Gender") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[0].answer[0].valueCoding.code, "LA10537-1") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[0].answer[0].valueCoding.display, "-- Colon Cancer") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54112-8") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[0].linkId, "2.1.1.4.1.1") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[0].text, "Cause of Death") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[1].answer[0].valueCoding.code, "LA10400-2") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[1].answer[0].valueCoding.display, "OVER 60") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[1].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54113-6") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[1].linkId, "2.1.1.4.1.2") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[1].text, "Age at Death") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].linkId, "2.1.1.4.1") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[8].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54139-1") + self.assertEqual(inst.item[2].item[8].item[0].item[3].linkId, "2.1.1.4") + self.assertEqual(inst.item[2].item[8].item[0].item[3].text, "Living?") + self.assertEqual(inst.item[2].item[8].item[0].item[4].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[8].item[0].item[4].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[8].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[8].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54121-9") + self.assertEqual(inst.item[2].item[8].item[0].item[4].linkId, "2.1.1.5") + self.assertEqual(inst.item[2].item[8].item[0].item[4].text, "Was this person born a twin?") + self.assertEqual(inst.item[2].item[8].item[0].item[5].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[8].item[0].item[5].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[8].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[8].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54122-7") + self.assertEqual(inst.item[2].item[8].item[0].item[5].linkId, "2.1.1.6") + self.assertEqual(inst.item[2].item[8].item[0].item[5].text, "Was this person adopted?") + self.assertEqual(inst.item[2].item[8].item[0].linkId, "2.1.1") + self.assertEqual(inst.item[2].item[8].item[1].item[0].answer[0].valueCoding.code, "LA10537-1") + self.assertEqual(inst.item[2].item[8].item[1].item[0].answer[0].valueCoding.display, "-- Colon Cancer") + self.assertEqual(inst.item[2].item[8].item[1].item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[8].item[1].item[0].linkId, "2.1.2.1") + self.assertEqual(inst.item[2].item[8].item[1].item[0].text, "Disease or Condition") + self.assertEqual(inst.item[2].item[8].item[1].item[1].answer[0].valueCoding.code, "LA10400-2") + self.assertEqual(inst.item[2].item[8].item[1].item[1].answer[0].valueCoding.display, "OVER 60") + self.assertEqual(inst.item[2].item[8].item[1].item[1].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[8].item[1].item[1].linkId, "2.1.2.2") + self.assertEqual(inst.item[2].item[8].item[1].item[1].text, "Age at Diagnosis") + self.assertEqual(inst.item[2].item[8].item[1].linkId, "2.1.2") + self.assertEqual(inst.item[2].item[8].item[1].text, "This family member's history of disease") + self.assertEqual(inst.item[2].item[8].linkId, "2.1") + self.assertEqual(inst.item[2].item[9].item[0].item[0].answer[0].valueCoding.code, "LA10424-2") + self.assertEqual(inst.item[2].item[9].item[0].item[0].answer[0].valueCoding.display, "Paternal Grandmother") + self.assertEqual(inst.item[2].item[9].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[9].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54136-7") + self.assertEqual(inst.item[2].item[9].item[0].item[0].linkId, "2.1.1.1") + self.assertEqual(inst.item[2].item[9].item[0].item[0].text, "Relationship to you") + self.assertEqual(inst.item[2].item[9].item[0].item[1].answer[0].valueString, "Claire") + self.assertEqual(inst.item[2].item[9].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54138-3") + self.assertEqual(inst.item[2].item[9].item[0].item[1].linkId, "2.1.1.2") + self.assertEqual(inst.item[2].item[9].item[0].item[1].text, "Name") + self.assertEqual(inst.item[2].item[9].item[0].item[2].answer[0].valueCoding.code, "LA3-6") + self.assertEqual(inst.item[2].item[9].item[0].item[2].answer[0].valueCoding.display, "Female") + self.assertEqual(inst.item[2].item[9].item[0].item[2].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[9].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/54123-5") + self.assertEqual(inst.item[2].item[9].item[0].item[2].linkId, "2.1.1.3") + self.assertEqual(inst.item[2].item[9].item[0].item[2].text, "Gender") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[0].answer[0].item[0].answer[0].valueString, "Lou Gehrigs") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[0].answer[0].item[0].linkId, "2.1.1.4.1.1.1") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[0].answer[0].item[0].text, "Please specify") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[0].answer[0].valueCoding.code, "LA10589-2") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[0].answer[0].valueCoding.display, "-- Other/Unexpected") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54112-8") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[0].linkId, "2.1.1.4.1.1") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[0].text, "Cause of Death") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[1].answer[0].valueCoding.code, "LA10400-2") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[1].answer[0].valueCoding.display, "OVER 60") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[1].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54113-6") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[1].linkId, "2.1.1.4.1.2") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[1].text, "Age at Death") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].linkId, "2.1.1.4.1") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[9].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54139-1") + self.assertEqual(inst.item[2].item[9].item[0].item[3].linkId, "2.1.1.4") + self.assertEqual(inst.item[2].item[9].item[0].item[3].text, "Living?") + self.assertEqual(inst.item[2].item[9].item[0].item[4].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[9].item[0].item[4].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[9].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[9].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54121-9") + self.assertEqual(inst.item[2].item[9].item[0].item[4].linkId, "2.1.1.5") + self.assertEqual(inst.item[2].item[9].item[0].item[4].text, "Was this person born a twin?") + self.assertEqual(inst.item[2].item[9].item[0].item[5].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[9].item[0].item[5].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[9].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[9].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54122-7") + self.assertEqual(inst.item[2].item[9].item[0].item[5].linkId, "2.1.1.6") + self.assertEqual(inst.item[2].item[9].item[0].item[5].text, "Was this person adopted?") + self.assertEqual(inst.item[2].item[9].item[0].linkId, "2.1.1") + 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.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.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.status, "completed") + self.assertEqual(inst.text.status, "generated") + + def testQuestionnaireResponse5(self): + inst = self.instantiate_from("questionnaireresponse-example-gcs.json") + self.assertIsNotNone(inst, "Must have instantiated a QuestionnaireResponse instance") + self.implQuestionnaireResponse5(inst) + + js = inst.as_json() + self.assertEqual("QuestionnaireResponse", js["resourceType"]) + inst2 = questionnaireresponse.QuestionnaireResponse(js) + self.implQuestionnaireResponse5(inst2) + + def implQuestionnaireResponse5(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") + diff --git a/fhirclient/models/STU3/range.py b/fhirclient/models/STU3/range.py new file mode 100644 index 000000000..9e8916e73 --- /dev/null +++ b/fhirclient/models/STU3/range.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Range) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Range(element.Element): + """ Set of values bounded by low and high. + + A set of ordered Quantities defined by a low and high limit. + """ + + resource_type = "Range" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.high = None + """ High limit. + Type `Quantity` (represented as `dict` in JSON). """ + + self.low = None + """ Low limit. + Type `Quantity` (represented as `dict` in JSON). """ + + super(Range, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Range, self).elementProperties() + js.extend([ + ("high", "high", quantity.Quantity, False, None, False), + ("low", "low", quantity.Quantity, False, None, False), + ]) + return js + + +import sys +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/STU3/ratio.py b/fhirclient/models/STU3/ratio.py new file mode 100644 index 000000000..06d36871e --- /dev/null +++ b/fhirclient/models/STU3/ratio.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Ratio) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Ratio(element.Element): + """ A ratio of two Quantity values - a numerator and a denominator. + + A relationship of two Quantity values - expressed as a numerator and a + denominator. + """ + + resource_type = "Ratio" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.denominator = None + """ Denominator value. + Type `Quantity` (represented as `dict` in JSON). """ + + self.numerator = None + """ Numerator value. + Type `Quantity` (represented as `dict` in JSON). """ + + super(Ratio, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Ratio, self).elementProperties() + js.extend([ + ("denominator", "denominator", quantity.Quantity, False, None, False), + ("numerator", "numerator", quantity.Quantity, False, None, False), + ]) + return js + + +import sys +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/STU3/reference.py b/fhirclient/models/STU3/reference.py new file mode 100644 index 000000000..60c5181b4 --- /dev/null +++ b/fhirclient/models/STU3/reference.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Reference) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Reference(element.Element): + """ A reference from one resource to another. + """ + + resource_type = "Reference" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.display = None + """ Text alternative for the resource. + Type `str`. """ + + self.identifier = None + """ Logical reference, when literal reference is not known. + Type `Identifier` (represented as `dict` in JSON). """ + + self.reference = None + """ Literal reference, Relative, internal or absolute URL. + Type `str`. """ + + super(Reference, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Reference, self).elementProperties() + js.extend([ + ("display", "display", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("reference", "reference", str, False, None, False), + ]) + return js + + +import sys +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] diff --git a/fhirclient/models/STU3/referralrequest.py b/fhirclient/models/STU3/referralrequest.py new file mode 100644 index 000000000..29a80a773 --- /dev/null +++ b/fhirclient/models/STU3/referralrequest.py @@ -0,0 +1,222 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ReferralRequest) on 2019-10-12. +# 2019, 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/STU3/referralrequest_tests.py b/fhirclient/models/STU3/referralrequest_tests.py new file mode 100644 index 000000000..35de7d42b --- /dev/null +++ b/fhirclient/models/STU3/referralrequest_tests.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +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/STU3/relatedartifact.py b/fhirclient/models/STU3/relatedartifact.py new file mode 100644 index 000000000..be2bf4d9a --- /dev/null +++ b/fhirclient/models/STU3/relatedartifact.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/RelatedArtifact) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class RelatedArtifact(element.Element): + """ Related artifacts for a knowledge resource. + + Related artifacts such as additional documentation, justification, or + bibliographic references. + """ + + resource_type = "RelatedArtifact" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.citation = None + """ Bibliographic citation for the artifact. + Type `str`. """ + + self.display = None + """ Brief description of the related artifact. + Type `str`. """ + + self.document = None + """ What document is being referenced. + Type `Attachment` (represented as `dict` in JSON). """ + + self.resource = None + """ What resource is being referenced. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.type = None + """ documentation | justification | citation | predecessor | successor + | derived-from | depends-on | composed-of. + Type `str`. """ + + self.url = None + """ Where the artifact can be accessed. + Type `str`. """ + + super(RelatedArtifact, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(RelatedArtifact, self).elementProperties() + js.extend([ + ("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), + ("type", "type", str, False, None, True), + ("url", "url", str, False, None, False), + ]) + return js + + +import sys +try: + 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/STU3/relatedperson.py b/fhirclient/models/STU3/relatedperson.py new file mode 100644 index 000000000..834098488 --- /dev/null +++ b/fhirclient/models/STU3/relatedperson.py @@ -0,0 +1,129 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/RelatedPerson) on 2019-10-12. +# 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 + care. + + Information about a person that is involved in the care for a patient, but + who is not the target of healthcare, nor has a formal responsibility in the + care process. + """ + + resource_type = "RelatedPerson" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 related person's record is in active use. + Type `bool`. """ + + self.address = None + """ Address where the related person can be contacted or visited. + List of `Address` items (represented as `dict` in JSON). """ + + self.birthDate = None + """ The date on which the related person was born. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.gender = None + """ male | female | other | unknown. + Type `str`. """ + + self.identifier = None + """ A human identifier for this person. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.name = None + """ A name associated with the person. + List of `HumanName` items (represented as `dict` in JSON). """ + + self.patient = None + """ The patient this person is related to. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.period = None + """ Period of time that this relationship is considered valid. + Type `Period` (represented as `dict` in JSON). """ + + self.photo = None + """ Image of the person. + List of `Attachment` items (represented as `dict` in JSON). """ + + self.relationship = None + """ The nature of the relationship. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.telecom = None + """ A contact detail for the person. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(RelatedPerson, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(RelatedPerson, self).elementProperties() + js.extend([ + ("active", "active", bool, False, None, False), + ("address", "address", address.Address, True, None, False), + ("birthDate", "birthDate", fhirdate.FHIRDate, False, 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), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ]) + return js + + +import sys +try: + from . import address +except ImportError: + address = sys.modules[__package__ + '.address'] +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 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: + 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 period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/STU3/relatedperson_tests.py b/fhirclient/models/STU3/relatedperson_tests.py new file mode 100644 index 000000000..d29355254 --- /dev/null +++ b/fhirclient/models/STU3/relatedperson_tests.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import relatedperson +from .fhirdate import FHIRDate + + +class RelatedPersonTests(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("RelatedPerson", js["resourceType"]) + return relatedperson.RelatedPerson(js) + + def testRelatedPerson1(self): + inst = self.instantiate_from("relatedperson-example-peter.json") + self.assertIsNotNone(inst, "Must have instantiated a RelatedPerson instance") + self.implRelatedPerson1(inst) + + js = inst.as_json() + self.assertEqual("RelatedPerson", js["resourceType"]) + inst2 = relatedperson.RelatedPerson(js) + self.implRelatedPerson1(inst2) + + def implRelatedPerson1(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.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.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.telecom[0].system, "phone") + 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-f001-sarah.json") + self.assertIsNotNone(inst, "Must have instantiated a RelatedPerson instance") + self.implRelatedPerson2(inst) + + js = inst.as_json() + self.assertEqual("RelatedPerson", js["resourceType"]) + inst2 = relatedperson.RelatedPerson(js) + self.implRelatedPerson2(inst2) + + def implRelatedPerson2(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.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.text.status, "generated") + + def testRelatedPerson3(self): + inst = self.instantiate_from("relatedperson-example.json") + self.assertIsNotNone(inst, "Must have instantiated a RelatedPerson instance") + self.implRelatedPerson3(inst) + + js = inst.as_json() + self.assertEqual("RelatedPerson", js["resourceType"]) + inst2 = relatedperson.RelatedPerson(js) + self.implRelatedPerson3(inst2) + + def implRelatedPerson3(self, inst): + self.assertTrue(inst.active) + self.assertEqual(inst.address[0].city, "Paris") + self.assertEqual(inst.address[0].country, "FRA") + self.assertEqual(inst.address[0].line[0], "43, Place du Marché Sainte Catherine") + self.assertEqual(inst.address[0].postalCode, "75004") + self.assertEqual(inst.gender, "female") + self.assertEqual(inst.id, "benedicte") + self.assertEqual(inst.identifier[0].system, "urn:oid:1.2.250.1.61") + 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.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.telecom[0].system, "phone") + self.assertEqual(inst.telecom[0].value, "+33 (237) 998327") + self.assertEqual(inst.text.status, "generated") + + def testRelatedPerson4(self): + inst = self.instantiate_from("relatedperson-example-f002-ariadne.json") + self.assertIsNotNone(inst, "Must have instantiated a RelatedPerson instance") + self.implRelatedPerson4(inst) + + js = inst.as_json() + self.assertEqual("RelatedPerson", js["resourceType"]) + inst2 = relatedperson.RelatedPerson(js) + self.implRelatedPerson4(inst2) + + def implRelatedPerson4(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.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.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/STU3/requestgroup.py b/fhirclient/models/STU3/requestgroup.py new file mode 100644 index 000000000..3442c709a --- /dev/null +++ b/fhirclient/models/STU3/requestgroup.py @@ -0,0 +1,392 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/RequestGroup) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class RequestGroup(domainresource.DomainResource): + """ A group of related requests. + + A group of related requests that can be used to capture intended activities + that have inter-dependencies such as "give this medication after that one". + """ + + resource_type = "RequestGroup" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Proposed actions, if any. + List of `RequestGroupAction` items (represented as `dict` in JSON). """ + + self.author = None + """ Device or practitioner that authored the request group. + Type `FHIRReference` referencing `Device, Practitioner` (represented as `dict` in JSON). """ + + self.authoredOn = None + """ When the request group was authored. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.basedOn = None + """ Fulfills plan, proposal, or order. + List of `FHIRReference` items referencing `Resource` (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.definition = None + """ Instantiates protocol or definition. + List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + + 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 + """ Additional notes about the response. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.priority = None + """ routine | urgent | asap | stat. + Type `str`. """ + + self.reasonCodeableConcept = None + """ Reason for the request group. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.reasonReference = None + """ Reason for the request group. + Type `FHIRReference` referencing `Resource` (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). """ + + self.status = None + """ draft | active | suspended | cancelled | completed | entered-in- + error | unknown. + Type `str`. """ + + self.subject = None + """ Who the request group is about. + Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ + + super(RequestGroup, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(RequestGroup, self).elementProperties() + js.extend([ + ("action", "action", RequestGroupAction, True, None, False), + ("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), + ("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), + ("priority", "priority", str, False, None, False), + ("reasonCodeableConcept", "reasonCodeableConcept", codeableconcept.CodeableConcept, False, "reason", False), + ("reasonReference", "reasonReference", fhirreference.FHIRReference, False, "reason", False), + ("replaces", "replaces", fhirreference.FHIRReference, True, None, False), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +from . import backboneelement + +class RequestGroupAction(backboneelement.BackboneElement): + """ Proposed actions, if any. + + The actions, if any, produced by the evaluation of the artifact. + """ + + resource_type = "RequestGroupAction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Sub action. + List of `RequestGroupAction` items (represented as `dict` in JSON). """ + + self.cardinalityBehavior = None + """ single | multiple. + Type `str`. """ + + self.code = None + """ Code representing the meaning of the action or sub-actions. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.condition = None + """ Whether or not the action is applicable. + List of `RequestGroupActionCondition` items (represented as `dict` in JSON). """ + + self.description = None + """ Short description of the action. + Type `str`. """ + + self.documentation = None + """ Supporting documentation for the intended performer of the action. + List of `RelatedArtifact` items (represented as `dict` in JSON). """ + + self.groupingBehavior = None + """ 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). """ + + self.precheckBehavior = None + """ yes | no. + Type `str`. """ + + self.relatedAction = None + """ Relationship to another action. + List of `RequestGroupActionRelatedAction` items (represented as `dict` in JSON). """ + + self.requiredBehavior = None + """ must | could | must-unless-documented. + Type `str`. """ + + self.resource = None + """ The target of the action. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.selectionBehavior = None + """ any | all | all-or-none | exactly-one | at-most-one | one-or-more. + Type `str`. """ + + self.textEquivalent = None + """ Static text equivalent of the action, used if the dynamic aspects + cannot be interpreted by the receiving system. + Type `str`. """ + + self.timingDateTime = None + """ When the action should take place. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.timingDuration = None + """ When the action should take place. + Type `Duration` (represented as `dict` in JSON). """ + + self.timingPeriod = None + """ When the action should take place. + Type `Period` (represented as `dict` in JSON). """ + + self.timingRange = None + """ When the action should take place. + Type `Range` (represented as `dict` in JSON). """ + + self.timingTiming = None + """ When the action should take place. + Type `Timing` (represented as `dict` in JSON). """ + + self.title = None + """ User-visible title. + Type `str`. """ + + self.type = None + """ create | update | remove | fire-event. + Type `Coding` (represented as `dict` in JSON). """ + + super(RequestGroupAction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(RequestGroupAction, self).elementProperties() + js.extend([ + ("action", "action", RequestGroupAction, True, None, False), + ("cardinalityBehavior", "cardinalityBehavior", str, False, None, False), + ("code", "code", codeableconcept.CodeableConcept, True, None, False), + ("condition", "condition", RequestGroupActionCondition, True, None, False), + ("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), + ("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), + ("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), + ]) + return js + + +class RequestGroupActionCondition(backboneelement.BackboneElement): + """ Whether or not the action is applicable. + + An expression that describes applicability criteria, or start/stop + conditions for the action. + """ + + resource_type = "RequestGroupActionCondition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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.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), + ("kind", "kind", str, False, None, True), + ("language", "language", str, False, None, False), + ]) + return js + + +class RequestGroupActionRelatedAction(backboneelement.BackboneElement): + """ Relationship to another action. + + A relationship to another action such as "before" or "30-60 minutes after + start of". + """ + + resource_type = "RequestGroupActionRelatedAction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.actionId = None + """ What action this is related to. + Type `str`. """ + + self.offsetDuration = None + """ Time offset for the relationship. + Type `Duration` (represented as `dict` in JSON). """ + + self.offsetRange = None + """ Time offset for the relationship. + Type `Range` (represented as `dict` in JSON). """ + + self.relationship = None + """ before-start | before | before-end | concurrent-with-start | + concurrent | concurrent-with-end | after-start | after | after-end. + Type `str`. """ + + super(RequestGroupActionRelatedAction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(RequestGroupActionRelatedAction, self).elementProperties() + js.extend([ + ("actionId", "actionId", str, False, None, True), + ("offsetDuration", "offsetDuration", duration.Duration, False, "offset", False), + ("offsetRange", "offsetRange", range.Range, False, "offset", False), + ("relationship", "relationship", 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 coding +except ImportError: + coding = sys.modules[__package__ + '.coding'] +try: + from . import duration +except ImportError: + duration = sys.modules[__package__ + '.duration'] +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 range +except ImportError: + range = sys.modules[__package__ + '.range'] +try: + from . import relatedartifact +except ImportError: + relatedartifact = sys.modules[__package__ + '.relatedartifact'] +try: + from . import timing +except ImportError: + timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/STU3/requestgroup_tests.py b/fhirclient/models/STU3/requestgroup_tests.py new file mode 100644 index 000000000..d13061182 --- /dev/null +++ b/fhirclient/models/STU3/requestgroup_tests.py @@ -0,0 +1,117 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import requestgroup +from .fhirdate import FHIRDate + + +class RequestGroupTests(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("RequestGroup", js["resourceType"]) + return requestgroup.RequestGroup(js) + + def testRequestGroup1(self): + inst = self.instantiate_from("requestgroup-kdn5-example.json") + self.assertIsNotNone(inst, "Must have instantiated a RequestGroup instance") + self.implRequestGroup1(inst) + + js = inst.as_json() + self.assertEqual("RequestGroup", js["resourceType"]) + inst2 = requestgroup.RequestGroup(js) + self.implRequestGroup1(inst2) + + def implRequestGroup1(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") + self.assertEqual(inst.action[0].action[0].action[0].action[0].action[0].extension[0].extension[1].valueInteger, 8) + 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].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") + self.assertEqual(inst.action[0].action[0].action[0].action[0].action[1].id, "action-2") + self.assertEqual(inst.action[0].action[0].action[0].action[0].action[1].relatedAction[0].actionId, "action-1") + self.assertEqual(inst.action[0].action[0].action[0].action[0].action[1].relatedAction[0].relationship, "concurrent-with-start") + self.assertEqual(inst.action[0].action[0].action[0].action[0].action[1].textEquivalent, "CARBOplatin AUC 5 IV over 30 minutes on Day 1") + self.assertEqual(inst.action[0].action[0].action[0].action[0].id, "cycle-definition-1") + self.assertEqual(inst.action[0].action[0].action[0].action[0].textEquivalent, "21-day cycle for 6 cycles") + self.assertEqual(inst.action[0].action[0].action[0].action[0].timingTiming.repeat.count, 6) + self.assertEqual(inst.action[0].action[0].action[0].action[0].timingTiming.repeat.duration, 21) + self.assertEqual(inst.action[0].action[0].action[0].action[0].timingTiming.repeat.durationUnit, "d") + self.assertEqual(inst.action[0].action[0].action[0].groupingBehavior, "sentence-group") + self.assertEqual(inst.action[0].action[0].action[0].selectionBehavior, "exactly-one") + self.assertEqual(inst.action[0].action[0].selectionBehavior, "all") + self.assertEqual(inst.action[0].selectionBehavior, "exactly-one") + 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, "1111") + self.assertEqual(inst.contained[1].id, "2222") + self.assertEqual(inst.id, "kdn5-example") + self.assertEqual(inst.identifier[0].value, "requestgroup-kdn5") + self.assertEqual(inst.intent, "plan") + 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.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") + diff --git a/fhirclient/models/STU3/researchstudy.py b/fhirclient/models/STU3/researchstudy.py new file mode 100644 index 000000000..1d170ad25 --- /dev/null +++ b/fhirclient/models/STU3/researchstudy.py @@ -0,0 +1,213 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ResearchStudy) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class ResearchStudy(domainresource.DomainResource): + """ Investigation to increase healthcare-related patient-independent knowledge. + + 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. + """ + + resource_type = "ResearchStudy" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.arm = None + """ Defined path through the study for a subject. + List of `ResearchStudyArm` items (represented as `dict` in JSON). """ + + self.category = None + """ Classifications for the study. + 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). """ + + self.description = None + """ What this is study doing. + Type `str`. """ + + self.enrollment = None + """ Inclusion & exclusion criteria. + List of `FHIRReference` items referencing `Group` (represented as `dict` in JSON). """ + + self.focus = None + """ Drugs, devices, conditions, 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.note = None + """ Comments made about the event. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.partOf = None + """ Part of larger study. + List of `FHIRReference` items referencing `ResearchStudy` (represented as `dict` in JSON). """ + + self.period = None + """ When the study began and ended. + Type `Period` (represented as `dict` in JSON). """ + + self.principalInvestigator = None + """ The individual responsible for the study. + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + self.protocol = None + """ Steps followed in executing study. + List of `FHIRReference` items referencing `PlanDefinition` (represented as `dict` in JSON). """ + + self.reasonStopped = None + """ Reason for terminating study early. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.relatedArtifact = None + """ References and dependencies. + 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). """ + + self.sponsor = None + """ Organization responsible for the study. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.status = None + """ draft | in-progress | suspended | stopped | completed | entered-in- + error. + Type `str`. """ + + self.title = None + """ Name for this study. + Type `str`. """ + + super(ResearchStudy, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ResearchStudy, self).elementProperties() + js.extend([ + ("arm", "arm", ResearchStudyArm, True, None, False), + ("category", "category", 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), + ("note", "note", annotation.Annotation, True, None, False), + ("partOf", "partOf", fhirreference.FHIRReference, True, None, False), + ("period", "period", period.Period, False, None, False), + ("principalInvestigator", "principalInvestigator", fhirreference.FHIRReference, False, None, False), + ("protocol", "protocol", fhirreference.FHIRReference, True, None, False), + ("reasonStopped", "reasonStopped", codeableconcept.CodeableConcept, False, None, False), + ("relatedArtifact", "relatedArtifact", relatedartifact.RelatedArtifact, True, None, False), + ("site", "site", fhirreference.FHIRReference, True, None, False), + ("sponsor", "sponsor", fhirreference.FHIRReference, False, None, False), + ("status", "status", str, False, None, True), + ("title", "title", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class ResearchStudyArm(backboneelement.BackboneElement): + """ Defined path through the study for a subject. + + Describes an expected sequence of events for one of the participants of a + study. E.g. Exposure to drug A, wash-out, exposure to drug B, wash-out, + follow-up. + """ + + resource_type = "ResearchStudyArm" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Categorization of study arm. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.description = None + """ Short explanation of study path. + Type `str`. """ + + self.name = None + """ Label for study arm. + Type `str`. """ + + 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), + ]) + 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 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'] diff --git a/fhirclient/models/STU3/researchstudy_tests.py b/fhirclient/models/STU3/researchstudy_tests.py new file mode 100644 index 000000000..0c3108ace --- /dev/null +++ b/fhirclient/models/STU3/researchstudy_tests.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import researchstudy +from .fhirdate import FHIRDate + + +class ResearchStudyTests(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("ResearchStudy", js["resourceType"]) + return researchstudy.ResearchStudy(js) + + def testResearchStudy1(self): + inst = self.instantiate_from("researchstudy-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ResearchStudy instance") + self.implResearchStudy1(inst) + + js = inst.as_json() + self.assertEqual("ResearchStudy", js["resourceType"]) + inst2 = researchstudy.ResearchStudy(js) + self.implResearchStudy1(inst2) + + def implResearchStudy1(self, inst): + self.assertEqual(inst.id, "example") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.div, "
[Put rendering here]
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/STU3/researchsubject.py b/fhirclient/models/STU3/researchsubject.py new file mode 100644 index 000000000..08181d030 --- /dev/null +++ b/fhirclient/models/STU3/researchsubject.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ResearchSubject) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class ResearchSubject(domainresource.DomainResource): + """ Investigation to increase healthcare-related patient-independent knowledge. + + 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. + """ + + resource_type = "ResearchSubject" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.actualArm = None + """ What path was followed. + Type `str`. """ + + self.assignedArm = None + """ What path should be followed. + Type `str`. """ + + self.consent = None + """ Agreement to participate in study. + Type `FHIRReference` referencing `Consent` (represented as `dict` in JSON). """ + + self.identifier = None + """ Business Identifier for research subject. + Type `Identifier` (represented as `dict` in JSON). """ + + self.individual = None + """ Who is part of study. + Type `FHIRReference` referencing `Patient` (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. + Type `str`. """ + + self.study = None + """ Study subject is part of. + Type `FHIRReference` referencing `ResearchStudy` (represented as `dict` in JSON). """ + + super(ResearchSubject, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ResearchSubject, self).elementProperties() + js.extend([ + ("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), + ("individual", "individual", fhirreference.FHIRReference, False, None, True), + ("period", "period", period.Period, False, None, False), + ("status", "status", str, False, None, True), + ("study", "study", fhirreference.FHIRReference, False, None, True), + ]) + return js + + +import sys +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/STU3/researchsubject_tests.py b/fhirclient/models/STU3/researchsubject_tests.py new file mode 100644 index 000000000..814c2b83b --- /dev/null +++ b/fhirclient/models/STU3/researchsubject_tests.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import researchsubject +from .fhirdate import FHIRDate + + +class ResearchSubjectTests(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("ResearchSubject", js["resourceType"]) + return researchsubject.ResearchSubject(js) + + def testResearchSubject1(self): + inst = self.instantiate_from("researchsubject-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ResearchSubject instance") + self.implResearchSubject1(inst) + + js = inst.as_json() + self.assertEqual("ResearchSubject", js["resourceType"]) + inst2 = researchsubject.ResearchSubject(js) + self.implResearchSubject1(inst2) + + 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.status, "candidate") + self.assertEqual(inst.text.div, "
[Put rendering here]
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/STU3/resource.py b/fhirclient/models/STU3/resource.py new file mode 100644 index 000000000..de9eb56ac --- /dev/null +++ b/fhirclient/models/STU3/resource.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Resource) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import fhirabstractresource + +class Resource(fhirabstractresource.FHIRAbstractResource): + """ Base Resource. + + This is the base resource type for everything. + """ + + resource_type = "Resource" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.id = None + """ Logical id of this artifact. + Type `str`. """ + + self.implicitRules = None + """ A set of rules under which this content was created. + Type `str`. """ + + self.language = None + """ Language of the resource content. + Type `str`. """ + + self.meta = None + """ Metadata about the resource. + Type `Meta` (represented as `dict` in JSON). """ + + super(Resource, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Resource, self).elementProperties() + js.extend([ + ("id", "id", str, False, None, False), + ("implicitRules", "implicitRules", str, False, None, False), + ("language", "language", str, False, None, False), + ("meta", "meta", meta.Meta, False, None, False), + ]) + return js + + +import sys +try: + from . import meta +except ImportError: + meta = sys.modules[__package__ + '.meta'] diff --git a/fhirclient/models/STU3/riskassessment.py b/fhirclient/models/STU3/riskassessment.py new file mode 100644 index 000000000..2d069eca4 --- /dev/null +++ b/fhirclient/models/STU3/riskassessment.py @@ -0,0 +1,217 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/RiskAssessment) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class RiskAssessment(domainresource.DomainResource): + """ Potential outcomes for a subject with likelihood. + + An assessment of the likely outcome(s) for a patient or other subject as + well as the likelihood of each outcome. + """ + + resource_type = "RiskAssessment" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.basedOn = None + """ Request fulfilled by this assessment. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.basis = None + """ Information used in assessment. + List of `FHIRReference` items referencing `Resource` (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). """ + + self.context = None + """ Where was assessment performed?. + Type `FHIRReference` referencing `Encounter, EpisodeOfCare` (represented as `dict` in JSON). """ + + self.identifier = None + """ Unique identifier for the assessment. + Type `Identifier` (represented as `dict` in JSON). """ + + self.method = None + """ Evaluation mechanism. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.mitigation = None + """ How to reduce risk. + Type `str`. """ + + self.occurrenceDateTime = None + """ When was assessment made?. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.occurrencePeriod = None + """ When was assessment made?. + Type `Period` (represented as `dict` in JSON). """ + + self.parent = None + """ Part of this occurrence. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.performer = None + """ Who did assessment?. + Type `FHIRReference` referencing `Practitioner, Device` (represented as `dict` in JSON). """ + + self.prediction = None + """ Outcome predicted. + List of `RiskAssessmentPrediction` items (represented as `dict` in JSON). """ + + self.reasonCodeableConcept = None + """ Why the assessment was necessary?. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.reasonReference = None + """ Why the assessment was necessary?. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.status = None + """ registered | preliminary | final | amended +. + Type `str`. """ + + self.subject = None + """ Who/what does assessment apply to?. + Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ + + super(RiskAssessment, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(RiskAssessment, self).elementProperties() + js.extend([ + ("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), + ("method", "method", codeableconcept.CodeableConcept, False, None, False), + ("mitigation", "mitigation", str, False, 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), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +from . import backboneelement + +class RiskAssessmentPrediction(backboneelement.BackboneElement): + """ Outcome predicted. + + Describes the expected outcome for the subject. + """ + + resource_type = "RiskAssessmentPrediction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.outcome = None + """ Possible outcome for the subject. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.probabilityDecimal = None + """ Likelihood of specified outcome. + Type `float`. """ + + self.probabilityRange = None + """ Likelihood of specified outcome. + Type `Range` (represented as `dict` in JSON). """ + + self.qualitativeRisk = None + """ Likelihood of specified outcome as a qualitative value. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.rationale = None + """ Explanation of prediction. + Type `str`. """ + + self.relativeRisk = None + """ Relative likelihood. + Type `float`. """ + + self.whenPeriod = None + """ Timeframe or age range. + Type `Period` (represented as `dict` in JSON). """ + + self.whenRange = None + """ Timeframe or age range. + Type `Range` (represented as `dict` in JSON). """ + + super(RiskAssessmentPrediction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(RiskAssessmentPrediction, self).elementProperties() + js.extend([ + ("outcome", "outcome", codeableconcept.CodeableConcept, False, None, True), + ("probabilityDecimal", "probabilityDecimal", float, False, "probability", False), + ("probabilityRange", "probabilityRange", range.Range, False, "probability", False), + ("qualitativeRisk", "qualitativeRisk", codeableconcept.CodeableConcept, False, None, False), + ("rationale", "rationale", str, False, None, False), + ("relativeRisk", "relativeRisk", float, False, None, False), + ("whenPeriod", "whenPeriod", period.Period, False, "when", False), + ("whenRange", "whenRange", range.Range, False, "when", 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'] +try: + from . import range +except ImportError: + range = sys.modules[__package__ + '.range'] diff --git a/fhirclient/models/STU3/riskassessment_tests.py b/fhirclient/models/STU3/riskassessment_tests.py new file mode 100644 index 000000000..49cd52c24 --- /dev/null +++ b/fhirclient/models/STU3/riskassessment_tests.py @@ -0,0 +1,186 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import riskassessment +from .fhirdate import FHIRDate + + +class RiskAssessmentTests(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("RiskAssessment", js["resourceType"]) + return riskassessment.RiskAssessment(js) + + def testRiskAssessment1(self): + inst = self.instantiate_from("riskassessment-example-population.json") + self.assertIsNotNone(inst, "Must have instantiated a RiskAssessment instance") + self.implRiskAssessment1(inst) + + js = inst.as_json() + self.assertEqual("RiskAssessment", js["resourceType"]) + inst2 = riskassessment.RiskAssessment(js) + self.implRiskAssessment1(inst2) + + def implRiskAssessment1(self, inst): + self.assertEqual(inst.id, "population") + 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.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") + self.assertEqual(inst.prediction[0].probabilityDecimal, 0.02) + self.assertEqual(inst.prediction[0].whenRange.high.code, "a") + self.assertEqual(inst.prediction[0].whenRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[0].whenRange.high.unit, "years") + self.assertEqual(inst.prediction[0].whenRange.high.value, 49) + self.assertEqual(inst.prediction[0].whenRange.low.code, "a") + self.assertEqual(inst.prediction[0].whenRange.low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[0].whenRange.low.unit, "years") + self.assertEqual(inst.prediction[0].whenRange.low.value, 39) + self.assertEqual(inst.status, "final") + self.assertEqual(inst.text.status, "additional") + + def testRiskAssessment3(self): + inst = self.instantiate_from("riskassessment-example.json") + self.assertIsNotNone(inst, "Must have instantiated a RiskAssessment instance") + self.implRiskAssessment3(inst) + + js = inst.as_json() + self.assertEqual("RiskAssessment", js["resourceType"]) + inst2 = riskassessment.RiskAssessment(js) + self.implRiskAssessment3(inst2) + + def implRiskAssessment3(self, inst): + self.assertEqual(inst.comment, "High degree of certainty") + self.assertEqual(inst.id, "genetic") + self.assertEqual(inst.method.coding[0].code, "BRCAPRO") + 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") + self.assertEqual(inst.prediction[0].probabilityDecimal, 0.000168) + self.assertEqual(inst.prediction[0].whenRange.high.code, "a") + self.assertEqual(inst.prediction[0].whenRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[0].whenRange.high.unit, "years") + self.assertEqual(inst.prediction[0].whenRange.high.value, 53) + self.assertEqual(inst.prediction[1].outcome.text, "Breast Cancer") + self.assertEqual(inst.prediction[1].probabilityDecimal, 0.000368) + self.assertEqual(inst.prediction[1].whenRange.high.code, "a") + self.assertEqual(inst.prediction[1].whenRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[1].whenRange.high.unit, "years") + self.assertEqual(inst.prediction[1].whenRange.high.value, 57) + self.assertEqual(inst.prediction[1].whenRange.low.code, "a") + self.assertEqual(inst.prediction[1].whenRange.low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[1].whenRange.low.unit, "years") + self.assertEqual(inst.prediction[1].whenRange.low.value, 54) + self.assertEqual(inst.prediction[2].outcome.text, "Breast Cancer") + self.assertEqual(inst.prediction[2].probabilityDecimal, 0.000594) + self.assertEqual(inst.prediction[2].whenRange.high.code, "a") + self.assertEqual(inst.prediction[2].whenRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[2].whenRange.high.unit, "years") + self.assertEqual(inst.prediction[2].whenRange.high.value, 62) + self.assertEqual(inst.prediction[2].whenRange.low.code, "a") + self.assertEqual(inst.prediction[2].whenRange.low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[2].whenRange.low.unit, "years") + self.assertEqual(inst.prediction[2].whenRange.low.value, 58) + self.assertEqual(inst.prediction[3].outcome.text, "Breast Cancer") + self.assertEqual(inst.prediction[3].probabilityDecimal, 0.000838) + self.assertEqual(inst.prediction[3].whenRange.high.code, "a") + self.assertEqual(inst.prediction[3].whenRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[3].whenRange.high.unit, "years") + self.assertEqual(inst.prediction[3].whenRange.high.value, 67) + self.assertEqual(inst.prediction[3].whenRange.low.code, "a") + self.assertEqual(inst.prediction[3].whenRange.low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[3].whenRange.low.unit, "years") + self.assertEqual(inst.prediction[3].whenRange.low.value, 63) + self.assertEqual(inst.prediction[4].outcome.text, "Breast Cancer") + self.assertEqual(inst.prediction[4].probabilityDecimal, 0.001089) + self.assertEqual(inst.prediction[4].whenRange.high.code, "a") + self.assertEqual(inst.prediction[4].whenRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[4].whenRange.high.unit, "years") + self.assertEqual(inst.prediction[4].whenRange.high.value, 72) + self.assertEqual(inst.prediction[4].whenRange.low.code, "a") + self.assertEqual(inst.prediction[4].whenRange.low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[4].whenRange.low.unit, "years") + self.assertEqual(inst.prediction[4].whenRange.low.value, 68) + self.assertEqual(inst.prediction[5].outcome.text, "Breast Cancer") + self.assertEqual(inst.prediction[5].probabilityDecimal, 0.001327) + self.assertEqual(inst.prediction[5].whenRange.high.code, "a") + self.assertEqual(inst.prediction[5].whenRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[5].whenRange.high.unit, "years") + self.assertEqual(inst.prediction[5].whenRange.high.value, 77) + self.assertEqual(inst.prediction[5].whenRange.low.code, "a") + self.assertEqual(inst.prediction[5].whenRange.low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[5].whenRange.low.unit, "years") + self.assertEqual(inst.prediction[5].whenRange.low.value, 73) + self.assertEqual(inst.prediction[6].outcome.text, "Breast Cancer") + self.assertEqual(inst.prediction[6].probabilityDecimal, 0.00153) + self.assertEqual(inst.prediction[6].whenRange.high.code, "a") + self.assertEqual(inst.prediction[6].whenRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[6].whenRange.high.unit, "years") + self.assertEqual(inst.prediction[6].whenRange.high.value, 82) + self.assertEqual(inst.prediction[6].whenRange.low.code, "a") + self.assertEqual(inst.prediction[6].whenRange.low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[6].whenRange.low.unit, "years") + self.assertEqual(inst.prediction[6].whenRange.low.value, 78) + self.assertEqual(inst.prediction[7].outcome.text, "Breast Cancer") + self.assertEqual(inst.prediction[7].probabilityDecimal, 0.001663) + self.assertEqual(inst.prediction[7].whenRange.high.code, "a") + self.assertEqual(inst.prediction[7].whenRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[7].whenRange.high.unit, "years") + self.assertEqual(inst.prediction[7].whenRange.high.value, 88) + self.assertEqual(inst.prediction[7].whenRange.low.code, "a") + self.assertEqual(inst.prediction[7].whenRange.low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.prediction[7].whenRange.low.unit, "years") + 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-prognosis.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.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") + diff --git a/fhirclient/models/STU3/sampleddata.py b/fhirclient/models/STU3/sampleddata.py new file mode 100644 index 000000000..751cdfb38 --- /dev/null +++ b/fhirclient/models/STU3/sampleddata.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/SampledData) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class SampledData(element.Element): + """ A series of measurements taken by a device. + + A series of measurements taken by a device, with upper and lower limits. + There may be more than one dimension in the data. + """ + + resource_type = "SampledData" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.data = None + """ Decimal values with spaces, or "E" | "U" | "L". + Type `str`. """ + + self.dimensions = None + """ Number of sample points at each time point. + Type `int`. """ + + self.factor = None + """ Multiply data by this before adding to origin. + Type `float`. """ + + self.lowerLimit = None + """ Lower limit of detection. + Type `float`. """ + + self.origin = None + """ Zero value and units. + Type `Quantity` (represented as `dict` in JSON). """ + + self.period = None + """ Number of milliseconds between samples. + Type `float`. """ + + self.upperLimit = None + """ Upper limit of detection. + Type `float`. """ + + super(SampledData, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SampledData, self).elementProperties() + js.extend([ + ("data", "data", str, False, None, True), + ("dimensions", "dimensions", int, False, None, True), + ("factor", "factor", float, False, None, False), + ("lowerLimit", "lowerLimit", float, False, None, False), + ("origin", "origin", quantity.Quantity, False, None, True), + ("period", "period", float, False, None, True), + ("upperLimit", "upperLimit", float, False, None, False), + ]) + return js + + +import sys +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/STU3/schedule.py b/fhirclient/models/STU3/schedule.py new file mode 100644 index 000000000..43128668e --- /dev/null +++ b/fhirclient/models/STU3/schedule.py @@ -0,0 +1,101 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Schedule) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Schedule(domainresource.DomainResource): + """ A container for slots of time that may be available for booking + appointments. + """ + + resource_type = "Schedule" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 schedule is in active use. + 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). """ + + self.comment = None + """ Comments on the availability to describe any extended information. + Such as custom constraints on the slots that may be associated. + Type `str`. """ + + self.identifier = None + """ External Ids for this item. + 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. + 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). """ + + self.serviceType = None + """ The specific service that is to be performed during this + appointment. + 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. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(Schedule, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Schedule, self).elementProperties() + js.extend([ + ("active", "active", bool, False, None, False), + ("actor", "actor", fhirreference.FHIRReference, True, None, True), + ("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), + ("serviceType", "serviceType", codeableconcept.CodeableConcept, True, None, False), + ("specialty", "specialty", codeableconcept.CodeableConcept, 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 period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/STU3/schedule_tests.py b/fhirclient/models/STU3/schedule_tests.py new file mode 100644 index 000000000..29e79b6ea --- /dev/null +++ b/fhirclient/models/STU3/schedule_tests.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import schedule +from .fhirdate import FHIRDate + + +class ScheduleTests(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("Schedule", js["resourceType"]) + return schedule.Schedule(js) + + def testSchedule1(self): + inst = self.instantiate_from("schedule-provider-location1-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Schedule instance") + self.implSchedule1(inst) + + js = inst.as_json() + self.assertEqual("Schedule", js["resourceType"]) + inst2 = schedule.Schedule(js) + self.implSchedule1(inst2) + + def implSchedule1(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.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.text.status, "generated") + + def testSchedule2(self): + inst = self.instantiate_from("schedule-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Schedule instance") + self.implSchedule2(inst) + + js = inst.as_json() + self.assertEqual("Schedule", js["resourceType"]) + inst2 = schedule.Schedule(js) + self.implSchedule2(inst2) + + def implSchedule2(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.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.text.status, "generated") + + def testSchedule3(self): + inst = self.instantiate_from("schedule-provider-location2-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Schedule instance") + self.implSchedule3(inst) + + js = inst.as_json() + self.assertEqual("Schedule", js["resourceType"]) + inst2 = schedule.Schedule(js) + self.implSchedule3(inst2) + + def implSchedule3(self, inst): + self.assertTrue(inst.active) + self.assertEqual(inst.comment, "The slots attached to this schedule are for neurosurgery operations at Starfleet HQ only.") + self.assertEqual(inst.id, "exampleloc2") + 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.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.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") + self.assertEqual(inst.specialty[0].coding[0].display, "Surgery-Neurosurgery") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/STU3/searchparameter.py b/fhirclient/models/STU3/searchparameter.py new file mode 100644 index 000000000..d4dee9719 --- /dev/null +++ b/fhirclient/models/STU3/searchparameter.py @@ -0,0 +1,215 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/SearchParameter) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class SearchParameter(domainresource.DomainResource): + """ Search Parameter for a resource. + + A search parameter that defines a named search item that can be used to + search/filter on a resource. + """ + + resource_type = "SearchParameter" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.base = None + """ The resource type(s) this search parameter applies to. + List of `str` items. """ + + self.chain = None + """ Chained names supported. + List of `str` items. """ + + self.code = None + """ Code used in URL. + Type `str`. """ + + self.comparator = None + """ eq | ne | gt | lt | ge | le | sa | eb | ap. + List of `str` items. """ + + self.component = None + """ For Composite resources to define the parts. + List of `SearchParameterComponent` items (represented as `dict` in JSON). """ + + 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.derivedFrom = None + """ Original Definition for the search parameter. + Type `str`. """ + + self.description = None + """ Natural language description of the search parameter. + Type `str`. """ + + self.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.expression = None + """ FHIRPath expression that extracts the values. + Type `str`. """ + + self.jurisdiction = None + """ Intended jurisdiction for search parameter (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.modifier = None + """ missing | exact | contains | not | text | in | not-in | below | + above | type. + List of `str` items. """ + + self.name = None + """ Name for this search parameter (computer friendly). + Type `str`. """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this search parameter is defined. + Type `str`. """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.target = None + """ Types of resource (if a resource reference). + List of `str` items. """ + + self.type = None + """ number | date | string | token | reference | composite | quantity | + uri. + Type `str`. """ + + self.url = None + """ Logical URI to reference this search parameter (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 search parameter. + Type `str`. """ + + self.xpath = None + """ XPath that extracts the values. + Type `str`. """ + + self.xpathUsage = None + """ normal | phonetic | nearby | distance | other. + Type `str`. """ + + super(SearchParameter, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SearchParameter, self).elementProperties() + js.extend([ + ("base", "base", str, True, None, True), + ("chain", "chain", str, True, None, False), + ("code", "code", str, False, None, True), + ("comparator", "comparator", str, True, None, False), + ("component", "component", SearchParameterComponent, True, None, False), + ("contact", "contact", contactdetail.ContactDetail, True, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("derivedFrom", "derivedFrom", str, False, None, False), + ("description", "description", str, False, None, True), + ("experimental", "experimental", bool, False, None, False), + ("expression", "expression", str, False, None, False), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("modifier", "modifier", str, True, None, False), + ("name", "name", str, False, None, True), + ("publisher", "publisher", str, False, None, False), + ("purpose", "purpose", str, False, None, False), + ("status", "status", str, False, None, True), + ("target", "target", str, True, None, False), + ("type", "type", str, False, None, True), + ("url", "url", str, False, None, True), + ("useContext", "useContext", usagecontext.UsageContext, True, None, False), + ("version", "version", str, False, None, False), + ("xpath", "xpath", str, False, None, False), + ("xpathUsage", "xpathUsage", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class SearchParameterComponent(backboneelement.BackboneElement): + """ For Composite resources to define the parts. + + Used to define the parts of a composite search parameter. + """ + + resource_type = "SearchParameterComponent" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Defines how the part works. + Type `FHIRReference` referencing `SearchParameter` (represented as `dict` in JSON). """ + + self.expression = None + """ Subexpression relative to main expression. + Type `str`. """ + + super(SearchParameterComponent, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SearchParameterComponent, self).elementProperties() + js.extend([ + ("definition", "definition", fhirreference.FHIRReference, False, None, True), + ("expression", "expression", 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 usagecontext +except ImportError: + usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/STU3/searchparameter_tests.py b/fhirclient/models/STU3/searchparameter_tests.py new file mode 100644 index 000000000..73859ff18 --- /dev/null +++ b/fhirclient/models/STU3/searchparameter_tests.py @@ -0,0 +1,129 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import searchparameter +from .fhirdate import FHIRDate + + +class SearchParameterTests(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("SearchParameter", js["resourceType"]) + return searchparameter.SearchParameter(js) + + def testSearchParameter1(self): + inst = self.instantiate_from("searchparameter-example-extension.json") + self.assertIsNotNone(inst, "Must have instantiated a SearchParameter instance") + self.implSearchParameter1(inst) + + js = inst.as_json() + self.assertEqual("SearchParameter", js["resourceType"]) + inst2 = searchparameter.SearchParameter(js) + self.implSearchParameter1(inst2) + + def implSearchParameter1(self, inst): + self.assertEqual(inst.base[0], "Patient") + self.assertEqual(inst.code, "part-agree") + self.assertEqual(inst.contact[0].telecom[0].system, "url") + self.assertEqual(inst.contact[0].telecom[0].value, "http://hl7.org/fhir") + self.assertEqual(inst.description, "Search by url for a participation agreement, which is stored in a DocumentReference") + self.assertTrue(inst.experimental) + self.assertEqual(inst.expression, "DocumentReference.extension('http://example.org/fhir/StructureDefinition/participation-agreement')") + self.assertEqual(inst.id, "example-extension") + self.assertEqual(inst.name, "Example Search Parameter on an extension") + self.assertEqual(inst.publisher, "Health Level Seven International (FHIR Infrastructure)") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.target[0], "DocumentReference") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type, "reference") + self.assertEqual(inst.url, "http://hl7.org/fhir/SearchParameter/example-extension") + self.assertEqual(inst.xpath, "f:DocumentReference/f:extension[@url='http://example.org/fhir/StructureDefinition/participation-agreement']") + self.assertEqual(inst.xpathUsage, "normal") + + def testSearchParameter2(self): + inst = self.instantiate_from("searchparameter-example-reference.json") + self.assertIsNotNone(inst, "Must have instantiated a SearchParameter instance") + self.implSearchParameter2(inst) + + js = inst.as_json() + self.assertEqual("SearchParameter", js["resourceType"]) + inst2 = searchparameter.SearchParameter(js) + self.implSearchParameter2(inst2) + + def implSearchParameter2(self, inst): + self.assertEqual(inst.base[0], "Condition") + self.assertEqual(inst.chain[0], "name") + self.assertEqual(inst.chain[1], "identifier") + self.assertEqual(inst.code, "subject") + self.assertEqual(inst.contact[0].name, "[string]") + 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-10-23").date) + self.assertEqual(inst.date.as_json(), "2013-10-23") + self.assertEqual(inst.description, "Search by condition subject") + self.assertTrue(inst.experimental) + self.assertEqual(inst.expression, "Condition.subject") + self.assertEqual(inst.id, "example-reference") + self.assertEqual(inst.modifier[0], "missing") + self.assertEqual(inst.name, "Example Search Parameter") + self.assertEqual(inst.publisher, "Health Level Seven International (FHIR Infrastructure)") + self.assertEqual(inst.purpose, "Need to search Condition by subject") + self.assertEqual(inst.status, "draft") + 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.xpathUsage, "normal") + + def testSearchParameter3(self): + inst = self.instantiate_from("searchparameter-example.json") + self.assertIsNotNone(inst, "Must have instantiated a SearchParameter instance") + self.implSearchParameter3(inst) + + js = inst.as_json() + self.assertEqual("SearchParameter", js["resourceType"]) + inst2 = searchparameter.SearchParameter(js) + self.implSearchParameter3(inst2) + + def implSearchParameter3(self, inst): + self.assertEqual(inst.base[0], "Resource") + self.assertEqual(inst.code, "_id") + self.assertEqual(inst.comparator[0], "eq") + self.assertEqual(inst.contact[0].name, "[string]") + 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-10-23").date) + self.assertEqual(inst.date.as_json(), "2013-10-23") + self.assertEqual(inst.derivedFrom, "http://hl7.org/fhir/SearchParameter/Resource-id") + self.assertEqual(inst.description, "Search by resource identifier - e.g. same as the read interaction, but can return included resources") + self.assertTrue(inst.experimental) + self.assertEqual(inst.expression, "id") + 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, "ID-SEARCH-PARAMETER") + self.assertEqual(inst.publisher, "Health Level Seven International (FHIR Infrastructure)") + self.assertEqual(inst.purpose, "Need to search by identifier for various infrastructural cases - mainly retrieving packages, and matching as part of a chain") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + 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].valueCodeableConcept.coding[0].code, "positive") + self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].system, "http://hl7.org/fhir/variant-state") + self.assertEqual(inst.version, "1") + self.assertEqual(inst.xpath, "f:*/f:id") + self.assertEqual(inst.xpathUsage, "normal") + diff --git a/fhirclient/models/STU3/sequence.py b/fhirclient/models/STU3/sequence.py new file mode 100644 index 000000000..bff505138 --- /dev/null +++ b/fhirclient/models/STU3/sequence.py @@ -0,0 +1,414 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Sequence) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Sequence(domainresource.DomainResource): + """ Information about a biological sequence. + + Raw data describing a biological sequence. + """ + + resource_type = "Sequence" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.coordinateSystem = None + """ Base number of coordinate system (0 for 0-based numbering or + coordinates, inclusive start, exclusive end, 1 for 1-based + numbering, inclusive start, inclusive end). + Type `int`. """ + + self.device = None + """ The method for sequencing. + Type `FHIRReference` referencing `Device` (represented as `dict` in JSON). """ + + self.identifier = None + """ Unique ID for this particular sequence. This is a FHIR-defined id. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.observedSeq = None + """ Sequence that was observed. + Type `str`. """ + + self.patient = None + """ Who and/or what this is about. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.performer = None + """ Who should be responsible for test result. + Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + + self.pointer = None + """ Pointer to next atomic sequence. + List of `FHIRReference` items referencing `Sequence` (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). """ + + self.quantity = None + """ The number of copies of the seqeunce of interest. (RNASeq). + Type `Quantity` (represented as `dict` in JSON). """ + + self.readCoverage = None + """ Average number of reads representing a given nucleotide in the + reconstructed sequence. + Type `int`. """ + + self.referenceSeq = None + """ A sequence used as reference. + Type `SequenceReferenceSeq` (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). """ + + self.specimen = None + """ Specimen used for sequencing. + Type `FHIRReference` referencing `Specimen` (represented as `dict` in JSON). """ + + self.type = None + """ aa | dna | rna. + Type `str`. """ + + self.variant = None + """ Variant in sequence. + List of `SequenceVariant` items (represented as `dict` in JSON). """ + + super(Sequence, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Sequence, self).elementProperties() + js.extend([ + ("coordinateSystem", "coordinateSystem", int, False, None, True), + ("device", "device", fhirreference.FHIRReference, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("observedSeq", "observedSeq", str, False, None, False), + ("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), + ("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), + ("specimen", "specimen", fhirreference.FHIRReference, False, None, False), + ("type", "type", str, False, None, False), + ("variant", "variant", SequenceVariant, True, None, False), + ]) + return js + + +from . import backboneelement + +class SequenceQuality(backboneelement.BackboneElement): + """ An set of value as quality of sequence. + + An experimental feature attribute that defines the quality of the feature + in a quantitative way, such as a phred quality score ([SO:0001686](http://w + ww.sequenceontology.org/browser/current_svn/term/SO:0001686)). + """ + + resource_type = "SequenceQuality" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ End position of the sequence. + Type `int`. """ + + self.fScore = None + """ F-score. + Type `float`. """ + + self.gtFP = None + """ False positives where the non-REF alleles in the Truth and Query + Call Sets match. + Type `float`. """ + + self.method = None + """ Method to get quality. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.precision = None + """ Precision of comparison. + Type `float`. """ + + self.queryFP = None + """ False positives. + Type `float`. """ + + self.queryTP = None + """ True positives from the perspective of the query data. + Type `float`. """ + + self.recall = None + """ Recall of comparison. + Type `float`. """ + + self.score = None + """ Quality score for the comparison. + Type `Quantity` (represented as `dict` in JSON). """ + + self.standardSequence = None + """ Standard sequence for comparison. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.start = None + """ Start position of the sequence. + Type `int`. """ + + self.truthFN = None + """ False negatives. + Type `float`. """ + + self.truthTP = None + """ True positives from the perspective of the truth data. + Type `float`. """ + + self.type = None + """ indel | snp | unknown. + Type `str`. """ + + super(SequenceQuality, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SequenceQuality, self).elementProperties() + js.extend([ + ("end", "end", int, False, None, False), + ("fScore", "fScore", float, False, None, False), + ("gtFP", "gtFP", float, False, None, False), + ("method", "method", codeableconcept.CodeableConcept, False, None, False), + ("precision", "precision", float, False, None, False), + ("queryFP", "queryFP", float, False, None, False), + ("queryTP", "queryTP", float, False, None, False), + ("recall", "recall", float, False, None, False), + ("score", "score", quantity.Quantity, False, None, False), + ("standardSequence", "standardSequence", codeableconcept.CodeableConcept, False, None, False), + ("start", "start", int, False, None, False), + ("truthFN", "truthFN", float, False, None, False), + ("truthTP", "truthTP", float, False, None, False), + ("type", "type", str, False, None, True), + ]) + return js + + +class SequenceReferenceSeq(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" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.chromosome = None + """ Chromosome containing genetic finding. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.genomeBuild = None + """ The Genome Build used for reference, following GRCh build versions + e.g. 'GRCh 37'. + 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). """ + + self.referenceSeqString = None + """ A string to represent reference sequence. + Type `str`. """ + + self.strand = None + """ Directionality of DNA ( +1/-1). + Type `int`. """ + + self.windowEnd = None + """ End position of the window on the reference sequence. + Type `int`. """ + + self.windowStart = None + """ Start position of the window on the reference sequence. + Type `int`. """ + + super(SequenceReferenceSeq, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SequenceReferenceSeq, self).elementProperties() + js.extend([ + ("chromosome", "chromosome", codeableconcept.CodeableConcept, False, None, False), + ("genomeBuild", "genomeBuild", 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), + ]) + return js + + +class SequenceRepository(backboneelement.BackboneElement): + """ External repository which contains detailed report related with observedSeq + in this resource. + + Configurations of the external repository. The repository shall store + target's observedSeq or records related with target's observedSeq. + """ + + resource_type = "SequenceRepository" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.datasetId = None + """ Id of the dataset that used to call for dataset in repository. + Type `str`. """ + + self.name = None + """ Repository's name. + Type `str`. """ + + self.readsetId = None + """ Id of the read. + Type `str`. """ + + self.type = None + """ directlink | openapi | login | oauth | other. + Type `str`. """ + + self.url = None + """ URI of the repository. + Type `str`. """ + + self.variantsetId = None + """ Id of the variantset that used to call for variantset in repository. + Type `str`. """ + + super(SequenceRepository, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SequenceRepository, self).elementProperties() + js.extend([ + ("datasetId", "datasetId", str, False, None, False), + ("name", "name", str, False, None, False), + ("readsetId", "readsetId", str, False, None, False), + ("type", "type", str, False, None, True), + ("url", "url", str, False, None, False), + ("variantsetId", "variantsetId", str, False, None, False), + ]) + return js + + +class SequenceVariant(backboneelement.BackboneElement): + """ Variant in sequence. + + The definition of variant here originates from Sequence ontology ([variant_ + of](http://www.sequenceontology.org/browser/current_svn/term/variant_of)). + This element can represent amino acid or nucleic sequence change(including + insertion,deletion,SNP,etc.) It can represent some complex mutation or + segment variation with the assist of CIGAR string. + """ + + resource_type = "SequenceVariant" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.cigar = None + """ Extended CIGAR string for aligning the sequence with reference + bases. + Type `str`. """ + + self.end = None + """ End position of the variant on the reference sequence. + Type `int`. """ + + self.observedAllele = None + """ Allele that was observed. + Type `str`. """ + + self.referenceAllele = None + """ Allele in the reference sequence. + Type `str`. """ + + self.start = None + """ Start position of the variant on the reference sequence. + Type `int`. """ + + self.variantPointer = None + """ Pointer to observed variant information. + Type `FHIRReference` referencing `Observation` (represented as `dict` in JSON). """ + + super(SequenceVariant, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SequenceVariant, self).elementProperties() + js.extend([ + ("cigar", "cigar", str, False, None, False), + ("end", "end", int, False, None, False), + ("observedAllele", "observedAllele", str, False, None, False), + ("referenceAllele", "referenceAllele", str, False, None, False), + ("start", "start", int, False, None, False), + ("variantPointer", "variantPointer", fhirreference.FHIRReference, 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'] diff --git a/fhirclient/models/STU3/sequence_tests.py b/fhirclient/models/STU3/sequence_tests.py new file mode 100644 index 000000000..27b72d56b --- /dev/null +++ b/fhirclient/models/STU3/sequence_tests.py @@ -0,0 +1,335 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import sequence +from .fhirdate import FHIRDate + + +class SequenceTests(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) + + def testSequence1(self): + inst = self.instantiate_from("sequence-graphic-example-1.json") + self.assertIsNotNone(inst, "Must have instantiated a Sequence instance") + self.implSequence1(inst) + + js = inst.as_json() + self.assertEqual("Sequence", js["resourceType"]) + inst2 = sequence.Sequence(js) + self.implSequence1(inst2) + + def implSequence1(self, inst): + self.assertEqual(inst.coordinateSystem, 0) + self.assertEqual(inst.id, "graphic-example-1") + 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, 128273732) + self.assertEqual(inst.referenceSeq.windowStart, 128273724) + self.assertEqual(inst.text.status, "generated") + 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 testSequence2(self): + inst = self.instantiate_from("sequence-example-fda-vcfeval.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, "fda-vcfeval-comparison") + 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") + self.assertEqual(inst.quality[0].method.coding[0].system, "https://precision.fda.gov/apps/") + self.assertEqual(inst.quality[0].method.text, "Vcfeval + Hap.py Comparison") + self.assertEqual(inst.quality[0].precision, 0.428005) + self.assertEqual(inst.quality[0].queryFP, 10670) + self.assertEqual(inst.quality[0].recall, 0.752111) + 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, 2554) + self.assertEqual(inst.quality[0].truthTP, 7749) + self.assertEqual(inst.quality[0].type, "indel") + self.assertEqual(inst.quality[1].end, 101770080) + self.assertEqual(inst.quality[1].gtFP, 493) + self.assertEqual(inst.quality[1].method.coding[0].code, "app-BxfGF8j02pBZzZxbzZxP725P") + self.assertEqual(inst.quality[1].method.coding[0].system, "https://precision.fda.gov/apps/") + self.assertEqual(inst.quality[1].method.text, "Vcfeval + Hap.py Comparison") + self.assertEqual(inst.quality[1].precision, 0.808602) + self.assertEqual(inst.quality[1].queryFP, 21744) + self.assertEqual(inst.quality[1].recall, 0.986642) + self.assertEqual(inst.quality[1].standardSequence.coding[0].code, "file-BkZxBZ00bpJVk2q6x43b1YBx") + self.assertEqual(inst.quality[1].standardSequence.coding[0].system, "https://precision.fda.gov/files/") + self.assertEqual(inst.quality[1].start, 10453) + self.assertEqual(inst.quality[1].truthFN, 1247) + self.assertEqual(inst.quality[1].truthTP, 92106) + 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.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/jobs/job-ByxYPx809jFVy21KJG74Jg3Y") + 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) + + def testSequence3(self): + inst = self.instantiate_from("sequence-example-TPMT-one.json") + self.assertIsNotNone(inst, "Must have instantiated a Sequence instance") + self.implSequence3(inst) + + js = inst.as_json() + self.assertEqual("Sequence", js["resourceType"]) + inst2 = sequence.Sequence(js) + self.implSequence3(inst2) + + def implSequence3(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.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 testSequence4(self): + inst = self.instantiate_from("sequence-example-pgx-2.json") + self.assertIsNotNone(inst, "Must have instantiated a Sequence instance") + self.implSequence4(inst) + + js = inst.as_json() + self.assertEqual("Sequence", js["resourceType"]) + inst2 = sequence.Sequence(js) + self.implSequence4(inst2) + + def implSequence4(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 testSequence5(self): + inst = self.instantiate_from("sequence-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Sequence instance") + self.implSequence5(inst) + + js = inst.as_json() + self.assertEqual("Sequence", js["resourceType"]) + inst2 = sequence.Sequence(js) + self.implSequence5(inst2) + + def implSequence5(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.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.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 testSequence6(self): + inst = self.instantiate_from("sequence-example-fda.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, 1) + self.assertEqual(inst.id, "fda-example") + self.assertEqual(inst.quality[0].end, 101770080) + self.assertEqual(inst.quality[0].fScore, 0.545551) + self.assertEqual(inst.quality[0].gtFP, 2186) + self.assertEqual(inst.quality[0].method.coding[0].code, "job-ByxYPx809jFVy21KJG74Jg3Y") + self.assertEqual(inst.quality[0].method.coding[0].system, "https://precision.fda.gov/jobs/") + self.assertEqual(inst.quality[0].method.text, "Vcfeval + Hap.py Comparison") + self.assertEqual(inst.quality[0].precision, 0.428005) + self.assertEqual(inst.quality[0].queryFP, 10670) + self.assertEqual(inst.quality[0].queryTP, 7984) + self.assertEqual(inst.quality[0].recall, 0.752111) + self.assertEqual(inst.quality[0].standardSequence.coding[0].code, "file-Bk50V4Q0qVb65P0v2VPbfYPZ") + 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, 2554) + self.assertEqual(inst.quality[0].truthTP, 7749) + 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.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/files/file-Bx37ZK009P4bX5g3qjkFZV38") + self.assertEqual(inst.repository[0].variantsetId, "file-Bx37ZK009P4bX5g3qjkFZV38") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type, "dna") + 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) + + def testSequence7(self): + inst = self.instantiate_from("coord-1base-example.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, 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) + + def testSequence8(self): + inst = self.instantiate_from("sequence-graphic-example-4.json") + self.assertIsNotNone(inst, "Must have instantiated a Sequence instance") + self.implSequence8(inst) + + js = inst.as_json() + self.assertEqual("Sequence", js["resourceType"]) + inst2 = sequence.Sequence(js) + self.implSequence8(inst2) + + def implSequence8(self, inst): + self.assertEqual(inst.coordinateSystem, 0) + self.assertEqual(inst.id, "graphic-example-4") + 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://hl7.org/fhir/chromosome-human") + self.assertEqual(inst.referenceSeq.genomeBuild, "GRCh 38") + self.assertEqual(inst.referenceSeq.strand, 1) + self.assertEqual(inst.referenceSeq.windowEnd, 128273740) + self.assertEqual(inst.referenceSeq.windowStart, 128273736) + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type, "dna") + + def testSequence9(self): + inst = self.instantiate_from("sequence-graphic-example-5.json") + self.assertIsNotNone(inst, "Must have instantiated a Sequence instance") + self.implSequence9(inst) + + js = inst.as_json() + self.assertEqual("Sequence", js["resourceType"]) + inst2 = sequence.Sequence(js) + self.implSequence9(inst2) + + def implSequence9(self, inst): + self.assertEqual(inst.coordinateSystem, 0) + self.assertEqual(inst.id, "graphic-example-5") + 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, 128273736) + self.assertEqual(inst.referenceSeq.windowStart, 128273732) + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type, "dna") + + def testSequence10(self): + inst = self.instantiate_from("sequence-example-TPMT-two.json") + self.assertIsNotNone(inst, "Must have instantiated a Sequence instance") + self.implSequence10(inst) + + js = inst.as_json() + self.assertEqual("Sequence", js["resourceType"]) + inst2 = sequence.Sequence(js) + self.implSequence10(inst2) + + def implSequence10(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) + 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) + diff --git a/fhirclient/models/STU3/servicedefinition.py b/fhirclient/models/STU3/servicedefinition.py new file mode 100644 index 000000000..83d4b6253 --- /dev/null +++ b/fhirclient/models/STU3/servicedefinition.py @@ -0,0 +1,206 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ServiceDefinition) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class ServiceDefinition(domainresource.DomainResource): + """ A description of decision support service functionality. + + 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. + """ + + resource_type = "ServiceDefinition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 service definition was approved by publisher. + Type `FHIRDate` (represented as `str` 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. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Natural language description of the service definition. + Type `str`. """ + + self.effectivePeriod = None + """ When the service 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 service definition. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ Intended jurisdiction for service definition (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.lastReviewDate = None + """ When the service definition was last reviewed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.name = None + """ Name for this service 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. + Type `str`. """ + + self.relatedArtifact = None + """ Additional documentation, citations, etc. + List of `RelatedArtifact` items (represented as `dict` in JSON). """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.title = None + """ Name for this service definition (human friendly). + Type `str`. """ + + self.topic = None + """ E.g. Education, Treatment, Assessment, etc. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.trigger = None + """ "when" the module should be invoked. + List of `TriggerDefinition` items (represented as `dict` in JSON). """ + + self.url = None + """ Logical URI to reference this service definition (globally unique). + Type `str`. """ + + self.usage = None + """ Describes the clinical usage of the module. + 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 service definition. + Type `str`. """ + + super(ServiceDefinition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ServiceDefinition, self).elementProperties() + js.extend([ + ("approvalDate", "approvalDate", fhirdate.FHIRDate, False, 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), + ("effectivePeriod", "effectivePeriod", period.Period, False, 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), + ("status", "status", str, False, None, True), + ("title", "title", str, False, None, False), + ("topic", "topic", codeableconcept.CodeableConcept, True, None, False), + ("trigger", "trigger", triggerdefinition.TriggerDefinition, 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 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: + 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 triggerdefinition +except ImportError: + triggerdefinition = sys.modules[__package__ + '.triggerdefinition'] +try: + from . import usagecontext +except ImportError: + usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/STU3/servicedefinition_tests.py b/fhirclient/models/STU3/servicedefinition_tests.py new file mode 100644 index 000000000..9018a27af --- /dev/null +++ b/fhirclient/models/STU3/servicedefinition_tests.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +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/STU3/signature.py b/fhirclient/models/STU3/signature.py new file mode 100644 index 000000000..3b615ce28 --- /dev/null +++ b/fhirclient/models/STU3/signature.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Signature) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Signature(element.Element): + """ A digital Signature - XML DigSig, JWT, 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. + """ + + resource_type = "Signature" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ The actual signature content (XML DigSig. JWT, picture, etc.). + Type `str`. """ + + self.contentType = 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. + Type `str`. """ + + self.type = None + """ Indication of the reason the entity signed the object(s). + List of `Coding` items (represented as `dict` in JSON). """ + + self.when = None + """ 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 + """ Who signed. + Type `str`. """ + + 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), + ("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), + ]) + return js + + +import sys +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'] diff --git a/fhirclient/models/STU3/slot.py b/fhirclient/models/STU3/slot.py new file mode 100644 index 000000000..181f66267 --- /dev/null +++ b/fhirclient/models/STU3/slot.py @@ -0,0 +1,113 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Slot) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Slot(domainresource.DomainResource): + """ A slot of time on a schedule that may be available for booking appointments. + """ + + resource_type = "Slot" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.appointmentType = None + """ The style of appointment or patient that may be booked in the slot + (not service type). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.comment = None + """ Comments on the slot to describe any extended information. Such as + custom constraints on the slot. + Type `str`. """ + + self.end = None + """ Date/Time that the slot is to conclude. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.identifier = None + """ External Ids for this item. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.overbooked = None + """ This slot has already been overbooked, appointments are unlikely to + be accepted for this time. + Type `bool`. """ + + self.schedule = None + """ The schedule resource that this slot defines an interval of status + information. + Type `FHIRReference` referencing `Schedule` (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). """ + + self.serviceType = None + """ The type of appointments that can be booked into this slot (ideally + this would be an identifiable service - which is at a location, + rather than the location itself). If provided then this overrides + the value provided on the availability resource. + 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. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.start = None + """ Date/Time that the slot is to begin. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.status = None + """ busy | free | busy-unavailable | busy-tentative | entered-in-error. + Type `str`. """ + + super(Slot, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Slot, self).elementProperties() + js.extend([ + ("appointmentType", "appointmentType", codeableconcept.CodeableConcept, False, None, False), + ("comment", "comment", str, False, None, False), + ("end", "end", fhirdate.FHIRDate, False, None, True), + ("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), + ("serviceType", "serviceType", codeableconcept.CodeableConcept, True, None, False), + ("specialty", "specialty", codeableconcept.CodeableConcept, True, None, False), + ("start", "start", fhirdate.FHIRDate, False, None, True), + ("status", "status", 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'] diff --git a/fhirclient/models/STU3/slot_tests.py b/fhirclient/models/STU3/slot_tests.py new file mode 100644 index 000000000..59b916c82 --- /dev/null +++ b/fhirclient/models/STU3/slot_tests.py @@ -0,0 +1,121 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import slot +from .fhirdate import FHIRDate + + +class SlotTests(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("Slot", js["resourceType"]) + return slot.Slot(js) + + def testSlot1(self): + inst = self.instantiate_from("slot-example-busy.json") + self.assertIsNotNone(inst, "Must have instantiated a Slot instance") + self.implSlot1(inst) + + js = inst.as_json() + self.assertEqual("Slot", js["resourceType"]) + inst2 = slot.Slot(js) + self.implSlot1(inst2) + + def implSlot1(self, inst): + self.assertEqual(inst.comment, "Assessments should be performed before requesting appointments in this slot.") + self.assertEqual(inst.end.date, FHIRDate("2013-12-25T09:15:00Z").date) + self.assertEqual(inst.end.as_json(), "2013-12-25T09:15:00Z") + self.assertEqual(inst.id, "1") + self.assertEqual(inst.identifier[0].system, "http://example.org/identifiers/slots") + self.assertEqual(inst.identifier[0].value, "123132") + self.assertTrue(inst.overbooked) + 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: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.json") + self.assertIsNotNone(inst, "Must have instantiated a Slot instance") + self.implSlot2(inst) + + js = inst.as_json() + self.assertEqual("Slot", js["resourceType"]) + inst2 = slot.Slot(js) + self.implSlot2(inst2) + + def implSlot2(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.text.status, "generated") + + def testSlot3(self): + inst = self.instantiate_from("slot-example-unavailable.json") + self.assertIsNotNone(inst, "Must have instantiated a Slot instance") + self.implSlot3(inst) + + js = inst.as_json() + self.assertEqual("Slot", js["resourceType"]) + inst2 = slot.Slot(js) + self.implSlot3(inst2) + + def implSlot3(self, inst): + self.assertEqual(inst.comment, "Dr Careful is out of the office") + 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.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-tentative.json") + self.assertIsNotNone(inst, "Must have instantiated a Slot instance") + self.implSlot4(inst) + + js = inst.as_json() + self.assertEqual("Slot", js["resourceType"]) + inst2 = slot.Slot(js) + self.implSlot4(inst2) + + def implSlot4(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.text.status, "generated") + diff --git a/fhirclient/models/STU3/specimen.py b/fhirclient/models/STU3/specimen.py new file mode 100644 index 000000000..47575296d --- /dev/null +++ b/fhirclient/models/STU3/specimen.py @@ -0,0 +1,292 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Specimen) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Specimen(domainresource.DomainResource): + """ Sample for analysis. + + A sample to be used for analysis. + """ + + resource_type = "Specimen" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.accessionIdentifier = None + """ Identifier assigned by the lab. + Type `Identifier` (represented as `dict` in JSON). """ + + self.collection = None + """ Collection details. + Type `SpecimenCollection` (represented as `dict` in JSON). """ + + self.container = None + """ Direct container of specimen (tube/slide, etc.). + List of `SpecimenContainer` items (represented as `dict` in JSON). """ + + self.identifier = None + """ External Identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.note = None + """ Comments. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.parent = None + """ Specimen from which this specimen originated. + List of `FHIRReference` items referencing `Specimen` (represented as `dict` in JSON). """ + + self.processing = None + """ Processing and processing step details. + List of `SpecimenProcessing` items (represented as `dict` in JSON). """ + + self.receivedTime = None + """ The time when specimen was received for processing. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.request = None + """ Why the specimen was collected. + List of `FHIRReference` items referencing `ProcedureRequest` (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). """ + + self.type = None + """ Kind of material that forms the specimen. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(Specimen, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Specimen, self).elementProperties() + js.extend([ + ("accessionIdentifier", "accessionIdentifier", identifier.Identifier, False, None, False), + ("collection", "collection", SpecimenCollection, False, None, False), + ("container", "container", SpecimenContainer, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("note", "note", annotation.Annotation, True, None, False), + ("parent", "parent", fhirreference.FHIRReference, True, None, False), + ("processing", "processing", SpecimenProcessing, True, None, False), + ("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), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import backboneelement + +class SpecimenCollection(backboneelement.BackboneElement): + """ Collection details. + + Details concerning the specimen collection. + """ + + resource_type = "SpecimenCollection" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.bodySite = None + """ Anatomical collection site. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.collectedDateTime = None + """ Collection time. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.collectedPeriod = None + """ Collection time. + Type `Period` (represented as `dict` in JSON). """ + + self.collector = None + """ Who collected the specimen. + Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + + self.method = None + """ Technique used to perform collection. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.quantity = None + """ The quantity of specimen collected. + Type `Quantity` (represented as `dict` in JSON). """ + + super(SpecimenCollection, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SpecimenCollection, self).elementProperties() + js.extend([ + ("bodySite", "bodySite", codeableconcept.CodeableConcept, False, None, False), + ("collectedDateTime", "collectedDateTime", fhirdate.FHIRDate, False, "collected", False), + ("collectedPeriod", "collectedPeriod", period.Period, False, "collected", False), + ("collector", "collector", fhirreference.FHIRReference, False, None, False), + ("method", "method", codeableconcept.CodeableConcept, False, None, False), + ("quantity", "quantity", quantity.Quantity, False, None, False), + ]) + return js + + +class SpecimenContainer(backboneelement.BackboneElement): + """ Direct container of specimen (tube/slide, etc.). + + The container holding the specimen. The recursive nature of containers; + i.e. blood in tube in tray in rack is not addressed here. + """ + + resource_type = "SpecimenContainer" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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` referencing `Substance` (represented as `dict` in JSON). """ + + self.capacity = None + """ Container volume or size. + Type `Quantity` (represented as `dict` in JSON). """ + + self.description = None + """ Textual description of the container. + Type `str`. """ + + self.identifier = None + """ Id for the container. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.specimenQuantity = None + """ Quantity of specimen within container. + Type `Quantity` (represented as `dict` in JSON). """ + + self.type = None + """ Kind of container directly associated with specimen. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(SpecimenContainer, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SpecimenContainer, self).elementProperties() + js.extend([ + ("additiveCodeableConcept", "additiveCodeableConcept", codeableconcept.CodeableConcept, False, "additive", False), + ("additiveReference", "additiveReference", fhirreference.FHIRReference, False, "additive", False), + ("capacity", "capacity", quantity.Quantity, False, None, False), + ("description", "description", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("specimenQuantity", "specimenQuantity", quantity.Quantity, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class SpecimenProcessing(backboneelement.BackboneElement): + """ Processing and processing step details. + + Details concerning processing and processing steps for the specimen. + """ + + resource_type = "SpecimenProcessing" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Material used in the processing step. + List of `FHIRReference` items referencing `Substance` (represented as `dict` in JSON). """ + + self.description = None + """ Textual description of procedure. + Type `str`. """ + + self.procedure = None + """ Indicates the treatment step applied to the specimen. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.timeDateTime = None + """ Date and time of specimen processing. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.timePeriod = None + """ Date and time of specimen processing. + Type `Period` (represented as `dict` in JSON). """ + + super(SpecimenProcessing, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SpecimenProcessing, self).elementProperties() + js.extend([ + ("additive", "additive", fhirreference.FHIRReference, True, 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 + + +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'] +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/STU3/specimen_tests.py b/fhirclient/models/STU3/specimen_tests.py new file mode 100644 index 000000000..c74c742b9 --- /dev/null +++ b/fhirclient/models/STU3/specimen_tests.py @@ -0,0 +1,152 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import specimen +from .fhirdate import FHIRDate + + +class SpecimenTests(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("Specimen", js["resourceType"]) + return specimen.Specimen(js) + + def testSpecimen1(self): + inst = self.instantiate_from("specimen-example-isolate.json") + self.assertIsNotNone(inst, "Must have instantiated a Specimen instance") + self.implSpecimen1(inst) + + js = inst.as_json() + self.assertEqual("Specimen", js["resourceType"]) + inst2 = specimen.Specimen(js) + self.implSpecimen1(inst2) + + def implSpecimen1(self, inst): + self.assertEqual(inst.accessionIdentifier.system, "http://lab.acme.org/specimens/2011") + self.assertEqual(inst.accessionIdentifier.value, "X352356-ISO1") + 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.contained[0].id, "stool") + self.assertEqual(inst.id, "isolate") + 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") + self.assertEqual(inst.status, "available") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.coding[0].code, "429951000124103") + self.assertEqual(inst.type.coding[0].display, "Bacterial isolate specimen") + self.assertEqual(inst.type.coding[0].system, "http://snomed.info/sct") + + def testSpecimen2(self): + inst = self.instantiate_from("specimen-example-urine.json") + self.assertIsNotNone(inst, "Must have instantiated a Specimen instance") + self.implSpecimen2(inst) + + js = inst.as_json() + self.assertEqual("Specimen", js["resourceType"]) + inst2 = specimen.Specimen(js) + self.implSpecimen2(inst2) + + def implSpecimen2(self, inst): + self.assertEqual(inst.accessionIdentifier.system, "http://lab.acme.org/specimens/2015") + self.assertEqual(inst.accessionIdentifier.value, "X352356") + self.assertEqual(inst.collection.collectedDateTime.date, FHIRDate("2015-08-18T07:03:00Z").date) + self.assertEqual(inst.collection.collectedDateTime.as_json(), "2015-08-18T07:03:00Z") + self.assertEqual(inst.container[0].capacity.unit, "mls") + self.assertEqual(inst.container[0].capacity.value, 50) + self.assertEqual(inst.container[0].specimenQuantity.unit, "mls") + 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.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].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) + self.assertEqual(inst.receivedTime.as_json(), "2015-08-18T07:03:00Z") + self.assertEqual(inst.status, "available") + 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") + + def testSpecimen3(self): + inst = self.instantiate_from("specimen-example-serum.json") + self.assertIsNotNone(inst, "Must have instantiated a Specimen instance") + self.implSpecimen3(inst) + + js = inst.as_json() + self.assertEqual("Specimen", js["resourceType"]) + inst2 = specimen.Specimen(js) + self.implSpecimen3(inst2) + + def implSpecimen3(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.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 testSpecimen4(self): + inst = self.instantiate_from("specimen-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Specimen instance") + self.implSpecimen4(inst) + + js = inst.as_json() + self.assertEqual("Specimen", js["resourceType"]) + inst2 = specimen.Specimen(js) + self.implSpecimen4(inst2) + + def implSpecimen4(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") + self.assertEqual(inst.collection.bodySite.coding[0].display, "Structure of median cubital vein (body structure)") + self.assertEqual(inst.collection.bodySite.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.collection.bodySite.text, "Right median cubital vein") + 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.quantity.unit, "mL") + self.assertEqual(inst.collection.quantity.value, 6) + self.assertEqual(inst.contained[0].id, "hep") + self.assertEqual(inst.container[0].capacity.unit, "mL") + self.assertEqual(inst.container[0].capacity.value, 10) + self.assertEqual(inst.container[0].description, "Green Gel tube") + self.assertEqual(inst.container[0].identifier[0].value, "48736-15394-75465") + self.assertEqual(inst.container[0].specimenQuantity.unit, "mL") + self.assertEqual(inst.container[0].specimenQuantity.value, 6) + self.assertEqual(inst.container[0].type.text, "Vacutainer") + 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.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") + self.assertEqual(inst.status, "available") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.coding[0].code, "122555007") + self.assertEqual(inst.type.coding[0].display, "Venous blood specimen") + self.assertEqual(inst.type.coding[0].system, "http://snomed.info/sct") + diff --git a/fhirclient/models/STU3/structuredefinition.py b/fhirclient/models/STU3/structuredefinition.py new file mode 100644 index 000000000..cf05831b3 --- /dev/null +++ b/fhirclient/models/STU3/structuredefinition.py @@ -0,0 +1,315 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/StructureDefinition) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class StructureDefinition(domainresource.DomainResource): + """ Structural Definition. + + A definition of a FHIR structure. This resource is used to describe the + underlying resources, data types defined in FHIR, and also for describing + extensions and constraints on resources and data types. + """ + + resource_type = "StructureDefinition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.abstract = None + """ Whether the structure is abstract. + Type `bool`. """ + + self.baseDefinition = None + """ Definition that this type is constrained/specialized from. + Type `str`. """ + + self.contact = None + """ Contact details for the publisher. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.context = None + """ Where the extension can be used in instances. + List of `str` items. """ + + 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. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.derivation = None + """ specialization | constraint - How relates to base definition. + Type `str`. """ + + self.description = None + """ Natural language description of the structure definition. + Type `str`. """ + + self.differential = None + """ Differential view of the structure. + Type `StructureDefinitionDifferential` (represented as `dict` in JSON). """ + + self.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.fhirVersion = None + """ FHIR Version this StructureDefinition targets. + Type `str`. """ + + self.identifier = None + """ Additional identifier for the structure definition. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ Intended jurisdiction for structure definition (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.keyword = None + """ Assist with indexing and finding. + List of `Coding` items (represented as `dict` in JSON). """ + + self.kind = None + """ primitive-type | complex-type | resource | logical. + Type `str`. """ + + self.mapping = None + """ External specification that the content is mapped to. + List of `StructureDefinitionMapping` items (represented as `dict` in JSON). """ + + self.name = None + """ Name for this structure definition (computer friendly). + Type `str`. """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this structure definition is defined. + Type `str`. """ + + self.snapshot = None + """ Snapshot view of the structure. + Type `StructureDefinitionSnapshot` (represented as `dict` in JSON). """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.title = None + """ Name for this structure definition (human friendly). + Type `str`. """ + + self.type = None + """ Type defined or constrained by this structure. + Type `str`. """ + + self.url = None + """ Logical URI to reference this structure definition (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 structure definition. + Type `str`. """ + + super(StructureDefinition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(StructureDefinition, self).elementProperties() + js.extend([ + ("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), + ("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), + ("description", "description", str, False, None, False), + ("differential", "differential", StructureDefinitionDifferential, False, None, False), + ("experimental", "experimental", bool, False, None, False), + ("fhirVersion", "fhirVersion", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("keyword", "keyword", coding.Coding, True, None, False), + ("kind", "kind", str, False, None, True), + ("mapping", "mapping", StructureDefinitionMapping, True, None, False), + ("name", "name", str, False, None, True), + ("publisher", "publisher", str, False, None, False), + ("purpose", "purpose", str, False, None, False), + ("snapshot", "snapshot", StructureDefinitionSnapshot, False, None, False), + ("status", "status", str, False, None, True), + ("title", "title", str, False, None, False), + ("type", "type", str, False, None, True), + ("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 StructureDefinitionDifferential(backboneelement.BackboneElement): + """ Differential view of the structure. + + A differential view is expressed relative to the base StructureDefinition - + a statement of differences that it applies. + """ + + resource_type = "StructureDefinitionDifferential" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Definition of elements in the resource (if no StructureDefinition). + List of `ElementDefinition` items (represented as `dict` in JSON). """ + + super(StructureDefinitionDifferential, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(StructureDefinitionDifferential, self).elementProperties() + js.extend([ + ("element", "element", elementdefinition.ElementDefinition, True, None, True), + ]) + return js + + +class StructureDefinitionMapping(backboneelement.BackboneElement): + """ External specification that the content is mapped to. + + An external specification that the content is mapped to. + """ + + resource_type = "StructureDefinitionMapping" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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(StructureDefinitionMapping, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(StructureDefinitionMapping, 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 + + +class StructureDefinitionSnapshot(backboneelement.BackboneElement): + """ Snapshot view of the structure. + + A snapshot view is expressed in a stand alone form that can be used and + interpreted without considering the base StructureDefinition. + """ + + resource_type = "StructureDefinitionSnapshot" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Definition of elements in the resource (if no StructureDefinition). + List of `ElementDefinition` items (represented as `dict` in JSON). """ + + super(StructureDefinitionSnapshot, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(StructureDefinitionSnapshot, self).elementProperties() + js.extend([ + ("element", "element", elementdefinition.ElementDefinition, True, 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 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/STU3/structuredefinition_tests.py b/fhirclient/models/STU3/structuredefinition_tests.py new file mode 100644 index 000000000..079e06a50 --- /dev/null +++ b/fhirclient/models/STU3/structuredefinition_tests.py @@ -0,0 +1,211 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import structuredefinition +from .fhirdate import FHIRDate + + +class StructureDefinitionTests(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("StructureDefinition", js["resourceType"]) + return structuredefinition.StructureDefinition(js) + + def testStructureDefinition1(self): + inst = self.instantiate_from("structuredefinition-example.json") + self.assertIsNotNone(inst, "Must have instantiated a StructureDefinition instance") + self.implStructureDefinition1(inst) + + js = inst.as_json() + self.assertEqual("StructureDefinition", js["resourceType"]) + inst2 = structuredefinition.StructureDefinition(js) + self.implStructureDefinition1(inst2) + + def implStructureDefinition1(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.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.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") + diff --git a/fhirclient/models/STU3/structuremap.py b/fhirclient/models/STU3/structuremap.py new file mode 100644 index 000000000..1ed328ea7 --- /dev/null +++ b/fhirclient/models/STU3/structuremap.py @@ -0,0 +1,830 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/StructureMap) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class StructureMap(domainresource.DomainResource): + """ A Map of relationships between 2 structures that can be used to transform + data. + """ + + resource_type = "StructureMap" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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.description = None + """ Natural language description of the structure map. + Type `str`. """ + + self.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.group = None + """ Named sections for reader convenience. + List of `StructureMapGroup` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Additional identifier for the structure map. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.import_fhir = None + """ Other maps used by this map (canonical URLs). + List of `str` items. """ + + self.jurisdiction = None + """ Intended jurisdiction for structure map (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.name = None + """ Name for this structure map (computer friendly). + Type `str`. """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this structure map is defined. + Type `str`. """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.structure = None + """ Structure Definition used by this map. + List of `StructureMapStructure` items (represented as `dict` in JSON). """ + + self.title = None + """ Name for this structure map (human friendly). + Type `str`. """ + + self.url = None + """ Logical URI to reference this structure map (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 structure map. + Type `str`. """ + + super(StructureMap, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(StructureMap, self).elementProperties() + js.extend([ + ("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), + ("experimental", "experimental", bool, False, None, False), + ("group", "group", StructureMapGroup, True, None, True), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("import_fhir", "import", str, True, 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), + ("status", "status", str, False, None, True), + ("structure", "structure", StructureMapStructure, True, None, False), + ("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 StructureMapGroup(backboneelement.BackboneElement): + """ Named sections for reader convenience. + + Organizes the mapping into managable chunks for human review/ease of + maintenance. + """ + + resource_type = "StructureMapGroup" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Additional description/explaination for group. + Type `str`. """ + + self.extends = None + """ Another group that this group adds rules to. + Type `str`. """ + + self.input = None + """ Named instance provided when invoking the map. + List of `StructureMapGroupInput` items (represented as `dict` in JSON). """ + + self.name = None + """ Human-readable label. + Type `str`. """ + + self.rule = None + """ Transform Rule from source to target. + List of `StructureMapGroupRule` items (represented as `dict` in JSON). """ + + self.typeMode = None + """ none | types | type-and-types. + Type `str`. """ + + super(StructureMapGroup, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(StructureMapGroup, self).elementProperties() + js.extend([ + ("documentation", "documentation", str, False, None, False), + ("extends", "extends", str, False, None, False), + ("input", "input", StructureMapGroupInput, True, None, True), + ("name", "name", str, False, None, True), + ("rule", "rule", StructureMapGroupRule, True, None, True), + ("typeMode", "typeMode", str, False, None, True), + ]) + return js + + +class StructureMapGroupInput(backboneelement.BackboneElement): + """ Named instance provided when invoking the map. + + A name assigned to an instance of data. The instance must be provided when + the mapping is invoked. + """ + + resource_type = "StructureMapGroupInput" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Documentation for this instance of data. + Type `str`. """ + + self.mode = None + """ source | target. + Type `str`. """ + + self.name = None + """ Name for this instance of data. + Type `str`. """ + + self.type = None + """ Type for this instance of data. + Type `str`. """ + + super(StructureMapGroupInput, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(StructureMapGroupInput, self).elementProperties() + js.extend([ + ("documentation", "documentation", str, False, None, False), + ("mode", "mode", str, False, None, True), + ("name", "name", str, False, None, True), + ("type", "type", str, False, None, False), + ]) + return js + + +class StructureMapGroupRule(backboneelement.BackboneElement): + """ Transform Rule from source to target. + """ + + resource_type = "StructureMapGroupRule" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.dependent = None + """ Which other rules to apply in the context of this rule. + List of `StructureMapGroupRuleDependent` items (represented as `dict` in JSON). """ + + self.documentation = None + """ Documentation for this instance of data. + Type `str`. """ + + self.name = None + """ Name of the rule for internal references. + Type `str`. """ + + self.rule = None + """ Rules contained in this rule. + List of `StructureMapGroupRule` items (represented as `dict` in JSON). """ + + self.source = None + """ Source inputs to the mapping. + List of `StructureMapGroupRuleSource` items (represented as `dict` in JSON). """ + + self.target = None + """ Content to create because of this mapping rule. + List of `StructureMapGroupRuleTarget` items (represented as `dict` in JSON). """ + + super(StructureMapGroupRule, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(StructureMapGroupRule, self).elementProperties() + js.extend([ + ("dependent", "dependent", StructureMapGroupRuleDependent, True, None, False), + ("documentation", "documentation", str, False, None, False), + ("name", "name", str, False, None, True), + ("rule", "rule", StructureMapGroupRule, True, None, False), + ("source", "source", StructureMapGroupRuleSource, True, None, True), + ("target", "target", StructureMapGroupRuleTarget, True, None, False), + ]) + return js + + +class StructureMapGroupRuleDependent(backboneelement.BackboneElement): + """ Which other rules to apply in the context of this rule. + """ + + resource_type = "StructureMapGroupRuleDependent" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 a rule or group to apply. + Type `str`. """ + + self.variable = None + """ Variable to pass to the rule or group. + List of `str` items. """ + + super(StructureMapGroupRuleDependent, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(StructureMapGroupRuleDependent, self).elementProperties() + js.extend([ + ("name", "name", str, False, None, True), + ("variable", "variable", str, True, None, True), + ]) + return js + + +class StructureMapGroupRuleSource(backboneelement.BackboneElement): + """ Source inputs to the mapping. + """ + + resource_type = "StructureMapGroupRuleSource" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.check = None + """ FHIRPath expression - must be true or the mapping engine throws an + error instead of completing. + Type `str`. """ + + self.condition = None + """ FHIRPath expression - must be true or the rule does not apply. + Type `str`. """ + + self.context = None + """ Type or variable this rule applies to. + Type `str`. """ + + self.defaultValueAddress = None + """ Default value if no value exists. + Type `Address` (represented as `dict` in JSON). """ + + self.defaultValueAge = None + """ Default value if no value exists. + Type `Age` (represented as `dict` in JSON). """ + + self.defaultValueAnnotation = None + """ Default value if no value exists. + Type `Annotation` (represented as `dict` in JSON). """ + + self.defaultValueAttachment = None + """ Default value if no value exists. + Type `Attachment` (represented as `dict` in JSON). """ + + self.defaultValueBase64Binary = None + """ Default value if no value exists. + Type `str`. """ + + self.defaultValueBoolean = None + """ Default value if no value exists. + Type `bool`. """ + + self.defaultValueCode = None + """ Default value if no value exists. + Type `str`. """ + + self.defaultValueCodeableConcept = None + """ Default value if no value exists. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.defaultValueCoding = None + """ Default value if no value exists. + Type `Coding` (represented as `dict` in JSON). """ + + self.defaultValueContactPoint = None + """ Default value if no value exists. + Type `ContactPoint` (represented as `dict` in JSON). """ + + self.defaultValueCount = None + """ Default value if no value exists. + Type `Count` (represented as `dict` in JSON). """ + + self.defaultValueDate = None + """ Default value if no value exists. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.defaultValueDateTime = None + """ Default value if no value exists. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.defaultValueDecimal = None + """ Default value if no value exists. + Type `float`. """ + + self.defaultValueDistance = None + """ Default value if no value exists. + Type `Distance` (represented as `dict` in JSON). """ + + self.defaultValueDuration = None + """ Default value if no value exists. + Type `Duration` (represented as `dict` in JSON). """ + + self.defaultValueHumanName = None + """ Default value if no value exists. + Type `HumanName` (represented as `dict` in JSON). """ + + self.defaultValueId = None + """ Default value if no value exists. + Type `str`. """ + + self.defaultValueIdentifier = None + """ Default value if no value exists. + Type `Identifier` (represented as `dict` in JSON). """ + + self.defaultValueInstant = None + """ Default value if no value exists. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.defaultValueInteger = None + """ Default value if no value exists. + Type `int`. """ + + self.defaultValueMarkdown = None + """ 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). """ + + self.defaultValueOid = None + """ Default value if no value exists. + Type `str`. """ + + self.defaultValuePeriod = None + """ Default value if no value exists. + Type `Period` (represented as `dict` in JSON). """ + + self.defaultValuePositiveInt = None + """ Default value if no value exists. + Type `int`. """ + + self.defaultValueQuantity = None + """ Default value if no value exists. + Type `Quantity` (represented as `dict` in JSON). """ + + self.defaultValueRange = None + """ Default value if no value exists. + Type `Range` (represented as `dict` in JSON). """ + + self.defaultValueRatio = None + """ Default value if no value exists. + Type `Ratio` (represented as `dict` in JSON). """ + + self.defaultValueReference = None + """ Default value if no value exists. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.defaultValueSampledData = None + """ Default value if no value exists. + Type `SampledData` (represented as `dict` in JSON). """ + + self.defaultValueSignature = None + """ Default value if no value exists. + Type `Signature` (represented as `dict` in JSON). """ + + self.defaultValueString = None + """ Default value if no value exists. + Type `str`. """ + + self.defaultValueTime = None + """ Default value if no value exists. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.defaultValueTiming = None + """ Default value if no value exists. + Type `Timing` (represented as `dict` in JSON). """ + + self.defaultValueUnsignedInt = None + """ Default value if no value exists. + Type `int`. """ + + self.defaultValueUri = None + """ Default value if no value exists. + Type `str`. """ + + self.element = None + """ Optional field for this source. + Type `str`. """ + + self.listMode = None + """ first | not_first | last | not_last | only_one. + Type `str`. """ + + self.max = None + """ Specified maximum cardinality (number or *). + Type `str`. """ + + self.min = None + """ Specified minimum cardinality. + Type `int`. """ + + self.type = None + """ Rule only applies if source has this type. + Type `str`. """ + + self.variable = None + """ Named context for field, if a field is specified. + Type `str`. """ + + super(StructureMapGroupRuleSource, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(StructureMapGroupRuleSource, self).elementProperties() + js.extend([ + ("check", "check", str, False, None, False), + ("condition", "condition", str, False, None, False), + ("context", "context", str, False, None, True), + ("defaultValueAddress", "defaultValueAddress", address.Address, False, "defaultValue", False), + ("defaultValueAge", "defaultValueAge", age.Age, False, "defaultValue", False), + ("defaultValueAnnotation", "defaultValueAnnotation", annotation.Annotation, False, "defaultValue", False), + ("defaultValueAttachment", "defaultValueAttachment", attachment.Attachment, False, "defaultValue", False), + ("defaultValueBase64Binary", "defaultValueBase64Binary", str, False, "defaultValue", False), + ("defaultValueBoolean", "defaultValueBoolean", bool, False, "defaultValue", False), + ("defaultValueCode", "defaultValueCode", str, False, "defaultValue", False), + ("defaultValueCodeableConcept", "defaultValueCodeableConcept", codeableconcept.CodeableConcept, False, "defaultValue", False), + ("defaultValueCoding", "defaultValueCoding", coding.Coding, False, "defaultValue", False), + ("defaultValueContactPoint", "defaultValueContactPoint", contactpoint.ContactPoint, False, "defaultValue", False), + ("defaultValueCount", "defaultValueCount", count.Count, 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), + ("defaultValueDuration", "defaultValueDuration", duration.Duration, 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), + ("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), + ("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), + ("defaultValueUnsignedInt", "defaultValueUnsignedInt", int, False, "defaultValue", False), + ("defaultValueUri", "defaultValueUri", str, False, "defaultValue", False), + ("element", "element", str, False, None, False), + ("listMode", "listMode", str, False, None, False), + ("max", "max", str, False, None, False), + ("min", "min", int, False, None, False), + ("type", "type", str, False, None, False), + ("variable", "variable", str, False, None, False), + ]) + return js + + +class StructureMapGroupRuleTarget(backboneelement.BackboneElement): + """ Content to create because of this mapping rule. + """ + + resource_type = "StructureMapGroupRuleTarget" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.context = None + """ Type or variable this rule applies to. + Type `str`. """ + + self.contextType = None + """ type | variable. + Type `str`. """ + + self.element = None + """ Field to create in the context. + Type `str`. """ + + self.listMode = None + """ first | share | last | collate. + List of `str` items. """ + + self.listRuleId = None + """ Internal rule reference for shared list items. + Type `str`. """ + + self.parameter = None + """ Parameters to the transform. + List of `StructureMapGroupRuleTargetParameter` items (represented as `dict` in JSON). """ + + self.transform = None + """ create | copy +. + Type `str`. """ + + self.variable = None + """ Named context for field, if desired, and a field is specified. + Type `str`. """ + + super(StructureMapGroupRuleTarget, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(StructureMapGroupRuleTarget, self).elementProperties() + js.extend([ + ("context", "context", str, False, None, False), + ("contextType", "contextType", str, False, None, False), + ("element", "element", str, False, None, False), + ("listMode", "listMode", str, True, None, False), + ("listRuleId", "listRuleId", str, False, None, False), + ("parameter", "parameter", StructureMapGroupRuleTargetParameter, True, None, False), + ("transform", "transform", str, False, None, False), + ("variable", "variable", str, False, None, False), + ]) + return js + + +class StructureMapGroupRuleTargetParameter(backboneelement.BackboneElement): + """ Parameters to the transform. + """ + + resource_type = "StructureMapGroupRuleTargetParameter" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.valueBoolean = None + """ Parameter value - variable or literal. + Type `bool`. """ + + self.valueDecimal = None + """ Parameter value - variable or literal. + Type `float`. """ + + self.valueId = None + """ Parameter value - variable or literal. + Type `str`. """ + + self.valueInteger = None + """ Parameter value - variable or literal. + Type `int`. """ + + self.valueString = None + """ Parameter value - variable or literal. + Type `str`. """ + + super(StructureMapGroupRuleTargetParameter, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(StructureMapGroupRuleTargetParameter, self).elementProperties() + js.extend([ + ("valueBoolean", "valueBoolean", bool, False, "value", True), + ("valueDecimal", "valueDecimal", float, False, "value", True), + ("valueId", "valueId", str, False, "value", True), + ("valueInteger", "valueInteger", int, False, "value", True), + ("valueString", "valueString", str, False, "value", True), + ]) + return js + + +class StructureMapStructure(backboneelement.BackboneElement): + """ Structure Definition used by this map. + + A structure definition used by this map. The structure definition may + describe instances that are converted, or the instances that are produced. + """ + + resource_type = "StructureMapStructure" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.alias = None + """ Name for type in this map. + Type `str`. """ + + self.documentation = None + """ Documentation on use of structure. + Type `str`. """ + + self.mode = None + """ source | queried | target | produced. + Type `str`. """ + + self.url = None + """ Canonical URL for structure definition. + Type `str`. """ + + super(StructureMapStructure, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(StructureMapStructure, self).elementProperties() + js.extend([ + ("alias", "alias", str, False, None, False), + ("documentation", "documentation", str, False, None, False), + ("mode", "mode", str, False, None, True), + ("url", "url", str, False, None, True), + ]) + return js + + +import sys +try: + from . import address +except ImportError: + address = sys.modules[__package__ + '.address'] +try: + from . import age +except ImportError: + age = sys.modules[__package__ + '.age'] +try: + from . import annotation +except ImportError: + annotation = sys.modules[__package__ + '.annotation'] +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 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 count +except ImportError: + count = sys.modules[__package__ + '.count'] +try: + from . import distance +except ImportError: + distance = sys.modules[__package__ + '.distance'] +try: + from . import duration +except ImportError: + duration = sys.modules[__package__ + '.duration'] +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 humanname +except ImportError: + humanname = sys.modules[__package__ + '.humanname'] +try: + 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 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 sampleddata +except ImportError: + sampleddata = sys.modules[__package__ + '.sampleddata'] +try: + from . import signature +except ImportError: + signature = sys.modules[__package__ + '.signature'] +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/STU3/structuremap_tests.py b/fhirclient/models/STU3/structuremap_tests.py new file mode 100644 index 000000000..7a555b0b4 --- /dev/null +++ b/fhirclient/models/STU3/structuremap_tests.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import structuremap +from .fhirdate import FHIRDate + + +class StructureMapTests(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("StructureMap", js["resourceType"]) + return structuremap.StructureMap(js) + + def testStructureMap1(self): + inst = self.instantiate_from("structuremap-example.json") + self.assertIsNotNone(inst, "Must have instantiated a StructureMap instance") + self.implStructureMap1(inst) + + js = inst.as_json() + self.assertEqual("StructureMap", js["resourceType"]) + inst2 = structuremap.StructureMap(js) + self.implStructureMap1(inst2) + + def implStructureMap1(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.date.date, FHIRDate("2017-03-09").date) + self.assertEqual(inst.date.as_json(), "2017-03-09") + self.assertEqual(inst.description, "Example Structure Map") + self.assertEqual(inst.group[0].documentation, "test -> testValue") + self.assertEqual(inst.group[0].input[0].mode, "source") + self.assertEqual(inst.group[0].input[0].name, "test") + self.assertEqual(inst.group[0].name, "Examples") + self.assertEqual(inst.group[0].rule[0].name, "rule1") + self.assertEqual(inst.group[0].rule[0].source[0].context, "Source") + self.assertEqual(inst.group[0].rule[0].source[0].element, "test") + self.assertEqual(inst.group[0].rule[0].source[0].type, "SourceClassA") + self.assertEqual(inst.group[0].rule[0].source[0].variable, "t") + self.assertEqual(inst.group[0].rule[0].target[0].context, "Destination") + self.assertEqual(inst.group[0].rule[0].target[0].contextType, "variable") + self.assertEqual(inst.group[0].rule[0].target[0].element, "testValue") + self.assertEqual(inst.group[0].rule[0].target[0].transform, "copy") + self.assertEqual(inst.group[0].typeMode, "none") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier[0].system, "urn:ietf:rfc:3986") + self.assertEqual(inst.identifier[0].value, "urn:oid:37843577-95fb-4adb-84c0-8837188a7bf3") + self.assertEqual(inst.jurisdiction[0].coding[0].code, "009") + self.assertEqual(inst.jurisdiction[0].coding[0].display, "Oceania") + self.assertEqual(inst.jurisdiction[0].coding[0].system, "http://unstats.un.org/unsd/methods/m49/m49.htm") + self.assertEqual(inst.name, "ExampleMap") + self.assertEqual(inst.publisher, "HL7 FHIR Standard") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "Example Map") + self.assertEqual(inst.url, "http://hl7.org/fhir/StructureMap/example") + self.assertEqual(inst.version, "0.1") + diff --git a/fhirclient/models/STU3/subscription.py b/fhirclient/models/STU3/subscription.py new file mode 100644 index 000000000..651c5b12e --- /dev/null +++ b/fhirclient/models/STU3/subscription.py @@ -0,0 +1,139 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Subscription) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Subscription(domainresource.DomainResource): + """ A server push subscription criteria. + + 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. + """ + + resource_type = "Subscription" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.channel = None + """ The channel on which to report matches to the criteria. + Type `SubscriptionChannel` (represented as `dict` in JSON). """ + + self.contact = None + """ Contact details for source (e.g. troubleshooting). + List of `ContactPoint` items (represented as `dict` in JSON). """ + + self.criteria = None + """ Rule for server push criteria. + Type `str`. """ + + self.end = None + """ When to automatically delete the subscription. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.error = None + """ Latest error note. + Type `str`. """ + + self.reason = None + """ Description of why this subscription was created. + Type `str`. """ + + self.status = None + """ 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): + js = super(Subscription, self).elementProperties() + js.extend([ + ("channel", "channel", SubscriptionChannel, False, None, True), + ("contact", "contact", contactpoint.ContactPoint, True, None, False), + ("criteria", "criteria", str, False, None, True), + ("end", "end", fhirdate.FHIRDate, False, None, False), + ("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 + + +from . import backboneelement + +class SubscriptionChannel(backboneelement.BackboneElement): + """ The channel on which to report matches to the criteria. + + Details where to send notifications when resources are received that meet + the criteria. + """ + + resource_type = "SubscriptionChannel" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Where the channel points to. + Type `str`. """ + + self.header = None + """ Usage depends on the channel type. + List of `str` items. """ + + self.payload = None + """ Mimetype to send, or omit for no payload. + Type `str`. """ + + self.type = None + """ rest-hook | websocket | email | sms | message. + Type `str`. """ + + super(SubscriptionChannel, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubscriptionChannel, self).elementProperties() + js.extend([ + ("endpoint", "endpoint", str, False, None, False), + ("header", "header", str, True, None, False), + ("payload", "payload", str, False, None, False), + ("type", "type", str, False, None, True), + ]) + return js + + +import sys +try: + from . import coding +except ImportError: + coding = sys.modules[__package__ + '.coding'] +try: + from . import contactpoint +except ImportError: + contactpoint = sys.modules[__package__ + '.contactpoint'] +try: + from . import fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] diff --git a/fhirclient/models/STU3/subscription_tests.py b/fhirclient/models/STU3/subscription_tests.py new file mode 100644 index 000000000..1075ad61f --- /dev/null +++ b/fhirclient/models/STU3/subscription_tests.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import subscription +from .fhirdate import FHIRDate + + +class SubscriptionTests(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("Subscription", js["resourceType"]) + return subscription.Subscription(js) + + def testSubscription1(self): + inst = self.instantiate_from("subscription-example-error.json") + self.assertIsNotNone(inst, "Must have instantiated a Subscription instance") + self.implSubscription1(inst) + + js = inst.as_json() + self.assertEqual("Subscription", js["resourceType"]) + inst2 = subscription.Subscription(js) + self.implSubscription1(inst2) + + def implSubscription1(self, inst): + self.assertEqual(inst.channel.endpoint, "https://biliwatch.com/customers/mount-auburn-miu/on-result") + self.assertEqual(inst.channel.header[0], "Authorization: Bearer secret-token-abc-123") + self.assertEqual(inst.channel.payload, "application/fhir+json") + self.assertEqual(inst.channel.type, "rest-hook") + self.assertEqual(inst.contact[0].system, "phone") + self.assertEqual(inst.contact[0].value, "ext 4123") + self.assertEqual(inst.criteria, "Observation?code=http://loinc.org|1975-2") + 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.error, "Socket Error 10060 - can't connect to host") + self.assertEqual(inst.id, "example-error") + 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") + + def testSubscription2(self): + inst = self.instantiate_from("subscription-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Subscription instance") + self.implSubscription2(inst) + + js = inst.as_json() + self.assertEqual("Subscription", js["resourceType"]) + inst2 = subscription.Subscription(js) + self.implSubscription2(inst2) + + def implSubscription2(self, inst): + self.assertEqual(inst.channel.endpoint, "https://biliwatch.com/customers/mount-auburn-miu/on-result") + self.assertEqual(inst.channel.header[0], "Authorization: Bearer secret-token-abc-123") + self.assertEqual(inst.channel.payload, "application/fhir+json") + self.assertEqual(inst.channel.type, "rest-hook") + self.assertEqual(inst.contact[0].system, "phone") + self.assertEqual(inst.contact[0].value, "ext 4123") + self.assertEqual(inst.criteria, "Observation?code=http://loinc.org|1975-2") + 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.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/STU3/substance.py b/fhirclient/models/STU3/substance.py new file mode 100644 index 000000000..26d69afaf --- /dev/null +++ b/fhirclient/models/STU3/substance.py @@ -0,0 +1,175 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Substance) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Substance(domainresource.DomainResource): + """ A homogeneous material with a definite composition. + """ + + resource_type = "Substance" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ What class/type of substance this is. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.code = None + """ What substance this is. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.description = None + """ Textual description of the substance, comments. + Type `str`. """ + + self.identifier = None + """ Unique identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.ingredient = None + """ Composition information about the substance. + List of `SubstanceIngredient` items (represented as `dict` in JSON). """ + + self.instance = None + """ If this describes a specific package/container of the substance. + List of `SubstanceInstance` items (represented as `dict` in JSON). """ + + self.status = None + """ active | inactive | entered-in-error. + Type `str`. """ + + super(Substance, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Substance, self).elementProperties() + js.extend([ + ("category", "category", codeableconcept.CodeableConcept, True, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("description", "description", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("ingredient", "ingredient", SubstanceIngredient, True, None, False), + ("instance", "instance", SubstanceInstance, True, None, False), + ("status", "status", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class SubstanceIngredient(backboneelement.BackboneElement): + """ Composition information about the substance. + + A substance can be composed of other substances. + """ + + resource_type = "SubstanceIngredient" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Optional amount (concentration). + Type `Ratio` (represented as `dict` in JSON). """ + + self.substanceCodeableConcept = None + """ A component of the substance. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.substanceReference = None + """ A component of the substance. + Type `FHIRReference` referencing `Substance` (represented as `dict` in JSON). """ + + super(SubstanceIngredient, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceIngredient, self).elementProperties() + js.extend([ + ("quantity", "quantity", ratio.Ratio, False, None, False), + ("substanceCodeableConcept", "substanceCodeableConcept", codeableconcept.CodeableConcept, False, "substance", True), + ("substanceReference", "substanceReference", fhirreference.FHIRReference, False, "substance", True), + ]) + return js + + +class SubstanceInstance(backboneelement.BackboneElement): + """ If this describes a specific package/container of the substance. + + Substance may be used to describe a kind of substance, or a specific + package/container of the substance: an instance. + """ + + resource_type = "SubstanceInstance" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.expiry = None + """ When no longer valid to use. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.identifier = None + """ Identifier of the package/container. + Type `Identifier` (represented as `dict` in JSON). """ + + self.quantity = None + """ Amount of substance in the package. + Type `Quantity` (represented as `dict` in JSON). """ + + super(SubstanceInstance, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceInstance, self).elementProperties() + js.extend([ + ("expiry", "expiry", fhirdate.FHIRDate, False, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("quantity", "quantity", quantity.Quantity, 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 quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] +try: + from . import ratio +except ImportError: + ratio = sys.modules[__package__ + '.ratio'] diff --git a/fhirclient/models/STU3/substance_tests.py b/fhirclient/models/STU3/substance_tests.py new file mode 100644 index 000000000..92aa33f89 --- /dev/null +++ b/fhirclient/models/STU3/substance_tests.py @@ -0,0 +1,170 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import substance +from .fhirdate import FHIRDate + + +class SubstanceTests(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("Substance", js["resourceType"]) + return substance.Substance(js) + + def testSubstance1(self): + inst = self.instantiate_from("substance-example-silver-nitrate-product.json") + self.assertIsNotNone(inst, "Must have instantiated a Substance instance") + self.implSubstance1(inst) + + js = inst.as_json() + self.assertEqual("Substance", js["resourceType"]) + inst2 = substance.Substance(js) + 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://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.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.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.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") + self.assertEqual(inst.contained[0].id, "ingr1") + self.assertEqual(inst.contained[1].id, "ingr2") + self.assertEqual(inst.description, "Augmentin 875") + self.assertEqual(inst.id, "f205") + self.assertEqual(inst.ingredient[0].quantity.denominator.code, "mg") + self.assertEqual(inst.ingredient[0].quantity.denominator.system, "http://unitsofmeasure.org") + self.assertEqual(inst.ingredient[0].quantity.denominator.unit, "mg") + self.assertEqual(inst.ingredient[0].quantity.denominator.value, 1000) + self.assertEqual(inst.ingredient[0].quantity.numerator.code, "mg") + self.assertEqual(inst.ingredient[0].quantity.numerator.system, "http://unitsofmeasure.org") + self.assertEqual(inst.ingredient[0].quantity.numerator.unit, "mg") + self.assertEqual(inst.ingredient[0].quantity.numerator.value, 875) + self.assertEqual(inst.ingredient[1].quantity.denominator.code, "mg") + self.assertEqual(inst.ingredient[1].quantity.denominator.system, "http://unitsofmeasure.org") + self.assertEqual(inst.ingredient[1].quantity.denominator.unit, "mg") + self.assertEqual(inst.ingredient[1].quantity.denominator.value, 1000) + self.assertEqual(inst.ingredient[1].quantity.numerator.code, "mg") + 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 testSubstance3(self): + inst = self.instantiate_from("substance-example-f203-potassium.json") + self.assertIsNotNone(inst, "Must have instantiated a Substance instance") + self.implSubstance3(inst) + + js = inst.as_json() + self.assertEqual("Substance", js["resourceType"]) + inst2 = substance.Substance(js) + self.implSubstance3(inst2) + + def implSubstance3(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].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.text.status, "generated") + + def testSubstance4(self): + inst = self.instantiate_from("substance-example-f201-dust.json") + self.assertIsNotNone(inst, "Must have instantiated a Substance instance") + self.implSubstance4(inst) + + js = inst.as_json() + self.assertEqual("Substance", js["resourceType"]) + inst2 = substance.Substance(js) + self.implSubstance4(inst2) + + def implSubstance4(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.text.status, "generated") + + def testSubstance5(self): + inst = self.instantiate_from("substance-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Substance instance") + self.implSubstance5(inst) + + js = inst.as_json() + self.assertEqual("Substance", js["resourceType"]) + inst2 = substance.Substance(js) + self.implSubstance5(inst2) + + def implSubstance5(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.text.status, "generated") + + def testSubstance6(self): + inst = self.instantiate_from("substance-example-f202-staphylococcus.json") + self.assertIsNotNone(inst, "Must have instantiated a Substance instance") + self.implSubstance6(inst) + + js = inst.as_json() + self.assertEqual("Substance", js["resourceType"]) + inst2 = substance.Substance(js) + self.implSubstance6(inst2) + + def implSubstance6(self, inst): + 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.text.status, "generated") + diff --git a/fhirclient/models/STU3/supplydelivery.py b/fhirclient/models/STU3/supplydelivery.py new file mode 100644 index 000000000..2c2acb10c --- /dev/null +++ b/fhirclient/models/STU3/supplydelivery.py @@ -0,0 +1,170 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/SupplyDelivery) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class SupplyDelivery(domainresource.DomainResource): + """ Delivery of bulk Supplies. + + Record of delivery of what is supplied. + """ + + resource_type = "SupplyDelivery" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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 referencing `SupplyRequest` (represented as `dict` in JSON). """ + + self.destination = None + """ Where the Supply was sent. + Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + + self.identifier = None + """ External identifier. + Type `Identifier` (represented as `dict` in JSON). """ + + self.occurrenceDateTime = None + """ When event occurred. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.occurrencePeriod = None + """ When event occurred. + Type `Period` (represented as `dict` in JSON). """ + + self.occurrenceTiming = None + """ When event occurred. + Type `Timing` (represented as `dict` in JSON). """ + + self.partOf = None + """ Part of referenced event. + List of `FHIRReference` items referencing `SupplyDelivery, Contract` (represented as `dict` in JSON). """ + + self.patient = None + """ Patient for whom the item is supplied. + Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + + self.receiver = None + """ Who collected the Supply. + List of `FHIRReference` items referencing `Practitioner` (represented as `dict` in JSON). """ + + self.status = None + """ in-progress | completed | abandoned | entered-in-error. + Type `str`. """ + + self.suppliedItem = None + """ The item that is delivered or supplied. + Type `SupplyDeliverySuppliedItem` (represented as `dict` in JSON). """ + + self.supplier = None + """ Dispenser. + Type `FHIRReference` referencing `Practitioner, Organization` (represented as `dict` in JSON). """ + + self.type = None + """ Category of dispense event. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(SupplyDelivery, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SupplyDelivery, self).elementProperties() + js.extend([ + ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), + ("destination", "destination", fhirreference.FHIRReference, False, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("occurrenceDateTime", "occurrenceDateTime", fhirdate.FHIRDate, False, "occurrence", False), + ("occurrencePeriod", "occurrencePeriod", period.Period, False, "occurrence", False), + ("occurrenceTiming", "occurrenceTiming", timing.Timing, False, "occurrence", False), + ("partOf", "partOf", fhirreference.FHIRReference, True, None, False), + ("patient", "patient", fhirreference.FHIRReference, False, None, False), + ("receiver", "receiver", fhirreference.FHIRReference, True, None, False), + ("status", "status", str, False, None, False), + ("suppliedItem", "suppliedItem", SupplyDeliverySuppliedItem, False, None, False), + ("supplier", "supplier", fhirreference.FHIRReference, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import backboneelement + +class SupplyDeliverySuppliedItem(backboneelement.BackboneElement): + """ The item that is delivered or supplied. + + The item that is being delivered or has been supplied. + """ + + resource_type = "SupplyDeliverySuppliedItem" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Medication, Substance, or Device supplied. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.itemReference = None + """ Medication, Substance, or Device supplied. + Type `FHIRReference` referencing `Medication, Substance, Device` (represented as `dict` in JSON). """ + + self.quantity = None + """ Amount dispensed. + Type `Quantity` (represented as `dict` in JSON). """ + + super(SupplyDeliverySuppliedItem, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SupplyDeliverySuppliedItem, self).elementProperties() + js.extend([ + ("itemCodeableConcept", "itemCodeableConcept", codeableconcept.CodeableConcept, False, "item", False), + ("itemReference", "itemReference", fhirreference.FHIRReference, False, "item", False), + ("quantity", "quantity", quantity.Quantity, 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'] +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] +try: + from . import timing +except ImportError: + timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/STU3/supplydelivery_tests.py b/fhirclient/models/STU3/supplydelivery_tests.py new file mode 100644 index 000000000..898ac3503 --- /dev/null +++ b/fhirclient/models/STU3/supplydelivery_tests.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import supplydelivery +from .fhirdate import FHIRDate + + +class SupplyDeliveryTests(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("SupplyDelivery", js["resourceType"]) + return supplydelivery.SupplyDelivery(js) + + def testSupplyDelivery1(self): + inst = self.instantiate_from("supplydelivery-example.json") + self.assertIsNotNone(inst, "Must have instantiated a SupplyDelivery instance") + self.implSupplyDelivery1(inst) + + js = inst.as_json() + self.assertEqual("SupplyDelivery", js["resourceType"]) + inst2 = supplydelivery.SupplyDelivery(js) + self.implSupplyDelivery1(inst2) + + def implSupplyDelivery1(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.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") + + def testSupplyDelivery2(self): + inst = self.instantiate_from("supplydelivery-example-pumpdelivery.json") + self.assertIsNotNone(inst, "Must have instantiated a SupplyDelivery instance") + self.implSupplyDelivery2(inst) + + js = inst.as_json() + self.assertEqual("SupplyDelivery", js["resourceType"]) + inst2 = supplydelivery.SupplyDelivery(js) + self.implSupplyDelivery2(inst2) + + def implSupplyDelivery2(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.text.status, "generated") + diff --git a/fhirclient/models/STU3/supplyrequest.py b/fhirclient/models/STU3/supplyrequest.py new file mode 100644 index 000000000..d13d1af7a --- /dev/null +++ b/fhirclient/models/STU3/supplyrequest.py @@ -0,0 +1,215 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/SupplyRequest) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class SupplyRequest(domainresource.DomainResource): + """ Request for a medication, substance or device. + + A record of a request for a medication, substance or device used in the + healthcare setting. + """ + + resource_type = "SupplyRequest" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ When the request was made. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.category = None + """ The kind of supply (central, non-stock, etc.). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.deliverFrom = None + """ The origin of the supply. + Type `FHIRReference` referencing `Organization, Location` (represented as `dict` in JSON). """ + + self.deliverTo = None + """ The destination of the supply. + Type `FHIRReference` referencing `Organization, Location, Patient` (represented as `dict` in JSON). """ + + self.identifier = None + """ Unique identifier. + Type `Identifier` (represented as `dict` in JSON). """ + + self.occurrenceDateTime = None + """ When the request should be fulfilled. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.occurrencePeriod = None + """ When the request should be fulfilled. + Type `Period` (represented as `dict` in JSON). """ + + self.occurrenceTiming = None + """ 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.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.reasonReference = None + """ Why the supply item was requested. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.requester = None + """ Who/what is requesting service. + Type `SupplyRequestRequester` (represented as `dict` in JSON). """ + + self.status = None + """ draft | active | suspended +. + Type `str`. """ + + self.supplier = None + """ Who is intended to fulfill the request. + List of `FHIRReference` items referencing `Organization` (represented as `dict` in JSON). """ + + super(SupplyRequest, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SupplyRequest, self).elementProperties() + js.extend([ + ("authoredOn", "authoredOn", fhirdate.FHIRDate, False, None, False), + ("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), + ("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), + ("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), + ("status", "status", str, False, None, False), + ("supplier", "supplier", fhirreference.FHIRReference, True, None, False), + ]) + return js + + +from . import backboneelement + +class SupplyRequestOrderedItem(backboneelement.BackboneElement): + """ The item being requested. + """ + + resource_type = "SupplyRequestOrderedItem" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ 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` 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). """ + + 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.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(SupplyRequestRequester, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SupplyRequestRequester, 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 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'] +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] +try: + from . import timing +except ImportError: + timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/STU3/supplyrequest_tests.py b/fhirclient/models/STU3/supplyrequest_tests.py new file mode 100644 index 000000000..064f582e9 --- /dev/null +++ b/fhirclient/models/STU3/supplyrequest_tests.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import supplyrequest +from .fhirdate import FHIRDate + + +class SupplyRequestTests(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("SupplyRequest", js["resourceType"]) + return supplyrequest.SupplyRequest(js) + + def testSupplyRequest1(self): + inst = self.instantiate_from("supplyrequest-example-simpleorder.json") + self.assertIsNotNone(inst, "Must have instantiated a SupplyRequest instance") + self.implSupplyRequest1(inst) + + js = inst.as_json() + self.assertEqual("SupplyRequest", js["resourceType"]) + inst2 = supplyrequest.SupplyRequest(js) + self.implSupplyRequest1(inst2) + + def implSupplyRequest1(self, inst): + self.assertEqual(inst.authoredOn.date, FHIRDate("2016-12-31").date) + self.assertEqual(inst.authoredOn.as_json(), "2016-12-31") + 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.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.status, "active") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/STU3/task.py b/fhirclient/models/STU3/task.py new file mode 100644 index 000000000..8cb407b18 --- /dev/null +++ b/fhirclient/models/STU3/task.py @@ -0,0 +1,785 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Task) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class Task(domainresource.DomainResource): + """ A task to be performed. + """ + + resource_type = "Task" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Task Creation Date. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.basedOn = None + """ Request fulfilled by this task. + List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + + self.businessStatus = None + """ E.g. "Specimen collected", "IV prepped". + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.code = None + """ 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.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). """ + + self.for_fhir = None + """ Beneficiary of the Task. + Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + + self.groupIdentifier = None + """ Requisition or grouper id. + Type `Identifier` (represented as `dict` in JSON). """ + + self.identifier = None + """ Task Instance Identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.input = None + """ Information used to perform task. + List of `TaskInput` items (represented as `dict` in JSON). """ + + self.intent = None + """ proposal | plan | order +. + Type `str`. """ + + self.lastModified = None + """ Task Last Modified Date. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.note = None + """ Comments made about the task. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.output = None + """ Information produced as part of task. + List of `TaskOutput` items (represented as `dict` in JSON). """ + + self.owner = None + """ Responsible individual. + Type `FHIRReference` referencing `Device, Organization, Patient, Practitioner, RelatedPerson` (represented as `dict` in JSON). """ + + self.partOf = None + """ Composite task. + List of `FHIRReference` items referencing `Task` (represented as `dict` in JSON). """ + + self.performerType = None + """ requester | dispatcher | scheduler | performer | monitor | manager + | acquirer | reviewer. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.priority = None + """ normal | urgent | asap | stat. + Type `str`. """ + + self.reason = None + """ Why task is needed. + Type `CodeableConcept` (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). """ + + self.requester = None + """ Who is asking for task to be done. + Type `TaskRequester` (represented as `dict` in JSON). """ + + self.restriction = None + """ Constraints on fulfillment tasks. + Type `TaskRestriction` (represented as `dict` in JSON). """ + + self.status = None + """ draft | requested | received | accepted | +. + Type `str`. """ + + self.statusReason = None + """ Reason for current status. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(Task, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Task, self).elementProperties() + js.extend([ + ("authoredOn", "authoredOn", fhirdate.FHIRDate, False, None, False), + ("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), + ("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), + ("intent", "intent", str, False, None, True), + ("lastModified", "lastModified", fhirdate.FHIRDate, 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), + ("relevantHistory", "relevantHistory", fhirreference.FHIRReference, True, None, False), + ("requester", "requester", TaskRequester, False, None, False), + ("restriction", "restriction", TaskRestriction, False, None, False), + ("status", "status", str, False, None, True), + ("statusReason", "statusReason", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import backboneelement + +class TaskInput(backboneelement.BackboneElement): + """ Information used to perform task. + + Additional information that may be needed in the execution of the task. + """ + + resource_type = "TaskInput" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Label for the input. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueAddress = None + """ Content to use in performing the task. + Type `Address` (represented as `dict` in JSON). """ + + self.valueAge = None + """ Content to use in performing the task. + Type `Age` (represented as `dict` in JSON). """ + + self.valueAnnotation = None + """ Content to use in performing the task. + Type `Annotation` (represented as `dict` in JSON). """ + + self.valueAttachment = None + """ Content to use in performing the task. + Type `Attachment` (represented as `dict` in JSON). """ + + self.valueBase64Binary = None + """ Content to use in performing the task. + Type `str`. """ + + self.valueBoolean = None + """ Content to use in performing the task. + Type `bool`. """ + + self.valueCode = None + """ Content to use in performing the task. + Type `str`. """ + + self.valueCodeableConcept = None + """ Content to use in performing the task. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueCoding = None + """ Content to use in performing the task. + Type `Coding` (represented as `dict` in JSON). """ + + self.valueContactPoint = None + """ Content to use in performing the task. + Type `ContactPoint` (represented as `dict` in JSON). """ + + self.valueCount = None + """ Content to use in performing the task. + Type `Count` (represented as `dict` in JSON). """ + + self.valueDate = None + """ Content to use in performing the task. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueDateTime = None + """ Content to use in performing the task. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueDecimal = None + """ Content to use in performing the task. + Type `float`. """ + + self.valueDistance = None + """ Content to use in performing the task. + Type `Distance` (represented as `dict` in JSON). """ + + self.valueDuration = None + """ Content to use in performing the task. + Type `Duration` (represented as `dict` in JSON). """ + + self.valueHumanName = None + """ Content to use in performing the task. + Type `HumanName` (represented as `dict` in JSON). """ + + self.valueId = None + """ Content to use in performing the task. + Type `str`. """ + + self.valueIdentifier = None + """ Content to use in performing the task. + Type `Identifier` (represented as `dict` in JSON). """ + + self.valueInstant = None + """ Content to use in performing the task. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueInteger = None + """ Content to use in performing the task. + Type `int`. """ + + self.valueMarkdown = None + """ 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). """ + + self.valueOid = None + """ Content to use in performing the task. + Type `str`. """ + + self.valuePeriod = None + """ Content to use in performing the task. + Type `Period` (represented as `dict` in JSON). """ + + self.valuePositiveInt = None + """ Content to use in performing the task. + Type `int`. """ + + self.valueQuantity = None + """ Content to use in performing the task. + Type `Quantity` (represented as `dict` in JSON). """ + + self.valueRange = None + """ Content to use in performing the task. + Type `Range` (represented as `dict` in JSON). """ + + self.valueRatio = None + """ Content to use in performing the task. + Type `Ratio` (represented as `dict` in JSON). """ + + self.valueReference = None + """ Content to use in performing the task. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.valueSampledData = None + """ Content to use in performing the task. + Type `SampledData` (represented as `dict` in JSON). """ + + self.valueSignature = None + """ Content to use in performing the task. + Type `Signature` (represented as `dict` in JSON). """ + + self.valueString = None + """ Content to use in performing the task. + Type `str`. """ + + self.valueTime = None + """ Content to use in performing the task. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueTiming = None + """ Content to use in performing the task. + Type `Timing` (represented as `dict` in JSON). """ + + self.valueUnsignedInt = None + """ Content to use in performing the task. + Type `int`. """ + + self.valueUri = None + """ Content to use in performing the task. + Type `str`. """ + + super(TaskInput, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TaskInput, self).elementProperties() + js.extend([ + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ("valueAddress", "valueAddress", address.Address, False, "value", True), + ("valueAge", "valueAge", age.Age, False, "value", True), + ("valueAnnotation", "valueAnnotation", annotation.Annotation, False, "value", True), + ("valueAttachment", "valueAttachment", attachment.Attachment, False, "value", True), + ("valueBase64Binary", "valueBase64Binary", str, False, "value", True), + ("valueBoolean", "valueBoolean", bool, False, "value", True), + ("valueCode", "valueCode", str, False, "value", True), + ("valueCodeableConcept", "valueCodeableConcept", codeableconcept.CodeableConcept, False, "value", True), + ("valueCoding", "valueCoding", coding.Coding, False, "value", True), + ("valueContactPoint", "valueContactPoint", contactpoint.ContactPoint, False, "value", True), + ("valueCount", "valueCount", count.Count, 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), + ("valueDuration", "valueDuration", duration.Duration, 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), + ("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), + ("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), + ("valueUnsignedInt", "valueUnsignedInt", int, False, "value", True), + ("valueUri", "valueUri", str, False, "value", True), + ]) + return js + + +class TaskOutput(backboneelement.BackboneElement): + """ Information produced as part of task. + + Outputs produced by the Task. + """ + + resource_type = "TaskOutput" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Label for output. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueAddress = None + """ Result of output. + Type `Address` (represented as `dict` in JSON). """ + + self.valueAge = None + """ Result of output. + Type `Age` (represented as `dict` in JSON). """ + + self.valueAnnotation = None + """ Result of output. + Type `Annotation` (represented as `dict` in JSON). """ + + self.valueAttachment = None + """ Result of output. + Type `Attachment` (represented as `dict` in JSON). """ + + self.valueBase64Binary = None + """ Result of output. + Type `str`. """ + + self.valueBoolean = None + """ Result of output. + Type `bool`. """ + + self.valueCode = None + """ Result of output. + Type `str`. """ + + self.valueCodeableConcept = None + """ Result of output. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueCoding = None + """ Result of output. + Type `Coding` (represented as `dict` in JSON). """ + + self.valueContactPoint = None + """ Result of output. + Type `ContactPoint` (represented as `dict` in JSON). """ + + self.valueCount = None + """ Result of output. + Type `Count` (represented as `dict` in JSON). """ + + self.valueDate = None + """ Result of output. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueDateTime = None + """ Result of output. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueDecimal = None + """ Result of output. + Type `float`. """ + + self.valueDistance = None + """ Result of output. + Type `Distance` (represented as `dict` in JSON). """ + + self.valueDuration = None + """ Result of output. + Type `Duration` (represented as `dict` in JSON). """ + + self.valueHumanName = None + """ Result of output. + Type `HumanName` (represented as `dict` in JSON). """ + + self.valueId = None + """ Result of output. + Type `str`. """ + + self.valueIdentifier = None + """ Result of output. + Type `Identifier` (represented as `dict` in JSON). """ + + self.valueInstant = None + """ Result of output. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueInteger = None + """ Result of output. + Type `int`. """ + + self.valueMarkdown = None + """ 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). """ + + self.valueOid = None + """ Result of output. + Type `str`. """ + + self.valuePeriod = None + """ Result of output. + Type `Period` (represented as `dict` in JSON). """ + + self.valuePositiveInt = None + """ Result of output. + Type `int`. """ + + self.valueQuantity = None + """ Result of output. + Type `Quantity` (represented as `dict` in JSON). """ + + self.valueRange = None + """ Result of output. + Type `Range` (represented as `dict` in JSON). """ + + self.valueRatio = None + """ Result of output. + Type `Ratio` (represented as `dict` in JSON). """ + + self.valueReference = None + """ Result of output. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.valueSampledData = None + """ Result of output. + Type `SampledData` (represented as `dict` in JSON). """ + + self.valueSignature = None + """ Result of output. + Type `Signature` (represented as `dict` in JSON). """ + + self.valueString = None + """ Result of output. + Type `str`. """ + + self.valueTime = None + """ Result of output. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueTiming = None + """ Result of output. + Type `Timing` (represented as `dict` in JSON). """ + + self.valueUnsignedInt = None + """ Result of output. + Type `int`. """ + + self.valueUri = None + """ Result of output. + Type `str`. """ + + super(TaskOutput, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TaskOutput, self).elementProperties() + js.extend([ + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ("valueAddress", "valueAddress", address.Address, False, "value", True), + ("valueAge", "valueAge", age.Age, False, "value", True), + ("valueAnnotation", "valueAnnotation", annotation.Annotation, False, "value", True), + ("valueAttachment", "valueAttachment", attachment.Attachment, False, "value", True), + ("valueBase64Binary", "valueBase64Binary", str, False, "value", True), + ("valueBoolean", "valueBoolean", bool, False, "value", True), + ("valueCode", "valueCode", str, False, "value", True), + ("valueCodeableConcept", "valueCodeableConcept", codeableconcept.CodeableConcept, False, "value", True), + ("valueCoding", "valueCoding", coding.Coding, False, "value", True), + ("valueContactPoint", "valueContactPoint", contactpoint.ContactPoint, False, "value", True), + ("valueCount", "valueCount", count.Count, 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), + ("valueDuration", "valueDuration", duration.Duration, 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), + ("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), + ("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), + ("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), + ]) + return js + + +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. + """ + + resource_type = "TaskRestriction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ When fulfillment sought. + Type `Period` (represented as `dict` in JSON). """ + + self.recipient = None + """ For whom is fulfillment sought?. + List of `FHIRReference` items referencing `Patient, Practitioner, RelatedPerson, Group, Organization` (represented as `dict` in JSON). """ + + self.repetitions = None + """ How many times to repeat. + Type `int`. """ + + super(TaskRestriction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TaskRestriction, self).elementProperties() + js.extend([ + ("period", "period", period.Period, False, None, False), + ("recipient", "recipient", fhirreference.FHIRReference, True, None, False), + ("repetitions", "repetitions", int, False, None, False), + ]) + return js + + +import sys +try: + from . import address +except ImportError: + address = sys.modules[__package__ + '.address'] +try: + from . import age +except ImportError: + age = sys.modules[__package__ + '.age'] +try: + from . import annotation +except ImportError: + annotation = sys.modules[__package__ + '.annotation'] +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 coding +except ImportError: + coding = sys.modules[__package__ + '.coding'] +try: + from . import contactpoint +except ImportError: + contactpoint = sys.modules[__package__ + '.contactpoint'] +try: + from . import count +except ImportError: + count = sys.modules[__package__ + '.count'] +try: + from . import distance +except ImportError: + distance = sys.modules[__package__ + '.distance'] +try: + from . import duration +except ImportError: + duration = sys.modules[__package__ + '.duration'] +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 humanname +except ImportError: + humanname = sys.modules[__package__ + '.humanname'] +try: + 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 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 sampleddata +except ImportError: + sampleddata = sys.modules[__package__ + '.sampleddata'] +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/STU3/task_tests.py b/fhirclient/models/STU3/task_tests.py new file mode 100644 index 000000000..fc1e78e1e --- /dev/null +++ b/fhirclient/models/STU3/task_tests.py @@ -0,0 +1,248 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import task +from .fhirdate import FHIRDate + + +class TaskTests(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("Task", js["resourceType"]) + return task.Task(js) + + def testTask1(self): + inst = self.instantiate_from("task-example6.json") + self.assertIsNotNone(inst, "Must have instantiated a Task instance") + self.implTask1(inst) + + js = inst.as_json() + self.assertEqual("Task", js["resourceType"]) + inst2 = task.Task(js) + self.implTask1(inst2) + + 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, "test completed and posted") + 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.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.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, "completed") + self.assertEqual(inst.text.status, "generated") + + def testTask2(self): + inst = self.instantiate_from("task-example1.json") + self.assertIsNotNone(inst, "Must have instantiated a Task instance") + self.implTask2(inst) + + js = inst.as_json() + self.assertEqual("Task", js["resourceType"]) + inst2 = task.Task(js) + self.implTask2(inst2) + + def implTask2(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, "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-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.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.text.status, "generated") + + def testTask3(self): + inst = self.instantiate_from("task-example3.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-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") + self.assertEqual(inst.id, "example3") + 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.status, "draft") + self.assertEqual(inst.text.status, "generated") + + def testTask4(self): + inst = self.instantiate_from("task-example2.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("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.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.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.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.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, "accepted") + self.assertEqual(inst.text.status, "generated") + + def testTask5(self): + inst = self.instantiate_from("task-example5.json") + self.assertIsNotNone(inst, "Must have instantiated a Task instance") + self.implTask5(inst) + + js = inst.as_json() + self.assertEqual("Task", js["resourceType"]) + inst2 = task.Task(js) + self.implTask5(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") + 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-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.text.status, "generated") + + def testTask6(self): + inst = self.instantiate_from("task-example4.json") + self.assertIsNotNone(inst, "Must have instantiated a Task instance") + self.implTask6(inst) + + js = inst.as_json() + self.assertEqual("Task", js["resourceType"]) + inst2 = task.Task(js) + self.implTask6(inst2) + + def implTask6(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.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.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.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.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.text.status, "generated") + diff --git a/fhirclient/models/STU3/testreport.py b/fhirclient/models/STU3/testreport.py new file mode 100644 index 000000000..a2856ce1a --- /dev/null +++ b/fhirclient/models/STU3/testreport.py @@ -0,0 +1,431 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/TestReport) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +class TestReport(domainresource.DomainResource): + """ Describes the results of a TestScript execution. + + A summary of information based on the results of executing a TestScript. + """ + + resource_type = "TestReport" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ External identifier. + Type `Identifier` (represented as `dict` in JSON). """ + + self.issued = None + """ When the TestScript was executed and this TestReport was generated. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.name = None + """ Informal name of the executed TestScript. + Type `str`. """ + + self.participant = None + """ A participant in the test execution, either the execution engine, a + client, or a server. + List of `TestReportParticipant` items (represented as `dict` in JSON). """ + + self.result = None + """ pass | fail | pending. + Type `str`. """ + + self.score = None + """ The final score (percentage of tests passed) resulting from the + execution of the TestScript. + Type `float`. """ + + self.setup = None + """ The results of the series of required setup operations before the + tests were executed. + Type `TestReportSetup` (represented as `dict` in JSON). """ + + self.status = None + """ completed | in-progress | waiting | stopped | entered-in-error. + Type `str`. """ + + self.teardown = None + """ The results of running the series of required clean up steps. + Type `TestReportTeardown` (represented as `dict` in JSON). """ + + self.test = None + """ A test executed from the test script. + List of `TestReportTest` items (represented as `dict` in JSON). """ + + 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). """ + + self.tester = None + """ Name of the tester producing this report (Organization or + individual). + Type `str`. """ + + super(TestReport, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestReport, self).elementProperties() + js.extend([ + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("issued", "issued", fhirdate.FHIRDate, False, None, False), + ("name", "name", str, False, None, False), + ("participant", "participant", TestReportParticipant, True, None, False), + ("result", "result", str, False, None, True), + ("score", "score", float, False, None, False), + ("setup", "setup", TestReportSetup, False, None, False), + ("status", "status", str, False, None, True), + ("teardown", "teardown", TestReportTeardown, False, None, False), + ("test", "test", TestReportTest, True, None, False), + ("testScript", "testScript", fhirreference.FHIRReference, False, None, True), + ("tester", "tester", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class TestReportParticipant(backboneelement.BackboneElement): + """ A participant in the test execution, either the execution engine, a client, + or a server. + """ + + resource_type = "TestReportParticipant" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.display = None + """ The display name of the participant. + Type `str`. """ + + self.type = None + """ test-engine | client | server. + Type `str`. """ + + self.uri = None + """ The uri of the participant. An absolute URL is preferred. + Type `str`. """ + + super(TestReportParticipant, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestReportParticipant, self).elementProperties() + js.extend([ + ("display", "display", str, False, None, False), + ("type", "type", str, False, None, True), + ("uri", "uri", str, False, None, True), + ]) + return js + + +class TestReportSetup(backboneelement.BackboneElement): + """ The results of the series of required setup operations before the tests + were executed. + """ + + resource_type = "TestReportSetup" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ A setup operation or assert that was executed. + List of `TestReportSetupAction` items (represented as `dict` in JSON). """ + + super(TestReportSetup, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestReportSetup, self).elementProperties() + js.extend([ + ("action", "action", TestReportSetupAction, True, None, True), + ]) + return js + + +class TestReportSetupAction(backboneelement.BackboneElement): + """ A setup operation or assert that was executed. + + Action would contain either an operation or an assertion. + """ + + resource_type = "TestReportSetupAction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.assert_fhir = None + """ The assertion to perform. + Type `TestReportSetupActionAssert` (represented as `dict` in JSON). """ + + self.operation = None + """ The operation to perform. + Type `TestReportSetupActionOperation` (represented as `dict` in JSON). """ + + super(TestReportSetupAction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestReportSetupAction, self).elementProperties() + js.extend([ + ("assert_fhir", "assert", TestReportSetupActionAssert, False, None, False), + ("operation", "operation", TestReportSetupActionOperation, False, None, False), + ]) + return js + + +class TestReportSetupActionAssert(backboneelement.BackboneElement): + """ The assertion to perform. + + The results of the assertion performed on the previous operations. + """ + + resource_type = "TestReportSetupActionAssert" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.detail = None + """ A link to further details on the result. + Type `str`. """ + + self.message = None + """ A message associated with the result. + Type `str`. """ + + self.result = None + """ pass | skip | fail | warning | error. + Type `str`. """ + + super(TestReportSetupActionAssert, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestReportSetupActionAssert, self).elementProperties() + js.extend([ + ("detail", "detail", str, False, None, False), + ("message", "message", str, False, None, False), + ("result", "result", str, False, None, True), + ]) + return js + + +class TestReportSetupActionOperation(backboneelement.BackboneElement): + """ The operation to perform. + + The operation performed. + """ + + resource_type = "TestReportSetupActionOperation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.detail = None + """ A link to further details on the result. + Type `str`. """ + + self.message = None + """ A message associated with the result. + Type `str`. """ + + self.result = None + """ pass | skip | fail | warning | error. + Type `str`. """ + + super(TestReportSetupActionOperation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestReportSetupActionOperation, self).elementProperties() + js.extend([ + ("detail", "detail", str, False, None, False), + ("message", "message", str, False, None, False), + ("result", "result", str, False, None, True), + ]) + return js + + +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). + """ + + resource_type = "TestReportTeardown" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ One or more teardown operations performed. + List of `TestReportTeardownAction` items (represented as `dict` in JSON). """ + + super(TestReportTeardown, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestReportTeardown, self).elementProperties() + js.extend([ + ("action", "action", TestReportTeardownAction, True, None, True), + ]) + return js + + +class TestReportTeardownAction(backboneelement.BackboneElement): + """ One or more teardown operations performed. + + The teardown action will only contain an operation. + """ + + resource_type = "TestReportTeardownAction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.operation = None + """ The teardown operation performed. + Type `TestReportSetupActionOperation` (represented as `dict` in JSON). """ + + super(TestReportTeardownAction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestReportTeardownAction, self).elementProperties() + js.extend([ + ("operation", "operation", TestReportSetupActionOperation, False, None, True), + ]) + return js + + +class TestReportTest(backboneelement.BackboneElement): + """ A test executed from the test script. + """ + + resource_type = "TestReportTest" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ A test operation or assert that was performed. + List of `TestReportTestAction` items (represented as `dict` in JSON). """ + + self.description = None + """ Tracking/reporting short description of the test. + Type `str`. """ + + self.name = None + """ Tracking/logging name of this test. + Type `str`. """ + + super(TestReportTest, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestReportTest, self).elementProperties() + js.extend([ + ("action", "action", TestReportTestAction, True, None, True), + ("description", "description", str, False, None, False), + ("name", "name", str, False, None, False), + ]) + return js + + +class TestReportTestAction(backboneelement.BackboneElement): + """ A test operation or assert that was performed. + + Action would contain either an operation or an assertion. + """ + + resource_type = "TestReportTestAction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.assert_fhir = None + """ The assertion performed. + Type `TestReportSetupActionAssert` (represented as `dict` in JSON). """ + + self.operation = None + """ The operation performed. + Type `TestReportSetupActionOperation` (represented as `dict` in JSON). """ + + super(TestReportTestAction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestReportTestAction, self).elementProperties() + js.extend([ + ("assert_fhir", "assert", TestReportSetupActionAssert, False, None, False), + ("operation", "operation", TestReportSetupActionOperation, False, None, False), + ]) + 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/STU3/testreport_tests.py b/fhirclient/models/STU3/testreport_tests.py new file mode 100644 index 000000000..e78792c9e --- /dev/null +++ b/fhirclient/models/STU3/testreport_tests.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import testreport +from .fhirdate import FHIRDate + + +class TestReportTests(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("TestReport", js["resourceType"]) + return testreport.TestReport(js) + + def testTestReport1(self): + inst = self.instantiate_from("testreport-example.json") + self.assertIsNotNone(inst, "Must have instantiated a TestReport instance") + self.implTestReport1(inst) + + js = inst.as_json() + self.assertEqual("TestReport", js["resourceType"]) + inst2 = testreport.TestReport(js) + self.implTestReport1(inst2) + + def implTestReport1(self, inst): + self.assertEqual(inst.id, "testreport-example") + 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.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.name, "TestReport Example for TestScript Example") + self.assertEqual(inst.participant[0].display, "Crucible") + self.assertEqual(inst.participant[0].type, "test-engine") + self.assertEqual(inst.participant[0].uri, "http://projectcrucible.org") + self.assertEqual(inst.participant[1].display, "HealthIntersections STU3") + self.assertEqual(inst.participant[1].type, "server") + self.assertEqual(inst.participant[1].uri, "http://fhir3.healthintersections.com.au/open") + self.assertEqual(inst.result, "pass") + self.assertEqual(inst.score, 100.0) + self.assertEqual(inst.setup.action[0].operation.detail, "http://projectcrucible.org/permalink/1") + self.assertEqual(inst.setup.action[0].operation.message, "DELETE Patient") + self.assertEqual(inst.setup.action[0].operation.result, "pass") + self.assertEqual(inst.setup.action[1].assert_fhir.detail, "http://projectcrucible.org/permalink/1") + self.assertEqual(inst.setup.action[1].assert_fhir.message, "HTTP 204") + self.assertEqual(inst.setup.action[1].assert_fhir.result, "pass") + self.assertEqual(inst.setup.action[2].operation.detail, "http://projectcrucible.org/permalink/1") + self.assertEqual(inst.setup.action[2].operation.message, "POST Patient/fixture-patient-create") + self.assertEqual(inst.setup.action[2].operation.result, "pass") + self.assertEqual(inst.setup.action[3].assert_fhir.detail, "http://projectcrucible.org/permalink/1") + self.assertEqual(inst.setup.action[3].assert_fhir.message, "HTTP 201") + self.assertEqual(inst.setup.action[3].assert_fhir.result, "pass") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.teardown.action[0].operation.detail, "http://projectcrucible.org/permalink/3") + self.assertEqual(inst.teardown.action[0].operation.message, "DELETE Patient/fixture-patient-create.") + self.assertEqual(inst.teardown.action[0].operation.result, "pass") + self.assertEqual(inst.test[0].action[0].operation.detail, "http://projectcrucible.org/permalink/2") + self.assertEqual(inst.test[0].action[0].operation.message, "GET Patient/fixture-patient-create") + self.assertEqual(inst.test[0].action[0].operation.result, "pass") + self.assertEqual(inst.test[0].action[1].assert_fhir.detail, "http://projectcrucible.org/permalink/2") + self.assertEqual(inst.test[0].action[1].assert_fhir.message, "HTTP 200") + self.assertEqual(inst.test[0].action[1].assert_fhir.result, "pass") + self.assertEqual(inst.test[0].action[2].assert_fhir.detail, "http://projectcrucible.org/permalink/2") + self.assertEqual(inst.test[0].action[2].assert_fhir.message, "Last-Modified Present") + self.assertEqual(inst.test[0].action[2].assert_fhir.result, "pass") + self.assertEqual(inst.test[0].action[3].assert_fhir.detail, "http://projectcrucible.org/permalink/2") + self.assertEqual(inst.test[0].action[3].assert_fhir.message, "Response is Patient") + self.assertEqual(inst.test[0].action[3].assert_fhir.result, "pass") + self.assertEqual(inst.test[0].action[4].assert_fhir.detail, "http://projectcrucible.org/permalink/2") + self.assertEqual(inst.test[0].action[4].assert_fhir.message, "Response validates") + self.assertEqual(inst.test[0].action[4].assert_fhir.result, "pass") + self.assertEqual(inst.test[0].action[5].assert_fhir.detail, "http://projectcrucible.org/permalink/2") + self.assertEqual(inst.test[0].action[5].assert_fhir.message, "Patient.name.family 'Chalmers'") + self.assertEqual(inst.test[0].action[5].assert_fhir.result, "pass") + self.assertEqual(inst.test[0].action[6].assert_fhir.detail, "http://projectcrucible.org/permalink/2") + self.assertEqual(inst.test[0].action[6].assert_fhir.message, "Patient.name.given 'Peter'") + self.assertEqual(inst.test[0].action[6].assert_fhir.result, "pass") + self.assertEqual(inst.test[0].action[7].assert_fhir.detail, "http://projectcrucible.org/permalink/2") + self.assertEqual(inst.test[0].action[7].assert_fhir.message, "Patient.name.family 'Chalmers'") + self.assertEqual(inst.test[0].action[7].assert_fhir.result, "pass") + self.assertEqual(inst.test[0].action[8].assert_fhir.detail, "http://projectcrucible.org/permalink/2") + self.assertEqual(inst.test[0].action[8].assert_fhir.message, "Patient.name.family 'Chalmers'") + self.assertEqual(inst.test[0].action[8].assert_fhir.result, "pass") + self.assertEqual(inst.test[0].action[9].assert_fhir.detail, "http://projectcrucible.org/permalink/2") + self.assertEqual(inst.test[0].action[9].assert_fhir.message, "Patient expected values.") + self.assertEqual(inst.test[0].action[9].assert_fhir.result, "pass") + 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.tester, "HL7 Execution Engine") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/STU3/testscript.py b/fhirclient/models/STU3/testscript.py new file mode 100644 index 000000000..39c987f78 --- /dev/null +++ b/fhirclient/models/STU3/testscript.py @@ -0,0 +1,1353 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/TestScript) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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. + """ + + resource_type = "TestScript" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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.description = None + """ Natural language description of the test script. + Type `str`. """ + + self.destination = None + """ An abstract server representing a destination or receiver in a + message exchange. + List of `TestScriptDestination` items (represented as `dict` in JSON). """ + + self.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.fixture = None + """ Fixture in the test script - by reference (uri). + List of `TestScriptFixture` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Additional identifier for the test script. + Type `Identifier` (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ Intended jurisdiction for test script (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.metadata = None + """ Required capability that is assumed to function correctly on the + FHIR server being tested. + Type `TestScriptMetadata` (represented as `dict` in JSON). """ + + self.name = None + """ Name for this test script (computer friendly). + Type `str`. """ + + self.origin = None + """ An abstract server representing a client or sender in a message + exchange. + List of `TestScriptOrigin` items (represented as `dict` in JSON). """ + + self.profile = None + """ Reference of the validation profile. + List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ 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). """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.teardown = None + """ A series of required clean up steps. + Type `TestScriptTeardown` (represented as `dict` in JSON). """ + + self.test = None + """ A test in this script. + List of `TestScriptTest` items (represented as `dict` in JSON). """ + + self.title = None + """ Name for this test script (human friendly). + Type `str`. """ + + self.url = None + """ Logical URI to reference this test script (globally unique). + Type `str`. """ + + self.useContext = None + """ Context the content is intended to support. + List of `UsageContext` items (represented as `dict` in JSON). """ + + self.variable = None + """ Placeholder for evaluated elements. + List of `TestScriptVariable` items (represented as `dict` in JSON). """ + + self.version = None + """ Business version of the test script. + Type `str`. """ + + super(TestScript, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScript, self).elementProperties() + js.extend([ + ("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), + ("destination", "destination", TestScriptDestination, True, None, False), + ("experimental", "experimental", bool, False, None, False), + ("fixture", "fixture", TestScriptFixture, True, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("metadata", "metadata", TestScriptMetadata, False, None, False), + ("name", "name", str, False, None, True), + ("origin", "origin", TestScriptOrigin, True, None, False), + ("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), + ("test", "test", TestScriptTest, True, None, False), + ("title", "title", str, False, None, False), + ("url", "url", str, False, None, True), + ("useContext", "useContext", usagecontext.UsageContext, True, None, False), + ("variable", "variable", TestScriptVariable, True, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class TestScriptDestination(backboneelement.BackboneElement): + """ An abstract server representing a destination or receiver in a message + exchange. + + An abstract server used in operations within this test script in the + destination element. + """ + + resource_type = "TestScriptDestination" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.index = None + """ The index of the abstract destination server starting at 1. + Type `int`. """ + + self.profile = None + """ FHIR-Server | FHIR-SDC-FormManager | FHIR-SDC-FormReceiver | FHIR- + SDC-FormProcessor. + Type `Coding` (represented as `dict` in JSON). """ + + super(TestScriptDestination, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScriptDestination, self).elementProperties() + js.extend([ + ("index", "index", int, False, None, True), + ("profile", "profile", coding.Coding, False, None, True), + ]) + return js + + +class TestScriptFixture(backboneelement.BackboneElement): + """ Fixture in the test script - by reference (uri). + + Fixture in the test script - by reference (uri). All fixtures are required + for the test script to execute. + """ + + resource_type = "TestScriptFixture" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.autocreate = None + """ Whether or not to implicitly create the fixture during setup. + Type `bool`. """ + + self.autodelete = None + """ Whether or not to implicitly delete the fixture during teardown. + Type `bool`. """ + + self.resource = None + """ Reference of the resource. + Type `FHIRReference` referencing `Resource` (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), + ("resource", "resource", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +class TestScriptMetadata(backboneelement.BackboneElement): + """ Required capability that is assumed to function correctly on the FHIR + server being tested. + + The required capability must exist and are assumed to function correctly on + the FHIR server being tested. + """ + + resource_type = "TestScriptMetadata" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Capabilities that are assumed to function correctly on the FHIR + server being tested. + List of `TestScriptMetadataCapability` items (represented as `dict` in JSON). """ + + self.link = None + """ Links to the FHIR specification. + List of `TestScriptMetadataLink` items (represented as `dict` in JSON). """ + + super(TestScriptMetadata, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScriptMetadata, self).elementProperties() + js.extend([ + ("capability", "capability", TestScriptMetadataCapability, True, None, True), + ("link", "link", TestScriptMetadataLink, True, None, False), + ]) + return js + + +class TestScriptMetadataCapability(backboneelement.BackboneElement): + """ Capabilities that are assumed to function correctly on the FHIR server + being tested. + + Capabilities that must exist and are assumed to function correctly on the + FHIR server being tested. + """ + + resource_type = "TestScriptMetadataCapability" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.capabilities = None + """ Required Capability Statement. + Type `FHIRReference` referencing `CapabilityStatement` (represented as `dict` in JSON). """ + + self.description = None + """ The expected capabilities of the server. + Type `str`. """ + + self.destination = None + """ Which server these requirements apply to. + Type `int`. """ + + self.link = None + """ Links to the FHIR specification. + List of `str` items. """ + + self.origin = None + """ Which origin server these requirements apply to. + List of `int` items. """ + + self.required = None + """ Are the capabilities required?. + Type `bool`. """ + + self.validated = None + """ Are the capabilities validated?. + Type `bool`. """ + + super(TestScriptMetadataCapability, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScriptMetadataCapability, self).elementProperties() + js.extend([ + ("capabilities", "capabilities", fhirreference.FHIRReference, 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), + ]) + return js + + +class TestScriptMetadataLink(backboneelement.BackboneElement): + """ Links to the FHIR specification. + + A link to the FHIR specification that this test is covering. + """ + + resource_type = "TestScriptMetadataLink" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Short description. + Type `str`. """ + + self.url = None + """ URL to the specification. + Type `str`. """ + + super(TestScriptMetadataLink, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScriptMetadataLink, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, False), + ("url", "url", str, False, None, True), + ]) + return js + + +class TestScriptOrigin(backboneelement.BackboneElement): + """ An abstract server representing a client or sender in a message exchange. + + An abstract server used in operations within this test script in the origin + element. + """ + + resource_type = "TestScriptOrigin" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.index = None + """ The index of the abstract origin server starting at 1. + Type `int`. """ + + self.profile = None + """ FHIR-Client | FHIR-SDC-FormFiller. + Type `Coding` (represented as `dict` in JSON). """ + + super(TestScriptOrigin, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScriptOrigin, self).elementProperties() + js.extend([ + ("index", "index", int, False, None, True), + ("profile", "profile", coding.Coding, False, None, True), + ]) + 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. + """ + + resource_type = "TestScriptSetup" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ A setup operation or assert to perform. + List of `TestScriptSetupAction` items (represented as `dict` in JSON). """ + + super(TestScriptSetup, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScriptSetup, self).elementProperties() + js.extend([ + ("action", "action", TestScriptSetupAction, True, None, True), + ]) + return js + + +class TestScriptSetupAction(backboneelement.BackboneElement): + """ A setup operation or assert to perform. + + Action would contain either an operation or an assertion. + """ + + resource_type = "TestScriptSetupAction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.assert_fhir = None + """ The assertion to perform. + Type `TestScriptSetupActionAssert` (represented as `dict` in JSON). """ + + self.operation = None + """ The setup operation to perform. + Type `TestScriptSetupActionOperation` (represented as `dict` in JSON). """ + + super(TestScriptSetupAction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScriptSetupAction, self).elementProperties() + js.extend([ + ("assert_fhir", "assert", TestScriptSetupActionAssert, False, None, False), + ("operation", "operation", TestScriptSetupActionOperation, False, None, False), + ]) + return js + + +class TestScriptSetupActionAssert(backboneelement.BackboneElement): + """ The assertion to perform. + + Evaluates the results of previous operations to determine if the server + under test behaves appropriately. + """ + + resource_type = "TestScriptSetupActionAssert" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.compareToSourceExpression = None + """ The fluentpath expression to evaluate against the source fixture. + Type `str`. """ + + self.compareToSourceId = None + """ Id of the source fixture to be evaluated. + Type `str`. """ + + self.compareToSourcePath = None + """ XPath or JSONPath expression to evaluate against the source fixture. + Type `str`. """ + + self.contentType = None + """ xml | json | ttl | none. + Type `str`. """ + + self.description = None + """ Tracking/reporting assertion description. + Type `str`. """ + + self.direction = None + """ response | request. + Type `str`. """ + + self.expression = None + """ The fluentpath expression to be evaluated. + Type `str`. """ + + self.headerField = None + """ HTTP header field name. + Type `str`. """ + + self.label = None + """ Tracking/logging assertion label. + Type `str`. """ + + self.minimumId = None + """ Fixture Id of minimum content resource. + Type `str`. """ + + self.navigationLinks = None + """ Perform validation on navigation links?. + Type `bool`. """ + + self.operator = None + """ equals | notEquals | in | notIn | greaterThan | lessThan | empty | + notEmpty | contains | notContains | eval. + Type `str`. """ + + self.path = None + """ XPath or JSONPath expression. + Type `str`. """ + + self.requestMethod = None + """ delete | get | options | patch | post | put. + Type `str`. """ + + self.requestURL = None + """ Request URL comparison value. + Type `str`. """ + + self.resource = None + """ Resource type. + Type `str`. """ + + self.response = None + """ okay | created | noContent | notModified | bad | forbidden | + notFound | methodNotAllowed | conflict | gone | preconditionFailed + | unprocessable. + Type `str`. """ + + self.responseCode = None + """ 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`. """ + + self.validateProfileId = None + """ Profile Id of validation profile reference. + Type `str`. """ + + self.value = None + """ The value to compare to. + Type `str`. """ + + self.warningOnly = None + """ Will this assert produce a warning only on error?. + Type `bool`. """ + + super(TestScriptSetupActionAssert, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScriptSetupActionAssert, self).elementProperties() + js.extend([ + ("compareToSourceExpression", "compareToSourceExpression", str, False, None, False), + ("compareToSourceId", "compareToSourceId", str, False, None, False), + ("compareToSourcePath", "compareToSourcePath", str, False, None, False), + ("contentType", "contentType", str, False, None, False), + ("description", "description", str, False, None, False), + ("direction", "direction", str, False, None, False), + ("expression", "expression", str, False, None, False), + ("headerField", "headerField", str, False, None, False), + ("label", "label", str, False, None, False), + ("minimumId", "minimumId", str, False, None, False), + ("navigationLinks", "navigationLinks", bool, False, None, False), + ("operator", "operator", str, False, None, False), + ("path", "path", str, False, None, False), + ("requestMethod", "requestMethod", str, False, None, False), + ("requestURL", "requestURL", str, False, None, False), + ("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), + ]) + return js + + +class TestScriptSetupActionOperation(backboneelement.BackboneElement): + """ The setup operation to perform. + + The operation to perform. + """ + + resource_type = "TestScriptSetupActionOperation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.accept = None + """ xml | json | ttl | none. + Type `str`. """ + + self.contentType = None + """ xml | json | ttl | none. + Type `str`. """ + + self.description = None + """ Tracking/reporting operation description. + Type `str`. """ + + self.destination = None + """ Server responding to the request. + Type `int`. """ + + self.encodeRequestUrl = None + """ Whether or not to send the request url in encoded format. + Type `bool`. """ + + self.label = None + """ Tracking/logging operation label. + Type `str`. """ + + self.origin = None + """ Server initiating the request. + Type `int`. """ + + self.params = None + """ Explicitly defined path parameters. + Type `str`. """ + + self.requestHeader = None + """ Each operation can have one or more header elements. + List of `TestScriptSetupActionOperationRequestHeader` items (represented as `dict` in JSON). """ + + self.requestId = None + """ Fixture Id of mapped request. + Type `str`. """ + + self.resource = None + """ Resource type. + Type `str`. """ + + self.responseId = None + """ Fixture Id of mapped response. + Type `str`. """ + + self.sourceId = None + """ Fixture Id of body for PUT and POST requests. + Type `str`. """ + + self.targetId = None + """ Id of fixture used for extracting the [id], [type], and [vid] for + GET requests. + Type `str`. """ + + self.type = None + """ The operation code type that will be executed. + Type `Coding` (represented as `dict` in JSON). """ + + self.url = None + """ Request URL. + Type `str`. """ + + super(TestScriptSetupActionOperation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScriptSetupActionOperation, self).elementProperties() + js.extend([ + ("accept", "accept", str, False, None, False), + ("contentType", "contentType", str, False, None, False), + ("description", "description", str, False, None, False), + ("destination", "destination", int, False, None, False), + ("encodeRequestUrl", "encodeRequestUrl", bool, False, None, False), + ("label", "label", str, False, None, False), + ("origin", "origin", int, False, None, False), + ("params", "params", str, False, None, False), + ("requestHeader", "requestHeader", TestScriptSetupActionOperationRequestHeader, True, None, False), + ("requestId", "requestId", str, False, None, False), + ("resource", "resource", str, False, None, False), + ("responseId", "responseId", str, False, None, False), + ("sourceId", "sourceId", str, False, None, False), + ("targetId", "targetId", str, False, None, False), + ("type", "type", coding.Coding, False, None, False), + ("url", "url", str, False, None, False), + ]) + return js + + +class TestScriptSetupActionOperationRequestHeader(backboneelement.BackboneElement): + """ Each operation can have one or more header elements. + + Header elements would be used to set HTTP headers. + """ + + resource_type = "TestScriptSetupActionOperationRequestHeader" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.field = None + """ HTTP header field name. + Type `str`. """ + + self.value = None + """ HTTP headerfield value. + Type `str`. """ + + super(TestScriptSetupActionOperationRequestHeader, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScriptSetupActionOperationRequestHeader, self).elementProperties() + js.extend([ + ("field", "field", str, False, None, True), + ("value", "value", str, False, None, True), + ]) + return js + + +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 + executed (successfully or otherwise). + """ + + resource_type = "TestScriptTeardown" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ One or more teardown operations to perform. + List of `TestScriptTeardownAction` items (represented as `dict` in JSON). """ + + super(TestScriptTeardown, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScriptTeardown, self).elementProperties() + js.extend([ + ("action", "action", TestScriptTeardownAction, True, None, True), + ]) + return js + + +class TestScriptTeardownAction(backboneelement.BackboneElement): + """ One or more teardown operations to perform. + + The teardown action will only contain an operation. + """ + + resource_type = "TestScriptTeardownAction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.operation = None + """ The teardown operation to perform. + Type `TestScriptSetupActionOperation` (represented as `dict` in JSON). """ + + super(TestScriptTeardownAction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScriptTeardownAction, self).elementProperties() + js.extend([ + ("operation", "operation", TestScriptSetupActionOperation, False, None, True), + ]) + return js + + +class TestScriptTest(backboneelement.BackboneElement): + """ A test in this script. + """ + + resource_type = "TestScriptTest" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ A test operation or assert to perform. + List of `TestScriptTestAction` items (represented as `dict` in JSON). """ + + self.description = None + """ Tracking/reporting short description of the test. + Type `str`. """ + + self.name = None + """ Tracking/logging name of this test. + Type `str`. """ + + super(TestScriptTest, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScriptTest, self).elementProperties() + js.extend([ + ("action", "action", TestScriptTestAction, True, None, True), + ("description", "description", str, False, None, False), + ("name", "name", str, False, None, False), + ]) + return js + + +class TestScriptTestAction(backboneelement.BackboneElement): + """ A test operation or assert to perform. + + Action would contain either an operation or an assertion. + """ + + resource_type = "TestScriptTestAction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.assert_fhir = None + """ The setup assertion to perform. + Type `TestScriptSetupActionAssert` (represented as `dict` in JSON). """ + + self.operation = None + """ The setup operation to perform. + Type `TestScriptSetupActionOperation` (represented as `dict` in JSON). """ + + super(TestScriptTestAction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScriptTestAction, self).elementProperties() + js.extend([ + ("assert_fhir", "assert", TestScriptSetupActionAssert, False, None, False), + ("operation", "operation", TestScriptSetupActionOperation, False, None, False), + ]) + return js + + +class TestScriptVariable(backboneelement.BackboneElement): + """ Placeholder for evaluated elements. + + Variable is set based either on element value in response body or on header + field value in the response headers. + """ + + resource_type = "TestScriptVariable" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.defaultValue = None + """ Default, hard-coded, or user-defined value for this variable. + Type `str`. """ + + self.description = None + """ Natural language description of the variable. + Type `str`. """ + + self.expression = None + """ The fluentpath expression against the fixture body. + Type `str`. """ + + self.headerField = None + """ HTTP header field name for source. + Type `str`. """ + + self.hint = None + """ Hint help text for default value to enter. + Type `str`. """ + + self.name = None + """ Descriptive name for this variable. + Type `str`. """ + + self.path = None + """ XPath or JSONPath against the fixture body. + Type `str`. """ + + self.sourceId = None + """ Fixture Id of source expression or headerField within this variable. + Type `str`. """ + + super(TestScriptVariable, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TestScriptVariable, self).elementProperties() + js.extend([ + ("defaultValue", "defaultValue", str, False, None, False), + ("description", "description", str, False, None, False), + ("expression", "expression", str, False, None, False), + ("headerField", "headerField", str, False, None, False), + ("hint", "hint", str, False, None, False), + ("name", "name", str, False, None, True), + ("path", "path", str, False, None, False), + ("sourceId", "sourceId", str, 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 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 usagecontext +except ImportError: + usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/STU3/testscript_tests.py b/fhirclient/models/STU3/testscript_tests.py new file mode 100644 index 000000000..34bda10ad --- /dev/null +++ b/fhirclient/models/STU3/testscript_tests.py @@ -0,0 +1,817 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import testscript +from .fhirdate import FHIRDate + + +class TestScriptTests(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("TestScript", js["resourceType"]) + return testscript.TestScript(js) + + def testTestScript1(self): + inst = self.instantiate_from("testscript-example-multisystem.json") + self.assertIsNotNone(inst, "Must have instantiated a TestScript instance") + self.implTestScript1(inst) + + js = inst.as_json() + self.assertEqual("TestScript", js["resourceType"]) + inst2 = testscript.TestScript(js) + 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.assertEqual(inst.destination[0].index, 1) + self.assertEqual(inst.destination[0].profile.code, "FHIR-Server") + self.assertEqual(inst.destination[1].index, 2) + self.assertEqual(inst.destination[1].profile.code, "FHIR-Server") + self.assertTrue(inst.experimental) + self.assertEqual(inst.id, "testscript-example-multisystem") + 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.9878") + 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].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].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") + self.assertEqual(inst.metadata.capability[1].origin[0], 1) + self.assertTrue(inst.metadata.capability[1].required) + self.assertFalse(inst.metadata.capability[1].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-multisystem") + self.assertEqual(inst.origin[0].index, 1) + self.assertEqual(inst.origin[0].profile.code, "FHIR-Client") + 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.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.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[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.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.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.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.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.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") + self.assertEqual(inst.test[1].action[0].operation.accept, "xml") + 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.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[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.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.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.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.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") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "Multisystem Test Script") + self.assertEqual(inst.url, "http://hl7.org/fhir/TestScript/testscript-example-multisystem") + self.assertEqual(inst.variable[0].defaultValue, "example") + self.assertEqual(inst.variable[0].name, "Dest1PatientResourceId") + self.assertEqual(inst.variable[1].defaultValue, "example") + self.assertEqual(inst.variable[1].name, "Dest2PatientResourceId") + self.assertEqual(inst.version, "1.0") + + def testTestScript2(self): + inst = self.instantiate_from("testscript-example-history.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") + 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 testTestScript3(self): + inst = self.instantiate_from("testscript-example-update.json") + self.assertIsNotNone(inst, "Must have instantiated a TestScript instance") + self.implTestScript3(inst) + + js = inst.as_json() + self.assertEqual("TestScript", js["resourceType"]) + inst2 = testscript.TestScript(js) + self.implTestScript3(inst2) + + 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") + 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 testTestScript4(self): + inst = self.instantiate_from("testscript-example-rule.json") + self.assertIsNotNone(inst, "Must have instantiated a TestScript instance") + self.implTestScript4(inst) + + js = inst.as_json() + self.assertEqual("TestScript", js["resourceType"]) + inst2 = testscript.TestScript(js) + self.implTestScript4(inst2) + + 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") + 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-minimum") + self.assertEqual(inst.id, "testscript-example-rule") + 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.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.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") + 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.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.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.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.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[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[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.text.status, "generated") + self.assertEqual(inst.url, "http://hl7.org/fhir/TestScript/testscript-example-rule") + 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): + inst = self.instantiate_from("testscript-example-search.json") + self.assertIsNotNone(inst, "Must have instantiated a TestScript instance") + self.implTestScript5(inst) + + js = inst.as_json() + self.assertEqual("TestScript", js["resourceType"]) + inst2 = testscript.TestScript(js) + self.implTestScript5(inst2) + + 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") + 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 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.assertEqual(inst.fixture[0].id, "fixture-patient-create") + self.assertEqual(inst.id, "testscript-example-search") + 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.9881") + 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 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.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") + self.assertEqual(inst.publisher, "HL7") + 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.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[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.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.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.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.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.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[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.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.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.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.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.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.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.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[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.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.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.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.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.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.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") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.url, "http://hl7.org/fhir/TestScript/testscript-example-search") + self.assertEqual(inst.variable[0].headerField, "Location") + self.assertEqual(inst.variable[0].name, "PatientCreateLocation") + self.assertEqual(inst.variable[0].sourceId, "PatientCreateResponse") + self.assertEqual(inst.variable[1].description, "Enter patient search criteria for a known family name on the target system") + self.assertEqual(inst.variable[1].hint, "[Family name]") + self.assertEqual(inst.variable[1].name, "PatientSearchFamilyName") + self.assertEqual(inst.variable[2].description, "Enter patient search criteria for a known given name on the target system") + self.assertEqual(inst.variable[2].hint, "[Given name]") + self.assertEqual(inst.variable[2].name, "PatientSearchGivenName") + self.assertEqual(inst.variable[3].description, "Evaluate the returned Patient searchset Bundle.total value") + self.assertEqual(inst.variable[3].expression, "Bundle.total.toInteger()") + self.assertEqual(inst.variable[3].name, "PatientSearchBundleTotal") + self.assertEqual(inst.version, "1.0") + + def testTestScript6(self): + inst = self.instantiate_from("testscript-example.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 read the created 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") + 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.9876") + 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.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") + self.assertEqual(inst.publisher, "HL7") + 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.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.description, "Read the created patient resource on the test server using the id from fixture-patient-create. Verify contents.") + 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[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.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.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.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.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[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.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.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.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.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.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.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.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) + 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.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].valueCodeableConcept.coding[0].code, "positive") + self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].system, "http://hl7.org/fhir/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 testTestScript7(self): + inst = self.instantiate_from("testscript-example-readtest.json") + self.assertIsNotNone(inst, "Must have instantiated a TestScript instance") + self.implTestScript7(inst) + + js = inst.as_json() + self.assertEqual("TestScript", js["resourceType"]) + inst2 = testscript.TestScript(js) + self.implTestScript7(inst2) + + def implTestScript7(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].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.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.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://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].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.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/STU3/timing.py b/fhirclient/models/STU3/timing.py new file mode 100644 index 000000000..9b364b2b3 --- /dev/null +++ b/fhirclient/models/STU3/timing.py @@ -0,0 +1,184 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Timing) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class Timing(element.Element): + """ A timing schedule that specifies an event that may occur multiple times. + + Specifies an event that may occur multiple times. Timing schedules are used + to record when things are planned, expected or requested to occur. The most + common usage is in dosage instructions for medications. They are also used + when planning care of various kinds, and may be used for reporting the + schedule to which past regular activities were carried out. + """ + + resource_type = "Timing" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ BID | TID | QID | AM | PM | QD | QOD | Q4H | Q6H +. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.event = None + """ When the event occurs. + List of `FHIRDate` items (represented as `str` in JSON). """ + + self.repeat = None + """ When the event is to occur. + Type `TimingRepeat` (represented as `dict` in JSON). """ + + super(Timing, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Timing, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("event", "event", fhirdate.FHIRDate, True, None, False), + ("repeat", "repeat", TimingRepeat, False, None, False), + ]) + return js + + +class TimingRepeat(element.Element): + """ When the event is to occur. + + A set of rules that describe when the event is scheduled. + """ + + resource_type = "TimingRepeat" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.boundsDuration = None + """ Length/Range of lengths, or (Start and/or end) limits. + Type `Duration` (represented as `dict` in JSON). """ + + self.boundsPeriod = None + """ Length/Range of lengths, or (Start and/or end) limits. + Type `Period` (represented as `dict` in JSON). """ + + self.boundsRange = None + """ Length/Range of lengths, or (Start and/or end) limits. + Type `Range` (represented as `dict` in JSON). """ + + self.count = None + """ Number of times to repeat. + Type `int`. """ + + self.countMax = None + """ Maximum number of times to repeat. + Type `int`. """ + + self.dayOfWeek = None + """ mon | tue | wed | thu | fri | sat | sun. + List of `str` items. """ + + self.duration = None + """ How long when it happens. + Type `float`. """ + + self.durationMax = None + """ How long when it happens (Max). + Type `float`. """ + + self.durationUnit = None + """ s | min | h | d | wk | mo | a - unit of time (UCUM). + Type `str`. """ + + self.frequency = None + """ Event occurs frequency times per period. + Type `int`. """ + + self.frequencyMax = None + """ Event occurs up to frequencyMax times per period. + Type `int`. """ + + self.offset = None + """ Minutes from event (before or after). + Type `int`. """ + + self.period = None + """ Event occurs frequency times per period. + Type `float`. """ + + self.periodMax = None + """ Upper limit of period (3-4 hours). + Type `float`. """ + + self.periodUnit = None + """ s | min | h | d | wk | mo | a - unit of time (UCUM). + Type `str`. """ + + self.timeOfDay = None + """ Time of day for action. + List of `FHIRDate` items (represented as `str` in JSON). """ + + self.when = None + """ Regular life events the event is tied to. + List of `str` items. """ + + super(TimingRepeat, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TimingRepeat, self).elementProperties() + js.extend([ + ("boundsDuration", "boundsDuration", duration.Duration, False, "bounds", False), + ("boundsPeriod", "boundsPeriod", period.Period, False, "bounds", False), + ("boundsRange", "boundsRange", range.Range, False, "bounds", False), + ("count", "count", int, False, None, False), + ("countMax", "countMax", int, False, None, False), + ("dayOfWeek", "dayOfWeek", str, True, None, False), + ("duration", "duration", float, False, None, False), + ("durationMax", "durationMax", float, False, None, False), + ("durationUnit", "durationUnit", str, False, None, False), + ("frequency", "frequency", int, False, None, False), + ("frequencyMax", "frequencyMax", int, False, None, False), + ("offset", "offset", int, False, None, False), + ("period", "period", float, False, None, False), + ("periodMax", "periodMax", float, False, None, False), + ("periodUnit", "periodUnit", str, False, None, False), + ("timeOfDay", "timeOfDay", fhirdate.FHIRDate, True, None, False), + ("when", "when", str, True, 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 fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] +try: + 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/STU3/triggerdefinition.py b/fhirclient/models/STU3/triggerdefinition.py new file mode 100644 index 000000000..0860038a6 --- /dev/null +++ b/fhirclient/models/STU3/triggerdefinition.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/TriggerDefinition) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +class TriggerDefinition(element.Element): + """ Defines an expected trigger for a module. + + A description of a triggering event. + """ + + resource_type = "TriggerDefinition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :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.eventName = None + """ Triggering event name. + Type `str`. """ + + self.eventTimingDate = None + """ Timing of the event. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.eventTimingDateTime = None + """ Timing of the event. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.eventTimingReference = None + """ Timing of the event. + Type `FHIRReference` referencing `Schedule` (represented as `dict` in JSON). """ + + self.eventTimingTiming = 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. + Type `str`. """ + + super(TriggerDefinition, self).__init__(jsondict=jsondict, strict=strict) + + 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), + ("type", "type", str, False, None, True), + ]) + return js + + +import sys +try: + from . import datarequirement +except ImportError: + datarequirement = sys.modules[__package__ + '.datarequirement'] +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 timing +except ImportError: + timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/STU3/usagecontext.py b/fhirclient/models/STU3/usagecontext.py new file mode 100644 index 000000000..9df38538c --- /dev/null +++ b/fhirclient/models/STU3/usagecontext.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/UsageContext) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import element + +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, + 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). + """ + + resource_type = "UsageContext" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 context being specified. + Type `Coding` (represented as `dict` in JSON). """ + + self.valueCodeableConcept = None + """ Value that defines the context. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueQuantity = None + """ Value that defines the context. + Type `Quantity` (represented as `dict` in JSON). """ + + self.valueRange = None + """ Value that defines the context. + Type `Range` (represented as `dict` in JSON). """ + + super(UsageContext, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(UsageContext, self).elementProperties() + js.extend([ + ("code", "code", coding.Coding, False, None, True), + ("valueCodeableConcept", "valueCodeableConcept", codeableconcept.CodeableConcept, False, "value", True), + ("valueQuantity", "valueQuantity", quantity.Quantity, False, "value", True), + ("valueRange", "valueRange", range.Range, False, "value", 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 quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] +try: + from . import range +except ImportError: + range = sys.modules[__package__ + '.range'] diff --git a/fhirclient/models/STU3/valueset.py b/fhirclient/models/STU3/valueset.py new file mode 100644 index 000000000..da5f88710 --- /dev/null +++ b/fhirclient/models/STU3/valueset.py @@ -0,0 +1,562 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ValueSet) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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. + """ + + resource_type = "ValueSet" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.compose = None + """ Definition of the content of the value set (CLD). + Type `ValueSetCompose` (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 this was last changed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Natural language description of the value set. + Type `str`. """ + + self.expansion = None + """ Used when the value set is "expanded". + Type `ValueSetExpansion` (represented as `dict` in JSON). """ + + self.experimental = None + """ 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. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.immutable = None + """ Indicates whether or not any change to the content logical + definition may occur. + Type `bool`. """ + + self.jurisdiction = None + """ Intended jurisdiction for value set (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.name = None + """ Name for this value set (computer friendly). + Type `str`. """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this value set is defined. + Type `str`. """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.title = None + """ Name for this value set (human friendly). + Type `str`. """ + + self.url = None + """ Logical URI to reference this value set (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 value set. + Type `str`. """ + + super(ValueSet, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ValueSet, self).elementProperties() + js.extend([ + ("compose", "compose", ValueSetCompose, False, 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), + ("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), + ("name", "name", str, False, None, False), + ("publisher", "publisher", str, False, None, False), + ("purpose", "purpose", str, False, None, False), + ("status", "status", str, False, None, True), + ("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 ValueSetCompose(backboneelement.BackboneElement): + """ Definition of the content 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). + """ + + resource_type = "ValueSetCompose" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 + """ Explicitly exclude codes from a code system or other value sets. + List of `ValueSetComposeInclude` items (represented as `dict` in JSON). """ + + self.inactive = None + """ Whether inactive codes are in the value set. + Type `bool`. """ + + self.include = None + """ Include one or more codes from a code system or other value set(s). + List of `ValueSetComposeInclude` items (represented as `dict` in JSON). """ + + self.lockedDate = None + """ Fixed date for version-less references (transitive). + Type `FHIRDate` (represented as `str` in JSON). """ + + super(ValueSetCompose, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ValueSetCompose, self).elementProperties() + js.extend([ + ("exclude", "exclude", ValueSetComposeInclude, True, None, False), + ("inactive", "inactive", bool, False, None, False), + ("include", "include", ValueSetComposeInclude, True, None, True), + ("lockedDate", "lockedDate", fhirdate.FHIRDate, False, None, False), + ]) + return js + + +class ValueSetComposeInclude(backboneelement.BackboneElement): + """ Include one or more codes from a code system or other value set(s). + """ + + resource_type = "ValueSetComposeInclude" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.concept = None + """ A concept defined in the system. + List of `ValueSetComposeIncludeConcept` items (represented as `dict` in JSON). """ + + self.filter = None + """ Select codes/concepts by their properties (including relationships). + List of `ValueSetComposeIncludeFilter` items (represented as `dict` in JSON). """ + + self.system = None + """ The system the codes come from. + Type `str`. """ + + self.valueSet = None + """ Select only contents included in this value set. + List of `str` items. """ + + self.version = None + """ Specific version of the code system referred to. + Type `str`. """ + + super(ValueSetComposeInclude, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ValueSetComposeInclude, self).elementProperties() + js.extend([ + ("concept", "concept", ValueSetComposeIncludeConcept, True, None, False), + ("filter", "filter", ValueSetComposeIncludeFilter, True, None, False), + ("system", "system", str, False, None, False), + ("valueSet", "valueSet", str, True, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + +class ValueSetComposeIncludeConcept(backboneelement.BackboneElement): + """ A concept defined in the system. + + Specifies a concept to be included or excluded. + """ + + resource_type = "ValueSetComposeIncludeConcept" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 or expression from system. + Type `str`. """ + + self.designation = None + """ Additional representations for this concept. + List of `ValueSetComposeIncludeConceptDesignation` items (represented as `dict` in JSON). """ + + self.display = None + """ Text to display for this code for this value set in this valueset. + Type `str`. """ + + super(ValueSetComposeIncludeConcept, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ValueSetComposeIncludeConcept, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("designation", "designation", ValueSetComposeIncludeConceptDesignation, True, None, False), + ("display", "display", str, False, None, False), + ]) + return js + + +class ValueSetComposeIncludeConceptDesignation(backboneelement.BackboneElement): + """ Additional representations for this concept. + + Additional representations for this concept when used in this value set - + other languages, aliases, specialized purposes, used for particular + purposes, etc. + """ + + resource_type = "ValueSetComposeIncludeConceptDesignation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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. + Type `str`. """ + + self.use = None + """ Details how this designation would be used. + Type `Coding` (represented as `dict` in JSON). """ + + self.value = None + """ The text value for this designation. + Type `str`. """ + + super(ValueSetComposeIncludeConceptDesignation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ValueSetComposeIncludeConceptDesignation, self).elementProperties() + js.extend([ + ("language", "language", str, False, None, False), + ("use", "use", coding.Coding, False, None, False), + ("value", "value", str, False, None, True), + ]) + return js + + +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. + """ + + resource_type = "ValueSetComposeIncludeFilter" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.op = None + """ = | is-a | descendent-of | is-not-a | regex | in | not-in | + generalizes | exists. + Type `str`. """ + + self.property = None + """ A property defined by the code system. + Type `str`. """ + + self.value = None + """ Code from the system, or regex criteria, or boolean value for + exists. + Type `str`. """ + + super(ValueSetComposeIncludeFilter, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ValueSetComposeIncludeFilter, self).elementProperties() + js.extend([ + ("op", "op", str, False, None, True), + ("property", "property", str, False, None, True), + ("value", "value", str, False, None, True), + ]) + return js + + +class ValueSetExpansion(backboneelement.BackboneElement): + """ Used when the value set is "expanded". + + A value set can also be "expanded", where the value set is turned into a + simple collection of enumerated codes. This element holds the expansion, if + it has been performed. + """ + + resource_type = "ValueSetExpansion" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.contains = None + """ Codes in the value set. + List of `ValueSetExpansionContains` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Uniquely identifies this expansion. + Type `str`. """ + + self.offset = None + """ Offset at which this resource starts. + Type `int`. """ + + self.parameter = None + """ Parameter that controlled the expansion process. + List of `ValueSetExpansionParameter` items (represented as `dict` in JSON). """ + + self.timestamp = None + """ Time ValueSet expansion happened. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.total = None + """ Total number of codes in the expansion. + Type `int`. """ + + super(ValueSetExpansion, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ValueSetExpansion, self).elementProperties() + js.extend([ + ("contains", "contains", ValueSetExpansionContains, True, None, False), + ("identifier", "identifier", str, False, None, True), + ("offset", "offset", int, False, None, False), + ("parameter", "parameter", ValueSetExpansionParameter, True, None, False), + ("timestamp", "timestamp", fhirdate.FHIRDate, False, None, True), + ("total", "total", int, False, None, False), + ]) + return js + + +class ValueSetExpansionContains(backboneelement.BackboneElement): + """ Codes in the value set. + + The codes that are contained in the value set expansion. + """ + + resource_type = "ValueSetExpansionContains" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.abstract = None + """ If user cannot select this entry. + Type `bool`. """ + + self.code = None + """ Code - if blank, this is not a selectable code. + Type `str`. """ + + self.contains = None + """ Codes contained under this entry. + List of `ValueSetExpansionContains` items (represented as `dict` in JSON). """ + + self.designation = None + """ Additional representations for this item. + List of `ValueSetComposeIncludeConceptDesignation` items (represented as `dict` in JSON). """ + + self.display = None + """ User display for the concept. + Type `str`. """ + + self.inactive = None + """ If concept is inactive in the code system. + Type `bool`. """ + + self.system = None + """ System value for the code. + Type `str`. """ + + self.version = None + """ Version in which this code/display is defined. + Type `str`. """ + + super(ValueSetExpansionContains, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ValueSetExpansionContains, self).elementProperties() + js.extend([ + ("abstract", "abstract", bool, False, None, False), + ("code", "code", str, False, None, False), + ("contains", "contains", ValueSetExpansionContains, True, None, False), + ("designation", "designation", ValueSetComposeIncludeConceptDesignation, True, None, False), + ("display", "display", str, False, None, False), + ("inactive", "inactive", bool, False, None, False), + ("system", "system", str, False, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + +class ValueSetExpansionParameter(backboneelement.BackboneElement): + """ Parameter that controlled the expansion process. + + A parameter that controlled the expansion process. These parameters may be + used by users of expanded value sets to check whether the expansion is + suitable for a particular purpose, or to pick the correct expansion. + """ + + resource_type = "ValueSetExpansionParameter" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :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 as assigned by the server. + Type `str`. """ + + self.valueBoolean = None + """ Value of the named parameter. + Type `bool`. """ + + self.valueCode = None + """ Value of the named parameter. + Type `str`. """ + + self.valueDecimal = None + """ Value of the named parameter. + Type `float`. """ + + self.valueInteger = None + """ Value of the named parameter. + Type `int`. """ + + self.valueString = None + """ Value of the named parameter. + Type `str`. """ + + self.valueUri = None + """ Value of the named parameter. + Type `str`. """ + + super(ValueSetExpansionParameter, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ValueSetExpansionParameter, self).elementProperties() + js.extend([ + ("name", "name", str, False, None, True), + ("valueBoolean", "valueBoolean", bool, False, "value", False), + ("valueCode", "valueCode", str, False, "value", False), + ("valueDecimal", "valueDecimal", float, False, "value", False), + ("valueInteger", "valueInteger", int, False, "value", False), + ("valueString", "valueString", str, False, "value", False), + ("valueUri", "valueUri", str, False, "value", 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 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/STU3/valueset_tests.py b/fhirclient/models/STU3/valueset_tests.py new file mode 100644 index 000000000..fde08e1f7 --- /dev/null +++ b/fhirclient/models/STU3/valueset_tests.py @@ -0,0 +1,294 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import valueset +from .fhirdate import FHIRDate + + +class ValueSetTests(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("ValueSet", js["resourceType"]) + return valueset.ValueSet(js) + + def testValueSet1(self): + inst = self.instantiate_from("valueset-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ValueSet instance") + self.implValueSet1(inst) + + js = inst.as_json() + self.assertEqual("ValueSet", js["resourceType"]) + inst2 = valueset.ValueSet(js) + 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.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-extensional") + self.assertEqual(inst.version, "20150622") + + def testValueSet2(self): + inst = self.instantiate_from("valueset-example-expansion.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].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].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.expansion.contains[0].code, "14647-2") + self.assertEqual(inst.expansion.contains[0].display, "Cholesterol [Moles/volume] in Serum or Plasma") + self.assertEqual(inst.expansion.contains[0].system, "http://loinc.org") + self.assertEqual(inst.expansion.contains[0].version, "2.50") + self.assertTrue(inst.expansion.contains[1].abstract) + self.assertEqual(inst.expansion.contains[1].contains[0].code, "2093-3") + self.assertEqual(inst.expansion.contains[1].contains[0].display, "Cholesterol [Mass/volume] in Serum or Plasma") + self.assertEqual(inst.expansion.contains[1].contains[0].system, "http://loinc.org") + self.assertEqual(inst.expansion.contains[1].contains[0].version, "2.50") + self.assertEqual(inst.expansion.contains[1].contains[1].code, "48620-9") + self.assertEqual(inst.expansion.contains[1].contains[1].display, "Cholesterol [Mass/volume] in Serum or Plasma ultracentrifugate") + self.assertEqual(inst.expansion.contains[1].contains[1].system, "http://loinc.org") + self.assertEqual(inst.expansion.contains[1].contains[1].version, "2.50") + self.assertEqual(inst.expansion.contains[1].contains[2].code, "9342-7") + self.assertEqual(inst.expansion.contains[1].contains[2].display, "Cholesterol [Percentile]") + self.assertEqual(inst.expansion.contains[1].contains[2].system, "http://loinc.org") + self.assertEqual(inst.expansion.contains[1].contains[2].version, "2.50") + self.assertEqual(inst.expansion.contains[1].display, "Cholesterol codes") + self.assertTrue(inst.expansion.contains[2].abstract) + self.assertEqual(inst.expansion.contains[2].contains[0].code, "2096-6") + self.assertEqual(inst.expansion.contains[2].contains[0].display, "Cholesterol/Triglyceride [Mass Ratio] in Serum or Plasma") + self.assertEqual(inst.expansion.contains[2].contains[0].system, "http://loinc.org") + self.assertEqual(inst.expansion.contains[2].contains[0].version, "2.50") + self.assertEqual(inst.expansion.contains[2].contains[1].code, "35200-5") + self.assertEqual(inst.expansion.contains[2].contains[1].display, "Cholesterol/Triglyceride [Mass Ratio] in Serum or Plasma") + self.assertEqual(inst.expansion.contains[2].contains[1].system, "http://loinc.org") + self.assertEqual(inst.expansion.contains[2].contains[1].version, "2.50") + self.assertEqual(inst.expansion.contains[2].contains[2].code, "48089-7") + self.assertEqual(inst.expansion.contains[2].contains[2].display, "Cholesterol/Apolipoprotein B [Molar ratio] in Serum or Plasma") + self.assertEqual(inst.expansion.contains[2].contains[2].system, "http://loinc.org") + self.assertEqual(inst.expansion.contains[2].contains[2].version, "2.50") + self.assertEqual(inst.expansion.contains[2].contains[3].code, "55838-7") + self.assertEqual(inst.expansion.contains[2].contains[3].display, "Cholesterol/Phospholipid [Molar ratio] in Serum or Plasma") + self.assertEqual(inst.expansion.contains[2].contains[3].system, "http://loinc.org") + self.assertEqual(inst.expansion.contains[2].contains[3].version, "2.50") + self.assertEqual(inst.expansion.contains[2].display, "Cholesterol Ratios") + self.assertEqual(inst.expansion.extension[0].url, "http://hl7.org/fhir/StructureDefinition/valueset-expansionSource") + self.assertEqual(inst.expansion.extension[0].valueUri, "http://hl7.org/fhir/ValueSet/example-extensional") + self.assertEqual(inst.expansion.identifier, "urn:uuid:42316ff8-2714-4680-9980-f37a6d1a71bc") + self.assertEqual(inst.expansion.offset, 0) + self.assertEqual(inst.expansion.parameter[0].name, "version") + self.assertEqual(inst.expansion.parameter[0].valueString, "2.50") + self.assertEqual(inst.expansion.timestamp.date, FHIRDate("2015-06-22T13:56:07Z").date) + self.assertEqual(inst.expansion.timestamp.as_json(), "2015-06-22T13:56:07Z") + self.assertEqual(inst.expansion.total, 8) + self.assertTrue(inst.experimental) + self.assertEqual(inst.id, "example-expansion") + 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, "FHIR Project team") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.url, "http://hl7.org/fhir/ValueSet/example-expansion") + self.assertEqual(inst.version, "20150622") + + def testValueSet3(self): + inst = self.instantiate_from("valueset-example-inactive.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.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.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[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[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].display, "expectation") + self.assertEqual(inst.expansion.contains[1].system, "http://hl7.org/fhir/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.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") + self.assertEqual(inst.id, "inactive") + self.assertEqual(inst.name, "Example-inactive") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "Example with inactive codes") + self.assertEqual(inst.url, "http://hl7.org/fhir/ValueSet/inactive") + + def testValueSet4(self): + inst = self.instantiate_from("valueset-example-yesnodontknow.json") + self.assertIsNotNone(inst, "Must have instantiated a ValueSet instance") + self.implValueSet4(inst) + + js = inst.as_json() + self.assertEqual("ValueSet", js["resourceType"]) + inst2 = valueset.ValueSet(js) + self.implValueSet4(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") + 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.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[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[2].display, "Don't know") + self.assertEqual(inst.expansion.contains[2].system, "http://hl7.org/fhir/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") + self.assertEqual(inst.id, "yesnodontknow") + self.assertEqual(inst.name, "Yes/No/Don't Know") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.url, "http://hl7.org/fhir/ValueSet/yesnodontknow") + + def testValueSet5(self): + inst = self.instantiate_from("valueset-list-example-codes.json") + self.assertIsNotNone(inst, "Must have instantiated a ValueSet instance") + self.implValueSet5(inst) + + js = inst.as_json() + self.assertEqual("ValueSet", js["resourceType"]) + inst2 = valueset.ValueSet(js) + self.implValueSet5(inst2) + + def implValueSet5(self, inst): + self.assertEqual(inst.compose.include[0].system, "http://hl7.org/fhir/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-04-19T07:44:43+10:00").date) + self.assertEqual(inst.date.as_json(), "2017-04-19T07:44:43+10: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.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.assertTrue(inst.immutable) + self.assertEqual(inst.meta.lastUpdated.date, FHIRDate("2017-04-19T07:44:43.294+10:00").date) + self.assertEqual(inst.meta.lastUpdated.as_json(), "2017-04-19T07:44:43.294+10: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.publisher, "FHIR Project") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.url, "http://hl7.org/fhir/ValueSet/list-example-codes") + self.assertEqual(inst.version, "3.0.1") + + def testValueSet6(self): + inst = self.instantiate_from("valueset-example-intensional.json") + self.assertIsNotNone(inst, "Must have instantiated a ValueSet instance") + self.implValueSet6(inst) + + js = inst.as_json() + self.assertEqual("ValueSet", js["resourceType"]) + inst2 = valueset.ValueSet(js) + self.implValueSet6(inst2) + + def implValueSet6(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/STU3/visionprescription.py b/fhirclient/models/STU3/visionprescription.py new file mode 100644 index 000000000..d46964c82 --- /dev/null +++ b/fhirclient/models/STU3/visionprescription.py @@ -0,0 +1,207 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/VisionPrescription) on 2019-10-12. +# 2019, SMART Health IT. + + +from . import domainresource + +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 + patient. + """ + + resource_type = "VisionPrescription" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + 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). """ + + self.identifier = None + """ Business identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.patient = None + """ Who prescription is for. + Type `FHIRReference` referencing `Patient` (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). """ + + self.status = None + """ active | cancelled | draft | entered-in-error. + Type `str`. """ + + super(VisionPrescription, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(VisionPrescription, self).elementProperties() + js.extend([ + ("dateWritten", "dateWritten", fhirdate.FHIRDate, False, None, False), + ("dispense", "dispense", VisionPrescriptionDispense, True, None, False), + ("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), + ]) + return js + + +from . import backboneelement + +class VisionPrescriptionDispense(backboneelement.BackboneElement): + """ Vision supply authorization. + + Deals with details of the dispense part of the supply specification. + """ + + resource_type = "VisionPrescriptionDispense" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.add = None + """ Lens add. + Type `float`. """ + + self.axis = None + """ Lens axis. + 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`. """ + + self.color = None + """ Color required. + Type `str`. """ + + self.cylinder = None + """ Lens cylinder. + Type `float`. """ + + self.diameter = None + """ Contact lens diameter. + Type `float`. """ + + self.duration = None + """ Lens wear duration. + Type `Quantity` (represented as `dict` in JSON). """ + + self.eye = None + """ right | left. + Type `str`. """ + + self.note = None + """ Notes for coatings. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.power = None + """ Contact lens power. + Type `float`. """ + + self.prism = None + """ Lens prism. + Type `float`. """ + + self.product = None + """ Product to be supplied. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.sphere = None + """ Lens sphere. + Type `float`. """ + + super(VisionPrescriptionDispense, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(VisionPrescriptionDispense, 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), + ("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), + ("sphere", "sphere", float, 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 quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/STU3/visionprescription_tests.py b/fhirclient/models/STU3/visionprescription_tests.py new file mode 100644 index 000000000..26d4395fd --- /dev/null +++ b/fhirclient/models/STU3/visionprescription_tests.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 3.0.1.11917 on 2019-10-12. +# 2019, SMART Health IT. + +from __future__ import unicode_literals +import os +import io +import unittest +import json +from . import visionprescription +from .fhirdate import FHIRDate + + +class VisionPrescriptionTests(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("VisionPrescription", js["resourceType"]) + return visionprescription.VisionPrescription(js) + + def testVisionPrescription1(self): + inst = self.instantiate_from("visionprescription-example-1.json") + self.assertIsNotNone(inst, "Must have instantiated a VisionPrescription instance") + self.implVisionPrescription1(inst) + + js = inst.as_json() + self.assertEqual("VisionPrescription", js["resourceType"]) + inst2 = visionprescription.VisionPrescription(js) + self.implVisionPrescription1(inst2) + + def implVisionPrescription1(self, inst): + 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.status, "active") + self.assertEqual(inst.text.div, "
Sample Contract Lens prescription
") + self.assertEqual(inst.text.status, "generated") + + def testVisionPrescription2(self): + inst = self.instantiate_from("visionprescription-example.json") + self.assertIsNotNone(inst, "Must have instantiated a VisionPrescription instance") + self.implVisionPrescription2(inst) + + js = inst.as_json() + self.assertEqual("VisionPrescription", js["resourceType"]) + inst2 = visionprescription.VisionPrescription(js) + self.implVisionPrescription2(inst2) + + def implVisionPrescription2(self, inst): + 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.status, "active") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/account.py b/fhirclient/models/account.py deleted file mode 100644 index 2447ca29f..000000000 --- a/fhirclient/models/account.py +++ /dev/null @@ -1,187 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Account) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class Account(domainresource.DomainResource): - """ Tracks balance, charges, for patient or cost center. - - A financial tool for tracking value accrued for a particular purpose. In - the healthcare field, used to track charges for a patient, cost centers, - etc. - """ - - resource_type = "Account" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - 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. - List of `AccountCoverage` items (represented as `dict` in JSON). """ - - self.description = None - """ Explanation of purpose/use. - Type `str`. """ - - self.guarantor = None - """ The parties ultimately responsible for balancing the Account. - List of `AccountGuarantor` items (represented as `dict` in JSON). """ - - self.identifier = None - """ Account number. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.name = None - """ Human-readable label. - Type `str`. """ - - self.owner = None - """ Entity managing the Account. - Type `FHIRReference` (represented as `dict` in JSON). """ - - 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 | on-hold | unknown. - Type `str`. """ - - self.subject = None - """ The entity that caused the expenses. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.type = None - """ E.g. patient, expense, depreciation. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(Account, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Account, self).elementProperties() - js.extend([ - ("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), - ("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 - - -from . import backboneelement - -class AccountCoverage(backboneelement.BackboneElement): - """ The party(s) that are responsible for covering the payment of this account, - and what order should they be applied to the account. - """ - - resource_type = "AccountCoverage" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.coverage = None - """ 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. - Type `int`. """ - - super(AccountCoverage, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(AccountCoverage, self).elementProperties() - js.extend([ - ("coverage", "coverage", fhirreference.FHIRReference, False, None, True), - ("priority", "priority", int, False, None, False), - ]) - return js - - -class AccountGuarantor(backboneelement.BackboneElement): - """ The parties ultimately responsible for balancing the Account. - - The parties responsible for balancing the account if other payment options - fall short. - """ - - resource_type = "AccountGuarantor" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.onHold = None - """ Credit or other hold applied. - Type `bool`. """ - - self.party = None - """ Responsible entity. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.period = None - """ Guarantee account during. - Type `Period` (represented as `dict` in JSON). """ - - super(AccountGuarantor, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(AccountGuarantor, self).elementProperties() - js.extend([ - ("onHold", "onHold", bool, False, None, False), - ("party", "party", fhirreference.FHIRReference, False, None, True), - ("period", "period", period.Period, 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 period -except ImportError: - period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/account_tests.py b/fhirclient/models/account_tests.py deleted file mode 100644 index b8148e855..000000000 --- a/fhirclient/models/account_tests.py +++ /dev/null @@ -1,91 +0,0 @@ -#!/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 account -from .fhirdate import FHIRDate - - -class AccountTests(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("Account", js["resourceType"]) - return account.Account(js) - - def testAccount1(self): - inst = self.instantiate_from("account-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Account instance") - self.implAccount1(inst) - - js = inst.as_json() - self.assertEqual("Account", js["resourceType"]) - inst2 = account.Account(js) - self.implAccount1(inst2) - - def implAccount1(self, inst): - self.assertEqual(inst.coverage[0].priority, 1) - self.assertEqual(inst.description, "Hospital charges") - 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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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, "
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://terminology.hl7.org/CodeSystem/v3-ActCode") - self.assertEqual(inst.type.text, "patient") - - def testAccount2(self): - inst = self.instantiate_from("account-example-with-guarantor.json") - self.assertIsNotNone(inst, "Must have instantiated a Account instance") - self.implAccount2(inst) - - js = inst.as_json() - self.assertEqual("Account", js["resourceType"]) - inst2 = account.Account(js) - self.implAccount2(inst2) - - def implAccount2(self, inst): - 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.identifier[0].system, "urn:oid:0.1.2.3.4.5.6.7") - 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.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, "
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://terminology.hl7.org/CodeSystem/v3-ActCode") - self.assertEqual(inst.type.text, "patient") - diff --git a/fhirclient/models/activitydefinition.py b/fhirclient/models/activitydefinition.py deleted file mode 100644 index 132df79ff..000000000 --- a/fhirclient/models/activitydefinition.py +++ /dev/null @@ -1,440 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ActivityDefinition) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class ActivityDefinition(domainresource.DomainResource): - """ The definition of a specific activity to be taken, independent of any - particular patient or context. - - This resource allows for the definition of some activity to be performed, - independent of a particular patient, practitioner, or other performance - context. - """ - - resource_type = "ActivityDefinition" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 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). """ - - self.code = None - """ Detail type of activity. - 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.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). """ - - self.dynamicValue = None - """ 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`. """ - - self.identifier = None - """ 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). """ - - self.kind = None - """ Kind of resource. - Type `str`. """ - - self.lastReviewDate = None - """ When the activity definition was last reviewed. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.library = None - """ Logic used by the activity definition. - List of `str` items. """ - - self.location = None - """ Where it should happen. - 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` (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). - Type `str`. """ - - self.purpose = None - """ Why this activity definition is defined. - Type `str`. """ - - self.quantity = None - """ How much is administered/consumed/supplied. - Type `Quantity` (represented as `dict` in JSON). """ - - 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.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). """ - - self.timingRange = None - """ When activity is to occur. - Type `Range` (represented as `dict` in JSON). """ - - self.timingTiming = None - """ When activity is to occur. - Type `Timing` (represented as `dict` in JSON). """ - - self.title = None - """ Name for this activity definition (human friendly). - Type `str`. """ - - self.topic = None - """ E.g. Education, Treatment, Assessment, etc.. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.transform = None - """ Transform to apply the template. - Type `str`. """ - - self.url = None - """ Canonical identifier for this activity definition, represented as a - URI (globally unique). - Type `str`. """ - - self.usage = None - """ Describes the clinical usage of the activity definition. - 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 activity definition. - Type `str`. """ - - super(ActivityDefinition, self).__init__(jsondict=jsondict, strict=strict) - - 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), - ("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", 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", str, False, 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 - - -from . import backboneelement - -class ActivityDefinitionDynamicValue(backboneelement.BackboneElement): - """ Dynamic aspects of the definition. - - Dynamic values that will be evaluated to produce values for elements of the - 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 - request resource that would contain the result. - """ - - resource_type = "ActivityDefinitionDynamicValue" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ An expression that provides the dynamic value for the customization. - Type `Expression` (represented as `dict` in JSON). """ - - self.path = None - """ The path to the element to be set dynamically. - Type `str`. """ - - super(ActivityDefinitionDynamicValue, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ActivityDefinitionDynamicValue, self).elementProperties() - js.extend([ - ("expression", "expression", expression.Expression, False, None, True), - ("path", "path", str, False, None, True), - ]) - return js - - -class ActivityDefinitionParticipant(backboneelement.BackboneElement): - """ Who should participate in the action. - - Indicates who should participate in performing the action described. - """ - - resource_type = "ActivityDefinitionParticipant" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.role = None - """ E.g. Nurse, Surgeon, Parent, etc.. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.type = None - """ patient | practitioner | related-person | device. - Type `str`. """ - - super(ActivityDefinitionParticipant, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ActivityDefinitionParticipant, self).elementProperties() - js.extend([ - ("role", "role", codeableconcept.CodeableConcept, False, None, False), - ("type", "type", str, False, None, True), - ]) - return js - - -import sys -try: - from . import age -except ImportError: - age = sys.modules[__package__ + '.age'] -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 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: - 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 quantity -except ImportError: - quantity = sys.modules[__package__ + '.quantity'] -try: - from . import range -except ImportError: - range = sys.modules[__package__ + '.range'] -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/activitydefinition_tests.py b/fhirclient/models/activitydefinition_tests.py deleted file mode 100644 index beab57bbb..000000000 --- a/fhirclient/models/activitydefinition_tests.py +++ /dev/null @@ -1,404 +0,0 @@ -#!/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 activitydefinition -from .fhirdate import FHIRDate - - -class ActivityDefinitionTests(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("ActivityDefinition", js["resourceType"]) - return activitydefinition.ActivityDefinition(js) - - def testActivityDefinition1(self): - inst = self.instantiate_from("activitydefinition-predecessor-example.json") - self.assertIsNotNone(inst, "Must have instantiated a ActivityDefinition instance") - self.implActivityDefinition1(inst) - - js = inst.as_json() - self.assertEqual("ActivityDefinition", js["resourceType"]) - inst2 = activitydefinition.ActivityDefinition(js) - self.implActivityDefinition1(inst2) - - def implActivityDefinition1(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.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)") - 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") - 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.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.assertTrue(inst.experimental) - 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, "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].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://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://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://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://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://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://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://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 testActivityDefinition2(self): - inst = self.instantiate_from("activitydefinition-medicationorder-example.json") - self.assertIsNotNone(inst, "Must have instantiated a ActivityDefinition instance") - self.implActivityDefinition2(inst) - - js = inst.as_json() - self.assertEqual("ActivityDefinition", js["resourceType"]) - inst2 = activitydefinition.ActivityDefinition(js) - self.implActivityDefinition2(inst2) - - 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") - 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.contained[0].id, "citalopramMedication") - self.assertEqual(inst.contained[1].id, "citalopramSubstance") - 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].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)") - self.assertEqual(inst.dosage[0].text, "1 tablet oral 1 time daily") - 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].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].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") - 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, "citalopramPrescription") - self.assertEqual(inst.identifier[0].system, "http://motivemi.com") - self.assertEqual(inst.identifier[0].use, "official") - self.assertEqual(inst.identifier[0].value, "citalopramPrescription") - 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, "MedicationRequest") - self.assertEqual(inst.lastReviewDate.date, FHIRDate("2016-08-15").date) - self.assertEqual(inst.lastReviewDate.as_json(), "2016-08-15") - self.assertEqual(inst.name, "CitalopramPrescription") - self.assertEqual(inst.publisher, "Motive Medical Intelligence") - self.assertEqual(inst.purpose, "Defines a guideline supported prescription for the treatment of depressive disorders") - 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") - self.assertEqual(inst.title, "Citalopram Prescription") - self.assertEqual(inst.topic[0].text, "Mental Health Treatment") - 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://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://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://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://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://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://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://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-example.json") - self.assertIsNotNone(inst, "Must have instantiated a ActivityDefinition instance") - self.implActivityDefinition3(inst) - - js = inst.as_json() - self.assertEqual("ActivityDefinition", js["resourceType"]) - inst2 = activitydefinition.ActivityDefinition(js) - self.implActivityDefinition3(inst2) - - def implActivityDefinition3(self, inst): - 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)") - 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") - 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.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.assertTrue(inst.experimental) - 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, "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].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://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://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://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://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://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://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://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") - - def testActivityDefinition4(self): - inst = self.instantiate_from("activitydefinition-servicerequest-example.json") - self.assertIsNotNone(inst, "Must have instantiated a ActivityDefinition instance") - self.implActivityDefinition4(inst) - - js = inst.as_json() - self.assertEqual("ActivityDefinition", js["resourceType"]) - inst2 = activitydefinition.ActivityDefinition(js) - self.implActivityDefinition4(inst2) - - def implActivityDefinition4(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].system, "http://snomed.info/sct") - self.assertEqual(inst.description, "Heart valve replacement") - self.assertEqual(inst.id, "heart-valve-replacement") - 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") - self.assertEqual(inst.participant[0].role.text, "Interventional Cardiology") - self.assertEqual(inst.participant[0].type, "practitioner") - self.assertEqual(inst.purpose, "Describes the proposal to perform a Heart Valve replacement.") - self.assertEqual(inst.status, "draft") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.topic[0].coding[0].code, "34068001") - 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://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://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") - - def testActivityDefinition5(self): - inst = self.instantiate_from("activitydefinition-supplyrequest-example.json") - self.assertIsNotNone(inst, "Must have instantiated a ActivityDefinition instance") - self.implActivityDefinition5(inst) - - js = inst.as_json() - self.assertEqual("ActivityDefinition", js["resourceType"]) - inst2 = activitydefinition.ActivityDefinition(js) - self.implActivityDefinition5(inst2) - - def implActivityDefinition5(self, inst): - self.assertEqual(inst.code.coding[0].code, "BlueTubes") - self.assertEqual(inst.code.coding[0].display, "Blood collect tubes blue cap") - 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 deleted file mode 100644 index ea7c384ac..000000000 --- a/fhirclient/models/address.py +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Address) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import element - -class Address(element.Element): - """ An address expressed using postal conventions (as opposed to GPS or other - location definition formats). - - An address expressed using postal conventions (as opposed to GPS or other - location definition formats). This data type may be used to convey - addresses for use in delivering mail as well as for visiting locations - which might not be valid for mail delivery. There are a variety of postal - address formats defined around the world. - """ - - resource_type = "Address" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.city = None - """ Name of city, town etc.. - Type `str`. """ - - self.country = None - """ Country (e.g. can be ISO 3166 2 or 3 letter code). - Type `str`. """ - - self.district = None - """ District name (aka county). - Type `str`. """ - - self.line = None - """ Street name, number, direction & P.O. Box etc.. - List of `str` items. """ - - self.period = None - """ Time period when address was/is in use. - Type `Period` (represented as `dict` in JSON). """ - - self.postalCode = None - """ Postal code for area. - Type `str`. """ - - self.state = None - """ Sub-unit of country (abbreviations ok). - Type `str`. """ - - self.text = None - """ Text representation of the address. - Type `str`. """ - - self.type = None - """ postal | physical | both. - Type `str`. """ - - self.use = None - """ home | work | temp | old | billing - purpose of this address. - Type `str`. """ - - super(Address, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Address, self).elementProperties() - js.extend([ - ("city", "city", str, False, None, False), - ("country", "country", str, False, None, False), - ("district", "district", str, False, None, False), - ("line", "line", str, True, None, False), - ("period", "period", period.Period, False, None, False), - ("postalCode", "postalCode", str, False, None, False), - ("state", "state", str, False, None, False), - ("text", "text", str, False, None, False), - ("type", "type", str, False, None, False), - ("use", "use", str, False, None, False), - ]) - return js - - -import sys -try: - from . import period -except ImportError: - period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/adverseevent.py b/fhirclient/models/adverseevent.py deleted file mode 100644 index d34b8e2ce..000000000 --- a/fhirclient/models/adverseevent.py +++ /dev/null @@ -1,241 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/AdverseEvent) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class AdverseEvent(domainresource.DomainResource): - """ Medical care, research study or other healthcare event causing physical - injury. - - Actual or potential/avoided event causing unintended physical injury - resulting from or contributed to by medical care, a research study or other - healthcare setting factors that requires additional monitoring, treatment, - or hospitalization, or that results in death. - """ - - resource_type = "AdverseEvent" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - 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.detected = None - """ When the event was detected. - Type `FHIRDate` (represented as `str` 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. - Type `Identifier` (represented as `dict` in JSON). """ - - self.location = None - """ Location where adverse event occurred. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.outcome = None - """ resolved | recovering | ongoing | resolvedWithSequelae | fatal | - unknown. - Type `CodeableConcept` (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` (represented as `dict` in JSON). """ - - self.referenceDocument = None - """ AdverseEvent.referenceDocument. - 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 - """ 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 (represented as `dict` in JSON). """ - - self.subject = None - """ Subject impacted by event. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.subjectMedicalHistory = None - """ AdverseEvent.subjectMedicalHistory. - 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). """ - - super(AdverseEvent, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(AdverseEvent, self).elementProperties() - js.extend([ - ("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), - ("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), - ("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, True), - ("subjectMedicalHistory", "subjectMedicalHistory", fhirreference.FHIRReference, True, None, False), - ("suspectEntity", "suspectEntity", AdverseEventSuspectEntity, True, None, False), - ]) - return js - - -from . import backboneelement - -class AdverseEventSuspectEntity(backboneelement.BackboneElement): - """ The suspected agent causing the adverse event. - - Describes the entity that is suspected to have caused the adverse event. - """ - - resource_type = "AdverseEventSuspectEntity" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.causality = None - """ 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. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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.author = None - """ AdverseEvent.suspectEntity.causalityAuthor. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.method = None - """ ProbabilityScale | Bayesian | Checklist. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.productRelatedness = None - """ AdverseEvent.suspectEntity.causalityProductRelatedness. - Type `str`. """ - - super(AdverseEventSuspectEntityCausality, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(AdverseEventSuspectEntityCausality, self).elementProperties() - js.extend([ - ("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 - - -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/adverseevent_tests.py b/fhirclient/models/adverseevent_tests.py deleted file mode 100644 index 7ac2b20dd..000000000 --- a/fhirclient/models/adverseevent_tests.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/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 adverseevent -from .fhirdate import FHIRDate - - -class AdverseEventTests(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("AdverseEvent", js["resourceType"]) - return adverseevent.AdverseEvent(js) - - def testAdverseEvent1(self): - inst = self.instantiate_from("adverseevent-example.json") - self.assertIsNotNone(inst, "Must have instantiated a AdverseEvent instance") - self.implAdverseEvent1(inst) - - js = inst.as_json() - self.assertEqual("AdverseEvent", js["resourceType"]) - inst2 = adverseevent.AdverseEvent(js) - self.implAdverseEvent1(inst2) - - def implAdverseEvent1(self, inst): - 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.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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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") - diff --git a/fhirclient/models/age.py b/fhirclient/models/age.py deleted file mode 100644 index 20f8e7cce..000000000 --- a/fhirclient/models/age.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Age) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import quantity - -class Age(quantity.Quantity): - """ A duration of time during which an organism (or a process) has existed. - """ - - resource_type = "Age" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - super(Age, self).__init__(jsondict=jsondict, strict=strict) - - diff --git a/fhirclient/models/allergyintolerance.py b/fhirclient/models/allergyintolerance.py deleted file mode 100644 index 45a7bcaf9..000000000 --- a/fhirclient/models/allergyintolerance.py +++ /dev/null @@ -1,232 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/AllergyIntolerance) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class AllergyIntolerance(domainresource.DomainResource): - """ Allergy or Intolerance (generally: Risk of adverse reaction to a substance). - - Risk of harmful or undesirable, physiological response which is unique to - an individual and associated with exposure to a substance. - """ - - resource_type = "AllergyIntolerance" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.asserter = None - """ Source of the information about the allergy. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.category = None - """ food | medication | environment | biologic. - List of `str` items. """ - - self.clinicalStatus = None - """ active | inactive | resolved. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.code = None - """ Code that identifies the allergy or intolerance. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.criticality = None - """ 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). """ - - self.lastOccurrence = None - """ Date(/time) of last known occurrence of a reaction. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.note = None - """ Additional text not captured in other fields. - List of `Annotation` items (represented as `dict` in JSON). """ - - self.onsetAge = None - """ When allergy or intolerance was identified. - Type `Age` (represented as `dict` in JSON). """ - - self.onsetDateTime = None - """ When allergy or intolerance was identified. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.onsetPeriod = None - """ When allergy or intolerance was identified. - Type `Period` (represented as `dict` in JSON). """ - - self.onsetRange = None - """ When allergy or intolerance was identified. - Type `Range` (represented as `dict` in JSON). """ - - self.onsetString = None - """ When allergy or intolerance was identified. - Type `str`. """ - - self.patient = None - """ Who the sensitivity is for. - 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` (represented as `dict` in JSON). """ - - self.type = None - """ allergy | intolerance - Underlying mechanism (if known). - Type `str`. """ - - self.verificationStatus = None - """ unconfirmed | confirmed | refuted | entered-in-error. - 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([ - ("asserter", "asserter", fhirreference.FHIRReference, False, None, False), - ("category", "category", str, True, 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), - ("onsetAge", "onsetAge", age.Age, False, "onset", False), - ("onsetDateTime", "onsetDateTime", fhirdate.FHIRDate, False, "onset", False), - ("onsetPeriod", "onsetPeriod", period.Period, False, "onset", False), - ("onsetRange", "onsetRange", range.Range, False, "onset", False), - ("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", codeableconcept.CodeableConcept, False, None, False), - ]) - return js - - -from . import backboneelement - -class AllergyIntoleranceReaction(backboneelement.BackboneElement): - """ Adverse Reaction Events linked to exposure to substance. - - Details about each adverse reaction event linked to exposure to the - identified substance. - """ - - resource_type = "AllergyIntoleranceReaction" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 the event as a whole. - Type `str`. """ - - self.exposureRoute = None - """ How the subject was exposed to the substance. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.manifestation = None - """ Clinical symptoms/signs associated with the Event. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.note = None - """ Text about event not captured in other fields. - List of `Annotation` items (represented as `dict` in JSON). """ - - self.onset = None - """ Date(/time) when manifestations showed. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.severity = None - """ mild | moderate | severe (of event as a whole). - Type `str`. """ - - self.substance = None - """ Specific substance or pharmaceutical product considered to be - responsible for event. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(AllergyIntoleranceReaction, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(AllergyIntoleranceReaction, self).elementProperties() - js.extend([ - ("description", "description", str, False, None, False), - ("exposureRoute", "exposureRoute", codeableconcept.CodeableConcept, False, None, False), - ("manifestation", "manifestation", codeableconcept.CodeableConcept, True, None, True), - ("note", "note", annotation.Annotation, True, None, False), - ("onset", "onset", fhirdate.FHIRDate, False, None, False), - ("severity", "severity", str, False, None, False), - ("substance", "substance", 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: - 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'] -try: - from . import range -except ImportError: - range = sys.modules[__package__ + '.range'] diff --git a/fhirclient/models/allergyintolerance_tests.py b/fhirclient/models/allergyintolerance_tests.py deleted file mode 100644 index 49fd70409..000000000 --- a/fhirclient/models/allergyintolerance_tests.py +++ /dev/null @@ -1,81 +0,0 @@ -#!/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 allergyintolerance -from .fhirdate import FHIRDate - - -class AllergyIntoleranceTests(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("AllergyIntolerance", js["resourceType"]) - return allergyintolerance.AllergyIntolerance(js) - - def testAllergyIntolerance1(self): - inst = self.instantiate_from("allergyintolerance-example.json") - self.assertIsNotNone(inst, "Must have instantiated a AllergyIntolerance instance") - self.implAllergyIntolerance1(inst) - - js = inst.as_json() - self.assertEqual("AllergyIntolerance", js["resourceType"]) - inst2 = allergyintolerance.AllergyIntolerance(js) - self.implAllergyIntolerance1(inst2) - - def implAllergyIntolerance1(self, inst): - self.assertEqual(inst.category[0], "food") - 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") - self.assertEqual(inst.criticality, "high") - self.assertEqual(inst.id, "example") - self.assertEqual(inst.identifier[0].system, "http://acme.com/ids/patients/risks") - 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") - self.assertEqual(inst.reaction[0].description, "Challenge Protocol. Severe reaction to subcutaneous cashew extract. Epinephrine administered") - self.assertEqual(inst.reaction[0].exposureRoute.coding[0].code, "34206005") - self.assertEqual(inst.reaction[0].exposureRoute.coding[0].display, "Subcutaneous route") - self.assertEqual(inst.reaction[0].exposureRoute.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.reaction[0].manifestation[0].coding[0].code, "39579001") - self.assertEqual(inst.reaction[0].manifestation[0].coding[0].display, "Anaphylactic reaction") - self.assertEqual(inst.reaction[0].manifestation[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.reaction[0].onset.date, FHIRDate("2012-06-12").date) - self.assertEqual(inst.reaction[0].onset.as_json(), "2012-06-12") - self.assertEqual(inst.reaction[0].severity, "severe") - self.assertEqual(inst.reaction[0].substance.coding[0].code, "1160593") - self.assertEqual(inst.reaction[0].substance.coding[0].display, "cashew nut allergenic extract Injectable Product") - self.assertEqual(inst.reaction[0].substance.coding[0].system, "http://www.nlm.nih.gov/research/umls/rxnorm") - self.assertEqual(inst.reaction[1].manifestation[0].coding[0].code, "64305001") - self.assertEqual(inst.reaction[1].manifestation[0].coding[0].display, "Urticaria") - self.assertEqual(inst.reaction[1].manifestation[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.reaction[1].note[0].text, "The patient reports that the onset of urticaria was within 15 minutes of eating cashews.") - 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.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 deleted file mode 100644 index 5cf300532..000000000 --- a/fhirclient/models/annotation.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Annotation) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import element - -class Annotation(element.Element): - """ Text node with attribution. - - A text note which also contains information about who made the statement - and when. - """ - - resource_type = "Annotation" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.authorReference = None - """ Individual responsible for the annotation. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.authorString = None - """ Individual responsible for the annotation. - Type `str`. """ - - self.text = None - """ The annotation - text content (as markdown). - Type `str`. """ - - self.time = None - """ When the annotation was made. - Type `FHIRDate` (represented as `str` in JSON). """ - - super(Annotation, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Annotation, self).elementProperties() - js.extend([ - ("authorReference", "authorReference", fhirreference.FHIRReference, False, "author", False), - ("authorString", "authorString", str, False, "author", False), - ("text", "text", str, False, None, True), - ("time", "time", fhirdate.FHIRDate, False, None, False), - ]) - 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'] diff --git a/fhirclient/models/appointment.py b/fhirclient/models/appointment.py deleted file mode 100644 index 19ccd53c2..000000000 --- a/fhirclient/models/appointment.py +++ /dev/null @@ -1,223 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Appointment) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class Appointment(domainresource.DomainResource): - """ A booking of a healthcare event among patient(s), practitioner(s), related - person(s) and/or device(s) for a specific date/time. This may result in one - or more Encounter(s). - """ - - resource_type = "Appointment" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.appointmentType = None - """ The style of appointment or patient that has been booked in the - 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`. """ - - self.created = None - """ The date that this appointment was initially created. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.description = None - """ Shown on a subject line in a meeting request, or appointment list. - Type `str`. """ - - self.end = None - """ When appointment is to conclude. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.identifier = None - """ External Ids for this item. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.minutesDuration = None - """ Can be less than start/end (e.g. estimate). - Type `int`. """ - - self.participant = None - """ 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.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 categorization of the service that is to be performed - during this appointment. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.serviceType = None - """ The specific service that is to be performed during this - appointment. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.slot = None - """ The slots that this appointment is filling. - List of `FHIRReference` 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. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.start = None - """ When appointment is to take place. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.status = None - """ proposed | pending | booked | arrived | fulfilled | cancelled | - noshow | entered-in-error | checked-in | waitlist. - Type `str`. """ - - self.supportingInformation = None - """ Additional information to support the appointment. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - super(Appointment, self).__init__(jsondict=jsondict, strict=strict) - - 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), - ("minutesDuration", "minutesDuration", int, False, None, False), - ("participant", "participant", AppointmentParticipant, True, None, True), - ("patientInstruction", "patientInstruction", str, False, None, False), - ("priority", "priority", int, False, 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, True, None, False), - ("serviceType", "serviceType", codeableconcept.CodeableConcept, True, None, False), - ("slot", "slot", fhirreference.FHIRReference, True, None, False), - ("specialty", "specialty", codeableconcept.CodeableConcept, True, None, False), - ("start", "start", fhirdate.FHIRDate, False, None, False), - ("status", "status", str, False, None, True), - ("supportingInformation", "supportingInformation", fhirreference.FHIRReference, True, None, False), - ]) - return js - - -from . import backboneelement - -class AppointmentParticipant(backboneelement.BackboneElement): - """ Participants involved in appointment. - - List of participants involved in the appointment. - """ - - resource_type = "AppointmentParticipant" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Person, Location/HealthcareService or Device. - 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. - Type `str`. """ - - self.status = None - """ accepted | declined | tentative | needs-action. - Type `str`. """ - - self.type = None - """ Role of participant in the appointment. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - super(AppointmentParticipant, self).__init__(jsondict=jsondict, strict=strict) - - 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), - ]) - 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/appointment_tests.py b/fhirclient/models/appointment_tests.py deleted file mode 100644 index cdce75f33..000000000 --- a/fhirclient/models/appointment_tests.py +++ /dev/null @@ -1,166 +0,0 @@ -#!/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 appointment -from .fhirdate import FHIRDate - - -class AppointmentTests(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("Appointment", js["resourceType"]) - return appointment.Appointment(js) - - def testAppointment1(self): - inst = self.instantiate_from("appointment-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Appointment instance") - self.implAppointment1(inst) - - js = inst.as_json() - self.assertEqual("Appointment", js["resourceType"]) - inst2 = appointment.Appointment(js) - self.implAppointment1(inst2) - - def implAppointment1(self, inst): - 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("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.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, "accepted") - self.assertEqual(inst.participant[1].required, "required") - 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://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[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-request.json") - self.assertIsNotNone(inst, "Must have instantiated a Appointment instance") - self.implAppointment2(inst) - - js = inst.as_json() - self.assertEqual("Appointment", js["resourceType"]) - inst2 = appointment.Appointment(js) - self.implAppointment2(inst2) - - def implAppointment2(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://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.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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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, "needs-action") - self.assertEqual(inst.participant[1].required, "required") - 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://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.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") - - def testAppointment3(self): - inst = self.instantiate_from("appointment-example2doctors.json") - self.assertIsNotNone(inst, "Must have instantiated a Appointment instance") - self.implAppointment3(inst) - - js = inst.as_json() - self.assertEqual("Appointment", js["resourceType"]) - inst2 = appointment.Appointment(js) - self.implAppointment3(inst2) - - def implAppointment3(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://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") - self.assertEqual(inst.participant[1].status, "accepted") - self.assertEqual(inst.participant[2].required, "required") - self.assertEqual(inst.participant[2].status, "accepted") - self.assertEqual(inst.participant[3].required, "information-only") - self.assertEqual(inst.participant[3].status, "accepted") - self.assertEqual(inst.priority, 5) - 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-09T09:00:00Z").date) - self.assertEqual(inst.start.as_json(), "2013-12-09T09:00:00Z") - self.assertEqual(inst.status, "booked") - self.assertEqual(inst.text.div, "
Brian MRI results discussion
") - self.assertEqual(inst.text.status, "generated") - diff --git a/fhirclient/models/appointmentresponse.py b/fhirclient/models/appointmentresponse.py deleted file mode 100644 index 332d26c48..000000000 --- a/fhirclient/models/appointmentresponse.py +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/AppointmentResponse) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class AppointmentResponse(domainresource.DomainResource): - """ A reply to an appointment request for a patient and/or practitioner(s), - such as a confirmation or rejection. - """ - - resource_type = "AppointmentResponse" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Person, Location, HealthcareService, or Device. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.appointment = None - """ Appointment this response relates to. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.comment = None - """ Additional comments. - Type `str`. """ - - self.end = None - """ Time from appointment, or requested new end time. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.identifier = None - """ External Ids for this item. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.participantStatus = None - """ accepted | declined | tentative | in-process | completed | needs- - action | entered-in-error. - Type `str`. """ - - self.participantType = None - """ Role of participant in the appointment. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.start = None - """ Time from appointment, or requested new start time. - Type `FHIRDate` (represented as `str` in JSON). """ - - super(AppointmentResponse, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(AppointmentResponse, self).elementProperties() - js.extend([ - ("actor", "actor", fhirreference.FHIRReference, False, None, False), - ("appointment", "appointment", fhirreference.FHIRReference, False, None, True), - ("comment", "comment", str, False, None, False), - ("end", "end", fhirdate.FHIRDate, False, None, False), - ("identifier", "identifier", identifier.Identifier, True, None, False), - ("participantStatus", "participantStatus", str, False, None, True), - ("participantType", "participantType", codeableconcept.CodeableConcept, True, None, False), - ("start", "start", fhirdate.FHIRDate, 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/appointmentresponse_tests.py b/fhirclient/models/appointmentresponse_tests.py deleted file mode 100644 index 63e4eb807..000000000 --- a/fhirclient/models/appointmentresponse_tests.py +++ /dev/null @@ -1,70 +0,0 @@ -#!/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 appointmentresponse -from .fhirdate import FHIRDate - - -class AppointmentResponseTests(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("AppointmentResponse", js["resourceType"]) - return appointmentresponse.AppointmentResponse(js) - - def testAppointmentResponse1(self): - inst = self.instantiate_from("appointmentresponse-example-req.json") - self.assertIsNotNone(inst, "Must have instantiated a AppointmentResponse instance") - self.implAppointmentResponse1(inst) - - js = inst.as_json() - self.assertEqual("AppointmentResponse", js["resourceType"]) - inst2 = appointmentresponse.AppointmentResponse(js) - self.implAppointmentResponse1(inst2) - - def implAppointmentResponse1(self, inst): - self.assertEqual(inst.comment, "can't we try for this time, can't do mornings") - self.assertEqual(inst.end.date, FHIRDate("2013-12-25T13:30:00Z").date) - self.assertEqual(inst.end.as_json(), "2013-12-25T13:30:00Z") - 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://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
") - self.assertEqual(inst.text.status, "generated") - - def testAppointmentResponse2(self): - inst = self.instantiate_from("appointmentresponse-example.json") - self.assertIsNotNone(inst, "Must have instantiated a AppointmentResponse instance") - self.implAppointmentResponse2(inst) - - js = inst.as_json() - self.assertEqual("AppointmentResponse", js["resourceType"]) - inst2 = appointmentresponse.AppointmentResponse(js) - self.implAppointmentResponse2(inst2) - - 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 deleted file mode 100644 index d58385a16..000000000 --- a/fhirclient/models/attachment.py +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Attachment) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import element - -class Attachment(element.Element): - """ Content in a format defined elsewhere. - - For referring to data content defined in other formats. - """ - - resource_type = "Attachment" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.contentType = None - """ Mime type of the content, with charset etc.. - Type `str`. """ - - self.creation = None - """ Date attachment was first created. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.data = None - """ Data inline, base64ed. - Type `str`. """ - - self.hash = None - """ Hash of the data (sha-1, base64ed). - Type `str`. """ - - self.language = None - """ Human language of the content (BCP-47). - Type `str`. """ - - self.size = None - """ Number of bytes of content (if url provided). - Type `int`. """ - - self.title = None - """ Label to display in place of the data. - Type `str`. """ - - self.url = None - """ Uri where the data can be found. - Type `str`. """ - - super(Attachment, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Attachment, self).elementProperties() - js.extend([ - ("contentType", "contentType", str, False, None, False), - ("creation", "creation", fhirdate.FHIRDate, False, None, False), - ("data", "data", str, False, None, False), - ("hash", "hash", str, False, None, False), - ("language", "language", str, False, None, False), - ("size", "size", int, False, None, False), - ("title", "title", str, False, None, False), - ("url", "url", str, False, None, False), - ]) - return js - - -import sys -try: - from . import fhirdate -except ImportError: - fhirdate = sys.modules[__package__ + '.fhirdate'] diff --git a/fhirclient/models/auditevent.py b/fhirclient/models/auditevent.py deleted file mode 100644 index 690d61e66..000000000 --- a/fhirclient/models/auditevent.py +++ /dev/null @@ -1,380 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/AuditEvent) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class AuditEvent(domainresource.DomainResource): - """ Event record kept for security purposes. - - A record of an event made for purposes of maintaining a security log. - Typical uses include detection of intrusion attempts and monitoring for - inappropriate usage. - """ - - resource_type = "AuditEvent" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Type of action performed during the event. - Type `str`. """ - - self.agent = None - """ Actor involved in the event. - List of `AuditEventAgent` items (represented as `dict` in JSON). """ - - self.entity = None - """ Data or objects used. - List of `AuditEventEntity` items (represented as `dict` in JSON). """ - - self.outcome = None - """ Whether the event succeeded or failed. - Type `str`. """ - - self.outcomeDesc = None - """ 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 was recorded. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.source = None - """ Audit Event Reporter. - Type `AuditEventSource` (represented as `dict` in JSON). """ - - self.subtype = None - """ More specific type/id for the event. - List of `Coding` items (represented as `dict` in JSON). """ - - self.type = None - """ Type/identifier of event. - Type `Coding` (represented as `dict` in JSON). """ - - super(AuditEvent, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(AuditEvent, self).elementProperties() - js.extend([ - ("action", "action", str, False, None, False), - ("agent", "agent", AuditEventAgent, True, None, True), - ("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), - ("subtype", "subtype", coding.Coding, True, None, False), - ("type", "type", coding.Coding, False, None, True), - ]) - return js - - -from . import backboneelement - -class AuditEventAgent(backboneelement.BackboneElement): - """ Actor involved in the event. - - An actor taking an active role in the event or activity that is logged. - """ - - resource_type = "AuditEventAgent" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.altId = None - """ Alternative User identity. - Type `str`. """ - - self.location = None - """ Where. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.media = None - """ Type of media. - Type `Coding` (represented as `dict` in JSON). """ - - self.name = None - """ Human friendly name for the agent. - Type `str`. """ - - self.network = None - """ Logical network location for application activity. - Type `AuditEventAgentNetwork` (represented as `dict` in JSON). """ - - self.policy = None - """ Policy that authorized event. - List of `str` items. """ - - self.purposeOfUse = None - """ Reason given for this user. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.requestor = None - """ Whether user is initiator. - Type `bool`. """ - - self.role = None - """ Agent role in the event. - List of `CodeableConcept` items (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) - - def elementProperties(self): - js = super(AuditEventAgent, self).elementProperties() - js.extend([ - ("altId", "altId", str, False, None, False), - ("location", "location", fhirreference.FHIRReference, False, None, False), - ("media", "media", coding.Coding, False, None, False), - ("name", "name", str, False, None, False), - ("network", "network", AuditEventAgentNetwork, False, None, False), - ("policy", "policy", str, True, None, False), - ("purposeOfUse", "purposeOfUse", codeableconcept.CodeableConcept, True, None, False), - ("requestor", "requestor", bool, False, None, True), - ("role", "role", codeableconcept.CodeableConcept, True, None, False), - ("type", "type", codeableconcept.CodeableConcept, False, None, False), - ("who", "who", fhirreference.FHIRReference, False, None, False), - ]) - return js - - -class AuditEventAgentNetwork(backboneelement.BackboneElement): - """ Logical network location for application activity. - - Logical network location for application activity, if the activity has a - network location. - """ - - resource_type = "AuditEventAgentNetwork" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Identifier for the network access point of the user device. - Type `str`. """ - - self.type = None - """ The type of network access point. - Type `str`. """ - - super(AuditEventAgentNetwork, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(AuditEventAgentNetwork, self).elementProperties() - js.extend([ - ("address", "address", str, False, None, False), - ("type", "type", str, False, None, False), - ]) - return js - - -class AuditEventEntity(backboneelement.BackboneElement): - """ Data or objects used. - - Specific instances of data or objects that have been accessed. - """ - - resource_type = "AuditEventEntity" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Descriptive text. - Type `str`. """ - - self.detail = None - """ Additional Information about the entity. - List of `AuditEventEntityDetail` items (represented as `dict` in JSON). """ - - self.lifecycle = None - """ Life-cycle stage for the entity. - Type `Coding` (represented as `dict` in JSON). """ - - self.name = None - """ Descriptor for entity. - Type `str`. """ - - self.query = None - """ Query parameters. - Type `str`. """ - - self.role = None - """ What role the entity played. - Type `Coding` (represented as `dict` in JSON). """ - - self.securityLabel = None - """ Security labels on the entity. - List of `Coding` items (represented as `dict` in JSON). """ - - self.type = None - """ 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): - js = super(AuditEventEntity, self).elementProperties() - js.extend([ - ("description", "description", str, False, None, False), - ("detail", "detail", AuditEventEntityDetail, True, None, False), - ("lifecycle", "lifecycle", coding.Coding, False, None, False), - ("name", "name", str, False, None, False), - ("query", "query", str, 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 - - -class AuditEventEntityDetail(backboneelement.BackboneElement): - """ Additional Information about the entity. - - Tagged value pairs for conveying additional information about the entity. - """ - - resource_type = "AuditEventEntityDetail" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Name of the property. - Type `str`. """ - - self.valueBase64Binary = None - """ Property value. - Type `str`. """ - - self.valueString = None - """ Property value. - Type `str`. """ - - super(AuditEventEntityDetail, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(AuditEventEntityDetail, self).elementProperties() - js.extend([ - ("type", "type", str, False, None, True), - ("valueBase64Binary", "valueBase64Binary", str, False, "value", True), - ("valueString", "valueString", str, False, "value", True), - ]) - return js - - -class AuditEventSource(backboneelement.BackboneElement): - """ Audit Event Reporter. - - The system that is reporting the event. - """ - - resource_type = "AuditEventSource" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.observer = None - """ The identity of source detecting the event. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.site = None - """ Logical source location within the enterprise. - Type `str`. """ - - self.type = None - """ The type of source where event originated. - List of `Coding` items (represented as `dict` in JSON). """ - - super(AuditEventSource, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(AuditEventSource, self).elementProperties() - js.extend([ - ("observer", "observer", fhirreference.FHIRReference, False, None, True), - ("site", "site", str, False, None, False), - ("type", "type", coding.Coding, True, 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 period -except ImportError: - period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/auditevent_tests.py b/fhirclient/models/auditevent_tests.py deleted file mode 100644 index e5f9f1a97..000000000 --- a/fhirclient/models/auditevent_tests.py +++ /dev/null @@ -1,520 +0,0 @@ -#!/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 auditevent -from .fhirdate import FHIRDate - - -class AuditEventTests(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("AuditEvent", js["resourceType"]) - return auditevent.AuditEvent(js) - - def testAuditEvent1(self): - inst = self.instantiate_from("audit-event-example-search.json") - self.assertIsNotNone(inst, "Must have instantiated a AuditEvent instance") - self.implAuditEvent1(inst) - - js = inst.as_json() - self.assertEqual("AuditEvent", js["resourceType"]) - inst2 = auditevent.AuditEvent(js) - self.implAuditEvent1(inst2) - - 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.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].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("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://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, "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") - self.assertIsNotNone(inst, "Must have instantiated a AuditEvent instance") - self.implAuditEvent2(inst) - - js = inst.as_json() - self.assertEqual("AuditEvent", js["resourceType"]) - inst2 = auditevent.AuditEvent(js) - self.implAuditEvent2(inst2) - - def implAuditEvent2(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-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.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, "110123") - self.assertEqual(inst.subtype[0].display, "Logout") - 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 testAuditEvent3(self): - inst = self.instantiate_from("audit-event-example-vread.json") - self.assertIsNotNone(inst, "Must have instantiated a AuditEvent instance") - self.implAuditEvent3(inst) - - js = inst.as_json() - self.assertEqual("AuditEvent", js["resourceType"]) - inst2 = auditevent.AuditEvent(js) - 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].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].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.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://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://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://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://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://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.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") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.code, "110106") - self.assertEqual(inst.type.display, "Export") - self.assertEqual(inst.type.system, "http://dicom.nema.org/resources/ontology/DCM") - - 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.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, "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].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].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://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://terminology.hl7.org/CodeSystem/audit-entity-type") - self.assertEqual(inst.entity[1].detail[0].type, "MSH-10") - 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://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://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.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") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.code, "110112") - self.assertEqual(inst.type.display, "Query") - self.assertEqual(inst.type.system, "http://dicom.nema.org/resources/ontology/DCM") - - def testAuditEvent7(self): - inst = self.instantiate_from("auditevent-example.json") - self.assertIsNotNone(inst, "Must have instantiated a AuditEvent instance") - self.implAuditEvent7(inst) - - js = inst.as_json() - self.assertEqual("AuditEvent", js["resourceType"]) - inst2 = auditevent.AuditEvent(js) - self.implAuditEvent7(inst2) - - def implAuditEvent7(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].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].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("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, "110100") - self.assertEqual(inst.type.display, "Application Activity") - self.assertEqual(inst.type.system, "http://dicom.nema.org/resources/ontology/DCM") - - def testAuditEvent8(self): - inst = self.instantiate_from("auditevent-example-disclosure.json") - self.assertIsNotNone(inst, "Must have instantiated a AuditEvent instance") - self.implAuditEvent8(inst) - - js = inst.as_json() - self.assertEqual("AuditEvent", js["resourceType"]) - inst2 = auditevent.AuditEvent(js) - self.implAuditEvent8(inst2) - - 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") - self.assertEqual(inst.agent[0].network.address, "custodian.net") - 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].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://terminology.hl7.org/CodeSystem/v3-ActReason") - self.assertFalse(inst.agent[1].requestor) - 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://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://terminology.hl7.org/CodeSystem/audit-entity-type") - self.assertEqual(inst.entity[1].description, "data about Everthing important") - self.assertEqual(inst.entity[1].lifecycle.code, "11") - self.assertEqual(inst.entity[1].lifecycle.display, "Disclosure") - 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://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://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://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://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://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://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.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://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.
") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.code, "110106") - self.assertEqual(inst.type.display, "Export") - self.assertEqual(inst.type.system, "http://dicom.nema.org/resources/ontology/DCM") - - def testAuditEvent9(self): - inst = self.instantiate_from("auditevent-example-error.json") - self.assertIsNotNone(inst, "Must have instantiated a AuditEvent instance") - self.implAuditEvent9(inst) - - js = inst.as_json() - self.assertEqual("AuditEvent", js["resourceType"]) - inst2 = auditevent.AuditEvent(js) - self.implAuditEvent9(inst2) - - 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].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, "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 deleted file mode 100644 index 84a55649e..000000000 --- a/fhirclient/models/backboneelement.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/BackboneElement) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import element - -class BackboneElement(element.Element): - """ Base for elements defined inside a resource. - - Base definition for all elements that are defined inside a resource - but - not those in a data type. - """ - - resource_type = "BackboneElement" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.modifierExtension = None - """ 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) - - def elementProperties(self): - js = super(BackboneElement, self).elementProperties() - js.extend([ - ("modifierExtension", "modifierExtension", extension.Extension, True, None, False), - ]) - return js - - -import sys -try: - from . import extension -except ImportError: - extension = sys.modules[__package__ + '.extension'] diff --git a/fhirclient/models/basic.py b/fhirclient/models/basic.py deleted file mode 100644 index 39ebf97ba..000000000 --- a/fhirclient/models/basic.py +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Basic) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class Basic(domainresource.DomainResource): - """ Resource for non-supported content. - - Basic is used for handling concepts not yet defined in FHIR, narrative-only - resources that don't map to an existing resource, and custom resources not - appropriate for inclusion in the FHIR specification. - """ - - resource_type = "Basic" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Who created. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.code = None - """ Kind of Resource. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.created = None - """ When created. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.identifier = None - """ Business identifier. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.subject = None - """ Identifies the focus of this resource. - Type `FHIRReference` (represented as `dict` in JSON). """ - - super(Basic, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Basic, self).elementProperties() - js.extend([ - ("author", "author", fhirreference.FHIRReference, False, None, False), - ("code", "code", codeableconcept.CodeableConcept, False, None, True), - ("created", "created", fhirdate.FHIRDate, False, None, False), - ("identifier", "identifier", identifier.Identifier, True, None, False), - ("subject", "subject", fhirreference.FHIRReference, 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/basic_tests.py b/fhirclient/models/basic_tests.py deleted file mode 100644 index 8b9075f87..000000000 --- a/fhirclient/models/basic_tests.py +++ /dev/null @@ -1,115 +0,0 @@ -#!/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 basic -from .fhirdate import FHIRDate - - -class BasicTests(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("Basic", js["resourceType"]) - return basic.Basic(js) - - def testBasic1(self): - inst = self.instantiate_from("basic-example2.json") - self.assertIsNotNone(inst, "Must have instantiated a Basic instance") - self.implBasic1(inst) - - js = inst.as_json() - self.assertEqual("Basic", js["resourceType"]) - inst2 = basic.Basic(js) - self.implBasic1(inst2) - - def implBasic1(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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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-narrative.json") - self.assertIsNotNone(inst, "Must have instantiated a Basic instance") - self.implBasic2(inst) - - js = inst.as_json() - self.assertEqual("Basic", js["resourceType"]) - inst2 = basic.Basic(js) - 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://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") - self.assertEqual(inst.extension[1].url, "http://example.org/do-not-use/fhir-extensions/referral#notes") - self.assertEqual(inst.extension[1].valueString, "The patient had fever peaks over the last couple of days. He is worried about these peaks.") - self.assertEqual(inst.extension[2].url, "http://example.org/do-not-use/fhir-extensions/referral#fulfillingEncounter") - 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") - self.assertEqual(inst.modifierExtension[0].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.modifierExtension[1].url, "http://example.org/do-not-use/fhir-extensions/referral#targetDate") - self.assertEqual(inst.modifierExtension[1].valuePeriod.end.date, FHIRDate("2013-04-15").date) - self.assertEqual(inst.modifierExtension[1].valuePeriod.end.as_json(), "2013-04-15") - self.assertEqual(inst.modifierExtension[1].valuePeriod.start.date, FHIRDate("2013-04-01").date) - self.assertEqual(inst.modifierExtension[1].valuePeriod.start.as_json(), "2013-04-01") - 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") - diff --git a/fhirclient/models/binary.py b/fhirclient/models/binary.py deleted file mode 100644 index b91f8b6f0..000000000 --- a/fhirclient/models/binary.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Binary) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import resource - -class Binary(resource.Resource): - """ Pure binary content defined by a format other than FHIR. - - 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" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.contentType = None - """ MimeType of the binary content. - Type `str`. """ - - self.data = None - """ The actual content. - Type `str`. """ - - self.securityContext = None - """ 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([ - ("contentType", "contentType", str, False, None, True), - ("data", "data", str, False, None, False), - ("securityContext", "securityContext", fhirreference.FHIRReference, False, None, False), - ]) - return js - - -import sys -try: - from . import fhirreference -except ImportError: - fhirreference = sys.modules[__package__ + '.fhirreference'] diff --git a/fhirclient/models/binary_tests.py b/fhirclient/models/binary_tests.py deleted file mode 100644 index 19feed45a..000000000 --- a/fhirclient/models/binary_tests.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/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 binary -from .fhirdate import FHIRDate - - -class BinaryTests(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("Binary", js["resourceType"]) - return binary.Binary(js) - - def testBinary1(self): - inst = self.instantiate_from("binary-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Binary instance") - self.implBinary1(inst) - - js = inst.as_json() - self.assertEqual("Binary", js["resourceType"]) - inst2 = binary.Binary(js) - self.implBinary1(inst2) - - 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/bundle.py b/fhirclient/models/bundle.py deleted file mode 100644 index 8cddee0c9..000000000 --- a/fhirclient/models/bundle.py +++ /dev/null @@ -1,322 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Bundle) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import resource - -class Bundle(resource.Resource): - """ Contains a collection of resources. - - A container for a collection of resources. - """ - - resource_type = "Bundle" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.entry = None - """ Entry in the bundle - will have a resource or information. - List of `BundleEntry` items (represented as `dict` in JSON). """ - - self.identifier = None - """ Persistent identifier for the bundle. - Type `Identifier` (represented as `dict` in JSON). """ - - self.link = None - """ Links related to this Bundle. - List of `BundleLink` items (represented as `dict` in JSON). """ - - self.signature = None - """ 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`. """ - - self.type = None - """ document | message | transaction | transaction-response | batch | - batch-response | history | searchset | collection. - Type `str`. """ - - super(Bundle, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Bundle, self).elementProperties() - js.extend([ - ("entry", "entry", BundleEntry, True, None, False), - ("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), - ]) - return js - - -from . import backboneelement - -class BundleEntry(backboneelement.BackboneElement): - """ Entry in the bundle - will have a resource or information. - - An entry in a bundle resource - will either contain a resource or - information about a resource (transactions and history only). - """ - - resource_type = "BundleEntry" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.fullUrl = None - """ URI for resource (Absolute URL server address or URI for UUID/OID). - Type `str`. """ - - self.link = None - """ Links related to this entry. - List of `BundleLink` items (represented as `dict` in JSON). """ - - self.request = None - """ Additional execution information (transaction/batch/history). - Type `BundleEntryRequest` (represented as `dict` in JSON). """ - - self.resource = None - """ A resource in the bundle. - Type `Resource` (represented as `dict` in JSON). """ - - self.response = None - """ Results of execution (transaction/batch/history). - Type `BundleEntryResponse` (represented as `dict` in JSON). """ - - self.search = None - """ Search related information. - Type `BundleEntrySearch` (represented as `dict` in JSON). """ - - super(BundleEntry, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(BundleEntry, self).elementProperties() - js.extend([ - ("fullUrl", "fullUrl", str, False, None, False), - ("link", "link", BundleLink, True, None, False), - ("request", "request", BundleEntryRequest, False, None, False), - ("resource", "resource", resource.Resource, False, None, False), - ("response", "response", BundleEntryResponse, False, None, False), - ("search", "search", BundleEntrySearch, False, None, False), - ]) - return js - - -class BundleEntryRequest(backboneelement.BackboneElement): - """ Additional execution information (transaction/batch/history). - - Additional information about how this entry should be processed as part of - a transaction or batch. For history, it shows how the entry was processed - to create the version contained in the entry. - """ - - resource_type = "BundleEntryRequest" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.ifMatch = None - """ For managing update contention. - Type `str`. """ - - self.ifModifiedSince = None - """ For managing cache currency. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.ifNoneExist = None - """ For conditional creates. - Type `str`. """ - - self.ifNoneMatch = None - """ For managing cache currency. - Type `str`. """ - - self.method = None - """ GET | HEAD | POST | PUT | DELETE | PATCH. - Type `str`. """ - - self.url = None - """ URL for HTTP equivalent of this entry. - Type `str`. """ - - super(BundleEntryRequest, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(BundleEntryRequest, self).elementProperties() - js.extend([ - ("ifMatch", "ifMatch", str, False, None, False), - ("ifModifiedSince", "ifModifiedSince", fhirdate.FHIRDate, False, None, False), - ("ifNoneExist", "ifNoneExist", str, False, None, False), - ("ifNoneMatch", "ifNoneMatch", str, False, None, False), - ("method", "method", str, False, None, True), - ("url", "url", str, False, None, True), - ]) - return js - - -class BundleEntryResponse(backboneelement.BackboneElement): - """ Results of execution (transaction/batch/history). - - 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" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.etag = None - """ The Etag for the resource (if relevant). - Type `str`. """ - - self.lastModified = None - """ Server's date time modified. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.location = None - """ The location (if the operation returns a location). - Type `str`. """ - - self.outcome = None - """ OperationOutcome with hints and warnings (for batch/transaction). - Type `Resource` (represented as `dict` in JSON). """ - - self.status = None - """ Status response code (text optional). - Type `str`. """ - - super(BundleEntryResponse, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(BundleEntryResponse, self).elementProperties() - js.extend([ - ("etag", "etag", str, False, None, False), - ("lastModified", "lastModified", fhirdate.FHIRDate, False, None, False), - ("location", "location", str, False, None, False), - ("outcome", "outcome", resource.Resource, False, None, False), - ("status", "status", str, False, None, True), - ]) - return js - - -class BundleEntrySearch(backboneelement.BackboneElement): - """ Search related information. - - Information about the search process that lead to the creation of this - entry. - """ - - resource_type = "BundleEntrySearch" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ match | include | outcome - why this is in the result set. - Type `str`. """ - - self.score = None - """ Search ranking (between 0 and 1). - Type `float`. """ - - super(BundleEntrySearch, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(BundleEntrySearch, self).elementProperties() - js.extend([ - ("mode", "mode", str, False, None, False), - ("score", "score", float, False, None, False), - ]) - return js - - -class BundleLink(backboneelement.BackboneElement): - """ Links related to this Bundle. - - A series of links that provide context to this bundle. - """ - - resource_type = "BundleLink" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.relation = None - """ See http://www.iana.org/assignments/link-relations/link- - relations.xhtml#link-relations-1. - Type `str`. """ - - self.url = None - """ Reference details for the link. - Type `str`. """ - - super(BundleLink, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(BundleLink, self).elementProperties() - js.extend([ - ("relation", "relation", str, False, None, True), - ("url", "url", str, False, None, True), - ]) - return js - - -import sys -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 signature -except ImportError: - signature = sys.modules[__package__ + '.signature'] diff --git a/fhirclient/models/bundle_tests.py b/fhirclient/models/bundle_tests.py deleted file mode 100644 index 2f262effb..000000000 --- a/fhirclient/models/bundle_tests.py +++ /dev/null @@ -1,393 +0,0 @@ -#!/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 bundle -from .fhirdate import FHIRDate - - -class BundleTests(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("Bundle", js["resourceType"]) - return bundle.Bundle(js) - - def testBundle1(self): - inst = self.instantiate_from("diagnosticreport-example-f202-bloodculture.json") - self.assertIsNotNone(inst, "Must have instantiated a Bundle instance") - self.implBundle1(inst) - - js = inst.as_json() - self.assertEqual("Bundle", js["resourceType"]) - inst2 = bundle.Bundle(js) - self.implBundle1(inst2) - - def implBundle1(self, inst): - 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("xds-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Bundle instance") - self.implBundle2(inst) - - js = inst.as_json() - self.assertEqual("Bundle", js["resourceType"]) - inst2 = bundle.Bundle(js) - self.implBundle2(inst2) - - def implBundle2(self, inst): - 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, "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, "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, "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, "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, "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 testBundle3(self): - inst = self.instantiate_from("diagnosticreport-example-ghp.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, "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 testBundle4(self): - inst = self.instantiate_from("practitioner-examples-general.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://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") - self.assertEqual(inst.entry[1].resource.id, "13") - 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/Practitioner/14") - self.assertEqual(inst.entry[2].resource.id, "14") - 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/Practitioner/15") - self.assertEqual(inst.entry[3].resource.id, "15") - 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/Practitioner/16") - self.assertEqual(inst.entry[4].resource.id, "16") - 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/Practitioner/17") - self.assertEqual(inst.entry[5].resource.id, "17") - 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/Practitioner/18") - self.assertEqual(inst.entry[6].resource.id, "18") - 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/Practitioner/19") - self.assertEqual(inst.entry[7].resource.id, "19") - 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/Practitioner/20") - self.assertEqual(inst.entry[8].resource.id, "20") - 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/Practitioner/21") - self.assertEqual(inst.entry[9].resource.id, "21") - 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, "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 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.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/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") - self.assertEqual(inst.entry[1].resource.id, "example-0") - self.assertEqual(inst.entry[2].fullUrl, "http://hl7.org/fhir/PractitionerRole/example-1") - self.assertEqual(inst.entry[2].resource.id, "example-1") - self.assertEqual(inst.entry[3].fullUrl, "http://hl7.org/fhir/PractitionerRole/example-2") - self.assertEqual(inst.entry[3].resource.id, "example-2") - self.assertEqual(inst.entry[4].fullUrl, "http://hl7.org/fhir/PractitionerRole/f007-0") - self.assertEqual(inst.entry[4].resource.id, "f007-0") - self.assertEqual(inst.entry[5].fullUrl, "http://hl7.org/fhir/PractitionerRole/f004-0") - self.assertEqual(inst.entry[5].resource.id, "f004-0") - self.assertEqual(inst.entry[6].fullUrl, "http://hl7.org/fhir/PractitionerRole/xcda1-0") - self.assertEqual(inst.entry[6].resource.id, "xcda1-0") - self.assertEqual(inst.entry[7].fullUrl, "http://hl7.org/fhir/PractitionerRole/f202-0") - self.assertEqual(inst.entry[7].resource.id, "f202-0") - self.assertEqual(inst.entry[8].fullUrl, "http://hl7.org/fhir/PractitionerRole/f201-0") - self.assertEqual(inst.entry[8].resource.id, "f201-0") - 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 deleted file mode 100644 index 8d73c5496..000000000 --- a/fhirclient/models/capabilitystatement.py +++ /dev/null @@ -1,815 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/CapabilityStatement) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class CapabilityStatement(domainresource.DomainResource): - """ A statement of system capabilities. - - A Capability Statement documents a set of capabilities (behaviors) of a - 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" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 last changed. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.description = None - """ Natural language description of the capability statement. - Type `str`. """ - - self.document = None - """ Document definition. - List of `CapabilityStatementDocument` items (represented as `dict` in JSON). """ - - self.experimental = None - """ For testing purposes, not real usage. - Type `bool`. """ - - self.fhirVersion = None - """ FHIR Version the system supports. - Type `str`. """ - - self.format = None - """ formats supported (xml | json | ttl | mime type). - List of `str` items. """ - - self.implementation = None - """ If this describes a specific instance. - Type `CapabilityStatementImplementation` (represented as `dict` in JSON). """ - - self.implementationGuide = None - """ 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. """ - - self.jurisdiction = None - """ Intended jurisdiction for capability statement (if applicable). - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.kind = None - """ instance | capability | requirements. - Type `str`. """ - - self.messaging = None - """ If messaging is supported. - List of `CapabilityStatementMessaging` items (represented as `dict` in JSON). """ - - self.name = None - """ Name for this capability statement (computer friendly). - Type `str`. """ - - self.patchFormat = None - """ Patch formats supported. - List of `str` items. """ - - self.publisher = None - """ Name of the publisher (organization or individual). - Type `str`. """ - - self.purpose = None - """ Why this capability statement is defined. - Type `str`. """ - - self.rest = None - """ If the endpoint is a RESTful one. - List of `CapabilityStatementRest` items (represented as `dict` in JSON). """ - - self.software = None - """ Software that is covered by this capability statement. - Type `CapabilityStatementSoftware` (represented as `dict` in JSON). """ - - self.status = None - """ draft | active | retired | unknown. - Type `str`. """ - - self.title = None - """ Name for this capability statement (human friendly). - Type `str`. """ - - self.url = None - """ Canonical identifier for this capability statement, 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 capability statement. - Type `str`. """ - - super(CapabilityStatement, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CapabilityStatement, self).elementProperties() - js.extend([ - ("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), - ("document", "document", CapabilityStatementDocument, True, None, False), - ("experimental", "experimental", bool, False, None, False), - ("fhirVersion", "fhirVersion", str, False, None, True), - ("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), - ("publisher", "publisher", str, False, None, False), - ("purpose", "purpose", str, False, None, False), - ("rest", "rest", CapabilityStatementRest, True, None, False), - ("software", "software", CapabilityStatementSoftware, False, None, False), - ("status", "status", str, False, None, True), - ("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 CapabilityStatementDocument(backboneelement.BackboneElement): - """ Document definition. - - A document definition. - """ - - resource_type = "CapabilityStatementDocument" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 document support. - Type `str`. """ - - self.mode = None - """ producer | consumer. - Type `str`. """ - - self.profile = None - """ Constraint on the resources used in the document. - Type `str`. """ - - super(CapabilityStatementDocument, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CapabilityStatementDocument, self).elementProperties() - js.extend([ - ("documentation", "documentation", str, False, None, False), - ("mode", "mode", str, False, None, True), - ("profile", "profile", str, False, None, True), - ]) - return js - - -class CapabilityStatementImplementation(backboneelement.BackboneElement): - """ If this describes a specific instance. - - Identifies a specific implementation instance that is described by the - capability statement - i.e. a particular installation, rather than the - capabilities of a software program. - """ - - resource_type = "CapabilityStatementImplementation" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :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`. """ - - self.url = None - """ Base URL for the installation. - Type `str`. """ - - super(CapabilityStatementImplementation, self).__init__(jsondict=jsondict, strict=strict) - - 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), - ]) - return js - - -class CapabilityStatementMessaging(backboneelement.BackboneElement): - """ If messaging is supported. - - A description of the messaging capabilities of the solution. - """ - - resource_type = "CapabilityStatementMessaging" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Messaging interface behavior details. - Type `str`. """ - - self.endpoint = None - """ Where messages should be sent. - List of `CapabilityStatementMessagingEndpoint` items (represented as `dict` in JSON). """ - - self.reliableCache = None - """ Reliable Message Cache Length (min). - Type `int`. """ - - self.supportedMessage = None - """ Messages supported by this system. - List of `CapabilityStatementMessagingSupportedMessage` items (represented as `dict` in JSON). """ - - super(CapabilityStatementMessaging, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CapabilityStatementMessaging, self).elementProperties() - js.extend([ - ("documentation", "documentation", str, False, None, False), - ("endpoint", "endpoint", CapabilityStatementMessagingEndpoint, True, None, False), - ("reliableCache", "reliableCache", int, False, None, False), - ("supportedMessage", "supportedMessage", CapabilityStatementMessagingSupportedMessage, True, None, False), - ]) - return js - - -class CapabilityStatementMessagingEndpoint(backboneelement.BackboneElement): - """ Where messages should be sent. - - An endpoint (network accessible address) to which messages and/or replies - are to be sent. - """ - - resource_type = "CapabilityStatementMessagingEndpoint" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Network address or identifier of the end-point. - Type `str`. """ - - self.protocol = None - """ http | ftp | mllp +. - Type `Coding` (represented as `dict` in JSON). """ - - super(CapabilityStatementMessagingEndpoint, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CapabilityStatementMessagingEndpoint, self).elementProperties() - js.extend([ - ("address", "address", str, False, None, True), - ("protocol", "protocol", coding.Coding, False, None, True), - ]) - return js - - -class CapabilityStatementMessagingSupportedMessage(backboneelement.BackboneElement): - """ Messages supported by this system. - - References to message definitions for messages this system can send or - receive. - """ - - resource_type = "CapabilityStatementMessagingSupportedMessage" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Message supported by this system. - Type `str`. """ - - self.mode = None - """ sender | receiver. - Type `str`. """ - - super(CapabilityStatementMessagingSupportedMessage, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CapabilityStatementMessagingSupportedMessage, self).elementProperties() - js.extend([ - ("definition", "definition", str, False, None, True), - ("mode", "mode", str, False, None, True), - ]) - return js - - -class CapabilityStatementRest(backboneelement.BackboneElement): - """ If the endpoint is a RESTful one. - - A definition of the restful capabilities of the solution, if any. - """ - - resource_type = "CapabilityStatementRest" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.compartment = None - """ Compartments served/used by system. - List of `str` items. """ - - self.documentation = None - """ General description of implementation. - Type `str`. """ - - self.interaction = None - """ What operations are supported?. - List of `CapabilityStatementRestInteraction` items (represented as `dict` in JSON). """ - - self.mode = None - """ client | server. - Type `str`. """ - - self.operation = None - """ Definition of a system level operation. - List of `CapabilityStatementRestResourceOperation` items (represented as `dict` in JSON). """ - - self.resource = None - """ Resource served on the REST interface. - List of `CapabilityStatementRestResource` items (represented as `dict` in JSON). """ - - self.searchParam = None - """ Search parameters for searching all resources. - List of `CapabilityStatementRestResourceSearchParam` items (represented as `dict` in JSON). """ - - self.security = None - """ Information about security of implementation. - Type `CapabilityStatementRestSecurity` (represented as `dict` in JSON). """ - - super(CapabilityStatementRest, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CapabilityStatementRest, self).elementProperties() - js.extend([ - ("compartment", "compartment", str, True, None, False), - ("documentation", "documentation", str, False, None, False), - ("interaction", "interaction", CapabilityStatementRestInteraction, True, None, False), - ("mode", "mode", str, False, None, True), - ("operation", "operation", CapabilityStatementRestResourceOperation, True, None, False), - ("resource", "resource", CapabilityStatementRestResource, True, None, False), - ("searchParam", "searchParam", CapabilityStatementRestResourceSearchParam, True, None, False), - ("security", "security", CapabilityStatementRestSecurity, False, None, False), - ]) - return js - - -class CapabilityStatementRestInteraction(backboneelement.BackboneElement): - """ What operations are supported?. - - A specification of restful operations supported by the system. - """ - - resource_type = "CapabilityStatementRestInteraction" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ transaction | batch | search-system | history-system. - Type `str`. """ - - self.documentation = None - """ Anything special about operation behavior. - Type `str`. """ - - super(CapabilityStatementRestInteraction, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CapabilityStatementRestInteraction, self).elementProperties() - js.extend([ - ("code", "code", str, False, None, True), - ("documentation", "documentation", str, False, None, False), - ]) - return js - - -class CapabilityStatementRestResource(backboneelement.BackboneElement): - """ Resource served on the REST interface. - - A specification of the restful capabilities of the solution for a specific - resource type. - """ - - resource_type = "CapabilityStatementRestResource" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.conditionalCreate = None - """ If allows/uses conditional create. - Type `bool`. """ - - self.conditionalDelete = None - """ not-supported | single | multiple - how conditional delete is - supported. - Type `str`. """ - - self.conditionalRead = None - """ not-supported | modified-since | not-match | full-support. - Type `str`. """ - - self.conditionalUpdate = None - """ If allows/uses conditional update. - Type `bool`. """ - - self.documentation = None - """ Additional information about the use of the resource type. - Type `str`. """ - - self.interaction = None - """ 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 `str`. """ - - self.readHistory = None - """ Whether vRead can return past versions. - Type `bool`. """ - - self.referencePolicy = None - """ literal | logical | resolves | enforced | local. - List of `str` items. """ - - self.searchInclude = None - """ _include values supported by the server. - List of `str` items. """ - - self.searchParam = None - """ Search parameters supported by implementation. - List of `CapabilityStatementRestResourceSearchParam` items (represented as `dict` in JSON). """ - - self.searchRevInclude = None - """ _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`. """ - - self.updateCreate = None - """ If update can commit to a new identity. - Type `bool`. """ - - self.versioning = None - """ no-version | versioned | versioned-update. - Type `str`. """ - - super(CapabilityStatementRestResource, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CapabilityStatementRestResource, self).elementProperties() - js.extend([ - ("conditionalCreate", "conditionalCreate", bool, False, None, False), - ("conditionalDelete", "conditionalDelete", str, False, None, False), - ("conditionalRead", "conditionalRead", str, False, None, False), - ("conditionalUpdate", "conditionalUpdate", bool, False, None, False), - ("documentation", "documentation", str, 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), - ]) - return js - - -class CapabilityStatementRestResourceInteraction(backboneelement.BackboneElement): - """ What operations are supported?. - - Identifies a restful operation supported by the solution. - """ - - resource_type = "CapabilityStatementRestResourceInteraction" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ read | vread | update | patch | delete | history-instance | - history-type | create | search-type. - Type `str`. """ - - self.documentation = None - """ Anything special about operation behavior. - Type `str`. """ - - super(CapabilityStatementRestResourceInteraction, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CapabilityStatementRestResourceInteraction, self).elementProperties() - js.extend([ - ("code", "code", str, False, None, True), - ("documentation", "documentation", str, False, None, False), - ]) - 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. - - Search parameters for implementations to support and/or make use of - - either references to ones defined in the specification, or additional ones - defined for/by the implementation. - """ - - resource_type = "CapabilityStatementRestResourceSearchParam" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Source of definition for parameter. - Type `str`. """ - - self.documentation = None - """ Server-specific usage. - Type `str`. """ - - self.name = None - """ Name of search parameter. - Type `str`. """ - - self.type = None - """ number | date | string | token | reference | composite | quantity | - uri | special. - Type `str`. """ - - super(CapabilityStatementRestResourceSearchParam, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CapabilityStatementRestResourceSearchParam, self).elementProperties() - js.extend([ - ("definition", "definition", str, False, None, False), - ("documentation", "documentation", str, False, None, False), - ("name", "name", str, False, None, True), - ("type", "type", str, False, None, True), - ]) - return js - - -class CapabilityStatementRestSecurity(backboneelement.BackboneElement): - """ Information about security of implementation. - - Information about security implementation from an interface perspective - - what a client needs to know. - """ - - resource_type = "CapabilityStatementRestSecurity" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.cors = None - """ Adds CORS Headers (http://enable-cors.org/). - Type `bool`. """ - - self.description = None - """ General description of how security works. - Type `str`. """ - - self.service = None - """ OAuth | SMART-on-FHIR | NTLM | Basic | Kerberos | Certificates. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - super(CapabilityStatementRestSecurity, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CapabilityStatementRestSecurity, self).elementProperties() - js.extend([ - ("cors", "cors", bool, False, None, False), - ("description", "description", str, False, None, False), - ("service", "service", codeableconcept.CodeableConcept, True, None, False), - ]) - return js - - -class CapabilityStatementSoftware(backboneelement.BackboneElement): - """ Software that is covered by this capability statement. - - Software that is covered by this capability statement. It is used when the - capability statement describes the capabilities of a particular software - version, independent of an installation. - """ - - resource_type = "CapabilityStatementSoftware" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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.releaseDate = None - """ Date this version was released. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.version = None - """ Version covered by this statement. - Type `str`. """ - - super(CapabilityStatementSoftware, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CapabilityStatementSoftware, self).elementProperties() - js.extend([ - ("name", "name", str, False, None, True), - ("releaseDate", "releaseDate", fhirdate.FHIRDate, False, 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 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 fhirreference -except ImportError: - fhirreference = sys.modules[__package__ + '.fhirreference'] -try: - from . import usagecontext -except ImportError: - usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/capabilitystatement_tests.py b/fhirclient/models/capabilitystatement_tests.py deleted file mode 100644 index 4cfc329c0..000000000 --- a/fhirclient/models/capabilitystatement_tests.py +++ /dev/null @@ -1,177 +0,0 @@ -#!/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 capabilitystatement -from .fhirdate import FHIRDate - - -class CapabilityStatementTests(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("CapabilityStatement", js["resourceType"]) - return capabilitystatement.CapabilityStatement(js) - - def testCapabilityStatement1(self): - inst = self.instantiate_from("capabilitystatement-example.json") - self.assertIsNotNone(inst, "Must have instantiated a CapabilityStatement instance") - self.implCapabilityStatement1(inst) - - js = inst.as_json() - self.assertEqual("CapabilityStatement", js["resourceType"]) - inst2 = capabilitystatement.CapabilityStatement(js) - self.implCapabilityStatement1(inst2) - - def implCapabilityStatement1(self, inst): - 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.copyright, "Copyright © Acme Healthcare and GoodCorp EHR Systems") - 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.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, "4.0.0") - self.assertEqual(inst.format[0], "xml") - self.assertEqual(inst.format[1], "json") - self.assertEqual(inst.id, "example") - self.assertEqual(inst.implementation.description, "main EHR at ACME") - self.assertEqual(inst.implementation.url, "http://10.2.3.4/fhir") - self.assertEqual(inst.implementationGuide[0], "http://hl7.org/fhir/us/lab") - self.assertEqual(inst.instantiates[0], "http://ihe.org/fhir/CapabilityStatement/pixm-client") - 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.kind, "instance") - 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://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") - self.assertEqual(inst.publisher, "ACME Corporation") - self.assertEqual(inst.purpose, "Main EHR capability statement, published for contracting and operational support") - self.assertEqual(inst.rest[0].compartment[0], "http://hl7.org/fhir/CompartmentDefinition/patient") - self.assertEqual(inst.rest[0].documentation, "Main FHIR endpoint for acem health") - self.assertEqual(inst.rest[0].interaction[0].code, "transaction") - self.assertEqual(inst.rest[0].interaction[1].code, "history-system") - self.assertEqual(inst.rest[0].mode, "server") - self.assertTrue(inst.rest[0].resource[0].conditionalCreate) - self.assertEqual(inst.rest[0].resource[0].conditionalDelete, "not-supported") - self.assertEqual(inst.rest[0].resource[0].conditionalRead, "full-support") - self.assertFalse(inst.rest[0].resource[0].conditionalUpdate) - self.assertEqual(inst.rest[0].resource[0].documentation, "This server does not let the clients create identities.") - self.assertEqual(inst.rest[0].resource[0].interaction[0].code, "read") - self.assertEqual(inst.rest[0].resource[0].interaction[1].code, "vread") - self.assertEqual(inst.rest[0].resource[0].interaction[1].documentation, "Only supported for patient records since 12-Dec 2012") - self.assertEqual(inst.rest[0].resource[0].interaction[2].code, "update") - 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") - self.assertEqual(inst.rest[0].resource[0].searchParam[0].documentation, "Only supports search by institution MRN") - self.assertEqual(inst.rest[0].resource[0].searchParam[0].name, "identifier") - self.assertEqual(inst.rest[0].resource[0].searchParam[0].type, "token") - self.assertEqual(inst.rest[0].resource[0].searchParam[1].definition, "http://hl7.org/fhir/SearchParameter/Patient-general-practitioner") - 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.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://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") - self.assertEqual(inst.software.version, "0.00.020.2134") - 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.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, "positive") - self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].system, "http://terminology.hl7.org/CodeSystem/variant-state") - self.assertEqual(inst.version, "20130510") - - def testCapabilityStatement2(self): - inst = self.instantiate_from("capabilitystatement-phr-example.json") - self.assertIsNotNone(inst, "Must have instantiated a CapabilityStatement instance") - self.implCapabilityStatement2(inst) - - js = inst.as_json() - self.assertEqual("CapabilityStatement", js["resourceType"]) - inst2 = capabilitystatement.CapabilityStatement(js) - self.implCapabilityStatement2(inst2) - - def implCapabilityStatement2(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.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, "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") - self.assertEqual(inst.rest[0].mode, "server") - self.assertEqual(inst.rest[0].resource[0].interaction[0].code, "read") - self.assertEqual(inst.rest[0].resource[0].interaction[1].code, "search-type") - self.assertEqual(inst.rest[0].resource[0].interaction[1].documentation, "When a client searches patients with no search criteria, they get a list of all patients they have access too. Servers may elect to offer additional search parameters, but this is not required") - self.assertEqual(inst.rest[0].resource[0].type, "Patient") - self.assertEqual(inst.rest[0].resource[1].interaction[0].code, "read") - self.assertEqual(inst.rest[0].resource[1].interaction[1].code, "search-type") - self.assertEqual(inst.rest[0].resource[1].searchParam[0].documentation, "_id parameter always supported. For the connectathon, servers may elect which search parameters are supported") - self.assertEqual(inst.rest[0].resource[1].searchParam[0].name, "_id") - self.assertEqual(inst.rest[0].resource[1].searchParam[0].type, "token") - self.assertEqual(inst.rest[0].resource[1].type, "DocumentReference") - self.assertEqual(inst.rest[0].resource[2].interaction[0].code, "read") - self.assertEqual(inst.rest[0].resource[2].interaction[1].code, "search-type") - self.assertEqual(inst.rest[0].resource[2].searchParam[0].documentation, "Standard _id parameter") - self.assertEqual(inst.rest[0].resource[2].searchParam[0].name, "_id") - self.assertEqual(inst.rest[0].resource[2].searchParam[0].type, "token") - self.assertEqual(inst.rest[0].resource[2].type, "Condition") - self.assertEqual(inst.rest[0].resource[3].interaction[0].code, "read") - self.assertEqual(inst.rest[0].resource[3].interaction[1].code, "search-type") - self.assertEqual(inst.rest[0].resource[3].searchParam[0].documentation, "Standard _id parameter") - self.assertEqual(inst.rest[0].resource[3].searchParam[0].name, "_id") - self.assertEqual(inst.rest[0].resource[3].searchParam[0].type, "token") - self.assertEqual(inst.rest[0].resource[3].searchParam[1].documentation, "which diagnostic discipline/department created the report") - self.assertEqual(inst.rest[0].resource[3].searchParam[1].name, "service") - self.assertEqual(inst.rest[0].resource[3].searchParam[1].type, "token") - self.assertEqual(inst.rest[0].resource[3].type, "DiagnosticReport") - self.assertEqual(inst.rest[0].security.service[0].text, "OAuth") - self.assertEqual(inst.software.name, "ACME PHR Server") - self.assertEqual(inst.status, "draft") - self.assertEqual(inst.text.status, "generated") - diff --git a/fhirclient/models/careplan.py b/fhirclient/models/careplan.py deleted file mode 100644 index a240d801d..000000000 --- a/fhirclient/models/careplan.py +++ /dev/null @@ -1,367 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/CarePlan) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class CarePlan(domainresource.DomainResource): - """ Healthcare plan for patient or group. - - Describes the intention of how one or more practitioners intend to deliver - care for a particular patient, group or community for a period of time, - possibly limited to care for a specific condition or set of conditions. - """ - - resource_type = "CarePlan" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.activity = None - """ Action to occur as part of plan. - List of `CarePlanActivity` items (represented as `dict` in JSON). """ - - self.addresses = None - """ Health issues this plan addresses. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.author = None - """ Who is the designated responsible party. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.basedOn = None - """ Fulfills CarePlan. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.careTeam = None - """ Who's involved in plan?. - 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.contributor = None - """ Who provided the content of the care plan. - List of `FHIRReference` items (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 (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`. """ - - self.note = None - """ Comments about the plan. - List of `Annotation` items (represented as `dict` in JSON). """ - - self.partOf = None - """ Part of referenced CarePlan. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.period = None - """ Time period plan covers. - Type `Period` (represented as `dict` in JSON). """ - - self.replaces = None - """ CarePlan replaced by this CarePlan. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.status = None - """ draft | active | suspended | completed | entered-in-error | - cancelled | unknown. - Type `str`. """ - - self.subject = None - """ 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 (represented as `dict` in JSON). """ - - self.title = None - """ Human-friendly name for the care plan. - Type `str`. """ - - super(CarePlan, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CarePlan, self).elementProperties() - js.extend([ - ("activity", "activity", CarePlanActivity, True, None, False), - ("addresses", "addresses", 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), - ("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), - ("period", "period", period.Period, False, None, False), - ("replaces", "replaces", fhirreference.FHIRReference, True, None, False), - ("status", "status", str, False, None, True), - ("subject", "subject", fhirreference.FHIRReference, False, None, True), - ("supportingInfo", "supportingInfo", fhirreference.FHIRReference, True, None, False), - ("title", "title", str, False, None, False), - ]) - return js - - -from . import backboneelement - -class CarePlanActivity(backboneelement.BackboneElement): - """ Action to occur as part of plan. - - Identifies a planned action to occur as part of the plan. For example, a - medication to be used, lab tests to perform, self-monitoring, education, - etc. - """ - - resource_type = "CarePlanActivity" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.detail = None - """ In-line definition of activity. - Type `CarePlanActivityDetail` (represented as `dict` in JSON). """ - - self.outcomeCodeableConcept = None - """ Results of the activity. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.outcomeReference = None - """ Appointment, Encounter, Procedure, etc.. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.progress = None - """ Comments about the activity status/progress. - List of `Annotation` items (represented as `dict` in JSON). """ - - self.reference = None - """ Activity details defined in specific resource. - Type `FHIRReference` (represented as `dict` in JSON). """ - - super(CarePlanActivity, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CarePlanActivity, self).elementProperties() - js.extend([ - ("detail", "detail", CarePlanActivityDetail, False, None, False), - ("outcomeCodeableConcept", "outcomeCodeableConcept", codeableconcept.CodeableConcept, True, None, False), - ("outcomeReference", "outcomeReference", fhirreference.FHIRReference, True, None, False), - ("progress", "progress", annotation.Annotation, True, None, False), - ("reference", "reference", fhirreference.FHIRReference, False, None, False), - ]) - return js - - -class CarePlanActivityDetail(backboneelement.BackboneElement): - """ In-line definition of activity. - - A simple summary of a planned activity suitable for a general care plan - system (e.g. form driven) that doesn't know about specific resources such - as procedure etc. - """ - - resource_type = "CarePlanActivityDetail" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Detail type of activity. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.dailyAmount = None - """ How to consume/day?. - Type `Quantity` (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 (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` (represented as `dict` in JSON). """ - - self.performer = None - """ Who will be responsible?. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.productCodeableConcept = None - """ What is to be administered/supplied. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.productReference = None - """ What is to be administered/supplied. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.quantity = None - """ How much to administer/supply/consume. - Type `Quantity` (represented as `dict` in JSON). """ - - self.reasonCode = None - """ Why activity should be done or why activity was prohibited. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.reasonReference = None - """ Why activity is needed. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.scheduledPeriod = None - """ When activity is to occur. - Type `Period` (represented as `dict` in JSON). """ - - self.scheduledString = None - """ When activity is to occur. - Type `str`. """ - - self.scheduledTiming = None - """ When activity is to occur. - Type `Timing` (represented as `dict` in JSON). """ - - self.status = None - """ not-started | scheduled | in-progress | on-hold | completed | - cancelled | stopped | unknown | entered-in-error. - Type `str`. """ - - self.statusReason = None - """ Reason for current status. - 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([ - ("code", "code", codeableconcept.CodeableConcept, False, None, False), - ("dailyAmount", "dailyAmount", quantity.Quantity, 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), - ("quantity", "quantity", quantity.Quantity, False, None, False), - ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), - ("reasonReference", "reasonReference", fhirreference.FHIRReference, True, None, False), - ("scheduledPeriod", "scheduledPeriod", period.Period, False, "scheduled", False), - ("scheduledString", "scheduledString", str, False, "scheduled", False), - ("scheduledTiming", "scheduledTiming", timing.Timing, False, "scheduled", False), - ("status", "status", str, False, None, True), - ("statusReason", "statusReason", 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 period -except ImportError: - period = sys.modules[__package__ + '.period'] -try: - from . import quantity -except ImportError: - quantity = sys.modules[__package__ + '.quantity'] -try: - from . import timing -except ImportError: - timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/careplan_tests.py b/fhirclient/models/careplan_tests.py deleted file mode 100644 index 53e03c136..000000000 --- a/fhirclient/models/careplan_tests.py +++ /dev/null @@ -1,511 +0,0 @@ -#!/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 careplan -from .fhirdate import FHIRDate - - -class CarePlanTests(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("CarePlan", js["resourceType"]) - return careplan.CarePlan(js) - - def testCarePlan1(self): - inst = self.instantiate_from("careplan-example-f002-lung.json") - self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") - self.implCarePlan1(inst) - - js = inst.as_json() - self.assertEqual("CarePlan", js["resourceType"]) - inst2 = careplan.CarePlan(js) - self.implCarePlan1(inst2) - - def implCarePlan1(self, inst): - 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.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, "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.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-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-f202-malignancy.json") - self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") - self.implCarePlan2(inst) - - js = inst.as_json() - self.assertEqual("CarePlan", js["resourceType"]) - inst2 = careplan.CarePlan(js) - self.implCarePlan2(inst2) - - def implCarePlan2(self, inst): - 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.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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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-obesity-narrative.json") - self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") - self.implCarePlan3(inst) - - js = inst.as_json() - self.assertEqual("CarePlan", js["resourceType"]) - inst2 = careplan.CarePlan(js) - self.implCarePlan3(inst2) - - def implCarePlan3(self, inst): - self.assertEqual(inst.id, "obesity-narrative") - 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.status, "active") - self.assertEqual(inst.text.status, "additional") - - def testCarePlan4(self): - inst = self.instantiate_from("careplan-example.json") - self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") - self.implCarePlan4(inst) - - js = inst.as_json() - self.assertEqual("CarePlan", js["resourceType"]) - inst2 = careplan.CarePlan(js) - self.implCarePlan4(inst2) - - def implCarePlan4(self, inst): - 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") - self.assertEqual(inst.activity[0].detail.dailyAmount.code, "258718000") - 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.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.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.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) - self.assertEqual(inst.period.start.as_json(), "2013-03-11") - self.assertEqual(inst.status, "draft") - self.assertEqual(inst.text.status, "generated") - - def testCarePlan6(self): - inst = self.instantiate_from("careplan-example-GPVisit.json") - self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") - self.implCarePlan6(inst) - - js = inst.as_json() - self.assertEqual("CarePlan", js["resourceType"]) - inst2 = careplan.CarePlan(js) - self.implCarePlan6(inst2) - - def implCarePlan6(self, inst): - 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.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.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.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 testCarePlan7(self): - inst = self.instantiate_from("careplan-example-integrated.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.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.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.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.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.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.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.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.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") - self.assertEqual(inst.activity[3].progress[0].text, "Eve would like to try for 5 days a week.") - self.assertEqual(inst.activity[3].progress[0].time.date, FHIRDate("2012-08-27").date) - self.assertEqual(inst.activity[3].progress[0].time.as_json(), "2012-08-27") - 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.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.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") - self.assertEqual(inst.activity[4].progress[0].text, "Eve walked 4 times the last week.") - self.assertEqual(inst.activity[4].progress[0].time.date, FHIRDate("2012-08-13").date) - self.assertEqual(inst.activity[4].progress[0].time.as_json(), "2012-08-13") - 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.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.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.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.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") - self.assertEqual(inst.activity[6].progress[0].text, "After restarting the vinegar soaks the psoriasis is improved and Eve plans to treat the remainder with light treatments. She plans to start this week.") - self.assertEqual(inst.activity[6].progress[0].time.date, FHIRDate("2012-08-13").date) - self.assertEqual(inst.activity[6].progress[0].time.as_json(), "2012-08-13") - 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.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.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.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.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") - self.assertEqual(inst.activity[8].progress[0].text, "Will be able to esume exercise.") - self.assertEqual(inst.activity[8].progress[0].time.date, FHIRDate("2012-07-30").date) - self.assertEqual(inst.activity[8].progress[0].time.as_json(), "2012-07-30") - 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.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.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") - self.assertEqual(inst.contained[0].id, "p1") - self.assertEqual(inst.contained[1].id, "p2") - self.assertEqual(inst.contained[2].id, "p3") - self.assertEqual(inst.contained[3].id, "g1") - self.assertEqual(inst.contained[4].id, "g2") - self.assertEqual(inst.contained[5].id, "g3") - self.assertEqual(inst.contained[6].id, "g4") - 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-f001-heart.json") - self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") - self.implCarePlan9(inst) - - js = inst.as_json() - self.assertEqual("CarePlan", js["resourceType"]) - inst2 = careplan.CarePlan(js) - self.implCarePlan9(inst2) - - def implCarePlan9(self, inst): - 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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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") - self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") - self.implCarePlan10(inst) - - js = inst.as_json() - self.assertEqual("CarePlan", js["resourceType"]) - inst2 = careplan.CarePlan(js) - self.implCarePlan10(inst2) - - def implCarePlan10(self, inst): - 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.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) - self.assertEqual(inst.activity[1].detail.scheduledTiming.repeat.boundsPeriod.start.as_json(), "2013-02-14") - 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.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.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.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.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) - self.assertEqual(inst.activity[3].detail.scheduledTiming.repeat.boundsPeriod.start.as_json(), "2013-09-01") - self.assertEqual(inst.activity[3].detail.status, "not-started") - self.assertEqual(inst.contained[0].id, "p1") - self.assertEqual(inst.contained[1].id, "pr1") - self.assertEqual(inst.contained[2].id, "pr2") - self.assertEqual(inst.contained[3].id, "careteam") - self.assertEqual(inst.contained[4].id, "goal") - self.assertEqual(inst.extension[0].url, "http://example.org/fhir/StructureDefinition/careplan#lmp") - self.assertEqual(inst.extension[0].valueDateTime.date, FHIRDate("2013-01-01").date) - 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) - self.assertEqual(inst.period.start.as_json(), "2013-01-01") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.status, "additional") - diff --git a/fhirclient/models/careteam.py b/fhirclient/models/careteam.py deleted file mode 100644 index 43bb8b9a4..000000000 --- a/fhirclient/models/careteam.py +++ /dev/null @@ -1,174 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/CareTeam) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class CareTeam(domainresource.DomainResource): - """ Planned participants in the coordination and delivery of care for a patient - or group. - - The Care Team includes all the people and organizations who plan to - participate in the coordination and delivery of care for a patient. - """ - - resource_type = "CareTeam" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Type of team. - List of `CodeableConcept` items (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. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.managingOrganization = None - """ Organization responsible for the care team. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.name = None - """ Name of the team, such as crisis assessment team. - Type `str`. """ - - self.note = None - """ Comments made about the CareTeam. - List of `Annotation` items (represented as `dict` in JSON). """ - - self.participant = None - """ Members of the team. - List of `CareTeamParticipant` items (represented as `dict` in JSON). """ - - self.period = None - """ Time period team covers. - Type `Period` (represented as `dict` in JSON). """ - - self.reasonCode = None - """ Why the care team exists. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.reasonReference = None - """ Why the care team exists. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.status = None - """ proposed | active | suspended | inactive | entered-in-error. - Type `str`. """ - - self.subject = None - """ Who care team is for. - 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) - - def elementProperties(self): - js = super(CareTeam, self).elementProperties() - js.extend([ - ("category", "category", codeableconcept.CodeableConcept, True, 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), - ("note", "note", annotation.Annotation, True, None, False), - ("participant", "participant", CareTeamParticipant, True, None, False), - ("period", "period", period.Period, False, None, False), - ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), - ("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 - - -from . import backboneelement - -class CareTeamParticipant(backboneelement.BackboneElement): - """ Members of the team. - - Identifies all people and organizations who are expected to be involved in - the care team. - """ - - resource_type = "CareTeamParticipant" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.member = None - """ Who is involved. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.onBehalfOf = None - """ Organization of the practitioner. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.period = None - """ Time period of participant. - Type `Period` (represented as `dict` in JSON). """ - - self.role = None - """ Type of involvement. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - super(CareTeamParticipant, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CareTeamParticipant, self).elementProperties() - js.extend([ - ("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, 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 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/careteam_tests.py b/fhirclient/models/careteam_tests.py deleted file mode 100644 index 7a1aa33d2..000000000 --- a/fhirclient/models/careteam_tests.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/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 careteam -from .fhirdate import FHIRDate - - -class CareTeamTests(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("CareTeam", js["resourceType"]) - return careteam.CareTeam(js) - - def testCareTeam1(self): - inst = self.instantiate_from("careteam-example.json") - self.assertIsNotNone(inst, "Must have instantiated a CareTeam instance") - self.implCareTeam1(inst) - - js = inst.as_json() - self.assertEqual("CareTeam", js["resourceType"]) - inst2 = careteam.CareTeam(js) - self.implCareTeam1(inst2) - - def implCareTeam1(self, inst): - 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[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[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") - self.assertEqual(inst.text.div, "
Care Team
") - self.assertEqual(inst.text.status, "generated") - diff --git a/fhirclient/models/chargeitem.py b/fhirclient/models/chargeitem.py deleted file mode 100644 index 0c0181b65..000000000 --- a/fhirclient/models/chargeitem.py +++ /dev/null @@ -1,260 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ChargeItem) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class ChargeItem(domainresource.DomainResource): - """ Item containing charge code(s) associated with the provision of healthcare - provider products. - - The resource ChargeItem describes the provision of healthcare provider - products for a certain patient, therefore referring not only to the - product, but containing in addition details of the provision, like date, - time, amounts and participating organizations and persons. Main Usage of - the ChargeItem is to enable the billing process and internal cost - allocation. - """ - - resource_type = "ChargeItem" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 to place this charge. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.bodysite = None - """ Anatomical location, if relevant. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.code = None - """ A code that identifies the charge, like a billing code. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.context = None - """ Encounter / Episode associated with event. - Type `FHIRReference` (represented as `dict` in JSON). """ - - 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. """ - - self.enteredDate = None - """ Date the charge item was entered. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.enterer = None - """ Individual who was entering. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.factorOverride = None - """ Factor overriding the associated rules. - Type `float`. """ - - self.identifier = None - """ Business Identifier for item. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.note = None - """ Comments made about the ChargeItem. - List of `Annotation` items (represented as `dict` in JSON). """ - - self.occurrenceDateTime = None - """ When the charged service was applied. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.occurrencePeriod = None - """ When the charged service was applied. - Type `Period` (represented as `dict` in JSON). """ - - self.occurrenceTiming = None - """ When the charged service was applied. - Type `Timing` (represented as `dict` in JSON). """ - - self.overrideReason = None - """ Reason for overriding the list price/factor. - Type `str`. """ - - self.partOf = None - """ Part of referenced ChargeItem. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.performer = None - """ Who performed charged service. - List of `ChargeItemPerformer` items (represented as `dict` in JSON). """ - - self.performingOrganization = None - """ 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). """ - - self.reason = None - """ Why was the charged service rendered?. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.requestingOrganization = None - """ Organization requesting the charged service. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.service = None - """ Which rendered service is being charged?. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.status = None - """ planned | billable | not-billable | aborted | billed | entered-in- - error | unknown. - Type `str`. """ - - self.subject = None - """ Individual service was done for/to. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.supportingInformation = None - """ Further information supporting this charge. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - super(ChargeItem, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ChargeItem, self).elementProperties() - js.extend([ - ("account", "account", fhirreference.FHIRReference, True, None, False), - ("bodysite", "bodysite", codeableconcept.CodeableConcept, True, None, False), - ("code", "code", codeableconcept.CodeableConcept, False, None, True), - ("context", "context", fhirreference.FHIRReference, False, 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, 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), - ("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), - ("service", "service", fhirreference.FHIRReference, True, None, False), - ("status", "status", str, False, None, True), - ("subject", "subject", fhirreference.FHIRReference, False, None, True), - ("supportingInformation", "supportingInformation", fhirreference.FHIRReference, True, None, False), - ]) - return js - - -from . import backboneelement - -class ChargeItemPerformer(backboneelement.BackboneElement): - """ Who performed charged service. - - Indicates who or what performed or participated in the charged service. - """ - - resource_type = "ChargeItemPerformer" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 performing. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.function = None - """ What type of performance was done. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(ChargeItemPerformer, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ChargeItemPerformer, 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: - 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'] -try: - from . import timing -except ImportError: - timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/chargeitem_tests.py b/fhirclient/models/chargeitem_tests.py deleted file mode 100644 index d9c794fc3..000000000 --- a/fhirclient/models/chargeitem_tests.py +++ /dev/null @@ -1,70 +0,0 @@ -#!/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 chargeitem -from .fhirdate import FHIRDate - - -class ChargeItemTests(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("ChargeItem", js["resourceType"]) - return chargeitem.ChargeItem(js) - - def testChargeItem1(self): - inst = self.instantiate_from("chargeitem-example.json") - self.assertIsNotNone(inst, "Must have instantiated a ChargeItem instance") - self.implChargeItem1(inst) - - js = inst.as_json() - self.assertEqual("ChargeItem", js["resourceType"]) - inst2 = chargeitem.ChargeItem(js) - self.implChargeItem1(inst2) - - 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.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[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") - self.assertEqual(inst.occurrencePeriod.end.date, FHIRDate("2017-01-25T12:35:00+01:00").date) - self.assertEqual(inst.occurrencePeriod.end.as_json(), "2017-01-25T12:35:00+01:00") - 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.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") - self.assertEqual(inst.reason[0].coding[0].display, "DIAG-1") - self.assertEqual(inst.reason[0].coding[0].system, "http://hl7.org/fhir/sid/icd-10") - self.assertEqual(inst.status, "billable") - self.assertEqual(inst.text.div, "
Example of ChargeItem Usage in Context of the German EBM Billing code system
") - self.assertEqual(inst.text.status, "generated") - diff --git a/fhirclient/models/claim.py b/fhirclient/models/claim.py deleted file mode 100644 index 8746641ee..000000000 --- a/fhirclient/models/claim.py +++ /dev/null @@ -1,949 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Claim) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class Claim(domainresource.DomainResource): - """ Claim, Pre-determination or Pre-authorization. - - 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" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.accident = None - """ Details of the event. - Type `ClaimAccident` (represented as `dict` in JSON). """ - - self.billablePeriod = None - """ Relevant time frame for the claim. - Type `Period` (represented as `dict` in JSON). """ - - self.careTeam = None - """ Members of the care team. - List of `ClaimCareTeam` items (represented as `dict` in JSON). """ - - self.created = None - """ Resource creation date. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.diagnosis = None - """ Pertinent diagnosis information. - List of `ClaimDiagnosis` items (represented as `dict` in JSON). """ - - self.enterer = None - """ Author of the claim. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.facility = None - """ Servicing facility. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.fundsReserve = None - """ For whom to reserve funds. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.identifier = None - """ Business Identifier for claim. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.insurance = None - """ Patient insurance information. - List of `ClaimInsurance` items (represented as `dict` in JSON). """ - - self.insurer = None - """ Target. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.item = None - """ Product or service provided. - List of `ClaimItem` items (represented as `dict` in JSON). """ - - self.originalPrescription = None - """ Original prescription if superseded by fulfiller. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.patient = None - """ The recipient of the products and services. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.payee = None - """ Recipient of benefits payable. - Type `ClaimPayee` (represented as `dict` in JSON). """ - - self.prescription = None - """ Prescription authorizing services and products. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.priority = None - """ Desired processing ugency. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.procedure = None - """ Clinical procedures performed. - List of `ClaimProcedure` items (represented as `dict` in JSON). """ - - self.provider = None - """ Party responsible for the claim. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.referral = None - """ Treatment referral. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.related = None - """ Prior or corollary claims. - List of `ClaimRelated` items (represented as `dict` in JSON). """ - - self.status = None - """ active | cancelled | draft | entered-in-error. - Type `str`. """ - - self.subType = None - """ 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 - """ Category or discipline. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.use = None - """ claim | preauthorization | predetermination. - Type `str`. """ - - super(Claim, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Claim, self).elementProperties() - js.extend([ - ("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, True), - ("diagnosis", "diagnosis", ClaimDiagnosis, True, None, False), - ("enterer", "enterer", fhirreference.FHIRReference, False, None, False), - ("facility", "facility", fhirreference.FHIRReference, False, None, False), - ("fundsReserve", "fundsReserve", codeableconcept.CodeableConcept, False, None, False), - ("identifier", "identifier", identifier.Identifier, True, None, False), - ("insurance", "insurance", ClaimInsurance, True, None, True), - ("insurer", "insurer", fhirreference.FHIRReference, False, None, False), - ("item", "item", ClaimItem, True, None, False), - ("originalPrescription", "originalPrescription", 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, True), - ("procedure", "procedure", ClaimProcedure, True, 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, 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, True), - ("use", "use", str, False, None, True), - ]) - return js - - -from . import backboneelement - -class ClaimAccident(backboneelement.BackboneElement): - """ Details of the event. - - Details of an accident which resulted in injuries which required the - products and services listed in the claim. - """ - - resource_type = "ClaimAccident" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ When the incident occurred. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.locationAddress = None - """ Where the event occurred. - Type `Address` (represented as `dict` in JSON). """ - - self.locationReference = None - """ Where the event occurred. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.type = None - """ The nature of the accident. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(ClaimAccident, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ClaimAccident, self).elementProperties() - js.extend([ - ("date", "date", fhirdate.FHIRDate, False, None, True), - ("locationAddress", "locationAddress", address.Address, False, "location", False), - ("locationReference", "locationReference", fhirreference.FHIRReference, False, "location", False), - ("type", "type", codeableconcept.CodeableConcept, False, None, False), - ]) - return js - - -class ClaimCareTeam(backboneelement.BackboneElement): - """ Members of the care team. - - The members of the team who provided the products and services. - """ - - resource_type = "ClaimCareTeam" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.provider = None - """ Practitioner or organization. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.qualification = None - """ Practitioner credential or specialization. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.responsible = None - """ Indicator of the lead practitioner. - Type `bool`. """ - - self.role = None - """ Function within the team. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.sequence = None - """ Order of care team. - Type `int`. """ - - super(ClaimCareTeam, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ClaimCareTeam, self).elementProperties() - js.extend([ - ("provider", "provider", fhirreference.FHIRReference, False, None, True), - ("qualification", "qualification", codeableconcept.CodeableConcept, False, None, False), - ("responsible", "responsible", bool, False, None, False), - ("role", "role", codeableconcept.CodeableConcept, False, None, False), - ("sequence", "sequence", int, False, None, True), - ]) - return js - - -class ClaimDiagnosis(backboneelement.BackboneElement): - """ Pertinent diagnosis information. - - Information about diagnoses relevant to the claim items. - """ - - resource_type = "ClaimDiagnosis" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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). """ - - 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 - """ Diagnosis instance identifier. - Type `int`. """ - - self.type = None - """ Timing or nature of the diagnosis. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - super(ClaimDiagnosis, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ClaimDiagnosis, self).elementProperties() - 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), - ]) - return js - - -class ClaimInsurance(backboneelement.BackboneElement): - """ Patient insurance information. - - Financial instruments for reimbursement for the health care products and - services specified on the claim. - """ - - resource_type = "ClaimInsurance" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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.claimResponse = None - """ Adjudication results. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.coverage = None - """ Insurance information. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.focal = None - """ 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 - """ Prior authorization reference number. - List of `str` items. """ - - self.sequence = None - """ Insurance instance identifier. - Type `int`. """ - - super(ClaimInsurance, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ClaimInsurance, self).elementProperties() - js.extend([ - ("businessArrangement", "businessArrangement", str, False, None, False), - ("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), - ]) - return js - - -class ClaimItem(backboneelement.BackboneElement): - """ Product or service provided. - - 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" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.bodySite = None - """ Anatomical location. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.careTeamSequence = None - """ Applicable careTeam members. - List of `int` items. """ - - self.category = None - """ Benefit classification. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.detail = None - """ Product or service provided. - List of `ClaimItemDetail` items (represented as `dict` in JSON). """ - - self.diagnosisSequence = None - """ Applicable diagnoses. - List of `int` items. """ - - self.encounter = None - """ Encounters related to this billed item. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.factor = None - """ Price scaling factor. - Type `float`. """ - - self.informationSequence = None - """ Applicable exception and supporting information. - 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 - """ 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.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 the product or service is provided under. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.quantity = None - """ Count of products or services. - Type `Quantity` (represented as `dict` in JSON). """ - - self.revenue = None - """ Revenue or cost center code. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.sequence = None - """ Item instance identifier. - Type `int`. """ - - 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.udi = None - """ Unique device identifier. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.unitPrice = None - """ Fee, charge or cost per item. - Type `Money` (represented as `dict` in JSON). """ - - super(ClaimItem, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ClaimItem, self).elementProperties() - js.extend([ - ("bodySite", "bodySite", codeableconcept.CodeableConcept, False, None, False), - ("careTeamSequence", "careTeamSequence", int, True, None, False), - ("category", "category", codeableconcept.CodeableConcept, False, None, False), - ("detail", "detail", ClaimItemDetail, True, None, False), - ("diagnosisSequence", "diagnosisSequence", int, True, None, False), - ("encounter", "encounter", fhirreference.FHIRReference, True, None, False), - ("factor", "factor", float, False, 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), - ("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), - ("servicedDate", "servicedDate", fhirdate.FHIRDate, False, "serviced", False), - ("servicedPeriod", "servicedPeriod", period.Period, False, "serviced", False), - ("subSite", "subSite", codeableconcept.CodeableConcept, True, None, False), - ("udi", "udi", fhirreference.FHIRReference, True, None, False), - ("unitPrice", "unitPrice", money.Money, False, None, False), - ]) - return js - - -class ClaimItemDetail(backboneelement.BackboneElement): - """ Product or service provided. - - A claim detail line. Either a simple (a product or service) or a 'group' of - sub-details which are simple items. - """ - - resource_type = "ClaimItemDetail" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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.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.productOrService = None - """ Billing, service, product, or drug code. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.programCode = None - """ 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. - Type `Quantity` (represented as `dict` in JSON). """ - - self.revenue = None - """ Revenue or cost center code. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.sequence = None - """ Item instance identifier. - Type `int`. """ - - self.subDetail = None - """ Product or service provided. - List of `ClaimItemDetailSubDetail` items (represented as `dict` in JSON). """ - - self.udi = None - """ Unique device identifier. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.unitPrice = None - """ Fee, charge or cost per item. - Type `Money` (represented as `dict` in JSON). """ - - super(ClaimItemDetail, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ClaimItemDetail, self).elementProperties() - js.extend([ - ("category", "category", codeableconcept.CodeableConcept, False, None, False), - ("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), - ("subDetail", "subDetail", ClaimItemDetailSubDetail, True, None, False), - ("udi", "udi", fhirreference.FHIRReference, True, None, False), - ("unitPrice", "unitPrice", money.Money, False, None, False), - ]) - return js - - -class ClaimItemDetailSubDetail(backboneelement.BackboneElement): - """ Product or service provided. - - A claim detail line. Either a simple (a product or service) or a 'group' of - sub-details which are simple items. - """ - - resource_type = "ClaimItemDetailSubDetail" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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.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.productOrService = None - """ Billing, service, product, or drug code. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.programCode = None - """ 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. - Type `Quantity` (represented as `dict` in JSON). """ - - self.revenue = None - """ Revenue or cost center code. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.sequence = None - """ Item instance identifier. - Type `int`. """ - - self.udi = None - """ Unique device identifier. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.unitPrice = None - """ Fee, charge or cost per item. - Type `Money` (represented as `dict` in JSON). """ - - super(ClaimItemDetailSubDetail, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ClaimItemDetailSubDetail, self).elementProperties() - js.extend([ - ("category", "category", codeableconcept.CodeableConcept, False, None, False), - ("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), - ("udi", "udi", fhirreference.FHIRReference, True, None, False), - ("unitPrice", "unitPrice", money.Money, False, None, False), - ]) - return js - - -class ClaimPayee(backboneelement.BackboneElement): - """ Recipient of benefits payable. - - The party to be reimbursed for cost of the products and services according - to the terms of the policy. - """ - - resource_type = "ClaimPayee" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.party = None - """ Recipient reference. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.type = None - """ Category of recipient. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(ClaimPayee, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ClaimPayee, self).elementProperties() - js.extend([ - ("party", "party", fhirreference.FHIRReference, False, None, False), - ("type", "type", codeableconcept.CodeableConcept, False, None, True), - ]) - return js - - -class ClaimProcedure(backboneelement.BackboneElement): - """ Clinical procedures performed. - - Procedures performed on the patient relevant to the billing items with the - claim. - """ - - resource_type = "ClaimProcedure" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ When the procedure was performed. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.procedureCodeableConcept = None - """ Specific clinical procedure. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.procedureReference = None - """ Specific clinical procedure. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.sequence = None - """ 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): - js = super(ClaimProcedure, self).elementProperties() - js.extend([ - ("date", "date", fhirdate.FHIRDate, False, None, False), - ("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): - """ Prior or corollary claims. - - 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" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.claim = None - """ Reference to the related claim. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.reference = None - """ File or case reference. - Type `Identifier` (represented as `dict` in JSON). """ - - self.relationship = None - """ How the reference claim is related. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(ClaimRelated, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ClaimRelated, self).elementProperties() - js.extend([ - ("claim", "claim", fhirreference.FHIRReference, False, None, False), - ("reference", "reference", identifier.Identifier, False, None, False), - ("relationship", "relationship", codeableconcept.CodeableConcept, False, None, False), - ]) - 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 -except ImportError: - address = sys.modules[__package__ + '.address'] -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 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/claim_tests.py b/fhirclient/models/claim_tests.py deleted file mode 100644 index 7fe79f78c..000000000 --- a/fhirclient/models/claim_tests.py +++ /dev/null @@ -1,777 +0,0 @@ -#!/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 claim -from .fhirdate import FHIRDate - - -class ClaimTests(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("Claim", js["resourceType"]) - return claim.Claim(js) - - def testClaim1(self): - inst = self.instantiate_from("claim-example-institutional-rich.json") - self.assertIsNotNone(inst, "Must have instantiated a Claim instance") - self.implClaim1(inst) - - js = inst.as_json() - self.assertEqual("Claim", js["resourceType"]) - inst2 = claim.Claim(js) - self.implClaim1(inst2) - - def implClaim1(self, inst): - self.assertEqual(inst.accident.date.date, FHIRDate("2014-07-09").date) - self.assertEqual(inst.accident.date.as_json(), "2014-07-09") - 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://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://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://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://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://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") - self.assertEqual(inst.insurance[0].businessArrangement, "BA987123") - 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].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].servicedDate.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.item[0].servicedDate.as_json(), "2014-08-16") - 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.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 testClaim2(self): - inst = self.instantiate_from("claim-example-professional.json") - self.assertIsNotNone(inst, "Must have instantiated a Claim instance") - self.implClaim2(inst) - - js = inst.as_json() - self.assertEqual("Claim", js["resourceType"]) - inst2 = claim.Claim(js) - self.implClaim2(inst2) - - def implClaim2(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, "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].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].servicedDate.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.item[0].servicedDate.as_json(), "2014-08-16") - 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.text.div, "
A human-readable rendering of the Claim
") - self.assertEqual(inst.text.status, "generated") - 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.json") - self.assertIsNotNone(inst, "Must have instantiated a Claim instance") - self.implClaim3(inst) - - js = inst.as_json() - self.assertEqual("Claim", js["resourceType"]) - inst2 = claim.Claim(js) - self.implClaim3(inst2) - - def implClaim3(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, "123456") - self.assertEqual(inst.diagnosis[0].sequence, 1) - self.assertEqual(inst.id, "100150") - self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/claim") - 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].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].servicedDate.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.item[0].servicedDate.as_json(), "2014-08-16") - 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, "
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://terminology.hl7.org/CodeSystem/claim-type") - self.assertEqual(inst.use, "claim") - - def testClaim4(self): - inst = self.instantiate_from("claim-example-vision.json") - self.assertIsNotNone(inst, "Must have instantiated a Claim instance") - self.implClaim4(inst) - - js = inst.as_json() - self.assertEqual("Claim", js["resourceType"]) - inst2 = claim.Claim(js) - self.implClaim4(inst2) - - def implClaim4(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, "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].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].servicedDate.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.item[0].servicedDate.as_json(), "2014-08-16") - 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.status, "active") - self.assertEqual(inst.text.div, "
A human-readable rendering of the Vision Claim
") - self.assertEqual(inst.text.status, "generated") - 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-vision-glasses-3tier.json") - self.assertIsNotNone(inst, "Must have instantiated a Claim instance") - self.implClaim5(inst) - - js = inst.as_json() - self.assertEqual("Claim", js["resourceType"]) - inst2 = claim.Claim(js) - self.implClaim5(inst2) - - def implClaim5(self, inst): - self.assertEqual(inst.careTeam[0].sequence, 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, "654321") - self.assertEqual(inst.diagnosis[0].sequence, 1) - 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.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].servicedDate.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.item[0].servicedDate.as_json(), "2014-08-16") - 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, "
A human-readable rendering of the Vision Claim for Glasses
") - self.assertEqual(inst.text.status, "generated") - 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-institutional.json") - self.assertIsNotNone(inst, "Must have instantiated a Claim instance") - self.implClaim6(inst) - - js = inst.as_json() - self.assertEqual("Claim", js["resourceType"]) - inst2 = claim.Claim(js) - self.implClaim6(inst2) - - def implClaim6(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, "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].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].servicedDate.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.item[0].servicedDate.as_json(), "2014-08-16") - 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.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.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-contained.json") - self.assertIsNotNone(inst, "Must have instantiated a Claim instance") - self.implClaim7(inst) - - js = inst.as_json() - self.assertEqual("Claim", js["resourceType"]) - inst2 = claim.Claim(js) - self.implClaim7(inst2) - - 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, "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].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].servicedDate.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.item[0].servicedDate.as_json(), "2014-08-16") - 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, "
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://terminology.hl7.org/CodeSystem/claim-type") - self.assertEqual(inst.use, "claim") - - def testClaim8(self): - inst = self.instantiate_from("claim-example-pharmacy-medication.json") - self.assertIsNotNone(inst, "Must have instantiated a Claim instance") - self.implClaim8(inst) - - js = inst.as_json() - self.assertEqual("Claim", js["resourceType"]) - inst2 = claim.Claim(js) - 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") - self.assertEqual(inst.diagnosis[0].diagnosisCodeableConcept.coding[0].code, "123457") - 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.fundsReserve.coding[0].code, "provider") - self.assertEqual(inst.id, "100153") - self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/claim") - 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].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].unitPrice.currency, "USD") - self.assertEqual(inst.item[0].detail[0].unitPrice.value, 1000.0) - 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].unitPrice.currency, "USD") - self.assertEqual(inst.item[0].detail[1].unitPrice.value, 1500.0) - 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].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[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].unitPrice.currency, "USD") - self.assertEqual(inst.item[0].detail[4].unitPrice.value, 250.0) - 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].servicedDate.date, FHIRDate("2015-05-16").date) - self.assertEqual(inst.item[0].servicedDate.as_json(), "2015-05-16") - 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].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].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.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].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].unitPrice.currency, "USD") - self.assertEqual(inst.item[2].detail[0].unitPrice.value, 750.0) - 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].unitPrice.currency, "USD") - self.assertEqual(inst.item[2].detail[1].unitPrice.value, 350.0) - 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].servicedDate.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.item[2].servicedDate.as_json(), "2014-08-16") - 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://terminology.hl7.org/CodeSystem/claim-type") - self.assertEqual(inst.use, "preauthorization") - - def testClaim10(self): - inst = self.instantiate_from("claim-example-cms1500-medical.json") - self.assertIsNotNone(inst, "Must have instantiated a Claim instance") - self.implClaim10(inst) - - js = inst.as_json() - self.assertEqual("Claim", js["resourceType"]) - inst2 = claim.Claim(js) - self.implClaim10(inst2) - - def implClaim10(self, inst): - self.assertEqual(inst.careTeam[0].sequence, 1) - 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.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].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].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.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.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.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 deleted file mode 100644 index f19d2db4d..000000000 --- a/fhirclient/models/claimresponse.py +++ /dev/null @@ -1,886 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# 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): - """ Response to a claim predetermination or preauthorization. - - This resource provides the adjudication details from the processing of a - Claim resource. - """ - - resource_type = "ClaimResponse" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.addItem = None - """ 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 (represented as `dict` in JSON). """ - - self.created = None - """ Response creation date. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.disposition = None - """ Disposition Message. - Type `str`. """ - - self.error = None - """ Processing errors. - List of `ClaimResponseError` items (represented as `dict` in JSON). """ - - self.form = None - """ 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 - """ Business Identifier for a claim response. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.insurance = None - """ Patient insurance information. - List of `ClaimResponseInsurance` items (represented as `dict` in JSON). """ - - self.insurer = None - """ Party responsible for reimbursement. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.item = None - """ Adjudication for claim line items. - List of `ClaimResponseItem` items (represented as `dict` in JSON). """ - - self.outcome = None - """ queued | complete | error | partial. - Type `str`. """ - - self.patient = None - """ 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. - 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 - """ Note concerning adjudication. - List of `ClaimResponseProcessNote` items (represented as `dict` in JSON). """ - - self.request = None - """ Id of resource triggering adjudication. - Type `FHIRReference` (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.subType = None - """ More granular claim type. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.total = None - """ Adjudication totals. - List of `ClaimResponseTotal` items (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) - - 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, True), - ("disposition", "disposition", str, False, None, False), - ("error", "error", ClaimResponseError, True, 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, True), - ("item", "item", ClaimResponseItem, True, 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), - ("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 - - -from . import backboneelement - -class ClaimResponseAddItem(backboneelement.BackboneElement): - """ Insurer added line items. - - The first-tier service adjudications for payor added product or service - lines. - """ - - resource_type = "ClaimResponseAddItem" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 `ClaimResponseItemAdjudication` items (represented as `dict` in JSON). """ - - self.bodySite = None - """ Anatomical location. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.detail = None - """ Insurer added line details. - List of `ClaimResponseAddItemDetail` items (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 - """ 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 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.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, True), - ("bodySite", "bodySite", codeableconcept.CodeableConcept, False, None, False), - ("detail", "detail", ClaimResponseAddItemDetail, True, 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), - ("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): - """ Insurer added line details. - - The second-tier service adjudications for payor added services. - """ - - resource_type = "ClaimResponseAddItemDetail" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Applicable note numbers. - List of `int` items. """ - - self.productOrService = None - """ Billing, service, product, or drug code. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - 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 - """ Applicable note numbers. - List of `int` items. """ - - self.productOrService = None - """ Billing, service, product, or drug code. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.quantity = None - """ Count of products or services. - Type `Quantity` (represented as `dict` in JSON). """ - - 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(ClaimResponseAddItemDetailSubDetail, 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), - ("unitPrice", "unitPrice", money.Money, False, None, False), - ]) - return js - - -class ClaimResponseError(backboneelement.BackboneElement): - """ Processing errors. - - Errors encountered during the processing of the adjudication. - """ - - resource_type = "ClaimResponseError" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Error code detailing processing issues. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.detailSequence = None - """ Detail sequence number. - Type `int`. """ - - self.itemSequence = None - """ Item sequence number. - Type `int`. """ - - self.subDetailSequence = None - """ Subdetail sequence number. - Type `int`. """ - - super(ClaimResponseError, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ClaimResponseError, self).elementProperties() - js.extend([ - ("code", "code", codeableconcept.CodeableConcept, False, None, True), - ("detailSequence", "detailSequence", int, False, None, False), - ("itemSequence", "itemSequence", int, False, None, False), - ("subDetailSequence", "subDetailSequence", int, False, None, False), - ]) - return js - - -class ClaimResponseInsurance(backboneelement.BackboneElement): - """ Patient insurance information. - - Financial instruments for reimbursement for the health care products and - services specified on the claim. - """ - - resource_type = "ClaimResponseInsurance" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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.claimResponse = None - """ Adjudication results. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.coverage = None - """ Insurance information. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.focal = None - """ Coverage to be used for adjudication. - Type `bool`. """ - - self.sequence = None - """ Insurance instance identifier. - Type `int`. """ - - super(ClaimResponseInsurance, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ClaimResponseInsurance, self).elementProperties() - js.extend([ - ("businessArrangement", "businessArrangement", str, False, None, False), - ("claimResponse", "claimResponse", fhirreference.FHIRReference, False, None, False), - ("coverage", "coverage", fhirreference.FHIRReference, False, None, True), - ("focal", "focal", bool, False, None, True), - ("sequence", "sequence", int, False, None, True), - ]) - return js - - -class ClaimResponseItem(backboneelement.BackboneElement): - """ Adjudication for claim line items. - - 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" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Adjudication details. - List of `ClaimResponseItemAdjudication` items (represented as `dict` in JSON). """ - - self.detail = None - """ 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 - """ Applicable note numbers. - List of `int` items. """ - - super(ClaimResponseItem, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ClaimResponseItem, self).elementProperties() - js.extend([ - ("adjudication", "adjudication", ClaimResponseItemAdjudication, True, None, True), - ("detail", "detail", ClaimResponseItemDetail, True, None, False), - ("itemSequence", "itemSequence", int, False, None, True), - ("noteNumber", "noteNumber", int, True, None, False), - ]) - return js - - -class ClaimResponseItemAdjudication(backboneelement.BackboneElement): - """ Adjudication details. - - 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" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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. - Type `Money` (represented as `dict` in JSON). """ - - self.category = None - """ Type of adjudication information. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.reason = None - """ Explanation of adjudication outcome. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.value = None - """ Non-monetary value. - Type `float`. """ - - super(ClaimResponseItemAdjudication, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ClaimResponseItemAdjudication, self).elementProperties() - js.extend([ - ("amount", "amount", money.Money, False, None, False), - ("category", "category", codeableconcept.CodeableConcept, False, None, True), - ("reason", "reason", codeableconcept.CodeableConcept, False, None, False), - ("value", "value", float, False, None, False), - ]) - return js - - -class ClaimResponseItemDetail(backboneelement.BackboneElement): - """ Adjudication for claim details. - - A claim detail. Either a simple (a product or service) or a 'group' of sub- - details which are simple items. - """ - - resource_type = "ClaimResponseItemDetail" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ 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 - """ Applicable note numbers. - List of `int` items. """ - - self.subDetail = None - """ Adjudication for claim sub-details. - List of `ClaimResponseItemDetailSubDetail` items (represented as `dict` in JSON). """ - - super(ClaimResponseItemDetail, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ClaimResponseItemDetail, self).elementProperties() - js.extend([ - ("adjudication", "adjudication", ClaimResponseItemAdjudication, True, None, True), - ("detailSequence", "detailSequence", int, False, None, True), - ("noteNumber", "noteNumber", int, True, None, False), - ("subDetail", "subDetail", ClaimResponseItemDetailSubDetail, True, None, False), - ]) - return js - - -class ClaimResponseItemDetailSubDetail(backboneelement.BackboneElement): - """ Adjudication for claim sub-details. - - A sub-detail adjudication of a simple product or service. - """ - - resource_type = "ClaimResponseItemDetailSubDetail" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Subdetail level adjudication details. - List of `ClaimResponseItemAdjudication` items (represented as `dict` in JSON). """ - - self.noteNumber = None - """ Applicable note numbers. - List of `int` items. """ - - self.subDetailSequence = None - """ Claim sub-detail instance identifier. - Type `int`. """ - - super(ClaimResponseItemDetailSubDetail, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ClaimResponseItemDetailSubDetail, self).elementProperties() - js.extend([ - ("adjudication", "adjudication", ClaimResponseItemAdjudication, True, None, False), - ("noteNumber", "noteNumber", int, True, None, False), - ("subDetailSequence", "subDetailSequence", int, False, None, True), - ]) - return js - - -class ClaimResponsePayment(backboneelement.BackboneElement): - """ Payment Details. - - Payment details for the adjudication of the claim. - """ - - resource_type = "ClaimResponsePayment" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.adjustment = None - """ Payment adjustment for non-claim issues. - Type `Money` (represented as `dict` in JSON). """ - - self.adjustmentReason = None - """ Explanation for the adjustment. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.amount = None - """ Payable amount after adjustment. - Type `Money` (represented as `dict` in JSON). """ - - self.date = None - """ Expected date of payment. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.identifier = None - """ Business identifier for the payment. - Type `Identifier` (represented as `dict` in JSON). """ - - self.type = None - """ Partial or complete payment. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(ClaimResponsePayment, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ClaimResponsePayment, self).elementProperties() - js.extend([ - ("adjustment", "adjustment", money.Money, False, None, False), - ("adjustmentReason", "adjustmentReason", codeableconcept.CodeableConcept, 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, True), - ]) - return js - - -class ClaimResponseProcessNote(backboneelement.BackboneElement): - """ Note concerning adjudication. - - A note that describes or explains adjudication results in a human readable - form. - """ - - resource_type = "ClaimResponseProcessNote" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Language of the text. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.number = None - """ Note instance identifier. - Type `int`. """ - - self.text = None - """ Note explanatory text. - Type `str`. """ - - self.type = None - """ display | print | printoper. - Type `str`. """ - - super(ClaimResponseProcessNote, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ClaimResponseProcessNote, self).elementProperties() - js.extend([ - ("language", "language", codeableconcept.CodeableConcept, False, None, False), - ("number", "number", int, 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 address -except ImportError: - address = sys.modules[__package__ + '.address'] -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 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 deleted file mode 100644 index 35501e543..000000000 --- a/fhirclient/models/claimresponse_tests.py +++ /dev/null @@ -1,474 +0,0 @@ -#!/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 claimresponse -from .fhirdate import FHIRDate - - -class ClaimResponseTests(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("ClaimResponse", js["resourceType"]) - return claimresponse.ClaimResponse(js) - - def testClaimResponse1(self): - inst = self.instantiate_from("claimresponse-example-unsolicited-preauth.json") - self.assertIsNotNone(inst, "Must have instantiated a ClaimResponse instance") - self.implClaimResponse1(inst) - - js = inst.as_json() - self.assertEqual("ClaimResponse", js["resourceType"]) - inst2 = claimresponse.ClaimResponse(js) - 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.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.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.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].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://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://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.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 deleted file mode 100644 index dbd825c4f..000000000 --- a/fhirclient/models/clinicalimpression.py +++ /dev/null @@ -1,253 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ClinicalImpression) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class ClinicalImpression(domainresource.DomainResource): - """ A clinical assessment performed when planning treatments and management - strategies for a patient. - - A record of a clinical assessment performed to determine what problem(s) - may affect the patient and before planning the treatments or management - strategies that are best to manage a patient's condition. Assessments are - often 1:1 with a clinical consultation / encounter, but this varies - greatly depending on the clinical workflow. This resource is called - "ClinicalImpression" rather than "ClinicalAssessment" to avoid confusion - with the recording of assessment tools such as Apgar score. - """ - - resource_type = "ClinicalImpression" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.assessor = None - """ The clinician performing the assessment. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.code = None - """ Kind of assessment performed. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.date = None - """ When the assessment was documented. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.description = None - """ Why/how the assessment was performed. - Type `str`. """ - - self.effectiveDateTime = None - """ Time of assessment. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.effectivePeriod = None - """ 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). """ - - self.identifier = None - """ Business identifier. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.investigation = None - """ One or more sets of investigations (signs, symptoms, etc.). - List of `ClinicalImpressionInvestigation` items (represented as `dict` in JSON). """ - - self.note = None - """ Comments made about the ClinicalImpression. - List of `Annotation` items (represented as `dict` in JSON). """ - - self.previous = None - """ Reference to last assessment. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.problem = None - """ Relevant impressions of patient state. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.prognosisCodeableConcept = None - """ Estimate of likely outcome. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.prognosisReference = None - """ RiskAssessment expressing likely outcome. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.protocol = None - """ Clinical Protocol followed. - List of `str` items. """ - - self.status = None - """ 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` (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([ - ("assessor", "assessor", fhirreference.FHIRReference, False, None, False), - ("code", "code", codeableconcept.CodeableConcept, 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), - ("note", "note", annotation.Annotation, True, None, False), - ("previous", "previous", fhirreference.FHIRReference, False, None, False), - ("problem", "problem", fhirreference.FHIRReference, True, None, False), - ("prognosisCodeableConcept", "prognosisCodeableConcept", codeableconcept.CodeableConcept, True, None, False), - ("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 - - -from . import backboneelement - -class ClinicalImpressionFinding(backboneelement.BackboneElement): - """ Possible or likely findings and diagnoses. - - Specific findings or diagnoses that were considered likely or relevant to - ongoing treatment. - """ - - resource_type = "ClinicalImpressionFinding" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.basis = None - """ Which investigations support finding. - Type `str`. """ - - self.itemCodeableConcept = None - """ What was found. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.itemReference = None - """ What was found. - Type `FHIRReference` (represented as `dict` in JSON). """ - - super(ClinicalImpressionFinding, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ClinicalImpressionFinding, self).elementProperties() - js.extend([ - ("basis", "basis", str, False, None, False), - ("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, symptoms, etc.). - - 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. - """ - - resource_type = "ClinicalImpressionInvestigation" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 name/code for the set. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.item = None - """ Record of a specific investigation. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - super(ClinicalImpressionInvestigation, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ClinicalImpressionInvestigation, self).elementProperties() - js.extend([ - ("code", "code", codeableconcept.CodeableConcept, False, None, True), - ("item", "item", fhirreference.FHIRReference, 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 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/clinicalimpression_tests.py b/fhirclient/models/clinicalimpression_tests.py deleted file mode 100644 index dc097f927..000000000 --- a/fhirclient/models/clinicalimpression_tests.py +++ /dev/null @@ -1,53 +0,0 @@ -#!/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 clinicalimpression -from .fhirdate import FHIRDate - - -class ClinicalImpressionTests(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("ClinicalImpression", js["resourceType"]) - return clinicalimpression.ClinicalImpression(js) - - def testClinicalImpression1(self): - inst = self.instantiate_from("clinicalimpression-example.json") - self.assertIsNotNone(inst, "Must have instantiated a ClinicalImpression instance") - self.implClinicalImpression1(inst) - - js = inst.as_json() - self.assertEqual("ClinicalImpression", js["resourceType"]) - inst2 = clinicalimpression.ClinicalImpression(js) - self.implClinicalImpression1(inst2) - - def implClinicalImpression1(self, inst): - self.assertEqual(inst.date.date, FHIRDate("2014-12-06T22:33:00+11:00").date) - self.assertEqual(inst.date.as_json(), "2014-12-06T22:33:00+11:00") - self.assertEqual(inst.description, "This 26 yo male patient is brought into ER by ambulance after being involved in a motor vehicle accident") - self.assertEqual(inst.effectivePeriod.end.date, FHIRDate("2014-12-06T22:33:00+11:00").date) - self.assertEqual(inst.effectivePeriod.end.as_json(), "2014-12-06T22:33:00+11:00") - self.assertEqual(inst.effectivePeriod.start.date, FHIRDate("2014-12-06T20:00:00+11:00").date) - self.assertEqual(inst.effectivePeriod.start.as_json(), "2014-12-06T20:00:00+11:00") - self.assertEqual(inst.finding[0].itemCodeableConcept.coding[0].code, "850.0") - self.assertEqual(inst.finding[0].itemCodeableConcept.coding[0].system, "http://hl7.org/fhir/sid/icd-9") - 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 deleted file mode 100644 index 62b9d6207..000000000 --- a/fhirclient/models/codeableconcept.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/CodeableConcept) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import element - -class CodeableConcept(element.Element): - """ Concept - reference to a terminology or just text. - - A concept that may be defined by a formal reference to a terminology or - ontology or may be provided by text. - """ - - resource_type = "CodeableConcept" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.coding = None - """ Code defined by a terminology system. - List of `Coding` items (represented as `dict` in JSON). """ - - self.text = None - """ Plain text representation of the concept. - Type `str`. """ - - super(CodeableConcept, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CodeableConcept, self).elementProperties() - js.extend([ - ("coding", "coding", coding.Coding, True, None, False), - ("text", "text", str, False, None, False), - ]) - return js - - -import sys -try: - from . import coding -except ImportError: - coding = sys.modules[__package__ + '.coding'] diff --git a/fhirclient/models/codesystem.py b/fhirclient/models/codesystem.py deleted file mode 100644 index 7f2a8dc11..000000000 --- a/fhirclient/models/codesystem.py +++ /dev/null @@ -1,452 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# 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): - """ Declares the existence of and describes a code system or code system - supplement. - - 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" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.caseSensitive = None - """ If code comparison is case sensitive. - Type `bool`. """ - - self.compositional = None - """ If code system defines a compositional grammar. - Type `bool`. """ - - self.concept = None - """ Concepts in the code system. - List of `CodeSystemConcept` items (represented as `dict` in JSON). """ - - self.contact = None - """ Contact details for the publisher. - List of `ContactDetail` items (represented as `dict` in JSON). """ - - self.content = None - """ not-present | example | fragment | complete | supplement. - Type `str`. """ - - self.copyright = None - """ Use and/or publishing restrictions. - Type `str`. """ - - self.count = None - """ Total concepts in the code system. - Type `int`. """ - - self.date = None - """ Date last changed. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.description = None - """ Natural language description of the code system. - Type `str`. """ - - self.experimental = None - """ For testing purposes, not real usage. - Type `bool`. """ - - self.filter = None - """ Filter that can be used in a value set. - List of `CodeSystemFilter` items (represented as `dict` in JSON). """ - - self.hierarchyMeaning = None - """ grouped-by | is-a | part-of | classified-with. - Type `str`. """ - - self.identifier = None - """ 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). - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.name = None - """ Name for this code system (computer friendly). - Type `str`. """ - - self.property = None - """ Additional information supplied about each concept. - List of `CodeSystemProperty` items (represented as `dict` in JSON). """ - - self.publisher = None - """ Name of the publisher (organization or individual). - Type `str`. """ - - self.purpose = None - """ Why this code system is defined. - Type `str`. """ - - self.status = None - """ 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 - """ Canonical identifier for this code system, represented as a URI - (globally unique) (Coding.system). - Type `str`. """ - - self.useContext = None - """ The context that the content is intended to support. - List of `UsageContext` items (represented as `dict` in JSON). """ - - self.valueSet = None - """ Canonical reference to the value set with entire code system. - Type `str`. """ - - self.version = None - """ Business version of the code system (Coding.version). - Type `str`. """ - - self.versionNeeded = None - """ If definitions are not stable. - Type `bool`. """ - - super(CodeSystem, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CodeSystem, self).elementProperties() - js.extend([ - ("caseSensitive", "caseSensitive", bool, False, None, False), - ("compositional", "compositional", bool, False, None, False), - ("concept", "concept", CodeSystemConcept, True, None, False), - ("contact", "contact", contactdetail.ContactDetail, True, None, False), - ("content", "content", str, False, None, True), - ("copyright", "copyright", str, False, None, False), - ("count", "count", int, False, None, False), - ("date", "date", fhirdate.FHIRDate, False, None, False), - ("description", "description", str, False, None, False), - ("experimental", "experimental", bool, False, None, False), - ("filter", "filter", CodeSystemFilter, True, None, False), - ("hierarchyMeaning", "hierarchyMeaning", str, 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), - ("valueSet", "valueSet", str, False, None, False), - ("version", "version", str, False, None, False), - ("versionNeeded", "versionNeeded", bool, False, None, False), - ]) - return js - - -from . import backboneelement - -class CodeSystemConcept(backboneelement.BackboneElement): - """ Concepts in the code system. - - Concepts that are in the code system. The concept definitions are - inherently hierarchical, but the definitions must be consulted to determine - what the meanings of the hierarchical relationships are. - """ - - resource_type = "CodeSystemConcept" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 that identifies concept. - Type `str`. """ - - self.concept = None - """ Child Concepts (is-a/contains/categorizes). - List of `CodeSystemConcept` items (represented as `dict` in JSON). """ - - self.definition = None - """ Formal definition. - Type `str`. """ - - self.designation = None - """ Additional representations for the concept. - List of `CodeSystemConceptDesignation` items (represented as `dict` in JSON). """ - - self.display = None - """ Text to display to the user. - Type `str`. """ - - self.property = None - """ Property value for the concept. - List of `CodeSystemConceptProperty` items (represented as `dict` in JSON). """ - - super(CodeSystemConcept, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CodeSystemConcept, self).elementProperties() - js.extend([ - ("code", "code", str, False, None, True), - ("concept", "concept", CodeSystemConcept, True, None, False), - ("definition", "definition", str, False, None, False), - ("designation", "designation", CodeSystemConceptDesignation, True, None, False), - ("display", "display", str, False, None, False), - ("property", "property", CodeSystemConceptProperty, True, None, False), - ]) - return js - - -class CodeSystemConceptDesignation(backboneelement.BackboneElement): - """ Additional representations for the concept. - - Additional representations for the concept - other languages, aliases, - specialized purposes, used for particular purposes, etc. - """ - - resource_type = "CodeSystemConceptDesignation" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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. - Type `str`. """ - - self.use = None - """ Details how this designation would be used. - Type `Coding` (represented as `dict` in JSON). """ - - self.value = None - """ The text value for this designation. - Type `str`. """ - - super(CodeSystemConceptDesignation, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CodeSystemConceptDesignation, self).elementProperties() - js.extend([ - ("language", "language", str, False, None, False), - ("use", "use", coding.Coding, False, None, False), - ("value", "value", str, False, None, True), - ]) - return js - - -class CodeSystemConceptProperty(backboneelement.BackboneElement): - """ Property value for the concept. - - A property value for this concept. - """ - - resource_type = "CodeSystemConceptProperty" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Reference to CodeSystem.property.code. - Type `str`. """ - - self.valueBoolean = None - """ Value of the property for this concept. - Type `bool`. """ - - self.valueCode = None - """ Value of the property for this concept. - Type `str`. """ - - self.valueCoding = None - """ Value of the property for this concept. - Type `Coding` (represented as `dict` in JSON). """ - - self.valueDateTime = None - """ 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`. """ - - self.valueString = None - """ Value of the property for this concept. - Type `str`. """ - - super(CodeSystemConceptProperty, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CodeSystemConceptProperty, self).elementProperties() - js.extend([ - ("code", "code", str, False, None, True), - ("valueBoolean", "valueBoolean", bool, False, "value", True), - ("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), - ]) - return js - - -class CodeSystemFilter(backboneelement.BackboneElement): - """ Filter that can be used in a value set. - - A filter that can be used in a value set compose statement when selecting - concepts using a filter. - """ - - resource_type = "CodeSystemFilter" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 that identifies the filter. - Type `str`. """ - - self.description = None - """ How or why the filter is used. - Type `str`. """ - - self.operator = None - """ Operators that can be used with filter. - List of `str` items. """ - - self.value = None - """ What to use for the value. - Type `str`. """ - - super(CodeSystemFilter, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CodeSystemFilter, self).elementProperties() - js.extend([ - ("code", "code", str, False, None, True), - ("description", "description", str, False, None, False), - ("operator", "operator", str, True, None, True), - ("value", "value", str, False, None, True), - ]) - return js - - -class CodeSystemProperty(backboneelement.BackboneElement): - """ Additional information supplied about each concept. - - A property defines an additional slot through which additional information - can be provided about a concept. - """ - - resource_type = "CodeSystemProperty" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Identifies the property on the concepts, and when referred to in - operations. - Type `str`. """ - - self.description = None - """ Why the property is defined, and/or what it conveys. - Type `str`. """ - - self.type = None - """ code | Coding | string | integer | boolean | dateTime | decimal. - Type `str`. """ - - self.uri = None - """ Formal identifier for the property. - Type `str`. """ - - super(CodeSystemProperty, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CodeSystemProperty, self).elementProperties() - js.extend([ - ("code", "code", str, False, None, True), - ("description", "description", str, False, None, False), - ("type", "type", str, False, None, True), - ("uri", "uri", str, 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 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/codesystem_tests.py b/fhirclient/models/codesystem_tests.py deleted file mode 100644 index 523f28ab9..000000000 --- a/fhirclient/models/codesystem_tests.py +++ /dev/null @@ -1,262 +0,0 @@ -#!/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 codesystem -from .fhirdate import FHIRDate - - -class CodeSystemTests(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("CodeSystem", js["resourceType"]) - return codesystem.CodeSystem(js) - - def testCodeSystem1(self): - inst = self.instantiate_from("codesystem-example-supplement.json") - self.assertIsNotNone(inst, "Must have instantiated a CodeSystem instance") - self.implCodeSystem1(inst) - - js = inst.as_json() - self.assertEqual("CodeSystem", js["resourceType"]) - inst2 = codesystem.CodeSystem(js) - 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") - self.assertEqual(inst.contact[0].telecom[0].value, "http://hl7.org/fhir") - self.assertEqual(inst.content, "not-present") - self.assertEqual(inst.count, 92) - self.assertEqual(inst.description, "This is an example code system summary for the ACME codes for body site.") - self.assertTrue(inst.experimental) - self.assertEqual(inst.id, "summary") - self.assertEqual(inst.jurisdiction[0].coding[0].code, "CA") - self.assertEqual(inst.jurisdiction[0].coding[0].system, "urn:iso:std:iso:3166") - self.assertEqual(inst.name, "Code system summary example for ACME body sites") - 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/CodeSystem/summary") - self.assertEqual(inst.useContext[0].code.code, "species") - self.assertEqual(inst.useContext[0].code.system, "http://example.org/CodeSystem/contexttype") - 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 testCodeSystem5(self): - inst = self.instantiate_from("codesystem-example.json") - self.assertIsNotNone(inst, "Must have instantiated a CodeSystem instance") - self.implCodeSystem5(inst) - - js = inst.as_json() - self.assertEqual("CodeSystem", js["resourceType"]) - inst2 = codesystem.CodeSystem(js) - self.implCodeSystem5(inst2) - - 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") - self.assertEqual(inst.concept[0].designation[0].use.code, "internal-label") - self.assertEqual(inst.concept[0].designation[0].use.system, "http://acme.com/config/fhir/codesystems/internal") - self.assertEqual(inst.concept[0].designation[0].value, "From ACME POC Testing") - self.assertEqual(inst.concept[0].display, "SChol (mmol/L)") - self.assertEqual(inst.concept[1].code, "chol-mass") - self.assertEqual(inst.concept[1].definition, "Serum Cholesterol, in mg/L") - self.assertEqual(inst.concept[1].designation[0].use.code, "internal-label") - self.assertEqual(inst.concept[1].designation[0].use.system, "http://acme.com/config/fhir/codesystems/internal") - self.assertEqual(inst.concept[1].designation[0].value, "From Paragon Labs") - self.assertEqual(inst.concept[1].display, "SChol (mg/L)") - self.assertEqual(inst.concept[2].code, "chol") - self.assertEqual(inst.concept[2].definition, "Serum Cholesterol") - self.assertEqual(inst.concept[2].designation[0].use.code, "internal-label") - self.assertEqual(inst.concept[2].designation[0].use.system, "http://acme.com/config/fhir/codesystems/internal") - self.assertEqual(inst.concept[2].designation[0].value, "Obdurate Labs uses this with both kinds of units...") - self.assertEqual(inst.concept[2].display, "SChol") - 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, "complete") - self.assertEqual(inst.date.date, FHIRDate("2016-01-28").date) - 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[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, "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") - diff --git a/fhirclient/models/coding.py b/fhirclient/models/coding.py deleted file mode 100644 index aca3bd376..000000000 --- a/fhirclient/models/coding.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Coding) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import element - -class Coding(element.Element): - """ A reference to a code defined by a terminology system. - """ - - resource_type = "Coding" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Symbol in syntax defined by the system. - Type `str`. """ - - self.display = None - """ Representation defined by the system. - Type `str`. """ - - self.system = None - """ Identity of the terminology system. - Type `str`. """ - - self.userSelected = None - """ If this coding was chosen directly by the user. - Type `bool`. """ - - self.version = None - """ Version of the system - if relevant. - Type `str`. """ - - super(Coding, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Coding, self).elementProperties() - js.extend([ - ("code", "code", str, False, None, False), - ("display", "display", str, False, None, False), - ("system", "system", str, False, None, False), - ("userSelected", "userSelected", bool, False, None, False), - ("version", "version", str, False, None, False), - ]) - return js - - diff --git a/fhirclient/models/communication.py b/fhirclient/models/communication.py deleted file mode 100644 index 45ab50d5d..000000000 --- a/fhirclient/models/communication.py +++ /dev/null @@ -1,219 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Communication) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -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 that was notified about a - reportable condition. - """ - - resource_type = "Communication" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :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 (represented as `dict` in JSON). """ - - self.category = None - """ Message category. - List of `CodeableConcept` items (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.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 (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 (represented as `dict` in JSON). """ - - self.received = None - """ When received. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.recipient = None - """ Message recipient. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.sender = None - """ Message sender. - 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 | 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` (represented as `dict` in JSON). """ - - self.topic = None - """ 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), - ("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), - ("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), - ("recipient", "recipient", fhirreference.FHIRReference, True, None, False), - ("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", codeableconcept.CodeableConcept, False, None, False), - ]) - return js - - -from . import backboneelement - -class CommunicationPayload(backboneelement.BackboneElement): - """ Message payload. - - Text, attachment(s), or resource(s) that was communicated to the recipient. - """ - - resource_type = "CommunicationPayload" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.contentAttachment = None - """ Message part content. - Type `Attachment` (represented as `dict` in JSON). """ - - self.contentReference = None - """ Message part content. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.contentString = None - """ Message part content. - Type `str`. """ - - super(CommunicationPayload, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CommunicationPayload, self).elementProperties() - js.extend([ - ("contentAttachment", "contentAttachment", attachment.Attachment, False, "content", True), - ("contentReference", "contentReference", fhirreference.FHIRReference, False, "content", True), - ("contentString", "contentString", str, False, "content", True), - ]) - return js - - -import sys -try: - from . import annotation -except ImportError: - annotation = sys.modules[__package__ + '.annotation'] -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'] diff --git a/fhirclient/models/communication_tests.py b/fhirclient/models/communication_tests.py deleted file mode 100644 index 814ca2089..000000000 --- a/fhirclient/models/communication_tests.py +++ /dev/null @@ -1,133 +0,0 @@ -#!/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 communication -from .fhirdate import FHIRDate - - -class CommunicationTests(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("Communication", js["resourceType"]) - return communication.Communication(js) - - def testCommunication1(self): - inst = self.instantiate_from("communication-example-fm-attachment.json") - self.assertIsNotNone(inst, "Must have instantiated a Communication instance") - self.implCommunication1(inst) - - js = inst.as_json() - self.assertEqual("Communication", js["resourceType"]) - inst2 = communication.Communication(js) - self.implCommunication1(inst2) - - def implCommunication1(self, inst): - self.assertEqual(inst.category[0].coding[0].code, "SolicitedAttachment") - self.assertEqual(inst.category[0].coding[0].system, "http://acme.org/messagetypes") - 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") - self.assertEqual(inst.payload[0].contentAttachment.data, "SGVsbG8=") - self.assertEqual(inst.payload[0].contentAttachment.title, "accident notes 20100201.pdf") - self.assertEqual(inst.payload[1].contentAttachment.contentType, "application/pdf") - self.assertEqual(inst.payload[1].contentAttachment.creation.date, FHIRDate("2010-02-01T10:57:34+01:00").date) - 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://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") - self.assertEqual(inst.text.div, "
Attachment which is unsolicited
") - self.assertEqual(inst.text.status, "generated") - - def testCommunication2(self): - inst = self.instantiate_from("communication-example-fm-solicited-attachment.json") - self.assertIsNotNone(inst, "Must have instantiated a Communication instance") - self.implCommunication2(inst) - - js = inst.as_json() - self.assertEqual("Communication", js["resourceType"]) - inst2 = communication.Communication(js) - self.implCommunication2(inst2) - - def implCommunication2(self, inst): - self.assertEqual(inst.category[0].coding[0].code, "SolicitedAttachment") - self.assertEqual(inst.category[0].coding[0].system, "http://acme.org/messagetypes") - self.assertEqual(inst.contained[0].id, "provider") - self.assertEqual(inst.contained[1].id, "payor") - self.assertEqual(inst.contained[2].id, "request") - 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") - self.assertEqual(inst.payload[0].contentAttachment.data, "SGVsbG8=") - self.assertEqual(inst.payload[0].contentAttachment.title, "accident notes 20100201.pdf") - self.assertEqual(inst.payload[1].contentAttachment.contentType, "application/pdf") - self.assertEqual(inst.payload[1].contentAttachment.creation.date, FHIRDate("2010-02-01T10:57:34+01:00").date) - 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.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") - self.assertEqual(inst.text.div, "
Attachment in response to a Request
") - self.assertEqual(inst.text.status, "generated") - - def testCommunication3(self): - inst = self.instantiate_from("communication-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Communication instance") - self.implCommunication3(inst) - - js = inst.as_json() - self.assertEqual("Communication", js["resourceType"]) - inst2 = communication.Communication(js) - self.implCommunication3(inst2) - - def implCommunication3(self, inst): - self.assertEqual(inst.category[0].coding[0].code, "Alert") - self.assertEqual(inst.category[0].coding[0].system, "http://acme.org/messagetypes") - self.assertEqual(inst.category[0].text, "Alert") - self.assertEqual(inst.id, "example") - 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://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") - self.assertEqual(inst.sent.date, FHIRDate("2014-12-12T18:01:10-08:00").date) - self.assertEqual(inst.sent.as_json(), "2014-12-12T18:01:10-08:00") - self.assertEqual(inst.status, "completed") - self.assertEqual(inst.text.div, "
Patient has very high serum potassium
") - self.assertEqual(inst.text.status, "generated") - diff --git a/fhirclient/models/communicationrequest.py b/fhirclient/models/communicationrequest.py deleted file mode 100644 index 8a3920037..000000000 --- a/fhirclient/models/communicationrequest.py +++ /dev/null @@ -1,223 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/CommunicationRequest) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class CommunicationRequest(domainresource.DomainResource): - """ A request for information to be sent to a receiver. - - A request to convey information; e.g. the CDS system proposes that an alert - be sent to a responsible provider, the CDS system proposes that the public - health agency be notified about a reportable condition. - """ - - resource_type = "CommunicationRequest" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :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 (represented as `dict` in JSON). """ - - self.category = None - """ Message category. - List of `CodeableConcept` items (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. - Type `Identifier` (represented as `dict` in JSON). """ - - self.identifier = None - """ Unique identifier. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.medium = None - """ A channel of communication. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.note = None - """ Comments made about communication request. - List of `Annotation` items (represented as `dict` in JSON). """ - - self.occurrenceDateTime = None - """ When scheduled. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.occurrencePeriod = None - """ When scheduled. - Type `Period` (represented as `dict` in JSON). """ - - self.payload = None - """ Message payload. - List of `CommunicationRequestPayload` items (represented as `dict` in JSON). """ - - self.priority = None - """ Message urgency. - Type `str`. """ - - self.reasonCode = None - """ Why is communication needed?. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.reasonReference = None - """ Why is communication needed?. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.recipient = None - """ Message recipient. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.replaces = None - """ Request(s) replaced by this request. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.requester = None - """ Who/what is requesting service. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.sender = None - """ Message sender. - 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` (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), - ("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), - ("note", "note", annotation.Annotation, True, None, False), - ("occurrenceDateTime", "occurrenceDateTime", fhirdate.FHIRDate, False, "occurrence", False), - ("occurrencePeriod", "occurrencePeriod", period.Period, False, "occurrence", False), - ("payload", "payload", CommunicationRequestPayload, True, None, 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), - ("replaces", "replaces", fhirreference.FHIRReference, True, 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), - ]) - return js - - -from . import backboneelement - -class CommunicationRequestPayload(backboneelement.BackboneElement): - """ Message payload. - - Text, attachment(s), or resource(s) to be communicated to the recipient. - """ - - resource_type = "CommunicationRequestPayload" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.contentAttachment = None - """ Message part content. - Type `Attachment` (represented as `dict` in JSON). """ - - self.contentReference = None - """ Message part content. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.contentString = None - """ Message part content. - Type `str`. """ - - super(CommunicationRequestPayload, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CommunicationRequestPayload, self).elementProperties() - js.extend([ - ("contentAttachment", "contentAttachment", attachment.Attachment, False, "content", True), - ("contentReference", "contentReference", fhirreference.FHIRReference, False, "content", True), - ("contentString", "contentString", str, False, "content", True), - ]) - return js - - -import sys -try: - from . import annotation -except ImportError: - annotation = sys.modules[__package__ + '.annotation'] -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 period -except ImportError: - period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/communicationrequest_tests.py b/fhirclient/models/communicationrequest_tests.py deleted file mode 100644 index 0a1ab9495..000000000 --- a/fhirclient/models/communicationrequest_tests.py +++ /dev/null @@ -1,79 +0,0 @@ -#!/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 communicationrequest -from .fhirdate import FHIRDate - - -class CommunicationRequestTests(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("CommunicationRequest", js["resourceType"]) - return communicationrequest.CommunicationRequest(js) - - def testCommunicationRequest1(self): - inst = self.instantiate_from("communicationrequest-example.json") - self.assertIsNotNone(inst, "Must have instantiated a CommunicationRequest instance") - self.implCommunicationRequest1(inst) - - js = inst.as_json() - self.assertEqual("CommunicationRequest", js["resourceType"]) - inst2 = communicationrequest.CommunicationRequest(js) - 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") - self.assertEqual(inst.category[0].coding[0].system, "http://acme.org/messagetypes") - self.assertEqual(inst.contained[0].id, "provider") - self.assertEqual(inst.contained[1].id, "payor") - self.assertEqual(inst.contained[2].id, "requester") - self.assertEqual(inst.groupIdentifier.value, "12345") - self.assertEqual(inst.id, "fm-solicit") - self.assertEqual(inst.identifier[0].system, "http://www.jurisdiction.com/insurer/123456") - 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://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.") - self.assertEqual(inst.priority, "routine") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
Request for Accident Report
") - self.assertEqual(inst.text.status, "generated") - diff --git a/fhirclient/models/compartmentdefinition.py b/fhirclient/models/compartmentdefinition.py deleted file mode 100644 index b3f0f8a6b..000000000 --- a/fhirclient/models/compartmentdefinition.py +++ /dev/null @@ -1,161 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/CompartmentDefinition) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class CompartmentDefinition(domainresource.DomainResource): - """ Compartment Definition for a resource. - - A compartment definition that defines how resources are accessed on a - server. - """ - - resource_type = "CompartmentDefinition" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Patient | Encounter | RelatedPerson | Practitioner | Device. - Type `str`. """ - - self.contact = None - """ Contact details for the publisher. - List of `ContactDetail` items (represented as `dict` in JSON). """ - - self.date = None - """ Date last changed. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.description = None - """ Natural language description of the compartment definition. - Type `str`. """ - - self.experimental = None - """ For testing purposes, not real usage. - Type `bool`. """ - - self.name = None - """ Name for this compartment definition (computer friendly). - Type `str`. """ - - self.publisher = None - """ Name of the publisher (organization or individual). - Type `str`. """ - - self.purpose = None - """ Why this compartment definition is defined. - Type `str`. """ - - self.resource = None - """ How a resource is related to the compartment. - List of `CompartmentDefinitionResource` items (represented as `dict` in JSON). """ - - self.search = None - """ Whether the search syntax is supported. - Type `bool`. """ - - self.status = None - """ draft | active | retired | unknown. - Type `str`. """ - - self.url = None - """ Canonical identifier for this compartment 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 compartment definition. - Type `str`. """ - - super(CompartmentDefinition, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CompartmentDefinition, self).elementProperties() - js.extend([ - ("code", "code", str, False, None, True), - ("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), - ("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), - ("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 CompartmentDefinitionResource(backboneelement.BackboneElement): - """ How a resource is related to the compartment. - - Information about how a resource is related to the compartment. - """ - - resource_type = "CompartmentDefinitionResource" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Name of resource type. - Type `str`. """ - - self.documentation = None - """ Additional documentation about the resource and compartment. - Type `str`. """ - - self.param = None - """ Search Parameter Name, or chained parameters. - List of `str` items. """ - - super(CompartmentDefinitionResource, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CompartmentDefinitionResource, self).elementProperties() - js.extend([ - ("code", "code", str, False, None, True), - ("documentation", "documentation", str, False, None, False), - ("param", "param", str, True, None, False), - ]) - return js - - -import sys -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/compartmentdefinition_tests.py b/fhirclient/models/compartmentdefinition_tests.py deleted file mode 100644 index 8914fb027..000000000 --- a/fhirclient/models/compartmentdefinition_tests.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/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 compartmentdefinition -from .fhirdate import FHIRDate - - -class CompartmentDefinitionTests(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("CompartmentDefinition", js["resourceType"]) - return compartmentdefinition.CompartmentDefinition(js) - - def testCompartmentDefinition1(self): - inst = self.instantiate_from("compartmentdefinition-example.json") - self.assertIsNotNone(inst, "Must have instantiated a CompartmentDefinition instance") - self.implCompartmentDefinition1(inst) - - js = inst.as_json() - self.assertEqual("CompartmentDefinition", js["resourceType"]) - inst2 = compartmentdefinition.CompartmentDefinition(js) - self.implCompartmentDefinition1(inst2) - - def implCompartmentDefinition1(self, inst): - self.assertEqual(inst.code, "Device") - self.assertEqual(inst.contact[0].name, "[string]") - 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-02-24").date) - self.assertEqual(inst.date.as_json(), "2017-02-24") - 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.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.") - self.assertEqual(inst.resource[0].code, "Communication") - self.assertEqual(inst.resource[0].documentation, "The device used as the message sender and recipient") - self.assertEqual(inst.resource[0].param[0], "sender") - self.assertEqual(inst.resource[0].param[1], "recipient") - self.assertEqual(inst.resource[1].code, "CommunicationRequest") - self.assertEqual(inst.resource[1].documentation, "The device used as the message sender and recipient") - self.assertEqual(inst.resource[1].param[0], "sender") - self.assertEqual(inst.resource[1].param[1], "recipient") - self.assertTrue(inst.search) - self.assertEqual(inst.status, "draft") - self.assertEqual(inst.text.status, "generated") - 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://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 deleted file mode 100644 index 2b7eafba8..000000000 --- a/fhirclient/models/composition.py +++ /dev/null @@ -1,343 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Composition) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class Composition(domainresource.DomainResource): - """ A set of resources composed into a single coherent clinical statement with - clinical attestation. - - A set of healthcare-related information that is assembled together into a - 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. 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" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.attester = None - """ Attests to accuracy of composition. - List of `CompositionAttester` items (represented as `dict` in JSON). """ - - self.author = None - """ Who and/or what authored the composition. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.category = None - """ Categorization of Composition. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.confidentiality = None - """ As defined by affinity domain. - Type `str`. """ - - self.custodian = None - """ Organization which maintains the composition. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.date = None - """ Composition editing time. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.encounter = None - """ Context of the Composition. - 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 - """ Version-independent identifier for the Composition. - Type `Identifier` (represented as `dict` in JSON). """ - - self.relatesTo = None - """ Relationships to other compositions/documents. - List of `CompositionRelatesTo` items (represented as `dict` in JSON). """ - - self.section = None - """ Composition is broken into sections. - List of `CompositionSection` items (represented as `dict` in JSON). """ - - self.status = None - """ preliminary | final | amended | entered-in-error. - Type `str`. """ - - self.subject = None - """ Who and/or what the composition is about. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.title = None - """ Human Readable name/title. - Type `str`. """ - - self.type = None - """ Kind of composition (LOINC if possible). - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(Composition, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Composition, self).elementProperties() - js.extend([ - ("attester", "attester", CompositionAttester, True, None, False), - ("author", "author", fhirreference.FHIRReference, True, None, True), - ("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), - ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), - ("event", "event", CompositionEvent, True, None, False), - ("identifier", "identifier", identifier.Identifier, False, None, False), - ("relatesTo", "relatesTo", CompositionRelatesTo, True, None, False), - ("section", "section", CompositionSection, True, None, False), - ("status", "status", str, False, None, True), - ("subject", "subject", fhirreference.FHIRReference, False, None, False), - ("title", "title", str, False, None, True), - ("type", "type", codeableconcept.CodeableConcept, False, None, True), - ]) - return js - - -from . import backboneelement - -class CompositionAttester(backboneelement.BackboneElement): - """ Attests to accuracy of composition. - - A participant who has attested to the accuracy of the composition/document. - """ - - resource_type = "CompositionAttester" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ personal | professional | legal | official. - Type `str`. """ - - self.party = None - """ Who attested the composition. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.time = None - """ When the composition was attested. - Type `FHIRDate` (represented as `str` in JSON). """ - - super(CompositionAttester, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CompositionAttester, self).elementProperties() - js.extend([ - ("mode", "mode", str, False, None, True), - ("party", "party", fhirreference.FHIRReference, False, None, False), - ("time", "time", fhirdate.FHIRDate, False, None, False), - ]) - return js - - -class CompositionEvent(backboneelement.BackboneElement): - """ The clinical service(s) being documented. - - The clinical service, such as a colonoscopy or an appendectomy, being - documented. - """ - - resource_type = "CompositionEvent" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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(s) that apply to the event being documented. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.detail = None - """ The event(s) being documented. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.period = None - """ The period covered by the documentation. - Type `Period` (represented as `dict` in JSON). """ - - super(CompositionEvent, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CompositionEvent, self).elementProperties() - js.extend([ - ("code", "code", codeableconcept.CodeableConcept, True, None, False), - ("detail", "detail", fhirreference.FHIRReference, True, None, False), - ("period", "period", period.Period, False, None, False), - ]) - return js - - -class CompositionRelatesTo(backboneelement.BackboneElement): - """ Relationships to other compositions/documents. - - Relationships that this composition has with other compositions or - documents that already exist. - """ - - resource_type = "CompositionRelatesTo" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ replaces | transforms | signs | appends. - Type `str`. """ - - self.targetIdentifier = None - """ Target of the relationship. - Type `Identifier` (represented as `dict` in JSON). """ - - self.targetReference = None - """ Target of the relationship. - Type `FHIRReference` (represented as `dict` in JSON). """ - - super(CompositionRelatesTo, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CompositionRelatesTo, self).elementProperties() - js.extend([ - ("code", "code", str, False, None, True), - ("targetIdentifier", "targetIdentifier", identifier.Identifier, False, "target", True), - ("targetReference", "targetReference", fhirreference.FHIRReference, False, "target", True), - ]) - return js - - -class CompositionSection(backboneelement.BackboneElement): - """ Composition is broken into sections. - - The root of the sections that make up the composition. - """ - - resource_type = "CompositionSection" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ 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). """ - - self.emptyReason = None - """ Why the section is empty. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.entry = None - """ A reference to data that supports this section. - 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. - Type `str`. """ - - self.orderedBy = None - """ Order of section entries. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.section = None - """ Nested Section. - List of `CompositionSection` items (represented as `dict` in JSON). """ - - self.text = None - """ Text summary of the section, for human interpretation. - Type `Narrative` (represented as `dict` in JSON). """ - - self.title = None - """ Label for section (e.g. for ToC). - Type `str`. """ - - super(CompositionSection, self).__init__(jsondict=jsondict, strict=strict) - - 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), - ("text", "text", narrative.Narrative, False, None, False), - ("title", "title", 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 narrative -except ImportError: - narrative = sys.modules[__package__ + '.narrative'] -try: - from . import period -except ImportError: - period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/composition_tests.py b/fhirclient/models/composition_tests.py deleted file mode 100644 index f729eae91..000000000 --- a/fhirclient/models/composition_tests.py +++ /dev/null @@ -1,126 +0,0 @@ -#!/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 composition -from .fhirdate import FHIRDate - - -class CompositionTests(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("Composition", js["resourceType"]) - return composition.Composition(js) - - def testComposition1(self): - inst = self.instantiate_from("composition-example-mixed.json") - self.assertIsNotNone(inst, "Must have instantiated a Composition instance") - self.implComposition1(inst) - - js = inst.as_json() - self.assertEqual("Composition", js["resourceType"]) - inst2 = composition.Composition(js) - self.implComposition1(inst2) - - def implComposition1(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.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.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://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) - self.assertEqual(inst.event[0].period.start.as_json(), "2010-07-18") - 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") - self.assertEqual(inst.relatesTo[1].targetIdentifier.value, "ABC123") - self.assertEqual(inst.section[0].code.coding[0].code, "11348-0") - self.assertEqual(inst.section[0].code.coding[0].display, "History of past illness Narrative") - self.assertEqual(inst.section[0].code.coding[0].system, "http://loinc.org") - 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://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") - self.assertEqual(inst.section[1].code.coding[0].display, "History of family member diseases Narrative") - 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://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") - self.assertEqual(inst.status, "final") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.title, "Consultation Note") - self.assertEqual(inst.type.coding[0].code, "11488-4") - self.assertEqual(inst.type.coding[0].display, "Consult note") - self.assertEqual(inst.type.coding[0].system, "http://loinc.org") - diff --git a/fhirclient/models/conceptmap.py b/fhirclient/models/conceptmap.py deleted file mode 100644 index 8446928c1..000000000 --- a/fhirclient/models/conceptmap.py +++ /dev/null @@ -1,409 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ConceptMap) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -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 concepts in code systems, or data element/data element - concepts, or classes in class models. - """ - - resource_type = "ConceptMap" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 last changed. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.description = None - """ Natural language description of the concept map. - Type `str`. """ - - self.experimental = None - """ For testing purposes, not real usage. - Type `bool`. """ - - self.group = None - """ Same source and target systems. - List of `ConceptMapGroup` items (represented as `dict` in JSON). """ - - self.identifier = None - """ Additional identifier for the concept map. - Type `Identifier` (represented as `dict` in JSON). """ - - self.jurisdiction = None - """ Intended jurisdiction for concept map (if applicable). - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.name = None - """ Name for this concept map (computer friendly). - Type `str`. """ - - self.publisher = None - """ Name of the publisher (organization or individual). - Type `str`. """ - - self.purpose = None - """ Why this concept map is defined. - Type `str`. """ - - self.sourceCanonical = None - """ The source value set that contains the concepts that are being - mapped. - Type `str`. """ - - self.sourceUri = None - """ The source value set that contains the concepts that are being - mapped. - Type `str`. """ - - self.status = None - """ draft | active | retired | unknown. - Type `str`. """ - - self.targetCanonical = None - """ The target value set which provides context for the mappings. - Type `str`. """ - - self.targetUri = None - """ The target value set which provides context for the mappings. - Type `str`. """ - - self.title = None - """ Name for this concept map (human friendly). - Type `str`. """ - - self.url = None - """ Canonical identifier for this concept map, 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 concept map. - Type `str`. """ - - super(ConceptMap, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ConceptMap, self).elementProperties() - js.extend([ - ("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), - ("experimental", "experimental", bool, False, None, False), - ("group", "group", ConceptMapGroup, True, None, False), - ("identifier", "identifier", identifier.Identifier, False, None, False), - ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), - ("name", "name", str, False, None, False), - ("publisher", "publisher", str, False, None, False), - ("purpose", "purpose", str, False, None, False), - ("sourceCanonical", "sourceCanonical", str, False, "source", False), - ("sourceUri", "sourceUri", str, False, "source", False), - ("status", "status", str, False, None, True), - ("targetCanonical", "targetCanonical", str, False, "target", False), - ("targetUri", "targetUri", str, False, "target", 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 ConceptMapGroup(backboneelement.BackboneElement): - """ Same source and target systems. - - A group of mappings that all have the same source and target system. - """ - - resource_type = "ConceptMapGroup" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Mappings for a concept from the source set. - List of `ConceptMapGroupElement` items (represented as `dict` in JSON). """ - - self.source = None - """ Source system where concepts to be mapped are defined. - Type `str`. """ - - self.sourceVersion = None - """ Specific version of the code system. - Type `str`. """ - - self.target = None - """ Target system that the concepts are to be mapped to. - Type `str`. """ - - self.targetVersion = None - """ Specific version of the code system. - Type `str`. """ - - self.unmapped = None - """ 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) - - def elementProperties(self): - js = super(ConceptMapGroup, self).elementProperties() - js.extend([ - ("element", "element", ConceptMapGroupElement, True, None, True), - ("source", "source", str, False, None, False), - ("sourceVersion", "sourceVersion", str, False, None, False), - ("target", "target", str, False, None, False), - ("targetVersion", "targetVersion", str, False, None, False), - ("unmapped", "unmapped", ConceptMapGroupUnmapped, False, None, False), - ]) - return js - - -class ConceptMapGroupElement(backboneelement.BackboneElement): - """ Mappings for a concept from the source set. - - Mappings for an individual concept in the source to one or more concepts in - the target. - """ - - resource_type = "ConceptMapGroupElement" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Identifies element being mapped. - Type `str`. """ - - self.display = None - """ Display for the code. - Type `str`. """ - - self.target = None - """ Concept in target system for element. - List of `ConceptMapGroupElementTarget` items (represented as `dict` in JSON). """ - - super(ConceptMapGroupElement, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ConceptMapGroupElement, self).elementProperties() - js.extend([ - ("code", "code", str, False, None, False), - ("display", "display", str, False, None, False), - ("target", "target", ConceptMapGroupElementTarget, True, None, False), - ]) - return js - - -class ConceptMapGroupElementTarget(backboneelement.BackboneElement): - """ Concept in target system for element. - - A concept from the target value set that this concept maps to. - """ - - resource_type = "ConceptMapGroupElementTarget" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 that identifies the target element. - Type `str`. """ - - self.comment = None - """ Description of status/issues in mapping. - Type `str`. """ - - self.dependsOn = None - """ Other elements required for this mapping (from context). - List of `ConceptMapGroupElementTargetDependsOn` items (represented as `dict` in JSON). """ - - self.display = None - """ Display for the code. - Type `str`. """ - - self.equivalence = None - """ relatedto | equivalent | equal | wider | subsumes | narrower | - specializes | inexact | unmatched | disjoint. - Type `str`. """ - - self.product = None - """ Other concepts that this mapping also produces. - List of `ConceptMapGroupElementTargetDependsOn` items (represented as `dict` in JSON). """ - - super(ConceptMapGroupElementTarget, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ConceptMapGroupElementTarget, self).elementProperties() - js.extend([ - ("code", "code", str, False, None, False), - ("comment", "comment", str, False, None, False), - ("dependsOn", "dependsOn", ConceptMapGroupElementTargetDependsOn, True, None, False), - ("display", "display", str, False, None, False), - ("equivalence", "equivalence", str, False, None, True), - ("product", "product", ConceptMapGroupElementTargetDependsOn, True, None, False), - ]) - return js - - -class ConceptMapGroupElementTargetDependsOn(backboneelement.BackboneElement): - """ Other elements required for this mapping (from context). - - A set of additional dependencies for this mapping to hold. This mapping is - only applicable if the specified element can be resolved, and it has the - specified value. - """ - - resource_type = "ConceptMapGroupElementTargetDependsOn" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.display = None - """ Display for the code (if value is a code). - Type `str`. """ - - self.property = None - """ Reference to property mapping depends on. - Type `str`. """ - - self.system = None - """ 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([ - ("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): - """ What to do when there is no mapping for the source concept. - - 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" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Fixed code when mode = fixed. - Type `str`. """ - - self.display = None - """ Display for the code. - Type `str`. """ - - self.mode = None - """ provided | fixed | other-map. - Type `str`. """ - - self.url = None - """ 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) - - def elementProperties(self): - js = super(ConceptMapGroupUnmapped, self).elementProperties() - js.extend([ - ("code", "code", str, False, None, False), - ("display", "display", str, False, None, False), - ("mode", "mode", str, False, None, True), - ("url", "url", 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/conceptmap_tests.py b/fhirclient/models/conceptmap_tests.py deleted file mode 100644 index fb58e8078..000000000 --- a/fhirclient/models/conceptmap_tests.py +++ /dev/null @@ -1,205 +0,0 @@ -#!/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 conceptmap -from .fhirdate import FHIRDate - - -class ConceptMapTests(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("ConceptMap", js["resourceType"]) - return conceptmap.ConceptMap(js) - - def testConceptMap1(self): - inst = self.instantiate_from("conceptmap-example.json") - self.assertIsNotNone(inst, "Must have instantiated a ConceptMap instance") - self.implConceptMap1(inst) - - js = inst.as_json() - self.assertEqual("ConceptMap", js["resourceType"]) - inst2 = conceptmap.ConceptMap(js) - 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") - self.assertEqual(inst.date.date, FHIRDate("2012-06-13").date) - self.assertEqual(inst.date.as_json(), "2012-06-13") - self.assertEqual(inst.description, "An example mapping") - self.assertTrue(inst.experimental) - 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].display, "Something Coded") - 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") - self.assertEqual(inst.group[0].target, "http://example.org/fhir/example2") - self.assertEqual(inst.group[0].unmapped.mode, "other-map") - self.assertEqual(inst.group[0].unmapped.url, "http://example.org/fhir/ConceptMap/map2") - self.assertEqual(inst.id, "example2") - self.assertEqual(inst.name, "FHIR-exanple-2") - self.assertEqual(inst.publisher, "HL7, Inc") - self.assertEqual(inst.purpose, "To illustrate mapping features") - self.assertEqual(inst.sourceUri, "http://example.org/fhir/example1") - self.assertEqual(inst.status, "draft") - self.assertEqual(inst.targetUri, "http://example.org/fhir/example2") - 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 testConceptMap3(self): - inst = self.instantiate_from("conceptmap-example-specimen-type.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].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") - self.assertEqual(inst.contact[1].telecom[0].value, "http://www.phconnect.org/group/laboratorymessagingcommunityofpractice/forum/attachment/download?id=3649725%3AUploadedFile%3A145786") - self.assertEqual(inst.date.date, FHIRDate("2013-07-25").date) - self.assertEqual(inst.date.as_json(), "2013-07-25") - 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].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].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].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].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://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, "4.0.0") - diff --git a/fhirclient/models/condition.py b/fhirclient/models/condition.py deleted file mode 100644 index e83180207..000000000 --- a/fhirclient/models/condition.py +++ /dev/null @@ -1,274 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Condition) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class Condition(domainresource.DomainResource): - """ Detailed information about conditions, problems or diagnoses. - - A clinical condition, problem, diagnosis, or other event, situation, issue, - or clinical concept that has risen to a level of concern. - """ - - resource_type = "Condition" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.abatementAge = None - """ When in resolution/remission. - Type `Age` (represented as `dict` in JSON). """ - - self.abatementDateTime = None - """ When in resolution/remission. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.abatementPeriod = None - """ When in resolution/remission. - Type `Period` (represented as `dict` in JSON). """ - - self.abatementRange = None - """ When in resolution/remission. - Type `Range` (represented as `dict` in JSON). """ - - self.abatementString = None - """ When in resolution/remission. - Type `str`. """ - - self.asserter = None - """ Person who asserts this condition. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.bodySite = None - """ Anatomical location, if relevant. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.category = None - """ problem-list-item | encounter-diagnosis. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.clinicalStatus = None - """ 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.encounter = None - """ Encounter created as part of. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.evidence = None - """ Supporting evidence. - List of `ConditionEvidence` items (represented as `dict` in JSON). """ - - self.identifier = None - """ External Ids for this condition. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.note = None - """ Additional information about the Condition. - List of `Annotation` items (represented as `dict` in JSON). """ - - self.onsetAge = None - """ Estimated or actual date, date-time, or age. - Type `Age` (represented as `dict` in JSON). """ - - self.onsetDateTime = None - """ Estimated or actual date, date-time, or age. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.onsetPeriod = None - """ Estimated or actual date, date-time, or age. - Type `Period` (represented as `dict` in JSON). """ - - self.onsetRange = None - """ Estimated or actual date, date-time, or age. - Type `Range` (represented as `dict` in JSON). """ - - self.onsetString = None - """ 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. - List of `ConditionStage` items (represented as `dict` in JSON). """ - - self.subject = None - """ Who has the condition?. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.verificationStatus = None - """ unconfirmed | provisional | differential | confirmed | refuted | - entered-in-error. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(Condition, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Condition, self).elementProperties() - js.extend([ - ("abatementAge", "abatementAge", age.Age, 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), - ("asserter", "asserter", fhirreference.FHIRReference, False, None, False), - ("bodySite", "bodySite", codeableconcept.CodeableConcept, True, None, False), - ("category", "category", codeableconcept.CodeableConcept, True, None, False), - ("clinicalStatus", "clinicalStatus", codeableconcept.CodeableConcept, False, None, False), - ("code", "code", codeableconcept.CodeableConcept, 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), - ("onsetAge", "onsetAge", age.Age, False, "onset", False), - ("onsetDateTime", "onsetDateTime", fhirdate.FHIRDate, False, "onset", False), - ("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, True, None, False), - ("subject", "subject", fhirreference.FHIRReference, False, None, True), - ("verificationStatus", "verificationStatus", codeableconcept.CodeableConcept, False, None, False), - ]) - return js - - -from . import backboneelement - -class ConditionEvidence(backboneelement.BackboneElement): - """ Supporting evidence. - - 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" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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/symptom. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.detail = None - """ Supporting information found elsewhere. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - super(ConditionEvidence, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ConditionEvidence, self).elementProperties() - js.extend([ - ("code", "code", codeableconcept.CodeableConcept, True, None, False), - ("detail", "detail", fhirreference.FHIRReference, True, None, False), - ]) - return js - - -class ConditionStage(backboneelement.BackboneElement): - """ Stage/grade, usually assessed formally. - - Clinical stage or grade of a condition. May include formal severity - assessments. - """ - - resource_type = "ConditionStage" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Formal record of assessment. - 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): - js = super(ConditionStage, self).elementProperties() - 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 - - -import sys -try: - from . import age -except ImportError: - age = sys.modules[__package__ + '.age'] -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'] -try: - from . import range -except ImportError: - range = sys.modules[__package__ + '.range'] diff --git a/fhirclient/models/condition_tests.py b/fhirclient/models/condition_tests.py deleted file mode 100644 index bf95c622f..000000000 --- a/fhirclient/models/condition_tests.py +++ /dev/null @@ -1,395 +0,0 @@ -#!/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 condition -from .fhirdate import FHIRDate - - -class ConditionTests(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("Condition", js["resourceType"]) - return condition.Condition(js) - - def testCondition1(self): - inst = self.instantiate_from("condition-example-f003-abscess.json") - self.assertIsNotNone(inst, "Must have instantiated a Condition instance") - self.implCondition1(inst) - - js = inst.as_json() - self.assertEqual("Condition", js["resourceType"]) - inst2 = condition.Condition(js) - self.implCondition1(inst2) - - def implCondition1(self, inst): - 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.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, "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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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.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-f203-sepsis.json") - self.assertIsNotNone(inst, "Must have instantiated a Condition instance") - self.implCondition2(inst) - - js = inst.as_json() - self.assertEqual("Condition", js["resourceType"]) - inst2 = condition.Condition(js) - self.implCondition2(inst2) - - def implCondition2(self, inst): - 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://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.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.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 testCondition3(self): - inst = self.instantiate_from("condition-example-stroke.json") - self.assertIsNotNone(inst, "Must have instantiated a Condition instance") - self.implCondition3(inst) - - js = inst.as_json() - self.assertEqual("Condition", js["resourceType"]) - inst2 = condition.Condition(js) - self.implCondition3(inst2) - - def implCondition3(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://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.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.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-family-history.json") - self.assertIsNotNone(inst, "Must have instantiated a Condition instance") - self.implCondition4(inst) - - js = inst.as_json() - self.assertEqual("Condition", js["resourceType"]) - inst2 = condition.Condition(js) - self.implCondition4(inst2) - - def implCondition4(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://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.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") - - def testCondition5(self): - inst = self.instantiate_from("condition-example-f002-lung.json") - self.assertIsNotNone(inst, "Must have instantiated a Condition instance") - self.implCondition5(inst) - - js = inst.as_json() - self.assertEqual("Condition", js["resourceType"]) - inst2 = condition.Condition(js) - self.implCondition5(inst2) - - def implCondition5(self, inst): - 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, "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.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.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-f205-infection.json") - self.assertIsNotNone(inst, "Must have instantiated a Condition instance") - self.implCondition6(inst) - - js = inst.as_json() - self.assertEqual("Condition", js["resourceType"]) - inst2 = condition.Condition(js) - self.implCondition6(inst2) - - def implCondition6(self, inst): - 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, "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.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") - self.assertIsNotNone(inst, "Must have instantiated a Condition instance") - self.implCondition7(inst) - - js = inst.as_json() - self.assertEqual("Condition", js["resourceType"]) - inst2 = condition.Condition(js) - self.implCondition7(inst2) - - 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.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") - 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, "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[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.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-example2.json") - self.assertIsNotNone(inst, "Must have instantiated a Condition instance") - self.implCondition8(inst) - - js = inst.as_json() - self.assertEqual("Condition", js["resourceType"]) - inst2 = condition.Condition(js) - self.implCondition8(inst2) - - def implCondition8(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://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.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-f202-malignancy.json") - self.assertIsNotNone(inst, "Must have instantiated a Condition instance") - self.implCondition9(inst) - - js = inst.as_json() - self.assertEqual("Condition", js["resourceType"]) - inst2 = condition.Condition(js) - self.implCondition9(inst2) - - def implCondition9(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.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, "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-f201-fever.json") - self.assertIsNotNone(inst, "Must have instantiated a Condition instance") - self.implCondition10(inst) - - js = inst.as_json() - self.assertEqual("Condition", js["resourceType"]) - inst2 = condition.Condition(js) - self.implCondition10(inst2) - - def implCondition10(self, inst): - 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.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.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 deleted file mode 100644 index 215ae6b28..000000000 --- a/fhirclient/models/consent.py +++ /dev/null @@ -1,368 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# 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 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 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. - """ - - resource_type = "Consent" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 consent statement - for indexing/retrieval. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.dateTime = None - """ When this Consent was created or indexed. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.identifier = None - """ Identifier for this record (external references). - List of `Identifier` items (represented as `dict` in JSON). """ - - self.organization = None - """ Custodian of the consent. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.patient = None - """ Who the consent applies to. - Type `FHIRReference` (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 - """ Regulation that this consents to. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.provision = None - """ Constraints to the base Consent.policyRule. - Type `ConsentProvision` (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.sourceReference = None - """ Source from which this consent is taken. - 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([ - ("category", "category", codeableconcept.CodeableConcept, True, None, True), - ("dateTime", "dateTime", fhirdate.FHIRDate, False, None, False), - ("identifier", "identifier", identifier.Identifier, True, None, False), - ("organization", "organization", fhirreference.FHIRReference, True, None, False), - ("patient", "patient", fhirreference.FHIRReference, False, None, False), - ("performer", "performer", fhirreference.FHIRReference, True, None, False), - ("policy", "policy", ConsentPolicy, 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), - ("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 ConsentPolicy(backboneelement.BackboneElement): - """ Policies covered by this consent. - - 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 = "ConsentPolicy" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Enforcement source for policy. - Type `str`. """ - - self.uri = None - """ Specific policy covered by this consent. - Type `str`. """ - - super(ConsentPolicy, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ConsentPolicy, self).elementProperties() - js.extend([ - ("authority", "authority", str, False, None, False), - ("uri", "uri", str, False, None, False), - ]) - return js - - -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 = "ConsentProvision" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Actions controlled by this rule. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.actor = None - """ 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, 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 `CodeableConcept` items (represented as `dict` in JSON). """ - - self.data = None - """ Data controlled by this rule. - List of `ConsentProvisionData` items (represented as `dict` in JSON). """ - - self.dataPeriod = None - """ Timeframe for data controlled by this rule. - Type `Period` (represented as `dict` in JSON). """ - - self.period = None - """ 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 rule. - List of `Coding` 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.type = None - """ deny | permit. - Type `str`. """ - - super(ConsentProvision, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ConsentProvision, self).elementProperties() - js.extend([ - ("action", "action", codeableconcept.CodeableConcept, True, None, False), - ("actor", "actor", ConsentProvisionActor, True, None, False), - ("class_fhir", "class", coding.Coding, 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, False), - ]) - return js - - -class ConsentProvisionActor(backboneelement.BackboneElement): - """ Who|what controlled by this rule (or group, by role). - - 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 = "ConsentProvisionActor" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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` (represented as `dict` in JSON). """ - - self.role = None - """ How the actor is involved. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(ConsentProvisionActor, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ConsentProvisionActor, self).elementProperties() - js.extend([ - ("reference", "reference", fhirreference.FHIRReference, False, None, True), - ("role", "role", codeableconcept.CodeableConcept, False, None, True), - ]) - return js - - -class ConsentProvisionData(backboneelement.BackboneElement): - """ Data controlled by this rule. - - The resources controlled by this rule if specific resources are referenced. - """ - - resource_type = "ConsentProvisionData" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.meaning = None - """ instance | related | dependents | authoredby. - Type `str`. """ - - self.reference = None - """ The actual data reference. - Type `FHIRReference` (represented as `dict` in JSON). """ - - super(ConsentProvisionData, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ConsentProvisionData, self).elementProperties() - js.extend([ - ("meaning", "meaning", str, False, None, True), - ("reference", "reference", fhirreference.FHIRReference, False, None, True), - ]) - return js - - -class ConsentVerification(backboneelement.BackboneElement): - """ Consent Verified by patient or family. - - 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 = "ConsentVerification" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.verificationDate = None - """ When consent verified. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.verified = None - """ Has been verified. - Type `bool`. """ - - 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(ConsentVerification, self).elementProperties() - js.extend([ - ("verificationDate", "verificationDate", fhirdate.FHIRDate, False, None, False), - ("verified", "verified", bool, False, None, True), - ("verifiedWith", "verifiedWith", fhirreference.FHIRReference, 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 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 period -except ImportError: - period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/consent_tests.py b/fhirclient/models/consent_tests.py deleted file mode 100644 index d8157f5b4..000000000 --- a/fhirclient/models/consent_tests.py +++ /dev/null @@ -1,412 +0,0 @@ -#!/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 consent -from .fhirdate import FHIRDate - - -class ConsentTests(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("Consent", js["resourceType"]) - return consent.Consent(js) - - def testConsent1(self): - inst = self.instantiate_from("consent-example-notThis.json") - self.assertIsNotNone(inst, "Must have instantiated a Consent instance") - self.implConsent1(inst) - - js = inst.as_json() - self.assertEqual("Consent", js["resourceType"]) - inst2 = consent.Consent(js) - 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.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-smartonfhir.json") - self.assertIsNotNone(inst, "Must have instantiated a Consent instance") - self.implConsent2(inst) - - js = inst.as_json() - self.assertEqual("Consent", js["resourceType"]) - inst2 = consent.Consent(js) - self.implConsent2(inst2) - - def implConsent2(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-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") - - def testConsent3(self): - inst = self.instantiate_from("consent-example-notAuthor.json") - self.assertIsNotNone(inst, "Must have instantiated a Consent instance") - self.implConsent3(inst) - - js = inst.as_json() - self.assertEqual("Consent", js["resourceType"]) - inst2 = consent.Consent(js) - 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.id, "consent-example-notAuthor") - self.assertEqual(inst.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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-notTime.json") - self.assertIsNotNone(inst, "Must have instantiated a Consent instance") - self.implConsent4(inst) - - js = inst.as_json() - self.assertEqual("Consent", js["resourceType"]) - inst2 = consent.Consent(js) - 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.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-signature.json") - self.assertIsNotNone(inst, "Must have instantiated a Consent instance") - self.implConsent5(inst) - - js = inst.as_json() - self.assertEqual("Consent", js["resourceType"]) - inst2 = consent.Consent(js) - self.implConsent5(inst2) - - def implConsent5(self, inst): - 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-notThem.json") - self.assertIsNotNone(inst, "Must have instantiated a Consent instance") - self.implConsent6(inst) - - js = inst.as_json() - self.assertEqual("Consent", js["resourceType"]) - inst2 = consent.Consent(js) - 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.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-grantor.json") - self.assertIsNotNone(inst, "Must have instantiated a Consent instance") - self.implConsent7(inst) - - js = inst.as_json() - self.assertEqual("Consent", js["resourceType"]) - inst2 = consent.Consent(js) - 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.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-notOrg.json") - self.assertIsNotNone(inst, "Must have instantiated a Consent instance") - self.implConsent8(inst) - - js = inst.as_json() - self.assertEqual("Consent", js["resourceType"]) - inst2 = consent.Consent(js) - self.implConsent8(inst2) - - def implConsent8(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.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") - - def testConsent9(self): - inst = self.instantiate_from("consent-example-pkb.json") - self.assertIsNotNone(inst, "Must have instantiated a Consent instance") - self.implConsent9(inst) - - js = inst.as_json() - self.assertEqual("Consent", js["resourceType"]) - inst2 = consent.Consent(js) - 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.id, "consent-example-pkb") - self.assertEqual(inst.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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.json") - self.assertIsNotNone(inst, "Must have instantiated a Consent instance") - self.implConsent10(inst) - - js = inst.as_json() - self.assertEqual("Consent", js["resourceType"]) - inst2 = consent.Consent(js) - self.implConsent10(inst2) - - def implConsent10(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-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 deleted file mode 100644 index 6b631a575..000000000 --- a/fhirclient/models/contactdetail.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ContactDetail) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import element - -class ContactDetail(element.Element): - """ Contact information. - - Specifies contact information for a person or organization. - """ - - resource_type = "ContactDetail" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 an individual to contact. - Type `str`. """ - - self.telecom = None - """ Contact details for individual or organization. - List of `ContactPoint` items (represented as `dict` in JSON). """ - - super(ContactDetail, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ContactDetail, self).elementProperties() - js.extend([ - ("name", "name", str, False, None, False), - ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), - ]) - return js - - -import sys -try: - from . import contactpoint -except ImportError: - contactpoint = sys.modules[__package__ + '.contactpoint'] diff --git a/fhirclient/models/contactpoint.py b/fhirclient/models/contactpoint.py deleted file mode 100644 index 7e5084e67..000000000 --- a/fhirclient/models/contactpoint.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ContactPoint) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import element - -class ContactPoint(element.Element): - """ Details of a Technology mediated contact point (phone, fax, email, etc.). - - Details for all kinds of technology mediated contact points for a person or - organization, including telephone, email, etc. - """ - - resource_type = "ContactPoint" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Time period when the contact point was/is in use. - Type `Period` (represented as `dict` in JSON). """ - - self.rank = None - """ Specify preferred order of use (1 = highest). - Type `int`. """ - - self.system = None - """ phone | fax | email | pager | url | sms | other. - Type `str`. """ - - self.use = None - """ home | work | temp | old | mobile - purpose of this contact point. - Type `str`. """ - - self.value = None - """ The actual contact point details. - Type `str`. """ - - super(ContactPoint, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ContactPoint, self).elementProperties() - js.extend([ - ("period", "period", period.Period, False, None, False), - ("rank", "rank", int, False, None, False), - ("system", "system", str, False, None, False), - ("use", "use", str, False, None, False), - ("value", "value", str, False, None, False), - ]) - return js - - -import sys -try: - from . import period -except ImportError: - period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/contract.py b/fhirclient/models/contract.py deleted file mode 100644 index 7553a5912..000000000 --- a/fhirclient/models/contract.py +++ /dev/null @@ -1,1210 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Contract) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class Contract(domainresource.DomainResource): - """ Legal Agreement. - - Legally enforceable, formally recorded unilateral or bilateral directive - i.e., a policy or agreement. - """ - - resource_type = "Contract" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - 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 (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.domain = None - """ 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. - List of `ContractFriendly` items (represented as `dict` in JSON). """ - - self.identifier = None - """ Contract number. - 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. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.legal = None - """ 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.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 - """ draft | active | suspended | cancelled | completed | entered-in- - error | unknown. - Type `str`. """ - - self.subType = None - """ Subtype within the context of type. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.subject = None - """ Contract Target Entity. - 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.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 - """ Legal instrument category. - Type `CodeableConcept` (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([ - ("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), - ("contentDefinition", "contentDefinition", ContractContentDefinition, False, None, False), - ("contentDerivative", "contentDerivative", 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, 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), - ("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), - ("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), - ("url", "url", str, False, None, False), - ("version", "version", str, False, None, False), - ]) - return js - - -from . import backboneelement - -class ContractContentDefinition(backboneelement.BackboneElement): - """ Contract precursor content. - - 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 = "ContractContentDefinition" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.copyright = None - """ Publication Ownership. - Type `str`. """ - - self.publicationDate = None - """ When published. - Type `FHIRDate` (represented as `str` in JSON). """ - - 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(ContractContentDefinition, self).elementProperties() - js.extend([ - ("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 - - -class ContractFriendly(backboneelement.BackboneElement): - """ Contract Friendly Language. - - The "patient friendly language" versionof the Contract in whole or in - parts. "Patient friendly language" means the representation of the Contract - and Contract Provisions in a manner that is readily accessible and - understandable by a layperson in accordance with best practices for - communication styles that ensure that those agreeing to or signing the - Contract understand the roles, actions, obligations, responsibilities, and - implication of the agreement. - """ - - resource_type = "ContractFriendly" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.contentAttachment = None - """ Easily comprehended representation of this Contract. - Type `Attachment` (represented as `dict` in JSON). """ - - self.contentReference = None - """ Easily comprehended representation of this Contract. - Type `FHIRReference` (represented as `dict` in JSON). """ - - super(ContractFriendly, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ContractFriendly, self).elementProperties() - js.extend([ - ("contentAttachment", "contentAttachment", attachment.Attachment, False, "content", True), - ("contentReference", "contentReference", fhirreference.FHIRReference, False, "content", True), - ]) - return js - - -class ContractLegal(backboneelement.BackboneElement): - """ Contract Legal Language. - - List of Legal expressions or representations of this Contract. - """ - - resource_type = "ContractLegal" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.contentAttachment = None - """ Contract Legal Text. - Type `Attachment` (represented as `dict` in JSON). """ - - self.contentReference = None - """ Contract Legal Text. - Type `FHIRReference` (represented as `dict` in JSON). """ - - super(ContractLegal, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ContractLegal, self).elementProperties() - js.extend([ - ("contentAttachment", "contentAttachment", attachment.Attachment, False, "content", True), - ("contentReference", "contentReference", fhirreference.FHIRReference, False, "content", True), - ]) - return js - - -class ContractRule(backboneelement.BackboneElement): - """ Computable Contract Language. - - List of Computable Policy Rule Language Representations of this Contract. - """ - - resource_type = "ContractRule" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.contentAttachment = None - """ Computable Contract Rules. - Type `Attachment` (represented as `dict` in JSON). """ - - self.contentReference = None - """ Computable Contract Rules. - Type `FHIRReference` (represented as `dict` in JSON). """ - - super(ContractRule, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ContractRule, self).elementProperties() - js.extend([ - ("contentAttachment", "contentAttachment", attachment.Attachment, False, "content", True), - ("contentReference", "contentReference", fhirreference.FHIRReference, False, "content", True), - ]) - return js - - -class ContractSigner(backboneelement.BackboneElement): - """ Contract Signatory. - - Parties with legal standing in the Contract, including the principal - parties, the grantor(s) and grantee(s), which are any person or - organization bound by the contract, and any ancillary parties, which - facilitate the execution of the contract such as a notary or witness. - """ - - resource_type = "ContractSigner" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.party = None - """ Contract Signatory Party. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.signature = None - """ Contract Documentation Signature. - List of `Signature` items (represented as `dict` in JSON). """ - - self.type = None - """ Contract Signatory Role. - Type `Coding` (represented as `dict` in JSON). """ - - super(ContractSigner, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ContractSigner, self).elementProperties() - js.extend([ - ("party", "party", fhirreference.FHIRReference, False, None, True), - ("signature", "signature", signature.Signature, True, None, True), - ("type", "type", coding.Coding, False, None, True), - ]) - return js - - -class ContractTerm(backboneelement.BackboneElement): - """ Contract Term List. - - One or more Contract Provisions, which may be related and conveyed as a - group, and may contain nested groups. - """ - - resource_type = "ContractTerm" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ 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). """ - - self.identifier = None - """ Contract Term Number. - Type `Identifier` (represented as `dict` in JSON). """ - - self.issued = None - """ 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 - """ 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 - """ Term Statement. - Type `str`. """ - - 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). """ - - super(ContractTerm, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ContractTerm, self).elementProperties() - js.extend([ - ("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), - ("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), - ("topicCodeableConcept", "topicCodeableConcept", codeableconcept.CodeableConcept, False, "topic", False), - ("topicReference", "topicReference", fhirreference.FHIRReference, False, "topic", False), - ("type", "type", codeableconcept.CodeableConcept, False, None, False), - ]) - return js - - -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 = "ContractTermAction" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.context = None - """ Episode associated with action. - Type `FHIRReference` (represented as `dict` in JSON). """ - - 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). """ - - 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(ContractTermAction, self).elementProperties() - js.extend([ - ("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 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) - - 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 = "ContractTermAsset" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 assets. - List of `ContractTermOfferAnswer` items (represented as `dict` in JSON). """ - - 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.securityLabelNumber = None - """ Asset restriction numbers. - List of `int` items. """ - - self.subtype = None - """ Asset sub-category. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.text = None - """ Asset clause or question text. - Type `str`. """ - - self.type = None - """ Asset category. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.typeReference = None - """ Associated entities. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.usePeriod = None - """ Time period. - List of `Period` items (represented as `dict` in JSON). """ - - self.valuedItem = None - """ Contract Valued Item List. - List of `ContractTermAssetValuedItem` items (represented as `dict` in JSON). """ - - super(ContractTermAsset, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ContractTermAsset, self).elementProperties() - js.extend([ - ("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 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 = "ContractTermAssetValuedItem" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.effectiveTime = None - """ Contract Valued Item Effective Tiem. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.entityCodeableConcept = None - """ Contract Valued Item Type. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.entityReference = None - """ Contract Valued Item Type. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.factor = None - """ Contract Valued Item Price Scaling Factor. - Type `float`. """ - - self.identifier = None - """ 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`. """ - - self.quantity = None - """ 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(ContractTermAssetValuedItem, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - 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: - attachment = sys.modules[__package__ + '.attachment'] -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 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'] -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/contract_tests.py b/fhirclient/models/contract_tests.py deleted file mode 100644 index 5be488d1a..000000000 --- a/fhirclient/models/contract_tests.py +++ /dev/null @@ -1,353 +0,0 @@ -#!/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 contract -from .fhirdate import FHIRDate - - -class ContractTests(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("Contract", js["resourceType"]) - return contract.Contract(js) - - def testContract1(self): - inst = self.instantiate_from("pcd-example-notOrg.json") - self.assertIsNotNone(inst, "Must have instantiated a Contract instance") - self.implContract1(inst) - - js = inst.as_json() - self.assertEqual("Contract", js["resourceType"]) - inst2 = contract.Contract(js) - self.implContract1(inst2) - - def implContract1(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.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, "57016-8") - self.assertEqual(inst.type.coding[0].system, "http://loinc.org") - - def testContract2(self): - inst = self.instantiate_from("contract-example-ins-policy.json") - self.assertIsNotNone(inst, "Must have instantiated a Contract instance") - self.implContract2(inst) - - js = inst.as_json() - self.assertEqual("Contract", js["resourceType"]) - inst2 = contract.Contract(js) - self.implContract2(inst2) - - def implContract2(self, inst): - 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("contract-example-42cfr-part2.json") - self.assertIsNotNone(inst, "Must have instantiated a Contract instance") - self.implContract3(inst) - - js = inst.as_json() - self.assertEqual("Contract", js["resourceType"]) - inst2 = contract.Contract(js) - self.implContract3(inst2) - - def implContract3(self, inst): - 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, "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") - self.assertIsNotNone(inst, "Must have instantiated a Contract instance") - self.implContract4(inst) - - js = inst.as_json() - self.assertEqual("Contract", js["resourceType"]) - inst2 = contract.Contract(js) - self.implContract4(inst2) - - def implContract4(self, inst): - self.assertEqual(inst.friendly[0].contentAttachment.title, "The terms of the consent in friendly consumer speak.") - self.assertEqual(inst.id, "pcd-example-notLabs") - 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].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-notThem.json") - self.assertIsNotNone(inst, "Must have instantiated a Contract instance") - self.implContract5(inst) - - js = inst.as_json() - self.assertEqual("Contract", js["resourceType"]) - inst2 = contract.Contract(js) - self.implContract5(inst2) - - 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-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].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") - 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 testContract6(self): - inst = self.instantiate_from("pcd-example-notAuthor.json") - self.assertIsNotNone(inst, "Must have instantiated a Contract instance") - self.implContract6(inst) - - js = inst.as_json() - self.assertEqual("Contract", js["resourceType"]) - inst2 = contract.Contract(js) - self.implContract6(inst2) - - 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-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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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 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("contract-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Contract instance") - self.implContract7(inst) - - js = inst.as_json() - self.assertEqual("Contract", js["resourceType"]) - inst2 = contract.Contract(js) - 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].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") - 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") - diff --git a/fhirclient/models/contributor.py b/fhirclient/models/contributor.py deleted file mode 100644 index 138f636c2..000000000 --- a/fhirclient/models/contributor.py +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Contributor) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import element - -class Contributor(element.Element): - """ Contributor information. - - A contributor to the content of a knowledge asset, including authors, - editors, reviewers, and endorsers. - """ - - resource_type = "Contributor" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 of the contributor. - List of `ContactDetail` items (represented as `dict` in JSON). """ - - self.name = None - """ Who contributed the content. - Type `str`. """ - - self.type = None - """ author | editor | reviewer | endorser. - Type `str`. """ - - super(Contributor, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Contributor, self).elementProperties() - js.extend([ - ("contact", "contact", contactdetail.ContactDetail, True, None, False), - ("name", "name", str, False, None, True), - ("type", "type", str, False, None, True), - ]) - return js - - -import sys -try: - from . import contactdetail -except ImportError: - contactdetail = sys.modules[__package__ + '.contactdetail'] diff --git a/fhirclient/models/count.py b/fhirclient/models/count.py deleted file mode 100644 index 28e8a9336..000000000 --- a/fhirclient/models/count.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Count) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import quantity - -class Count(quantity.Quantity): - """ A measured or measurable amount. - - A measured amount (or an amount that can potentially be measured). Note - that measured amounts include amounts that are not precisely quantified, - including amounts involving arbitrary units and floating currencies. - """ - - resource_type = "Count" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - super(Count, self).__init__(jsondict=jsondict, strict=strict) - - diff --git a/fhirclient/models/coverage.py b/fhirclient/models/coverage.py deleted file mode 100644 index f061e64dd..000000000 --- a/fhirclient/models/coverage.py +++ /dev/null @@ -1,270 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Coverage) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -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. Includes both insurance and self-payment. - """ - - resource_type = "Coverage" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.beneficiary = None - """ 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 (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.identifier = None - """ Business Identifier for the coverage. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.network = None - """ Insurer network. - Type `str`. """ - - self.order = None - """ Relative order of the coverage. - Type `int`. """ - - self.payor = None - """ Issuer of the policy. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.period = None - """ Coverage start and end dates. - Type `Period` (represented as `dict` in JSON). """ - - self.policyHolder = None - """ Owner of the policy. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.relationship = None - """ Beneficiary relationship to the subscriber. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - 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` (represented as `dict` in JSON). """ - - self.subscriberId = None - """ ID assigned to the subscriber. - Type `str`. """ - - self.type = None - """ Coverage category such as medical or accident. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(Coverage, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Coverage, self).elementProperties() - js.extend([ - ("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), - ("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, True), - ("period", "period", period.Period, False, None, False), - ("policyHolder", "policyHolder", fhirreference.FHIRReference, False, None, False), - ("relationship", "relationship", codeableconcept.CodeableConcept, 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), - ]) - return js - - -from . import backboneelement - -class CoverageClass(backboneelement.BackboneElement): - """ Additional coverage classifications. - - A suite of underwriter specific classifiers. - """ - - resource_type = "CoverageClass" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Human readable description of the type and value. - Type `str`. """ - - self.type = None - """ Type of class such as 'group' or 'plan'. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.value = None - """ Value associated with the type. - 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. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.exception = None - """ Exceptions for patient payments. - List of `CoverageCostToBeneficiaryException` items (represented as `dict` in JSON). """ - - self.type = None - """ Cost category. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.valueMoney = None - """ The amount or percentage due from the beneficiary. - Type `Money` (represented as `dict` in JSON). """ - - self.valueQuantity = None - """ The amount or percentage due from the beneficiary. - Type `Quantity` (represented as `dict` in JSON). """ - - 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. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 effective period of the exception. - Type `Period` (represented as `dict` in JSON). """ - - 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(CoverageCostToBeneficiaryException, self).elementProperties() - js.extend([ - ("period", "period", period.Period, 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 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/coverage_tests.py b/fhirclient/models/coverage_tests.py deleted file mode 100644 index 28fdf27ca..000000000 --- a/fhirclient/models/coverage_tests.py +++ /dev/null @@ -1,198 +0,0 @@ -#!/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 coverage -from .fhirdate import FHIRDate - - -class CoverageTests(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("Coverage", js["resourceType"]) - return coverage.Coverage(js) - - def testCoverage1(self): - inst = self.instantiate_from("coverage-example-2.json") - self.assertIsNotNone(inst, "Must have instantiated a Coverage instance") - self.implCoverage1(inst) - - js = inst.as_json() - self.assertEqual("Coverage", js["resourceType"]) - inst2 = coverage.Coverage(js) - 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.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) - self.assertEqual(inst.period.end.as_json(), "2012-03-17") - self.assertEqual(inst.period.start.date, FHIRDate("2011-03-17").date) - self.assertEqual(inst.period.start.as_json(), "2011-03-17") - self.assertEqual(inst.relationship.coding[0].code, "self") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.subscriberId, "AB9876") - 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://terminology.hl7.org/CodeSystem/v3-ActCode") - - def testCoverage2(self): - inst = self.instantiate_from("coverage-example-selfpay.json") - self.assertIsNotNone(inst, "Must have instantiated a Coverage instance") - self.implCoverage2(inst) - - js = inst.as_json() - self.assertEqual("Coverage", js["resourceType"]) - inst2 = coverage.Coverage(js) - self.implCoverage2(inst2) - - def implCoverage2(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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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.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://terminology.hl7.org/CodeSystem/coverage-selfpay") - - def testCoverage3(self): - inst = self.instantiate_from("coverage-example-ehic.json") - self.assertIsNotNone(inst, "Must have instantiated a Coverage instance") - self.implCoverage3(inst) - - js = inst.as_json() - self.assertEqual("Coverage", js["resourceType"]) - inst2 = coverage.Coverage(js) - self.implCoverage3(inst2) - - def implCoverage3(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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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.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://terminology.hl7.org/CodeSystem/v3-ActCode") - - def testCoverage4(self): - inst = self.instantiate_from("coverage-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Coverage instance") - self.implCoverage4(inst) - - js = inst.as_json() - self.assertEqual("Coverage", js["resourceType"]) - inst2 = coverage.Coverage(js) - 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.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.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://terminology.hl7.org/CodeSystem/v3-ActCode") - diff --git a/fhirclient/models/datarequirement.py b/fhirclient/models/datarequirement.py deleted file mode 100644 index b1a8e5a0e..000000000 --- a/fhirclient/models/datarequirement.py +++ /dev/null @@ -1,243 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/DataRequirement) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import element - -class DataRequirement(element.Element): - """ Describes a required data item. - - Describes a required data item for evaluation in terms of the type of data, - and optional code or date-based filters of the data. - """ - - resource_type = "DataRequirement" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.codeFilter = None - """ What codes are expected. - List of `DataRequirementCodeFilter` items (represented as `dict` in JSON). """ - - self.dateFilter = None - """ 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 specific structure elements that are referenced by the - knowledge module. - List of `str` items. """ - - self.profile = None - """ 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`. """ - - super(DataRequirement, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(DataRequirement, self).elementProperties() - 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 - - -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. Each code - filter defines an additional constraint on the data, i.e. code filters are - AND'ed, not OR'ed. - """ - - resource_type = "DataRequirementCodeFilter" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 code is expected. - List of `Coding` items (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.valueSet = None - """ Valueset for the filter. - Type `str`. """ - - super(DataRequirementCodeFilter, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(DataRequirementCodeFilter, self).elementProperties() - js.extend([ - ("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 - - -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. Each date filter specifies an - additional constraint on the data, i.e. date filters are AND'ed, not OR'ed. - """ - - resource_type = "DataRequirementDateFilter" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.path = None - """ A date-valued attribute to filter on. - Type `str`. """ - - self.searchParam = None - """ A date valued parameter to search on. - Type `str`. """ - - self.valueDateTime = None - """ The value of the filter, as a Period, DateTime, or Duration value. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.valueDuration = None - """ The value of the filter, as a Period, DateTime, or Duration value. - Type `Duration` (represented as `dict` in JSON). """ - - self.valuePeriod = None - """ The value of the filter, as a Period, DateTime, or Duration value. - Type `Period` (represented as `dict` in JSON). """ - - super(DataRequirementDateFilter, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(DataRequirementDateFilter, self).elementProperties() - js.extend([ - ("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), - ]) - 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 -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 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: - period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/detectedissue.py b/fhirclient/models/detectedissue.py deleted file mode 100644 index e2201a7a7..000000000 --- a/fhirclient/models/detectedissue.py +++ /dev/null @@ -1,204 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/DetectedIssue) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class DetectedIssue(domainresource.DomainResource): - """ Clinical issue with action. - - Indicates an actual or potential clinical issue with or between one or more - active or proposed clinical actions for a patient; e.g. Drug-drug - interaction, Ineffective treatment frequency, Procedure-condition conflict, - etc. - """ - - resource_type = "DetectedIssue" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ The provider or device that identified the issue. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.code = None - """ Issue Category, e.g. drug-drug, duplicate therapy, etc.. - Type `CodeableConcept` (represented as `dict` 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. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.implicated = None - """ Problem resource. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.mitigation = None - """ Step taken to address. - List of `DetectedIssueMitigation` items (represented as `dict` in JSON). """ - - self.patient = None - """ Associated patient. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.reference = None - """ Authority for issue. - Type `str`. """ - - self.severity = None - """ high | moderate | low. - Type `str`. """ - - self.status = None - """ registered | preliminary | final | amended +. - Type `str`. """ - - super(DetectedIssue, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(DetectedIssue, self).elementProperties() - js.extend([ - ("author", "author", fhirreference.FHIRReference, False, None, False), - ("code", "code", codeableconcept.CodeableConcept, False, None, False), - ("detail", "detail", str, 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), - ("reference", "reference", str, False, None, False), - ("severity", "severity", str, False, None, False), - ("status", "status", str, False, None, True), - ]) - return js - - -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 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. - """ - - resource_type = "DetectedIssueMitigation" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ What mitigation?. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.author = None - """ Who is committing?. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.date = None - """ Date committed. - Type `FHIRDate` (represented as `str` in JSON). """ - - super(DetectedIssueMitigation, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(DetectedIssueMitigation, self).elementProperties() - js.extend([ - ("action", "action", codeableconcept.CodeableConcept, False, None, True), - ("author", "author", fhirreference.FHIRReference, False, None, False), - ("date", "date", fhirdate.FHIRDate, 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/detectedissue_tests.py b/fhirclient/models/detectedissue_tests.py deleted file mode 100644 index 2749deeb1..000000000 --- a/fhirclient/models/detectedissue_tests.py +++ /dev/null @@ -1,119 +0,0 @@ -#!/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 detectedissue -from .fhirdate import FHIRDate - - -class DetectedIssueTests(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("DetectedIssue", js["resourceType"]) - return detectedissue.DetectedIssue(js) - - def testDetectedIssue1(self): - inst = self.instantiate_from("detectedissue-example-allergy.json") - self.assertIsNotNone(inst, "Must have instantiated a DetectedIssue instance") - self.implDetectedIssue1(inst) - - js = inst.as_json() - self.assertEqual("DetectedIssue", js["resourceType"]) - inst2 = detectedissue.DetectedIssue(js) - self.implDetectedIssue1(inst2) - - 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") - - def testDetectedIssue2(self): - inst = self.instantiate_from("detectedissue-example-dup.json") - self.assertIsNotNone(inst, "Must have instantiated a DetectedIssue instance") - self.implDetectedIssue2(inst) - - js = inst.as_json() - self.assertEqual("DetectedIssue", js["resourceType"]) - inst2 = detectedissue.DetectedIssue(js) - self.implDetectedIssue2(inst2) - - def implDetectedIssue2(self, inst): - 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.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.json") - self.assertIsNotNone(inst, "Must have instantiated a DetectedIssue instance") - self.implDetectedIssue3(inst) - - js = inst.as_json() - self.assertEqual("DetectedIssue", js["resourceType"]) - inst2 = detectedissue.DetectedIssue(js) - self.implDetectedIssue3(inst2) - - def implDetectedIssue3(self, inst): - 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.status, "generated") - - def testDetectedIssue4(self): - inst = self.instantiate_from("detectedissue-example-lab.json") - self.assertIsNotNone(inst, "Must have instantiated a DetectedIssue instance") - self.implDetectedIssue4(inst) - - js = inst.as_json() - self.assertEqual("DetectedIssue", js["resourceType"]) - inst2 = detectedissue.DetectedIssue(js) - self.implDetectedIssue4(inst2) - - def implDetectedIssue4(self, inst): - 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 deleted file mode 100644 index 51c824e2f..000000000 --- a/fhirclient/models/device.py +++ /dev/null @@ -1,411 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Device) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class Device(domainresource.DomainResource): - """ Item used in healthcare. - - 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" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ 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). """ - - self.identifier = None - """ Instance identifier. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.location = None - """ Where the device is found. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.lotNumber = None - """ Lot number of manufacture. - Type `str`. """ - - self.manufactureDate = None - """ Date when the device was made. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.manufacturer = None - """ Name of device manufacturer. - Type `str`. """ - - 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.owner = None - """ Organization responsible for device. - 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` (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 - """ The kind or type of device. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.udiCarrier = None - """ Unique Device Identifier (UDI) Barcode string. - List of `DeviceUdiCarrier` items (represented as `dict` in JSON). """ - - self.url = None - """ Network address to contact device. - Type `str`. """ - - self.version = None - """ 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) - - 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), - ("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), - ("udiCarrier", "udiCarrier", DeviceUdiCarrier, True, None, False), - ("url", "url", str, False, None, False), - ("version", "version", DeviceVersion, True, None, False), - ]) - return js - - -from . import 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) 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 = "DeviceUdiCarrier" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.carrierAIDC = None - """ UDI Machine Readable Barcode String. - Type `str`. """ - - self.carrierHRF = None - """ UDI Human Readable Barcode String. - Type `str`. """ - - self.deviceIdentifier = None - """ Mandatory fixed portion of UDI. - Type `str`. """ - - self.entryType = None - """ barcode | rfid | manual +. - Type `str`. """ - - self.issuer = None - """ UDI Issuing Organization. - Type `str`. """ - - self.jurisdiction = None - """ Regional UDI authority. - Type `str`. """ - - super(DeviceUdiCarrier, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(DeviceUdiCarrier, self).elementProperties() - js.extend([ - ("carrierAIDC", "carrierAIDC", str, False, None, False), - ("carrierHRF", "carrierHRF", str, False, None, False), - ("deviceIdentifier", "deviceIdentifier", str, False, None, False), - ("entryType", "entryType", str, False, None, False), - ("issuer", "issuer", str, False, None, False), - ("jurisdiction", "jurisdiction", 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 - - -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 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'] diff --git a/fhirclient/models/device_tests.py b/fhirclient/models/device_tests.py deleted file mode 100644 index 3698ecf32..000000000 --- a/fhirclient/models/device_tests.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/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 device -from .fhirdate import FHIRDate - - -class DeviceTests(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("Device", js["resourceType"]) - return device.Device(js) - - def testDevice1(self): - inst = self.instantiate_from("device-example-f001-feedingtube.json") - self.assertIsNotNone(inst, "Must have instantiated a Device instance") - self.implDevice1(inst) - - js = inst.as_json() - self.assertEqual("Device", js["resourceType"]) - inst2 = device.Device(js) - self.implDevice1(inst2) - - def implDevice1(self, inst): - 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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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") - - def testDevice2(self): - inst = self.instantiate_from("device-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Device instance") - self.implDevice2(inst) - - js = inst.as_json() - self.assertEqual("Device", js["resourceType"]) - inst2 = device.Device(js) - self.implDevice2(inst2) - - def implDevice2(self, inst): - 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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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") - diff --git a/fhirclient/models/devicemetric.py b/fhirclient/models/devicemetric.py deleted file mode 100644 index b47b2f68a..000000000 --- a/fhirclient/models/devicemetric.py +++ /dev/null @@ -1,148 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/DeviceMetric) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class DeviceMetric(domainresource.DomainResource): - """ Measurement, calculation or setting capability of a medical device. - - Describes a measurement, calculation or setting capability of a medical - device. - """ - - resource_type = "DeviceMetric" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.calibration = None - """ Describes the calibrations that have been performed or that are - required to be performed. - List of `DeviceMetricCalibration` items (represented as `dict` in JSON). """ - - self.category = None - """ measurement | setting | calculation | unspecified. - Type `str`. """ - - self.color = None - """ black | red | green | yellow | blue | magenta | cyan | white. - Type `str`. """ - - self.identifier = None - """ Instance identifier. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.measurementPeriod = None - """ Describes the measurement repetition time. - Type `Timing` (represented as `dict` in JSON). """ - - self.operationalStatus = None - """ on | off | standby | entered-in-error. - Type `str`. """ - - self.parent = None - """ 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` (represented as `dict` in JSON). """ - - self.type = None - """ Identity of metric, for example Heart Rate or PEEP Setting. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.unit = None - """ Unit of Measure for the Metric. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(DeviceMetric, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(DeviceMetric, self).elementProperties() - js.extend([ - ("calibration", "calibration", DeviceMetricCalibration, True, None, False), - ("category", "category", str, False, None, True), - ("color", "color", str, False, None, False), - ("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), - ("source", "source", fhirreference.FHIRReference, False, None, False), - ("type", "type", codeableconcept.CodeableConcept, False, None, True), - ("unit", "unit", codeableconcept.CodeableConcept, False, None, False), - ]) - return js - - -from . import backboneelement - -class DeviceMetricCalibration(backboneelement.BackboneElement): - """ Describes the calibrations that have been performed or that are required to - be performed. - """ - - resource_type = "DeviceMetricCalibration" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.state = None - """ not-calibrated | calibration-required | calibrated | unspecified. - Type `str`. """ - - self.time = None - """ Describes the time last calibration has been performed. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.type = None - """ unspecified | offset | gain | two-point. - Type `str`. """ - - super(DeviceMetricCalibration, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(DeviceMetricCalibration, self).elementProperties() - js.extend([ - ("state", "state", str, False, None, False), - ("time", "time", fhirdate.FHIRDate, 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 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 timing -except ImportError: - timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/devicemetric_tests.py b/fhirclient/models/devicemetric_tests.py deleted file mode 100644 index 944c91be3..000000000 --- a/fhirclient/models/devicemetric_tests.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/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 devicemetric -from .fhirdate import FHIRDate - - -class DeviceMetricTests(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("DeviceMetric", js["resourceType"]) - return devicemetric.DeviceMetric(js) - - def testDeviceMetric1(self): - inst = self.instantiate_from("devicemetric-example.json") - self.assertIsNotNone(inst, "Must have instantiated a DeviceMetric instance") - self.implDeviceMetric1(inst) - - js = inst.as_json() - self.assertEqual("DeviceMetric", js["resourceType"]) - inst2 = devicemetric.DeviceMetric(js) - self.implDeviceMetric1(inst2) - - def implDeviceMetric1(self, inst): - self.assertEqual(inst.calibration[0].state, "calibrated") - self.assertEqual(inst.calibration[0].time.date, FHIRDate("2016-12-28T09:03:04-05:00").date) - self.assertEqual(inst.calibration[0].time.as_json(), "2016-12-28T09:03:04-05:00") - self.assertEqual(inst.calibration[0].type, "two-point") - self.assertEqual(inst.category, "measurement") - self.assertEqual(inst.color, "blue") - self.assertEqual(inst.id, "example") - 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, "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, "urn:iso:std:iso:11073:10101") - diff --git a/fhirclient/models/devicerequest.py b/fhirclient/models/devicerequest.py deleted file mode 100644 index 494914c55..000000000 --- a/fhirclient/models/devicerequest.py +++ /dev/null @@ -1,263 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/DeviceRequest) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class DeviceRequest(domainresource.DomainResource): - """ Medical device request. - - Represents a request for a patient to employ a medical device. The device - may be an implantable device, or an external assistive device, such as a - walker. - """ - - resource_type = "DeviceRequest" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ When recorded. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.basedOn = None - """ What request fulfills. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.codeCodeableConcept = None - """ Device requested. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.codeReference = None - """ Device requested. - Type `FHIRReference` (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. - Type `Identifier` (represented as `dict` in JSON). """ - - self.identifier = None - """ 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 `str`. """ - - self.note = None - """ Notes or comments. - List of `Annotation` items (represented as `dict` in JSON). """ - - self.occurrenceDateTime = None - """ Desired time or schedule for use. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.occurrencePeriod = None - """ Desired time or schedule for use. - Type `Period` (represented as `dict` in JSON). """ - - self.occurrenceTiming = None - """ 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` (represented as `dict` in JSON). """ - - self.performerType = None - """ Filler role. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.priorRequest = None - """ What request replaces. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.priority = None - """ Indicates how quickly the {{title}} should be addressed with - respect to other requests. - Type `str`. """ - - self.reasonCode = None - """ Coded Reason for request. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.reasonReference = None - """ Linked Reason for request. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.relevantHistory = None - """ Request provenance. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.requester = None - """ Who/what is requesting diagnostics. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.status = None - """ draft | active | suspended | completed | entered-in-error | - cancelled. - Type `str`. """ - - self.subject = None - """ Focus of request. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.supportingInfo = None - """ Additional clinical information. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - super(DeviceRequest, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(DeviceRequest, self).elementProperties() - js.extend([ - ("authoredOn", "authoredOn", fhirdate.FHIRDate, False, None, False), - ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), - ("codeCodeableConcept", "codeCodeableConcept", codeableconcept.CodeableConcept, False, "code", True), - ("codeReference", "codeReference", fhirreference.FHIRReference, False, "code", True), - ("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), - ("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), - ("priority", "priority", str, False, None, False), - ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), - ("reasonReference", "reasonReference", fhirreference.FHIRReference, True, None, False), - ("relevantHistory", "relevantHistory", fhirreference.FHIRReference, True, 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), - ]) - return js - - -from . import backboneelement - -class DeviceRequestParameter(backboneelement.BackboneElement): - """ Device details. - - Specific parameters for the ordered item. For example, the prism value for - lenses. - """ - - resource_type = "DeviceRequestParameter" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ 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.valueRange = None - """ Value of detail. - Type `Range` (represented as `dict` in JSON). """ - - super(DeviceRequestParameter, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(DeviceRequestParameter, self).elementProperties() - js.extend([ - ("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 - - -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'] -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: - timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/devicerequest_tests.py b/fhirclient/models/devicerequest_tests.py deleted file mode 100644 index adbc8ed39..000000000 --- a/fhirclient/models/devicerequest_tests.py +++ /dev/null @@ -1,76 +0,0 @@ -#!/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 devicerequest -from .fhirdate import FHIRDate - - -class DeviceRequestTests(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("DeviceRequest", js["resourceType"]) - return devicerequest.DeviceRequest(js) - - def testDeviceRequest1(self): - inst = self.instantiate_from("devicerequest-example-insulinpump.json") - self.assertIsNotNone(inst, "Must have instantiated a DeviceRequest instance") - self.implDeviceRequest1(inst) - - js = inst.as_json() - self.assertEqual("DeviceRequest", js["resourceType"]) - inst2 = devicerequest.DeviceRequest(js) - self.implDeviceRequest1(inst2) - - def implDeviceRequest1(self, inst): - self.assertEqual(inst.authoredOn.date, FHIRDate("2013-05-08T09:33:27+07:00").date) - self.assertEqual(inst.authoredOn.as_json(), "2013-05-08T09:33:27+07:00") - self.assertEqual(inst.codeCodeableConcept.coding[0].code, "43148-6") - self.assertEqual(inst.codeCodeableConcept.coding[0].system, "http://loinc.org") - self.assertEqual(inst.codeCodeableConcept.text, "Insulin delivery device panel") - self.assertEqual(inst.groupIdentifier.value, "ip_request1") - self.assertEqual(inst.id, "insulinpump") - self.assertEqual(inst.identifier[0].value, "ip_request1.1") - 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") - self.assertEqual(inst.performerType.coding[0].display, "Qualified nurse") - self.assertEqual(inst.performerType.text, "Nurse") - self.assertEqual(inst.priority, "routine") - self.assertEqual(inst.reasonCode[0].text, "gastroparesis") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.status, "generated") - - def testDeviceRequest2(self): - inst = self.instantiate_from("devicerequest-example.json") - self.assertIsNotNone(inst, "Must have instantiated a DeviceRequest instance") - self.implDeviceRequest2(inst) - - js = inst.as_json() - self.assertEqual("DeviceRequest", js["resourceType"]) - inst2 = devicerequest.DeviceRequest(js) - self.implDeviceRequest2(inst2) - - def implDeviceRequest2(self, inst): - self.assertEqual(inst.id, "example") - 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 deleted file mode 100644 index d0de8a817..000000000 --- a/fhirclient/models/deviceusestatement.py +++ /dev/null @@ -1,139 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/DeviceUseStatement) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class DeviceUseStatement(domainresource.DomainResource): - """ Record of use of a device. - - A record of a device being used by a patient where the record is the result - of a report from the patient or another clinician. - """ - - resource_type = "DeviceUseStatement" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :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` (represented as `dict` in JSON). """ - - self.identifier = None - """ External identifier for this record. - List of `Identifier` 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` (represented as `dict` in JSON). """ - - self.status = None - """ active | completed | entered-in-error +. - Type `str`. """ - - self.subject = None - """ Patient using device. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.timingDateTime = None - """ How often the device was used. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.timingPeriod = None - """ How often the device was used. - Type `Period` (represented as `dict` in JSON). """ - - self.timingTiming = None - """ How often the device was used. - Type `Timing` (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), - ("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), - ("subject", "subject", fhirreference.FHIRReference, False, None, True), - ("timingDateTime", "timingDateTime", fhirdate.FHIRDate, False, "timing", False), - ("timingPeriod", "timingPeriod", period.Period, False, "timing", False), - ("timingTiming", "timingTiming", timing.Timing, False, "timing", 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'] -try: - from . import timing -except ImportError: - timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/deviceusestatement_tests.py b/fhirclient/models/deviceusestatement_tests.py deleted file mode 100644 index ecbfaae72..000000000 --- a/fhirclient/models/deviceusestatement_tests.py +++ /dev/null @@ -1,43 +0,0 @@ -#!/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 deviceusestatement -from .fhirdate import FHIRDate - - -class DeviceUseStatementTests(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("DeviceUseStatement", js["resourceType"]) - return deviceusestatement.DeviceUseStatement(js) - - def testDeviceUseStatement1(self): - inst = self.instantiate_from("deviceusestatement-example.json") - self.assertIsNotNone(inst, "Must have instantiated a DeviceUseStatement instance") - self.implDeviceUseStatement1(inst) - - js = inst.as_json() - self.assertEqual("DeviceUseStatement", js["resourceType"]) - inst2 = deviceusestatement.DeviceUseStatement(js) - self.implDeviceUseStatement1(inst2) - - 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 deleted file mode 100644 index 707c80620..000000000 --- a/fhirclient/models/diagnosticreport.py +++ /dev/null @@ -1,199 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/DiagnosticReport) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class DiagnosticReport(domainresource.DomainResource): - """ A Diagnostic report - a combination of request information, atomic results, - images, interpretation, as well as formatted reports. - - The findings and interpretation of diagnostic tests performed on patients, - groups of patients, devices, and locations, and/or specimens derived from - these. The report includes clinical context such as requesting and provider - information, and some mix of atomic results, images, textual and coded - interpretations, and formatted representation of diagnostic reports. - """ - - resource_type = "DiagnosticReport" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.basedOn = None - """ What was requested. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.category = None - """ Service category. - 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.conclusion = None - """ Clinical conclusion (interpretation) of test results. - Type `str`. """ - - 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. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.effectivePeriod = None - """ 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.imagingStudy = None - """ Reference to full details of imaging associated with the diagnostic - report. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.issued = None - """ 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 - """ 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. - 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 (represented as `dict` in JSON). """ - - self.status = None - """ registered | partial | preliminary | final +. - Type `str`. """ - - self.subject = None - """ The subject of the report - usually, but not always, the patient. - Type `FHIRReference` (represented as `dict` in JSON). """ - - super(DiagnosticReport, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(DiagnosticReport, self).elementProperties() - js.extend([ - ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), - ("category", "category", codeableconcept.CodeableConcept, True, None, False), - ("code", "code", codeableconcept.CodeableConcept, False, None, True), - ("conclusion", "conclusion", str, 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), - ("imagingStudy", "imagingStudy", fhirreference.FHIRReference, True, None, False), - ("issued", "issued", fhirdate.FHIRDate, False, 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), - ]) - return js - - -from . import backboneelement - -class DiagnosticReportMedia(backboneelement.BackboneElement): - """ Key images associated with this report. - - A list of key images associated with this report. The images are generally - created during the diagnostic process, and may be directly of the patient, - or of treated specimens (i.e. slides of interest). - """ - - resource_type = "DiagnosticReportMedia" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Comment about the image (e.g. explanation). - Type `str`. """ - - self.link = None - """ Reference to the image source. - Type `FHIRReference` (represented as `dict` in JSON). """ - - super(DiagnosticReportMedia, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(DiagnosticReportMedia, self).elementProperties() - js.extend([ - ("comment", "comment", str, False, None, False), - ("link", "link", fhirreference.FHIRReference, False, None, True), - ]) - 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 period -except ImportError: - period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/diagnosticreport_tests.py b/fhirclient/models/diagnosticreport_tests.py deleted file mode 100644 index d20113665..000000000 --- a/fhirclient/models/diagnosticreport_tests.py +++ /dev/null @@ -1,211 +0,0 @@ -#!/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 diagnosticreport -from .fhirdate import FHIRDate - - -class DiagnosticReportTests(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("DiagnosticReport", js["resourceType"]) - return diagnosticreport.DiagnosticReport(js) - - def testDiagnosticReport1(self): - inst = self.instantiate_from("diagnosticreport-example-ultrasound.json") - self.assertIsNotNone(inst, "Must have instantiated a DiagnosticReport instance") - self.implDiagnosticReport1(inst) - - js = inst.as_json() - self.assertEqual("DiagnosticReport", js["resourceType"]) - inst2 = diagnosticreport.DiagnosticReport(js) - self.implDiagnosticReport1(inst2) - - def implDiagnosticReport1(self, inst): - 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-f201-brainct.json") - self.assertIsNotNone(inst, "Must have instantiated a DiagnosticReport instance") - self.implDiagnosticReport2(inst) - - js = inst.as_json() - self.assertEqual("DiagnosticReport", js["resourceType"]) - inst2 = diagnosticreport.DiagnosticReport(js) - self.implDiagnosticReport2(inst2) - - def implDiagnosticReport2(self, inst): - 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.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 testDiagnosticReport3(self): - inst = self.instantiate_from("diagnosticreport-example-papsmear.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.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, "additional") - - def testDiagnosticReport4(self): - inst = self.instantiate_from("diagnosticreport-example-gingival-mass.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[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") - self.assertEqual(inst.code.text, "Biopsy without Microscopic Description (1 Site/Lesion)-Standard") - self.assertEqual(inst.effectiveDateTime.date, FHIRDate("2017-03-02").date) - self.assertEqual(inst.effectiveDateTime.as_json(), "2017-03-02") - self.assertEqual(inst.id, "gingival-mass") - self.assertEqual(inst.identifier[0].system, "https://www.acmeonline.com") - 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 testDiagnosticReport5(self): - inst = self.instantiate_from("diagnosticreport-example-pgx.json") - self.assertIsNotNone(inst, "Must have instantiated a DiagnosticReport instance") - self.implDiagnosticReport5(inst) - - js = inst.as_json() - self.assertEqual("DiagnosticReport", js["resourceType"]) - inst2 = diagnosticreport.DiagnosticReport(js) - self.implDiagnosticReport5(inst2) - - 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") - self.assertEqual(inst.code.text, "Pharmacogenetics Report") - self.assertEqual(inst.effectiveDateTime.date, FHIRDate("2016-10-15T12:34:56+11:00").date) - self.assertEqual(inst.effectiveDateTime.as_json(), "2016-10-15T12:34:56+11:00") - 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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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=") - self.assertEqual(inst.presentedForm[0].hash, "571ef9c5655840f324e679072ed62b1b95eef8a0") - self.assertEqual(inst.presentedForm[0].language, "en") - self.assertEqual(inst.presentedForm[0].title, "Pharmacogenetics Report") - self.assertEqual(inst.status, "final") - self.assertEqual(inst.text.status, "generated") - - def testDiagnosticReport6(self): - inst = self.instantiate_from("diagnosticreport-example-dxa.json") - self.assertIsNotNone(inst, "Must have instantiated a DiagnosticReport instance") - self.implDiagnosticReport6(inst) - - js = inst.as_json() - self.assertEqual("DiagnosticReport", js["resourceType"]) - inst2 = diagnosticreport.DiagnosticReport(js) - self.implDiagnosticReport6(inst2) - - 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 deleted file mode 100644 index 836da615f..000000000 --- a/fhirclient/models/distance.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Distance) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import quantity - -class Distance(quantity.Quantity): - """ A length - a value with a unit that is a physical distance. - """ - - resource_type = "Distance" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - super(Distance, self).__init__(jsondict=jsondict, strict=strict) - - diff --git a/fhirclient/models/documentmanifest.py b/fhirclient/models/documentmanifest.py deleted file mode 100644 index 2d25db3a8..000000000 --- a/fhirclient/models/documentmanifest.py +++ /dev/null @@ -1,149 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/DocumentManifest) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class DocumentManifest(domainresource.DomainResource): - """ A list that defines a set of documents. - - A collection of documents compiled for a purpose together with metadata - that applies to the collection. - """ - - resource_type = "DocumentManifest" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Who and/or what authored the DocumentManifest. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.content = None - """ Items in manifest. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.created = None - """ When this document manifest created. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.description = None - """ Human-readable description (title). - Type `str`. """ - - self.identifier = None - """ Other identifiers for the manifest. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.masterIdentifier = None - """ Unique Identifier for the set of documents. - Type `Identifier` (represented as `dict` in JSON). """ - - self.recipient = None - """ Intended to get notified about this set of documents. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.related = None - """ Related things. - List of `DocumentManifestRelated` items (represented as `dict` in JSON). """ - - self.source = None - """ The source system/application/software. - Type `str`. """ - - self.status = None - """ current | superseded | entered-in-error. - Type `str`. """ - - self.subject = None - """ The subject of the set of documents. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.type = None - """ Kind of document set. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(DocumentManifest, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(DocumentManifest, self).elementProperties() - js.extend([ - ("author", "author", fhirreference.FHIRReference, True, None, False), - ("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), - ("masterIdentifier", "masterIdentifier", identifier.Identifier, False, None, False), - ("recipient", "recipient", fhirreference.FHIRReference, True, None, False), - ("related", "related", DocumentManifestRelated, True, None, False), - ("source", "source", str, False, None, False), - ("status", "status", str, False, None, True), - ("subject", "subject", fhirreference.FHIRReference, False, None, False), - ("type", "type", codeableconcept.CodeableConcept, False, None, False), - ]) - return js - - -from . import backboneelement - -class DocumentManifestRelated(backboneelement.BackboneElement): - """ Related things. - - Related identifiers or resources associated with the DocumentManifest. - """ - - resource_type = "DocumentManifestRelated" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Identifiers of things that are related. - Type `Identifier` (represented as `dict` in JSON). """ - - self.ref = None - """ Related Resource. - Type `FHIRReference` (represented as `dict` in JSON). """ - - super(DocumentManifestRelated, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(DocumentManifestRelated, self).elementProperties() - js.extend([ - ("identifier", "identifier", identifier.Identifier, False, None, False), - ("ref", "ref", fhirreference.FHIRReference, 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/documentmanifest_tests.py b/fhirclient/models/documentmanifest_tests.py deleted file mode 100644 index 4d2328960..000000000 --- a/fhirclient/models/documentmanifest_tests.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/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 documentmanifest -from .fhirdate import FHIRDate - - -class DocumentManifestTests(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("DocumentManifest", js["resourceType"]) - return documentmanifest.DocumentManifest(js) - - def testDocumentManifest1(self): - inst = self.instantiate_from("documentmanifest-example.json") - self.assertIsNotNone(inst, "Must have instantiated a DocumentManifest instance") - self.implDocumentManifest1(inst) - - js = inst.as_json() - self.assertEqual("DocumentManifest", js["resourceType"]) - inst2 = documentmanifest.DocumentManifest(js) - self.implDocumentManifest1(inst2) - - def implDocumentManifest1(self, inst): - self.assertEqual(inst.contained[0].id, "a1") - self.assertEqual(inst.created.date, FHIRDate("2004-12-25T23:50:50-05:00").date) - self.assertEqual(inst.created.as_json(), "2004-12-25T23:50:50-05:00") - self.assertEqual(inst.description, "Physical") - self.assertEqual(inst.id, "example") - self.assertEqual(inst.identifier[0].system, "http://example.org/documents") - 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") - self.assertEqual(inst.status, "current") - self.assertEqual(inst.text.div, "
Text
") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.text, "History and Physical") - diff --git a/fhirclient/models/documentreference.py b/fhirclient/models/documentreference.py deleted file mode 100644 index 219e47c89..000000000 --- a/fhirclient/models/documentreference.py +++ /dev/null @@ -1,282 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# 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" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.authenticator = None - """ Who/what authenticated the document. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.author = None - """ Who and/or what authored the document. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.category = None - """ Categorization of document. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.content = None - """ Document referenced. - List of `DocumentReferenceContent` items (represented as `dict` in JSON). """ - - self.context = None - """ Clinical context of document. - Type `DocumentReferenceContext` (represented as `dict` in JSON). """ - - self.custodian = None - """ Organization which maintains the document. - 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. - Type `str`. """ - - self.docStatus = None - """ preliminary | final | appended | amended | entered-in-error. - Type `str`. """ - - self.identifier = None - """ Other identifiers for the document. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.masterIdentifier = None - """ Master Version Specific Identifier. - Type `Identifier` (represented as `dict` in JSON). """ - - self.relatesTo = None - """ Relationships to other documents. - List of `DocumentReferenceRelatesTo` items (represented as `dict` in JSON). """ - - self.securityLabel = None - """ Document security-tags. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.status = None - """ current | superseded | entered-in-error. - Type `str`. """ - - self.subject = None - """ Who/what is the subject of the document. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.type = None - """ Kind of document (LOINC if possible). - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(DocumentReference, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(DocumentReference, self).elementProperties() - js.extend([ - ("authenticator", "authenticator", fhirreference.FHIRReference, False, None, False), - ("author", "author", fhirreference.FHIRReference, True, None, False), - ("category", "category", codeableconcept.CodeableConcept, True, None, False), - ("content", "content", DocumentReferenceContent, True, None, True), - ("context", "context", DocumentReferenceContext, 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), - ("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, False), - ]) - return js - - -from . import backboneelement - -class DocumentReferenceContent(backboneelement.BackboneElement): - """ Document referenced. - - The document and format referenced. There may be multiple content element - repetitions, each with a different format. - """ - - resource_type = "DocumentReferenceContent" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Where to access the document. - Type `Attachment` (represented as `dict` in JSON). """ - - self.format = None - """ Format/content rules for the document. - Type `Coding` (represented as `dict` in JSON). """ - - super(DocumentReferenceContent, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(DocumentReferenceContent, self).elementProperties() - js.extend([ - ("attachment", "attachment", attachment.Attachment, False, None, True), - ("format", "format", coding.Coding, False, None, False), - ]) - return js - - -class DocumentReferenceContext(backboneelement.BackboneElement): - """ Clinical context of document. - - The clinical context in which the document was prepared. - """ - - resource_type = "DocumentReferenceContext" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.encounter = None - """ Context of the document content. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.event = None - """ Main clinical acts documented. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.facilityType = None - """ Kind of facility where patient was seen. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.period = None - """ Time of service that is being documented. - Type `Period` (represented as `dict` in JSON). """ - - self.practiceSetting = None - """ Additional details about where the content was created (e.g. - clinical specialty). - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.related = None - """ Related identifiers or resources. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.sourcePatientInfo = None - """ Patient demographics from source. - 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, 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", fhirreference.FHIRReference, True, None, False), - ("sourcePatientInfo", "sourcePatientInfo", fhirreference.FHIRReference, False, None, False), - ]) - return js - - -class DocumentReferenceRelatesTo(backboneelement.BackboneElement): - """ Relationships to other documents. - - Relationships that this document has with other document references that - already exist. - """ - - resource_type = "DocumentReferenceRelatesTo" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ replaces | transforms | signs | appends. - Type `str`. """ - - self.target = None - """ Target of the relationship. - Type `FHIRReference` (represented as `dict` in JSON). """ - - super(DocumentReferenceRelatesTo, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(DocumentReferenceRelatesTo, self).elementProperties() - js.extend([ - ("code", "code", str, False, None, True), - ("target", "target", fhirreference.FHIRReference, False, None, True), - ]) - 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 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 period -except ImportError: - period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/documentreference_tests.py b/fhirclient/models/documentreference_tests.py deleted file mode 100644 index bb394fb85..000000000 --- a/fhirclient/models/documentreference_tests.py +++ /dev/null @@ -1,84 +0,0 @@ -#!/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 documentreference -from .fhirdate import FHIRDate - - -class DocumentReferenceTests(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("DocumentReference", js["resourceType"]) - return documentreference.DocumentReference(js) - - def testDocumentReference1(self): - inst = self.instantiate_from("documentreference-example.json") - self.assertIsNotNone(inst, "Must have instantiated a DocumentReference instance") - self.implDocumentReference1(inst) - - js = inst.as_json() - self.assertEqual("DocumentReference", js["resourceType"]) - inst2 = documentreference.DocumentReference(js) - self.implDocumentReference1(inst2) - - def implDocumentReference1(self, inst): - 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") - self.assertEqual(inst.content[0].format.system, "urn:oid:1.3.6.1.4.1.19376.1.2.3") - self.assertEqual(inst.context.event[0].coding[0].code, "T-D8200") - self.assertEqual(inst.context.event[0].coding[0].display, "Arm") - self.assertEqual(inst.context.event[0].coding[0].system, "http://ihe.net/xds/connectathon/eventCodes") - self.assertEqual(inst.context.facilityType.coding[0].code, "Outpatient") - self.assertEqual(inst.context.facilityType.coding[0].display, "Outpatient") - self.assertEqual(inst.context.facilityType.coding[0].system, "http://www.ihe.net/xds/connectathon/healthcareFacilityTypeCodes") - self.assertEqual(inst.context.period.end.date, FHIRDate("2004-12-23T08:01:00+11:00").date) - self.assertEqual(inst.context.period.end.as_json(), "2004-12-23T08:01:00+11:00") - self.assertEqual(inst.context.period.start.date, FHIRDate("2004-12-23T08:00:00+11:00").date) - self.assertEqual(inst.context.period.start.as_json(), "2004-12-23T08:00:00+11:00") - 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.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.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://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") - self.assertEqual(inst.type.coding[0].display, "Outpatient Note") - self.assertEqual(inst.type.coding[0].system, "http://loinc.org") - diff --git a/fhirclient/models/domainresource.py b/fhirclient/models/domainresource.py deleted file mode 100644 index 2bc2b458a..000000000 --- a/fhirclient/models/domainresource.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/DomainResource) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import resource - -class DomainResource(resource.Resource): - """ A resource with narrative, extensions, and contained resources. - - A resource that includes narrative, extensions, and contained resources. - """ - - resource_type = "DomainResource" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.contained = None - """ Contained, inline Resources. - List of `Resource` items (represented as `dict` in JSON). """ - - self.extension = None - """ Additional content defined by implementations. - List of `Extension` items (represented as `dict` in JSON). """ - - self.modifierExtension = None - """ Extensions that cannot be ignored. - List of `Extension` items (represented as `dict` in JSON). """ - - self.text = None - """ Text summary of the resource, for human interpretation. - Type `Narrative` (represented as `dict` in JSON). """ - - super(DomainResource, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(DomainResource, self).elementProperties() - js.extend([ - ("contained", "contained", resource.Resource, True, None, False), - ("extension", "extension", extension.Extension, True, None, False), - ("modifierExtension", "modifierExtension", extension.Extension, True, None, False), - ("text", "text", narrative.Narrative, False, None, False), - ]) - return js - - -import sys -try: - from . import extension -except ImportError: - extension = sys.modules[__package__ + '.extension'] -try: - from . import narrative -except ImportError: - narrative = sys.modules[__package__ + '.narrative'] diff --git a/fhirclient/models/dosage.py b/fhirclient/models/dosage.py deleted file mode 100644 index fdb546e6d..000000000 --- a/fhirclient/models/dosage.py +++ /dev/null @@ -1,184 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Dosage) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import backboneelement - -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 - patient. - """ - - resource_type = "Dosage" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.additionalInstruction = None - """ 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 - """ Take "as needed" (for x). - Type `bool`. """ - - self.asNeededCodeableConcept = None - """ Take "as needed" (for x). - Type `CodeableConcept` (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. - Type `Quantity` (represented as `dict` in JSON). """ - - self.maxDosePerLifetime = None - """ Upper limit on medication per lifetime of the patient. - Type `Quantity` (represented as `dict` in JSON). """ - - self.maxDosePerPeriod = None - """ Upper limit on medication per unit of time. - Type `Ratio` (represented as `dict` in JSON). """ - - self.method = None - """ Technique for administering medication. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.patientInstruction = None - """ Patient or consumer oriented instructions. - Type `str`. """ - - self.route = None - """ How drug should enter body. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.sequence = None - """ The order of the dosage instructions. - Type `int`. """ - - self.site = None - """ Body site to administer to. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.text = None - """ Free text dosage instructions e.g. SIG. - Type `str`. """ - - self.timing = None - """ When medication should be administered. - Type `Timing` (represented as `dict` in JSON). """ - - super(Dosage, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Dosage, self).elementProperties() - js.extend([ - ("additionalInstruction", "additionalInstruction", codeableconcept.CodeableConcept, True, None, False), - ("asNeededBoolean", "asNeededBoolean", bool, False, "asNeeded", False), - ("asNeededCodeableConcept", "asNeededCodeableConcept", codeableconcept.CodeableConcept, False, "asNeeded", 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), - ("route", "route", codeableconcept.CodeableConcept, False, None, False), - ("sequence", "sequence", int, False, None, False), - ("site", "site", codeableconcept.CodeableConcept, False, None, False), - ("text", "text", str, False, None, False), - ("timing", "timing", timing.Timing, False, None, False), - ]) - 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 -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'] -try: - from . import ratio -except ImportError: - ratio = sys.modules[__package__ + '.ratio'] -try: - from . import timing -except ImportError: - timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/duration.py b/fhirclient/models/duration.py deleted file mode 100644 index 922e777fd..000000000 --- a/fhirclient/models/duration.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Duration) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import quantity - -class Duration(quantity.Quantity): - """ A length of time. - """ - - resource_type = "Duration" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - super(Duration, self).__init__(jsondict=jsondict, strict=strict) - - diff --git a/fhirclient/models/element.py b/fhirclient/models/element.py deleted file mode 100644 index 812aa22bd..000000000 --- a/fhirclient/models/element.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Element) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import fhirabstractbase - -class Element(fhirabstractbase.FHIRAbstractBase): - """ Base for all elements. - - Base definition for all elements in a resource. - """ - - resource_type = "Element" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.extension = None - """ Additional content defined by implementations. - List of `Extension` items (represented as `dict` in JSON). """ - - self.id = None - """ Unique id for inter-element referencing. - Type `str`. """ - - super(Element, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Element, self).elementProperties() - from . import extension - js.extend([ - ("extension", "extension", extension.Extension, True, None, False), - ("id", "id", str, False, None, False), - ]) - return js - - diff --git a/fhirclient/models/elementdefinition.py b/fhirclient/models/elementdefinition.py deleted file mode 100644 index 5c1ae4cf9..000000000 --- a/fhirclient/models/elementdefinition.py +++ /dev/null @@ -1,1746 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ElementDefinition) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import backboneelement - -class ElementDefinition(backboneelement.BackboneElement): - """ Definition of an element in a resource or extension. - - Captures constraints on each element within the resource, profile, or - extension. - """ - - resource_type = "ElementDefinition" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.alias = None - """ Other names. - List of `str` items. """ - - self.base = None - """ Base definition information for tools. - Type `ElementDefinitionBase` (represented as `dict` in JSON). """ - - self.binding = None - """ ValueSet details if this is coded. - Type `ElementDefinitionBinding` (represented as `dict` in JSON). """ - - self.code = None - """ Corresponding codes in terminologies. - List of `Coding` items (represented as `dict` in JSON). """ - - self.comment = None - """ Comments about the use of this element. - Type `str`. """ - - self.condition = None - """ Reference to invariant about presence. - List of `str` items. """ - - self.constraint = None - """ Condition that must evaluate to true. - List of `ElementDefinitionConstraint` items (represented as `dict` in JSON). """ - - self.contentReference = None - """ Reference to definition of content for the element. - Type `str`. """ - - self.defaultValueAddress = None - """ Specified value if missing from instance. - Type `Address` (represented as `dict` in JSON). """ - - self.defaultValueAge = None - """ Specified value if missing from instance. - Type `Age` (represented as `dict` in JSON). """ - - self.defaultValueAnnotation = None - """ Specified value if missing from instance. - Type `Annotation` (represented as `dict` in JSON). """ - - self.defaultValueAttachment = None - """ Specified value if missing from instance. - Type `Attachment` (represented as `dict` in JSON). """ - - self.defaultValueBase64Binary = None - """ Specified value if missing from instance. - Type `str`. """ - - self.defaultValueBoolean = None - """ 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`. """ - - self.defaultValueCodeableConcept = None - """ Specified value if missing from instance. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.defaultValueCoding = None - """ 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). """ - - self.defaultValueDateTime = None - """ Specified value if missing from instance. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.defaultValueDecimal = None - """ Specified value if missing from instance. - Type `float`. """ - - self.defaultValueDistance = None - """ 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). """ - - self.defaultValueId = None - """ Specified value if missing from instance. - Type `str`. """ - - self.defaultValueIdentifier = None - """ Specified value if missing from instance. - Type `Identifier` (represented as `dict` in JSON). """ - - self.defaultValueInstant = None - """ Specified value if missing from instance. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.defaultValueInteger = None - """ Specified value if missing from instance. - Type `int`. """ - - self.defaultValueMarkdown = None - """ Specified value if missing from instance. - Type `str`. """ - - self.defaultValueMoney = None - """ Specified value if missing from instance. - Type `Money` (represented as `dict` in JSON). """ - - self.defaultValueOid = None - """ 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). """ - - self.defaultValuePositiveInt = None - """ Specified value if missing from instance. - Type `int`. """ - - self.defaultValueQuantity = None - """ Specified value if missing from instance. - Type `Quantity` (represented as `dict` in JSON). """ - - self.defaultValueRange = None - """ Specified value if missing from instance. - Type `Range` (represented as `dict` in JSON). """ - - self.defaultValueRatio = None - """ Specified value if missing from instance. - Type `Ratio` (represented as `dict` in JSON). """ - - self.defaultValueReference = None - """ 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). """ - - self.defaultValueSignature = None - """ Specified value if missing from instance. - Type `Signature` (represented as `dict` in JSON). """ - - self.defaultValueString = None - """ Specified value if missing from instance. - Type `str`. """ - - self.defaultValueTime = None - """ Specified value if missing from instance. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.defaultValueTiming = None - """ 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`. """ - - self.defaultValueUri = None - """ 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`. """ - - self.example = None - """ Example value (as defined for type). - List of `ElementDefinitionExample` items (represented as `dict` in JSON). """ - - self.fixedAddress = None - """ Value must be exactly this. - Type `Address` (represented as `dict` in JSON). """ - - self.fixedAge = None - """ Value must be exactly this. - Type `Age` (represented as `dict` in JSON). """ - - self.fixedAnnotation = None - """ Value must be exactly this. - Type `Annotation` (represented as `dict` in JSON). """ - - self.fixedAttachment = None - """ Value must be exactly this. - Type `Attachment` (represented as `dict` in JSON). """ - - self.fixedBase64Binary = None - """ Value must be exactly this. - Type `str`. """ - - self.fixedBoolean = None - """ 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`. """ - - self.fixedCodeableConcept = None - """ Value must be exactly this. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.fixedCoding = None - """ 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). """ - - self.fixedDateTime = None - """ Value must be exactly this. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.fixedDecimal = None - """ Value must be exactly this. - Type `float`. """ - - self.fixedDistance = None - """ 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). """ - - self.fixedId = None - """ Value must be exactly this. - Type `str`. """ - - self.fixedIdentifier = None - """ Value must be exactly this. - Type `Identifier` (represented as `dict` in JSON). """ - - self.fixedInstant = None - """ Value must be exactly this. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.fixedInteger = None - """ Value must be exactly this. - Type `int`. """ - - self.fixedMarkdown = None - """ Value must be exactly this. - Type `str`. """ - - self.fixedMoney = None - """ Value must be exactly this. - Type `Money` (represented as `dict` in JSON). """ - - self.fixedOid = None - """ 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). """ - - self.fixedPositiveInt = None - """ Value must be exactly this. - Type `int`. """ - - self.fixedQuantity = None - """ Value must be exactly this. - Type `Quantity` (represented as `dict` in JSON). """ - - self.fixedRange = None - """ Value must be exactly this. - Type `Range` (represented as `dict` in JSON). """ - - self.fixedRatio = None - """ Value must be exactly this. - Type `Ratio` (represented as `dict` in JSON). """ - - self.fixedReference = None - """ 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). """ - - self.fixedSignature = None - """ Value must be exactly this. - Type `Signature` (represented as `dict` in JSON). """ - - self.fixedString = None - """ Value must be exactly this. - Type `str`. """ - - self.fixedTime = None - """ Value must be exactly this. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.fixedTiming = None - """ 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`. """ - - self.fixedUri = None - """ 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`. """ - - self.label = None - """ Name for element to display with or prompt for element. - Type `str`. """ - - self.mapping = None - """ Map element to another set of definitions. - List of `ElementDefinitionMapping` items (represented as `dict` in JSON). """ - - self.max = None - """ Maximum Cardinality (a number or *). - Type `str`. """ - - self.maxLength = None - """ Max length for strings. - Type `int`. """ - - self.maxValueDate = None - """ Maximum Allowed Value (for some types). - Type `FHIRDate` (represented as `str` in JSON). """ - - self.maxValueDateTime = None - """ Maximum Allowed Value (for some types). - Type `FHIRDate` (represented as `str` in JSON). """ - - self.maxValueDecimal = None - """ Maximum Allowed Value (for some types). - Type `float`. """ - - self.maxValueInstant = None - """ Maximum Allowed Value (for some types). - Type `FHIRDate` (represented as `str` in JSON). """ - - self.maxValueInteger = None - """ Maximum Allowed Value (for some types). - Type `int`. """ - - self.maxValuePositiveInt = None - """ Maximum Allowed Value (for some types). - Type `int`. """ - - self.maxValueQuantity = None - """ Maximum Allowed Value (for some types). - Type `Quantity` (represented as `dict` in JSON). """ - - self.maxValueTime = None - """ Maximum Allowed Value (for some types). - Type `FHIRDate` (represented as `str` in JSON). """ - - self.maxValueUnsignedInt = None - """ Maximum Allowed Value (for some types). - Type `int`. """ - - self.meaningWhenMissing = None - """ Implicit meaning when this element is missing. - Type `str`. """ - - self.min = None - """ Minimum Cardinality. - Type `int`. """ - - self.minValueDate = None - """ Minimum Allowed Value (for some types). - Type `FHIRDate` (represented as `str` in JSON). """ - - self.minValueDateTime = None - """ Minimum Allowed Value (for some types). - Type `FHIRDate` (represented as `str` in JSON). """ - - self.minValueDecimal = None - """ Minimum Allowed Value (for some types). - Type `float`. """ - - self.minValueInstant = None - """ Minimum Allowed Value (for some types). - Type `FHIRDate` (represented as `str` in JSON). """ - - self.minValueInteger = None - """ Minimum Allowed Value (for some types). - Type `int`. """ - - self.minValuePositiveInt = None - """ Minimum Allowed Value (for some types). - Type `int`. """ - - self.minValueQuantity = None - """ Minimum Allowed Value (for some types). - Type `Quantity` (represented as `dict` in JSON). """ - - self.minValueTime = None - """ Minimum Allowed Value (for some types). - Type `FHIRDate` (represented as `str` in JSON). """ - - self.minValueUnsignedInt = None - """ Minimum Allowed Value (for some types). - Type `int`. """ - - self.mustSupport = None - """ If the element must be supported. - Type `bool`. """ - - self.orderMeaning = None - """ What the order of the elements means. - Type `str`. """ - - self.path = None - """ Path of the element in the hierarchy of elements. - Type `str`. """ - - self.patternAddress = None - """ Value must have at least these property values. - Type `Address` (represented as `dict` in JSON). """ - - self.patternAge = None - """ Value must have at least these property values. - Type `Age` (represented as `dict` in JSON). """ - - self.patternAnnotation = None - """ Value must have at least these property values. - Type `Annotation` (represented as `dict` in JSON). """ - - self.patternAttachment = None - """ Value must have at least these property values. - Type `Attachment` (represented as `dict` in JSON). """ - - self.patternBase64Binary = None - """ Value must have at least these property values. - Type `str`. """ - - self.patternBoolean = None - """ 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`. """ - - self.patternCodeableConcept = None - """ Value must have at least these property values. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.patternCoding = None - """ 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). """ - - self.patternDateTime = None - """ Value must have at least these property values. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.patternDecimal = None - """ Value must have at least these property values. - Type `float`. """ - - self.patternDistance = None - """ 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). """ - - self.patternId = None - """ Value must have at least these property values. - Type `str`. """ - - self.patternIdentifier = None - """ Value must have at least these property values. - Type `Identifier` (represented as `dict` in JSON). """ - - self.patternInstant = None - """ Value must have at least these property values. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.patternInteger = None - """ Value must have at least these property values. - Type `int`. """ - - self.patternMarkdown = None - """ Value must have at least these property values. - Type `str`. """ - - self.patternMoney = None - """ Value must have at least these property values. - Type `Money` (represented as `dict` in JSON). """ - - self.patternOid = None - """ 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). """ - - self.patternPositiveInt = None - """ Value must have at least these property values. - Type `int`. """ - - self.patternQuantity = None - """ Value must have at least these property values. - Type `Quantity` (represented as `dict` in JSON). """ - - self.patternRange = None - """ Value must have at least these property values. - Type `Range` (represented as `dict` in JSON). """ - - self.patternRatio = None - """ Value must have at least these property values. - Type `Ratio` (represented as `dict` in JSON). """ - - self.patternReference = None - """ 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). """ - - self.patternSignature = None - """ Value must have at least these property values. - Type `Signature` (represented as `dict` in JSON). """ - - self.patternString = None - """ Value must have at least these property values. - Type `str`. """ - - self.patternTime = None - """ Value must have at least these property values. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.patternTiming = None - """ 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`. """ - - self.patternUri = None - """ 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. """ - - self.requirements = None - """ Why this resource has been created. - Type `str`. """ - - self.short = None - """ 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`. """ - - self.slicing = None - """ This element is sliced - slices follow. - Type `ElementDefinitionSlicing` (represented as `dict` in JSON). """ - - self.type = None - """ Data type and Profile for this element. - List of `ElementDefinitionType` items (represented as `dict` in JSON). """ - - super(ElementDefinition, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ElementDefinition, self).elementProperties() - js.extend([ - ("alias", "alias", str, True, None, False), - ("base", "base", ElementDefinitionBase, False, None, False), - ("binding", "binding", ElementDefinitionBinding, False, None, False), - ("code", "code", coding.Coding, True, None, False), - ("comment", "comment", str, False, None, False), - ("condition", "condition", str, True, None, False), - ("constraint", "constraint", ElementDefinitionConstraint, True, None, False), - ("contentReference", "contentReference", str, False, None, False), - ("defaultValueAddress", "defaultValueAddress", address.Address, False, "defaultValue", False), - ("defaultValueAge", "defaultValueAge", age.Age, False, "defaultValue", False), - ("defaultValueAnnotation", "defaultValueAnnotation", annotation.Annotation, False, "defaultValue", False), - ("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), - ("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), - ("fixedAge", "fixedAge", age.Age, False, "fixed", False), - ("fixedAnnotation", "fixedAnnotation", annotation.Annotation, False, "fixed", False), - ("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), - ("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), - ("max", "max", str, False, None, False), - ("maxLength", "maxLength", int, False, None, False), - ("maxValueDate", "maxValueDate", fhirdate.FHIRDate, False, "maxValue", False), - ("maxValueDateTime", "maxValueDateTime", fhirdate.FHIRDate, False, "maxValue", False), - ("maxValueDecimal", "maxValueDecimal", float, False, "maxValue", False), - ("maxValueInstant", "maxValueInstant", fhirdate.FHIRDate, False, "maxValue", False), - ("maxValueInteger", "maxValueInteger", int, False, "maxValue", False), - ("maxValuePositiveInt", "maxValuePositiveInt", int, False, "maxValue", False), - ("maxValueQuantity", "maxValueQuantity", quantity.Quantity, False, "maxValue", False), - ("maxValueTime", "maxValueTime", fhirdate.FHIRDate, False, "maxValue", False), - ("maxValueUnsignedInt", "maxValueUnsignedInt", int, False, "maxValue", False), - ("meaningWhenMissing", "meaningWhenMissing", str, False, None, False), - ("min", "min", int, False, None, False), - ("minValueDate", "minValueDate", fhirdate.FHIRDate, False, "minValue", False), - ("minValueDateTime", "minValueDateTime", fhirdate.FHIRDate, False, "minValue", False), - ("minValueDecimal", "minValueDecimal", float, False, "minValue", False), - ("minValueInstant", "minValueInstant", fhirdate.FHIRDate, False, "minValue", False), - ("minValueInteger", "minValueInteger", int, False, "minValue", False), - ("minValuePositiveInt", "minValuePositiveInt", int, False, "minValue", False), - ("minValueQuantity", "minValueQuantity", quantity.Quantity, False, "minValue", False), - ("minValueTime", "minValueTime", fhirdate.FHIRDate, False, "minValue", False), - ("minValueUnsignedInt", "minValueUnsignedInt", int, False, "minValue", False), - ("mustSupport", "mustSupport", bool, False, None, False), - ("orderMeaning", "orderMeaning", str, False, None, False), - ("path", "path", str, False, None, True), - ("patternAddress", "patternAddress", address.Address, False, "pattern", False), - ("patternAge", "patternAge", age.Age, False, "pattern", False), - ("patternAnnotation", "patternAnnotation", annotation.Annotation, False, "pattern", False), - ("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), - ("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), - ]) - 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. 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" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.max = None - """ Max cardinality of the base element. - Type `str`. """ - - self.min = None - """ Min cardinality of the base element. - Type `int`. """ - - self.path = None - """ Path that identifies the base element. - Type `str`. """ - - super(ElementDefinitionBase, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ElementDefinitionBase, self).elementProperties() - js.extend([ - ("max", "max", str, False, None, True), - ("min", "min", int, False, None, True), - ("path", "path", str, False, None, True), - ]) - return js - - -class ElementDefinitionBinding(element.Element): - """ ValueSet details if this is coded. - - Binds to a value set if this element is coded (code, Coding, - CodeableConcept, Quantity), or the data types (string, uri). - """ - - resource_type = "ElementDefinitionBinding" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Human explanation of the value set. - Type `str`. """ - - self.strength = None - """ required | extensible | preferred | example. - Type `str`. """ - - self.valueSet = None - """ Source of value set. - Type `str`. """ - - super(ElementDefinitionBinding, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ElementDefinitionBinding, self).elementProperties() - js.extend([ - ("description", "description", str, False, None, False), - ("strength", "strength", str, False, None, True), - ("valueSet", "valueSet", str, False, None, False), - ]) - return js - - -class ElementDefinitionConstraint(element.Element): - """ Condition that must evaluate to true. - - Formal constraints such as co-occurrence and other constraints that can be - computationally evaluated within the context of the instance. - """ - - resource_type = "ElementDefinitionConstraint" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ FHIRPath expression of constraint. - Type `str`. """ - - self.human = None - """ Human description of constraint. - Type `str`. """ - - self.key = None - """ Target of 'condition' reference above. - Type `str`. """ - - self.requirements = None - """ Why this constraint is necessary or appropriate. - Type `str`. """ - - self.severity = None - """ error | warning. - Type `str`. """ - - self.source = None - """ Reference to original source of constraint. - Type `str`. """ - - self.xpath = None - """ XPath expression of constraint. - Type `str`. """ - - super(ElementDefinitionConstraint, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ElementDefinitionConstraint, self).elementProperties() - js.extend([ - ("expression", "expression", str, False, None, False), - ("human", "human", str, False, None, True), - ("key", "key", str, False, None, True), - ("requirements", "requirements", str, False, None, False), - ("severity", "severity", str, False, None, True), - ("source", "source", str, False, None, False), - ("xpath", "xpath", str, False, None, False), - ]) - return js - - -class ElementDefinitionExample(element.Element): - """ Example value (as defined for type). - - A sample value for this element demonstrating the type of information that - would typically be found in the element. - """ - - resource_type = "ElementDefinitionExample" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.label = None - """ Describes the purpose of this example. - Type `str`. """ - - self.valueAddress = None - """ Value of Example (one of allowed types). - Type `Address` (represented as `dict` in JSON). """ - - self.valueAge = None - """ Value of Example (one of allowed types). - Type `Age` (represented as `dict` in JSON). """ - - self.valueAnnotation = None - """ Value of Example (one of allowed types). - Type `Annotation` (represented as `dict` in JSON). """ - - self.valueAttachment = None - """ Value of Example (one of allowed types). - Type `Attachment` (represented as `dict` in JSON). """ - - self.valueBase64Binary = None - """ Value of Example (one of allowed types). - Type `str`. """ - - self.valueBoolean = None - """ 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`. """ - - self.valueCodeableConcept = None - """ Value of Example (one of allowed types). - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.valueCoding = None - """ 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). """ - - self.valueDateTime = None - """ Value of Example (one of allowed types). - Type `FHIRDate` (represented as `str` in JSON). """ - - self.valueDecimal = None - """ Value of Example (one of allowed types). - Type `float`. """ - - self.valueDistance = None - """ 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). """ - - self.valueId = None - """ Value of Example (one of allowed types). - Type `str`. """ - - self.valueIdentifier = None - """ Value of Example (one of allowed types). - Type `Identifier` (represented as `dict` in JSON). """ - - self.valueInstant = None - """ Value of Example (one of allowed types). - Type `FHIRDate` (represented as `str` in JSON). """ - - self.valueInteger = None - """ Value of Example (one of allowed types). - Type `int`. """ - - self.valueMarkdown = None - """ Value of Example (one of allowed types). - Type `str`. """ - - self.valueMoney = None - """ Value of Example (one of allowed types). - Type `Money` (represented as `dict` in JSON). """ - - self.valueOid = None - """ 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). """ - - self.valuePositiveInt = None - """ Value of Example (one of allowed types). - Type `int`. """ - - self.valueQuantity = None - """ Value of Example (one of allowed types). - Type `Quantity` (represented as `dict` in JSON). """ - - self.valueRange = None - """ Value of Example (one of allowed types). - Type `Range` (represented as `dict` in JSON). """ - - self.valueRatio = None - """ Value of Example (one of allowed types). - Type `Ratio` (represented as `dict` in JSON). """ - - self.valueReference = None - """ 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). """ - - self.valueSignature = None - """ Value of Example (one of allowed types). - Type `Signature` (represented as `dict` in JSON). """ - - self.valueString = None - """ Value of Example (one of allowed types). - Type `str`. """ - - self.valueTime = None - """ Value of Example (one of allowed types). - Type `FHIRDate` (represented as `str` in JSON). """ - - self.valueTiming = None - """ 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`. """ - - self.valueUri = None - """ 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): - js = super(ElementDefinitionExample, self).elementProperties() - js.extend([ - ("label", "label", str, False, None, True), - ("valueAddress", "valueAddress", address.Address, False, "value", True), - ("valueAge", "valueAge", age.Age, False, "value", True), - ("valueAnnotation", "valueAnnotation", annotation.Annotation, False, "value", True), - ("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), - ("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 - - -class ElementDefinitionMapping(element.Element): - """ Map element to another set of definitions. - - Identifies a concept from an external specification that roughly - corresponds to this element. - """ - - resource_type = "ElementDefinitionMapping" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Comments about the mapping or its use. - Type `str`. """ - - self.identity = None - """ Reference to mapping declaration. - Type `str`. """ - - self.language = None - """ Computable language of mapping. - Type `str`. """ - - self.map = None - """ Details of the mapping. - Type `str`. """ - - super(ElementDefinitionMapping, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ElementDefinitionMapping, self).elementProperties() - js.extend([ - ("comment", "comment", str, False, None, False), - ("identity", "identity", str, False, None, True), - ("language", "language", str, False, None, False), - ("map", "map", str, False, None, True), - ]) - return js - - -class ElementDefinitionSlicing(element.Element): - """ This element is sliced - slices follow. - - Indicates that the element is sliced into a set of alternative definitions - (i.e. in a structure definition, there are multiple different constraints - on a single element in the base resource). Slicing can be used in any - resource that has cardinality ..* on the base resource, or any resource - with a choice of types. The set of slices is any elements that come after - this in the element sequence that have the same path, until a shorter path - occurs (the shorter path terminates the set). - """ - - resource_type = "ElementDefinitionSlicing" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Text description of how slicing works (or not). - Type `str`. """ - - self.discriminator = None - """ Element values that are used to distinguish the slices. - List of `ElementDefinitionSlicingDiscriminator` items (represented as `dict` in JSON). """ - - self.ordered = None - """ If elements must be in same order as slices. - Type `bool`. """ - - self.rules = None - """ closed | open | openAtEnd. - Type `str`. """ - - super(ElementDefinitionSlicing, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ElementDefinitionSlicing, self).elementProperties() - js.extend([ - ("description", "description", str, False, None, False), - ("discriminator", "discriminator", ElementDefinitionSlicingDiscriminator, True, None, False), - ("ordered", "ordered", bool, False, None, False), - ("rules", "rules", str, False, None, True), - ]) - return js - - -class ElementDefinitionSlicingDiscriminator(element.Element): - """ Element values that are used to distinguish the slices. - - Designates which child elements are used to discriminate between the slices - when processing an instance. If one or more discriminators are provided, - the value of the child elements in the instance data SHALL completely - distinguish which slice the element in the resource matches based on the - allowed values for those elements in each of the slices. - """ - - resource_type = "ElementDefinitionSlicingDiscriminator" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.path = None - """ Path to element value. - Type `str`. """ - - self.type = None - """ value | exists | pattern | type | profile. - Type `str`. """ - - super(ElementDefinitionSlicingDiscriminator, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ElementDefinitionSlicingDiscriminator, self).elementProperties() - js.extend([ - ("path", "path", str, False, None, True), - ("type", "type", str, False, None, True), - ]) - return js - - -class ElementDefinitionType(element.Element): - """ Data type and Profile for this element. - - The data type or resource that the value of this element is permitted to - be. - """ - - resource_type = "ElementDefinitionType" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.aggregation = None - """ contained | referenced | bundled - how aggregated. - List of `str` items. """ - - self.code = None - """ Data type or Resource (reference to definition). - Type `str`. """ - - self.profile = None - """ Profiles (StructureDefinition or IG) - one must apply. - List of `str` items. """ - - self.targetProfile = None - """ Profile (StructureDefinition or IG) on the Reference/canonical - target - one must apply. - List of `str` items. """ - - self.versioning = None - """ either | independent | specific. - Type `str`. """ - - super(ElementDefinitionType, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ElementDefinitionType, self).elementProperties() - js.extend([ - ("aggregation", "aggregation", str, True, None, False), - ("code", "code", str, False, None, True), - ("profile", "profile", str, True, None, False), - ("targetProfile", "targetProfile", str, True, None, False), - ("versioning", "versioning", str, False, None, False), - ]) - return js - - -import sys -try: - from . import address -except ImportError: - address = sys.modules[__package__ + '.address'] -try: - from . import age -except ImportError: - age = sys.modules[__package__ + '.age'] -try: - from . import annotation -except ImportError: - annotation = sys.modules[__package__ + '.annotation'] -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 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: - fhirdate = sys.modules[__package__ + '.fhirdate'] -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 parameterdefinition -except ImportError: - parameterdefinition = sys.modules[__package__ + '.parameterdefinition'] -try: - 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 relatedartifact -except ImportError: - relatedartifact = sys.modules[__package__ + '.relatedartifact'] -try: - from . import sampleddata -except ImportError: - sampleddata = sys.modules[__package__ + '.sampleddata'] -try: - from . import signature -except ImportError: - signature = sys.modules[__package__ + '.signature'] -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/encounter.py b/fhirclient/models/encounter.py deleted file mode 100644 index 6c201d0ea..000000000 --- a/fhirclient/models/encounter.py +++ /dev/null @@ -1,454 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Encounter) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class Encounter(domainresource.DomainResource): - """ An interaction during which services are provided to the patient. - - An interaction between a patient and healthcare provider(s) for the purpose - of providing healthcare service(s) or assessing the health status of a - patient. - """ - - resource_type = "Encounter" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ The set of accounts that may be used for billing for this Encounter. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.appointment = None - """ The appointment that scheduled this encounter. - 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 - """ Classification of patient encounter. - Type `Coding` (represented as `dict` in JSON). """ - - self.diagnosis = None - """ The list of diagnosis relevant to this encounter. - List of `EncounterDiagnosis` items (represented as `dict` in JSON). """ - - self.episodeOfCare = None - """ Episode(s) of care that this encounter should be recorded against. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.hospitalization = None - """ Details about the admission to a healthcare service. - Type `EncounterHospitalization` (represented as `dict` in JSON). """ - - self.identifier = None - """ Identifier(s) by which this encounter is known. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.length = None - """ Quantity of time the encounter lasted (less time absent). - Type `Duration` (represented as `dict` in JSON). """ - - self.location = None - """ List of locations where the patient has been. - List of `EncounterLocation` items (represented as `dict` in JSON). """ - - self.partOf = None - """ Another Encounter this encounter is part of. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.participant = None - """ List of participants involved in the encounter. - List of `EncounterParticipant` items (represented as `dict` in JSON). """ - - self.period = None - """ The start and end time of the encounter. - Type `Period` (represented as `dict` in JSON). """ - - self.priority = None - """ Indicates the urgency of the encounter. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - 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 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 | - cancelled +. - Type `str`. """ - - self.statusHistory = None - """ List of past encounter statuses. - List of `EncounterStatusHistory` items (represented as `dict` in JSON). """ - - self.subject = None - """ The patient or group present at the encounter. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.type = None - """ Specific type of encounter. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - super(Encounter, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Encounter, self).elementProperties() - js.extend([ - ("account", "account", fhirreference.FHIRReference, True, 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, 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), - ("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), - ("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), - ("type", "type", codeableconcept.CodeableConcept, True, None, False), - ]) - return js - - -from . import backboneelement - -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 - 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" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ inpatient | outpatient | ambulatory | emergency +. - Type `Coding` (represented as `dict` in JSON). """ - - self.period = None - """ The time that the episode was in the specified class. - Type `Period` (represented as `dict` in JSON). """ - - super(EncounterClassHistory, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(EncounterClassHistory, self).elementProperties() - js.extend([ - ("class_fhir", "class", coding.Coding, False, None, True), - ("period", "period", period.Period, False, None, True), - ]) - return js - - -class EncounterDiagnosis(backboneelement.BackboneElement): - """ The list of diagnosis relevant to this encounter. - """ - - resource_type = "EncounterDiagnosis" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.condition = None - """ 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.use = None - """ Role that this diagnosis has within the encounter (e.g. admission, - billing, discharge …). - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(EncounterDiagnosis, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(EncounterDiagnosis, self).elementProperties() - js.extend([ - ("condition", "condition", fhirreference.FHIRReference, False, None, True), - ("rank", "rank", int, False, None, False), - ("use", "use", codeableconcept.CodeableConcept, False, None, False), - ]) - return js - - -class EncounterHospitalization(backboneelement.BackboneElement): - """ Details about the admission to a healthcare service. - """ - - resource_type = "EncounterHospitalization" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.admitSource = None - """ From where patient was admitted (physician referral, transfer). - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.destination = None - """ Location/organization to which the patient is discharged. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.dietPreference = None - """ Diet preferences reported by the patient. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.dischargeDisposition = None - """ Category or kind of location after discharge. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.origin = None - """ The location/organization from which the patient came before - admission. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.preAdmissionIdentifier = None - """ Pre-admission identifier. - Type `Identifier` (represented as `dict` in JSON). """ - - self.reAdmission = None - """ The type of hospital re-admission that has occurred (if any). If - the value is absent, then this is not identified as a readmission. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.specialArrangement = None - """ Wheelchair, translator, stretcher, etc.. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.specialCourtesy = None - """ Special courtesies (VIP, board member). - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - super(EncounterHospitalization, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(EncounterHospitalization, self).elementProperties() - js.extend([ - ("admitSource", "admitSource", codeableconcept.CodeableConcept, False, None, False), - ("destination", "destination", fhirreference.FHIRReference, False, None, False), - ("dietPreference", "dietPreference", codeableconcept.CodeableConcept, True, None, False), - ("dischargeDisposition", "dischargeDisposition", codeableconcept.CodeableConcept, False, None, False), - ("origin", "origin", fhirreference.FHIRReference, False, None, False), - ("preAdmissionIdentifier", "preAdmissionIdentifier", identifier.Identifier, False, None, False), - ("reAdmission", "reAdmission", codeableconcept.CodeableConcept, False, None, False), - ("specialArrangement", "specialArrangement", codeableconcept.CodeableConcept, True, None, False), - ("specialCourtesy", "specialCourtesy", codeableconcept.CodeableConcept, True, None, False), - ]) - return js - - -class EncounterLocation(backboneelement.BackboneElement): - """ List of locations where the patient has been. - - List of locations where the patient has been during this encounter. - """ - - resource_type = "EncounterLocation" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.location = None - """ Location the encounter takes place. - 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`. """ - - super(EncounterLocation, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(EncounterLocation, self).elementProperties() - 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 - - -class EncounterParticipant(backboneelement.BackboneElement): - """ List of participants involved in the encounter. - - The list of people responsible for providing the service. - """ - - resource_type = "EncounterParticipant" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.individual = None - """ Persons involved in the encounter other than the patient. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.period = None - """ Period of time during the encounter that the participant - participated. - Type `Period` (represented as `dict` in JSON). """ - - self.type = None - """ Role of participant in encounter. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - super(EncounterParticipant, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(EncounterParticipant, self).elementProperties() - js.extend([ - ("individual", "individual", fhirreference.FHIRReference, False, None, False), - ("period", "period", period.Period, False, None, False), - ("type", "type", codeableconcept.CodeableConcept, True, None, False), - ]) - return js - - -class EncounterStatusHistory(backboneelement.BackboneElement): - """ List of past encounter statuses. - - The status history permits the encounter resource to contain the status - history without needing to read through the historical versions of the - resource, or even have the server store them. - """ - - resource_type = "EncounterStatusHistory" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 time that the episode was in the specified status. - Type `Period` (represented as `dict` in JSON). """ - - self.status = None - """ planned | arrived | triaged | in-progress | onleave | finished | - cancelled +. - Type `str`. """ - - super(EncounterStatusHistory, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(EncounterStatusHistory, self).elementProperties() - js.extend([ - ("period", "period", period.Period, False, None, True), - ("status", "status", 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 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 period -except ImportError: - period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/encounter_tests.py b/fhirclient/models/encounter_tests.py deleted file mode 100644 index c0611906d..000000000 --- a/fhirclient/models/encounter_tests.py +++ /dev/null @@ -1,462 +0,0 @@ -#!/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 encounter -from .fhirdate import FHIRDate - - -class EncounterTests(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("Encounter", js["resourceType"]) - return encounter.Encounter(js) - - def testEncounter1(self): - inst = self.instantiate_from("encounter-example-home.json") - self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") - self.implEncounter1(inst) - - js = inst.as_json() - self.assertEqual("Encounter", js["resourceType"]) - inst2 = encounter.Encounter(js) - self.implEncounter1(inst2) - - def implEncounter1(self, inst): - 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-f201-20130404.json") - self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") - self.implEncounter2(inst) - - js = inst.as_json() - self.assertEqual("Encounter", js["resourceType"]) - inst2 = encounter.Encounter(js) - self.implEncounter2(inst2) - - 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://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.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, "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-f003-abscess.json") - self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") - self.implEncounter3(inst) - - js = inst.as_json() - self.assertEqual("Encounter", js["resourceType"]) - inst2 = encounter.Encounter(js) - self.implEncounter3(inst2) - - 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://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, "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, "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, 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, "Non-urgent ear, nose and throat admission") - self.assertEqual(inst.priority.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") - self.assertEqual(inst.type[0].coding[0].display, "Patient-initiated encounter") - self.assertEqual(inst.type[0].coding[0].system, "http://snomed.info/sct") - - def testEncounter4(self): - inst = self.instantiate_from("encounter-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") - self.implEncounter4(inst) - - js = inst.as_json() - self.assertEqual("Encounter", js["resourceType"]) - inst2 = encounter.Encounter(js) - 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://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, "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, "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, 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, "Urgent") - 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, "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 testEncounter6(self): - inst = self.instantiate_from("encounter-example-f203-20130311.json") - self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") - self.implEncounter6(inst) - - js = inst.as_json() - self.assertEqual("Encounter", js["resourceType"]) - inst2 = encounter.Encounter(js) - self.implEncounter6(inst2) - - def implEncounter6(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.diagnosis[0].rank, 1) - 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") - self.assertEqual(inst.hospitalization.dietPreference[0].coding[0].code, "276026009") - self.assertEqual(inst.hospitalization.dietPreference[0].coding[0].display, "Fluid balance regulation") - self.assertEqual(inst.hospitalization.dietPreference[0].coding[0].system, "http://snomed.info/sct") - 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://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://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://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) - self.assertEqual(inst.period.start.as_json(), "2013-03-11") - 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.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") - self.assertEqual(inst.statusHistory[0].status, "arrived") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type[0].coding[0].code, "183807002") - 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-f202-20130128.json") - self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") - self.implEncounter8(inst) - - js = inst.as_json() - self.assertEqual("Encounter", js["resourceType"]) - inst2 = encounter.Encounter(js) - self.implEncounter8(inst2) - - def implEncounter8(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.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.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-emerg.json") - self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") - self.implEncounter9(inst) - - js = inst.as_json() - self.assertEqual("Encounter", js["resourceType"]) - inst2 = encounter.Encounter(js) - self.implEncounter9(inst2) - - def implEncounter9(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://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-f001-heart.json") - self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") - self.implEncounter10(inst) - - js = inst.as_json() - self.assertEqual("Encounter", js["resourceType"]) - inst2 = encounter.Encounter(js) - self.implEncounter10(inst2) - - def implEncounter10(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.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 deleted file mode 100644 index 1dcffb47d..000000000 --- a/fhirclient/models/endpoint.py +++ /dev/null @@ -1,120 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Endpoint) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class Endpoint(domainresource.DomainResource): - """ The technical details of an endpoint that can be used for electronic - services. - - The technical details of an endpoint that can be used for electronic - services, such as for web services providing XDS.b or a REST endpoint for - another FHIR server. This may include any security context information. - """ - - resource_type = "Endpoint" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ The technical base address for connecting to this endpoint. - Type `str`. """ - - self.connectionType = None - """ Protocol/Profile/Standard to be used with this endpoint connection. - Type `Coding` (represented as `dict` in JSON). """ - - self.contact = None - """ Contact details for source (e.g. troubleshooting). - List of `ContactPoint` items (represented as `dict` in JSON). """ - - self.header = None - """ Usage depends on the channel type. - List of `str` items. """ - - self.identifier = None - """ Identifies this endpoint across multiple systems. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.managingOrganization = None - """ Organization that manages this endpoint (might not be the - organization that exposes the endpoint). - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.name = None - """ A name that this endpoint can be identified by. - Type `str`. """ - - self.payloadMimeType = None - """ Mimetype to send. If not specified, the content could be anything - (including no payload, if the connectionType defined this). - List of `str` items. """ - - self.payloadType = None - """ The type of content that may be used at this endpoint (e.g. XDS - Discharge summaries). - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.period = None - """ Interval the endpoint is expected to be operational. - Type `Period` (represented as `dict` in JSON). """ - - self.status = None - """ active | suspended | error | off | entered-in-error | test. - Type `str`. """ - - super(Endpoint, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Endpoint, self).elementProperties() - js.extend([ - ("address", "address", str, False, None, True), - ("connectionType", "connectionType", coding.Coding, False, None, True), - ("contact", "contact", contactpoint.ContactPoint, True, None, False), - ("header", "header", str, True, None, False), - ("identifier", "identifier", identifier.Identifier, True, None, False), - ("managingOrganization", "managingOrganization", fhirreference.FHIRReference, False, None, False), - ("name", "name", str, False, None, False), - ("payloadMimeType", "payloadMimeType", str, True, None, False), - ("payloadType", "payloadType", codeableconcept.CodeableConcept, True, None, True), - ("period", "period", period.Period, False, None, False), - ("status", "status", 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 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/endpoint_tests.py b/fhirclient/models/endpoint_tests.py deleted file mode 100644 index 73ab722e8..000000000 --- a/fhirclient/models/endpoint_tests.py +++ /dev/null @@ -1,126 +0,0 @@ -#!/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 endpoint -from .fhirdate import FHIRDate - - -class EndpointTests(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("Endpoint", js["resourceType"]) - return endpoint.Endpoint(js) - - def testEndpoint1(self): - inst = self.instantiate_from("endpoint-example-iid.json") - self.assertIsNotNone(inst, "Must have instantiated a Endpoint instance") - self.implEndpoint1(inst) - - js = inst.as_json() - self.assertEqual("Endpoint", js["resourceType"]) - inst2 = endpoint.Endpoint(js) - self.implEndpoint1(inst2) - - 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://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-direct.json") - self.assertIsNotNone(inst, "Must have instantiated a Endpoint instance") - self.implEndpoint2(inst) - - js = inst.as_json() - self.assertEqual("Endpoint", js["resourceType"]) - inst2 = endpoint.Endpoint(js) - 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://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 testEndpoint4(self): - inst = self.instantiate_from("endpoint-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Endpoint instance") - self.implEndpoint4(inst) - - js = inst.as_json() - self.assertEqual("Endpoint", js["resourceType"]) - inst2 = endpoint.Endpoint(js) - self.implEndpoint4(inst2) - - 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://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") - self.assertEqual(inst.header[0], "bearer-code BASGS534s4") - 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") - self.assertEqual(inst.payloadType[0].coding[0].system, "http://hl7.org/fhir/resource-types") - 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") - self.assertEqual(inst.text.status, "generated") - diff --git a/fhirclient/models/enrollmentrequest.py b/fhirclient/models/enrollmentrequest.py deleted file mode 100644 index 1eab212c0..000000000 --- a/fhirclient/models/enrollmentrequest.py +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# 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): - """ Enroll in coverage. - - This resource provides the insurance enrollment details to the insurer - regarding a specified coverage. - """ - - resource_type = "EnrollmentRequest" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :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` (represented as `dict` in JSON). """ - - self.created = None - """ Creation date. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.identifier = None - """ Business Identifier. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.insurer = None - """ Target. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.provider = None - """ Responsible practitioner. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.status = None - """ active | cancelled | draft | entered-in-error. - Type `str`. """ - - 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), - ("provider", "provider", fhirreference.FHIRReference, False, None, False), - ("status", "status", str, False, None, False), - ]) - 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/enrollmentrequest_tests.py b/fhirclient/models/enrollmentrequest_tests.py deleted file mode 100644 index 431e53564..000000000 --- a/fhirclient/models/enrollmentrequest_tests.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/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 enrollmentrequest -from .fhirdate import FHIRDate - - -class EnrollmentRequestTests(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("EnrollmentRequest", js["resourceType"]) - return enrollmentrequest.EnrollmentRequest(js) - - def testEnrollmentRequest1(self): - inst = self.instantiate_from("enrollmentrequest-example.json") - self.assertIsNotNone(inst, "Must have instantiated a EnrollmentRequest instance") - self.implEnrollmentRequest1(inst) - - js = inst.as_json() - self.assertEqual("EnrollmentRequest", js["resourceType"]) - inst2 = enrollmentrequest.EnrollmentRequest(js) - self.implEnrollmentRequest1(inst2) - - def implEnrollmentRequest1(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, "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 deleted file mode 100644 index eb380c52d..000000000 --- a/fhirclient/models/enrollmentresponse.py +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/EnrollmentResponse) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class EnrollmentResponse(domainresource.DomainResource): - """ EnrollmentResponse resource. - - This resource provides enrollment and plan details from the processing of - an EnrollmentRequest resource. - """ - - resource_type = "EnrollmentResponse" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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.disposition = None - """ Disposition Message. - Type `str`. """ - - self.identifier = None - """ Business Identifier. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.organization = None - """ Insurer. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.outcome = None - """ queued | complete | error | partial. - Type `str`. """ - - self.request = None - """ Claim reference. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.requestProvider = None - """ Responsible practitioner. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.status = None - """ active | cancelled | draft | entered-in-error. - Type `str`. """ - - super(EnrollmentResponse, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(EnrollmentResponse, self).elementProperties() - js.extend([ - ("created", "created", fhirdate.FHIRDate, False, None, False), - ("disposition", "disposition", str, False, None, False), - ("identifier", "identifier", identifier.Identifier, True, None, False), - ("organization", "organization", fhirreference.FHIRReference, False, None, False), - ("outcome", "outcome", str, False, None, False), - ("request", "request", fhirreference.FHIRReference, False, None, False), - ("requestProvider", "requestProvider", fhirreference.FHIRReference, False, None, False), - ("status", "status", str, False, None, False), - ]) - 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/enrollmentresponse_tests.py b/fhirclient/models/enrollmentresponse_tests.py deleted file mode 100644 index 6e721e841..000000000 --- a/fhirclient/models/enrollmentresponse_tests.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/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 enrollmentresponse -from .fhirdate import FHIRDate - - -class EnrollmentResponseTests(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("EnrollmentResponse", js["resourceType"]) - return enrollmentresponse.EnrollmentResponse(js) - - def testEnrollmentResponse1(self): - inst = self.instantiate_from("enrollmentresponse-example.json") - self.assertIsNotNone(inst, "Must have instantiated a EnrollmentResponse instance") - self.implEnrollmentResponse1(inst) - - js = inst.as_json() - self.assertEqual("EnrollmentResponse", js["resourceType"]) - inst2 = enrollmentresponse.EnrollmentResponse(js) - self.implEnrollmentResponse1(inst2) - - def implEnrollmentResponse1(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, "Dependant added to policy.") - 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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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 deleted file mode 100644 index b0d1ee2ec..000000000 --- a/fhirclient/models/episodeofcare.py +++ /dev/null @@ -1,198 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/EpisodeOfCare) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class EpisodeOfCare(domainresource.DomainResource): - """ An association of a Patient with an Organization and Healthcare - Provider(s) for a period of time that the Organization assumes some level - of responsibility. - - An association between a patient and an organization / healthcare - provider(s) during which time encounters may occur. The managing - organization assumes a level of responsibility for the patient during this - time. - """ - - resource_type = "EpisodeOfCare" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ The set of accounts that may be used for billing for this - EpisodeOfCare. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.careManager = None - """ 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. - List of `EpisodeOfCareDiagnosis` items (represented as `dict` in JSON). """ - - self.identifier = None - """ Business Identifier(s) relevant for this EpisodeOfCare. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.managingOrganization = None - """ Organization that assumes care. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.patient = None - """ The patient who is the focus of this episode of care. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.period = None - """ Interval during responsibility is assumed. - Type `Period` (represented as `dict` in JSON). """ - - self.referralRequest = None - """ Originating Referral Request(s). - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.status = None - """ planned | waitlist | active | onhold | finished | cancelled | - entered-in-error. - Type `str`. """ - - self.statusHistory = None - """ Past list of status codes (the current status may be included to - cover the start date of the status). - List of `EpisodeOfCareStatusHistory` items (represented as `dict` in JSON). """ - - self.team = None - """ Other practitioners facilitating this episode of care. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.type = None - """ Type/class - e.g. specialist referral, disease management. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - super(EpisodeOfCare, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(EpisodeOfCare, self).elementProperties() - js.extend([ - ("account", "account", fhirreference.FHIRReference, True, None, False), - ("careManager", "careManager", fhirreference.FHIRReference, False, None, False), - ("diagnosis", "diagnosis", EpisodeOfCareDiagnosis, True, None, False), - ("identifier", "identifier", identifier.Identifier, True, None, False), - ("managingOrganization", "managingOrganization", fhirreference.FHIRReference, False, None, False), - ("patient", "patient", fhirreference.FHIRReference, False, None, True), - ("period", "period", period.Period, False, None, False), - ("referralRequest", "referralRequest", fhirreference.FHIRReference, True, None, False), - ("status", "status", str, False, None, True), - ("statusHistory", "statusHistory", EpisodeOfCareStatusHistory, True, None, False), - ("team", "team", fhirreference.FHIRReference, True, None, False), - ("type", "type", codeableconcept.CodeableConcept, True, None, False), - ]) - return js - - -from . import backboneelement - -class EpisodeOfCareDiagnosis(backboneelement.BackboneElement): - """ The list of diagnosis relevant to this episode of care. - """ - - resource_type = "EpisodeOfCareDiagnosis" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.condition = None - """ Conditions/problems/diagnoses this episode of care is for. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.rank = None - """ Ranking of the diagnosis (for each role type). - Type `int`. """ - - self.role = None - """ Role that this diagnosis has within the episode of care (e.g. - admission, billing, discharge …). - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(EpisodeOfCareDiagnosis, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(EpisodeOfCareDiagnosis, self).elementProperties() - js.extend([ - ("condition", "condition", fhirreference.FHIRReference, False, None, True), - ("rank", "rank", int, False, None, False), - ("role", "role", codeableconcept.CodeableConcept, False, None, False), - ]) - return js - - -class EpisodeOfCareStatusHistory(backboneelement.BackboneElement): - """ Past list of status codes (the current status may be included to cover the - start date of the status). - - The history of statuses that the EpisodeOfCare has been through (without - requiring processing the history of the resource). - """ - - resource_type = "EpisodeOfCareStatusHistory" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Duration the EpisodeOfCare was in the specified status. - Type `Period` (represented as `dict` in JSON). """ - - self.status = None - """ planned | waitlist | active | onhold | finished | cancelled | - entered-in-error. - Type `str`. """ - - super(EpisodeOfCareStatusHistory, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(EpisodeOfCareStatusHistory, self).elementProperties() - js.extend([ - ("period", "period", period.Period, False, None, True), - ("status", "status", str, 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 period -except ImportError: - period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/episodeofcare_tests.py b/fhirclient/models/episodeofcare_tests.py deleted file mode 100644 index 1781fcff3..000000000 --- a/fhirclient/models/episodeofcare_tests.py +++ /dev/null @@ -1,70 +0,0 @@ -#!/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 episodeofcare -from .fhirdate import FHIRDate - - -class EpisodeOfCareTests(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("EpisodeOfCare", js["resourceType"]) - return episodeofcare.EpisodeOfCare(js) - - def testEpisodeOfCare1(self): - inst = self.instantiate_from("episodeofcare-example.json") - self.assertIsNotNone(inst, "Must have instantiated a EpisodeOfCare instance") - self.implEpisodeOfCare1(inst) - - js = inst.as_json() - self.assertEqual("EpisodeOfCare", js["resourceType"]) - inst2 = episodeofcare.EpisodeOfCare(js) - self.implEpisodeOfCare1(inst2) - - 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://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") - self.assertEqual(inst.statusHistory[0].period.end.date, FHIRDate("2014-09-14").date) - self.assertEqual(inst.statusHistory[0].period.end.as_json(), "2014-09-14") - self.assertEqual(inst.statusHistory[0].period.start.date, FHIRDate("2014-09-01").date) - self.assertEqual(inst.statusHistory[0].period.start.as_json(), "2014-09-01") - self.assertEqual(inst.statusHistory[0].status, "planned") - self.assertEqual(inst.statusHistory[1].period.end.date, FHIRDate("2014-09-21").date) - self.assertEqual(inst.statusHistory[1].period.end.as_json(), "2014-09-21") - self.assertEqual(inst.statusHistory[1].period.start.date, FHIRDate("2014-09-15").date) - self.assertEqual(inst.statusHistory[1].period.start.as_json(), "2014-09-15") - self.assertEqual(inst.statusHistory[1].status, "active") - self.assertEqual(inst.statusHistory[2].period.end.date, FHIRDate("2014-09-24").date) - self.assertEqual(inst.statusHistory[2].period.end.as_json(), "2014-09-24") - self.assertEqual(inst.statusHistory[2].period.start.date, FHIRDate("2014-09-22").date) - self.assertEqual(inst.statusHistory[2].period.start.as_json(), "2014-09-22") - self.assertEqual(inst.statusHistory[2].status, "onhold") - self.assertEqual(inst.statusHistory[3].period.start.date, FHIRDate("2014-09-25").date) - self.assertEqual(inst.statusHistory[3].period.start.as_json(), "2014-09-25") - self.assertEqual(inst.statusHistory[3].status, "active") - 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://terminology.hl7.org/CodeSystem/episodeofcare-type") - diff --git a/fhirclient/models/explanationofbenefit.py b/fhirclient/models/explanationofbenefit.py deleted file mode 100644 index e855bcab0..000000000 --- a/fhirclient/models/explanationofbenefit.py +++ /dev/null @@ -1,1608 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ExplanationOfBenefit) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class ExplanationOfBenefit(domainresource.DomainResource): - """ Explanation of Benefit resource. - - This resource provides: the claim details; adjudication details from the - processing of a Claim; and optionally account balance information, for - informing the subscriber of the benefits provided. - """ - - resource_type = "ExplanationOfBenefit" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.accident = None - """ 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 - """ Relevant time frame for the claim. - Type `Period` (represented as `dict` in JSON). """ - - self.careTeam = None - """ Care Team members. - List of `ExplanationOfBenefitCareTeam` items (represented as `dict` in JSON). """ - - self.claim = None - """ Claim reference. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.claimResponse = None - """ Claim response reference. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.created = None - """ Response creation date. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.diagnosis = None - """ Pertinent diagnosis information. - List of `ExplanationOfBenefitDiagnosis` items (represented as `dict` in JSON). """ - - self.disposition = None - """ Disposition Message. - Type `str`. """ - - self.enterer = None - """ Author of the claim. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.facility = None - """ Servicing Facility. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.form = None - """ 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.fundsReserveRequested = None - """ For whom to reserve funds. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.identifier = None - """ Business Identifier for the resource. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.insurance = None - """ Patient insurance information. - List of `ExplanationOfBenefitInsurance` items (represented as `dict` in JSON). """ - - self.insurer = None - """ Party responsible for reimbursement. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.item = None - """ Product or service provided. - List of `ExplanationOfBenefitItem` items (represented as `dict` in JSON). """ - - self.originalPrescription = None - """ Original prescription if superceded by fulfiller. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.outcome = None - """ queued | complete | error | partial. - Type `str`. """ - - self.patient = None - """ The recipient of the products and services. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.payee = None - """ Recipient of benefits payable. - Type `ExplanationOfBenefitPayee` (represented as `dict` in JSON). """ - - self.payment = None - """ 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` (represented as `dict` in JSON). """ - - self.priority = None - """ Desired processing urgency. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.procedure = None - """ Clinical procedures performed. - List of `ExplanationOfBenefitProcedure` items (represented as `dict` in JSON). """ - - self.processNote = None - """ Note concerning adjudication. - List of `ExplanationOfBenefitProcessNote` items (represented as `dict` in JSON). """ - - self.provider = None - """ Party responsible for the claim. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.referral = None - """ Treatment Referral. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.related = None - """ Prior or corollary claims. - List of `ExplanationOfBenefitRelated` items (represented as `dict` in JSON). """ - - self.status = None - """ active | cancelled | draft | entered-in-error. - Type `str`. """ - - self.subType = None - """ More granular claim type. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.supportingInfo = None - """ Supporting information. - List of `ExplanationOfBenefitSupportingInfo` items (represented as `dict` in JSON). """ - - self.total = None - """ Adjudication totals. - List of `ExplanationOfBenefitTotal` items (represented as `dict` in JSON). """ - - self.type = None - """ Category or discipline. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.use = None - """ claim | preauthorization | predetermination. - Type `str`. """ - - super(ExplanationOfBenefit, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ExplanationOfBenefit, self).elementProperties() - 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, True), - ("diagnosis", "diagnosis", ExplanationOfBenefitDiagnosis, True, None, False), - ("disposition", "disposition", str, False, None, False), - ("enterer", "enterer", fhirreference.FHIRReference, False, None, False), - ("facility", "facility", fhirreference.FHIRReference, 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), - ("insurance", "insurance", ExplanationOfBenefitInsurance, True, None, True), - ("insurer", "insurer", fhirreference.FHIRReference, False, None, True), - ("item", "item", ExplanationOfBenefitItem, True, None, False), - ("originalPrescription", "originalPrescription", 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, True), - ("referral", "referral", fhirreference.FHIRReference, False, None, False), - ("related", "related", ExplanationOfBenefitRelated, True, 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 - - -from . import backboneelement - -class ExplanationOfBenefitAccident(backboneelement.BackboneElement): - """ Details of the event. - - Details of a accident which resulted in injuries which required the - products and services listed in the claim. - """ - - resource_type = "ExplanationOfBenefitAccident" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ When the incident occurred. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.locationAddress = None - """ Where the event occurred. - Type `Address` (represented as `dict` in JSON). """ - - self.locationReference = None - """ Where the event occurred. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.type = None - """ The nature of the accident. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(ExplanationOfBenefitAccident, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ExplanationOfBenefitAccident, self).elementProperties() - js.extend([ - ("date", "date", fhirdate.FHIRDate, False, None, False), - ("locationAddress", "locationAddress", address.Address, False, "location", False), - ("locationReference", "locationReference", fhirreference.FHIRReference, False, "location", False), - ("type", "type", codeableconcept.CodeableConcept, False, None, False), - ]) - return js - - -class ExplanationOfBenefitAddItem(backboneelement.BackboneElement): - """ Insurer added line items. - - The first-tier service adjudications for payor added product or service - lines. - """ - - resource_type = "ExplanationOfBenefitAddItem" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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.bodySite = None - """ Anatomical location. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.detail = None - """ Insurer added line items. - List of `ExplanationOfBenefitAddItemDetail` items (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 - """ 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 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.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) - - def elementProperties(self): - js = super(ExplanationOfBenefitAddItem, self).elementProperties() - js.extend([ - ("adjudication", "adjudication", ExplanationOfBenefitItemAdjudication, True, None, False), - ("bodySite", "bodySite", codeableconcept.CodeableConcept, False, None, False), - ("detail", "detail", ExplanationOfBenefitAddItemDetail, True, 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), - ("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): - """ Insurer added line items. - - The second-tier service adjudications for payor added services. - """ - - resource_type = "ExplanationOfBenefitAddItemDetail" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Applicable note numbers. - List of `int` items. """ - - self.productOrService = None - """ Billing, service, product, or drug code. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - 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 - """ Applicable note numbers. - List of `int` items. """ - - self.productOrService = None - """ Billing, service, product, or drug code. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.quantity = None - """ Count of products or services. - Type `Quantity` (represented as `dict` in JSON). """ - - 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(ExplanationOfBenefitAddItemDetailSubDetail, 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), - ("unitPrice", "unitPrice", money.Money, False, None, False), - ]) - return js - - -class ExplanationOfBenefitBenefitBalance(backboneelement.BackboneElement): - """ Balance by Benefit Category. - """ - - resource_type = "ExplanationOfBenefitBenefitBalance" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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.description = None - """ Description of the benefit or services covered. - Type `str`. """ - - self.excluded = None - """ Excluded from the plan. - Type `bool`. """ - - self.financial = None - """ Benefit Summary. - List of `ExplanationOfBenefitBenefitBalanceFinancial` items (represented as `dict` in JSON). """ - - self.name = None - """ Short name for the benefit. - Type `str`. """ - - self.network = None - """ In or out of network. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.term = None - """ Annual or lifetime. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.unit = None - """ Individual or family. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(ExplanationOfBenefitBenefitBalance, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ExplanationOfBenefitBenefitBalance, self).elementProperties() - js.extend([ - ("category", "category", codeableconcept.CodeableConcept, False, None, True), - ("description", "description", str, False, None, False), - ("excluded", "excluded", bool, False, None, False), - ("financial", "financial", ExplanationOfBenefitBenefitBalanceFinancial, True, None, False), - ("name", "name", str, False, None, False), - ("network", "network", codeableconcept.CodeableConcept, False, None, False), - ("term", "term", codeableconcept.CodeableConcept, False, None, False), - ("unit", "unit", codeableconcept.CodeableConcept, False, None, False), - ]) - return js - - -class ExplanationOfBenefitBenefitBalanceFinancial(backboneelement.BackboneElement): - """ Benefit Summary. - - Benefits Used to date. - """ - - resource_type = "ExplanationOfBenefitBenefitBalanceFinancial" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.allowedMoney = None - """ Benefits allowed. - Type `Money` (represented as `dict` in JSON). """ - - self.allowedString = None - """ Benefits allowed. - Type `str`. """ - - self.allowedUnsignedInt = None - """ Benefits allowed. - Type `int`. """ - - self.type = None - """ Benefit classification. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.usedMoney = None - """ Benefits used. - Type `Money` (represented as `dict` in JSON). """ - - self.usedUnsignedInt = None - """ Benefits used. - Type `int`. """ - - super(ExplanationOfBenefitBenefitBalanceFinancial, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ExplanationOfBenefitBenefitBalanceFinancial, 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), - ("usedUnsignedInt", "usedUnsignedInt", int, False, "used", False), - ]) - return js - - -class ExplanationOfBenefitCareTeam(backboneelement.BackboneElement): - """ Care Team members. - - The members of the team who provided the products and services. - """ - - resource_type = "ExplanationOfBenefitCareTeam" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.provider = None - """ Practitioner or organization. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.qualification = None - """ Practitioner credential or specialization. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.responsible = None - """ Indicator of the lead practitioner. - Type `bool`. """ - - self.role = None - """ Function within the team. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.sequence = None - """ Order of care team. - Type `int`. """ - - super(ExplanationOfBenefitCareTeam, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ExplanationOfBenefitCareTeam, self).elementProperties() - js.extend([ - ("provider", "provider", fhirreference.FHIRReference, False, None, True), - ("qualification", "qualification", codeableconcept.CodeableConcept, False, None, False), - ("responsible", "responsible", bool, False, None, False), - ("role", "role", codeableconcept.CodeableConcept, False, None, False), - ("sequence", "sequence", int, False, None, True), - ]) - return js - - -class ExplanationOfBenefitDiagnosis(backboneelement.BackboneElement): - """ Pertinent diagnosis information. - - Information about diagnoses relevant to the claim items. - """ - - resource_type = "ExplanationOfBenefitDiagnosis" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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). """ - - 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 - """ Diagnosis instance identifier. - Type `int`. """ - - self.type = None - """ Timing or nature of the diagnosis. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - super(ExplanationOfBenefitDiagnosis, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ExplanationOfBenefitDiagnosis, self).elementProperties() - 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), - ]) - return js - - -class ExplanationOfBenefitInsurance(backboneelement.BackboneElement): - """ Patient insurance information. - - Financial instruments for reimbursement for the health care products and - services specified on the claim. - """ - - resource_type = "ExplanationOfBenefitInsurance" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.coverage = None - """ Insurance information. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.focal = None - """ Coverage to be used for adjudication. - Type `bool`. """ - - self.preAuthRef = None - """ Prior authorization reference number. - List of `str` items. """ - - super(ExplanationOfBenefitInsurance, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ExplanationOfBenefitInsurance, self).elementProperties() - js.extend([ - ("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): - """ Product or service provided. - - 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" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Adjudication details. - List of `ExplanationOfBenefitItemAdjudication` items (represented as `dict` in JSON). """ - - self.bodySite = None - """ Anatomical location. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.careTeamSequence = None - """ Applicable care team members. - List of `int` items. """ - - self.category = None - """ Benefit classification. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.detail = None - """ Additional items. - List of `ExplanationOfBenefitItemDetail` items (represented as `dict` in JSON). """ - - self.diagnosisSequence = None - """ Applicable diagnoses. - List of `int` items. """ - - self.encounter = None - """ Encounters related to this billed item. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.factor = None - """ Price scaling factor. - Type `float`. """ - - self.informationSequence = None - """ Applicable exception and supporting information. - 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 - """ 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.noteNumber = None - """ Applicable note numbers. - List of `int` items. """ - - 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 the product or service is provided under. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.quantity = None - """ Count of products or services. - Type `Quantity` (represented as `dict` in JSON). """ - - self.revenue = None - """ Revenue or cost center code. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.sequence = None - """ Item instance identifier. - Type `int`. """ - - 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.udi = None - """ Unique device identifier. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.unitPrice = None - """ Fee, charge or cost per item. - Type `Money` (represented as `dict` in JSON). """ - - super(ExplanationOfBenefitItem, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ExplanationOfBenefitItem, self).elementProperties() - js.extend([ - ("adjudication", "adjudication", ExplanationOfBenefitItemAdjudication, True, None, False), - ("bodySite", "bodySite", codeableconcept.CodeableConcept, False, None, False), - ("careTeamSequence", "careTeamSequence", int, True, None, False), - ("category", "category", codeableconcept.CodeableConcept, False, None, False), - ("detail", "detail", ExplanationOfBenefitItemDetail, True, None, False), - ("diagnosisSequence", "diagnosisSequence", int, True, None, False), - ("encounter", "encounter", fhirreference.FHIRReference, True, None, False), - ("factor", "factor", float, False, 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), - ("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), - ("servicedDate", "servicedDate", fhirdate.FHIRDate, False, "serviced", False), - ("servicedPeriod", "servicedPeriod", period.Period, False, "serviced", False), - ("subSite", "subSite", codeableconcept.CodeableConcept, True, None, False), - ("udi", "udi", fhirreference.FHIRReference, True, None, False), - ("unitPrice", "unitPrice", money.Money, False, None, False), - ]) - return js - - -class ExplanationOfBenefitItemAdjudication(backboneelement.BackboneElement): - """ Adjudication details. - - 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" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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. - Type `Money` (represented as `dict` in JSON). """ - - self.category = None - """ Type of adjudication information. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.reason = None - """ Explanation of adjudication outcome. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.value = None - """ Non-monitary value. - Type `float`. """ - - super(ExplanationOfBenefitItemAdjudication, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ExplanationOfBenefitItemAdjudication, self).elementProperties() - js.extend([ - ("amount", "amount", money.Money, False, None, False), - ("category", "category", codeableconcept.CodeableConcept, False, None, True), - ("reason", "reason", codeableconcept.CodeableConcept, False, None, False), - ("value", "value", float, False, None, False), - ]) - return js - - -class ExplanationOfBenefitItemDetail(backboneelement.BackboneElement): - """ Additional items. - - Second-tier of goods and services. - """ - - resource_type = "ExplanationOfBenefitItemDetail" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Detail level adjudication details. - List of `ExplanationOfBenefitItemAdjudication` items (represented as `dict` in JSON). """ - - self.category = None - """ Benefit classification. - Type `CodeableConcept` (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 - """ 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 the product or service is provided under. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.quantity = None - """ Count of products or services. - Type `Quantity` (represented as `dict` in JSON). """ - - self.revenue = None - """ Revenue or cost center code. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.sequence = None - """ Product or service provided. - Type `int`. """ - - self.subDetail = None - """ Additional items. - List of `ExplanationOfBenefitItemDetailSubDetail` items (represented as `dict` in JSON). """ - - self.udi = None - """ Unique device identifier. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.unitPrice = None - """ Fee, charge or cost per item. - Type `Money` (represented as `dict` in JSON). """ - - super(ExplanationOfBenefitItemDetail, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ExplanationOfBenefitItemDetail, self).elementProperties() - js.extend([ - ("adjudication", "adjudication", ExplanationOfBenefitItemAdjudication, True, None, False), - ("category", "category", codeableconcept.CodeableConcept, 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), - ("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), - ("subDetail", "subDetail", ExplanationOfBenefitItemDetailSubDetail, True, None, False), - ("udi", "udi", fhirreference.FHIRReference, True, None, False), - ("unitPrice", "unitPrice", money.Money, False, None, False), - ]) - return js - - -class ExplanationOfBenefitItemDetailSubDetail(backboneelement.BackboneElement): - """ Additional items. - - Third-tier of goods and services. - """ - - resource_type = "ExplanationOfBenefitItemDetailSubDetail" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Subdetail level adjudication details. - List of `ExplanationOfBenefitItemAdjudication` items (represented as `dict` in JSON). """ - - self.category = None - """ Benefit classification. - Type `CodeableConcept` (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 - """ 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 the product or service is provided under. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.quantity = None - """ Count of products or services. - Type `Quantity` (represented as `dict` in JSON). """ - - self.revenue = None - """ Revenue or cost center code. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.sequence = None - """ Product or service provided. - Type `int`. """ - - self.udi = None - """ Unique device identifier. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.unitPrice = None - """ Fee, charge or cost per item. - Type `Money` (represented as `dict` in JSON). """ - - super(ExplanationOfBenefitItemDetailSubDetail, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ExplanationOfBenefitItemDetailSubDetail, self).elementProperties() - js.extend([ - ("adjudication", "adjudication", ExplanationOfBenefitItemAdjudication, True, None, False), - ("category", "category", codeableconcept.CodeableConcept, 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), - ("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), - ("udi", "udi", fhirreference.FHIRReference, True, None, False), - ("unitPrice", "unitPrice", money.Money, False, None, False), - ]) - return js - - -class ExplanationOfBenefitPayee(backboneelement.BackboneElement): - """ Recipient of benefits payable. - - The party to be reimbursed for cost of the products and services according - to the terms of the policy. - """ - - resource_type = "ExplanationOfBenefitPayee" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.party = None - """ Recipient reference. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.type = None - """ Category of recipient. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(ExplanationOfBenefitPayee, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ExplanationOfBenefitPayee, self).elementProperties() - js.extend([ - ("party", "party", fhirreference.FHIRReference, False, None, False), - ("type", "type", codeableconcept.CodeableConcept, False, None, False), - ]) - return js - - -class ExplanationOfBenefitPayment(backboneelement.BackboneElement): - """ Payment Details. - - Payment details for the adjudication of the claim. - """ - - resource_type = "ExplanationOfBenefitPayment" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.adjustment = None - """ Payment adjustment for non-claim issues. - Type `Money` (represented as `dict` in JSON). """ - - self.adjustmentReason = None - """ Explanation for the variance. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.amount = None - """ Payable amount after adjustment. - Type `Money` (represented as `dict` in JSON). """ - - self.date = None - """ Expected date of payment. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.identifier = None - """ Business identifier for the payment. - Type `Identifier` (represented as `dict` in JSON). """ - - self.type = None - """ Partial or complete payment. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(ExplanationOfBenefitPayment, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ExplanationOfBenefitPayment, self).elementProperties() - js.extend([ - ("adjustment", "adjustment", money.Money, False, None, False), - ("adjustmentReason", "adjustmentReason", codeableconcept.CodeableConcept, False, None, False), - ("amount", "amount", money.Money, False, None, False), - ("date", "date", fhirdate.FHIRDate, False, None, False), - ("identifier", "identifier", identifier.Identifier, False, None, False), - ("type", "type", codeableconcept.CodeableConcept, False, None, False), - ]) - return js - - -class ExplanationOfBenefitProcedure(backboneelement.BackboneElement): - """ Clinical procedures performed. - - Procedures performed on the patient relevant to the billing items with the - claim. - """ - - resource_type = "ExplanationOfBenefitProcedure" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ When the procedure was performed. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.procedureCodeableConcept = None - """ Specific clinical procedure. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.procedureReference = None - """ Specific clinical procedure. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.sequence = None - """ 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): - js = super(ExplanationOfBenefitProcedure, self).elementProperties() - js.extend([ - ("date", "date", fhirdate.FHIRDate, False, None, False), - ("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): - """ Note concerning adjudication. - - A note that describes or explains adjudication results in a human readable - form. - """ - - resource_type = "ExplanationOfBenefitProcessNote" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Language of the text. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.number = None - """ Note instance identifier. - Type `int`. """ - - self.text = None - """ Note explanatory text. - Type `str`. """ - - self.type = None - """ display | print | printoper. - Type `str`. """ - - super(ExplanationOfBenefitProcessNote, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ExplanationOfBenefitProcessNote, self).elementProperties() - js.extend([ - ("language", "language", codeableconcept.CodeableConcept, False, None, False), - ("number", "number", int, False, None, False), - ("text", "text", str, False, None, False), - ("type", "type", str, False, None, False), - ]) - return js - - -class ExplanationOfBenefitRelated(backboneelement.BackboneElement): - """ Prior or corollary claims. - - 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" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.claim = None - """ Reference to the related claim. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.reference = None - """ File or case reference. - Type `Identifier` (represented as `dict` in JSON). """ - - self.relationship = None - """ How the reference claim is related. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(ExplanationOfBenefitRelated, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ExplanationOfBenefitRelated, self).elementProperties() - js.extend([ - ("claim", "claim", fhirreference.FHIRReference, False, None, False), - ("reference", "reference", identifier.Identifier, False, None, False), - ("relationship", "relationship", codeableconcept.CodeableConcept, False, None, False), - ]) - 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 -except ImportError: - address = sys.modules[__package__ + '.address'] -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 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 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/explanationofbenefit_tests.py b/fhirclient/models/explanationofbenefit_tests.py deleted file mode 100644 index b45c18c5e..000000000 --- a/fhirclient/models/explanationofbenefit_tests.py +++ /dev/null @@ -1,184 +0,0 @@ -#!/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 explanationofbenefit -from .fhirdate import FHIRDate - - -class ExplanationOfBenefitTests(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("ExplanationOfBenefit", js["resourceType"]) - return explanationofbenefit.ExplanationOfBenefit(js) - - def testExplanationOfBenefit1(self): - inst = self.instantiate_from("explanationofbenefit-example.json") - self.assertIsNotNone(inst, "Must have instantiated a ExplanationOfBenefit instance") - self.implExplanationOfBenefit1(inst) - - js = inst.as_json() - self.assertEqual("ExplanationOfBenefit", js["resourceType"]) - inst2 = explanationofbenefit.ExplanationOfBenefit(js) - self.implExplanationOfBenefit1(inst2) - - def implExplanationOfBenefit1(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.disposition, "Claim settled as per contract.") - 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.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.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].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].servicedDate.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.item[0].servicedDate.as_json(), "2014-08-16") - self.assertEqual(inst.item[0].unitPrice.currency, "USD") - self.assertEqual(inst.item[0].unitPrice.value, 135.57) - 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://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.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://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/extension.py b/fhirclient/models/extension.py deleted file mode 100644 index 2dff366d8..000000000 --- a/fhirclient/models/extension.py +++ /dev/null @@ -1,409 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Extension) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import element - -class Extension(element.Element): - """ Optional Extensions Element. - - Optional Extension Element - found in all resources. - """ - - resource_type = "Extension" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.url = None - """ identifies the meaning of the extension. - Type `str`. """ - - self.valueAddress = None - """ Value of extension. - Type `Address` (represented as `dict` in JSON). """ - - self.valueAge = None - """ Value of extension. - Type `Age` (represented as `dict` in JSON). """ - - self.valueAnnotation = None - """ Value of extension. - Type `Annotation` (represented as `dict` in JSON). """ - - self.valueAttachment = None - """ Value of extension. - Type `Attachment` (represented as `dict` in JSON). """ - - self.valueBase64Binary = None - """ Value of extension. - Type `str`. """ - - self.valueBoolean = None - """ Value of extension. - Type `bool`. """ - - self.valueCanonical = None - """ Value of extension. - Type `str`. """ - - self.valueCode = None - """ Value of extension. - Type `str`. """ - - self.valueCodeableConcept = None - """ Value of extension. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.valueCoding = None - """ 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). """ - - self.valueDateTime = None - """ Value of extension. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.valueDecimal = None - """ Value of extension. - Type `float`. """ - - self.valueDistance = None - """ 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). """ - - self.valueId = None - """ Value of extension. - Type `str`. """ - - self.valueIdentifier = None - """ Value of extension. - Type `Identifier` (represented as `dict` in JSON). """ - - self.valueInstant = None - """ Value of extension. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.valueInteger = None - """ Value of extension. - Type `int`. """ - - self.valueMarkdown = None - """ Value of extension. - Type `str`. """ - - self.valueMoney = None - """ Value of extension. - Type `Money` (represented as `dict` in JSON). """ - - self.valueOid = None - """ 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). """ - - self.valuePositiveInt = None - """ Value of extension. - Type `int`. """ - - self.valueQuantity = None - """ Value of extension. - Type `Quantity` (represented as `dict` in JSON). """ - - self.valueRange = None - """ Value of extension. - Type `Range` (represented as `dict` in JSON). """ - - self.valueRatio = None - """ Value of extension. - Type `Ratio` (represented as `dict` in JSON). """ - - self.valueReference = None - """ 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). """ - - self.valueSignature = None - """ Value of extension. - Type `Signature` (represented as `dict` in JSON). """ - - self.valueString = None - """ Value of extension. - Type `str`. """ - - self.valueTime = None - """ Value of extension. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.valueTiming = None - """ 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`. """ - - self.valueUri = None - """ 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): - js = super(Extension, self).elementProperties() - js.extend([ - ("url", "url", str, False, None, True), - ("valueAddress", "valueAddress", address.Address, False, "value", False), - ("valueAge", "valueAge", age.Age, False, "value", False), - ("valueAnnotation", "valueAnnotation", annotation.Annotation, False, "value", False), - ("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), - ("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 - - -import sys -try: - from . import address -except ImportError: - address = sys.modules[__package__ + '.address'] -try: - from . import age -except ImportError: - age = sys.modules[__package__ + '.age'] -try: - from . import annotation -except ImportError: - annotation = sys.modules[__package__ + '.annotation'] -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 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: - fhirdate = sys.modules[__package__ + '.fhirdate'] -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 parameterdefinition -except ImportError: - parameterdefinition = sys.modules[__package__ + '.parameterdefinition'] -try: - 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 relatedartifact -except ImportError: - relatedartifact = sys.modules[__package__ + '.relatedartifact'] -try: - from . import sampleddata -except ImportError: - sampleddata = sys.modules[__package__ + '.sampleddata'] -try: - from . import signature -except ImportError: - signature = sys.modules[__package__ + '.signature'] -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/familymemberhistory.py b/fhirclient/models/familymemberhistory.py deleted file mode 100644 index 176c089f7..000000000 --- a/fhirclient/models/familymemberhistory.py +++ /dev/null @@ -1,268 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/FamilyMemberHistory) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class FamilyMemberHistory(domainresource.DomainResource): - """ Information about patient's relatives, relevant for patient. - - Significant health conditions for a person related to the patient relevant - in the context of care for the patient. - """ - - resource_type = "FamilyMemberHistory" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.ageAge = None - """ (approximate) age. - Type `Age` (represented as `dict` in JSON). """ - - self.ageRange = None - """ (approximate) age. - Type `Range` (represented as `dict` in JSON). """ - - self.ageString = None - """ (approximate) age. - Type `str`. """ - - self.bornDate = None - """ (approximate) date of birth. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.bornPeriod = None - """ (approximate) date of birth. - Type `Period` (represented as `dict` in JSON). """ - - self.bornString = None - """ (approximate) date of birth. - Type `str`. """ - - self.condition = None - """ 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 recorded or last updated. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.deceasedAge = None - """ Dead? How old/when?. - Type `Age` (represented as `dict` in JSON). """ - - self.deceasedBoolean = None - """ Dead? How old/when?. - Type `bool`. """ - - self.deceasedDate = None - """ Dead? How old/when?. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.deceasedRange = None - """ Dead? How old/when?. - Type `Range` (represented as `dict` in JSON). """ - - self.deceasedString = None - """ Dead? How old/when?. - Type `str`. """ - - self.estimatedAge = None - """ Age is estimated?. - Type `bool`. """ - - 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.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` (represented as `dict` in JSON). """ - - self.reasonCode = None - """ Why was family member history performed?. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.reasonReference = None - """ Why was family member history performed?. - 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`. """ - - super(FamilyMemberHistory, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(FamilyMemberHistory, self).elementProperties() - js.extend([ - ("ageAge", "ageAge", age.Age, False, "age", False), - ("ageRange", "ageRange", range.Range, False, "age", False), - ("ageString", "ageString", str, False, "age", False), - ("bornDate", "bornDate", fhirdate.FHIRDate, False, "born", False), - ("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), - ("estimatedAge", "estimatedAge", bool, 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), - ("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 - - -from . import backboneelement - -class FamilyMemberHistoryCondition(backboneelement.BackboneElement): - """ Condition that the related person had. - - The significant Conditions (or condition) that the family member had. This - is a repeating section to allow a system to represent more than one - condition per resource, though there is nothing stopping multiple resources - - one per condition. - """ - - resource_type = "FamilyMemberHistoryCondition" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ 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). """ - - self.onsetAge = None - """ When condition first manifested. - Type `Age` (represented as `dict` in JSON). """ - - self.onsetPeriod = None - """ When condition first manifested. - Type `Period` (represented as `dict` in JSON). """ - - self.onsetRange = None - """ When condition first manifested. - Type `Range` (represented as `dict` in JSON). """ - - self.onsetString = None - """ When condition first manifested. - Type `str`. """ - - self.outcome = None - """ deceased | permanent disability | etc.. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(FamilyMemberHistoryCondition, self).__init__(jsondict=jsondict, strict=strict) - - 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), - ("onsetRange", "onsetRange", range.Range, False, "onset", False), - ("onsetString", "onsetString", str, False, "onset", False), - ("outcome", "outcome", 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: - 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'] -try: - from . import range -except ImportError: - range = sys.modules[__package__ + '.range'] diff --git a/fhirclient/models/familymemberhistory_tests.py b/fhirclient/models/familymemberhistory_tests.py deleted file mode 100644 index 5345cb4e7..000000000 --- a/fhirclient/models/familymemberhistory_tests.py +++ /dev/null @@ -1,92 +0,0 @@ -#!/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 familymemberhistory -from .fhirdate import FHIRDate - - -class FamilyMemberHistoryTests(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("FamilyMemberHistory", js["resourceType"]) - return familymemberhistory.FamilyMemberHistory(js) - - def testFamilyMemberHistory1(self): - inst = self.instantiate_from("familymemberhistory-example.json") - self.assertIsNotNone(inst, "Must have instantiated a FamilyMemberHistory instance") - self.implFamilyMemberHistory1(inst) - - js = inst.as_json() - self.assertEqual("FamilyMemberHistory", js["resourceType"]) - inst2 = familymemberhistory.FamilyMemberHistory(js) - self.implFamilyMemberHistory1(inst2) - - def implFamilyMemberHistory1(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].system, "http://snomed.info/sct") - 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, 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, "
Father died of a heart attack aged 74
") - self.assertEqual(inst.text.status, "generated") - - def testFamilyMemberHistory2(self): - inst = self.instantiate_from("familymemberhistory-example-mother.json") - self.assertIsNotNone(inst, "Must have instantiated a FamilyMemberHistory instance") - self.implFamilyMemberHistory2(inst) - - js = inst.as_json() - self.assertEqual("FamilyMemberHistory", js["resourceType"]) - inst2 = familymemberhistory.FamilyMemberHistory(js) - self.implFamilyMemberHistory2(inst2) - - def implFamilyMemberHistory2(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].system, "http://snomed.info/sct") - 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, 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, "
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 deleted file mode 100644 index 0016e3eeb..000000000 --- a/fhirclient/models/fhirelementfactory.py +++ /dev/null @@ -1,2013 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. -# 2019, SMART Health IT. - - -class FHIRElementFactory(object): - """ Factory class to instantiate resources by resource name. - """ - - @classmethod - def instantiate(cls, resource_type, jsondict): - """ Instantiate a resource of the type correlating to "resource_type". - - :param str resource_type: The name/type of the resource to instantiate - :param dict jsondict: The JSON dictionary to use for data - :returns: A resource of the respective type or `Element` - """ - if "Account" == resource_type: - from . import account - return account.Account(jsondict) - if "AccountCoverage" == resource_type: - from . import account - return account.AccountCoverage(jsondict) - if "AccountGuarantor" == resource_type: - from . import account - return account.AccountGuarantor(jsondict) - if "ActivityDefinition" == resource_type: - from . import activitydefinition - return activitydefinition.ActivityDefinition(jsondict) - if "ActivityDefinitionDynamicValue" == resource_type: - from . import activitydefinition - return activitydefinition.ActivityDefinitionDynamicValue(jsondict) - if "ActivityDefinitionParticipant" == resource_type: - from . import activitydefinition - return activitydefinition.ActivityDefinitionParticipant(jsondict) - if "Address" == resource_type: - from . import address - return address.Address(jsondict) - if "AdverseEvent" == resource_type: - from . import adverseevent - return adverseevent.AdverseEvent(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) - if "AllergyIntolerance" == resource_type: - from . import allergyintolerance - return allergyintolerance.AllergyIntolerance(jsondict) - if "AllergyIntoleranceReaction" == resource_type: - from . import allergyintolerance - return allergyintolerance.AllergyIntoleranceReaction(jsondict) - if "Annotation" == resource_type: - from . import annotation - return annotation.Annotation(jsondict) - if "Appointment" == resource_type: - from . import appointment - return appointment.Appointment(jsondict) - if "AppointmentParticipant" == resource_type: - from . import appointment - return appointment.AppointmentParticipant(jsondict) - if "AppointmentResponse" == resource_type: - from . import appointmentresponse - return appointmentresponse.AppointmentResponse(jsondict) - if "Attachment" == resource_type: - from . import attachment - return attachment.Attachment(jsondict) - if "AuditEvent" == resource_type: - from . import auditevent - return auditevent.AuditEvent(jsondict) - if "AuditEventAgent" == resource_type: - from . import auditevent - return auditevent.AuditEventAgent(jsondict) - if "AuditEventAgentNetwork" == resource_type: - from . import auditevent - return auditevent.AuditEventAgentNetwork(jsondict) - if "AuditEventEntity" == resource_type: - from . import auditevent - return auditevent.AuditEventEntity(jsondict) - if "AuditEventEntityDetail" == resource_type: - from . import auditevent - return auditevent.AuditEventEntityDetail(jsondict) - if "AuditEventSource" == resource_type: - from . import auditevent - return auditevent.AuditEventSource(jsondict) - if "BackboneElement" == resource_type: - from . import backboneelement - return backboneelement.BackboneElement(jsondict) - if "Basic" == resource_type: - from . import basic - return basic.Basic(jsondict) - if "Binary" == resource_type: - from . import binary - return binary.Binary(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) - if "BundleEntry" == resource_type: - from . import bundle - return bundle.BundleEntry(jsondict) - if "BundleEntryRequest" == resource_type: - from . import bundle - return bundle.BundleEntryRequest(jsondict) - if "BundleEntryResponse" == resource_type: - from . import bundle - return bundle.BundleEntryResponse(jsondict) - if "BundleEntrySearch" == resource_type: - from . import bundle - return bundle.BundleEntrySearch(jsondict) - if "BundleLink" == resource_type: - from . import bundle - return bundle.BundleLink(jsondict) - if "CapabilityStatement" == resource_type: - from . import capabilitystatement - return capabilitystatement.CapabilityStatement(jsondict) - if "CapabilityStatementDocument" == resource_type: - from . import capabilitystatement - return capabilitystatement.CapabilityStatementDocument(jsondict) - if "CapabilityStatementImplementation" == resource_type: - from . import capabilitystatement - return capabilitystatement.CapabilityStatementImplementation(jsondict) - if "CapabilityStatementMessaging" == resource_type: - from . import capabilitystatement - return capabilitystatement.CapabilityStatementMessaging(jsondict) - if "CapabilityStatementMessagingEndpoint" == resource_type: - from . import capabilitystatement - return capabilitystatement.CapabilityStatementMessagingEndpoint(jsondict) - if "CapabilityStatementMessagingSupportedMessage" == resource_type: - from . import capabilitystatement - return capabilitystatement.CapabilityStatementMessagingSupportedMessage(jsondict) - if "CapabilityStatementRest" == resource_type: - from . import capabilitystatement - return capabilitystatement.CapabilityStatementRest(jsondict) - if "CapabilityStatementRestInteraction" == resource_type: - from . import capabilitystatement - return capabilitystatement.CapabilityStatementRestInteraction(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 "CapabilityStatementSoftware" == resource_type: - from . import capabilitystatement - return capabilitystatement.CapabilityStatementSoftware(jsondict) - if "CarePlan" == resource_type: - from . import careplan - return careplan.CarePlan(jsondict) - if "CarePlanActivity" == resource_type: - from . import careplan - return careplan.CarePlanActivity(jsondict) - if "CarePlanActivityDetail" == resource_type: - from . import careplan - return careplan.CarePlanActivityDetail(jsondict) - if "CareTeam" == resource_type: - from . import careteam - return careteam.CareTeam(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 "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.ChargeItemPerformer(jsondict) - if "Claim" == resource_type: - from . import claim - return claim.Claim(jsondict) - if "ClaimAccident" == resource_type: - from . import claim - return claim.ClaimAccident(jsondict) - if "ClaimCareTeam" == resource_type: - from . import claim - return claim.ClaimCareTeam(jsondict) - if "ClaimDiagnosis" == resource_type: - from . import claim - return claim.ClaimDiagnosis(jsondict) - if "ClaimInsurance" == resource_type: - from . import claim - return claim.ClaimInsurance(jsondict) - if "ClaimItem" == resource_type: - from . import claim - return claim.ClaimItem(jsondict) - if "ClaimItemDetail" == resource_type: - from . import claim - return claim.ClaimItemDetail(jsondict) - if "ClaimItemDetailSubDetail" == resource_type: - from . import claim - return claim.ClaimItemDetailSubDetail(jsondict) - if "ClaimPayee" == resource_type: - from . import claim - return claim.ClaimPayee(jsondict) - if "ClaimProcedure" == resource_type: - from . import claim - return claim.ClaimProcedure(jsondict) - if "ClaimRelated" == resource_type: - from . import claim - return claim.ClaimRelated(jsondict) - if "ClaimResponse" == resource_type: - from . import claimresponse - return claimresponse.ClaimResponse(jsondict) - if "ClaimResponseAddItem" == resource_type: - from . import claimresponse - return claimresponse.ClaimResponseAddItem(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) - if "ClaimResponseInsurance" == resource_type: - from . import claimresponse - return claimresponse.ClaimResponseInsurance(jsondict) - if "ClaimResponseItem" == resource_type: - from . import claimresponse - return claimresponse.ClaimResponseItem(jsondict) - if "ClaimResponseItemAdjudication" == resource_type: - from . import claimresponse - return claimresponse.ClaimResponseItemAdjudication(jsondict) - if "ClaimResponseItemDetail" == resource_type: - from . import claimresponse - return claimresponse.ClaimResponseItemDetail(jsondict) - if "ClaimResponseItemDetailSubDetail" == resource_type: - from . import claimresponse - return claimresponse.ClaimResponseItemDetailSubDetail(jsondict) - if "ClaimResponsePayment" == resource_type: - from . import claimresponse - return claimresponse.ClaimResponsePayment(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) - if "ClinicalImpressionFinding" == resource_type: - from . import clinicalimpression - return clinicalimpression.ClinicalImpressionFinding(jsondict) - if "ClinicalImpressionInvestigation" == resource_type: - from . import clinicalimpression - return clinicalimpression.ClinicalImpressionInvestigation(jsondict) - if "CodeSystem" == resource_type: - from . import codesystem - return codesystem.CodeSystem(jsondict) - if "CodeSystemConcept" == resource_type: - from . import codesystem - return codesystem.CodeSystemConcept(jsondict) - if "CodeSystemConceptDesignation" == resource_type: - from . import codesystem - return codesystem.CodeSystemConceptDesignation(jsondict) - if "CodeSystemConceptProperty" == resource_type: - from . import codesystem - return codesystem.CodeSystemConceptProperty(jsondict) - if "CodeSystemFilter" == resource_type: - from . import codesystem - return codesystem.CodeSystemFilter(jsondict) - if "CodeSystemProperty" == resource_type: - from . import codesystem - return codesystem.CodeSystemProperty(jsondict) - if "CodeableConcept" == resource_type: - from . import codeableconcept - return codeableconcept.CodeableConcept(jsondict) - if "Coding" == resource_type: - from . import coding - return coding.Coding(jsondict) - if "Communication" == resource_type: - from . import communication - return communication.Communication(jsondict) - if "CommunicationPayload" == resource_type: - from . import communication - return communication.CommunicationPayload(jsondict) - if "CommunicationRequest" == resource_type: - from . import communicationrequest - return communicationrequest.CommunicationRequest(jsondict) - if "CommunicationRequestPayload" == resource_type: - from . import communicationrequest - return communicationrequest.CommunicationRequestPayload(jsondict) - if "CompartmentDefinition" == resource_type: - from . import compartmentdefinition - return compartmentdefinition.CompartmentDefinition(jsondict) - if "CompartmentDefinitionResource" == resource_type: - from . import compartmentdefinition - return compartmentdefinition.CompartmentDefinitionResource(jsondict) - if "Composition" == resource_type: - from . import composition - return composition.Composition(jsondict) - if "CompositionAttester" == resource_type: - from . import composition - return composition.CompositionAttester(jsondict) - if "CompositionEvent" == resource_type: - from . import composition - return composition.CompositionEvent(jsondict) - if "CompositionRelatesTo" == resource_type: - from . import composition - return composition.CompositionRelatesTo(jsondict) - if "CompositionSection" == resource_type: - from . import composition - return composition.CompositionSection(jsondict) - if "ConceptMap" == resource_type: - from . import conceptmap - return conceptmap.ConceptMap(jsondict) - if "ConceptMapGroup" == resource_type: - from . import conceptmap - return conceptmap.ConceptMapGroup(jsondict) - if "ConceptMapGroupElement" == resource_type: - from . import conceptmap - return conceptmap.ConceptMapGroupElement(jsondict) - if "ConceptMapGroupElementTarget" == resource_type: - from . import conceptmap - return conceptmap.ConceptMapGroupElementTarget(jsondict) - if "ConceptMapGroupElementTargetDependsOn" == resource_type: - from . import conceptmap - return conceptmap.ConceptMapGroupElementTargetDependsOn(jsondict) - if "ConceptMapGroupUnmapped" == resource_type: - from . import conceptmap - return conceptmap.ConceptMapGroupUnmapped(jsondict) - if "Condition" == resource_type: - from . import condition - return condition.Condition(jsondict) - if "ConditionEvidence" == resource_type: - from . import condition - return condition.ConditionEvidence(jsondict) - if "ConditionStage" == resource_type: - from . import condition - return condition.ConditionStage(jsondict) - if "Consent" == resource_type: - from . import consent - return consent.Consent(jsondict) - if "ConsentPolicy" == resource_type: - from . import consent - return consent.ConsentPolicy(jsondict) - if "ConsentProvision" == resource_type: - from . import consent - return consent.ConsentProvision(jsondict) - if "ConsentProvisionActor" == resource_type: - from . import consent - return consent.ConsentProvisionActor(jsondict) - if "ConsentProvisionData" == resource_type: - from . import consent - return consent.ConsentProvisionData(jsondict) - if "ConsentVerification" == resource_type: - from . import consent - return consent.ConsentVerification(jsondict) - if "ContactDetail" == resource_type: - from . import contactdetail - return contactdetail.ContactDetail(jsondict) - if "ContactPoint" == resource_type: - from . import contactpoint - return contactpoint.ContactPoint(jsondict) - if "Contract" == resource_type: - from . import contract - return contract.Contract(jsondict) - if "ContractContentDefinition" == resource_type: - from . import contract - return contract.ContractContentDefinition(jsondict) - if "ContractFriendly" == resource_type: - from . import contract - return contract.ContractFriendly(jsondict) - if "ContractLegal" == resource_type: - from . import contract - return contract.ContractLegal(jsondict) - if "ContractRule" == resource_type: - from . import contract - return contract.ContractRule(jsondict) - if "ContractSigner" == resource_type: - from . import contract - return contract.ContractSigner(jsondict) - if "ContractTerm" == resource_type: - from . import contract - return contract.ContractTerm(jsondict) - 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.ContractTermOffer(jsondict) - if "ContractTermOfferAnswer" == resource_type: - from . import contract - return contract.ContractTermOfferAnswer(jsondict) - if "ContractTermOfferParty" == resource_type: - from . import contract - 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) - if "Count" == resource_type: - from . import count - return count.Count(jsondict) - if "Coverage" == resource_type: - from . import coverage - return coverage.Coverage(jsondict) - 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.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) - if "DataRequirementCodeFilter" == resource_type: - from . import datarequirement - return datarequirement.DataRequirementCodeFilter(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 "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 "DeviceRequestParameter" == resource_type: - from . import devicerequest - return devicerequest.DeviceRequestParameter(jsondict) - if "DeviceSpecialization" == resource_type: - from . import device - return device.DeviceSpecialization(jsondict) - if "DeviceUdiCarrier" == resource_type: - from . import device - 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 "DiagnosticReportMedia" == resource_type: - from . import diagnosticreport - 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 "DocumentManifestRelated" == resource_type: - from . import documentmanifest - return documentmanifest.DocumentManifestRelated(jsondict) - if "DocumentReference" == resource_type: - from . import documentreference - return documentreference.DocumentReference(jsondict) - if "DocumentReferenceContent" == resource_type: - from . import documentreference - return documentreference.DocumentReferenceContent(jsondict) - if "DocumentReferenceContext" == resource_type: - from . import documentreference - return documentreference.DocumentReferenceContext(jsondict) - if "DocumentReferenceRelatesTo" == resource_type: - from . import documentreference - return documentreference.DocumentReferenceRelatesTo(jsondict) - if "DomainResource" == resource_type: - from . import domainresource - return domainresource.DomainResource(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) - if "ElementDefinition" == resource_type: - from . import elementdefinition - return elementdefinition.ElementDefinition(jsondict) - if "ElementDefinitionBase" == resource_type: - from . import elementdefinition - return elementdefinition.ElementDefinitionBase(jsondict) - if "ElementDefinitionBinding" == resource_type: - from . import elementdefinition - return elementdefinition.ElementDefinitionBinding(jsondict) - if "ElementDefinitionConstraint" == resource_type: - from . import elementdefinition - return elementdefinition.ElementDefinitionConstraint(jsondict) - if "ElementDefinitionExample" == resource_type: - from . import elementdefinition - return elementdefinition.ElementDefinitionExample(jsondict) - if "ElementDefinitionMapping" == resource_type: - from . import elementdefinition - return elementdefinition.ElementDefinitionMapping(jsondict) - if "ElementDefinitionSlicing" == resource_type: - from . import elementdefinition - return elementdefinition.ElementDefinitionSlicing(jsondict) - if "ElementDefinitionSlicingDiscriminator" == resource_type: - from . import elementdefinition - return elementdefinition.ElementDefinitionSlicingDiscriminator(jsondict) - if "ElementDefinitionType" == resource_type: - from . import elementdefinition - return elementdefinition.ElementDefinitionType(jsondict) - if "Encounter" == resource_type: - from . import encounter - return encounter.Encounter(jsondict) - if "EncounterClassHistory" == resource_type: - from . import encounter - return encounter.EncounterClassHistory(jsondict) - if "EncounterDiagnosis" == resource_type: - from . import encounter - return encounter.EncounterDiagnosis(jsondict) - if "EncounterHospitalization" == resource_type: - from . import encounter - return encounter.EncounterHospitalization(jsondict) - if "EncounterLocation" == resource_type: - from . import encounter - return encounter.EncounterLocation(jsondict) - if "EncounterParticipant" == resource_type: - from . import encounter - return encounter.EncounterParticipant(jsondict) - if "EncounterStatusHistory" == resource_type: - from . import encounter - return encounter.EncounterStatusHistory(jsondict) - if "Endpoint" == resource_type: - from . import endpoint - return endpoint.Endpoint(jsondict) - if "EnrollmentRequest" == resource_type: - from . import enrollmentrequest - return enrollmentrequest.EnrollmentRequest(jsondict) - if "EnrollmentResponse" == resource_type: - from . import enrollmentresponse - return enrollmentresponse.EnrollmentResponse(jsondict) - if "EpisodeOfCare" == resource_type: - from . import episodeofcare - return episodeofcare.EpisodeOfCare(jsondict) - if "EpisodeOfCareDiagnosis" == resource_type: - from . import episodeofcare - return episodeofcare.EpisodeOfCareDiagnosis(jsondict) - if "EpisodeOfCareStatusHistory" == resource_type: - from . import episodeofcare - return episodeofcare.EpisodeOfCareStatusHistory(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) - if "ExplanationOfBenefitAccident" == resource_type: - from . import explanationofbenefit - return explanationofbenefit.ExplanationOfBenefitAccident(jsondict) - if "ExplanationOfBenefitAddItem" == resource_type: - from . import explanationofbenefit - return explanationofbenefit.ExplanationOfBenefitAddItem(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) - if "ExplanationOfBenefitBenefitBalanceFinancial" == resource_type: - from . import explanationofbenefit - return explanationofbenefit.ExplanationOfBenefitBenefitBalanceFinancial(jsondict) - if "ExplanationOfBenefitCareTeam" == resource_type: - from . import explanationofbenefit - return explanationofbenefit.ExplanationOfBenefitCareTeam(jsondict) - if "ExplanationOfBenefitDiagnosis" == resource_type: - from . import explanationofbenefit - return explanationofbenefit.ExplanationOfBenefitDiagnosis(jsondict) - if "ExplanationOfBenefitInsurance" == resource_type: - from . import explanationofbenefit - return explanationofbenefit.ExplanationOfBenefitInsurance(jsondict) - if "ExplanationOfBenefitItem" == resource_type: - from . import explanationofbenefit - return explanationofbenefit.ExplanationOfBenefitItem(jsondict) - if "ExplanationOfBenefitItemAdjudication" == resource_type: - from . import explanationofbenefit - return explanationofbenefit.ExplanationOfBenefitItemAdjudication(jsondict) - if "ExplanationOfBenefitItemDetail" == resource_type: - from . import explanationofbenefit - return explanationofbenefit.ExplanationOfBenefitItemDetail(jsondict) - if "ExplanationOfBenefitItemDetailSubDetail" == resource_type: - from . import explanationofbenefit - return explanationofbenefit.ExplanationOfBenefitItemDetailSubDetail(jsondict) - if "ExplanationOfBenefitPayee" == resource_type: - from . import explanationofbenefit - return explanationofbenefit.ExplanationOfBenefitPayee(jsondict) - if "ExplanationOfBenefitPayment" == resource_type: - from . import explanationofbenefit - return explanationofbenefit.ExplanationOfBenefitPayment(jsondict) - if "ExplanationOfBenefitProcedure" == resource_type: - from . import explanationofbenefit - return explanationofbenefit.ExplanationOfBenefitProcedure(jsondict) - if "ExplanationOfBenefitProcessNote" == resource_type: - from . import explanationofbenefit - return explanationofbenefit.ExplanationOfBenefitProcessNote(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) - if "FamilyMemberHistory" == resource_type: - from . import familymemberhistory - return familymemberhistory.FamilyMemberHistory(jsondict) - if "FamilyMemberHistoryCondition" == resource_type: - from . import familymemberhistory - return familymemberhistory.FamilyMemberHistoryCondition(jsondict) - if "Flag" == resource_type: - from . import flag - return flag.Flag(jsondict) - if "Goal" == resource_type: - from . import goal - return goal.Goal(jsondict) - if "GoalTarget" == resource_type: - from . import goal - return goal.GoalTarget(jsondict) - if "GraphDefinition" == resource_type: - from . import graphdefinition - return graphdefinition.GraphDefinition(jsondict) - if "GraphDefinitionLink" == resource_type: - from . import graphdefinition - return graphdefinition.GraphDefinitionLink(jsondict) - if "GraphDefinitionLinkTarget" == resource_type: - from . import graphdefinition - return graphdefinition.GraphDefinitionLinkTarget(jsondict) - if "GraphDefinitionLinkTargetCompartment" == resource_type: - from . import graphdefinition - return graphdefinition.GraphDefinitionLinkTargetCompartment(jsondict) - if "Group" == resource_type: - from . import group - return group.Group(jsondict) - if "GroupCharacteristic" == resource_type: - from . import group - return group.GroupCharacteristic(jsondict) - if "GroupMember" == resource_type: - from . import group - return group.GroupMember(jsondict) - if "GuidanceResponse" == resource_type: - from . import guidanceresponse - return guidanceresponse.GuidanceResponse(jsondict) - if "HealthcareService" == resource_type: - from . import healthcareservice - return healthcareservice.HealthcareService(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) - if "HumanName" == resource_type: - from . import humanname - return humanname.HumanName(jsondict) - if "Identifier" == resource_type: - from . import identifier - return identifier.Identifier(jsondict) - if "ImagingStudy" == resource_type: - from . import imagingstudy - return imagingstudy.ImagingStudy(jsondict) - if "ImagingStudySeries" == resource_type: - from . import imagingstudy - return imagingstudy.ImagingStudySeries(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 "ImmunizationEducation" == resource_type: - from . import immunization - return immunization.ImmunizationEducation(jsondict) - if "ImmunizationEvaluation" == resource_type: - from . import immunizationevaluation - return immunizationevaluation.ImmunizationEvaluation(jsondict) - if "ImmunizationPerformer" == resource_type: - from . import immunization - 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) - if "ImmunizationRecommendation" == resource_type: - from . import immunizationrecommendation - return immunizationrecommendation.ImmunizationRecommendation(jsondict) - if "ImmunizationRecommendationRecommendation" == resource_type: - from . import immunizationrecommendation - return immunizationrecommendation.ImmunizationRecommendationRecommendation(jsondict) - if "ImmunizationRecommendationRecommendationDateCriterion" == resource_type: - from . import immunizationrecommendation - return immunizationrecommendation.ImmunizationRecommendationRecommendationDateCriterion(jsondict) - if "ImplementationGuide" == resource_type: - from . import implementationguide - return implementationguide.ImplementationGuide(jsondict) - 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.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 "ImplementationGuideManifest" == resource_type: - from . import implementationguide - return implementationguide.ImplementationGuideManifest(jsondict) - if "ImplementationGuideManifestPage" == resource_type: - from . import implementationguide - return implementationguide.ImplementationGuideManifestPage(jsondict) - if "ImplementationGuideManifestResource" == resource_type: - from . import implementationguide - 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) - if "Linkage" == resource_type: - from . import linkage - return linkage.Linkage(jsondict) - if "LinkageItem" == resource_type: - from . import linkage - return linkage.LinkageItem(jsondict) - if "List" == resource_type: - from . import list - return list.List(jsondict) - if "ListEntry" == resource_type: - from . import list - return list.ListEntry(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) - if "MeasureGroup" == resource_type: - from . import measure - return measure.MeasureGroup(jsondict) - if "MeasureGroupPopulation" == resource_type: - from . import measure - return measure.MeasureGroupPopulation(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) - if "MeasureReportGroup" == resource_type: - from . import measurereport - return measurereport.MeasureReportGroup(jsondict) - if "MeasureReportGroupPopulation" == resource_type: - from . import measurereport - return measurereport.MeasureReportGroupPopulation(jsondict) - if "MeasureReportGroupStratifier" == resource_type: - from . import measurereport - return measurereport.MeasureReportGroupStratifier(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) - if "MeasureSupplementalData" == resource_type: - from . import measure - return measure.MeasureSupplementalData(jsondict) - if "Media" == resource_type: - from . import media - return media.Media(jsondict) - if "Medication" == resource_type: - from . import medication - return medication.Medication(jsondict) - if "MedicationAdministration" == resource_type: - from . import medicationadministration - return medicationadministration.MedicationAdministration(jsondict) - if "MedicationAdministrationDosage" == resource_type: - from . import medicationadministration - return medicationadministration.MedicationAdministrationDosage(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) - if "MedicationDispensePerformer" == resource_type: - from . import medicationdispense - return medicationdispense.MedicationDispensePerformer(jsondict) - if "MedicationDispenseSubstitution" == resource_type: - from . import medicationdispense - return medicationdispense.MedicationDispenseSubstitution(jsondict) - if "MedicationIngredient" == resource_type: - from . import medication - return medication.MedicationIngredient(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 "MedicationRequestDispenseRequestInitialFill" == resource_type: - from . import medicationrequest - 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) - if "MessageDefinitionAllowedResponse" == resource_type: - from . import messagedefinition - return messagedefinition.MessageDefinitionAllowedResponse(jsondict) - if "MessageDefinitionFocus" == resource_type: - from . import messagedefinition - return messagedefinition.MessageDefinitionFocus(jsondict) - if "MessageHeader" == resource_type: - from . import messageheader - return messageheader.MessageHeader(jsondict) - if "MessageHeaderDestination" == resource_type: - from . import messageheader - return messageheader.MessageHeaderDestination(jsondict) - if "MessageHeaderResponse" == resource_type: - from . import messageheader - return messageheader.MessageHeaderResponse(jsondict) - if "MessageHeaderSource" == resource_type: - from . import messageheader - return messageheader.MessageHeaderSource(jsondict) - if "Meta" == resource_type: - from . import meta - return meta.Meta(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) - if "NamingSystem" == resource_type: - from . import namingsystem - return namingsystem.NamingSystem(jsondict) - if "NamingSystemUniqueId" == resource_type: - from . import namingsystem - return namingsystem.NamingSystemUniqueId(jsondict) - if "Narrative" == resource_type: - from . import narrative - return narrative.Narrative(jsondict) - if "NutritionOrder" == resource_type: - from . import nutritionorder - return nutritionorder.NutritionOrder(jsondict) - if "NutritionOrderEnteralFormula" == resource_type: - from . import nutritionorder - return nutritionorder.NutritionOrderEnteralFormula(jsondict) - if "NutritionOrderEnteralFormulaAdministration" == resource_type: - from . import nutritionorder - return nutritionorder.NutritionOrderEnteralFormulaAdministration(jsondict) - if "NutritionOrderOralDiet" == resource_type: - from . import nutritionorder - return nutritionorder.NutritionOrderOralDiet(jsondict) - if "NutritionOrderOralDietNutrient" == resource_type: - from . import nutritionorder - return nutritionorder.NutritionOrderOralDietNutrient(jsondict) - if "NutritionOrderOralDietTexture" == resource_type: - from . import nutritionorder - return nutritionorder.NutritionOrderOralDietTexture(jsondict) - if "NutritionOrderSupplement" == resource_type: - from . import nutritionorder - return nutritionorder.NutritionOrderSupplement(jsondict) - if "Observation" == resource_type: - from . import observation - return observation.Observation(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 "OperationDefinition" == resource_type: - from . import operationdefinition - return operationdefinition.OperationDefinition(jsondict) - if "OperationDefinitionOverload" == resource_type: - from . import operationdefinition - return operationdefinition.OperationDefinitionOverload(jsondict) - if "OperationDefinitionParameter" == resource_type: - from . import operationdefinition - return operationdefinition.OperationDefinitionParameter(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) - if "OperationOutcomeIssue" == resource_type: - from . import operationoutcome - return operationoutcome.OperationOutcomeIssue(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) - if "ParameterDefinition" == resource_type: - from . import parameterdefinition - return parameterdefinition.ParameterDefinition(jsondict) - if "Parameters" == resource_type: - from . import parameters - return parameters.Parameters(jsondict) - if "ParametersParameter" == resource_type: - from . import parameters - return parameters.ParametersParameter(jsondict) - if "Patient" == resource_type: - from . import patient - return patient.Patient(jsondict) - if "PatientCommunication" == resource_type: - from . import patient - return patient.PatientCommunication(jsondict) - if "PatientContact" == resource_type: - from . import patient - return patient.PatientContact(jsondict) - if "PatientLink" == resource_type: - from . import patient - return patient.PatientLink(jsondict) - if "PaymentNotice" == resource_type: - from . import paymentnotice - return paymentnotice.PaymentNotice(jsondict) - if "PaymentReconciliation" == resource_type: - from . import paymentreconciliation - return paymentreconciliation.PaymentReconciliation(jsondict) - if "PaymentReconciliationDetail" == resource_type: - from . import paymentreconciliation - return paymentreconciliation.PaymentReconciliationDetail(jsondict) - if "PaymentReconciliationProcessNote" == resource_type: - from . import paymentreconciliation - return paymentreconciliation.PaymentReconciliationProcessNote(jsondict) - if "Period" == resource_type: - from . import period - return period.Period(jsondict) - if "Person" == resource_type: - from . import person - return person.Person(jsondict) - if "PersonLink" == resource_type: - from . import person - return person.PersonLink(jsondict) - if "PlanDefinition" == resource_type: - from . import plandefinition - return plandefinition.PlanDefinition(jsondict) - if "PlanDefinitionAction" == resource_type: - from . import plandefinition - return plandefinition.PlanDefinitionAction(jsondict) - if "PlanDefinitionActionCondition" == resource_type: - from . import plandefinition - return plandefinition.PlanDefinitionActionCondition(jsondict) - if "PlanDefinitionActionDynamicValue" == resource_type: - from . import plandefinition - return plandefinition.PlanDefinitionActionDynamicValue(jsondict) - if "PlanDefinitionActionParticipant" == resource_type: - from . import plandefinition - return plandefinition.PlanDefinitionActionParticipant(jsondict) - if "PlanDefinitionActionRelatedAction" == resource_type: - from . import plandefinition - return plandefinition.PlanDefinitionActionRelatedAction(jsondict) - if "PlanDefinitionGoal" == resource_type: - from . import plandefinition - return plandefinition.PlanDefinitionGoal(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) - if "PractitionerQualification" == resource_type: - from . import practitioner - return practitioner.PractitionerQualification(jsondict) - if "PractitionerRole" == resource_type: - from . import practitionerrole - return practitionerrole.PractitionerRole(jsondict) - if "PractitionerRoleAvailableTime" == resource_type: - from . import practitionerrole - return practitionerrole.PractitionerRoleAvailableTime(jsondict) - if "PractitionerRoleNotAvailable" == resource_type: - from . import practitionerrole - return practitionerrole.PractitionerRoleNotAvailable(jsondict) - if "Procedure" == resource_type: - from . import procedure - return procedure.Procedure(jsondict) - if "ProcedureFocalDevice" == resource_type: - from . import procedure - return procedure.ProcedureFocalDevice(jsondict) - if "ProcedurePerformer" == resource_type: - from . import procedure - return procedure.ProcedurePerformer(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) - if "ProvenanceAgent" == resource_type: - from . import provenance - return provenance.ProvenanceAgent(jsondict) - if "ProvenanceEntity" == resource_type: - from . import provenance - return provenance.ProvenanceEntity(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 "QuestionnaireItemInitial" == resource_type: - from . import questionnaire - return questionnaire.QuestionnaireItemInitial(jsondict) - if "QuestionnaireResponse" == resource_type: - from . import questionnaireresponse - return questionnaireresponse.QuestionnaireResponse(jsondict) - if "QuestionnaireResponseItem" == resource_type: - from . import questionnaireresponse - return questionnaireresponse.QuestionnaireResponseItem(jsondict) - if "QuestionnaireResponseItemAnswer" == resource_type: - from . import questionnaireresponse - return questionnaireresponse.QuestionnaireResponseItemAnswer(jsondict) - if "Range" == resource_type: - from . import range - return range.Range(jsondict) - if "Ratio" == resource_type: - from . import ratio - return ratio.Ratio(jsondict) - if "Reference" == resource_type: - from . import reference - return reference.Reference(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) - if "RequestGroupAction" == resource_type: - from . import requestgroup - return requestgroup.RequestGroupAction(jsondict) - if "RequestGroupActionCondition" == resource_type: - from . import requestgroup - return requestgroup.RequestGroupActionCondition(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) - if "Resource" == resource_type: - from . import resource - return resource.Resource(jsondict) - if "RiskAssessment" == resource_type: - from . import riskassessment - return riskassessment.RiskAssessment(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) - if "Schedule" == resource_type: - from . import schedule - return schedule.Schedule(jsondict) - if "SearchParameter" == resource_type: - from . import searchparameter - return searchparameter.SearchParameter(jsondict) - if "SearchParameterComponent" == resource_type: - from . import searchparameter - return searchparameter.SearchParameterComponent(jsondict) - if "ServiceRequest" == resource_type: - from . import servicerequest - return servicerequest.ServiceRequest(jsondict) - if "Signature" == resource_type: - from . import signature - return signature.Signature(jsondict) - if "Slot" == resource_type: - from . import slot - return slot.Slot(jsondict) - if "Specimen" == resource_type: - from . import specimen - return specimen.Specimen(jsondict) - if "SpecimenCollection" == resource_type: - from . import specimen - return specimen.SpecimenCollection(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) - if "StructureDefinitionMapping" == resource_type: - from . import structuredefinition - return structuredefinition.StructureDefinitionMapping(jsondict) - if "StructureDefinitionSnapshot" == resource_type: - from . import structuredefinition - return structuredefinition.StructureDefinitionSnapshot(jsondict) - if "StructureMap" == resource_type: - from . import structuremap - return structuremap.StructureMap(jsondict) - if "StructureMapGroup" == resource_type: - from . import structuremap - return structuremap.StructureMapGroup(jsondict) - if "StructureMapGroupInput" == resource_type: - from . import structuremap - return structuremap.StructureMapGroupInput(jsondict) - if "StructureMapGroupRule" == resource_type: - from . import structuremap - return structuremap.StructureMapGroupRule(jsondict) - if "StructureMapGroupRuleDependent" == resource_type: - from . import structuremap - return structuremap.StructureMapGroupRuleDependent(jsondict) - if "StructureMapGroupRuleSource" == resource_type: - from . import structuremap - return structuremap.StructureMapGroupRuleSource(jsondict) - if "StructureMapGroupRuleTarget" == resource_type: - from . import structuremap - return structuremap.StructureMapGroupRuleTarget(jsondict) - if "StructureMapGroupRuleTargetParameter" == resource_type: - from . import structuremap - return structuremap.StructureMapGroupRuleTargetParameter(jsondict) - if "StructureMapStructure" == resource_type: - from . import structuremap - return structuremap.StructureMapStructure(jsondict) - if "Subscription" == resource_type: - from . import subscription - return subscription.Subscription(jsondict) - if "SubscriptionChannel" == resource_type: - from . import subscription - return subscription.SubscriptionChannel(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) - if "SupplyDeliverySuppliedItem" == resource_type: - from . import supplydelivery - return supplydelivery.SupplyDeliverySuppliedItem(jsondict) - if "SupplyRequest" == resource_type: - from . import supplyrequest - return supplyrequest.SupplyRequest(jsondict) - if "SupplyRequestParameter" == resource_type: - from . import supplyrequest - return supplyrequest.SupplyRequestParameter(jsondict) - if "Task" == resource_type: - from . import task - return task.Task(jsondict) - if "TaskInput" == resource_type: - from . import task - return task.TaskInput(jsondict) - if "TaskOutput" == resource_type: - from . import task - return task.TaskOutput(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) - if "TestReportParticipant" == resource_type: - from . import testreport - return testreport.TestReportParticipant(jsondict) - if "TestReportSetup" == resource_type: - from . import testreport - return testreport.TestReportSetup(jsondict) - if "TestReportSetupAction" == resource_type: - from . import testreport - return testreport.TestReportSetupAction(jsondict) - if "TestReportSetupActionAssert" == resource_type: - from . import testreport - return testreport.TestReportSetupActionAssert(jsondict) - if "TestReportSetupActionOperation" == resource_type: - from . import testreport - return testreport.TestReportSetupActionOperation(jsondict) - if "TestReportTeardown" == resource_type: - from . import testreport - return testreport.TestReportTeardown(jsondict) - if "TestReportTeardownAction" == resource_type: - from . import testreport - return testreport.TestReportTeardownAction(jsondict) - if "TestReportTest" == resource_type: - from . import testreport - return testreport.TestReportTest(jsondict) - if "TestReportTestAction" == resource_type: - from . import testreport - return testreport.TestReportTestAction(jsondict) - if "TestScript" == resource_type: - from . import testscript - return testscript.TestScript(jsondict) - if "TestScriptDestination" == resource_type: - from . import testscript - return testscript.TestScriptDestination(jsondict) - if "TestScriptFixture" == resource_type: - from . import testscript - return testscript.TestScriptFixture(jsondict) - if "TestScriptMetadata" == resource_type: - from . import testscript - return testscript.TestScriptMetadata(jsondict) - if "TestScriptMetadataCapability" == resource_type: - from . import testscript - return testscript.TestScriptMetadataCapability(jsondict) - if "TestScriptMetadataLink" == resource_type: - from . import testscript - return testscript.TestScriptMetadataLink(jsondict) - if "TestScriptOrigin" == resource_type: - from . import testscript - return testscript.TestScriptOrigin(jsondict) - if "TestScriptSetup" == resource_type: - from . import testscript - return testscript.TestScriptSetup(jsondict) - if "TestScriptSetupAction" == resource_type: - from . import testscript - return testscript.TestScriptSetupAction(jsondict) - if "TestScriptSetupActionAssert" == resource_type: - from . import testscript - return testscript.TestScriptSetupActionAssert(jsondict) - if "TestScriptSetupActionOperation" == resource_type: - from . import testscript - return testscript.TestScriptSetupActionOperation(jsondict) - if "TestScriptSetupActionOperationRequestHeader" == resource_type: - from . import testscript - return testscript.TestScriptSetupActionOperationRequestHeader(jsondict) - if "TestScriptTeardown" == resource_type: - from . import testscript - return testscript.TestScriptTeardown(jsondict) - if "TestScriptTeardownAction" == resource_type: - from . import testscript - return testscript.TestScriptTeardownAction(jsondict) - if "TestScriptTest" == resource_type: - from . import testscript - return testscript.TestScriptTest(jsondict) - if "TestScriptTestAction" == resource_type: - from . import testscript - return testscript.TestScriptTestAction(jsondict) - if "TestScriptVariable" == resource_type: - from . import testscript - return testscript.TestScriptVariable(jsondict) - if "Timing" == resource_type: - from . import timing - return timing.Timing(jsondict) - if "TimingRepeat" == resource_type: - from . import timing - return timing.TimingRepeat(jsondict) - if "TriggerDefinition" == resource_type: - from . import triggerdefinition - return triggerdefinition.TriggerDefinition(jsondict) - if "UsageContext" == resource_type: - from . import usagecontext - return usagecontext.UsageContext(jsondict) - if "ValueSet" == resource_type: - from . import valueset - return valueset.ValueSet(jsondict) - if "ValueSetCompose" == resource_type: - from . import valueset - return valueset.ValueSetCompose(jsondict) - if "ValueSetComposeInclude" == resource_type: - from . import valueset - return valueset.ValueSetComposeInclude(jsondict) - if "ValueSetComposeIncludeConcept" == resource_type: - from . import valueset - return valueset.ValueSetComposeIncludeConcept(jsondict) - if "ValueSetComposeIncludeConceptDesignation" == resource_type: - from . import valueset - return valueset.ValueSetComposeIncludeConceptDesignation(jsondict) - if "ValueSetComposeIncludeFilter" == resource_type: - from . import valueset - return valueset.ValueSetComposeIncludeFilter(jsondict) - if "ValueSetExpansion" == resource_type: - from . import valueset - return valueset.ValueSetExpansion(jsondict) - if "ValueSetExpansionContains" == resource_type: - from . import valueset - return valueset.ValueSetExpansionContains(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 "VisionPrescriptionLensSpecification" == resource_type: - from . import visionprescription - return visionprescription.VisionPrescriptionLensSpecification(jsondict) - if "VisionPrescriptionLensSpecificationPrism" == resource_type: - from . import visionprescription - return visionprescription.VisionPrescriptionLensSpecificationPrism(jsondict) - from . import element - return element.Element(jsondict) diff --git a/fhirclient/models/flag.py b/fhirclient/models/flag.py deleted file mode 100644 index 5c76ae4c1..000000000 --- a/fhirclient/models/flag.py +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Flag) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class Flag(domainresource.DomainResource): - """ Key information to flag to healthcare providers. - - Prospective warnings of potential issues when providing care to the - patient. - """ - - resource_type = "Flag" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Flag creator. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.category = None - """ Clinical, administrative, etc.. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.code = None - """ Coded or textual message to display to user. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.encounter = None - """ Alert relevant during encounter. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.identifier = None - """ Business identifier. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.period = None - """ Time period when flag is active. - Type `Period` (represented as `dict` in JSON). """ - - self.status = None - """ active | inactive | entered-in-error. - Type `str`. """ - - self.subject = None - """ Who/What is flag about?. - Type `FHIRReference` (represented as `dict` in JSON). """ - - super(Flag, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Flag, self).elementProperties() - js.extend([ - ("author", "author", fhirreference.FHIRReference, 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), - ("period", "period", period.Period, False, None, False), - ("status", "status", str, False, None, True), - ("subject", "subject", fhirreference.FHIRReference, 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 period -except ImportError: - period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/flag_tests.py b/fhirclient/models/flag_tests.py deleted file mode 100644 index 624deee6e..000000000 --- a/fhirclient/models/flag_tests.py +++ /dev/null @@ -1,80 +0,0 @@ -#!/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 flag -from .fhirdate import FHIRDate - - -class FlagTests(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("Flag", js["resourceType"]) - return flag.Flag(js) - - def testFlag1(self): - inst = self.instantiate_from("flag-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Flag instance") - self.implFlag1(inst) - - js = inst.as_json() - self.assertEqual("Flag", js["resourceType"]) - inst2 = flag.Flag(js) - self.implFlag1(inst2) - - def implFlag1(self, inst): - 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) - self.assertEqual(inst.period.start.as_json(), "2015-01-17") - 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 deleted file mode 100644 index 432b1f576..000000000 --- a/fhirclient/models/goal.py +++ /dev/null @@ -1,238 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Goal) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class Goal(domainresource.DomainResource): - """ Describes the intended objective(s) for a patient, group or organization. - - Describes the intended objective(s) for a patient, group or organization - care, for example, weight loss, restoring an activity of daily living, - obtaining herd immunity via immunization, meeting a process improvement - objective, etc. - """ - - resource_type = "Goal" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :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 (represented as `dict` in JSON). """ - - self.category = None - """ E.g. Treatment, dietary, behavioral, etc.. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.description = None - """ Code or text describing goal. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.expressedBy = None - """ Who's responsible for creating Goal?. - 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). """ - - self.outcomeCode = None - """ What result was achieved regarding the goal?. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.outcomeReference = None - """ Observation that resulted from goal. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.priority = None - """ high-priority | medium-priority | low-priority. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.startCodeableConcept = None - """ When goal pursuit begins. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.startDate = None - """ When goal pursuit begins. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.statusDate = None - """ When goal status took effect. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.statusReason = None - """ Reason for current status. - Type `str`. """ - - self.subject = None - """ Who this goal is intended for. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.target = None - """ Target outcome for the goal. - 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), - ("statusDate", "statusDate", fhirdate.FHIRDate, False, None, False), - ("statusReason", "statusReason", str, False, None, False), - ("subject", "subject", fhirreference.FHIRReference, False, None, True), - ("target", "target", GoalTarget, True, None, False), - ]) - return js - - -from . import backboneelement - -class GoalTarget(backboneelement.BackboneElement): - """ Target outcome for the goal. - - Indicates what should be done by when. - """ - - resource_type = "GoalTarget" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :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). """ - - self.detailRange = None - """ 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). """ - - self.dueDuration = None - """ Reach goal on or before. - Type `Duration` (represented as `dict` in JSON). """ - - self.measure = None - """ The parameter whose value is being tracked. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(GoalTarget, self).__init__(jsondict=jsondict, strict=strict) - - 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), - ]) - 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 duration -except ImportError: - duration = sys.modules[__package__ + '.duration'] -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/goal_tests.py b/fhirclient/models/goal_tests.py deleted file mode 100644 index 3f39c17ae..000000000 --- a/fhirclient/models/goal_tests.py +++ /dev/null @@ -1,97 +0,0 @@ -#!/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 goal -from .fhirdate import FHIRDate - - -class GoalTests(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("Goal", js["resourceType"]) - return goal.Goal(js) - - def testGoal1(self): - inst = self.instantiate_from("goal-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Goal instance") - self.implGoal1(inst) - - js = inst.as_json() - self.assertEqual("Goal", js["resourceType"]) - inst2 = goal.Goal(js) - self.implGoal1(inst2) - - def implGoal1(self, inst): - 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.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.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-stop-smoking.json") - self.assertIsNotNone(inst, "Must have instantiated a Goal instance") - self.implGoal2(inst) - - js = inst.as_json() - self.assertEqual("Goal", js["resourceType"]) - inst2 = goal.Goal(js) - self.implGoal2(inst2) - - def implGoal2(self, inst): - 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.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.text.status, "additional") - diff --git a/fhirclient/models/graphdefinition.py b/fhirclient/models/graphdefinition.py deleted file mode 100644 index 5e6832e30..000000000 --- a/fhirclient/models/graphdefinition.py +++ /dev/null @@ -1,280 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# 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 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 - Graph Definition resource defines a set and makes rules about the set. - """ - - resource_type = "GraphDefinition" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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.date = None - """ Date last changed. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.description = None - """ Natural language description of the graph definition. - Type `str`. """ - - self.experimental = None - """ For testing purposes, not real usage. - Type `bool`. """ - - self.jurisdiction = None - """ Intended jurisdiction for graph definition (if applicable). - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.link = None - """ Links this graph makes rules about. - List of `GraphDefinitionLink` items (represented as `dict` in JSON). """ - - self.name = None - """ Name for this graph definition (computer friendly). - Type `str`. """ - - self.profile = None - """ Profile on base resource. - Type `str`. """ - - self.publisher = None - """ Name of the publisher (organization or individual). - Type `str`. """ - - self.purpose = None - """ Why this graph definition is defined. - Type `str`. """ - - self.start = None - """ Type of resource at which the graph starts. - Type `str`. """ - - self.status = None - """ draft | active | retired | unknown. - Type `str`. """ - - self.url = None - """ Canonical identifier for this graph 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 graph definition. - Type `str`. """ - - super(GraphDefinition, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(GraphDefinition, self).elementProperties() - js.extend([ - ("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), - ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), - ("link", "link", GraphDefinitionLink, True, None, False), - ("name", "name", str, False, None, True), - ("profile", "profile", str, False, None, False), - ("publisher", "publisher", str, False, None, False), - ("purpose", "purpose", str, False, None, False), - ("start", "start", str, False, None, True), - ("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 GraphDefinitionLink(backboneelement.BackboneElement): - """ Links this graph makes rules about. - """ - - resource_type = "GraphDefinitionLink" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Why this link is specified. - Type `str`. """ - - self.max = None - """ Maximum occurrences for this link. - Type `str`. """ - - self.min = None - """ Minimum occurrences for this link. - Type `int`. """ - - self.path = None - """ Path in the resource that contains the link. - Type `str`. """ - - self.sliceName = None - """ Which slice (if profiled). - Type `str`. """ - - self.target = None - """ Potential target for the link. - List of `GraphDefinitionLinkTarget` items (represented as `dict` in JSON). """ - - super(GraphDefinitionLink, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(GraphDefinitionLink, self).elementProperties() - js.extend([ - ("description", "description", str, False, None, False), - ("max", "max", str, False, None, False), - ("min", "min", int, False, None, False), - ("path", "path", str, False, None, False), - ("sliceName", "sliceName", str, False, None, False), - ("target", "target", GraphDefinitionLinkTarget, True, None, False), - ]) - return js - - -class GraphDefinitionLinkTarget(backboneelement.BackboneElement): - """ Potential target for the link. - """ - - resource_type = "GraphDefinitionLinkTarget" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.compartment = None - """ Compartment Consistency Rules. - List of `GraphDefinitionLinkTargetCompartment` items (represented as `dict` in JSON). """ - - self.link = None - """ 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`. """ - - self.type = None - """ Type of resource this link refers to. - Type `str`. """ - - super(GraphDefinitionLinkTarget, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(GraphDefinitionLinkTarget, self).elementProperties() - 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), - ]) - return js - - -class GraphDefinitionLinkTargetCompartment(backboneelement.BackboneElement): - """ Compartment Consistency Rules. - """ - - resource_type = "GraphDefinitionLinkTargetCompartment" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Identifies the compartment. - Type `str`. """ - - self.description = None - """ Documentation for FHIRPath expression. - Type `str`. """ - - self.expression = None - """ Custom rule, as a FHIRPath expression. - Type `str`. """ - - self.rule = None - """ identical | matching | different | custom. - Type `str`. """ - - self.use = None - """ condition | requirement. - Type `str`. """ - - super(GraphDefinitionLinkTargetCompartment, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(GraphDefinitionLinkTargetCompartment, self).elementProperties() - js.extend([ - ("code", "code", str, False, None, True), - ("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 - - -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/graphdefinition_tests.py b/fhirclient/models/graphdefinition_tests.py deleted file mode 100644 index 5c147c2f8..000000000 --- a/fhirclient/models/graphdefinition_tests.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/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 graphdefinition -from .fhirdate import FHIRDate - - -class GraphDefinitionTests(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("GraphDefinition", js["resourceType"]) - return graphdefinition.GraphDefinition(js) - - def testGraphDefinition1(self): - inst = self.instantiate_from("graphdefinition-example.json") - self.assertIsNotNone(inst, "Must have instantiated a GraphDefinition instance") - self.implGraphDefinition1(inst) - - js = inst.as_json() - self.assertEqual("GraphDefinition", js["resourceType"]) - inst2 = graphdefinition.GraphDefinition(js) - self.implGraphDefinition1(inst2) - - def implGraphDefinition1(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.date.date, FHIRDate("2015-08-04").date) - self.assertEqual(inst.date.as_json(), "2015-08-04") - self.assertEqual(inst.description, "Specify to include list references when generating a document using the $document operation") - self.assertEqual(inst.id, "example") - self.assertEqual(inst.link[0].description, "Link to List") - 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") - self.assertEqual(inst.publisher, "FHIR Project") - self.assertEqual(inst.start, "Composition") - self.assertEqual(inst.status, "draft") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.url, "http://h7.org/fhir/GraphDefinition/example") - diff --git a/fhirclient/models/group.py b/fhirclient/models/group.py deleted file mode 100644 index 08eda14cd..000000000 --- a/fhirclient/models/group.py +++ /dev/null @@ -1,220 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Group) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -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 - not formally or legally recognized; i.e. a collection of entities that - isn't an Organization. - """ - - resource_type = "Group" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 group's record is in active use. - Type `bool`. """ - - self.actual = None - """ Descriptive or actual. - Type `bool`. """ - - self.characteristic = None - """ Include / Exclude group members by Trait. - List of `GroupCharacteristic` items (represented as `dict` in JSON). """ - - self.code = None - """ Kind of Group members. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.identifier = None - """ 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). """ - - self.name = None - """ Label for Group. - Type `str`. """ - - self.quantity = None - """ Number of members. - Type `int`. """ - - self.type = None - """ person | animal | practitioner | device | medication | substance. - Type `str`. """ - - super(Group, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Group, self).elementProperties() - js.extend([ - ("active", "active", bool, False, None, False), - ("actual", "actual", bool, False, None, True), - ("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), - ("type", "type", str, False, None, True), - ]) - return js - - -from . import backboneelement - -class GroupCharacteristic(backboneelement.BackboneElement): - """ Include / Exclude group members by Trait. - - Identifies traits whose presence r absence is shared by members of the - group. - """ - - resource_type = "GroupCharacteristic" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Kind of characteristic. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.exclude = None - """ Group includes or excludes. - Type `bool`. """ - - self.period = None - """ Period over which characteristic is tested. - Type `Period` (represented as `dict` in JSON). """ - - self.valueBoolean = None - """ Value held by characteristic. - Type `bool`. """ - - self.valueCodeableConcept = None - """ Value held by characteristic. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.valueQuantity = None - """ Value held by characteristic. - Type `Quantity` (represented as `dict` in JSON). """ - - self.valueRange = None - """ 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): - js = super(GroupCharacteristic, self).elementProperties() - js.extend([ - ("code", "code", codeableconcept.CodeableConcept, False, None, True), - ("exclude", "exclude", bool, False, None, True), - ("period", "period", period.Period, False, None, False), - ("valueBoolean", "valueBoolean", bool, False, "value", True), - ("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 - - -class GroupMember(backboneelement.BackboneElement): - """ Who or what is in group. - - Identifies the resource instances that are members of the group. - """ - - resource_type = "GroupMember" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.entity = None - """ Reference to the group member. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.inactive = None - """ If member is no longer in group. - Type `bool`. """ - - self.period = None - """ Period member belonged to the group. - Type `Period` (represented as `dict` in JSON). """ - - super(GroupMember, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(GroupMember, self).elementProperties() - js.extend([ - ("entity", "entity", fhirreference.FHIRReference, False, None, True), - ("inactive", "inactive", bool, False, None, False), - ("period", "period", period.Period, 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 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'] diff --git a/fhirclient/models/group_tests.py b/fhirclient/models/group_tests.py deleted file mode 100644 index 1c7b47599..000000000 --- a/fhirclient/models/group_tests.py +++ /dev/null @@ -1,139 +0,0 @@ -#!/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 group -from .fhirdate import FHIRDate - - -class GroupTests(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("Group", js["resourceType"]) - return group.Group(js) - - def testGroup1(self): - inst = self.instantiate_from("group-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Group instance") - self.implGroup1(inst) - - js = inst.as_json() - self.assertEqual("Group", js["resourceType"]) - inst2 = group.Group(js) - 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) - self.assertEqual(inst.member[0].period.start.as_json(), "2014-10-08") - self.assertTrue(inst.member[1].inactive) - self.assertEqual(inst.member[1].period.start.date, FHIRDate("2015-04-02").date) - self.assertEqual(inst.member[1].period.start.as_json(), "2015-04-02") - self.assertEqual(inst.member[2].period.start.date, FHIRDate("2015-08-06").date) - 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 testGroup3(self): - inst = self.instantiate_from("group-example-patientlist.json") - self.assertIsNotNone(inst, "Must have instantiated a Group instance") - self.implGroup3(inst) - - js = inst.as_json() - self.assertEqual("Group", js["resourceType"]) - inst2 = group.Group(js) - self.implGroup3(inst2) - - def implGroup3(self, inst): - self.assertTrue(inst.actual) - 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.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 deleted file mode 100644 index 9cf35993c..000000000 --- a/fhirclient/models/guidanceresponse.py +++ /dev/null @@ -1,147 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/GuidanceResponse) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class GuidanceResponse(domainresource.DomainResource): - """ The formal response to a guidance request. - - A guidance response is the formal response to a guidance request, including - any output parameters returned by the evaluation, as well as the - description of any proposed actions to be taken. - """ - - resource_type = "GuidanceResponse" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - 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 (represented as `dict` in JSON). """ - - self.identifier = None - """ Business identifier. - List of `Identifier` items (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. - List of `Annotation` items (represented as `dict` in JSON). """ - - self.occurrenceDateTime = None - """ When the guidance response was processed. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.outputParameters = None - """ The output parameters of the evaluation, if any. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.performer = None - """ Device returning the guidance. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.reasonCode = None - """ Why guidance is needed. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.reasonReference = None - """ Why guidance is needed. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - 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` (represented as `dict` in JSON). """ - - self.status = None - """ success | data-requested | data-required | in-progress | failure | - entered-in-error. - Type `str`. """ - - self.subject = None - """ Patient the request was performed for. - 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([ - ("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, 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), - ("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), - ]) - 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 datarequirement -except ImportError: - datarequirement = sys.modules[__package__ + '.datarequirement'] -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/guidanceresponse_tests.py b/fhirclient/models/guidanceresponse_tests.py deleted file mode 100644 index d53054eb0..000000000 --- a/fhirclient/models/guidanceresponse_tests.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/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 guidanceresponse -from .fhirdate import FHIRDate - - -class GuidanceResponseTests(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("GuidanceResponse", js["resourceType"]) - return guidanceresponse.GuidanceResponse(js) - - def testGuidanceResponse1(self): - inst = self.instantiate_from("guidanceresponse-example.json") - self.assertIsNotNone(inst, "Must have instantiated a GuidanceResponse instance") - self.implGuidanceResponse1(inst) - - js = inst.as_json() - self.assertEqual("GuidanceResponse", js["resourceType"]) - inst2 = guidanceresponse.GuidanceResponse(js) - self.implGuidanceResponse1(inst2) - - def implGuidanceResponse1(self, inst): - self.assertEqual(inst.contained[0].id, "outputParameters1") - self.assertEqual(inst.id, "example") - 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.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 deleted file mode 100644 index 08be149b9..000000000 --- a/fhirclient/models/healthcareservice.py +++ /dev/null @@ -1,303 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/HealthcareService) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class HealthcareService(domainresource.DomainResource): - """ The details of a healthcare service available at a location. - """ - - resource_type = "HealthcareService" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 HealthcareService record is in active use. - Type `bool`. """ - - self.appointmentRequired = None - """ If an appointment is required for access to this service. - Type `bool`. """ - - self.availabilityExceptions = None - """ Description of availability exceptions. - Type `str`. """ - - self.availableTime = None - """ Times the Service Site is available. - List of `HealthcareServiceAvailableTime` items (represented as `dict` in JSON). """ - - self.category = None - """ Broad category of service being performed or delivered. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.characteristic = None - """ Collection of characteristics (attributes). - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.comment = None - """ Additional description and/or any specific issues not covered - 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 intended for/available to. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.eligibility = None - """ Specific eligibility requirements required to use the service. - List of `HealthcareServiceEligibility` items (represented as `dict` in JSON). """ - - self.endpoint = None - """ 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 - fields. - Type `str`. """ - - self.identifier = None - """ External identifiers for this item. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.location = None - """ Location(s) where service may be provided. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.name = None - """ Description of service as presented to a consumer while searching. - Type `str`. """ - - self.notAvailable = None - """ Not available during this time due to provided reason. - List of `HealthcareServiceNotAvailable` items (represented as `dict` in JSON). """ - - self.photo = None - """ Facilitates quick identification of the service. - Type `Attachment` (represented as `dict` in JSON). """ - - 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` (represented as `dict` in JSON). """ - - self.referralMethod = None - """ Ways that the service accepts referrals. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.serviceProvisionCode = None - """ Conditions under which service is available/offered. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.specialty = None - """ Specialties handled by the HealthcareService. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.telecom = None - """ Contacts related to the healthcare service. - List of `ContactPoint` items (represented as `dict` in JSON). """ - - self.type = None - """ Type of service that may be delivered or performed. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - super(HealthcareService, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(HealthcareService, self).elementProperties() - js.extend([ - ("active", "active", bool, False, None, False), - ("appointmentRequired", "appointmentRequired", bool, False, None, False), - ("availabilityExceptions", "availabilityExceptions", str, False, None, False), - ("availableTime", "availableTime", HealthcareServiceAvailableTime, True, 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", HealthcareServiceEligibility, True, None, False), - ("endpoint", "endpoint", fhirreference.FHIRReference, True, None, False), - ("extraDetails", "extraDetails", str, False, None, False), - ("identifier", "identifier", identifier.Identifier, True, None, False), - ("location", "location", fhirreference.FHIRReference, True, None, False), - ("name", "name", str, False, None, False), - ("notAvailable", "notAvailable", HealthcareServiceNotAvailable, True, None, False), - ("photo", "photo", attachment.Attachment, False, 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), - ("specialty", "specialty", codeableconcept.CodeableConcept, True, None, False), - ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), - ("type", "type", codeableconcept.CodeableConcept, True, None, False), - ]) - return js - - -from . import backboneelement - -class HealthcareServiceAvailableTime(backboneelement.BackboneElement): - """ Times the Service Site is available. - - A collection of times that the Service Site is available. - """ - - resource_type = "HealthcareServiceAvailableTime" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Always available? e.g. 24 hour service. - Type `bool`. """ - - self.availableEndTime = None - """ Closing time of day (ignored if allDay = true). - Type `FHIRDate` (represented as `str` in JSON). """ - - self.availableStartTime = None - """ Opening time of day (ignored if allDay = true). - Type `FHIRDate` (represented as `str` in JSON). """ - - self.daysOfWeek = None - """ mon | tue | wed | thu | fri | sat | sun. - List of `str` items. """ - - super(HealthcareServiceAvailableTime, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(HealthcareServiceAvailableTime, self).elementProperties() - js.extend([ - ("allDay", "allDay", bool, False, None, False), - ("availableEndTime", "availableEndTime", fhirdate.FHIRDate, False, None, False), - ("availableStartTime", "availableStartTime", fhirdate.FHIRDate, False, None, False), - ("daysOfWeek", "daysOfWeek", str, True, None, False), - ]) - 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. - - The HealthcareService is not available during this period of time due to - the provided reason. - """ - - resource_type = "HealthcareServiceNotAvailable" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Reason presented to the user explaining why time not available. - Type `str`. """ - - self.during = None - """ Service not available from this date. - Type `Period` (represented as `dict` in JSON). """ - - super(HealthcareServiceNotAvailable, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(HealthcareServiceNotAvailable, self).elementProperties() - js.extend([ - ("description", "description", str, False, None, True), - ("during", "during", period.Period, 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 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: - 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/healthcareservice_tests.py b/fhirclient/models/healthcareservice_tests.py deleted file mode 100644 index e1825fd65..000000000 --- a/fhirclient/models/healthcareservice_tests.py +++ /dev/null @@ -1,108 +0,0 @@ -#!/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 healthcareservice -from .fhirdate import FHIRDate - - -class HealthcareServiceTests(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("HealthcareService", js["resourceType"]) - return healthcareservice.HealthcareService(js) - - def testHealthcareService1(self): - inst = self.instantiate_from("healthcareservice-example.json") - self.assertIsNotNone(inst, "Must have instantiated a HealthcareService instance") - self.implHealthcareService1(inst) - - js = inst.as_json() - self.assertEqual("HealthcareService", js["resourceType"]) - inst2 = healthcareservice.HealthcareService(js) - self.implHealthcareService1(inst2) - - def implHealthcareService1(self, inst): - self.assertTrue(inst.active) - self.assertFalse(inst.appointmentRequired) - self.assertEqual(inst.availabilityExceptions, "Reduced capacity is available during the Christmas period") - self.assertTrue(inst.availableTime[0].allDay) - self.assertEqual(inst.availableTime[0].daysOfWeek[0], "wed") - self.assertEqual(inst.availableTime[1].availableEndTime.date, FHIRDate("05:30:00").date) - self.assertEqual(inst.availableTime[1].availableEndTime.as_json(), "05:30:00") - self.assertEqual(inst.availableTime[1].availableStartTime.date, FHIRDate("08:30:00").date) - self.assertEqual(inst.availableTime[1].availableStartTime.as_json(), "08:30:00") - self.assertEqual(inst.availableTime[1].daysOfWeek[0], "mon") - self.assertEqual(inst.availableTime[1].daysOfWeek[1], "tue") - self.assertEqual(inst.availableTime[1].daysOfWeek[2], "thu") - self.assertEqual(inst.availableTime[1].daysOfWeek[3], "fri") - self.assertEqual(inst.availableTime[2].availableEndTime.date, FHIRDate("04:30:00").date) - self.assertEqual(inst.availableTime[2].availableEndTime.as_json(), "04:30:00") - self.assertEqual(inst.availableTime[2].availableStartTime.date, FHIRDate("09:30:00").date) - 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[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[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) - self.assertEqual(inst.notAvailable[0].during.end.as_json(), "2015-12-26") - self.assertEqual(inst.notAvailable[0].during.start.date, FHIRDate("2015-12-25").date) - self.assertEqual(inst.notAvailable[0].during.start.as_json(), "2015-12-25") - self.assertEqual(inst.notAvailable[1].description, "New Years Day") - self.assertEqual(inst.notAvailable[1].during.end.date, FHIRDate("2016-01-01").date) - 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.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") - self.assertEqual(inst.referralMethod[1].coding[0].display, "Fax") - self.assertEqual(inst.referralMethod[2].coding[0].code, "elec") - self.assertEqual(inst.referralMethod[2].coding[0].display, "Secure Messaging") - self.assertEqual(inst.referralMethod[3].coding[0].code, "semail") - 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://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") - self.assertEqual(inst.telecom[0].system, "phone") - self.assertEqual(inst.telecom[0].use, "work") - self.assertEqual(inst.telecom[0].value, "(555) silent") - self.assertEqual(inst.telecom[1].system, "email") - self.assertEqual(inst.telecom[1].use, "work") - self.assertEqual(inst.telecom[1].value, "directaddress@example.com") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type[0].coding[0].code, "394913002") - self.assertEqual(inst.type[0].coding[0].display, "Psychotherapy") - self.assertEqual(inst.type[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.type[1].coding[0].code, "394587001") - self.assertEqual(inst.type[1].coding[0].display, "Psychiatry") - self.assertEqual(inst.type[1].coding[0].system, "http://snomed.info/sct") - diff --git a/fhirclient/models/humanname.py b/fhirclient/models/humanname.py deleted file mode 100644 index 18b0d0d78..000000000 --- a/fhirclient/models/humanname.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/HumanName) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import element - -class HumanName(element.Element): - """ Name of a human - parts and usage. - - A human's name with the ability to identify parts and usage. - """ - - resource_type = "HumanName" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.family = None - """ Family name (often called 'Surname'). - Type `str`. """ - - self.given = None - """ Given names (not always 'first'). Includes middle names. - List of `str` items. """ - - self.period = None - """ Time period when name was/is in use. - Type `Period` (represented as `dict` in JSON). """ - - self.prefix = None - """ Parts that come before the name. - List of `str` items. """ - - self.suffix = None - """ Parts that come after the name. - List of `str` items. """ - - self.text = None - """ Text representation of the full name. - Type `str`. """ - - self.use = None - """ usual | official | temp | nickname | anonymous | old | maiden. - Type `str`. """ - - super(HumanName, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(HumanName, self).elementProperties() - js.extend([ - ("family", "family", str, False, None, False), - ("given", "given", str, True, None, False), - ("period", "period", period.Period, False, None, False), - ("prefix", "prefix", str, True, None, False), - ("suffix", "suffix", str, True, None, False), - ("text", "text", str, False, None, False), - ("use", "use", str, False, None, False), - ]) - return js - - -import sys -try: - from . import period -except ImportError: - period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/identifier.py b/fhirclient/models/identifier.py deleted file mode 100644 index 4cb86f75a..000000000 --- a/fhirclient/models/identifier.py +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Identifier) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import element - -class Identifier(element.Element): - """ An identifier intended for computation. - - An identifier - identifies some entity uniquely and unambiguously. - Typically this is used for business identifiers. - """ - - resource_type = "Identifier" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.assigner = None - """ Organization that issued id (may be just text). - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.period = None - """ Time period when id is/was valid for use. - Type `Period` (represented as `dict` in JSON). """ - - self.system = None - """ The namespace for the identifier value. - Type `str`. """ - - self.type = None - """ Description of identifier. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.use = None - """ usual | official | temp | secondary | old (If known). - Type `str`. """ - - self.value = None - """ The value that is unique. - Type `str`. """ - - super(Identifier, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Identifier, self).elementProperties() - js.extend([ - ("assigner", "assigner", fhirreference.FHIRReference, False, None, False), - ("period", "period", period.Period, False, None, False), - ("system", "system", str, False, None, False), - ("type", "type", codeableconcept.CodeableConcept, False, None, False), - ("use", "use", str, False, None, False), - ("value", "value", str, 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 period -except ImportError: - period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/imagingstudy.py b/fhirclient/models/imagingstudy.py deleted file mode 100644 index e73275e44..000000000 --- a/fhirclient/models/imagingstudy.py +++ /dev/null @@ -1,332 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ImagingStudy) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class ImagingStudy(domainresource.DomainResource): - """ A set of images produced in single study (one or more series of references - images). - - Representation of the content produced in a DICOM imaging study. A study - comprises a set of series, each of which includes a set of Service-Object - Pair Instances (SOP Instances - images or other data) acquired or produced - in a common context. A series is of only one modality (e.g. X-ray, CT, MR, - ultrasound), but a study may have multiple series of different modalities. - """ - - resource_type = "ImagingStudy" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.basedOn = None - """ Request fulfilled. - 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 (represented as `dict` in JSON). """ - - self.identifier = None - """ Identifiers for the whole study. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.interpreter = None - """ Who interpreted images. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.location = None - """ Where ImagingStudy occurred. - Type `FHIRReference` (represented as `dict` in JSON). """ - - 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`. """ - - self.numberOfSeries = None - """ Number of Study Related Series. - Type `int`. """ - - self.procedureCode = None - """ The performed procedure code. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.procedureReference = None - """ The performed Procedure reference. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.reasonCode = None - """ Why the study was requested. - 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` (represented as `dict` in JSON). """ - - self.series = None - """ Each study has one or more series of instances. - List of `ImagingStudySeries` items (represented as `dict` in JSON). """ - - self.started = None - """ When the study was started. - Type `FHIRDate` (represented as `str` in JSON). """ - - 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([ - ("basedOn", "basedOn", fhirreference.FHIRReference, True, 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), - ("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), - ("procedureCode", "procedureCode", codeableconcept.CodeableConcept, True, 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), - ("status", "status", str, False, None, True), - ("subject", "subject", fhirreference.FHIRReference, False, None, True), - ]) - return js - - -from . import backboneelement - -class ImagingStudySeries(backboneelement.BackboneElement): - """ Each study has one or more series of instances. - - Each study has one or more series of images or other content. - """ - - resource_type = "ImagingStudySeries" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.bodySite = None - """ Body part examined. - Type `Coding` (represented as `dict` in JSON). """ - - self.description = None - """ A short human readable summary of the series. - Type `str`. """ - - self.endpoint = None - """ Series access endpoint. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.instance = None - """ A single SOP instance from the series. - List of `ImagingStudySeriesInstance` items (represented as `dict` in JSON). """ - - self.laterality = None - """ Body part laterality. - Type `Coding` (represented as `dict` in JSON). """ - - self.modality = None - """ The modality of the instances in the series. - Type `Coding` (represented as `dict` in JSON). """ - - self.number = None - """ Numeric identifier of this series. - Type `int`. """ - - self.numberOfInstances = None - """ Number of Series Related Instances. - Type `int`. """ - - self.performer = None - """ Who performed the series. - 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 - """ DICOM Series Instance UID for the series. - Type `str`. """ - - super(ImagingStudySeries, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ImagingStudySeries, self).elementProperties() - js.extend([ - ("bodySite", "bodySite", coding.Coding, False, None, False), - ("description", "description", str, False, None, False), - ("endpoint", "endpoint", fhirreference.FHIRReference, True, None, False), - ("instance", "instance", ImagingStudySeriesInstance, True, None, False), - ("laterality", "laterality", coding.Coding, False, None, False), - ("modality", "modality", coding.Coding, False, None, True), - ("number", "number", int, False, None, False), - ("numberOfInstances", "numberOfInstances", int, False, 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), - ]) - return js - - -class ImagingStudySeriesInstance(backboneelement.BackboneElement): - """ A single SOP instance from the series. - - A single SOP instance within the series, e.g. an image, or presentation - state. - """ - - resource_type = "ImagingStudySeriesInstance" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.number = None - """ The number of this instance in the series. - Type `int`. """ - - self.sopClass = None - """ DICOM class type. - Type `Coding` (represented as `dict` in JSON). """ - - self.title = None - """ Description of instance. - Type `str`. """ - - self.uid = None - """ DICOM SOP Instance UID. - Type `str`. """ - - super(ImagingStudySeriesInstance, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ImagingStudySeriesInstance, self).elementProperties() - js.extend([ - ("number", "number", int, False, None, False), - ("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: - 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'] diff --git a/fhirclient/models/imagingstudy_tests.py b/fhirclient/models/imagingstudy_tests.py deleted file mode 100644 index e4cbf30fb..000000000 --- a/fhirclient/models/imagingstudy_tests.py +++ /dev/null @@ -1,129 +0,0 @@ -#!/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 imagingstudy -from .fhirdate import FHIRDate - - -class ImagingStudyTests(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("ImagingStudy", js["resourceType"]) - return imagingstudy.ImagingStudy(js) - - def testImagingStudy1(self): - inst = self.instantiate_from("imagingstudy-example-xr.json") - self.assertIsNotNone(inst, "Must have instantiated a ImagingStudy instance") - self.implImagingStudy1(inst) - - js = inst.as_json() - self.assertEqual("ImagingStudy", js["resourceType"]) - inst2 = imagingstudy.ImagingStudy(js) - self.implImagingStudy1(inst2) - - def implImagingStudy1(self, inst): - self.assertEqual(inst.id, "example-xr") - 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.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.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, "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.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, "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") - self.assertEqual(inst.series[0].modality.code, "DX") - 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, "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") - - def testImagingStudy2(self): - inst = self.instantiate_from("imagingstudy-example.json") - self.assertIsNotNone(inst, "Must have instantiated a ImagingStudy instance") - self.implImagingStudy2(inst) - - js = inst.as_json() - self.assertEqual("ImagingStudy", js["resourceType"]) - inst2 = imagingstudy.ImagingStudy(js) - self.implImagingStudy2(inst2) - - 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") - self.assertEqual(inst.series[0].bodySite.display, "Upper Trunk Structure") - 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.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, "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") - diff --git a/fhirclient/models/immunization.py b/fhirclient/models/immunization.py deleted file mode 100644 index 1c693f2ff..000000000 --- a/fhirclient/models/immunization.py +++ /dev/null @@ -1,390 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Immunization) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class Immunization(domainresource.DomainResource): - """ Immunization event information. - - 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" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 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 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.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 immunization occurred. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.lotNumber = None - """ Vaccine lot number. - Type `str`. """ - - self.manufacturer = None - """ Vaccine manufacturer. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.note = None - """ 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` (represented as `dict` in JSON). """ - - self.performer = None - """ Who performed event. - 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). """ - - self.route = None - """ How vaccine entered body. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.site = None - """ Body site vaccine was administered. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.status = None - """ completed | entered-in-error | not-done. - Type `str`. """ - - 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. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(Immunization, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Immunization, self).elementProperties() - js.extend([ - ("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), - ("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), - ("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), - ("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), - ("statusReason", "statusReason", codeableconcept.CodeableConcept, False, None, False), - ("subpotentReason", "subpotentReason", codeableconcept.CodeableConcept, True, None, False), - ("vaccineCode", "vaccineCode", codeableconcept.CodeableConcept, False, None, True), - ]) - return js - - -from . import backboneelement - -class ImmunizationEducation(backboneelement.BackboneElement): - """ Educational material presented to patient. - - Educational material presented to the patient (or guardian) at the time of - vaccine administration. - """ - - resource_type = "ImmunizationEducation" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.documentType = None - """ Educational material document identifier. - Type `str`. """ - - 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(ImmunizationEducation, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ImmunizationEducation, self).elementProperties() - js.extend([ - ("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 ImmunizationPerformer(backboneelement.BackboneElement): - """ Who performed event. - - Indicates who performed the immunization event. - """ - - resource_type = "ImmunizationPerformer" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 or organization who was performing. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.function = None - """ What type of performance was done. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(ImmunizationPerformer, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ImmunizationPerformer, self).elementProperties() - js.extend([ - ("actor", "actor", fhirreference.FHIRReference, False, None, True), - ("function", "function", codeableconcept.CodeableConcept, False, None, False), - ]) - return js - - -class ImmunizationProtocolApplied(backboneelement.BackboneElement): - """ Protocol followed by the provider. - - The protocol (set of recommendations) being followed by the provider who - administered the dose. - """ - - resource_type = "ImmunizationProtocolApplied" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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.doseNumberPositiveInt = None - """ Dose number within series. - Type `int`. """ - - self.doseNumberString = None - """ Dose number within series. - Type `str`. """ - - 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(ImmunizationProtocolApplied, self).elementProperties() - js.extend([ - ("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 ImmunizationReaction(backboneelement.BackboneElement): - """ Details of a reaction that follows immunization. - - Categorical data indicating that an adverse event is associated in time to - an immunization. - """ - - resource_type = "ImmunizationReaction" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ When reaction started. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.detail = None - """ Additional information on reaction. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.reported = None - """ Indicates self-reported reaction. - Type `bool`. """ - - super(ImmunizationReaction, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ImmunizationReaction, self).elementProperties() - js.extend([ - ("date", "date", fhirdate.FHIRDate, False, None, False), - ("detail", "detail", fhirreference.FHIRReference, False, None, False), - ("reported", "reported", bool, 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 quantity -except ImportError: - quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/immunization_tests.py b/fhirclient/models/immunization_tests.py deleted file mode 100644 index 5359747b4..000000000 --- a/fhirclient/models/immunization_tests.py +++ /dev/null @@ -1,244 +0,0 @@ -#!/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 immunization -from .fhirdate import FHIRDate - - -class ImmunizationTests(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("Immunization", js["resourceType"]) - return immunization.Immunization(js) - - def testImmunization1(self): - inst = self.instantiate_from("immunization-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Immunization instance") - self.implImmunization1(inst) - - js = inst.as_json() - self.assertEqual("Immunization", js["resourceType"]) - inst2 = immunization.Immunization(js) - self.implImmunization1(inst2) - - def implImmunization1(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.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.assertEqual(inst.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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://terminology.hl7.org/CodeSystem/immunization-origin") - self.assertEqual(inst.reportOrigin.text, "Written Record") - self.assertEqual(inst.status, "completed") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.vaccineCode.coding[0].code, "GNFLU") - self.assertEqual(inst.vaccineCode.coding[0].system, "urn:oid:1.2.36.1.2001.1005.17") - self.assertEqual(inst.vaccineCode.text, "Influenza") - - 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.implImmunization4(inst) - - js = inst.as_json() - self.assertEqual("Immunization", js["resourceType"]) - inst2 = immunization.Immunization(js) - self.implImmunization4(inst2) - - def implImmunization4(self, inst): - self.assertEqual(inst.id, "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, "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 testImmunization5(self): - inst = self.instantiate_from("immunization-example-subpotent.json") - self.assertIsNotNone(inst, "Must have instantiated a Immunization instance") - self.implImmunization5(inst) - - js = inst.as_json() - self.assertEqual("Immunization", js["resourceType"]) - inst2 = immunization.Immunization(js) - self.implImmunization5(inst2) - - def implImmunization5(self, inst): - self.assertEqual(inst.doseQuantity.code, "ml") - self.assertEqual(inst.doseQuantity.system, "http://unitsofmeasure.org") - 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.assertEqual(inst.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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("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.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://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.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, "Hepatitis B") - diff --git a/fhirclient/models/immunizationrecommendation.py b/fhirclient/models/immunizationrecommendation.py deleted file mode 100644 index 17d5cf7b4..000000000 --- a/fhirclient/models/immunizationrecommendation.py +++ /dev/null @@ -1,208 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ImmunizationRecommendation) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class ImmunizationRecommendation(domainresource.DomainResource): - """ Guidance or advice relating to an immunization. - - A patient's point-in-time set of recommendations (i.e. forecasting) - according to a published schedule with optional supporting justification. - """ - - resource_type = "ImmunizationRecommendation" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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` (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` (represented as `dict` in JSON). """ - - self.recommendation = None - """ Vaccine administration recommendations. - List of `ImmunizationRecommendationRecommendation` items (represented as `dict` in JSON). """ - - super(ImmunizationRecommendation, self).__init__(jsondict=jsondict, strict=strict) - - 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), - ]) - return js - - -from . import backboneelement - -class ImmunizationRecommendationRecommendation(backboneelement.BackboneElement): - """ Vaccine administration recommendations. - """ - - resource_type = "ImmunizationRecommendationRecommendation" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - 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.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 recommendation status. - Type `CodeableConcept` (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 (represented as `dict` in JSON). """ - - self.supportingPatientInformation = None - """ Patient observations supporting recommendation. - 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 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([ - ("contraindicatedVaccineCode", "contraindicatedVaccineCode", codeableconcept.CodeableConcept, True, None, False), - ("dateCriterion", "dateCriterion", ImmunizationRecommendationRecommendationDateCriterion, True, 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), - ("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, True, None, False), - ]) - return js - - -class ImmunizationRecommendationRecommendationDateCriterion(backboneelement.BackboneElement): - """ Dates governing proposed immunization. - - Vaccine date recommendations. For example, earliest date to administer, - latest date to administer, etc. - """ - - resource_type = "ImmunizationRecommendationRecommendationDateCriterion" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 date. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.value = None - """ Recommended date. - Type `FHIRDate` (represented as `str` in JSON). """ - - super(ImmunizationRecommendationRecommendationDateCriterion, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ImmunizationRecommendationRecommendationDateCriterion, self).elementProperties() - js.extend([ - ("code", "code", codeableconcept.CodeableConcept, False, None, True), - ("value", "value", fhirdate.FHIRDate, 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/immunizationrecommendation_tests.py b/fhirclient/models/immunizationrecommendation_tests.py deleted file mode 100644 index 5088fd49f..000000000 --- a/fhirclient/models/immunizationrecommendation_tests.py +++ /dev/null @@ -1,112 +0,0 @@ -#!/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 immunizationrecommendation -from .fhirdate import FHIRDate - - -class ImmunizationRecommendationTests(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("ImmunizationRecommendation", js["resourceType"]) - return immunizationrecommendation.ImmunizationRecommendation(js) - - def testImmunizationRecommendation1(self): - inst = self.instantiate_from("immunizationrecommendation-example.json") - self.assertIsNotNone(inst, "Must have instantiated a ImmunizationRecommendation instance") - self.implImmunizationRecommendation1(inst) - - js = inst.as_json() - self.assertEqual("ImmunizationRecommendation", js["resourceType"]) - inst2 = immunizationrecommendation.ImmunizationRecommendation(js) - 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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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://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://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://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].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].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-example-target-disease.json") - self.assertIsNotNone(inst, "Must have instantiated a ImmunizationRecommendation instance") - self.implImmunizationRecommendation2(inst) - - js = inst.as_json() - self.assertEqual("ImmunizationRecommendation", js["resourceType"]) - inst2 = immunizationrecommendation.ImmunizationRecommendation(js) - 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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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://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://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].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].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
") - self.assertEqual(inst.text.status, "generated") - diff --git a/fhirclient/models/implementationguide.py b/fhirclient/models/implementationguide.py deleted file mode 100644 index c6aa1c2fc..000000000 --- a/fhirclient/models/implementationguide.py +++ /dev/null @@ -1,652 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ImplementationGuide) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class ImplementationGuide(domainresource.DomainResource): - """ A set of rules about how FHIR is used. - - A set of rules of how a particular interoperability or standards problem is - solved - typically through the use of FHIR resources. This resource is used - to gather all the parts of an implementation guide into a logical whole and - to publish a computable definition of all the parts. - """ - - resource_type = "ImplementationGuide" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 last changed. - Type `FHIRDate` (represented as `str` in JSON). """ - - 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 `ImplementationGuideDependsOn` items (represented as `dict` in JSON). """ - - self.description = None - """ Natural language description of the implementation guide. - Type `str`. """ - - self.experimental = None - """ For testing purposes, not real usage. - Type `bool`. """ - - self.fhirVersion = None - """ FHIR Version(s) this Implementation Guide targets. - List of `str` items. """ - - self.global_fhir = None - """ Profiles that apply globally. - List of `ImplementationGuideGlobal` items (represented as `dict` in JSON). """ - - self.jurisdiction = None - """ 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.packageId = None - """ NPM Package name for IG. - Type `str`. """ - - self.publisher = None - """ Name of the publisher (organization or individual). - Type `str`. """ - - self.status = None - """ draft | active | retired | unknown. - Type `str`. """ - - self.title = None - """ Name for this implementation guide (human friendly). - Type `str`. """ - - self.url = None - """ Canonical identifier for this implementation guide, 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 implementation guide. - Type `str`. """ - - super(ImplementationGuide, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ImplementationGuide, self).elementProperties() - js.extend([ - ("contact", "contact", contactdetail.ContactDetail, True, None, False), - ("copyright", "copyright", str, False, None, False), - ("date", "date", fhirdate.FHIRDate, False, 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, 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), - ("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), - ]) - return js - - -from . import backboneelement - -class ImplementationGuideDefinition(backboneelement.BackboneElement): - """ Information needed to build the IG. - - The information needed by an IG publisher tool to publish the whole - implementation guide. - """ - - resource_type = "ImplementationGuideDefinition" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.grouping = None - """ Grouping used to present related resources in the IG. - List of `ImplementationGuideDefinitionGrouping` items (represented as `dict` in JSON). """ - - 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). """ - - 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(ImplementationGuideDefinition, self).elementProperties() - js.extend([ - ("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 ImplementationGuideDefinitionGrouping(backboneelement.BackboneElement): - """ Grouping used to present related resources in the IG. - - A logical group of resources. Logical groups can be used when building - pages. - """ - - resource_type = "ImplementationGuideDefinitionGrouping" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Human readable text describing the package. - Type `str`. """ - - self.name = None - """ Descriptive name for the package. - Type `str`. """ - - super(ImplementationGuideDefinitionGrouping, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ImplementationGuideDefinitionGrouping, self).elementProperties() - js.extend([ - ("description", "description", str, False, None, False), - ("name", "name", str, False, None, True), - ]) - return js - - -class ImplementationGuideDefinitionPage(backboneelement.BackboneElement): - """ Page/Section in the Guide. - - A page / section in the implementation guide. The root page is the - implementation guide home page. - """ - - resource_type = "ImplementationGuideDefinitionPage" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.generation = None - """ html | markdown | xml | generated. - Type `str`. """ - - 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.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(ImplementationGuideDefinitionPage, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ImplementationGuideDefinitionPage, self).elementProperties() - js.extend([ - ("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 ImplementationGuideDefinitionResource(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 = "ImplementationGuideDefinitionResource" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Reason why included in guide. - Type `str`. """ - - self.exampleBoolean = None - """ Is an example/What is this an example of?. - Type `bool`. """ - - 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.reference = None - """ Location of the resource. - Type `FHIRReference` (represented as `dict` in JSON). """ - - super(ImplementationGuideDefinitionResource, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ImplementationGuideDefinitionResource, self).elementProperties() - js.extend([ - ("description", "description", str, 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), - ("reference", "reference", fhirreference.FHIRReference, False, None, True), - ]) - return js - - -class ImplementationGuideDefinitionTemplate(backboneelement.BackboneElement): - """ A template for building resources. - """ - - 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 = "ImplementationGuideDependsOn" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.packageId = None - """ NPM Package name for IG this depends on. - Type `str`. """ - - self.uri = None - """ Identity of the IG that this depends on. - Type `str`. """ - - self.version = None - """ Version of the IG. - Type `str`. """ - - 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 - """ HTML page within the parent IG. - List of `ImplementationGuideManifestPage` items (represented as `dict` in JSON). """ - - 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 - """ Title of the page, for references. - Type `str`. """ - - 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`. """ - - 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(ImplementationGuideManifestResource, self).elementProperties() - js.extend([ - ("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 - - -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 usagecontext -except ImportError: - usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/implementationguide_tests.py b/fhirclient/models/implementationguide_tests.py deleted file mode 100644 index 3b920a0b9..000000000 --- a/fhirclient/models/implementationguide_tests.py +++ /dev/null @@ -1,83 +0,0 @@ -#!/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 implementationguide -from .fhirdate import FHIRDate - - -class ImplementationGuideTests(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("ImplementationGuide", js["resourceType"]) - return implementationguide.ImplementationGuide(js) - - def testImplementationGuide1(self): - inst = self.instantiate_from("implementationguide-example.json") - self.assertIsNotNone(inst, "Must have instantiated a ImplementationGuide instance") - self.implImplementationGuide1(inst) - - js = inst.as_json() - self.assertEqual("ImplementationGuide", js["resourceType"]) - inst2 = implementationguide.ImplementationGuide(js) - self.implImplementationGuide1(inst2) - - def implImplementationGuide1(self, inst): - 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") - self.assertEqual(inst.contact[1].name, "HL7") - self.assertEqual(inst.contact[1].telecom[0].system, "url") - self.assertEqual(inst.contact[1].telecom[0].value, "http://hl7.org/fhir") - 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.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[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.packageId, "hl7.fhir.us.daf") - self.assertEqual(inst.publisher, "ONC / HL7 Joint project") - self.assertEqual(inst.status, "draft") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.url, "http://hl7.org/fhir/us/daf") - self.assertEqual(inst.version, "0") - diff --git a/fhirclient/models/library.py b/fhirclient/models/library.py deleted file mode 100644 index 54600d37e..000000000 --- a/fhirclient/models/library.py +++ /dev/null @@ -1,244 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Library) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class Library(domainresource.DomainResource): - """ Represents a library of quality improvement components. - - The Library resource is a general-purpose container for knowledge asset - definitions. It can be used to describe and expose existing knowledge - assets such as logic libraries and information model descriptions, as well - as to describe a collection of knowledge assets. - """ - - resource_type = "Library" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 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). """ - - self.content = None - """ Contents of the library, either embedded or referenced. - List of `Attachment` items (represented as `dict` in JSON). """ - - self.copyright = None - """ Use and/or publishing restrictions. - Type `str`. """ - - self.dataRequirement = None - """ What data is referenced by this library. - List of `DataRequirement` items (represented as `dict` in JSON). """ - - self.date = None - """ 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`. """ - - self.identifier = None - """ Additional identifier for the library. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.jurisdiction = None - """ Intended jurisdiction for library (if applicable). - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.lastReviewDate = None - """ When the library was last reviewed. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.name = None - """ Name for this library (computer friendly). - Type `str`. """ - - self.parameter = None - """ Parameters defined by the library. - List of `ParameterDefinition` items (represented as `dict` in JSON). """ - - self.publisher = None - """ Name of the publisher (organization or individual). - Type `str`. """ - - self.purpose = None - """ Why this library 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.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.. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.type = None - """ logic-library | model-definition | asset-collection | module- - definition. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.url = None - """ Canonical identifier for this library, represented as a URI - (globally unique). - Type `str`. """ - - self.usage = None - """ Describes the clinical usage of the library. - 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 library. - Type `str`. """ - - super(Library, self).__init__(jsondict=jsondict, strict=strict) - - 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), - ("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), - ("parameter", "parameter", parameterdefinition.ParameterDefinition, True, 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, True), - ("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 attachment -except ImportError: - attachment = sys.modules[__package__ + '.attachment'] -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 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 parameterdefinition -except ImportError: - parameterdefinition = sys.modules[__package__ + '.parameterdefinition'] -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/library_tests.py b/fhirclient/models/library_tests.py deleted file mode 100644 index 6449f1c48..000000000 --- a/fhirclient/models/library_tests.py +++ /dev/null @@ -1,202 +0,0 @@ -#!/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 library -from .fhirdate import FHIRDate - - -class LibraryTests(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("Library", js["resourceType"]) - return library.Library(js) - - def testLibrary1(self): - inst = self.instantiate_from("library-predecessor-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Library instance") - self.implLibrary1(inst) - - js = inst.as_json() - self.assertEqual("Library", js["resourceType"]) - inst2 = library.Library(js) - 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[1].code[0].code, "confirmed") - self.assertEqual(inst.dataRequirement[1].codeFilter[1].path, "clinicalStatus") - self.assertEqual(inst.dataRequirement[1].codeFilter[2].path, "code") - 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[1].code[0].code, "confirmed") - self.assertEqual(inst.dataRequirement[2].codeFilter[1].path, "clinicalStatus") - self.assertEqual(inst.dataRequirement[2].codeFilter[2].path, "code") - 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[1].code[0].code, "ambulatory") - self.assertEqual(inst.dataRequirement[3].codeFilter[1].path, "class") - self.assertEqual(inst.dataRequirement[3].codeFilter[2].path, "type") - 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].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].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[1].path, "medication.code") - 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[1].path, "medication.code") - 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") - self.assertEqual(inst.description, "Logic for CMS 146: Appropriate Testing for Children with Pharyngitis") - 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") - self.assertEqual(inst.title, "Appropriate Testing for Children with Pharyngitis") - self.assertEqual(inst.type.coding[0].code, "logic-library") - self.assertEqual(inst.version, "2.0.0") - - def testLibrary3(self): - inst = self.instantiate_from("library-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Library instance") - self.implLibrary3(inst) - - js = inst.as_json() - self.assertEqual("Library", js["resourceType"]) - inst2 = library.Library(js) - self.implLibrary3(inst2) - - 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].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") - self.assertEqual(inst.description, "Common Logic for adherence to Chlamydia Screening guidelines") - 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") - self.assertEqual(inst.title, "Chlamydia Screening Common Library") - self.assertEqual(inst.topic[0].text, "Chlamydia Screening") - self.assertEqual(inst.type.coding[0].code, "logic-library") - self.assertEqual(inst.version, "2.0.0") - - def testLibrary4(self): - inst = self.instantiate_from("library-composition-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Library instance") - self.implLibrary4(inst) - - js = inst.as_json() - self.assertEqual("Library", js["resourceType"]) - inst2 = library.Library(js) - self.implLibrary4(inst2) - - def implLibrary4(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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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, "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 deleted file mode 100644 index bd8584bab..000000000 --- a/fhirclient/models/linkage.py +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Linkage) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class Linkage(domainresource.DomainResource): - """ Links records for 'same' item. - - Identifies two or more records (resource instances) that refer to the same - real-world "occurrence". - """ - - resource_type = "Linkage" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 linkage assertion is active or not. - Type `bool`. """ - - self.author = None - """ Who is responsible for linkages. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.item = None - """ Item to be linked. - List of `LinkageItem` items (represented as `dict` in JSON). """ - - super(Linkage, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Linkage, self).elementProperties() - js.extend([ - ("active", "active", bool, False, None, False), - ("author", "author", fhirreference.FHIRReference, False, None, False), - ("item", "item", LinkageItem, True, None, True), - ]) - return js - - -from . import backboneelement - -class LinkageItem(backboneelement.BackboneElement): - """ Item to be linked. - - 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. - """ - - resource_type = "LinkageItem" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Resource being linked. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.type = None - """ source | alternate | historical. - Type `str`. """ - - super(LinkageItem, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(LinkageItem, self).elementProperties() - js.extend([ - ("resource", "resource", fhirreference.FHIRReference, False, None, True), - ("type", "type", str, False, None, True), - ]) - return js - - -import sys -try: - from . import fhirreference -except ImportError: - fhirreference = sys.modules[__package__ + '.fhirreference'] diff --git a/fhirclient/models/linkage_tests.py b/fhirclient/models/linkage_tests.py deleted file mode 100644 index 1af98ddb5..000000000 --- a/fhirclient/models/linkage_tests.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/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 linkage -from .fhirdate import FHIRDate - - -class LinkageTests(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("Linkage", js["resourceType"]) - return linkage.Linkage(js) - - def testLinkage1(self): - inst = self.instantiate_from("linkage-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Linkage instance") - self.implLinkage1(inst) - - js = inst.as_json() - self.assertEqual("Linkage", js["resourceType"]) - inst2 = linkage.Linkage(js) - self.implLinkage1(inst2) - - 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 deleted file mode 100644 index 2da478c93..000000000 --- a/fhirclient/models/list.py +++ /dev/null @@ -1,165 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# 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): - """ A list is a curated collection of resources. - """ - - resource_type = "List" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 the purpose of this list is. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.date = None - """ When the list was prepared. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.emptyReason = None - """ Why list is empty. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.encounter = None - """ Context in which list created. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.entry = None - """ Entries in the list. - List of `ListEntry` items (represented as `dict` in JSON). """ - - self.identifier = None - """ Business identifier. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.mode = None - """ working | snapshot | changes. - Type `str`. """ - - self.note = None - """ Comments about the list. - List of `Annotation` items (represented as `dict` in JSON). """ - - self.orderedBy = None - """ What order the list has. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.source = None - """ Who and/or what defined the list contents (aka Author). - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.status = None - """ current | retired | entered-in-error. - Type `str`. """ - - self.subject = None - """ If all resources have the same subject. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.title = None - """ Descriptive name for the list. - Type `str`. """ - - super(List, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(List, self).elementProperties() - js.extend([ - ("code", "code", codeableconcept.CodeableConcept, False, None, False), - ("date", "date", fhirdate.FHIRDate, False, None, False), - ("emptyReason", "emptyReason", codeableconcept.CodeableConcept, False, None, False), - ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), - ("entry", "entry", ListEntry, True, None, False), - ("identifier", "identifier", identifier.Identifier, True, None, False), - ("mode", "mode", str, False, None, True), - ("note", "note", annotation.Annotation, True, None, False), - ("orderedBy", "orderedBy", codeableconcept.CodeableConcept, False, None, False), - ("source", "source", fhirreference.FHIRReference, False, None, False), - ("status", "status", str, False, None, True), - ("subject", "subject", fhirreference.FHIRReference, False, None, False), - ("title", "title", str, False, None, False), - ]) - return js - - -from . import backboneelement - -class ListEntry(backboneelement.BackboneElement): - """ Entries in the list. - - Entries in this list. - """ - - resource_type = "ListEntry" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ When item added to list. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.deleted = None - """ If this item is actually marked as deleted. - Type `bool`. """ - - self.flag = None - """ Status/Workflow information about this item. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.item = None - """ Actual entry. - Type `FHIRReference` (represented as `dict` in JSON). """ - - super(ListEntry, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ListEntry, self).elementProperties() - js.extend([ - ("date", "date", fhirdate.FHIRDate, False, None, False), - ("deleted", "deleted", bool, False, None, False), - ("flag", "flag", codeableconcept.CodeableConcept, False, None, False), - ("item", "item", fhirreference.FHIRReference, 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 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/list_tests.py b/fhirclient/models/list_tests.py deleted file mode 100644 index c25ae0ca0..000000000 --- a/fhirclient/models/list_tests.py +++ /dev/null @@ -1,299 +0,0 @@ -#!/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 list -from .fhirdate import FHIRDate - - -class ListTests(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("List", js["resourceType"]) - return list.List(js) - - def testList1(self): - inst = self.instantiate_from("list-example-medlist.json") - self.assertIsNotNone(inst, "Must have instantiated a List instance") - self.implList1(inst) - - js = inst.as_json() - self.assertEqual("List", js["resourceType"]) - inst2 = list.List(js) - self.implList1(inst2) - - def implList1(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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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 testList2(self): - inst = self.instantiate_from("list-example-familyhistory-genetics-profile-annie.json") - self.assertIsNotNone(inst, "Must have instantiated a List instance") - self.implList2(inst) - - js = inst.as_json() - self.assertEqual("List", js["resourceType"]) - inst2 = list.List(js) - self.implList2(inst2) - - def implList2(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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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-simple-empty.json") - self.assertIsNotNone(inst, "Must have instantiated a List instance") - self.implList3(inst) - - js = inst.as_json() - self.assertEqual("List", js["resourceType"]) - inst2 = list.List(js) - self.implList3(inst2) - - def implList3(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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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-empty.json") - self.assertIsNotNone(inst, "Must have instantiated a List instance") - self.implList4(inst) - - js = inst.as_json() - self.assertEqual("List", js["resourceType"]) - inst2 = list.List(js) - self.implList4(inst2) - - def implList4(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://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.status, "current") - self.assertEqual(inst.text.status, "generated") - - def testList5(self): - inst = self.instantiate_from("list-example-familyhistory-genetics-profile.json") - self.assertIsNotNone(inst, "Must have instantiated a List instance") - self.implList5(inst) - - js = inst.as_json() - self.assertEqual("List", js["resourceType"]) - inst2 = list.List(js) - self.implList5(inst2) - - 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, "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-f201-roel.json") - self.assertIsNotNone(inst, "Must have instantiated a List instance") - self.implList6(inst) - - js = inst.as_json() - self.assertEqual("List", js["resourceType"]) - inst2 = list.List(js) - self.implList6(inst2) - - 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, "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.json") - self.assertIsNotNone(inst, "Must have instantiated a List instance") - self.implList7(inst) - - js = inst.as_json() - self.assertEqual("List", js["resourceType"]) - inst2 = list.List(js) - self.implList7(inst2) - - def implList7(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].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-allergies.json") - self.assertIsNotNone(inst, "Must have instantiated a List instance") - self.implList8(inst) - - js = inst.as_json() - self.assertEqual("List", js["resourceType"]) - inst2 = list.List(js) - self.implList8(inst2) - - def implList8(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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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-double-cousin-relationship-pedigree.json") - self.assertIsNotNone(inst, "Must have instantiated a List instance") - self.implList9(inst) - - js = inst.as_json() - self.assertEqual("List", js["resourceType"]) - inst2 = list.List(js) - self.implList9(inst2) - - def implList9(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].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 deleted file mode 100644 index e0e662105..000000000 --- a/fhirclient/models/location.py +++ /dev/null @@ -1,240 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Location) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -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 - accommodated. - """ - - resource_type = "Location" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Physical location. - 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. - 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. - Type `str`. """ - - self.endpoint = None - """ Technical endpoints providing access to services operated for the - location. - 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. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.managingOrganization = None - """ Organization responsible for provisioning and upkeep. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.mode = None - """ instance | kind. - Type `str`. """ - - self.name = None - """ Name of the location as used by humans. - Type `str`. """ - - self.operationalStatus = None - """ 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 a part of. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.physicalType = None - """ Physical form of the location. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.position = None - """ The absolute geographic location. - Type `LocationPosition` (represented as `dict` in JSON). """ - - self.status = None - """ active | suspended | inactive. - Type `str`. """ - - self.telecom = None - """ Contact details of the location. - List of `ContactPoint` items (represented as `dict` in JSON). """ - - self.type = None - """ Type of function performed. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - super(Location, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Location, self).elementProperties() - 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), - ("name", "name", str, False, None, False), - ("operationalStatus", "operationalStatus", coding.Coding, False, None, False), - ("partOf", "partOf", fhirreference.FHIRReference, False, None, False), - ("physicalType", "physicalType", codeableconcept.CodeableConcept, False, None, False), - ("position", "position", LocationPosition, False, None, False), - ("status", "status", str, False, None, False), - ("telecom", "telecom", contactpoint.ContactPoint, True, 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. - - The absolute geographic location of the Location, expressed using the WGS84 - datum (This is the same co-ordinate system used in KML). - """ - - resource_type = "LocationPosition" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.altitude = None - """ Altitude with WGS84 datum. - Type `float`. """ - - self.latitude = None - """ Latitude with WGS84 datum. - Type `float`. """ - - self.longitude = None - """ Longitude with WGS84 datum. - Type `float`. """ - - super(LocationPosition, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(LocationPosition, self).elementProperties() - js.extend([ - ("altitude", "altitude", float, False, None, False), - ("latitude", "latitude", float, False, None, True), - ("longitude", "longitude", float, False, None, True), - ]) - 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 coding -except ImportError: - coding = sys.modules[__package__ + '.coding'] -try: - 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: - fhirreference = sys.modules[__package__ + '.fhirreference'] -try: - from . import identifier -except ImportError: - identifier = sys.modules[__package__ + '.identifier'] diff --git a/fhirclient/models/location_tests.py b/fhirclient/models/location_tests.py deleted file mode 100644 index 6d108e5ad..000000000 --- a/fhirclient/models/location_tests.py +++ /dev/null @@ -1,233 +0,0 @@ -#!/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 location -from .fhirdate import FHIRDate - - -class LocationTests(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("Location", js["resourceType"]) - return location.Location(js) - - def testLocation1(self): - inst = self.instantiate_from("location-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Location instance") - self.implLocation1(inst) - - js = inst.as_json() - self.assertEqual("Location", js["resourceType"]) - inst2 = location.Location(js) - self.implLocation1(inst2) - - def implLocation1(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.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, "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") - - def testLocation2(self): - inst = self.instantiate_from("location-example-room.json") - self.assertIsNotNone(inst, "Must have instantiated a Location instance") - self.implLocation2(inst) - - js = inst.as_json() - self.assertEqual("Location", js["resourceType"]) - inst2 = location.Location(js) - self.implLocation2(inst2) - - def implLocation2(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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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 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, "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[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-ambulance.json") - self.assertIsNotNone(inst, "Must have instantiated a Location instance") - self.implLocation3(inst) - - js = inst.as_json() - self.assertEqual("Location", js["resourceType"]) - inst2 = location.Location(js) - self.implLocation3(inst2) - - def implLocation3(self, inst): - 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, "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.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[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-ukpharmacy.json") - self.assertIsNotNone(inst, "Must have instantiated a Location instance") - self.implLocation4(inst) - - js = inst.as_json() - self.assertEqual("Location", js["resourceType"]) - inst2 = location.Location(js) - self.implLocation4(inst2) - - def implLocation4(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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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[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-patients-home.json") - self.assertIsNotNone(inst, "Must have instantiated a Location instance") - self.implLocation5(inst) - - js = inst.as_json() - self.assertEqual("Location", js["resourceType"]) - inst2 = location.Location(js) - self.implLocation5(inst2) - - def implLocation5(self, inst): - 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, "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, "
Patient's Home
") - self.assertEqual(inst.text.status, "generated") - 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-hl7hq.json") - self.assertIsNotNone(inst, "Must have instantiated a Location instance") - self.implLocation6(inst) - - js = inst.as_json() - self.assertEqual("Location", js["resourceType"]) - inst2 = location.Location(js) - self.implLocation6(inst2) - - def implLocation6(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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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://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].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, "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/measure.py b/fhirclient/models/measure.py deleted file mode 100644 index 848ad69db..000000000 --- a/fhirclient/models/measure.py +++ /dev/null @@ -1,511 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Measure) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class Measure(domainresource.DomainResource): - """ A quality measure definition. - - The Measure resource provides the definition of a quality measure. - """ - - resource_type = "Measure" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 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`. """ - - self.compositeScoring = None - """ opportunity | all-or-nothing | linear | weighted. - 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.definition = None - """ Defined terms used in the measure documentation. - List of `str` items. """ - - self.description = None - """ Natural language description of the measure. - Type `str`. """ - - self.disclaimer = None - """ 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`. """ - - self.group = None - """ Population criteria group. - List of `MeasureGroup` items (represented as `dict` in JSON). """ - - self.guidance = None - """ Additional guidance for implementers. - Type `str`. """ - - self.identifier = None - """ Additional identifier for the measure. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.improvementNotation = None - """ increase | decrease. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.jurisdiction = None - """ Intended jurisdiction for measure (if applicable). - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.lastReviewDate = None - """ When the measure was last reviewed. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.library = None - """ Logic used by the measure. - List of `str` items. """ - - self.name = None - """ Name for this measure (computer friendly). - Type `str`. """ - - self.publisher = None - """ Name of the publisher (organization or individual). - Type `str`. """ - - self.purpose = None - """ Why this measure is defined. - Type `str`. """ - - self.rateAggregation = None - """ How is rate aggregation performed for this measure. - Type `str`. """ - - self.rationale = None - """ Detailed description of why the measure exists. - 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.riskAdjustment = None - """ 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.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). """ - - self.title = None - """ Name for this measure (human friendly). - Type `str`. """ - - self.topic = None - """ The category of the measure, such as Education, Treatment, - Assessment, etc.. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.type = None - """ process | outcome | structure | patient-reported-outcome | - composite. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.url = None - """ Canonical identifier for this measure, represented as a URI - (globally unique). - Type `str`. """ - - self.usage = None - """ Describes the clinical usage of the measure. - 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 measure. - Type `str`. """ - - super(Measure, self).__init__(jsondict=jsondict, strict=strict) - - 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), - ("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", codeableconcept.CodeableConcept, False, 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), - ("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), - ("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), - ("type", "type", 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 - - -from . import backboneelement - -class MeasureGroup(backboneelement.BackboneElement): - """ Population criteria group. - - A group of population criteria for the measure. - """ - - resource_type = "MeasureGroup" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 group. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.description = None - """ Summary description. - Type `str`. """ - - self.population = None - """ Population criteria. - List of `MeasureGroupPopulation` items (represented as `dict` in JSON). """ - - self.stratifier = None - """ Stratifier criteria for the measure. - List of `MeasureGroupStratifier` items (represented as `dict` in JSON). """ - - super(MeasureGroup, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(MeasureGroup, self).elementProperties() - js.extend([ - ("code", "code", codeableconcept.CodeableConcept, False, None, False), - ("description", "description", str, False, None, False), - ("population", "population", MeasureGroupPopulation, True, None, False), - ("stratifier", "stratifier", MeasureGroupStratifier, True, None, False), - ]) - return js - - -class MeasureGroupPopulation(backboneelement.BackboneElement): - """ Population criteria. - - A population criteria for the measure. - """ - - resource_type = "MeasureGroupPopulation" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ initial-population | numerator | numerator-exclusion | denominator - | denominator-exclusion | denominator-exception | measure- - population | measure-population-exclusion | measure-observation. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.criteria = None - """ 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`. """ - - 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", expression.Expression, False, None, True), - ("description", "description", str, False, None, False), - ]) - return js - - -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 - valid FHIR Resource Path. - """ - - resource_type = "MeasureGroupStratifier" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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. - 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 `Expression` (represented as `dict` in JSON). """ - - self.description = None - """ The human readable description of this stratifier. - Type `str`. """ - - super(MeasureGroupStratifier, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(MeasureGroupStratifier, self).elementProperties() - js.extend([ - ("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 - - -class MeasureSupplementalData(backboneelement.BackboneElement): - """ What other data should be reported with the measure. - - The supplemental data criteria for the measure report, specified as either - the name of a valid CQL expression within a referenced library, or a valid - FHIR Resource Path. - """ - - resource_type = "MeasureSupplementalData" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 supplemental data. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.criteria = None - """ Expression describing additional data to be reported. - Type `Expression` (represented as `dict` in JSON). """ - - self.description = None - """ The human readable description of this supplemental data. - Type `str`. """ - - self.usage = None - """ supplemental-data | risk-adjustment-factor. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - super(MeasureSupplementalData, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(MeasureSupplementalData, self).elementProperties() - js.extend([ - ("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 - - -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 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 usagecontext -except ImportError: - usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/measure_tests.py b/fhirclient/models/measure_tests.py deleted file mode 100644 index ea8fdd011..000000000 --- a/fhirclient/models/measure_tests.py +++ /dev/null @@ -1,272 +0,0 @@ -#!/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 measure -from .fhirdate import FHIRDate - - -class MeasureTests(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("Measure", js["resourceType"]) - return measure.Measure(js) - - def testMeasure1(self): - inst = self.instantiate_from("measure-component-b-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Measure instance") - self.implMeasure1(inst) - - js = inst.as_json() - self.assertEqual("Measure", js["resourceType"]) - inst2 = measure.Measure(js) - 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.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.") - 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-01-01").date) - self.assertEqual(inst.effectivePeriod.start.as_json(), "2017-01-01") - self.assertTrue(inst.experimental) - 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.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.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.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.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") - self.assertEqual(inst.identifier[0].use, "official") - self.assertEqual(inst.identifier[0].value, "146") - 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.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].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].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].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://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 testMeasure4(self): - inst = self.instantiate_from("measure-component-a-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Measure instance") - self.implMeasure4(inst) - - js = inst.as_json() - self.assertEqual("Measure", js["resourceType"]) - inst2 = measure.Measure(js) - self.implMeasure4(inst2) - - 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.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-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 testMeasure5(self): - inst = self.instantiate_from("measure-composite-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.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") - diff --git a/fhirclient/models/measurereport.py b/fhirclient/models/measurereport.py deleted file mode 100644 index b401e3ed8..000000000 --- a/fhirclient/models/measurereport.py +++ /dev/null @@ -1,370 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MeasureReport) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class MeasureReport(domainresource.DomainResource): - """ Results of a measure evaluation. - - 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" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ When the report was generated. - Type `FHIRDate` (represented as `str` 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 MeasureReport. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.improvementNotation = None - """ increase | decrease. - Type `CodeableConcept` (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.reporter = None - """ Who is reporting the data. - 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 | subject-list | summary | data-collection. - Type `str`. """ - - super(MeasureReport, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(MeasureReport, self).elementProperties() - js.extend([ - ("date", "date", fhirdate.FHIRDate, False, None, False), - ("evaluatedResource", "evaluatedResource", fhirreference.FHIRReference, True, None, False), - ("group", "group", MeasureReportGroup, True, 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), - ("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 - - -from . import backboneelement - -class MeasureReportGroup(backboneelement.BackboneElement): - """ Measure results for each group. - - The results of the calculation, one for each population group in the - measure. - """ - - resource_type = "MeasureReportGroup" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 group. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.measureScore = None - """ What score this group achieved. - Type `Quantity` (represented as `dict` in JSON). """ - - self.population = None - """ The populations in the group. - List of `MeasureReportGroupPopulation` items (represented as `dict` in JSON). """ - - self.stratifier = None - """ Stratification results. - List of `MeasureReportGroupStratifier` items (represented as `dict` in JSON). """ - - super(MeasureReportGroup, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(MeasureReportGroup, self).elementProperties() - js.extend([ - ("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), - ]) - return js - - -class MeasureReportGroupPopulation(backboneelement.BackboneElement): - """ The populations in the group. - - The populations that make up the population group, one for each type of - population appropriate for the measure. - """ - - resource_type = "MeasureReportGroupPopulation" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ initial-population | numerator | numerator-exclusion | denominator - | denominator-exclusion | denominator-exception | measure- - population | measure-population-exclusion | measure-observation. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.count = None - """ Size of the population. - Type `int`. """ - - 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) - - def elementProperties(self): - js = super(MeasureReportGroupPopulation, self).elementProperties() - js.extend([ - ("code", "code", codeableconcept.CodeableConcept, False, None, False), - ("count", "count", int, False, None, False), - ("subjectResults", "subjectResults", fhirreference.FHIRReference, False, None, False), - ]) - return js - - -class MeasureReportGroupStratifier(backboneelement.BackboneElement): - """ Stratification results. - - When a measure includes multiple stratifiers, there will be a stratifier - group for each stratifier defined by the measure. - """ - - resource_type = "MeasureReportGroupStratifier" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 of the group. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.stratum = None - """ 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) - - def elementProperties(self): - js = super(MeasureReportGroupStratifier, self).elementProperties() - js.extend([ - ("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, 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 - will be four strata, one for each possible gender value. - """ - - resource_type = "MeasureReportGroupStratifierStratum" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Stratifier component values. - List of `MeasureReportGroupStratifierStratumComponent` items (represented as `dict` in JSON). """ - - self.measureScore = None - """ What score this stratum achieved. - Type `Quantity` (represented as `dict` in JSON). """ - - self.population = None - """ Population results in this stratum. - List of `MeasureReportGroupStratifierStratumPopulation` items (represented as `dict` in JSON). """ - - self.value = None - """ The stratum value, e.g. male. - 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([ - ("component", "component", MeasureReportGroupStratifierStratumComponent, True, None, False), - ("measureScore", "measureScore", quantity.Quantity, False, None, False), - ("population", "population", MeasureReportGroupStratifierStratumPopulation, True, None, False), - ("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 - - -class MeasureReportGroupStratifierStratumPopulation(backboneelement.BackboneElement): - """ Population results in this stratum. - - The populations that make up the stratum, one for each type of population - appropriate to the measure. - """ - - resource_type = "MeasureReportGroupStratifierStratumPopulation" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ initial-population | numerator | numerator-exclusion | denominator - | denominator-exclusion | denominator-exception | measure- - population | measure-population-exclusion | measure-observation. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.count = None - """ Size of the population. - Type `int`. """ - - 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) - - def elementProperties(self): - js = super(MeasureReportGroupStratifierStratumPopulation, self).elementProperties() - js.extend([ - ("code", "code", codeableconcept.CodeableConcept, False, None, False), - ("count", "count", int, False, None, False), - ("subjectResults", "subjectResults", fhirreference.FHIRReference, 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'] -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 deleted file mode 100644 index 626a2abf8..000000000 --- a/fhirclient/models/measurereport_tests.py +++ /dev/null @@ -1,359 +0,0 @@ -#!/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 measurereport -from .fhirdate import FHIRDate - - -class MeasureReportTests(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("MeasureReport", js["resourceType"]) - return measurereport.MeasureReport(js) - - def testMeasureReport1(self): - inst = self.instantiate_from("measurereport-cms146-cat1-example.json") - self.assertIsNotNone(inst, "Must have instantiated a MeasureReport instance") - self.implMeasureReport1(inst) - - js = inst.as_json() - self.assertEqual("MeasureReport", js["resourceType"]) - inst2 = measurereport.MeasureReport(js) - self.implMeasureReport1(inst2) - - def implMeasureReport1(self, inst): - self.assertEqual(inst.contained[0].id, "reporter") - 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") - self.assertEqual(inst.group[0].population[1].count, 1) - self.assertEqual(inst.group[0].population[2].code.coding[0].code, "denominator") - 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].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") - self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[1].count, 1) - self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[2].code.coding[0].code, "denominator") - 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.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") - self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[1].count, 0) - self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[2].code.coding[0].code, "denominator") - 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.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") - self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[1].count, 0) - self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[2].code.coding[0].code, "denominator") - 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.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") - self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[1].count, 1) - self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[2].code.coding[0].code, "denominator") - 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.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") - self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[1].count, 1) - self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[2].code.coding[0].code, "denominator") - 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.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") - self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[1].count, 0) - self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[2].code.coding[0].code, "denominator") - 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.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") - self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[1].count, 0) - self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[2].code.coding[0].code, "denominator") - 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.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") - self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[1].count, 0) - self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[2].code.coding[0].code, "denominator") - 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.text, "unknown") - self.assertEqual(inst.id, "measurereport-cms146-cat1-example") - 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) - 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, "individual") - - def testMeasureReport2(self): - inst = self.instantiate_from("measurereport-cms146-cat2-example.json") - self.assertIsNotNone(inst, "Must have instantiated a MeasureReport instance") - self.implMeasureReport2(inst) - - js = inst.as_json() - self.assertEqual("MeasureReport", js["resourceType"]) - inst2 = measurereport.MeasureReport(js) - self.implMeasureReport2(inst2) - - def implMeasureReport2(self, inst): - self.assertEqual(inst.contained[0].id, "reporter") - 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") - self.assertEqual(inst.group[0].population[1].count, 200) - self.assertEqual(inst.group[0].population[2].code.coding[0].code, "denominator") - 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].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") - self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[1].count, 100) - self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[2].code.coding[0].code, "denominator") - 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.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") - self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[1].count, 100) - self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[2].code.coding[0].code, "denominator") - 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.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") - self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[1].count, 100) - self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[2].code.coding[0].code, "denominator") - 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.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") - self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[1].count, 100) - self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[2].code.coding[0].code, "denominator") - 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.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") - self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[1].count, 100) - self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[2].code.coding[0].code, "denominator") - 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.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") - self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[1].count, 100) - self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[2].code.coding[0].code, "denominator") - 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.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") - self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[1].count, 0) - self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[2].code.coding[0].code, "denominator") - 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.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") - self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[1].count, 0) - self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[2].code.coding[0].code, "denominator") - 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.text, "unknown") - self.assertEqual(inst.id, "measurereport-cms146-cat2-example") - 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, "subject-list") - - def testMeasureReport3(self): - inst = self.instantiate_from("measurereport-cms146-cat3-example.json") - self.assertIsNotNone(inst, "Must have instantiated a MeasureReport instance") - self.implMeasureReport3(inst) - - js = inst.as_json() - self.assertEqual("MeasureReport", js["resourceType"]) - inst2 = measurereport.MeasureReport(js) - self.implMeasureReport3(inst2) - - def implMeasureReport3(self, inst): - self.assertEqual(inst.contained[0].id, "reporter") - 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") - self.assertEqual(inst.group[0].population[1].count, 200) - self.assertEqual(inst.group[0].population[2].code.coding[0].code, "denominator") - 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].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") - self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[1].count, 100) - self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[2].code.coding[0].code, "denominator") - 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.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") - self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[1].count, 100) - self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[2].code.coding[0].code, "denominator") - 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.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") - self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[1].count, 100) - self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[2].code.coding[0].code, "denominator") - 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.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") - self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[1].count, 100) - self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[2].code.coding[0].code, "denominator") - 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.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") - self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[1].count, 100) - self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[2].code.coding[0].code, "denominator") - 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.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") - self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[1].count, 100) - self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[2].code.coding[0].code, "denominator") - 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.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") - self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[1].count, 0) - self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[2].code.coding[0].code, "denominator") - 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.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") - self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[1].count, 0) - self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[2].code.coding[0].code, "denominator") - 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.text, "unknown") - self.assertEqual(inst.id, "measurereport-cms146-cat3-example") - 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) - 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, "summary") - diff --git a/fhirclient/models/media.py b/fhirclient/models/media.py deleted file mode 100644 index 2be0cd63d..000000000 --- a/fhirclient/models/media.py +++ /dev/null @@ -1,178 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Media) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class Media(domainresource.DomainResource): - """ A photo, video, or audio recording acquired or used in healthcare. The - actual content may be inline or provided by direct reference. - """ - - resource_type = "Media" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.basedOn = None - """ Procedure that caused this media to be created. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.bodySite = None - """ 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.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` (represented as `dict` in JSON). """ - - self.deviceName = None - """ Name of the device/manufacturer. - Type `str`. """ - - self.duration = None - """ Length in seconds (audio / video). - 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). - Type `int`. """ - - self.height = None - """ Height of the image in pixels (photo/video). - Type `int`. """ - - self.identifier = None - """ 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.operator = None - """ The person who generated the image. - 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` (represented as `dict` in JSON). """ - - self.type = None - """ 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. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.width = None - """ Width of the image in pixels (photo/video). - Type `int`. """ - - super(Media, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Media, self).elementProperties() - js.extend([ - ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), - ("bodySite", "bodySite", codeableconcept.CodeableConcept, False, None, False), - ("content", "content", attachment.Attachment, False, None, True), - ("createdDateTime", "createdDateTime", fhirdate.FHIRDate, False, "created", False), - ("createdPeriod", "createdPeriod", period.Period, False, "created", False), - ("device", "device", fhirreference.FHIRReference, 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), - ("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), - ("type", "type", codeableconcept.CodeableConcept, False, None, False), - ("view", "view", codeableconcept.CodeableConcept, False, None, False), - ("width", "width", int, False, None, False), - ]) - return js - - -import sys -try: - from . import annotation -except ImportError: - annotation = sys.modules[__package__ + '.annotation'] -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 period -except ImportError: - period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/media_tests.py b/fhirclient/models/media_tests.py deleted file mode 100644 index c20d3d9d1..000000000 --- a/fhirclient/models/media_tests.py +++ /dev/null @@ -1,155 +0,0 @@ -#!/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 media -from .fhirdate import FHIRDate - - -class MediaTests(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("Media", js["resourceType"]) - return media.Media(js) - - def testMedia1(self): - inst = self.instantiate_from("media-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Media instance") - self.implMedia1(inst) - - js = inst.as_json() - self.assertEqual("Media", js["resourceType"]) - inst2 = media.Media(js) - 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.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.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: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: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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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.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 testMedia3(self): - inst = self.instantiate_from("media-example-xray.json") - self.assertIsNotNone(inst, "Must have instantiated a Media instance") - self.implMedia3(inst) - - js = inst.as_json() - self.assertEqual("Media", js["resourceType"]) - inst2 = media.Media(js) - self.implMedia3(inst2) - - 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.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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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.width, 640) - - def testMedia4(self): - inst = self.instantiate_from("media-example-sound.json") - self.assertIsNotNone(inst, "Must have instantiated a Media instance") - self.implMedia4(inst) - - js = inst.as_json() - self.assertEqual("Media", js["resourceType"]) - inst2 = media.Media(js) - self.implMedia4(inst2) - - def implMedia4(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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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") - diff --git a/fhirclient/models/medication.py b/fhirclient/models/medication.py deleted file mode 100644 index f32dead97..000000000 --- a/fhirclient/models/medication.py +++ /dev/null @@ -1,179 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Medication) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class Medication(domainresource.DomainResource): - """ Definition of a Medication. - - This resource is primarily used for the identification and definition of a - medication for the purposes of prescribing, dispensing, and administering a - medication as well as for making statements about medication use. - """ - - resource_type = "Medication" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 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). """ - - self.form = None - """ powder | tablets | capsule +. - Type `CodeableConcept` (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.manufacturer = None - """ Manufacturer of the item. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.status = None - """ active | inactive | entered-in-error. - Type `str`. """ - - super(Medication, self).__init__(jsondict=jsondict, strict=strict) - - 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), - ("identifier", "identifier", identifier.Identifier, True, None, False), - ("ingredient", "ingredient", MedicationIngredient, True, None, False), - ("manufacturer", "manufacturer", fhirreference.FHIRReference, False, None, False), - ("status", "status", str, False, None, False), - ]) - return js - - -from . import backboneelement - -class MedicationBatch(backboneelement.BackboneElement): - """ Details about packaged medications. - - Information that only applies to packages (not products). - """ - - resource_type = "MedicationBatch" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.expirationDate = None - """ When batch will expire. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.lotNumber = None - """ Identifier assigned to batch. - Type `str`. """ - - super(MedicationBatch, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(MedicationBatch, self).elementProperties() - js.extend([ - ("expirationDate", "expirationDate", fhirdate.FHIRDate, False, None, False), - ("lotNumber", "lotNumber", str, False, None, False), - ]) - return js - - -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.isActive = None - """ Active ingredient indicator. - Type `bool`. """ - - self.itemCodeableConcept = None - """ The actual ingredient or content. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.itemReference = None - """ 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(MedicationIngredient, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(MedicationIngredient, 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 - - -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 ratio -except ImportError: - ratio = sys.modules[__package__ + '.ratio'] diff --git a/fhirclient/models/medicationadministration.py b/fhirclient/models/medicationadministration.py deleted file mode 100644 index 8543c5611..000000000 --- a/fhirclient/models/medicationadministration.py +++ /dev/null @@ -1,277 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicationAdministration) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class MedicationAdministration(domainresource.DomainResource): - """ Administration of medication to a patient. - - Describes the event of a patient consuming or otherwise being administered - a medication. This may be as simple as swallowing a tablet or it may be a - long running infusion. Related resources tie this event to the authorizing - prescription, and the specific encounter between patient and health care - practitioner. - """ - - resource_type = "MedicationAdministration" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Type of medication usage. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.context = None - """ Encounter or Episode of Care administered as part of. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.device = None - """ Device used to administer. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.dosage = None - """ Details of how medication was taken. - Type `MedicationAdministrationDosage` (represented as `dict` in JSON). """ - - self.effectiveDateTime = None - """ Start and end time of administration. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.effectivePeriod = None - """ Start and end time of administration. - Type `Period` (represented as `dict` in JSON). """ - - self.eventHistory = None - """ A list of events of interest in the lifecycle. - 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` (represented as `dict` in JSON). """ - - self.note = None - """ Information about the administration. - 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 performed the medication administration and what they did. - List of `MedicationAdministrationPerformer` items (represented as `dict` in JSON). """ - - self.reasonCode = None - """ Reason administration performed. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.reasonReference = None - """ Condition or observation that supports why the medication was - administered. - 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 | 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` (represented as `dict` in JSON). """ - - self.supportingInformation = None - """ Additional information to support administration. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - super(MedicationAdministration, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(MedicationAdministration, self).elementProperties() - js.extend([ - ("category", "category", codeableconcept.CodeableConcept, False, None, False), - ("context", "context", fhirreference.FHIRReference, False, 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), - ("note", "note", annotation.Annotation, True, None, False), - ("partOf", "partOf", fhirreference.FHIRReference, True, None, False), - ("performer", "performer", MedicationAdministrationPerformer, True, None, False), - ("reasonCode", "reasonCode", 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), - ]) - return js - - -from . import backboneelement - -class MedicationAdministrationDosage(backboneelement.BackboneElement): - """ Details of how medication was taken. - - Describes the medication dosage information details e.g. dose, rate, site, - route, etc. - """ - - resource_type = "MedicationAdministrationDosage" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.dose = None - """ Amount of medication per dose. - Type `Quantity` (represented as `dict` in JSON). """ - - self.method = None - """ How drug was administered. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.rateQuantity = None - """ Dose quantity per unit of time. - Type `Quantity` (represented as `dict` in JSON). """ - - self.rateRatio = None - """ Dose quantity per unit of time. - Type `Ratio` (represented as `dict` in JSON). """ - - self.route = None - """ Path of substance into body. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.site = None - """ Body site administered to. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.text = None - """ Free text dosage instructions e.g. SIG. - Type `str`. """ - - super(MedicationAdministrationDosage, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(MedicationAdministrationDosage, self).elementProperties() - js.extend([ - ("dose", "dose", quantity.Quantity, False, None, False), - ("method", "method", codeableconcept.CodeableConcept, False, None, False), - ("rateQuantity", "rateQuantity", quantity.Quantity, False, "rate", False), - ("rateRatio", "rateRatio", ratio.Ratio, False, "rate", False), - ("route", "route", codeableconcept.CodeableConcept, False, None, False), - ("site", "site", codeableconcept.CodeableConcept, False, None, False), - ("text", "text", str, False, None, False), - ]) - return js - - -class MedicationAdministrationPerformer(backboneelement.BackboneElement): - """ Who performed the medication administration and what they did. - - Indicates who or what performed the medication administration and how they - were involved. - """ - - resource_type = "MedicationAdministrationPerformer" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 medication administration. - Type `FHIRReference` (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) - - def elementProperties(self): - js = super(MedicationAdministrationPerformer, 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: - 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'] -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/medicationdispense.py b/fhirclient/models/medicationdispense.py deleted file mode 100644 index b9b43753a..000000000 --- a/fhirclient/models/medicationdispense.py +++ /dev/null @@ -1,286 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicationDispense) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class MedicationDispense(domainresource.DomainResource): - """ Dispensing a medication to a named patient. - - Indicates that a medication product is to be or has been dispensed for a - named person/patient. This includes a description of the medication - product (supply) provided and the instructions for administering the - medication. The medication dispense is the result of a pharmacy system - responding to a medication order. - """ - - resource_type = "MedicationDispense" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.authorizingPrescription = None - """ Medication order that authorizes the dispense. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.category = None - """ Type of medication dispense. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.context = None - """ Encounter / Episode associated with event. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.daysSupply = None - """ Amount of medication expressed as a timing amount. - Type `Quantity` (represented as `dict` in JSON). """ - - self.destination = None - """ Where the medication was sent. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.detectedIssue = None - """ Clinical issue with action. - 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 - the caregiver. - List of `Dosage` items (represented as `dict` in JSON). """ - - self.eventHistory = None - """ 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` (represented as `dict` in JSON). """ - - self.note = None - """ Information about the dispense. - List of `Annotation` items (represented as `dict` in JSON). """ - - self.partOf = None - """ Event that dispense is part of. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.performer = None - """ Who performed event. - List of `MedicationDispensePerformer` items (represented as `dict` in JSON). """ - - self.quantity = None - """ Amount dispensed. - Type `Quantity` (represented as `dict` in JSON). """ - - self.receiver = None - """ Who collected the medication. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.status = None - """ 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` (represented as `dict` in JSON). """ - - self.substitution = None - """ Whether a substitution was performed on the dispense. - Type `MedicationDispenseSubstitution` (represented as `dict` in JSON). """ - - self.supportingInformation = None - """ Information that supports the dispensing of the medication. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.type = None - """ Trial fill, partial fill, emergency fill, etc.. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.whenHandedOver = None - """ When product was given out. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.whenPrepared = None - """ When product was packaged and reviewed. - Type `FHIRDate` (represented as `str` in JSON). """ - - super(MedicationDispense, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(MedicationDispense, self).elementProperties() - js.extend([ - ("authorizingPrescription", "authorizingPrescription", fhirreference.FHIRReference, True, None, False), - ("category", "category", codeableconcept.CodeableConcept, False, None, False), - ("context", "context", fhirreference.FHIRReference, False, None, False), - ("daysSupply", "daysSupply", quantity.Quantity, False, None, False), - ("destination", "destination", fhirreference.FHIRReference, False, None, False), - ("detectedIssue", "detectedIssue", fhirreference.FHIRReference, True, None, False), - ("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), - ("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, 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), - ("type", "type", codeableconcept.CodeableConcept, False, None, False), - ("whenHandedOver", "whenHandedOver", fhirdate.FHIRDate, False, None, False), - ("whenPrepared", "whenPrepared", fhirdate.FHIRDate, False, None, False), - ]) - return js - - -from . import backboneelement - -class MedicationDispensePerformer(backboneelement.BackboneElement): - """ Who performed event. - - Indicates who or what performed the event. - """ - - resource_type = "MedicationDispensePerformer" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 performing. - Type `FHIRReference` (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) - - def elementProperties(self): - js = super(MedicationDispensePerformer, self).elementProperties() - js.extend([ - ("actor", "actor", fhirreference.FHIRReference, False, None, True), - ("function", "function", codeableconcept.CodeableConcept, False, None, False), - ]) - return js - - -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 - 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. - """ - - resource_type = "MedicationDispenseSubstitution" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.reason = None - """ Why was substitution made. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.responsibleParty = None - """ Who is responsible for the substitution. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.type = None - """ Code signifying whether a different drug was dispensed from what - was prescribed. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.wasSubstituted = None - """ Whether a substitution was or was not performed on the dispense. - Type `bool`. """ - - super(MedicationDispenseSubstitution, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(MedicationDispenseSubstitution, self).elementProperties() - js.extend([ - ("reason", "reason", codeableconcept.CodeableConcept, True, None, False), - ("responsibleParty", "responsibleParty", fhirreference.FHIRReference, True, None, False), - ("type", "type", codeableconcept.CodeableConcept, False, None, False), - ("wasSubstituted", "wasSubstituted", bool, 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 dosage -except ImportError: - dosage = sys.modules[__package__ + '.dosage'] -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'] diff --git a/fhirclient/models/medicationrequest.py b/fhirclient/models/medicationrequest.py deleted file mode 100644 index dd2889576..000000000 --- a/fhirclient/models/medicationrequest.py +++ /dev/null @@ -1,394 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicationRequest) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class MedicationRequest(domainresource.DomainResource): - """ Ordering of medication for patient or group. - - An order or request for both supply of the medication and the instructions - for administration of the medication to a patient. The resource is called - "MedicationRequest" rather than "MedicationPrescription" or - "MedicationOrder" to generalize the use across inpatient and outpatient - settings, including care plans, etc., and to harmonize with workflow - patterns. - """ - - resource_type = "MedicationRequest" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ When request was initially authored. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.basedOn = None - """ What request fulfills. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.category = None - """ Type of medication usage. - List of `CodeableConcept` items (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 (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 (represented as `dict` in JSON). """ - - self.groupIdentifier = None - """ Composite request this is part of. - Type `Identifier` (represented as `dict` in JSON). """ - - self.identifier = None - """ 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 | original-order | instance-order | option. - Type `str`. """ - - self.medicationCodeableConcept = None - """ Medication to be taken. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.medicationReference = None - """ Medication to be taken. - 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` (represented as `dict` in JSON). """ - - self.priority = None - """ routine | urgent | asap | stat. - Type `str`. """ - - self.reasonCode = None - """ 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 - being written. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.recorder = None - """ Person who entered the request. - 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 `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` (represented as `dict` in JSON). """ - - self.substitution = None - """ Any restrictions on medication substitution. - Type `MedicationRequestSubstitution` (represented as `dict` in JSON). """ - - self.supportingInformation = None - """ Information to support ordering of the medication. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - super(MedicationRequest, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(MedicationRequest, self).elementProperties() - js.extend([ - ("authoredOn", "authoredOn", fhirdate.FHIRDate, False, None, False), - ("basedOn", "basedOn", 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), - ("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), - ]) - return js - - -from . import backboneelement - -class MedicationRequestDispenseRequest(backboneelement.BackboneElement): - """ Medication supply authorization. - - Indicates the specific details for the dispense or medication supply part - of a medication request (also known as a Medication Prescription or - Medication Order). Note that this information is not always sent with the - order. There may be in some settings (e.g. hospitals) institutional or - system support for completing the dispense details in the pharmacy - department. - """ - - resource_type = "MedicationRequestDispenseRequest" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :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` (represented as `dict` in JSON). """ - - self.quantity = None - """ Amount of medication to supply per dispense. - Type `Quantity` (represented as `dict` in JSON). """ - - self.validityPeriod = None - """ Time period supply is authorized for. - Type `Period` (represented as `dict` in JSON). """ - - super(MedicationRequestDispenseRequest, self).__init__(jsondict=jsondict, strict=strict) - - 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), - ("validityPeriod", "validityPeriod", period.Period, False, None, False), - ]) - return js - - -class MedicationRequestDispenseRequestInitialFill(backboneelement.BackboneElement): - """ First fill details. - - Indicates the quantity or duration for the first dispense of the - medication. - """ - - resource_type = "MedicationRequestDispenseRequestInitialFill" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.duration = None - """ First fill duration. - Type `Duration` (represented as `dict` in JSON). """ - - self.quantity = None - """ First fill quantity. - Type `Quantity` (represented as `dict` in JSON). """ - - super(MedicationRequestDispenseRequestInitialFill, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(MedicationRequestDispenseRequestInitialFill, self).elementProperties() - js.extend([ - ("duration", "duration", duration.Duration, False, None, False), - ("quantity", "quantity", quantity.Quantity, False, None, False), - ]) - return js - - -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 - substitution must not happen. This block explains the prescriber's intent. - If nothing is specified substitution may be done. - """ - - resource_type = "MedicationRequestSubstitution" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - 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). """ - - super(MedicationRequestSubstitution, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(MedicationRequestSubstitution, self).elementProperties() - js.extend([ - ("allowedBoolean", "allowedBoolean", bool, False, "allowed", True), - ("allowedCodeableConcept", "allowedCodeableConcept", codeableconcept.CodeableConcept, False, "allowed", True), - ("reason", "reason", 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 dosage -except ImportError: - dosage = sys.modules[__package__ + '.dosage'] -try: - from . import duration -except ImportError: - duration = sys.modules[__package__ + '.duration'] -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 quantity -except ImportError: - quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/medicationstatement.py b/fhirclient/models/medicationstatement.py deleted file mode 100644 index 91ff6aead..000000000 --- a/fhirclient/models/medicationstatement.py +++ /dev/null @@ -1,184 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicationStatement) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class MedicationStatement(domainresource.DomainResource): - """ Record of medication being taken by a patient. - - 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 - 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. - - The primary difference between a medication statement and a medication - administration is that the medication administration has complete - administration information and is based on actual administration - information from the person who administered the medication. A medication - statement is often, if not always, less specific. There is no required - date/time when the medication was administered, in fact we only know that a - source has reported the patient is taking this medication, where details - such as time, quantity, or rate or even medication product may be - incomplete or missing or less precise. As stated earlier, the medication - statement information may come from the patient's memory, from a - prescription bottle or from a list of medications the patient, clinician or - other party maintains. Medication administration is more formal and is not - missing detailed information. - """ - - resource_type = "MedicationStatement" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.basedOn = None - """ Fulfils plan, proposal or order. - 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 - """ Encounter / Episode associated with MedicationStatement. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.dateAsserted = None - """ When the statement was asserted?. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.derivedFrom = None - """ Additional supporting information. - 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 is/was/will be taken. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.effectivePeriod = None - """ The date/time or interval when the medication is/was/will be taken. - Type `Period` (represented as `dict` in JSON). """ - - self.identifier = None - """ External identifier. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.informationSource = None - """ Person or organization that provided the information about the - taking of this medication. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.medicationCodeableConcept = None - """ What medication was taken. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.medicationReference = None - """ What medication was taken. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.note = None - """ Further information about the statement. - 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.reasonCode = None - """ Reason for why the medication is being/was taken. - 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 (represented as `dict` in JSON). """ - - self.status = None - """ active | completed | entered-in-error | intended | stopped | on- - 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` (represented as `dict` in JSON). """ - - super(MedicationStatement, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(MedicationStatement, self).elementProperties() - js.extend([ - ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), - ("category", "category", codeableconcept.CodeableConcept, False, None, False), - ("context", "context", fhirreference.FHIRReference, False, None, False), - ("dateAsserted", "dateAsserted", fhirdate.FHIRDate, False, None, False), - ("derivedFrom", "derivedFrom", fhirreference.FHIRReference, True, None, False), - ("dosage", "dosage", dosage.Dosage, True, None, False), - ("effectiveDateTime", "effectiveDateTime", fhirdate.FHIRDate, False, "effective", False), - ("effectivePeriod", "effectivePeriod", period.Period, False, "effective", False), - ("identifier", "identifier", identifier.Identifier, True, None, False), - ("informationSource", "informationSource", fhirreference.FHIRReference, False, None, False), - ("medicationCodeableConcept", "medicationCodeableConcept", codeableconcept.CodeableConcept, False, "medication", True), - ("medicationReference", "medicationReference", fhirreference.FHIRReference, False, "medication", True), - ("note", "note", annotation.Annotation, True, None, False), - ("partOf", "partOf", fhirreference.FHIRReference, True, None, False), - ("reasonCode", "reasonCode", 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), - ]) - 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 dosage -except ImportError: - dosage = sys.modules[__package__ + '.dosage'] -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/messagedefinition.py b/fhirclient/models/messagedefinition.py deleted file mode 100644 index 965528a11..000000000 --- a/fhirclient/models/messagedefinition.py +++ /dev/null @@ -1,272 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MessageDefinition) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class MessageDefinition(domainresource.DomainResource): - """ A resource that defines a type of message that can be exchanged between - systems. - - Defines the characteristics of a message that can be shared between - systems, including the type of event that initiates the message, the - content to be transmitted and what response(s), if any, are permitted. - """ - - resource_type = "MessageDefinition" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.allowedResponse = None - """ Responses to this message. - List of `MessageDefinitionAllowedResponse` items (represented as `dict` in JSON). """ - - self.base = None - """ Definition this one is based on. - Type `str`. """ - - self.category = None - """ consequence | currency | notification. - Type `str`. """ - - 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 message definition. - Type `str`. """ - - 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`. """ - - self.focus = None - """ 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 - """ 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). - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.name = None - """ Name for this message definition (computer friendly). - Type `str`. """ - - self.parent = None - """ Protocol/workflow this is part of. - List of `str` items. """ - - self.publisher = None - """ Name of the publisher (organization or individual). - Type `str`. """ - - self.purpose = None - """ Why this message definition is defined. - Type `str`. """ - - self.replaces = None - """ Takes the place of. - List of `str` items. """ - - self.responseRequired = None - """ always | on-error | never | on-success. - Type `str`. """ - - self.status = None - """ draft | active | retired | unknown. - Type `str`. """ - - self.title = None - """ Name for this message definition (human friendly). - Type `str`. """ - - self.url = None - """ Business Identifier for a given MessageDefinition. - 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 message definition. - Type `str`. """ - - super(MessageDefinition, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(MessageDefinition, self).elementProperties() - js.extend([ - ("allowedResponse", "allowedResponse", MessageDefinitionAllowedResponse, True, 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), - ("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), - ("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", str, True, None, False), - ("publisher", "publisher", str, False, None, False), - ("purpose", "purpose", str, 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), - ("useContext", "useContext", usagecontext.UsageContext, True, None, False), - ("version", "version", str, False, None, False), - ]) - return js - - -from . import backboneelement - -class MessageDefinitionAllowedResponse(backboneelement.BackboneElement): - """ Responses to this message. - - Indicates what types of messages may be sent as an application-level - response to this message. - """ - - resource_type = "MessageDefinitionAllowedResponse" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.message = None - """ Reference to allowed message definition response. - Type `str`. """ - - self.situation = None - """ When should this response be used. - Type `str`. """ - - super(MessageDefinitionAllowedResponse, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(MessageDefinitionAllowedResponse, self).elementProperties() - js.extend([ - ("message", "message", str, False, None, True), - ("situation", "situation", str, False, None, False), - ]) - return js - - -class MessageDefinitionFocus(backboneelement.BackboneElement): - """ Resource(s) that are the subject of the event. - - Identifies the resource (or resources) that are being addressed by the - event. For example, the Encounter for an admit message or two Account - records for a merge. - """ - - resource_type = "MessageDefinitionFocus" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 resource. - Type `str`. """ - - self.max = None - """ Maximum number of focuses of this type. - Type `str`. """ - - self.min = None - """ Minimum number of focuses of this type. - Type `int`. """ - - self.profile = None - """ Profile that must be adhered to by focus. - Type `str`. """ - - super(MessageDefinitionFocus, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(MessageDefinitionFocus, self).elementProperties() - js.extend([ - ("code", "code", str, False, None, True), - ("max", "max", str, False, None, False), - ("min", "min", int, False, None, True), - ("profile", "profile", str, 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 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/messagedefinition_tests.py b/fhirclient/models/messagedefinition_tests.py deleted file mode 100644 index ac42936ad..000000000 --- a/fhirclient/models/messagedefinition_tests.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/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 messagedefinition -from .fhirdate import FHIRDate - - -class MessageDefinitionTests(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("MessageDefinition", js["resourceType"]) - return messagedefinition.MessageDefinition(js) - - def testMessageDefinition1(self): - inst = self.instantiate_from("messagedefinition-example.json") - self.assertIsNotNone(inst, "Must have instantiated a MessageDefinition instance") - self.implMessageDefinition1(inst) - - js = inst.as_json() - self.assertEqual("MessageDefinition", js["resourceType"]) - inst2 = messagedefinition.MessageDefinition(js) - self.implMessageDefinition1(inst2) - - def implMessageDefinition1(self, inst): - 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.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 MessageDefinition instances.") - self.assertEqual(inst.status, "draft") - self.assertEqual(inst.text.div, "
Message definition base example
") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.title, "Message definition base example") - self.assertEqual(inst.url, "http://hl7.org/fhir/MessageDefinition/example") - diff --git a/fhirclient/models/messageheader.py b/fhirclient/models/messageheader.py deleted file mode 100644 index 9940371c5..000000000 --- a/fhirclient/models/messageheader.py +++ /dev/null @@ -1,255 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MessageHeader) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class MessageHeader(domainresource.DomainResource): - """ A resource that describes a message that is exchanged between systems. - - The header for a message exchange that is either requesting or responding - to an action. The reference(s) that are the subject of the action as well - as other information related to the action are typically transmitted in a - bundle in which the MessageHeader resource instance is the first resource - in the bundle. - """ - - resource_type = "MessageHeader" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ The source of the decision. - 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). - List of `MessageHeaderDestination` items (represented as `dict` in JSON). """ - - self.enterer = None - """ The source of the data entry. - Type `FHIRReference` (represented as `dict` in JSON). """ - - 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 (represented as `dict` in JSON). """ - - self.reason = None - """ Cause of event. - Type `CodeableConcept` (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` (represented as `dict` in JSON). """ - - self.sender = None - """ Real world sender of the message. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.source = None - """ Message source application. - Type `MessageHeaderSource` (represented as `dict` 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), - ("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), - ("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), - ]) - return js - - -from . import backboneelement - -class MessageHeaderDestination(backboneelement.BackboneElement): - """ Message destination application(s). - - The destination application which the message is intended for. - """ - - resource_type = "MessageHeaderDestination" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Actual destination address or id. - Type `str`. """ - - self.name = None - """ 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` (represented as `dict` in JSON). """ - - super(MessageHeaderDestination, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(MessageHeaderDestination, self).elementProperties() - 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 - - -class MessageHeaderResponse(backboneelement.BackboneElement): - """ If this is a reply to prior message. - - Information about the message that this message is a response to. Only - present if this message is a response. - """ - - resource_type = "MessageHeaderResponse" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ ok | transient-error | fatal-error. - Type `str`. """ - - self.details = None - """ Specific list of hints/warnings/errors. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.identifier = None - """ Id of original message. - Type `str`. """ - - super(MessageHeaderResponse, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(MessageHeaderResponse, self).elementProperties() - js.extend([ - ("code", "code", str, False, None, True), - ("details", "details", fhirreference.FHIRReference, False, None, False), - ("identifier", "identifier", str, False, None, True), - ]) - return js - - -class MessageHeaderSource(backboneelement.BackboneElement): - """ Message source application. - - The source application from which this message originated. - """ - - resource_type = "MessageHeaderSource" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Human contact for problems. - Type `ContactPoint` (represented as `dict` in JSON). """ - - self.endpoint = None - """ Actual message source address or id. - Type `str`. """ - - self.name = None - """ Name of system. - Type `str`. """ - - self.software = None - """ Name of software running the system. - Type `str`. """ - - self.version = None - """ Version of software running. - Type `str`. """ - - super(MessageHeaderSource, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(MessageHeaderSource, self).elementProperties() - js.extend([ - ("contact", "contact", contactpoint.ContactPoint, False, None, False), - ("endpoint", "endpoint", str, False, None, True), - ("name", "name", str, False, None, False), - ("software", "software", str, False, 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 coding -except ImportError: - coding = sys.modules[__package__ + '.coding'] -try: - from . import contactpoint -except ImportError: - contactpoint = sys.modules[__package__ + '.contactpoint'] -try: - from . import fhirreference -except ImportError: - fhirreference = sys.modules[__package__ + '.fhirreference'] diff --git a/fhirclient/models/messageheader_tests.py b/fhirclient/models/messageheader_tests.py deleted file mode 100644 index f16e4d6e5..000000000 --- a/fhirclient/models/messageheader_tests.py +++ /dev/null @@ -1,55 +0,0 @@ -#!/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 messageheader -from .fhirdate import FHIRDate - - -class MessageHeaderTests(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("MessageHeader", js["resourceType"]) - return messageheader.MessageHeader(js) - - def testMessageHeader1(self): - inst = self.instantiate_from("messageheader-example.json") - self.assertIsNotNone(inst, "Must have instantiated a MessageHeader instance") - self.implMessageHeader1(inst) - - js = inst.as_json() - self.assertEqual("MessageHeader", js["resourceType"]) - inst2 = messageheader.MessageHeader(js) - 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.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://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") - self.assertEqual(inst.source.contact.value, "+1 (555) 123 4567") - self.assertEqual(inst.source.endpoint, "llp:10.11.12.13:5432") - self.assertEqual(inst.source.name, "Acme Central Patient Registry") - self.assertEqual(inst.source.software, "FooBar Patient Manager") - self.assertEqual(inst.source.version, "3.1.45.AABB") - self.assertEqual(inst.text.status, "generated") - diff --git a/fhirclient/models/meta.py b/fhirclient/models/meta.py deleted file mode 100644 index dcad7467c..000000000 --- a/fhirclient/models/meta.py +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Meta) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import element - -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 might not always - be associated with version changes to the resource. - """ - - resource_type = "Meta" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.lastUpdated = None - """ When the resource version last changed. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.profile = None - """ Profiles this resource claims to conform to. - List of `str` items. """ - - self.security = None - """ 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). """ - - self.versionId = None - """ Version specific identifier. - Type `str`. """ - - super(Meta, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Meta, self).elementProperties() - js.extend([ - ("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), - ]) - return js - - -import sys -try: - from . import coding -except ImportError: - coding = sys.modules[__package__ + '.coding'] -try: - from . import fhirdate -except ImportError: - fhirdate = sys.modules[__package__ + '.fhirdate'] diff --git a/fhirclient/models/metadataresource.py b/fhirclient/models/metadataresource.py deleted file mode 100644 index 174f94fb1..000000000 --- a/fhirclient/models/metadataresource.py +++ /dev/null @@ -1,113 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MetadataResource) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class MetadataResource(domainresource.DomainResource): - """ Common Ancestor declaration for definitional resources. - - Common Ancestor declaration for conformance and knowledge artifact - resources. - """ - - resource_type = "MetadataResource" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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.date = None - """ Date last changed. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.description = None - """ Natural language description of the metadata resource. - Type `str`. """ - - self.experimental = None - """ For testing purposes, not real usage. - Type `bool`. """ - - self.jurisdiction = None - """ Intended jurisdiction for metadata resource (if applicable). - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.name = None - """ Name for this metadata resource (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.title = None - """ Name for this metadata resource (human friendly). - Type `str`. """ - - self.url = None - """ Canonical identifier for this metadata resource, 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 metadata resource. - Type `str`. """ - - super(MetadataResource, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(MetadataResource, self).elementProperties() - js.extend([ - ("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), - ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), - ("name", "name", str, False, None, False), - ("publisher", "publisher", str, False, None, False), - ("status", "status", str, False, None, True), - ("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 - - -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/money.py b/fhirclient/models/money.py deleted file mode 100644 index 2d54db884..000000000 --- a/fhirclient/models/money.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Money) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import element - -class Money(element.Element): - """ An amount of economic utility in some recognized currency. - """ - - resource_type = "Money" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :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 deleted file mode 100644 index 6f283ef77..000000000 --- a/fhirclient/models/namingsystem.py +++ /dev/null @@ -1,175 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/NamingSystem) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class NamingSystem(domainresource.DomainResource): - """ System of unique identification. - - A curated namespace that issues unique symbols within that namespace for - the identification of concepts, people, devices, etc. Represents a - "System" used within the Identifier and Coding data types. - """ - - resource_type = "NamingSystem" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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.date = None - """ Date last changed. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.description = None - """ Natural language description of the naming system. - Type `str`. """ - - self.jurisdiction = None - """ Intended jurisdiction for naming system (if applicable). - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.kind = None - """ codesystem | identifier | root. - Type `str`. """ - - self.name = None - """ Name for this naming system (computer friendly). - Type `str`. """ - - self.publisher = None - """ Name of the publisher (organization or individual). - Type `str`. """ - - self.responsible = None - """ Who maintains system namespace?. - Type `str`. """ - - self.status = None - """ draft | active | retired | unknown. - Type `str`. """ - - self.type = None - """ e.g. driver, provider, patient, bank etc.. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.uniqueId = None - """ Unique identifiers used for system. - List of `NamingSystemUniqueId` items (represented as `dict` in JSON). """ - - self.usage = None - """ How/where is it used. - Type `str`. """ - - self.useContext = None - """ 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) - - def elementProperties(self): - js = super(NamingSystem, self).elementProperties() - js.extend([ - ("contact", "contact", contactdetail.ContactDetail, True, None, False), - ("date", "date", fhirdate.FHIRDate, False, None, True), - ("description", "description", str, False, None, False), - ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), - ("kind", "kind", str, False, None, True), - ("name", "name", str, False, None, True), - ("publisher", "publisher", str, False, None, False), - ("responsible", "responsible", str, False, None, False), - ("status", "status", str, False, None, True), - ("type", "type", codeableconcept.CodeableConcept, False, None, False), - ("uniqueId", "uniqueId", NamingSystemUniqueId, True, None, True), - ("usage", "usage", str, False, None, False), - ("useContext", "useContext", usagecontext.UsageContext, True, None, False), - ]) - return js - - -from . import backboneelement - -class NamingSystemUniqueId(backboneelement.BackboneElement): - """ Unique identifiers used for system. - - Indicates how the system may be identified when referenced in electronic - exchange. - """ - - resource_type = "NamingSystemUniqueId" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Notes about identifier usage. - Type `str`. """ - - self.period = None - """ When is identifier valid?. - Type `Period` (represented as `dict` in JSON). """ - - self.preferred = None - """ Is this the id that should be used for this type. - Type `bool`. """ - - self.type = None - """ oid | uuid | uri | other. - Type `str`. """ - - self.value = None - """ The unique identifier. - Type `str`. """ - - super(NamingSystemUniqueId, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(NamingSystemUniqueId, self).elementProperties() - js.extend([ - ("comment", "comment", str, False, None, False), - ("period", "period", period.Period, False, None, False), - ("preferred", "preferred", bool, False, None, False), - ("type", "type", str, False, None, True), - ("value", "value", 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 period -except ImportError: - period = sys.modules[__package__ + '.period'] -try: - from . import usagecontext -except ImportError: - usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/namingsystem_tests.py b/fhirclient/models/namingsystem_tests.py deleted file mode 100644 index 378dc8154..000000000 --- a/fhirclient/models/namingsystem_tests.py +++ /dev/null @@ -1,98 +0,0 @@ -#!/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 namingsystem -from .fhirdate import FHIRDate - - -class NamingSystemTests(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("NamingSystem", js["resourceType"]) - return namingsystem.NamingSystem(js) - - def testNamingSystem1(self): - inst = self.instantiate_from("namingsystem-example-id.json") - self.assertIsNotNone(inst, "Must have instantiated a NamingSystem instance") - self.implNamingSystem1(inst) - - js = inst.as_json() - self.assertEqual("NamingSystem", js["resourceType"]) - inst2 = namingsystem.NamingSystem(js) - self.implNamingSystem1(inst2) - - def implNamingSystem1(self, inst): - self.assertEqual(inst.contact[0].name, "HL7 Australia FHIR Team") - self.assertEqual(inst.contact[0].telecom[0].system, "url") - 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.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") - self.assertEqual(inst.status, "active") - 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://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") - self.assertEqual(inst.uniqueId[0].value, "1.2.36.1.2001.1003.0") - self.assertEqual(inst.uniqueId[1].period.start.date, FHIRDate("2015-08-21").date) - self.assertEqual(inst.uniqueId[1].period.start.as_json(), "2015-08-21") - self.assertTrue(inst.uniqueId[1].preferred) - self.assertEqual(inst.uniqueId[1].type, "uri") - self.assertEqual(inst.uniqueId[1].value, "http://ns.electronichealth.net.au/id/hi/ihi/1.0") - self.assertEqual(inst.usage, "Used in Australia for identifying patients") - - def testNamingSystem2(self): - inst = self.instantiate_from("namingsystem-example.json") - self.assertIsNotNone(inst, "Must have instantiated a NamingSystem instance") - self.implNamingSystem2(inst) - - js = inst.as_json() - self.assertEqual("NamingSystem", js["resourceType"]) - inst2 = namingsystem.NamingSystem(js) - self.implNamingSystem2(inst2) - - def implNamingSystem2(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("2014-12-13").date) - 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") - self.assertEqual(inst.status, "active") - 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") - self.assertTrue(inst.uniqueId[1].preferred) - self.assertEqual(inst.uniqueId[1].type, "uri") - self.assertEqual(inst.uniqueId[1].value, "http://snomed.info/sct") - diff --git a/fhirclient/models/narrative.py b/fhirclient/models/narrative.py deleted file mode 100644 index 6c19f60c6..000000000 --- a/fhirclient/models/narrative.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# 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): - """ 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" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.div = None - """ Limited xhtml content. - Type `str`. """ - - self.status = None - """ generated | extensions | additional | empty. - Type `str`. """ - - super(Narrative, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Narrative, self).elementProperties() - js.extend([ - ("div", "div", str, False, None, True), - ("status", "status", str, False, None, True), - ]) - return js - - diff --git a/fhirclient/models/nutritionorder.py b/fhirclient/models/nutritionorder.py deleted file mode 100644 index 93d365623..000000000 --- a/fhirclient/models/nutritionorder.py +++ /dev/null @@ -1,458 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/NutritionOrder) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class NutritionOrder(domainresource.DomainResource): - """ Diet, formula or nutritional supplement request. - - A request to supply a diet, formula feeding (enteral) or oral nutritional - supplement to a patient/resident. - """ - - resource_type = "NutritionOrder" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.allergyIntolerance = None - """ List of the patient's food and nutrition-related allergies and - intolerances. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.dateTime = None - """ Date and time the nutrition order was requested. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.encounter = None - """ The encounter associated with this nutrition order. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.enteralFormula = None - """ Enteral formula components. - Type `NutritionOrderEnteralFormula` (represented as `dict` in JSON). """ - - self.excludeFoodModifier = None - """ Order-specific modifier about the type of food that should not be - given. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.foodPreferenceModifier = None - """ Order-specific modifier about the type of food that should be given. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.identifier = None - """ 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` (represented as `dict` in JSON). """ - - self.patient = None - """ The person who requires the diet, formula or nutritional supplement. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.status = None - """ proposed | draft | planned | requested | active | on-hold | - completed | cancelled | entered-in-error. - Type `str`. """ - - self.supplement = None - """ Supplement components. - List of `NutritionOrderSupplement` items (represented as `dict` in JSON). """ - - super(NutritionOrder, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(NutritionOrder, self).elementProperties() - js.extend([ - ("allergyIntolerance", "allergyIntolerance", fhirreference.FHIRReference, True, None, False), - ("dateTime", "dateTime", fhirdate.FHIRDate, False, None, True), - ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), - ("enteralFormula", "enteralFormula", NutritionOrderEnteralFormula, False, None, False), - ("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, True), - ("supplement", "supplement", NutritionOrderSupplement, True, None, False), - ]) - return js - - -from . import backboneelement - -class NutritionOrderEnteralFormula(backboneelement.BackboneElement): - """ Enteral formula components. - - Feeding provided through the gastrointestinal tract via a tube, catheter, - or stoma that delivers nutrition distal to the oral cavity. - """ - - resource_type = "NutritionOrderEnteralFormula" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.additiveProductName = None - """ Product or brand name of the modular additive. - Type `str`. """ - - self.additiveType = None - """ Type of modular component to add to the feeding. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.administration = None - """ Formula feeding instruction as structured data. - List of `NutritionOrderEnteralFormulaAdministration` items (represented as `dict` in JSON). """ - - self.administrationInstruction = None - """ Formula feeding instructions expressed as text. - Type `str`. """ - - self.baseFormulaProductName = None - """ Product or brand name of the enteral or infant formula. - Type `str`. """ - - self.baseFormulaType = None - """ Type of enteral or infant formula. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.caloricDensity = None - """ Amount of energy per specified volume that is required. - Type `Quantity` (represented as `dict` in JSON). """ - - self.maxVolumeToDeliver = None - """ Upper limit on formula volume per unit of time. - Type `Quantity` (represented as `dict` in JSON). """ - - self.routeofAdministration = None - """ How the formula should enter the patient's gastrointestinal tract. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(NutritionOrderEnteralFormula, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(NutritionOrderEnteralFormula, self).elementProperties() - js.extend([ - ("additiveProductName", "additiveProductName", str, False, None, False), - ("additiveType", "additiveType", codeableconcept.CodeableConcept, False, None, False), - ("administration", "administration", NutritionOrderEnteralFormulaAdministration, True, None, False), - ("administrationInstruction", "administrationInstruction", str, False, None, False), - ("baseFormulaProductName", "baseFormulaProductName", str, False, None, False), - ("baseFormulaType", "baseFormulaType", codeableconcept.CodeableConcept, False, None, False), - ("caloricDensity", "caloricDensity", quantity.Quantity, False, None, False), - ("maxVolumeToDeliver", "maxVolumeToDeliver", quantity.Quantity, False, None, False), - ("routeofAdministration", "routeofAdministration", codeableconcept.CodeableConcept, False, None, False), - ]) - return js - - -class NutritionOrderEnteralFormulaAdministration(backboneelement.BackboneElement): - """ Formula feeding instruction as structured data. - - Formula administration instructions as structured data. This repeating - structure allows for changing the administration rate or volume over time - for both bolus and continuous feeding. An example of this would be an - instruction to increase the rate of continuous feeding every 2 hours. - """ - - resource_type = "NutritionOrderEnteralFormulaAdministration" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 volume of formula to provide. - Type `Quantity` (represented as `dict` in JSON). """ - - self.rateQuantity = None - """ Speed with which the formula is provided per period of time. - Type `Quantity` (represented as `dict` in JSON). """ - - self.rateRatio = None - """ Speed with which the formula is provided per period of time. - Type `Ratio` (represented as `dict` in JSON). """ - - self.schedule = None - """ Scheduled frequency of enteral feeding. - Type `Timing` (represented as `dict` in JSON). """ - - super(NutritionOrderEnteralFormulaAdministration, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(NutritionOrderEnteralFormulaAdministration, self).elementProperties() - js.extend([ - ("quantity", "quantity", quantity.Quantity, False, None, False), - ("rateQuantity", "rateQuantity", quantity.Quantity, False, "rate", False), - ("rateRatio", "rateRatio", ratio.Ratio, False, "rate", False), - ("schedule", "schedule", timing.Timing, False, None, False), - ]) - return js - - -class NutritionOrderOralDiet(backboneelement.BackboneElement): - """ Oral diet components. - - Diet given orally in contrast to enteral (tube) feeding. - """ - - resource_type = "NutritionOrderOralDiet" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.fluidConsistencyType = None - """ The required consistency of fluids and liquids provided to the - patient. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.instruction = None - """ Instructions or additional information about the oral diet. - Type `str`. """ - - self.nutrient = None - """ Required nutrient modifications. - List of `NutritionOrderOralDietNutrient` items (represented as `dict` in JSON). """ - - self.schedule = None - """ Scheduled frequency of diet. - List of `Timing` items (represented as `dict` in JSON). """ - - self.texture = None - """ Required texture modifications. - List of `NutritionOrderOralDietTexture` items (represented as `dict` in JSON). """ - - self.type = None - """ Type of oral diet or diet restrictions that describe what can be - consumed orally. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - super(NutritionOrderOralDiet, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(NutritionOrderOralDiet, self).elementProperties() - js.extend([ - ("fluidConsistencyType", "fluidConsistencyType", codeableconcept.CodeableConcept, True, None, False), - ("instruction", "instruction", str, False, None, False), - ("nutrient", "nutrient", NutritionOrderOralDietNutrient, True, None, False), - ("schedule", "schedule", timing.Timing, True, None, False), - ("texture", "texture", NutritionOrderOralDietTexture, True, None, False), - ("type", "type", codeableconcept.CodeableConcept, True, None, False), - ]) - return js - - -class NutritionOrderOralDietNutrient(backboneelement.BackboneElement): - """ Required nutrient modifications. - - Class that defines the quantity and type of nutrient modifications (for - example carbohydrate, fiber or sodium) required for the oral diet. - """ - - resource_type = "NutritionOrderOralDietNutrient" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 the specified nutrient. - Type `Quantity` (represented as `dict` in JSON). """ - - self.modifier = None - """ Type of nutrient that is being modified. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(NutritionOrderOralDietNutrient, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(NutritionOrderOralDietNutrient, self).elementProperties() - js.extend([ - ("amount", "amount", quantity.Quantity, False, None, False), - ("modifier", "modifier", codeableconcept.CodeableConcept, False, None, False), - ]) - return js - - -class NutritionOrderOralDietTexture(backboneelement.BackboneElement): - """ Required texture modifications. - - Class that describes any texture modifications required for the patient to - safely consume various types of solid foods. - """ - - resource_type = "NutritionOrderOralDietTexture" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.foodType = None - """ Concepts that are used to identify an entity that is ingested for - nutritional purposes. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.modifier = None - """ Code to indicate how to alter the texture of the foods, e.g. pureed. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(NutritionOrderOralDietTexture, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(NutritionOrderOralDietTexture, self).elementProperties() - js.extend([ - ("foodType", "foodType", codeableconcept.CodeableConcept, False, None, False), - ("modifier", "modifier", codeableconcept.CodeableConcept, False, None, False), - ]) - return js - - -class NutritionOrderSupplement(backboneelement.BackboneElement): - """ Supplement components. - - Oral nutritional products given in order to add further nutritional value - to the patient's diet. - """ - - resource_type = "NutritionOrderSupplement" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Instructions or additional information about the oral supplement. - Type `str`. """ - - self.productName = None - """ Product or brand name of the nutritional supplement. - Type `str`. """ - - self.quantity = None - """ Amount of the nutritional supplement. - Type `Quantity` (represented as `dict` in JSON). """ - - self.schedule = None - """ Scheduled frequency of supplement. - List of `Timing` items (represented as `dict` in JSON). """ - - self.type = None - """ Type of supplement product requested. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(NutritionOrderSupplement, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(NutritionOrderSupplement, self).elementProperties() - js.extend([ - ("instruction", "instruction", str, False, None, False), - ("productName", "productName", str, False, None, False), - ("quantity", "quantity", quantity.Quantity, False, None, False), - ("schedule", "schedule", timing.Timing, True, None, False), - ("type", "type", 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 quantity -except ImportError: - quantity = sys.modules[__package__ + '.quantity'] -try: - from . import ratio -except ImportError: - ratio = sys.modules[__package__ + '.ratio'] -try: - from . import timing -except ImportError: - timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/nutritionorder_tests.py b/fhirclient/models/nutritionorder_tests.py deleted file mode 100644 index 13c57493b..000000000 --- a/fhirclient/models/nutritionorder_tests.py +++ /dev/null @@ -1,543 +0,0 @@ -#!/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 nutritionorder -from .fhirdate import FHIRDate - - -class NutritionOrderTests(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("NutritionOrder", js["resourceType"]) - return nutritionorder.NutritionOrder(js) - - def testNutritionOrder1(self): - inst = self.instantiate_from("nutritionorder-example-diabeticsupplement.json") - self.assertIsNotNone(inst, "Must have instantiated a NutritionOrder instance") - self.implNutritionOrder1(inst) - - js = inst.as_json() - self.assertEqual("NutritionOrder", js["resourceType"]) - inst2 = nutritionorder.NutritionOrder(js) - 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, "kosher") - 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") - self.assertEqual(inst.supplement[0].quantity.value, 1) - self.assertEqual(inst.supplement[0].schedule[0].repeat.boundsPeriod.start.date, FHIRDate("2015-02-10T15:00:00Z").date) - self.assertEqual(inst.supplement[0].schedule[0].repeat.boundsPeriod.start.as_json(), "2015-02-10T15:00:00Z") - self.assertEqual(inst.supplement[0].schedule[0].repeat.frequency, 1) - self.assertEqual(inst.supplement[0].schedule[0].repeat.period, 24) - self.assertEqual(inst.supplement[0].schedule[0].repeat.periodUnit, "h") - self.assertEqual(inst.supplement[0].schedule[1].repeat.duration, 1) - self.assertEqual(inst.supplement[0].schedule[1].repeat.durationUnit, "h") - self.assertEqual(inst.supplement[0].schedule[1].repeat.when[0], "HS") - self.assertEqual(inst.supplement[0].type.coding[0].code, "443051000124104") - self.assertEqual(inst.supplement[0].type.coding[0].display, "Adult diabetes specialty 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 diabetic formula") - self.assertEqual(inst.supplement[0].type.coding[1].system, "http://goodhealthhospital.org/supplement-type-codes") - self.assertEqual(inst.supplement[0].type.text, "Adult diabetic formula") - self.assertEqual(inst.text.status, "generated") - - def testNutritionOrder2(self): - inst = self.instantiate_from("nutritionorder-example-enteralbolus.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.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://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") - self.assertEqual(inst.enteralFormula.administration[0].quantity.unit, "milliliters") - self.assertEqual(inst.enteralFormula.administration[0].quantity.value, 240) - self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.boundsPeriod.start.date, FHIRDate("2014-09-17T16:00:00Z").date) - self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.boundsPeriod.start.as_json(), "2014-09-17T16:00:00Z") - self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.frequency, 1) - 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, "442991000124104") - self.assertEqual(inst.enteralFormula.baseFormulaType.coding[0].display, "Adult high protein 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.5) - 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, 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://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://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 testNutritionOrder3(self): - inst = self.instantiate_from("nutritionorder-example-fiberrestricteddiet.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") - 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, "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") - self.assertEqual(inst.oralDiet.nutrient[0].amount.value, 50) - self.assertEqual(inst.oralDiet.nutrient[0].modifier.coding[0].code, "256674009") - self.assertEqual(inst.oralDiet.nutrient[0].modifier.coding[0].display, "Fat") - 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, "15108003") - self.assertEqual(inst.oralDiet.type[0].coding[0].display, "Restricted fiber diet") - self.assertEqual(inst.oralDiet.type[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.oralDiet.type[0].coding[1].code, "1000") - self.assertEqual(inst.oralDiet.type[0].coding[1].display, "Fiber restricted") - self.assertEqual(inst.oralDiet.type[0].coding[1].system, "http://goodhealthhospital.org/diet-type-codes") - self.assertEqual(inst.oralDiet.type[0].text, "Fiber restricted diet") - self.assertEqual(inst.oralDiet.type[1].coding[0].code, "16208003") - self.assertEqual(inst.oralDiet.type[1].coding[0].display, "Low fat diet") - self.assertEqual(inst.oralDiet.type[1].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.oralDiet.type[1].coding[1].code, "1100") - self.assertEqual(inst.oralDiet.type[1].coding[1].display, "Low Fat") - self.assertEqual(inst.oralDiet.type[1].coding[1].system, "http://goodhealthhospital.org/diet-type-codes") - self.assertEqual(inst.oralDiet.type[1].text, "Low fat diet") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.status, "generated") - - 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.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.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://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") - self.assertEqual(inst.enteralFormula.administration[0].quantity.unit, "ounces") - self.assertEqual(inst.enteralFormula.administration[0].quantity.value, 4) - self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.boundsPeriod.start.date, FHIRDate("2014-09-17").date) - self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.boundsPeriod.start.as_json(), "2014-09-17") - self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.frequency, 1) - self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.period, 3) - self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.periodUnit, "h") - self.assertEqual(inst.enteralFormula.baseFormulaProductName, "Acme Infant Formula + Iron") - self.assertEqual(inst.enteralFormula.baseFormulaType.coding[0].code, "412414007") - self.assertEqual(inst.enteralFormula.baseFormulaType.coding[0].display, "infant formula + iron") - self.assertEqual(inst.enteralFormula.baseFormulaType.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.enteralFormula.caloricDensity.code, "cal/[foz_us]") - self.assertEqual(inst.enteralFormula.caloricDensity.system, "http://unitsofmeasure.org") - self.assertEqual(inst.enteralFormula.caloricDensity.unit, "calories per ounce") - self.assertEqual(inst.enteralFormula.caloricDensity.value, 20) - self.assertEqual(inst.enteralFormula.maxVolumeToDeliver.code, "[foz_us]") - self.assertEqual(inst.enteralFormula.maxVolumeToDeliver.system, "http://unitsofmeasure.org") - self.assertEqual(inst.enteralFormula.maxVolumeToDeliver.unit, "ounces") - 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://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 testNutritionOrder7(self): - inst = self.instantiate_from("nutritionorder-example-enteralcontinuous.json") - self.assertIsNotNone(inst, "Must have instantiated a NutritionOrder instance") - self.implNutritionOrder7(inst) - - js = inst.as_json() - self.assertEqual("NutritionOrder", js["resourceType"]) - inst2 = nutritionorder.NutritionOrder(js) - self.implNutritionOrder7(inst2) - - 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.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.text.status, "generated") - - def testNutritionOrder9(self): - inst = self.instantiate_from("nutritionorder-example-pureeddiet.json") - self.assertIsNotNone(inst, "Must have instantiated a NutritionOrder instance") - self.implNutritionOrder9(inst) - - js = inst.as_json() - self.assertEqual("NutritionOrder", js["resourceType"]) - inst2 = nutritionorder.NutritionOrder(js) - self.implNutritionOrder9(inst2) - - 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.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") - 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.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 deleted file mode 100644 index 7814cb68a..000000000 --- a/fhirclient/models/observation.py +++ /dev/null @@ -1,430 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Observation) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class Observation(domainresource.DomainResource): - """ Measurements and simple assertions. - - Measurements and simple assertions made about a patient, device or other - subject. - """ - - resource_type = "Observation" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :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 - """ Observed body part. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.category = None - """ Classification of type 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.component = None - """ Component results. - List of `ObservationComponent` items (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` (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.. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.issued = None - """ 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 (represented as `dict` in JSON). """ - - self.referenceRange = None - """ Provides guide for interpretation. - List of `ObservationReferenceRange` items (represented as `dict` in JSON). """ - - self.specimen = None - """ Specimen used for this observation. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.status = None - """ registered | preliminary | final | amended +. - Type `str`. """ - - self.subject = None - """ Who and/or what the observation is about. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.valueBoolean = None - """ Actual result. - Type `bool`. """ - - self.valueCodeableConcept = None - """ Actual result. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.valueDateTime = None - """ 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). """ - - self.valueQuantity = None - """ Actual result. - Type `Quantity` (represented as `dict` in JSON). """ - - self.valueRange = None - """ Actual result. - Type `Range` (represented as `dict` in JSON). """ - - self.valueRatio = None - """ Actual result. - Type `Ratio` (represented as `dict` in JSON). """ - - self.valueSampledData = None - """ Actual result. - Type `SampledData` (represented as `dict` in JSON). """ - - self.valueString = None - """ Actual result. - Type `str`. """ - - self.valueTime = None - """ Actual result. - Type `FHIRDate` (represented as `str` in JSON). """ - - super(Observation, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Observation, self).elementProperties() - js.extend([ - ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), - ("bodySite", "bodySite", codeableconcept.CodeableConcept, False, None, False), - ("category", "category", codeableconcept.CodeableConcept, True, None, False), - ("code", "code", codeableconcept.CodeableConcept, False, None, True), - ("component", "component", ObservationComponent, True, 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, 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), - ("specimen", "specimen", fhirreference.FHIRReference, False, None, False), - ("status", "status", str, False, None, True), - ("subject", "subject", fhirreference.FHIRReference, False, None, 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), - ("valueRatio", "valueRatio", ratio.Ratio, False, "value", False), - ("valueSampledData", "valueSampledData", sampleddata.SampledData, False, "value", False), - ("valueString", "valueString", str, False, "value", False), - ("valueTime", "valueTime", fhirdate.FHIRDate, False, "value", False), - ]) - return js - - -from . import backboneelement - -class ObservationComponent(backboneelement.BackboneElement): - """ Component results. - - Some observations have multiple component observations. These component - observations are expressed as separate code value pairs that share the same - attributes. Examples include systolic and diastolic component observations - for blood pressure measurement and multiple component observations for - genetics observations. - """ - - resource_type = "ObservationComponent" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 component observation (code / type). - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.dataAbsentReason = None - """ Why the component result is missing. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.interpretation = None - """ High, low, normal, etc.. - 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.valueBoolean = None - """ Actual component result. - Type `bool`. """ - - self.valueCodeableConcept = None - """ Actual component result. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.valueDateTime = None - """ 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). """ - - self.valueQuantity = None - """ Actual component result. - Type `Quantity` (represented as `dict` in JSON). """ - - self.valueRange = None - """ Actual component result. - Type `Range` (represented as `dict` in JSON). """ - - self.valueRatio = None - """ Actual component result. - Type `Ratio` (represented as `dict` in JSON). """ - - self.valueSampledData = None - """ Actual component result. - Type `SampledData` (represented as `dict` in JSON). """ - - self.valueString = None - """ Actual component result. - Type `str`. """ - - self.valueTime = None - """ Actual component result. - Type `FHIRDate` (represented as `str` in JSON). """ - - super(ObservationComponent, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ObservationComponent, self).elementProperties() - js.extend([ - ("code", "code", codeableconcept.CodeableConcept, False, None, True), - ("dataAbsentReason", "dataAbsentReason", codeableconcept.CodeableConcept, False, None, False), - ("interpretation", "interpretation", codeableconcept.CodeableConcept, True, None, False), - ("referenceRange", "referenceRange", ObservationReferenceRange, True, None, 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), - ("valueRatio", "valueRatio", ratio.Ratio, False, "value", False), - ("valueSampledData", "valueSampledData", sampleddata.SampledData, False, "value", False), - ("valueString", "valueString", str, False, "value", False), - ("valueTime", "valueTime", fhirdate.FHIRDate, False, "value", False), - ]) - return js - - -class ObservationReferenceRange(backboneelement.BackboneElement): - """ Provides guide for interpretation. - - Guidance on how to interpret the value by comparison to a normal or - 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" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Reference range population. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.high = None - """ High Range, if relevant. - Type `Quantity` (represented as `dict` in JSON). """ - - self.low = None - """ Low Range, if relevant. - Type `Quantity` (represented as `dict` in JSON). """ - - self.text = None - """ Text based reference range in an observation. - Type `str`. """ - - self.type = None - """ Reference range qualifier. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(ObservationReferenceRange, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ObservationReferenceRange, self).elementProperties() - js.extend([ - ("age", "age", range.Range, False, None, False), - ("appliesTo", "appliesTo", codeableconcept.CodeableConcept, True, None, False), - ("high", "high", quantity.Quantity, False, None, False), - ("low", "low", quantity.Quantity, False, None, False), - ("text", "text", str, False, None, False), - ("type", "type", 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 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 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 deleted file mode 100644 index 11260390d..000000000 --- a/fhirclient/models/observation_tests.py +++ /dev/null @@ -1,339 +0,0 @@ -#!/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 observation -from .fhirdate import FHIRDate - - -class ObservationTests(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("Observation", js["resourceType"]) - return observation.Observation(js) - - def testObservation1(self): - inst = self.instantiate_from("observation-example-genetics-1.json") - self.assertIsNotNone(inst, "Must have instantiated a Observation instance") - self.implObservation1(inst) - - js = inst.as_json() - self.assertEqual("Observation", js["resourceType"]) - inst2 = observation.Observation(js) - self.implObservation1(inst2) - - def implObservation1(self, inst): - 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.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.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-bmd.json") - self.assertIsNotNone(inst, "Must have instantiated a Observation instance") - self.implObservation2(inst) - - js = inst.as_json() - self.assertEqual("Observation", js["resourceType"]) - inst2 = observation.Observation(js) - self.implObservation2(inst2) - - def implObservation2(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.code.coding[0].system, "http://loinc.org") - 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, "g/cm-2") - self.assertEqual(inst.valueQuantity.system, "http://unitsofmeasure.org") - self.assertEqual(inst.valueQuantity.unit, "g/cm²") - self.assertEqual(inst.valueQuantity.value, 0.887) - - def testObservation3(self): - inst = self.instantiate_from("observation-example-respiratory-rate.json") - self.assertIsNotNone(inst, "Must have instantiated a Observation instance") - self.implObservation3(inst) - - js = inst.as_json() - self.assertEqual("Observation", js["resourceType"]) - inst2 = observation.Observation(js) - self.implObservation3(inst2) - - def implObservation3(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://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, "/min") - self.assertEqual(inst.valueQuantity.system, "http://unitsofmeasure.org") - self.assertEqual(inst.valueQuantity.unit, "breaths/minute") - self.assertEqual(inst.valueQuantity.value, 26) - - def testObservation4(self): - inst = self.instantiate_from("observation-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Observation instance") - self.implObservation4(inst) - - js = inst.as_json() - self.assertEqual("Observation", js["resourceType"]) - inst2 = observation.Observation(js) - self.implObservation4(inst2) - - def implObservation4(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://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.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, "[lb_av]") - self.assertEqual(inst.valueQuantity.system, "http://unitsofmeasure.org") - self.assertEqual(inst.valueQuantity.unit, "lbs") - self.assertEqual(inst.valueQuantity.value, 185) - - def testObservation5(self): - inst = self.instantiate_from("observation-example-haplotype2.json") - self.assertIsNotNone(inst, "Must have instantiated a Observation instance") - self.implObservation5(inst) - - js = inst.as_json() - self.assertEqual("Observation", js["resourceType"]) - inst2 = observation.Observation(js) - self.implObservation5(inst2) - - def implObservation5(self, inst): - 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.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.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-mbp.json") - self.assertIsNotNone(inst, "Must have instantiated a Observation instance") - self.implObservation6(inst) - - js = inst.as_json() - self.assertEqual("Observation", js["resourceType"]) - inst2 = observation.Observation(js) - self.implObservation6(inst2) - - def implObservation6(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://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, "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-genetics-brcapat.json") - self.assertIsNotNone(inst, "Must have instantiated a Observation instance") - self.implObservation7(inst) - - js = inst.as_json() - self.assertEqual("Observation", js["resourceType"]) - inst2 = observation.Observation(js) - self.implObservation7(inst2) - - def implObservation7(self, inst): - 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.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-bmi.json") - self.assertIsNotNone(inst, "Must have instantiated a Observation instance") - self.implObservation8(inst) - - js = inst.as_json() - self.assertEqual("Observation", js["resourceType"]) - inst2 = observation.Observation(js) - self.implObservation8(inst2) - - def implObservation8(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://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, "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-body-height.json") - self.assertIsNotNone(inst, "Must have instantiated a Observation instance") - self.implObservation9(inst) - - js = inst.as_json() - self.assertEqual("Observation", js["resourceType"]) - inst2 = observation.Observation(js) - self.implObservation9(inst2) - - def implObservation9(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://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, "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, "[in_i]") - self.assertEqual(inst.valueQuantity.system, "http://unitsofmeasure.org") - self.assertEqual(inst.valueQuantity.unit, "in") - self.assertEqual(inst.valueQuantity.value, 66.89999999999999) - - def testObservation10(self): - inst = self.instantiate_from("observation-example-eye-color.json") - self.assertIsNotNone(inst, "Must have instantiated a Observation instance") - self.implObservation10(inst) - - js = inst.as_json() - self.assertEqual("Observation", js["resourceType"]) - inst2 = observation.Observation(js) - self.implObservation10(inst2) - - def implObservation10(self, inst): - 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.valueString, "blue") - diff --git a/fhirclient/models/operationdefinition.py b/fhirclient/models/operationdefinition.py deleted file mode 100644 index 631c02626..000000000 --- a/fhirclient/models/operationdefinition.py +++ /dev/null @@ -1,375 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/OperationDefinition) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class OperationDefinition(domainresource.DomainResource): - """ Definition of an operation or a named query. - - A formal computable definition of an operation (on the RESTful interface) - or a named query (using the search interaction). - """ - - resource_type = "OperationDefinition" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :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 `str`. """ - - self.code = None - """ Name used to invoke the operation. - Type `str`. """ - - self.comment = None - """ Additional information about use. - Type `str`. """ - - self.contact = None - """ Contact details for the publisher. - List of `ContactDetail` items (represented as `dict` in JSON). """ - - self.date = None - """ Date last changed. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.description = None - """ Natural language description of the operation definition. - Type `str`. """ - - self.experimental = None - """ For testing purposes, not real usage. - Type `bool`. """ - - self.inputProfile = None - """ Validation information for in parameters. - Type `str`. """ - - self.instance = None - """ Invoke on an instance?. - Type `bool`. """ - - self.jurisdiction = None - """ Intended jurisdiction for operation definition (if applicable). - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.kind = None - """ operation | query. - Type `str`. """ - - self.name = None - """ 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). """ - - self.parameter = None - """ Parameters for the operation/query. - List of `OperationDefinitionParameter` items (represented as `dict` in JSON). """ - - self.publisher = None - """ Name of the publisher (organization or individual). - Type `str`. """ - - self.purpose = None - """ Why this operation definition is defined. - Type `str`. """ - - self.resource = None - """ Types this operation applies to. - List of `str` items. """ - - self.status = None - """ draft | active | retired | unknown. - Type `str`. """ - - self.system = None - """ Invoke at the system level?. - Type `bool`. """ - - self.title = None - """ Name for this operation definition (human friendly). - Type `str`. """ - - self.type = None - """ Invoke at the type level?. - Type `bool`. """ - - self.url = None - """ Canonical identifier for this operation 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 operation definition. - Type `str`. """ - - super(OperationDefinition, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(OperationDefinition, self).elementProperties() - js.extend([ - ("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), - ("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), - ("purpose", "purpose", str, False, None, False), - ("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), - ("version", "version", str, False, None, False), - ]) - return js - - -from . import backboneelement - -class OperationDefinitionOverload(backboneelement.BackboneElement): - """ Define overloaded variants for when generating code. - - Defines an appropriate combination of parameters to use when invoking this - operation, to help code generators when generating overloaded parameter - sets for this operation. - """ - - resource_type = "OperationDefinitionOverload" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Comments to go on overload. - Type `str`. """ - - self.parameterName = None - """ Name of parameter to include in overload. - List of `str` items. """ - - super(OperationDefinitionOverload, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(OperationDefinitionOverload, self).elementProperties() - js.extend([ - ("comment", "comment", str, False, None, False), - ("parameterName", "parameterName", str, True, None, False), - ]) - return js - - -class OperationDefinitionParameter(backboneelement.BackboneElement): - """ Parameters for the operation/query. - - The parameters for the operation/query. - """ - - resource_type = "OperationDefinitionParameter" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.binding = None - """ ValueSet details if this is coded. - Type `OperationDefinitionParameterBinding` (represented as `dict` in JSON). """ - - self.documentation = None - """ Description of meaning/use. - Type `str`. """ - - self.max = None - """ Maximum Cardinality (a number or *). - Type `str`. """ - - self.min = None - """ Minimum Cardinality. - Type `int`. """ - - self.name = None - """ Name in Parameters.parameter.name or in URL. - Type `str`. """ - - self.part = None - """ Parts of a nested Parameter. - List of `OperationDefinitionParameter` items (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 | 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`. """ - - self.use = None - """ in | out. - Type `str`. """ - - super(OperationDefinitionParameter, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(OperationDefinitionParameter, self).elementProperties() - js.extend([ - ("binding", "binding", OperationDefinitionParameterBinding, False, None, False), - ("documentation", "documentation", str, False, None, False), - ("max", "max", str, False, None, True), - ("min", "min", int, False, None, True), - ("name", "name", str, False, None, True), - ("part", "part", OperationDefinitionParameter, True, 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), - ]) - return js - - -class OperationDefinitionParameterBinding(backboneelement.BackboneElement): - """ ValueSet details if this is coded. - - Binds to a value set if this parameter is coded (code, Coding, - CodeableConcept). - """ - - resource_type = "OperationDefinitionParameterBinding" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.strength = None - """ required | extensible | preferred | example. - Type `str`. """ - - self.valueSet = None - """ Source of value set. - Type `str`. """ - - super(OperationDefinitionParameterBinding, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(OperationDefinitionParameterBinding, self).elementProperties() - js.extend([ - ("strength", "strength", str, False, None, 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 - - -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/operationdefinition_tests.py b/fhirclient/models/operationdefinition_tests.py deleted file mode 100644 index 9d4fac102..000000000 --- a/fhirclient/models/operationdefinition_tests.py +++ /dev/null @@ -1,86 +0,0 @@ -#!/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 operationdefinition -from .fhirdate import FHIRDate - - -class OperationDefinitionTests(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("OperationDefinition", js["resourceType"]) - return operationdefinition.OperationDefinition(js) - - def testOperationDefinition1(self): - inst = self.instantiate_from("operationdefinition-example.json") - self.assertIsNotNone(inst, "Must have instantiated a OperationDefinition instance") - self.implOperationDefinition1(inst) - - js = inst.as_json() - self.assertEqual("OperationDefinition", js["resourceType"]) - inst2 = operationdefinition.OperationDefinition(js) - 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") - self.assertEqual(inst.contact[0].telecom[0].system, "email") - 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 implementation") - self.assertEqual(inst.id, "example") - self.assertTrue(inst.instance) - self.assertEqual(inst.jurisdiction[0].coding[0].code, "GB") - self.assertEqual(inst.jurisdiction[0].coding[0].display, "United Kingdom of Great Britain and Northern Ireland (the)") - self.assertEqual(inst.jurisdiction[0].coding[0].system, "urn:iso:std:iso:3166") - self.assertEqual(inst.kind, "operation") - self.assertEqual(inst.name, "Populate Questionnaire") - self.assertEqual(inst.overload[0].parameterName[0], "subject") - self.assertEqual(inst.overload[0].parameterName[1], "local") - self.assertEqual(inst.overload[1].comment, "local defaults to false when not passed as a parameter") - self.assertEqual(inst.overload[1].parameterName[0], "subject") - self.assertEqual(inst.parameter[0].max, "1") - self.assertEqual(inst.parameter[0].min, 1) - self.assertEqual(inst.parameter[0].name, "subject") - self.assertEqual(inst.parameter[0].type, "Reference") - self.assertEqual(inst.parameter[0].use, "in") - self.assertEqual(inst.parameter[1].documentation, "If the *local* parameter is set to true, server information about the specified subject will be used to populate the instance.") - self.assertEqual(inst.parameter[1].max, "1") - self.assertEqual(inst.parameter[1].min, 0) - self.assertEqual(inst.parameter[1].name, "local") - self.assertEqual(inst.parameter[1].type, "Reference") - self.assertEqual(inst.parameter[1].use, "in") - self.assertEqual(inst.parameter[2].documentation, "The partially (or fully)-populated set of answers for the specified Questionnaire") - self.assertEqual(inst.parameter[2].max, "1") - self.assertEqual(inst.parameter[2].min, 1) - self.assertEqual(inst.parameter[2].name, "return") - self.assertEqual(inst.parameter[2].type, "QuestionnaireResponse") - self.assertEqual(inst.parameter[2].use, "out") - self.assertEqual(inst.publisher, "Acme Healthcare Services") - self.assertEqual(inst.resource[0], "Questionnaire") - self.assertEqual(inst.status, "draft") - self.assertFalse(inst.system) - self.assertEqual(inst.text.status, "generated") - self.assertFalse(inst.type) - self.assertEqual(inst.url, "http://h7.org/fhir/OperationDefinition/example") - self.assertEqual(inst.useContext[0].code.code, "venue") - self.assertEqual(inst.useContext[0].code.display, "Clinical Venue") - 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://terminology.hl7.org/CodeSystem/v3-ActCode") - self.assertEqual(inst.version, "B") - diff --git a/fhirclient/models/operationoutcome.py b/fhirclient/models/operationoutcome.py deleted file mode 100644 index eca22f0c8..000000000 --- a/fhirclient/models/operationoutcome.py +++ /dev/null @@ -1,103 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/OperationOutcome) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class OperationOutcome(domainresource.DomainResource): - """ Information about the success/failure of an action. - - A collection of error, warning, or information messages that result from a - system action. - """ - - resource_type = "OperationOutcome" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.issue = None - """ A single issue associated with the action. - List of `OperationOutcomeIssue` items (represented as `dict` in JSON). """ - - super(OperationOutcome, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(OperationOutcome, self).elementProperties() - js.extend([ - ("issue", "issue", OperationOutcomeIssue, True, None, True), - ]) - return js - - -from . import backboneelement - -class OperationOutcomeIssue(backboneelement.BackboneElement): - """ A single issue associated with the action. - - An error, warning, or information message that results from a system - action. - """ - - resource_type = "OperationOutcomeIssue" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Error or warning code. - Type `str`. """ - - self.details = None - """ Additional details about the error. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.diagnostics = None - """ Additional diagnostic information about the issue. - Type `str`. """ - - self.expression = None - """ FHIRPath of element(s) related to issue. - List of `str` items. """ - - self.location = None - """ Deprecated: Path of element(s) related to issue. - List of `str` items. """ - - self.severity = None - """ fatal | error | warning | information. - Type `str`. """ - - super(OperationOutcomeIssue, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(OperationOutcomeIssue, self).elementProperties() - js.extend([ - ("code", "code", str, False, None, True), - ("details", "details", codeableconcept.CodeableConcept, False, None, False), - ("diagnostics", "diagnostics", str, False, None, False), - ("expression", "expression", str, True, None, False), - ("location", "location", str, True, None, False), - ("severity", "severity", str, False, None, True), - ]) - return js - - -import sys -try: - from . import codeableconcept -except ImportError: - codeableconcept = sys.modules[__package__ + '.codeableconcept'] diff --git a/fhirclient/models/operationoutcome_tests.py b/fhirclient/models/operationoutcome_tests.py deleted file mode 100644 index f1e5c7cc6..000000000 --- a/fhirclient/models/operationoutcome_tests.py +++ /dev/null @@ -1,152 +0,0 @@ -#!/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 operationoutcome -from .fhirdate import FHIRDate - - -class OperationOutcomeTests(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("OperationOutcome", js["resourceType"]) - return operationoutcome.OperationOutcome(js) - - def testOperationOutcome1(self): - inst = self.instantiate_from("operationoutcome-example-validationfail.json") - self.assertIsNotNone(inst, "Must have instantiated a OperationOutcome instance") - self.implOperationOutcome1(inst) - - js = inst.as_json() - self.assertEqual("OperationOutcome", js["resourceType"]) - inst2 = operationoutcome.OperationOutcome(js) - self.implOperationOutcome1(inst2) - - def implOperationOutcome1(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.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") - self.assertIsNotNone(inst, "Must have instantiated a OperationOutcome instance") - self.implOperationOutcome2(inst) - - js = inst.as_json() - self.assertEqual("OperationOutcome", js["resourceType"]) - inst2 = operationoutcome.OperationOutcome(js) - self.implOperationOutcome2(inst2) - - def implOperationOutcome2(self, inst): - self.assertEqual(inst.id, "break-the-glass") - 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://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-searchfail.json") - self.assertIsNotNone(inst, "Must have instantiated a OperationOutcome instance") - self.implOperationOutcome3(inst) - - js = inst.as_json() - self.assertEqual("OperationOutcome", js["resourceType"]) - inst2 = operationoutcome.OperationOutcome(js) - self.implOperationOutcome3(inst2) - - def implOperationOutcome3(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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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-exception.json") - self.assertIsNotNone(inst, "Must have instantiated a OperationOutcome instance") - self.implOperationOutcome4(inst) - - js = inst.as_json() - self.assertEqual("OperationOutcome", js["resourceType"]) - inst2 = operationoutcome.OperationOutcome(js) - self.implOperationOutcome4(inst2) - - def implOperationOutcome4(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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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.json") - self.assertIsNotNone(inst, "Must have instantiated a OperationOutcome instance") - self.implOperationOutcome5(inst) - - js = inst.as_json() - self.assertEqual("OperationOutcome", js["resourceType"]) - inst2 = operationoutcome.OperationOutcome(js) - self.implOperationOutcome5(inst2) - - def implOperationOutcome5(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], "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-allok.json") - self.assertIsNotNone(inst, "Must have instantiated a OperationOutcome instance") - self.implOperationOutcome6(inst) - - js = inst.as_json() - self.assertEqual("OperationOutcome", js["resourceType"]) - inst2 = operationoutcome.OperationOutcome(js) - self.implOperationOutcome6(inst2) - - def implOperationOutcome6(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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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 deleted file mode 100644 index 81f597e7a..000000000 --- a/fhirclient/models/organization.py +++ /dev/null @@ -1,159 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Organization) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class Organization(domainresource.DomainResource): - """ A grouping of people or organizations with a common purpose. - - 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, payer/insurer, etc. - """ - - resource_type = "Organization" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 the organization's record is still in active use. - Type `bool`. """ - - self.address = None - """ An address for the organization. - 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 - known as in the past. - List of `str` items. """ - - self.contact = None - """ Contact for the organization for a certain purpose. - List of `OrganizationContact` items (represented as `dict` in JSON). """ - - self.endpoint = None - """ Technical endpoints providing access to services operated for the - organization. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.identifier = None - """ Identifies this organization across multiple systems. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.name = None - """ Name used for the organization. - Type `str`. """ - - self.partOf = None - """ The organization of which this organization forms a part. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.telecom = None - """ A contact detail for the organization. - List of `ContactPoint` items (represented as `dict` in JSON). """ - - self.type = None - """ Kind of organization. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - super(Organization, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Organization, self).elementProperties() - js.extend([ - ("active", "active", bool, False, None, False), - ("address", "address", address.Address, True, None, False), - ("alias", "alias", str, True, None, False), - ("contact", "contact", OrganizationContact, True, None, False), - ("endpoint", "endpoint", fhirreference.FHIRReference, True, None, False), - ("identifier", "identifier", identifier.Identifier, True, None, False), - ("name", "name", str, False, None, False), - ("partOf", "partOf", fhirreference.FHIRReference, False, None, False), - ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), - ("type", "type", codeableconcept.CodeableConcept, True, None, False), - ]) - return js - - -from . import backboneelement - -class OrganizationContact(backboneelement.BackboneElement): - """ Contact for the organization for a certain purpose. - """ - - resource_type = "OrganizationContact" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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(OrganizationContact, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(OrganizationContact, 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 - - -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'] diff --git a/fhirclient/models/organization_tests.py b/fhirclient/models/organization_tests.py deleted file mode 100644 index 427015693..000000000 --- a/fhirclient/models/organization_tests.py +++ /dev/null @@ -1,325 +0,0 @@ -#!/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 organization -from .fhirdate import FHIRDate - - -class OrganizationTests(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("Organization", js["resourceType"]) - return organization.Organization(js) - - def testOrganization1(self): - inst = self.instantiate_from("organization-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Organization instance") - self.implOrganization1(inst) - - js = inst.as_json() - self.assertEqual("Organization", js["resourceType"]) - inst2 = organization.Organization(js) - self.implOrganization1(inst2) - - def implOrganization1(self, inst): - 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].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") - - def testOrganization2(self): - inst = self.instantiate_from("organization-example-mmanu.json") - self.assertIsNotNone(inst, "Must have instantiated a Organization instance") - self.implOrganization2(inst) - - js = inst.as_json() - self.assertEqual("Organization", js["resourceType"]) - inst2 = organization.Organization(js) - self.implOrganization2(inst2) - - def implOrganization2(self, inst): - self.assertTrue(inst.active) - 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") - - def testOrganization3(self): - inst = self.instantiate_from("organization-example-gastro.json") - self.assertIsNotNone(inst, "Must have instantiated a Organization instance") - self.implOrganization3(inst) - - js = inst.as_json() - self.assertEqual("Organization", js["resourceType"]) - inst2 = organization.Organization(js) - 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], "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://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 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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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 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://terminology.hl7.org/CodeSystem/organization-type") - - def testOrganization7(self): - inst = self.instantiate_from("organization-example-f201-aumc.json") - self.assertIsNotNone(inst, "Must have instantiated a Organization instance") - self.implOrganization7(inst) - - js = inst.as_json() - self.assertEqual("Organization", js["resourceType"]) - inst2 = organization.Organization(js) - self.implOrganization7(inst2) - - def implOrganization7(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.contact[0].address.city, "Den helder") - self.assertEqual(inst.contact[0].address.country, "NLD") - self.assertEqual(inst.contact[0].address.line[0], "Walvisbaai 3") - self.assertEqual(inst.contact[0].address.line[1], "Gebouw 2") - self.assertEqual(inst.contact[0].address.postalCode, "2333ZA") - self.assertEqual(inst.contact[0].name.family, "Brand") - self.assertEqual(inst.contact[0].name.given[0], "Ronald") - self.assertEqual(inst.contact[0].name.prefix[0], "Prof.Dr.") - self.assertEqual(inst.contact[0].name.text, "Professor Brand") - self.assertEqual(inst.contact[0].name.use, "official") - 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, "+31715269702") - self.assertEqual(inst.id, "f201") - 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") - self.assertEqual(inst.telecom[0].value, "+31715269111") - 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, "V6") - self.assertEqual(inst.type[0].coding[1].display, "University Medical Hospital") - 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://terminology.hl7.org/CodeSystem/organization-type") - - def testOrganization8(self): - inst = self.instantiate_from("organization-example-good-health-care.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.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 testOrganization9(self): - inst = self.instantiate_from("organization-example-f001-burgers.json") - self.assertIsNotNone(inst, "Must have instantiated a Organization instance") - self.implOrganization9(inst) - - js = inst.as_json() - self.assertEqual("Organization", js["resourceType"]) - inst2 = organization.Organization(js) - self.implOrganization9(inst2) - - def implOrganization9(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://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, "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-insurer.json") - self.assertIsNotNone(inst, "Must have instantiated a Organization instance") - self.implOrganization10(inst) - - js = inst.as_json() - self.assertEqual("Organization", js["resourceType"]) - inst2 = organization.Organization(js) - self.implOrganization10(inst2) - - def implOrganization10(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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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/parameterdefinition.py b/fhirclient/models/parameterdefinition.py deleted file mode 100644 index 4fee7da5c..000000000 --- a/fhirclient/models/parameterdefinition.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ParameterDefinition) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import element - -class ParameterDefinition(element.Element): - """ Definition of a parameter to a module. - - The parameters to the module. This collection specifies both the input and - output parameters. Input parameters are provided by the caller as part of - the $evaluate operation. Output parameters are included in the - GuidanceResponse. - """ - - resource_type = "ParameterDefinition" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ A brief description of the parameter. - Type `str`. """ - - self.max = None - """ Maximum cardinality (a number of *). - Type `str`. """ - - self.min = None - """ Minimum cardinality. - Type `int`. """ - - self.name = None - """ Name used to access the parameter value. - Type `str`. """ - - self.profile = None - """ What profile the value is expected to be. - Type `str`. """ - - self.type = None - """ What type of value. - Type `str`. """ - - self.use = None - """ in | out. - Type `str`. """ - - super(ParameterDefinition, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ParameterDefinition, self).elementProperties() - js.extend([ - ("documentation", "documentation", str, False, None, False), - ("max", "max", str, False, None, False), - ("min", "min", int, False, None, False), - ("name", "name", str, False, None, False), - ("profile", "profile", str, False, None, False), - ("type", "type", str, False, None, True), - ("use", "use", str, False, None, True), - ]) - return js - - diff --git a/fhirclient/models/parameters.py b/fhirclient/models/parameters.py deleted file mode 100644 index 94c960c03..000000000 --- a/fhirclient/models/parameters.py +++ /dev/null @@ -1,453 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Parameters) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import resource - -class Parameters(resource.Resource): - """ Operation Request or Response. - - 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" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.parameter = None - """ Operation Parameter. - List of `ParametersParameter` items (represented as `dict` in JSON). """ - - super(Parameters, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Parameters, self).elementProperties() - js.extend([ - ("parameter", "parameter", ParametersParameter, True, None, False), - ]) - return js - - -from . import backboneelement - -class ParametersParameter(backboneelement.BackboneElement): - """ Operation Parameter. - - A parameter passed to or received from the operation. - """ - - resource_type = "ParametersParameter" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 from the definition. - Type `str`. """ - - self.part = None - """ Named part of a multi-part parameter. - List of `ParametersParameter` items (represented as `dict` in JSON). """ - - self.resource = None - """ If parameter is a whole resource. - Type `Resource` (represented as `dict` in JSON). """ - - self.valueAddress = None - """ If parameter is a data type. - Type `Address` (represented as `dict` in JSON). """ - - self.valueAge = None - """ If parameter is a data type. - Type `Age` (represented as `dict` in JSON). """ - - self.valueAnnotation = None - """ If parameter is a data type. - Type `Annotation` (represented as `dict` in JSON). """ - - self.valueAttachment = None - """ If parameter is a data type. - Type `Attachment` (represented as `dict` in JSON). """ - - self.valueBase64Binary = None - """ If parameter is a data type. - Type `str`. """ - - self.valueBoolean = None - """ 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`. """ - - self.valueCodeableConcept = None - """ If parameter is a data type. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.valueCoding = None - """ 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). """ - - self.valueDateTime = None - """ If parameter is a data type. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.valueDecimal = None - """ If parameter is a data type. - Type `float`. """ - - self.valueDistance = None - """ 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). """ - - self.valueId = None - """ If parameter is a data type. - Type `str`. """ - - self.valueIdentifier = None - """ If parameter is a data type. - Type `Identifier` (represented as `dict` in JSON). """ - - self.valueInstant = None - """ If parameter is a data type. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.valueInteger = None - """ If parameter is a data type. - Type `int`. """ - - self.valueMarkdown = None - """ If parameter is a data type. - Type `str`. """ - - self.valueMoney = None - """ If parameter is a data type. - Type `Money` (represented as `dict` in JSON). """ - - self.valueOid = None - """ 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). """ - - self.valuePositiveInt = None - """ If parameter is a data type. - Type `int`. """ - - self.valueQuantity = None - """ If parameter is a data type. - Type `Quantity` (represented as `dict` in JSON). """ - - self.valueRange = None - """ If parameter is a data type. - Type `Range` (represented as `dict` in JSON). """ - - self.valueRatio = None - """ If parameter is a data type. - Type `Ratio` (represented as `dict` in JSON). """ - - self.valueReference = None - """ 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). """ - - self.valueSignature = None - """ If parameter is a data type. - Type `Signature` (represented as `dict` in JSON). """ - - self.valueString = None - """ If parameter is a data type. - Type `str`. """ - - self.valueTime = None - """ If parameter is a data type. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.valueTiming = None - """ 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`. """ - - self.valueUri = None - """ 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): - js = super(ParametersParameter, self).elementProperties() - js.extend([ - ("name", "name", str, False, None, True), - ("part", "part", ParametersParameter, True, None, False), - ("resource", "resource", resource.Resource, False, None, False), - ("valueAddress", "valueAddress", address.Address, False, "value", False), - ("valueAge", "valueAge", age.Age, False, "value", False), - ("valueAnnotation", "valueAnnotation", annotation.Annotation, False, "value", False), - ("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), - ("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 - - -import sys -try: - from . import address -except ImportError: - address = sys.modules[__package__ + '.address'] -try: - from . import age -except ImportError: - age = sys.modules[__package__ + '.age'] -try: - from . import annotation -except ImportError: - annotation = sys.modules[__package__ + '.annotation'] -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 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: - fhirdate = sys.modules[__package__ + '.fhirdate'] -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 parameterdefinition -except ImportError: - parameterdefinition = sys.modules[__package__ + '.parameterdefinition'] -try: - 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 relatedartifact -except ImportError: - relatedartifact = sys.modules[__package__ + '.relatedartifact'] -try: - from . import sampleddata -except ImportError: - sampleddata = sys.modules[__package__ + '.sampleddata'] -try: - from . import signature -except ImportError: - signature = sys.modules[__package__ + '.signature'] -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/parameters_tests.py b/fhirclient/models/parameters_tests.py deleted file mode 100644 index 77a208788..000000000 --- a/fhirclient/models/parameters_tests.py +++ /dev/null @@ -1,47 +0,0 @@ -#!/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 parameters -from .fhirdate import FHIRDate - - -class ParametersTests(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("Parameters", js["resourceType"]) - return parameters.Parameters(js) - - def testParameters1(self): - inst = self.instantiate_from("parameters-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Parameters instance") - self.implParameters1(inst) - - js = inst.as_json() - self.assertEqual("Parameters", js["resourceType"]) - inst2 = parameters.Parameters(js) - self.implParameters1(inst2) - - def implParameters1(self, inst): - self.assertEqual(inst.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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 deleted file mode 100644 index 325db4a26..000000000 --- a/fhirclient/models/patient.py +++ /dev/null @@ -1,296 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Patient) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class Patient(domainresource.DomainResource): - """ Information about an individual or animal receiving health care services. - - Demographics and other administrative information about an individual or - animal receiving care or other health-related services. - """ - - resource_type = "Patient" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 patient's record is in active use. - Type `bool`. """ - - self.address = None - """ An address for the individual. - List of `Address` items (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 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 - """ A contact party (e.g. guardian, partner, friend) for the patient. - List of `PatientContact` items (represented as `dict` in JSON). """ - - self.deceasedBoolean = None - """ Indicates if the individual is deceased or not. - Type `bool`. """ - - self.deceasedDateTime = None - """ Indicates if the individual is deceased or not. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.gender = None - """ male | female | other | unknown. - Type `str`. """ - - self.generalPractitioner = None - """ Patient's nominated primary care provider. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.identifier = None - """ An identifier for this patient. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.link = None - """ Link to another patient resource that concerns the same actual - person. - List of `PatientLink` items (represented as `dict` in JSON). """ - - self.managingOrganization = None - """ Organization that is the custodian of the patient record. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.maritalStatus = None - """ Marital (civil) status of a patient. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.multipleBirthBoolean = None - """ Whether patient is part of a multiple birth. - Type `bool`. """ - - self.multipleBirthInteger = None - """ Whether patient is part of a multiple birth. - Type `int`. """ - - self.name = None - """ A name associated with the patient. - List of `HumanName` items (represented as `dict` in JSON). """ - - self.photo = None - """ Image of the patient. - List of `Attachment` items (represented as `dict` in JSON). """ - - self.telecom = None - """ A contact detail for the individual. - List of `ContactPoint` items (represented as `dict` in JSON). """ - - super(Patient, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Patient, self).elementProperties() - js.extend([ - ("active", "active", bool, False, None, False), - ("address", "address", address.Address, True, None, False), - ("birthDate", "birthDate", fhirdate.FHIRDate, False, None, False), - ("communication", "communication", PatientCommunication, True, None, False), - ("contact", "contact", PatientContact, True, None, False), - ("deceasedBoolean", "deceasedBoolean", bool, False, "deceased", False), - ("deceasedDateTime", "deceasedDateTime", fhirdate.FHIRDate, False, "deceased", False), - ("gender", "gender", str, False, None, False), - ("generalPractitioner", "generalPractitioner", fhirreference.FHIRReference, True, None, False), - ("identifier", "identifier", identifier.Identifier, True, None, False), - ("link", "link", PatientLink, True, None, False), - ("managingOrganization", "managingOrganization", fhirreference.FHIRReference, False, None, False), - ("maritalStatus", "maritalStatus", codeableconcept.CodeableConcept, False, None, False), - ("multipleBirthBoolean", "multipleBirthBoolean", bool, False, "multipleBirth", False), - ("multipleBirthInteger", "multipleBirthInteger", int, False, "multipleBirth", False), - ("name", "name", humanname.HumanName, True, None, False), - ("photo", "photo", attachment.Attachment, True, None, False), - ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), - ]) - return js - - -from . import backboneelement - -class PatientCommunication(backboneelement.BackboneElement): - """ A language which may be used to communicate with the patient about his or - her health. - """ - - resource_type = "PatientCommunication" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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(PatientCommunication, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(PatientCommunication, self).elementProperties() - js.extend([ - ("language", "language", codeableconcept.CodeableConcept, False, None, True), - ("preferred", "preferred", bool, False, None, False), - ]) - return js - - -class PatientContact(backboneelement.BackboneElement): - """ A contact party (e.g. guardian, partner, friend) for the patient. - """ - - resource_type = "PatientContact" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Address for the contact person. - Type `Address` (represented as `dict` in JSON). """ - - self.gender = None - """ male | female | other | unknown. - Type `str`. """ - - self.name = None - """ A name associated with the contact person. - Type `HumanName` (represented as `dict` in JSON). """ - - self.organization = None - """ Organization that is associated with the contact. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.period = None - """ The period during which this contact person or organization is - valid to be contacted relating to this patient. - Type `Period` (represented as `dict` in JSON). """ - - self.relationship = None - """ The kind of relationship. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.telecom = None - """ A contact detail for the person. - List of `ContactPoint` items (represented as `dict` in JSON). """ - - super(PatientContact, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(PatientContact, self).elementProperties() - js.extend([ - ("address", "address", address.Address, False, None, False), - ("gender", "gender", str, False, None, False), - ("name", "name", humanname.HumanName, False, None, False), - ("organization", "organization", fhirreference.FHIRReference, False, None, False), - ("period", "period", period.Period, False, None, False), - ("relationship", "relationship", codeableconcept.CodeableConcept, True, None, False), - ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), - ]) - return js - - -class PatientLink(backboneelement.BackboneElement): - """ Link to another patient resource that concerns the same actual person. - - Link to another patient resource that concerns the same actual patient. - """ - - resource_type = "PatientLink" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.other = None - """ The other patient or related person resource that the link refers - to. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.type = None - """ replaced-by | replaces | refer | seealso. - Type `str`. """ - - super(PatientLink, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(PatientLink, self).elementProperties() - js.extend([ - ("other", "other", fhirreference.FHIRReference, False, None, True), - ("type", "type", str, False, None, True), - ]) - return js - - -import sys -try: - from . import address -except ImportError: - address = sys.modules[__package__ + '.address'] -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 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: - 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 period -except ImportError: - period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/patient_tests.py b/fhirclient/models/patient_tests.py deleted file mode 100644 index d7c07ae5d..000000000 --- a/fhirclient/models/patient_tests.py +++ /dev/null @@ -1,376 +0,0 @@ -#!/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 patient -from .fhirdate import FHIRDate - - -class PatientTests(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("Patient", js["resourceType"]) - return patient.Patient(js) - - def testPatient1(self): - inst = self.instantiate_from("patient-example-xds.json") - self.assertIsNotNone(inst, "Must have instantiated a Patient instance") - self.implPatient1(inst) - - js = inst.as_json() - self.assertEqual("Patient", js["resourceType"]) - inst2 = patient.Patient(js) - self.implPatient1(inst2) - - def implPatient1(self, inst): - self.assertTrue(inst.active) - 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, "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://terminology.hl7.org/CodeSystem/v2-0203") - self.assertEqual(inst.identifier[0].use, "usual") - 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-f001-pieter.json") - self.assertIsNotNone(inst, "Must have instantiated a Patient instance") - self.implPatient2(inst) - - js = inst.as_json() - self.assertEqual("Patient", js["resourceType"]) - inst2 = patient.Patient(js) - self.implPatient2(inst2) - - def implPatient2(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].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://terminology.hl7.org/CodeSystem/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://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-d.json") - self.assertIsNotNone(inst, "Must have instantiated a Patient instance") - self.implPatient3(inst) - - js = inst.as_json() - self.assertEqual("Patient", js["resourceType"]) - inst2 = patient.Patient(js) - self.implPatient3(inst2) - - def implPatient3(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://terminology.hl7.org/CodeSystem/v2-0203") - self.assertEqual(inst.identifier[0].use, "usual") - 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.text.status, "generated") - - def testPatient4(self): - inst = self.instantiate_from("patient-example-infant-twin-1.json") - self.assertIsNotNone(inst, "Must have instantiated a Patient instance") - self.implPatient4(inst) - - js = inst.as_json() - self.assertEqual("Patient", js["resourceType"]) - inst2 = patient.Patient(js) - self.implPatient4(inst2) - - def implPatient4(self, inst): - 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://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-infant-mom.json") - self.assertIsNotNone(inst, "Must have instantiated a Patient instance") - self.implPatient5(inst) - - js = inst.as_json() - self.assertEqual("Patient", js["resourceType"]) - inst2 = patient.Patient(js) - self.implPatient5(inst2) - - def implPatient5(self, inst): - 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.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-newborn.json") - self.assertIsNotNone(inst, "Must have instantiated a Patient instance") - self.implPatient6(inst) - - js = inst.as_json() - self.assertEqual("Patient", js["resourceType"]) - inst2 = patient.Patient(js) - self.implPatient6(inst2) - - def implPatient6(self, inst): - 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-infant-fetal.json") - self.assertIsNotNone(inst, "Must have instantiated a Patient instance") - self.implPatient7(inst) - - js = inst.as_json() - self.assertEqual("Patient", js["resourceType"]) - inst2 = patient.Patient(js) - self.implPatient7(inst2) - - def implPatient7(self, inst): - 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, "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-genetics-example1.json") - self.assertIsNotNone(inst, "Must have instantiated a Patient instance") - self.implPatient8(inst) - - js = inst.as_json() - self.assertEqual("Patient", js["resourceType"]) - inst2 = patient.Patient(js) - self.implPatient8(inst2) - - def implPatient8(self, inst): - self.assertTrue(inst.active) - self.assertEqual(inst.address[0].line[0], "2222 Home Street") - self.assertEqual(inst.address[0].use, "home") - 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, "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-b.json") - self.assertIsNotNone(inst, "Must have instantiated a Patient instance") - self.implPatient9(inst) - - js = inst.as_json() - self.assertEqual("Patient", js["resourceType"]) - inst2 = patient.Patient(js) - self.implPatient9(inst2) - - def implPatient9(self, inst): - self.assertTrue(inst.active) - 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/gif") - self.assertEqual(inst.text.status, "generated") - - def testPatient10(self): - inst = self.instantiate_from("patient-example-c.json") - self.assertIsNotNone(inst, "Must have instantiated a Patient instance") - self.implPatient10(inst) - - js = inst.as_json() - self.assertEqual("Patient", js["resourceType"]) - inst2 = patient.Patient(js) - self.implPatient10(inst2) - - def implPatient10(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.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 deleted file mode 100644 index 4d2615007..000000000 --- a/fhirclient/models/paymentnotice.py +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/PaymentNotice) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class PaymentNotice(domainresource.DomainResource): - """ PaymentNotice request. - - This resource provides the status of the payment for goods and services - rendered, and the request and response resource references. - """ - - resource_type = "PaymentNotice" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 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 for the payment noctice. - List of `Identifier` items (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 - """ Issued or cleared Status of the payment. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.provider = None - """ Responsible practitioner. - 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` (represented as `dict` in JSON). """ - - self.response = None - """ Response reference. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.status = None - """ active | cancelled | draft | entered-in-error. - Type `str`. """ - - super(PaymentNotice, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(PaymentNotice, self).elementProperties() - js.extend([ - ("amount", "amount", money.Money, False, None, True), - ("created", "created", fhirdate.FHIRDate, False, None, True), - ("identifier", "identifier", identifier.Identifier, True, 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, 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'] diff --git a/fhirclient/models/paymentnotice_tests.py b/fhirclient/models/paymentnotice_tests.py deleted file mode 100644 index 7f85c44a6..000000000 --- a/fhirclient/models/paymentnotice_tests.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/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 paymentnotice -from .fhirdate import FHIRDate - - -class PaymentNoticeTests(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("PaymentNotice", js["resourceType"]) - return paymentnotice.PaymentNotice(js) - - def testPaymentNotice1(self): - inst = self.instantiate_from("paymentnotice-example.json") - self.assertIsNotNone(inst, "Must have instantiated a PaymentNotice instance") - self.implPaymentNotice1(inst) - - js = inst.as_json() - self.assertEqual("PaymentNotice", js["resourceType"]) - inst2 = paymentnotice.PaymentNotice(js) - 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://terminology.hl7.org/CodeSystem/paymentstatus") - self.assertEqual(inst.status, "active") - 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 deleted file mode 100644 index 958c21348..000000000 --- a/fhirclient/models/paymentreconciliation.py +++ /dev/null @@ -1,247 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/PaymentReconciliation) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class PaymentReconciliation(domainresource.DomainResource): - """ PaymentReconciliation resource. - - This resource provides the details including amount of a payment and - allocates the payment items being paid. - """ - - resource_type = "PaymentReconciliation" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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.detail = None - """ Settlement particulars. - List of `PaymentReconciliationDetail` items (represented as `dict` in JSON). """ - - self.disposition = None - """ Disposition message. - Type `str`. """ - - self.formCode = None - """ Printed form identifier. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.identifier = None - """ Business Identifier for a payment reconciliation. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.outcome = None - """ 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 - """ Note concerning processing. - List of `PaymentReconciliationProcessNote` items (represented as `dict` in JSON). """ - - self.request = None - """ Reference to requesting resource. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.requestor = None - """ Responsible practitioner. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.status = None - """ active | cancelled | draft | entered-in-error. - Type `str`. """ - - super(PaymentReconciliation, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(PaymentReconciliation, self).elementProperties() - js.extend([ - ("created", "created", fhirdate.FHIRDate, False, None, True), - ("detail", "detail", PaymentReconciliationDetail, True, None, False), - ("disposition", "disposition", str, False, None, False), - ("formCode", "formCode", codeableconcept.CodeableConcept, False, None, False), - ("identifier", "identifier", identifier.Identifier, True, 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), - ("requestor", "requestor", fhirreference.FHIRReference, False, None, False), - ("status", "status", str, False, None, True), - ]) - return js - - -from . import backboneelement - -class PaymentReconciliationDetail(backboneelement.BackboneElement): - """ Settlement particulars. - - Distribution of the payment amount for a previously acknowledged payable. - """ - - resource_type = "PaymentReconciliationDetail" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 allocated to this payable. - Type `Money` (represented as `dict` in JSON). """ - - self.date = None - """ 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 - """ 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 - """ Request giving rise to the payment. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.response = None - """ 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 - """ Submitter of the request. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.type = None - """ Category of payment. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(PaymentReconciliationDetail, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(PaymentReconciliationDetail, self).elementProperties() - 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), - ]) - return js - - -class PaymentReconciliationProcessNote(backboneelement.BackboneElement): - """ Note concerning processing. - - A note that describes or explains the processing in a human readable form. - """ - - resource_type = "PaymentReconciliationProcessNote" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Note explanatory text. - Type `str`. """ - - self.type = None - """ display | print | printoper. - Type `str`. """ - - super(PaymentReconciliationProcessNote, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(PaymentReconciliationProcessNote, self).elementProperties() - js.extend([ - ("text", "text", str, 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 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'] diff --git a/fhirclient/models/paymentreconciliation_tests.py b/fhirclient/models/paymentreconciliation_tests.py deleted file mode 100644 index edc7aa4af..000000000 --- a/fhirclient/models/paymentreconciliation_tests.py +++ /dev/null @@ -1,86 +0,0 @@ -#!/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 paymentreconciliation -from .fhirdate import FHIRDate - - -class PaymentReconciliationTests(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("PaymentReconciliation", js["resourceType"]) - return paymentreconciliation.PaymentReconciliation(js) - - def testPaymentReconciliation1(self): - inst = self.instantiate_from("paymentreconciliation-example.json") - self.assertIsNotNone(inst, "Must have instantiated a PaymentReconciliation instance") - self.implPaymentReconciliation1(inst) - - js = inst.as_json() - self.assertEqual("PaymentReconciliation", js["resourceType"]) - inst2 = paymentreconciliation.PaymentReconciliation(js) - self.implPaymentReconciliation1(inst2) - - 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.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://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://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://terminology.hl7.org/CodeSystem/payment-type") - self.assertEqual(inst.disposition, "2014 August mid-month settlement.") - 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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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, "display") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
A human-readable rendering of the PaymentReconciliation
") - self.assertEqual(inst.text.status, "generated") - diff --git a/fhirclient/models/period.py b/fhirclient/models/period.py deleted file mode 100644 index 4cdb26f7b..000000000 --- a/fhirclient/models/period.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Period) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import element - -class Period(element.Element): - """ Time range defined by start and end date/time. - - A time period defined by a start and end date and optionally time. - """ - - resource_type = "Period" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ End time with inclusive boundary, if not ongoing. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.start = None - """ Starting time with inclusive boundary. - Type `FHIRDate` (represented as `str` in JSON). """ - - super(Period, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Period, self).elementProperties() - js.extend([ - ("end", "end", fhirdate.FHIRDate, False, None, False), - ("start", "start", fhirdate.FHIRDate, False, None, False), - ]) - return js - - -import sys -try: - from . import fhirdate -except ImportError: - fhirdate = sys.modules[__package__ + '.fhirdate'] diff --git a/fhirclient/models/person.py b/fhirclient/models/person.py deleted file mode 100644 index 7c68f213a..000000000 --- a/fhirclient/models/person.py +++ /dev/null @@ -1,149 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Person) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class Person(domainresource.DomainResource): - """ A generic person record. - - Demographics and administrative information about a person independent of a - specific health-related context. - """ - - resource_type = "Person" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ This person's record is in active use. - Type `bool`. """ - - self.address = None - """ One or more addresses for the person. - List of `Address` items (represented as `dict` in JSON). """ - - self.birthDate = None - """ The date on which the person was born. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.gender = None - """ male | female | other | unknown. - Type `str`. """ - - self.identifier = None - """ A human identifier for this person. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.link = None - """ Link to a resource that concerns the same actual person. - List of `PersonLink` items (represented as `dict` in JSON). """ - - self.managingOrganization = None - """ The organization that is the custodian of the person record. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.name = None - """ A name associated with the person. - List of `HumanName` items (represented as `dict` in JSON). """ - - self.photo = None - """ Image of the person. - Type `Attachment` (represented as `dict` in JSON). """ - - self.telecom = None - """ A contact detail for the person. - List of `ContactPoint` items (represented as `dict` in JSON). """ - - super(Person, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Person, self).elementProperties() - js.extend([ - ("active", "active", bool, False, None, False), - ("address", "address", address.Address, True, None, False), - ("birthDate", "birthDate", fhirdate.FHIRDate, False, None, False), - ("gender", "gender", str, False, None, False), - ("identifier", "identifier", identifier.Identifier, True, None, False), - ("link", "link", PersonLink, True, None, False), - ("managingOrganization", "managingOrganization", fhirreference.FHIRReference, False, None, False), - ("name", "name", humanname.HumanName, True, None, False), - ("photo", "photo", attachment.Attachment, False, None, False), - ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), - ]) - return js - - -from . import backboneelement - -class PersonLink(backboneelement.BackboneElement): - """ Link to a resource that concerns the same actual person. - """ - - resource_type = "PersonLink" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.assurance = None - """ level1 | level2 | level3 | level4. - Type `str`. """ - - self.target = None - """ The resource to which this actual person is associated. - Type `FHIRReference` (represented as `dict` in JSON). """ - - super(PersonLink, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(PersonLink, self).elementProperties() - js.extend([ - ("assurance", "assurance", str, False, None, False), - ("target", "target", fhirreference.FHIRReference, False, None, True), - ]) - return js - - -import sys -try: - from . import address -except ImportError: - address = sys.modules[__package__ + '.address'] -try: - from . import attachment -except ImportError: - attachment = sys.modules[__package__ + '.attachment'] -try: - 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: - 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'] diff --git a/fhirclient/models/person_tests.py b/fhirclient/models/person_tests.py deleted file mode 100644 index 4cfdc247c..000000000 --- a/fhirclient/models/person_tests.py +++ /dev/null @@ -1,96 +0,0 @@ -#!/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 person -from .fhirdate import FHIRDate - - -class PersonTests(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("Person", js["resourceType"]) - return person.Person(js) - - def testPerson1(self): - inst = self.instantiate_from("person-example-f002-ariadne.json") - self.assertIsNotNone(inst, "Must have instantiated a Person instance") - self.implPerson1(inst) - - js = inst.as_json() - self.assertEqual("Person", js["resourceType"]) - inst2 = person.Person(js) - self.implPerson1(inst2) - - def implPerson1(self, inst): - self.assertTrue(inst.active) - 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.photo.contentType, "image/jpeg") - 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") - - def testPerson2(self): - inst = self.instantiate_from("person-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Person instance") - self.implPerson2(inst) - - js = inst.as_json() - self.assertEqual("Person", js["resourceType"]) - inst2 = person.Person(js) - self.implPerson2(inst2) - - def implPerson2(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.birthDate.date, FHIRDate("1974-12-25").date) - self.assertEqual(inst.birthDate.as_json(), "1974-12-25") - self.assertEqual(inst.gender, "male") - self.assertEqual(inst.id, "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://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") - self.assertEqual(inst.name[0].use, "official") - self.assertEqual(inst.name[1].given[0], "Jim") - self.assertEqual(inst.name[1].use, "usual") - 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, "(03) 5555 6473") - self.assertEqual(inst.telecom[2].system, "email") - self.assertEqual(inst.telecom[2].use, "home") - self.assertEqual(inst.telecom[2].value, "Jim@example.org") - self.assertEqual(inst.text.status, "generated") - diff --git a/fhirclient/models/plandefinition.py b/fhirclient/models/plandefinition.py deleted file mode 100644 index 458c37c02..000000000 --- a/fhirclient/models/plandefinition.py +++ /dev/null @@ -1,732 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/PlanDefinition) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class PlanDefinition(domainresource.DomainResource): - """ The definition of a plan for a series of actions, independent of any - specific patient or context. - - This resource allows for the definition of various types of plans as a - sharable, consumable, and executable artifact. The resource is general - enough to support the description of a broad range of clinical artifacts - such as clinical decision support rules, order sets and protocols. - """ - - resource_type = "PlanDefinition" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Action defined by the plan. - List of `PlanDefinitionAction` items (represented as `dict` in JSON). """ - - self.approvalDate = None - """ 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.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 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`. """ - - self.goal = None - """ What the plan is trying to accomplish. - List of `PlanDefinitionGoal` items (represented as `dict` in JSON). """ - - self.identifier = None - """ Additional identifier for the plan definition. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.jurisdiction = None - """ Intended jurisdiction for plan definition (if applicable). - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.lastReviewDate = None - """ When the plan definition was last reviewed. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.library = None - """ Logic used by the plan definition. - List of `str` items. """ - - self.name = None - """ Name for this plan definition (computer friendly). - Type `str`. """ - - self.publisher = None - """ Name of the publisher (organization or individual). - Type `str`. """ - - self.purpose = None - """ Why this plan definition is defined. - Type `str`. """ - - self.relatedArtifact = None - """ 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. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.type = None - """ order-set | clinical-protocol | eca-rule | workflow-definition. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.url = None - """ Canonical identifier for this plan definition, represented as a URI - (globally unique). - Type `str`. """ - - self.usage = None - """ Describes the clinical usage of the plan. - 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 plan definition. - Type `str`. """ - - super(PlanDefinition, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(PlanDefinition, self).elementProperties() - 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), - ("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", 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), - ("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 - - -from . import backboneelement - -class PlanDefinitionAction(backboneelement.BackboneElement): - """ Action defined by the plan. - - An action or group of actions to be taken as part of the plan. - """ - - resource_type = "PlanDefinitionAction" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ A sub-action. - List of `PlanDefinitionAction` items (represented as `dict` in JSON). """ - - self.cardinalityBehavior = None - """ single | multiple. - Type `str`. """ - - self.code = None - """ Code representing the meaning of the action or sub-actions. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.condition = None - """ Whether or not the action is applicable. - List of `PlanDefinitionActionCondition` items (represented as `dict` in JSON). """ - - self.definitionCanonical = None - """ Description of the activity to be performed. - Type `str`. """ - - self.definitionUri = None - """ Description of the activity to be performed. - Type `str`. """ - - self.description = None - """ Brief description of the action. - Type `str`. """ - - self.documentation = None - """ Supporting documentation for the intended performer of the action. - List of `RelatedArtifact` items (represented as `dict` in JSON). """ - - self.dynamicValue = None - """ Dynamic aspects of the definition. - List of `PlanDefinitionActionDynamicValue` items (represented as `dict` in JSON). """ - - self.goalId = None - """ What goals this action supports. - List of `str` items. """ - - self.groupingBehavior = None - """ visual-group | logical-group | sentence-group. - Type `str`. """ - - self.input = None - """ Input data requirements. - List of `DataRequirement` items (represented as `dict` in JSON). """ - - self.output = None - """ Output data definition. - List of `DataRequirement` items (represented as `dict` in JSON). """ - - self.participant = None - """ Who should participate in the action. - List of `PlanDefinitionActionParticipant` 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.reason = None - """ Why the action should be performed. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.relatedAction = None - """ Relationship to another action. - List of `PlanDefinitionActionRelatedAction` items (represented as `dict` in JSON). """ - - self.requiredBehavior = None - """ must | could | must-unless-documented. - Type `str`. """ - - self.selectionBehavior = None - """ 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). """ - - self.timingDuration = None - """ When the action should take place. - Type `Duration` (represented as `dict` in JSON). """ - - self.timingPeriod = None - """ When the action should take place. - Type `Period` (represented as `dict` in JSON). """ - - self.timingRange = None - """ When the action should take place. - Type `Range` (represented as `dict` in JSON). """ - - self.timingTiming = None - """ When the action should take place. - Type `Timing` (represented as `dict` in JSON). """ - - self.title = None - """ User-visible title. - Type `str`. """ - - self.transform = None - """ Transform to apply the template. - Type `str`. """ - - 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 `CodeableConcept` (represented as `dict` in JSON). """ - - super(PlanDefinitionAction, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(PlanDefinitionAction, self).elementProperties() - js.extend([ - ("action", "action", PlanDefinitionAction, True, None, False), - ("cardinalityBehavior", "cardinalityBehavior", str, False, None, False), - ("code", "code", codeableconcept.CodeableConcept, True, None, False), - ("condition", "condition", PlanDefinitionActionCondition, True, 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), - ("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", str, False, None, False), - ("trigger", "trigger", triggerdefinition.TriggerDefinition, True, None, False), - ("type", "type", codeableconcept.CodeableConcept, False, None, False), - ]) - return js - - -class PlanDefinitionActionCondition(backboneelement.BackboneElement): - """ Whether or not the action is applicable. - - An expression that describes applicability criteria or start/stop - conditions for the action. - """ - - resource_type = "PlanDefinitionActionCondition" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Boolean-valued expression. - Type `Expression` (represented as `dict` in JSON). """ - - self.kind = None - """ applicability | start | stop. - Type `str`. """ - - super(PlanDefinitionActionCondition, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(PlanDefinitionActionCondition, self).elementProperties() - js.extend([ - ("expression", "expression", expression.Expression, False, None, False), - ("kind", "kind", str, False, None, True), - ]) - return js - - -class PlanDefinitionActionDynamicValue(backboneelement.BackboneElement): - """ Dynamic aspects of the definition. - - Customizations that should be applied to the statically defined resource. - For example, if the dosage of a medication must be computed based on the - patient's weight, a customization would be used to specify an expression - that calculated the weight, and the path on the resource that would contain - the result. - """ - - resource_type = "PlanDefinitionActionDynamicValue" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ An expression that provides the dynamic value for the customization. - Type `Expression` (represented as `dict` in JSON). """ - - self.path = None - """ The path to the element to be set dynamically. - Type `str`. """ - - super(PlanDefinitionActionDynamicValue, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(PlanDefinitionActionDynamicValue, self).elementProperties() - js.extend([ - ("expression", "expression", expression.Expression, False, None, False), - ("path", "path", str, False, None, False), - ]) - return js - - -class PlanDefinitionActionParticipant(backboneelement.BackboneElement): - """ Who should participate in the action. - - Indicates who should participate in performing the action described. - """ - - resource_type = "PlanDefinitionActionParticipant" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.role = None - """ E.g. Nurse, Surgeon, Parent. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.type = None - """ patient | practitioner | related-person | device. - Type `str`. """ - - super(PlanDefinitionActionParticipant, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(PlanDefinitionActionParticipant, self).elementProperties() - js.extend([ - ("role", "role", codeableconcept.CodeableConcept, False, None, False), - ("type", "type", str, False, None, True), - ]) - return js - - -class PlanDefinitionActionRelatedAction(backboneelement.BackboneElement): - """ Relationship to another action. - - A relationship to another action such as "before" or "30-60 minutes after - start of". - """ - - resource_type = "PlanDefinitionActionRelatedAction" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.actionId = None - """ What action is this related to. - Type `str`. """ - - self.offsetDuration = None - """ Time offset for the relationship. - Type `Duration` (represented as `dict` in JSON). """ - - self.offsetRange = None - """ Time offset for the relationship. - Type `Range` (represented as `dict` in JSON). """ - - self.relationship = None - """ before-start | before | before-end | concurrent-with-start | - concurrent | concurrent-with-end | after-start | after | after-end. - Type `str`. """ - - super(PlanDefinitionActionRelatedAction, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(PlanDefinitionActionRelatedAction, self).elementProperties() - js.extend([ - ("actionId", "actionId", str, False, None, True), - ("offsetDuration", "offsetDuration", duration.Duration, False, "offset", False), - ("offsetRange", "offsetRange", range.Range, False, "offset", False), - ("relationship", "relationship", str, False, None, True), - ]) - return js - - -class PlanDefinitionGoal(backboneelement.BackboneElement): - """ What the plan is trying to accomplish. - - Goals that describe what the activities within the plan are intended to - achieve. For example, weight loss, restoring an activity of daily living, - obtaining herd immunity via immunization, meeting a process improvement - objective, etc. - """ - - resource_type = "PlanDefinitionGoal" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.addresses = None - """ What does the goal address. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.category = None - """ E.g. Treatment, dietary, behavioral. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.description = None - """ Code or text describing the goal. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.documentation = None - """ Supporting documentation for the goal. - List of `RelatedArtifact` items (represented as `dict` in JSON). """ - - self.priority = None - """ high-priority | medium-priority | low-priority. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.start = None - """ When goal pursuit begins. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.target = None - """ Target outcome for the goal. - List of `PlanDefinitionGoalTarget` items (represented as `dict` in JSON). """ - - super(PlanDefinitionGoal, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(PlanDefinitionGoal, self).elementProperties() - js.extend([ - ("addresses", "addresses", codeableconcept.CodeableConcept, True, None, False), - ("category", "category", codeableconcept.CodeableConcept, False, None, False), - ("description", "description", codeableconcept.CodeableConcept, False, None, True), - ("documentation", "documentation", relatedartifact.RelatedArtifact, True, None, False), - ("priority", "priority", codeableconcept.CodeableConcept, False, None, False), - ("start", "start", codeableconcept.CodeableConcept, False, None, False), - ("target", "target", PlanDefinitionGoalTarget, True, None, False), - ]) - return js - - -class PlanDefinitionGoalTarget(backboneelement.BackboneElement): - """ Target outcome for the goal. - - Indicates what should be done and within what timeframe. - """ - - resource_type = "PlanDefinitionGoalTarget" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.detailCodeableConcept = None - """ The target value to be achieved. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.detailQuantity = None - """ The target value to be achieved. - Type `Quantity` (represented as `dict` in JSON). """ - - self.detailRange = None - """ The target value to be achieved. - Type `Range` (represented as `dict` in JSON). """ - - self.due = None - """ Reach goal within. - Type `Duration` (represented as `dict` in JSON). """ - - self.measure = None - """ The parameter whose value is to be tracked. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(PlanDefinitionGoalTarget, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(PlanDefinitionGoalTarget, self).elementProperties() - js.extend([ - ("detailCodeableConcept", "detailCodeableConcept", codeableconcept.CodeableConcept, False, "detail", False), - ("detailQuantity", "detailQuantity", quantity.Quantity, False, "detail", False), - ("detailRange", "detailRange", range.Range, False, "detail", False), - ("due", "due", duration.Duration, False, None, False), - ("measure", "measure", codeableconcept.CodeableConcept, False, None, False), - ]) - return js - - -import sys -try: - from . import age -except ImportError: - age = sys.modules[__package__ + '.age'] -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 quantity -except ImportError: - quantity = sys.modules[__package__ + '.quantity'] -try: - from . import range -except ImportError: - range = sys.modules[__package__ + '.range'] -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/plandefinition_tests.py b/fhirclient/models/plandefinition_tests.py deleted file mode 100644 index 5fe6208c3..000000000 --- a/fhirclient/models/plandefinition_tests.py +++ /dev/null @@ -1,605 +0,0 @@ -#!/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 plandefinition -from .fhirdate import FHIRDate - - -class PlanDefinitionTests(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("PlanDefinition", js["resourceType"]) - return plandefinition.PlanDefinition(js) - - def testPlanDefinition1(self): - inst = self.instantiate_from("plandefinition-example-kdn5-simplified.json") - self.assertIsNotNone(inst, "Must have instantiated a PlanDefinition instance") - self.implPlanDefinition1(inst) - - js = inst.as_json() - self.assertEqual("PlanDefinition", js["resourceType"]) - inst2 = plandefinition.PlanDefinition(js) - 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") - self.assertEqual(inst.action[0].action[0].action[0].action[0].action[0].extension[0].extension[1].valueInteger, 8) - 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") - self.assertEqual(inst.action[0].action[0].action[0].action[0].action[1].id, "action-2") - self.assertEqual(inst.action[0].action[0].action[0].action[0].action[1].relatedAction[0].actionId, "action-1") - self.assertEqual(inst.action[0].action[0].action[0].action[0].action[1].relatedAction[0].relationship, "concurrent-with-start") - self.assertEqual(inst.action[0].action[0].action[0].action[0].action[1].textEquivalent, "CARBOplatin AUC 5 IV over 30 minutes on Day 1") - self.assertEqual(inst.action[0].action[0].action[0].action[0].id, "cycle-definition-1") - self.assertEqual(inst.action[0].action[0].action[0].action[0].textEquivalent, "21-day cycle for 6 cycles") - self.assertEqual(inst.action[0].action[0].action[0].action[0].timingTiming.repeat.count, 6) - self.assertEqual(inst.action[0].action[0].action[0].action[0].timingTiming.repeat.duration, 21) - self.assertEqual(inst.action[0].action[0].action[0].action[0].timingTiming.repeat.durationUnit, "d") - self.assertEqual(inst.action[0].action[0].action[0].groupingBehavior, "sentence-group") - self.assertEqual(inst.action[0].action[0].action[0].selectionBehavior, "exactly-one") - self.assertEqual(inst.action[0].action[0].selectionBehavior, "all") - 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.copyright, "All rights reserved.") - self.assertTrue(inst.experimental) - self.assertEqual(inst.id, "KDN5") - self.assertEqual(inst.identifier[0].system, "http://example.org/ordertemplates") - 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") - self.assertEqual(inst.relatedArtifact[0].url, "http://www.example.org/professionals/physician_gls/PDF/kidney.pdf") - self.assertEqual(inst.relatedArtifact[1].citation, "Oudard S, et al. J Urol. 2007;177(5):1698-702") - self.assertEqual(inst.relatedArtifact[1].type, "citation") - self.assertEqual(inst.relatedArtifact[1].url, "http://www.ncbi.nlm.nih.gov/pubmed/17437788") - self.assertEqual(inst.status, "draft") - self.assertEqual(inst.text.status, "additional") - self.assertEqual(inst.title, "Gemcitabine/CARBOplatin") - self.assertEqual(inst.type.text, "Chemotherapy Order Template") - self.assertEqual(inst.useContext[0].code.code, "treamentSetting-or-diseaseStatus") - self.assertEqual(inst.useContext[0].code.system, "http://example.org/fhir/CodeSystem/indications") - self.assertEqual(inst.useContext[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/usagecontext-group") - self.assertEqual(inst.useContext[0].extension[0].valueString, "A") - self.assertEqual(inst.useContext[0].valueCodeableConcept.text, "Metastatic") - self.assertEqual(inst.useContext[1].code.code, "disease-or-histology") - self.assertEqual(inst.useContext[1].code.system, "http://example.org/fhir/CodeSystem/indications") - self.assertEqual(inst.useContext[1].extension[0].url, "http://hl7.org/fhir/StructureDefinition/usagecontext-group") - 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://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") - self.assertEqual(inst.useContext[3].code.code, "treatmentSetting-or-diseaseStatus") - self.assertEqual(inst.useContext[3].code.system, "http://example.org/fhir/CodeSystem/indications") - self.assertEqual(inst.useContext[3].extension[0].url, "http://hl7.org/fhir/StructureDefinition/usagecontext-group") - self.assertEqual(inst.useContext[3].extension[0].valueString, "B") - self.assertEqual(inst.useContext[3].valueCodeableConcept.text, "Relapsed") - self.assertEqual(inst.useContext[4].code.code, "disease-or-histology") - self.assertEqual(inst.useContext[4].code.system, "http://example.org/fhir/CodeSystem/indications") - self.assertEqual(inst.useContext[4].extension[0].url, "http://hl7.org/fhir/StructureDefinition/usagecontext-group") - 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://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-options-example.json") - self.assertIsNotNone(inst, "Must have instantiated a PlanDefinition instance") - self.implPlanDefinition2(inst) - - js = inst.as_json() - self.assertEqual("PlanDefinition", js["resourceType"]) - inst2 = plandefinition.PlanDefinition(js) - self.implPlanDefinition2(inst2) - - def implPlanDefinition2(self, inst): - 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.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.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.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.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.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.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].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.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.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.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.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)") - self.assertEqual(inst.action[0].action[1].action[0].action[0].action[2].textEquivalent, "fluoxetine 20 mg capsule 1 capsule oral 1 time daily now (30 tablet; 3 refills)") - self.assertEqual(inst.action[0].action[1].action[0].action[0].action[3].textEquivalent, "paroxetine 20 mg tablet 1 tablet oral 1 time daily now (30 tablet; 3 refills)") - self.assertEqual(inst.action[0].action[1].action[0].action[0].action[4].textEquivalent, "sertraline 50 mg tablet 1 tablet oral 1 time daily now (30 tablet; 3 refills)") - self.assertEqual(inst.action[0].action[1].action[0].action[0].documentation[0].document.contentType, "text/html") - self.assertEqual(inst.action[0].action[1].action[0].action[0].documentation[0].document.title, "National Library of Medicine. DailyMed website. CITALOPRAM- citalopram hydrobromide tablet, film coated.") - self.assertEqual(inst.action[0].action[1].action[0].action[0].documentation[0].document.url, "http://dailymed.nlm.nih.gov/dailymed/drugInfo.cfm?setid=6daeb45c-451d-b135-bf8f-2d6dff4b6b01") - self.assertEqual(inst.action[0].action[1].action[0].action[0].documentation[0].type, "citation") - self.assertEqual(inst.action[0].action[1].action[0].action[0].groupingBehavior, "logical-group") - self.assertEqual(inst.action[0].action[1].action[0].action[0].selectionBehavior, "at-most-one") - self.assertEqual(inst.action[0].action[1].action[0].action[0].title, "Selective Serotonin Reuptake Inhibitors (Choose a mazimum of one or document reasons for exception)") - self.assertEqual(inst.action[0].action[1].action[0].action[1].textEquivalent, "Dopamine Norepinephrine Reuptake Inhibitors (Choose a maximum of one or document reasons for exception)") - 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/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://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") - self.assertEqual(inst.action[0].action[1].action[0].documentation[0].type, "citation") - 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[0].title, "First-Line Antidepressants") - self.assertEqual(inst.action[0].action[1].groupingBehavior, "logical-group") - self.assertEqual(inst.action[0].action[1].selectionBehavior, "at-most-one") - self.assertEqual(inst.action[0].action[1].title, "Medications") - 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") - 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.contained[0].id, "referralToMentalHealthCare") - self.assertEqual(inst.contained[1].id, "citalopramPrescription") - self.assertEqual(inst.contained[2].id, "citalopramMedication") - self.assertEqual(inst.contained[3].id, "citalopramSubstance") - 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, "Orders to be applied to a patient characterized as low suicide risk.") - 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.assertTrue(inst.experimental) - self.assertEqual(inst.id, "low-suicide-risk-order-set") - self.assertEqual(inst.identifier[0].system, "http://motivemi.com/artifacts") - self.assertEqual(inst.identifier[0].use, "official") - self.assertEqual(inst.identifier[0].value, "mmi:low-suicide-risk-order-set") - 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-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") - self.assertEqual(inst.title, "Low Suicide Risk Order Set") - self.assertEqual(inst.topic[0].text, "Suicide risk assessment") - 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://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://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://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://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://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://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://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 testPlanDefinition6(self): - inst = self.instantiate_from("plandefinition-predecessor-example.json") - self.assertIsNotNone(inst, "Must have instantiated a PlanDefinition instance") - self.implPlanDefinition6(inst) - - js = inst.as_json() - self.assertEqual("PlanDefinition", js["resourceType"]) - inst2 = plandefinition.PlanDefinition(js) - self.implPlanDefinition6(inst2) - - 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[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[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[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[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.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].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") - self.assertEqual(inst.title, "Example Zika Virus Intervention") - 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") - diff --git a/fhirclient/models/practitioner.py b/fhirclient/models/practitioner.py deleted file mode 100644 index fc41aba3f..000000000 --- a/fhirclient/models/practitioner.py +++ /dev/null @@ -1,175 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Practitioner) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class Practitioner(domainresource.DomainResource): - """ A person with a formal responsibility in the provisioning of healthcare or - related services. - - A person who is directly or indirectly involved in the provisioning of - healthcare. - """ - - resource_type = "Practitioner" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 practitioner's record is in active use. - Type `bool`. """ - - self.address = None - """ Address(es) of the practitioner that are not role specific - (typically home address). - List of `Address` items (represented as `dict` in JSON). """ - - self.birthDate = None - """ The date on which the practitioner was born. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.communication = None - """ A language the practitioner can use in patient communication. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.gender = None - """ male | female | other | unknown. - Type `str`. """ - - self.identifier = None - """ An identifier for the person as this agent. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.name = None - """ The name(s) associated with the practitioner. - List of `HumanName` items (represented as `dict` in JSON). """ - - self.photo = None - """ Image of the person. - List of `Attachment` items (represented as `dict` in JSON). """ - - self.qualification = None - """ Certification, licenses, or training pertaining to the provision of - care. - List of `PractitionerQualification` items (represented as `dict` in JSON). """ - - self.telecom = None - """ A contact detail for the practitioner (that apply to all roles). - List of `ContactPoint` items (represented as `dict` in JSON). """ - - super(Practitioner, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Practitioner, self).elementProperties() - js.extend([ - ("active", "active", bool, False, None, False), - ("address", "address", address.Address, True, None, False), - ("birthDate", "birthDate", fhirdate.FHIRDate, False, None, False), - ("communication", "communication", codeableconcept.CodeableConcept, True, None, False), - ("gender", "gender", str, False, None, False), - ("identifier", "identifier", identifier.Identifier, True, None, False), - ("name", "name", humanname.HumanName, True, None, False), - ("photo", "photo", attachment.Attachment, True, None, False), - ("qualification", "qualification", PractitionerQualification, True, None, False), - ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), - ]) - return js - - -from . import backboneelement - -class PractitionerQualification(backboneelement.BackboneElement): - """ 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" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 representation of the qualification. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.identifier = None - """ An identifier for this qualification for the practitioner. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.issuer = None - """ Organization that regulates and issues the qualification. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.period = None - """ Period during which the qualification is valid. - Type `Period` (represented as `dict` in JSON). """ - - super(PractitionerQualification, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(PractitionerQualification, self).elementProperties() - js.extend([ - ("code", "code", codeableconcept.CodeableConcept, False, None, True), - ("identifier", "identifier", identifier.Identifier, True, None, False), - ("issuer", "issuer", fhirreference.FHIRReference, False, None, False), - ("period", "period", period.Period, False, None, False), - ]) - return js - - -import sys -try: - from . import address -except ImportError: - address = sys.modules[__package__ + '.address'] -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 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: - 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 period -except ImportError: - period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/practitioner_tests.py b/fhirclient/models/practitioner_tests.py deleted file mode 100644 index 29b1c06f8..000000000 --- a/fhirclient/models/practitioner_tests.py +++ /dev/null @@ -1,396 +0,0 @@ -#!/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 practitioner -from .fhirdate import FHIRDate - - -class PractitionerTests(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("Practitioner", js["resourceType"]) - return practitioner.Practitioner(js) - - def testPractitioner1(self): - inst = self.instantiate_from("practitioner-example-f203-jvg.json") - self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") - self.implPractitioner1(inst) - - js = inst.as_json() - self.assertEqual("Practitioner", js["resourceType"]) - inst2 = practitioner.Practitioner(js) - self.implPractitioner1(inst2) - - def implPractitioner1(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.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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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, "+31715269111") - self.assertEqual(inst.text.status, "generated") - - def testPractitioner2(self): - inst = self.instantiate_from("practitioner-example-f201-ab.json") - self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") - self.implPractitioner2(inst) - - js = inst.as_json() - self.assertEqual("Practitioner", js["resourceType"]) - inst2 = practitioner.Practitioner(js) - self.implPractitioner2(inst2) - - def implPractitioner2(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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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, "+31715269111") - self.assertEqual(inst.text.status, "generated") - - def testPractitioner3(self): - inst = self.instantiate_from("practitioner-example-f202-lm.json") - self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") - self.implPractitioner3(inst) - - js = inst.as_json() - self.assertEqual("Practitioner", js["resourceType"]) - inst2 = practitioner.Practitioner(js) - self.implPractitioner3(inst2) - - def implPractitioner3(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.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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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, "+31715269111") - self.assertEqual(inst.text.status, "generated") - - def testPractitioner4(self): - inst = self.instantiate_from("practitioner-example-xcda-author.json") - self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") - self.implPractitioner4(inst) - - js = inst.as_json() - self.assertEqual("Practitioner", js["resourceType"]) - inst2 = practitioner.Practitioner(js) - self.implPractitioner4(inst2) - - def implPractitioner4(self, inst): - 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.text.status, "generated") - - def testPractitioner5(self): - inst = self.instantiate_from("practitioner-example-f003-mv.json") - self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") - self.implPractitioner5(inst) - - js = inst.as_json() - self.assertEqual("Practitioner", js["resourceType"]) - inst2 = practitioner.Practitioner(js) - self.implPractitioner5(inst2) - - 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 91") - self.assertEqual(inst.address[0].postalCode, "1105 AZ") - 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: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, "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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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.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.text.status, "generated") - - def testPractitioner6(self): - inst = self.instantiate_from("practitioner-example-f002-pv.json") - self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") - self.implPractitioner6(inst) - - js = inst.as_json() - self.assertEqual("Practitioner", js["resourceType"]) - inst2 = practitioner.Practitioner(js) - self.implPractitioner6(inst2) - - def implPractitioner6(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.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, "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, "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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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, "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.text.status, "generated") - - def testPractitioner7(self): - inst = self.instantiate_from("practitioner-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") - self.implPractitioner7(inst) - - js = inst.as_json() - self.assertEqual("Practitioner", js["resourceType"]) - inst2 = practitioner.Practitioner(js) - 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") - self.assertEqual(inst.address[0].postalCode, "9105 PZ") - self.assertEqual(inst.address[0].use, "work") - self.assertEqual(inst.birthDate.date, FHIRDate("1971-11-07").date) - self.assertEqual(inst.birthDate.as_json(), "1971-11-07") - self.assertEqual(inst.gender, "female") - self.assertEqual(inst.id, "f007") - 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, "874635264") - 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") - 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, "020556936") - self.assertEqual(inst.telecom[1].system, "email") - self.assertEqual(inst.telecom[1].use, "work") - self.assertEqual(inst.telecom[1].value, "S.M.Heps@bmc.nl") - self.assertEqual(inst.telecom[2].system, "fax") - self.assertEqual(inst.telecom[2].use, "work") - self.assertEqual(inst.telecom[2].value, "0205669283") - self.assertEqual(inst.text.status, "generated") - - def testPractitioner9(self): - inst = self.instantiate_from("practitioner-example-f204-ce.json") - self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") - self.implPractitioner9(inst) - - js = inst.as_json() - self.assertEqual("Practitioner", js["resourceType"]) - inst2 = practitioner.Practitioner(js) - self.implPractitioner9(inst2) - - def implPractitioner9(self, inst): - 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("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, "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, "+31715262169") - self.assertEqual(inst.text.status, "generated") - - def testPractitioner10(self): - inst = self.instantiate_from("practitioner-example-xcda1.json") - self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") - self.implPractitioner10(inst) - - js = inst.as_json() - self.assertEqual("Practitioner", js["resourceType"]) - inst2 = practitioner.Practitioner(js) - self.implPractitioner10(inst2) - - def implPractitioner10(self, inst): - 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, "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 deleted file mode 100644 index 1ecca2e3a..000000000 --- a/fhirclient/models/practitionerrole.py +++ /dev/null @@ -1,218 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/PractitionerRole) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class PractitionerRole(domainresource.DomainResource): - """ Roles/organizations the practitioner is associated with. - - A specific set of Roles/Locations/specialties/services that a practitioner - may perform at an organization for a period of time. - """ - - resource_type = "PractitionerRole" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 practitioner role record is in active use. - Type `bool`. """ - - self.availabilityExceptions = None - """ Description of availability exceptions. - Type `str`. """ - - self.availableTime = None - """ Times the Service Site is available. - List of `PractitionerRoleAvailableTime` items (represented as `dict` in JSON). """ - - self.code = None - """ Roles which this practitioner may perform. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.endpoint = None - """ Technical endpoints providing access to services operated for the - practitioner with this role. - 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 (represented as `dict` in JSON). """ - - self.identifier = None - """ Business Identifiers that are specific to a role/location. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.location = None - """ The location(s) at which this practitioner provides care. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.notAvailable = None - """ Not available during this time due to provided reason. - List of `PractitionerRoleNotAvailable` items (represented as `dict` in JSON). """ - - self.organization = None - """ Organization where the roles are available. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.period = None - """ The period during which the practitioner is authorized to perform - in these role(s). - Type `Period` (represented as `dict` in JSON). """ - - self.practitioner = None - """ Practitioner that is able to provide the defined services for the - organization. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.specialty = None - """ Specific specialty of the practitioner. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.telecom = None - """ Contact details that are specific to the role/location/service. - List of `ContactPoint` items (represented as `dict` in JSON). """ - - super(PractitionerRole, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(PractitionerRole, self).elementProperties() - js.extend([ - ("active", "active", bool, False, None, False), - ("availabilityExceptions", "availabilityExceptions", str, False, None, False), - ("availableTime", "availableTime", PractitionerRoleAvailableTime, True, 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), - ("notAvailable", "notAvailable", PractitionerRoleNotAvailable, True, None, False), - ("organization", "organization", fhirreference.FHIRReference, False, None, False), - ("period", "period", period.Period, False, None, False), - ("practitioner", "practitioner", fhirreference.FHIRReference, False, None, False), - ("specialty", "specialty", codeableconcept.CodeableConcept, True, None, False), - ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), - ]) - return js - - -from . import backboneelement - -class PractitionerRoleAvailableTime(backboneelement.BackboneElement): - """ Times the Service Site is available. - - A collection of times the practitioner is available or performing this role - at the location and/or healthcareservice. - """ - - resource_type = "PractitionerRoleAvailableTime" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Always available? e.g. 24 hour service. - Type `bool`. """ - - self.availableEndTime = None - """ Closing time of day (ignored if allDay = true). - Type `FHIRDate` (represented as `str` in JSON). """ - - self.availableStartTime = None - """ Opening time of day (ignored if allDay = true). - Type `FHIRDate` (represented as `str` in JSON). """ - - self.daysOfWeek = None - """ mon | tue | wed | thu | fri | sat | sun. - List of `str` items. """ - - super(PractitionerRoleAvailableTime, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(PractitionerRoleAvailableTime, self).elementProperties() - js.extend([ - ("allDay", "allDay", bool, False, None, False), - ("availableEndTime", "availableEndTime", fhirdate.FHIRDate, False, None, False), - ("availableStartTime", "availableStartTime", fhirdate.FHIRDate, False, None, False), - ("daysOfWeek", "daysOfWeek", str, True, None, False), - ]) - return js - - -class PractitionerRoleNotAvailable(backboneelement.BackboneElement): - """ Not available during this time due to provided reason. - - The practitioner is not available or performing this role during this - period of time due to the provided reason. - """ - - resource_type = "PractitionerRoleNotAvailable" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Reason presented to the user explaining why time not available. - Type `str`. """ - - self.during = None - """ Service not available from this date. - Type `Period` (represented as `dict` in JSON). """ - - super(PractitionerRoleNotAvailable, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(PractitionerRoleNotAvailable, self).elementProperties() - js.extend([ - ("description", "description", str, False, None, True), - ("during", "during", period.Period, False, 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 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/practitionerrole_tests.py b/fhirclient/models/practitionerrole_tests.py deleted file mode 100644 index 5a8d81427..000000000 --- a/fhirclient/models/practitionerrole_tests.py +++ /dev/null @@ -1,77 +0,0 @@ -#!/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 practitionerrole -from .fhirdate import FHIRDate - - -class PractitionerRoleTests(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("PractitionerRole", js["resourceType"]) - return practitionerrole.PractitionerRole(js) - - def testPractitionerRole1(self): - inst = self.instantiate_from("practitionerrole-example.json") - self.assertIsNotNone(inst, "Must have instantiated a PractitionerRole instance") - self.implPractitionerRole1(inst) - - js = inst.as_json() - self.assertEqual("PractitionerRole", js["resourceType"]) - inst2 = practitionerrole.PractitionerRole(js) - self.implPractitionerRole1(inst2) - - def implPractitionerRole1(self, inst): - self.assertTrue(inst.active) - self.assertEqual(inst.availabilityExceptions, "Adam is generally unavailable on public holidays and during the Christmas/New Year break") - self.assertEqual(inst.availableTime[0].availableEndTime.date, FHIRDate("16:30:00").date) - self.assertEqual(inst.availableTime[0].availableEndTime.as_json(), "16:30:00") - self.assertEqual(inst.availableTime[0].availableStartTime.date, FHIRDate("09:00:00").date) - self.assertEqual(inst.availableTime[0].availableStartTime.as_json(), "09:00:00") - self.assertEqual(inst.availableTime[0].daysOfWeek[0], "mon") - self.assertEqual(inst.availableTime[0].daysOfWeek[1], "tue") - self.assertEqual(inst.availableTime[0].daysOfWeek[2], "wed") - self.assertEqual(inst.availableTime[1].availableEndTime.date, FHIRDate("12:00:00").date) - self.assertEqual(inst.availableTime[1].availableEndTime.as_json(), "12:00:00") - self.assertEqual(inst.availableTime[1].availableStartTime.date, FHIRDate("09:00:00").date) - self.assertEqual(inst.availableTime[1].availableStartTime.as_json(), "09:00:00") - 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://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") - self.assertEqual(inst.notAvailable[0].during.start.date, FHIRDate("2017-05-01").date) - self.assertEqual(inst.notAvailable[0].during.start.as_json(), "2017-05-01") - 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, "phone") - self.assertEqual(inst.telecom[0].use, "work") - self.assertEqual(inst.telecom[0].value, "(03) 5555 6473") - self.assertEqual(inst.telecom[1].system, "email") - self.assertEqual(inst.telecom[1].use, "work") - self.assertEqual(inst.telecom[1].value, "adam.southern@example.org") - self.assertEqual(inst.text.status, "generated") - diff --git a/fhirclient/models/procedure.py b/fhirclient/models/procedure.py deleted file mode 100644 index 2a865916c..000000000 --- a/fhirclient/models/procedure.py +++ /dev/null @@ -1,309 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Procedure) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class Procedure(domainresource.DomainResource): - """ An action that is being or was performed on a patient. - - 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" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :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 (represented as `dict` in JSON). """ - - self.bodySite = None - """ Target body sites. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.category = None - """ Classification of the procedure. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.code = None - """ Identification of the procedure. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.complication = None - """ Complication following the procedure. - 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 (represented as `dict` in JSON). """ - - self.encounter = None - """ Encounter created as part of. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.focalDevice = None - """ Manipulated, implanted, or removed device. - List of `ProcedureFocalDevice` items (represented as `dict` in JSON). """ - - self.followUp = None - """ Instructions for follow up. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.identifier = None - """ External Identifiers for this procedure. - 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.location = None - """ Where the procedure happened. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.note = None - """ Additional information about the procedure. - List of `Annotation` items (represented as `dict` in JSON). """ - - self.outcome = None - """ The result of procedure. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.partOf = None - """ Part of referenced event. - 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 - """ When the procedure was performed. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.performedPeriod = None - """ 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). """ - - self.reasonCode = None - """ Coded reason procedure performed. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.reasonReference = None - """ 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 (represented as `dict` in JSON). """ - - self.status = None - """ 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` (represented as `dict` in JSON). """ - - self.usedCode = None - """ Coded items used during the procedure. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.usedReference = None - """ Items used during procedure. - 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), - ("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), - ("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), - ]) - return js - - -from . import backboneelement - -class ProcedureFocalDevice(backboneelement.BackboneElement): - """ 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 - a focal portion of the Procedure. - """ - - resource_type = "ProcedureFocalDevice" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Kind of change to device. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.manipulated = None - """ Device that was changed. - Type `FHIRReference` (represented as `dict` in JSON). """ - - super(ProcedureFocalDevice, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ProcedureFocalDevice, self).elementProperties() - js.extend([ - ("action", "action", codeableconcept.CodeableConcept, False, None, False), - ("manipulated", "manipulated", fhirreference.FHIRReference, False, None, True), - ]) - return js - - -class ProcedurePerformer(backboneelement.BackboneElement): - """ The people who performed the procedure. - - Limited to "real" people rather than equipment. - """ - - resource_type = "ProcedurePerformer" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ The reference to the practitioner. - 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` (represented as `dict` in JSON). """ - - super(ProcedurePerformer, self).__init__(jsondict=jsondict, strict=strict) - - 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), - ]) - return js - - -import sys -try: - from . import age -except ImportError: - age = sys.modules[__package__ + '.age'] -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'] -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 deleted file mode 100644 index ce9b927f4..000000000 --- a/fhirclient/models/procedure_tests.py +++ /dev/null @@ -1,325 +0,0 @@ -#!/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 procedure -from .fhirdate import FHIRDate - - -class ProcedureTests(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("Procedure", js["resourceType"]) - return procedure.Procedure(js) - - def testProcedure1(self): - inst = self.instantiate_from("procedure-example-f201-tpf.json") - self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") - self.implProcedure1(inst) - - js = inst.as_json() - self.assertEqual("Procedure", js["resourceType"]) - inst2 = procedure.Procedure(js) - self.implProcedure1(inst2) - - def implProcedure1(self, inst): - 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.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-ambulation.json") - self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") - self.implProcedure2(inst) - - js = inst.as_json() - self.assertEqual("Procedure", js["resourceType"]) - inst2 = procedure.Procedure(js) - self.implProcedure2(inst2) - - def implProcedure2(self, inst): - 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-implant.json") - self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") - self.implProcedure3(inst) - - js = inst.as_json() - self.assertEqual("Procedure", js["resourceType"]) - inst2 = procedure.Procedure(js) - self.implProcedure3(inst2) - - def implProcedure3(self, inst): - 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.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.status, "generated") - - def testProcedure4(self): - inst = self.instantiate_from("procedure-example-colon-biopsy.json") - self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") - self.implProcedure4(inst) - - js = inst.as_json() - self.assertEqual("Procedure", js["resourceType"]) - inst2 = procedure.Procedure(js) - self.implProcedure4(inst2) - - def implProcedure4(self, inst): - 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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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-f004-tracheotomy.json") - self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") - self.implProcedure5(inst) - - js = inst.as_json() - self.assertEqual("Procedure", js["resourceType"]) - inst2 = procedure.Procedure(js) - self.implProcedure5(inst2) - - def implProcedure5(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].system, "http://snomed.info/sct") - 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.status, "generated") - - def testProcedure6(self): - inst = self.instantiate_from("procedure-example-education.json") - self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") - self.implProcedure6(inst) - - js = inst.as_json() - self.assertEqual("Procedure", js["resourceType"]) - inst2 = procedure.Procedure(js) - self.implProcedure6(inst2) - - def implProcedure6(self, inst): - self.assertEqual(inst.category.coding[0].code, "311401005") - self.assertEqual(inst.category.coding[0].display, "Patient education (procedure)") - self.assertEqual(inst.category.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.category.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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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") - self.assertEqual(inst.status, "completed") - self.assertEqual(inst.text.div, "
Health education - breast examination for early detection of breast mass
") - self.assertEqual(inst.text.status, "generated") - - def testProcedure7(self): - inst = self.instantiate_from("procedure-example-colonoscopy.json") - self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") - self.implProcedure7(inst) - - js = inst.as_json() - self.assertEqual("Procedure", js["resourceType"]) - inst2 = procedure.Procedure(js) - self.implProcedure7(inst2) - - def implProcedure7(self, inst): - 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, "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-physical-therapy.json") - self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") - self.implProcedure8(inst) - - js = inst.as_json() - self.assertEqual("Procedure", js["resourceType"]) - inst2 = procedure.Procedure(js) - self.implProcedure8(inst2) - - def implProcedure8(self, inst): - 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.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.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): - inst = self.instantiate_from("procedure-example-f003-abscess.json") - self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") - self.implProcedure9(inst) - - js = inst.as_json() - self.assertEqual("Procedure", js["resourceType"]) - inst2 = procedure.Procedure(js) - self.implProcedure9(inst2) - - def implProcedure9(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, "172960003") - self.assertEqual(inst.code.coding[0].display, "Incision of retropharyngeal abscess") - 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].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.json") - self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") - self.implProcedure10(inst) - - js = inst.as_json() - self.assertEqual("Procedure", js["resourceType"]) - inst2 = procedure.Procedure(js) - self.implProcedure10(inst2) - - def implProcedure10(self, inst): - 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.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/provenance.py b/fhirclient/models/provenance.py deleted file mode 100644 index b0e1ca24e..000000000 --- a/fhirclient/models/provenance.py +++ /dev/null @@ -1,205 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Provenance) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class Provenance(domainresource.DomainResource): - """ Who, What, When for a set of resources. - - Provenance of a resource is a record that describes entities and processes - involved in producing and delivering or otherwise influencing that - resource. Provenance provides a critical foundation for assessing - authenticity, enabling trust, and allowing reproducibility. Provenance - assertions are a form of contextual metadata and can themselves become - important records with their own provenance. Provenance statement indicates - clinical significance in terms of confidence in authenticity, reliability, - and trustworthiness, integrity, and stage in lifecycle (e.g. Document - Completion - has the artifact been legally authenticated), all of which may - impact security, privacy, and trust policies. - """ - - resource_type = "Provenance" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.activity = None - """ Activity that occurred. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.agent = None - """ Actor involved. - List of `ProvenanceAgent` items (represented as `dict` in JSON). """ - - self.entity = None - """ An entity used in this activity. - List of `ProvenanceEntity` items (represented as `dict` in JSON). """ - - self.location = None - """ Where the activity occurred, if relevant. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.occurredDateTime = None - """ When the activity occurred. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.occurredPeriod = None - """ When the activity occurred. - Type `Period` (represented as `dict` in JSON). """ - - self.policy = None - """ Policy or plan the activity was defined by. - List of `str` items. """ - - self.reason = None - """ Reason the activity is occurring. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.recorded = None - """ When the activity was recorded / updated. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.signature = None - """ Signature on target. - List of `Signature` items (represented as `dict` in JSON). """ - - self.target = None - """ Target Reference(s) (usually version specific). - 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", codeableconcept.CodeableConcept, False, None, False), - ("agent", "agent", ProvenanceAgent, True, None, True), - ("entity", "entity", ProvenanceEntity, True, None, False), - ("location", "location", fhirreference.FHIRReference, 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", 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), - ]) - return js - - -from . import backboneelement - -class ProvenanceAgent(backboneelement.BackboneElement): - """ Actor involved. - - 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 = "ProvenanceAgent" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.onBehalfOf = None - """ Who the agent is representing. - 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.type = None - """ How the agent participated. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.who = None - """ Who participated. - 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([ - ("onBehalfOf", "onBehalfOf", fhirreference.FHIRReference, False, None, False), - ("role", "role", codeableconcept.CodeableConcept, True, None, False), - ("type", "type", codeableconcept.CodeableConcept, False, None, False), - ("who", "who", fhirreference.FHIRReference, False, None, True), - ]) - return js - - -class ProvenanceEntity(backboneelement.BackboneElement): - """ An entity used in this activity. - """ - - resource_type = "ProvenanceEntity" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Entity is attributed to this agent. - List of `ProvenanceAgent` items (represented as `dict` in JSON). """ - - self.role = None - """ derivation | revision | quotation | source | removal. - Type `str`. """ - - self.what = None - """ Identity of entity. - Type `FHIRReference` (represented as `dict` in JSON). """ - - super(ProvenanceEntity, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ProvenanceEntity, self).elementProperties() - js.extend([ - ("agent", "agent", ProvenanceAgent, True, None, False), - ("role", "role", str, False, None, True), - ("what", "what", 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 period -except ImportError: - period = sys.modules[__package__ + '.period'] -try: - from . import signature -except ImportError: - signature = sys.modules[__package__ + '.signature'] diff --git a/fhirclient/models/provenance_tests.py b/fhirclient/models/provenance_tests.py deleted file mode 100644 index 4d61896a2..000000000 --- a/fhirclient/models/provenance_tests.py +++ /dev/null @@ -1,142 +0,0 @@ -#!/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 provenance -from .fhirdate import FHIRDate - - -class ProvenanceTests(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("Provenance", js["resourceType"]) - return provenance.Provenance(js) - - def testProvenance1(self): - inst = self.instantiate_from("provenance-example-sig.json") - self.assertIsNotNone(inst, "Must have instantiated a Provenance instance") - self.implProvenance1(inst) - - js = inst.as_json() - self.assertEqual("Provenance", js["resourceType"]) - inst2 = provenance.Provenance(js) - self.implProvenance1(inst2) - - def implProvenance1(self, inst): - 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): - inst = self.instantiate_from("provenance-example-cwl.json") - self.assertIsNotNone(inst, "Must have instantiated a Provenance instance") - self.implProvenance2(inst) - - js = inst.as_json() - self.assertEqual("Provenance", js["resourceType"]) - inst2 = provenance.Provenance(js) - self.implProvenance2(inst2) - - def implProvenance2(self, inst): - 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-cwl") - self.assertEqual(inst.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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-biocompute-object.json") - self.assertIsNotNone(inst, "Must have instantiated a Provenance instance") - self.implProvenance3(inst) - - js = inst.as_json() - self.assertEqual("Provenance", js["resourceType"]) - inst2 = provenance.Provenance(js) - self.implProvenance3(inst2) - - def implProvenance3(self, inst): - 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): - inst = self.instantiate_from("provenance-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Provenance instance") - self.implProvenance4(inst) - - js = inst.as_json() - self.assertEqual("Provenance", js["resourceType"]) - inst2 = provenance.Provenance(js) - self.implProvenance4(inst2) - - def implProvenance4(self, inst): - 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].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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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].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.status, "generated") - diff --git a/fhirclient/models/quantity.py b/fhirclient/models/quantity.py deleted file mode 100644 index 277c7f4cb..000000000 --- a/fhirclient/models/quantity.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MoneyQuantity) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import element - -class Quantity(element.Element): - """ A measured or measurable amount. - - A measured amount (or an amount that can potentially be measured). Note - that measured amounts include amounts that are not precisely quantified, - including amounts involving arbitrary units and floating currencies. - """ - - resource_type = "Quantity" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 form of the unit. - Type `str`. """ - - self.comparator = None - """ < | <= | >= | > - how to understand the value. - Type `str`. """ - - self.system = None - """ System that defines coded unit form. - Type `str`. """ - - self.unit = None - """ Unit representation. - Type `str`. """ - - self.value = None - """ Numerical value (with implicit precision). - Type `float`. """ - - super(Quantity, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Quantity, self).elementProperties() - js.extend([ - ("code", "code", str, False, None, False), - ("comparator", "comparator", str, False, None, False), - ("system", "system", str, False, None, False), - ("unit", "unit", str, False, None, False), - ("value", "value", float, False, None, False), - ]) - return js - - diff --git a/fhirclient/models/questionnaire.py b/fhirclient/models/questionnaire.py deleted file mode 100644 index 0a6d129ca..000000000 --- a/fhirclient/models/questionnaire.py +++ /dev/null @@ -1,530 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Questionnaire) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class Questionnaire(domainresource.DomainResource): - """ A structured set of questions. - - A structured set of questions intended to guide the collection of answers - from end-users. Questionnaires provide detailed control over order, - presentation, phraseology and grouping to allow coherent, consistent data - collection. - """ - - resource_type = "Questionnaire" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 questionnaire was approved by publisher. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.code = None - """ Concept that represents the overall questionnaire. - List of `Coding` 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.derivedFrom = None - """ Instantiates protocol or definition. - List of `str` items. """ - - self.description = None - """ Natural language description of the questionnaire. - Type `str`. """ - - self.effectivePeriod = None - """ When the questionnaire 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 questionnaire. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.item = None - """ Questions and sections within the Questionnaire. - List of `QuestionnaireItem` items (represented as `dict` in JSON). """ - - self.jurisdiction = None - """ Intended jurisdiction for questionnaire (if applicable). - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.lastReviewDate = None - """ When the questionnaire was last reviewed. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.name = None - """ Name for this questionnaire (computer friendly). - Type `str`. """ - - self.publisher = None - """ Name of the publisher (organization or individual). - Type `str`. """ - - self.purpose = None - """ Why this questionnaire is defined. - Type `str`. """ - - self.status = None - """ draft | active | retired | unknown. - Type `str`. """ - - self.subjectType = None - """ Resource that can be subject of QuestionnaireResponse. - List of `str` items. """ - - self.title = None - """ Name for this questionnaire (human friendly). - Type `str`. """ - - self.url = None - """ Canonical identifier for this questionnaire, 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 questionnaire. - Type `str`. """ - - super(Questionnaire, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Questionnaire, self).elementProperties() - js.extend([ - ("approvalDate", "approvalDate", fhirdate.FHIRDate, False, None, False), - ("code", "code", coding.Coding, True, None, False), - ("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), - ("identifier", "identifier", identifier.Identifier, True, None, False), - ("item", "item", QuestionnaireItem, True, None, False), - ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), - ("lastReviewDate", "lastReviewDate", fhirdate.FHIRDate, False, None, False), - ("name", "name", str, False, None, False), - ("publisher", "publisher", str, False, None, False), - ("purpose", "purpose", str, False, None, False), - ("status", "status", str, False, None, True), - ("subjectType", "subjectType", str, True, 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 QuestionnaireItem(backboneelement.BackboneElement): - """ Questions and sections within the Questionnaire. - - A particular question, question grouping or display text that is part of - the questionnaire. - """ - - resource_type = "QuestionnaireItem" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :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). """ - - self.definition = None - """ 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.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. - List of `QuestionnaireItem` items (represented as `dict` in JSON). """ - - self.linkId = None - """ Unique id for item in questionnaire. - Type `str`. """ - - self.maxLength = None - """ No more than this many characters. - Type `int`. """ - - self.prefix = None - """ E.g. "1(a)", "2.5.3". - Type `str`. """ - - self.readOnly = None - """ Don't allow human editing. - Type `bool`. """ - - self.repeats = None - """ Whether the item may repeat. - Type `bool`. """ - - self.required = None - """ Whether the item must be included in data results. - Type `bool`. """ - - self.text = None - """ Primary text for the item. - Type `str`. """ - - self.type = None - """ group | display | boolean | decimal | integer | date | dateTime +. - Type `str`. """ - - super(QuestionnaireItem, self).__init__(jsondict=jsondict, strict=strict) - - 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), - ("initial", "initial", QuestionnaireItemInitial, True, None, False), - ("item", "item", QuestionnaireItem, True, None, False), - ("linkId", "linkId", str, False, None, True), - ("maxLength", "maxLength", int, False, None, False), - ("prefix", "prefix", str, False, None, False), - ("readOnly", "readOnly", bool, False, None, False), - ("repeats", "repeats", bool, False, None, False), - ("required", "required", bool, False, None, False), - ("text", "text", str, False, None, False), - ("type", "type", str, False, None, True), - ]) - 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. - - A constraint indicating that this item should only be enabled - (displayed/allow answers to be captured) when the specified condition is - true. - """ - - resource_type = "QuestionnaireItemEnableWhen" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.answerBoolean = None - """ Value for question comparison based on operator. - Type `bool`. """ - - self.answerCoding = None - """ Value for question comparison based on operator. - Type `Coding` (represented as `dict` in JSON). """ - - self.answerDate = None - """ Value for question comparison based on operator. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.answerDateTime = None - """ Value for question comparison based on operator. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.answerDecimal = None - """ Value for question comparison based on operator. - Type `float`. """ - - self.answerInteger = None - """ Value for question comparison based on operator. - Type `int`. """ - - self.answerQuantity = None - """ Value for question comparison based on operator. - Type `Quantity` (represented as `dict` in JSON). """ - - self.answerReference = None - """ Value for question comparison based on operator. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.answerString = None - """ Value for question comparison based on operator. - Type `str`. """ - - self.answerTime = None - """ Value for question comparison based on operator. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.operator = None - """ exists | = | != | > | < | >= | <=. - Type `str`. """ - - self.question = None - """ Question that determines whether item is enabled. - Type `str`. """ - - super(QuestionnaireItemEnableWhen, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(QuestionnaireItemEnableWhen, self).elementProperties() - js.extend([ - ("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 QuestionnaireItemInitial(backboneelement.BackboneElement): - """ Initial value(s) when item is first rendered. - - One or more values that should be pre-populated in the answer when - initially rendering the questionnaire for user input. - """ - - resource_type = "QuestionnaireItemInitial" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ 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 - """ Actual value for initializing the question. - Type `Coding` (represented as `dict` in JSON). """ - - self.valueDate = None - """ 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 - """ 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 - """ Actual value for initializing the question. - Type `str`. """ - - self.valueTime = None - """ Actual value for initializing the question. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.valueUri = None - """ Actual value for initializing the question. - Type `str`. """ - - super(QuestionnaireItemInitial, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - 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 - - -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 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 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 quantity -except ImportError: - quantity = sys.modules[__package__ + '.quantity'] -try: - from . import usagecontext -except ImportError: - usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/questionnaire_tests.py b/fhirclient/models/questionnaire_tests.py deleted file mode 100644 index 8c219bac5..000000000 --- a/fhirclient/models/questionnaire_tests.py +++ /dev/null @@ -1,366 +0,0 @@ -#!/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 questionnaire -from .fhirdate import FHIRDate - - -class QuestionnaireTests(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("Questionnaire", js["resourceType"]) - return questionnaire.Questionnaire(js) - - def testQuestionnaire1(self): - inst = self.instantiate_from("questionnaire-cqf-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Questionnaire instance") - self.implQuestionnaire1(inst) - - js = inst.as_json() - self.assertEqual("Questionnaire", js["resourceType"]) - inst2 = questionnaire.Questionnaire(js) - self.implQuestionnaire1(inst2) - - def implQuestionnaire1(self, inst): - 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, "Patient Health Questionnaire (PHQ-9)") - self.assertEqual(inst.version, "1.0.0") - - def testQuestionnaire2(self): - inst = self.instantiate_from("questionnaire-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Questionnaire instance") - self.implQuestionnaire2(inst) - - js = inst.as_json() - self.assertEqual("Questionnaire", js["resourceType"]) - inst2 = questionnaire.Questionnaire(js) - 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") - self.assertEqual(inst.date.date, FHIRDate("2010").date) - self.assertEqual(inst.date.as_json(), "2010") - self.assertEqual(inst.id, "f201") - self.assertEqual(inst.item[0].linkId, "1") - self.assertEqual(inst.item[0].text, "Do you have allergies?") - self.assertEqual(inst.item[0].type, "boolean") - 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[0].type, "string") - 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[1].type, "date") - 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[2].type, "string") - 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].item[3].type, "string") - self.assertEqual(inst.item[1].linkId, "2") - self.assertEqual(inst.item[1].text, "General questions") - self.assertEqual(inst.item[1].type, "group") - 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[0].type, "boolean") - 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].item[1].type, "boolean") - self.assertEqual(inst.item[2].linkId, "3") - self.assertEqual(inst.item[2].text, "Intoxications") - self.assertEqual(inst.item[2].type, "group") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.subjectType[0], "Patient") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.url, "http://hl7.org/fhir/Questionnaire/f201") - - def testQuestionnaire4(self): - inst = self.instantiate_from("questionnaire-example-gcs.json") - self.assertIsNotNone(inst, "Must have instantiated a Questionnaire instance") - self.implQuestionnaire4(inst) - - js = inst.as_json() - self.assertEqual("Questionnaire", js["resourceType"]) - inst2 = questionnaire.Questionnaire(js) - self.implQuestionnaire4(inst2) - - 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") - self.assertEqual(inst.contained[1].id, "verbal") - self.assertEqual(inst.contained[2].id, "eye") - 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") - self.assertEqual(inst.item[2].type, "choice") - self.assertEqual(inst.publisher, "FHIR Project team") - self.assertEqual(inst.status, "draft") - self.assertEqual(inst.subjectType[0], "Patient") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.title, "Glasgow Coma Score") - self.assertEqual(inst.url, "http://hl7.org/fhir/Questionnaire/gcs") - - def testQuestionnaire5(self): - inst = self.instantiate_from("questionnaire-example-bluebook.json") - self.assertIsNotNone(inst, "Must have instantiated a Questionnaire instance") - self.implQuestionnaire5(inst) - - js = inst.as_json() - self.assertEqual("Questionnaire", js["resourceType"]) - inst2 = questionnaire.Questionnaire(js) - self.implQuestionnaire5(inst2) - - 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.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, "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 deleted file mode 100644 index dad6d42cf..000000000 --- a/fhirclient/models/questionnaireresponse.py +++ /dev/null @@ -1,259 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class QuestionnaireResponse(domainresource.DomainResource): - """ A structured set of questions and their answers. - - A structured set of questions and their answers. The questions are ordered - and grouped into coherent subsets, corresponding to the structure of the - grouping of the questionnaire being responded to. - """ - - resource_type = "QuestionnaireResponse" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Person who received and recorded the answers. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.authored = None - """ Date the answers were gathered. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.basedOn = None - """ Request fulfilled by this QuestionnaireResponse. - List of `FHIRReference` items (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. - Type `Identifier` (represented as `dict` in JSON). """ - - self.item = None - """ Groups and questions. - List of `QuestionnaireResponseItem` items (represented as `dict` in JSON). """ - - self.partOf = None - """ Part of this action. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.questionnaire = None - """ Form being answered. - Type `str`. """ - - self.source = None - """ The person who answered the questions. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.status = None - """ in-progress | completed | amended | entered-in-error | stopped. - Type `str`. """ - - self.subject = None - """ The subject of the questions. - Type `FHIRReference` (represented as `dict` in JSON). """ - - super(QuestionnaireResponse, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(QuestionnaireResponse, self).elementProperties() - js.extend([ - ("author", "author", fhirreference.FHIRReference, False, None, False), - ("authored", "authored", fhirdate.FHIRDate, False, None, False), - ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), - ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), - ("identifier", "identifier", identifier.Identifier, False, None, False), - ("item", "item", QuestionnaireResponseItem, True, 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), - ]) - return js - - -from . import backboneelement - -class QuestionnaireResponseItem(backboneelement.BackboneElement): - """ Groups and questions. - - A group or question item from the original questionnaire for which answers - are provided. - """ - - resource_type = "QuestionnaireResponseItem" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ The response(s) to the question. - List of `QuestionnaireResponseItemAnswer` items (represented as `dict` in JSON). """ - - self.definition = None - """ ElementDefinition - details for the item. - Type `str`. """ - - self.item = None - """ Nested questionnaire response items. - List of `QuestionnaireResponseItem` items (represented as `dict` in JSON). """ - - self.linkId = None - """ Pointer to specific item from Questionnaire. - Type `str`. """ - - self.text = None - """ Name for group or question text. - Type `str`. """ - - super(QuestionnaireResponseItem, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(QuestionnaireResponseItem, self).elementProperties() - js.extend([ - ("answer", "answer", QuestionnaireResponseItemAnswer, True, None, False), - ("definition", "definition", str, False, None, False), - ("item", "item", QuestionnaireResponseItem, True, None, False), - ("linkId", "linkId", str, False, None, True), - ("text", "text", str, False, None, False), - ]) - return js - - -class QuestionnaireResponseItemAnswer(backboneelement.BackboneElement): - """ The response(s) to the question. - - The respondent's answer(s) to the question. - """ - - resource_type = "QuestionnaireResponseItemAnswer" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Nested groups and questions. - List of `QuestionnaireResponseItem` items (represented as `dict` in JSON). """ - - self.valueAttachment = None - """ Single-valued answer to the question. - Type `Attachment` (represented as `dict` in JSON). """ - - self.valueBoolean = None - """ Single-valued answer to the question. - Type `bool`. """ - - self.valueCoding = None - """ Single-valued answer to the question. - Type `Coding` (represented as `dict` in JSON). """ - - self.valueDate = None - """ Single-valued answer to the question. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.valueDateTime = None - """ Single-valued answer to the question. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.valueDecimal = None - """ Single-valued answer to the question. - Type `float`. """ - - self.valueInteger = None - """ Single-valued answer to the question. - Type `int`. """ - - self.valueQuantity = None - """ Single-valued answer to the question. - Type `Quantity` (represented as `dict` in JSON). """ - - self.valueReference = None - """ Single-valued answer to the question. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.valueString = None - """ Single-valued answer to the question. - Type `str`. """ - - self.valueTime = None - """ Single-valued answer to the question. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.valueUri = None - """ Single-valued answer to the question. - Type `str`. """ - - super(QuestionnaireResponseItemAnswer, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(QuestionnaireResponseItemAnswer, self).elementProperties() - js.extend([ - ("item", "item", QuestionnaireResponseItem, True, None, False), - ("valueAttachment", "valueAttachment", attachment.Attachment, False, "value", False), - ("valueBoolean", "valueBoolean", bool, False, "value", False), - ("valueCoding", "valueCoding", coding.Coding, False, "value", False), - ("valueDate", "valueDate", fhirdate.FHIRDate, False, "value", False), - ("valueDateTime", "valueDateTime", fhirdate.FHIRDate, False, "value", False), - ("valueDecimal", "valueDecimal", float, False, "value", False), - ("valueInteger", "valueInteger", int, False, "value", False), - ("valueQuantity", "valueQuantity", quantity.Quantity, False, "value", False), - ("valueReference", "valueReference", fhirreference.FHIRReference, False, "value", False), - ("valueString", "valueString", str, False, "value", False), - ("valueTime", "valueTime", fhirdate.FHIRDate, False, "value", False), - ("valueUri", "valueUri", str, False, "value", False), - ]) - return js - - -import sys -try: - from . import attachment -except ImportError: - attachment = sys.modules[__package__ + '.attachment'] -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 quantity -except ImportError: - quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/questionnaireresponse_tests.py b/fhirclient/models/questionnaireresponse_tests.py deleted file mode 100644 index 6e63238de..000000000 --- a/fhirclient/models/questionnaireresponse_tests.py +++ /dev/null @@ -1,775 +0,0 @@ -#!/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 questionnaireresponse -from .fhirdate import FHIRDate - - -class QuestionnaireResponseTests(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("QuestionnaireResponse", js["resourceType"]) - return questionnaireresponse.QuestionnaireResponse(js) - - def testQuestionnaireResponse1(self): - inst = self.instantiate_from("questionnaireresponse-example.json") - self.assertIsNotNone(inst, "Must have instantiated a QuestionnaireResponse instance") - self.implQuestionnaireResponse1(inst) - - js = inst.as_json() - self.assertEqual("QuestionnaireResponse", js["resourceType"]) - inst2 = questionnaireresponse.QuestionnaireResponse(js) - self.implQuestionnaireResponse1(inst2) - - def implQuestionnaireResponse1(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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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-ussg-fht-answers.json") - self.assertIsNotNone(inst, "Must have instantiated a QuestionnaireResponse instance") - self.implQuestionnaireResponse2(inst) - - js = inst.as_json() - self.assertEqual("QuestionnaireResponse", js["resourceType"]) - inst2 = questionnaireresponse.QuestionnaireResponse(js) - self.implQuestionnaireResponse2(inst2) - - def implQuestionnaireResponse2(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") - self.assertEqual(inst.item[0].item[0].answer[0].valueDate.date, FHIRDate("2008-01-17").date) - self.assertEqual(inst.item[0].item[0].answer[0].valueDate.as_json(), "2008-01-17") - self.assertEqual(inst.item[0].item[0].linkId, "0.1") - self.assertEqual(inst.item[0].item[0].text, "Date Done") - self.assertEqual(inst.item[0].linkId, "0") - self.assertEqual(inst.item[1].definition, "http://loinc.org/fhir/DataElement/54126-8") - self.assertEqual(inst.item[1].item[0].item[0].answer[0].valueString, "Annie Proband") - self.assertEqual(inst.item[1].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54125-0") - self.assertEqual(inst.item[1].item[0].item[0].linkId, "1.1.1") - self.assertEqual(inst.item[1].item[0].item[0].text, "Name") - self.assertEqual(inst.item[1].item[0].item[1].answer[0].valueCoding.code, "LA3-6") - self.assertEqual(inst.item[1].item[0].item[1].answer[0].valueCoding.display, "Female") - self.assertEqual(inst.item[1].item[0].item[1].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[1].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54131-8") - self.assertEqual(inst.item[1].item[0].item[1].linkId, "1.1.2") - self.assertEqual(inst.item[1].item[0].item[1].text, "Gender") - self.assertEqual(inst.item[1].item[0].item[2].answer[0].valueDate.date, FHIRDate("1966-04-04").date) - self.assertEqual(inst.item[1].item[0].item[2].answer[0].valueDate.as_json(), "1966-04-04") - self.assertEqual(inst.item[1].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/21112-8") - self.assertEqual(inst.item[1].item[0].item[2].linkId, "1.1.3") - self.assertEqual(inst.item[1].item[0].item[2].text, "Date of Birth") - self.assertEqual(inst.item[1].item[0].item[3].answer[0].valueCoding.code, "LA32-8") - self.assertEqual(inst.item[1].item[0].item[3].answer[0].valueCoding.display, "No") - self.assertEqual(inst.item[1].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[1].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54132-6") - self.assertEqual(inst.item[1].item[0].item[3].linkId, "1.1.4") - self.assertEqual(inst.item[1].item[0].item[3].text, "Were you born a twin?") - self.assertEqual(inst.item[1].item[0].item[4].answer[0].valueCoding.code, "LA32-8") - self.assertEqual(inst.item[1].item[0].item[4].answer[0].valueCoding.display, "No") - self.assertEqual(inst.item[1].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[1].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54128-4") - self.assertEqual(inst.item[1].item[0].item[4].linkId, "1.1.5") - self.assertEqual(inst.item[1].item[0].item[4].text, "Were you adopted?") - self.assertEqual(inst.item[1].item[0].item[5].answer[0].valueCoding.code, "LA32-8") - self.assertEqual(inst.item[1].item[0].item[5].answer[0].valueCoding.display, "No") - self.assertEqual(inst.item[1].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[1].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54135-9") - self.assertEqual(inst.item[1].item[0].item[5].linkId, "1.1.6") - self.assertEqual(inst.item[1].item[0].item[5].text, "Are your parents related to each other in any way other than marriage?") - self.assertEqual(inst.item[1].item[0].item[6].answer[0].item[0].item[0].answer[0].valueCoding.code, "[in_i]") - self.assertEqual(inst.item[1].item[0].item[6].answer[0].item[0].item[0].answer[0].valueCoding.display, "inches") - self.assertEqual(inst.item[1].item[0].item[6].answer[0].item[0].item[0].answer[0].valueCoding.system, "http://unitsofmeasure.org") - self.assertEqual(inst.item[1].item[0].item[6].answer[0].item[0].item[0].linkId, "1.1.7.1.1") - self.assertEqual(inst.item[1].item[0].item[6].answer[0].item[0].item[0].text, "Units") - self.assertEqual(inst.item[1].item[0].item[6].answer[0].item[0].linkId, "1.1.7.1") - self.assertEqual(inst.item[1].item[0].item[6].answer[0].valueDecimal, 63) - 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_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") - self.assertEqual(inst.item[1].item[0].item[7].answer[0].item[0].item[0].text, "Units") - self.assertEqual(inst.item[1].item[0].item[7].answer[0].item[0].linkId, "1.1.8.1") - self.assertEqual(inst.item[1].item[0].item[7].answer[0].valueDecimal, 127) - self.assertEqual(inst.item[1].item[0].item[7].definition, "http://loinc.org/fhir/DataElement/29463-7") - self.assertEqual(inst.item[1].item[0].item[7].linkId, "1.1.8") - self.assertEqual(inst.item[1].item[0].item[7].text, "Weight") - self.assertEqual(inst.item[1].item[0].item[8].answer[0].valueDecimal, 22.5) - self.assertEqual(inst.item[1].item[0].item[8].definition, "http://loinc.org/fhir/DataElement/39156-5") - self.assertEqual(inst.item[1].item[0].item[8].linkId, "1.1.9") - self.assertEqual(inst.item[1].item[0].item[8].text, "Body mass index (BMI) [Ratio]") - self.assertEqual(inst.item[1].item[0].item[9].answer[0].valueCoding.code, "LA4457-3") - self.assertEqual(inst.item[1].item[0].item[9].answer[0].valueCoding.display, "White") - self.assertEqual(inst.item[1].item[0].item[9].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[1].item[0].item[9].definition, "http://loinc.org/fhir/DataElement/54134-2") - self.assertEqual(inst.item[1].item[0].item[9].linkId, "1.1.10") - self.assertEqual(inst.item[1].item[0].item[9].text, "Race") - self.assertEqual(inst.item[1].item[0].linkId, "1.1") - 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].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") - self.assertEqual(inst.item[2].item[1].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[1].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54136-7") - self.assertEqual(inst.item[2].item[1].item[0].item[0].linkId, "2.1.1.1") - self.assertEqual(inst.item[2].item[1].item[0].item[0].text, "Relationship to you") - self.assertEqual(inst.item[2].item[1].item[0].item[1].answer[0].valueString, "Brian") - self.assertEqual(inst.item[2].item[1].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54138-3") - self.assertEqual(inst.item[2].item[1].item[0].item[1].linkId, "2.1.1.2") - self.assertEqual(inst.item[2].item[1].item[0].item[1].text, "Name") - self.assertEqual(inst.item[2].item[1].item[0].item[2].answer[0].valueCoding.code, "LA2-8") - self.assertEqual(inst.item[2].item[1].item[0].item[2].answer[0].valueCoding.display, "Male") - self.assertEqual(inst.item[2].item[1].item[0].item[2].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[1].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/54123-5") - self.assertEqual(inst.item[2].item[1].item[0].item[2].linkId, "2.1.1.3") - self.assertEqual(inst.item[2].item[1].item[0].item[2].text, "Gender") - self.assertEqual(inst.item[2].item[1].item[0].item[3].answer[0].item[0].item[0].answer[0].valueDecimal, 32) - self.assertEqual(inst.item[2].item[1].item[0].item[3].answer[0].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54141-7") - self.assertEqual(inst.item[2].item[1].item[0].item[3].answer[0].item[0].item[0].linkId, "2.1.1.4.2.2") - self.assertEqual(inst.item[2].item[1].item[0].item[3].answer[0].item[0].item[0].text, "Age") - self.assertEqual(inst.item[2].item[1].item[0].item[3].answer[0].item[0].linkId, "2.1.1.4.2") - self.assertEqual(inst.item[2].item[1].item[0].item[3].answer[0].valueCoding.code, "LA33-6") - self.assertEqual(inst.item[2].item[1].item[0].item[3].answer[0].valueCoding.display, "Yes") - self.assertEqual(inst.item[2].item[1].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[1].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54139-1") - self.assertEqual(inst.item[2].item[1].item[0].item[3].linkId, "2.1.1.4") - self.assertEqual(inst.item[2].item[1].item[0].item[3].text, "Living?") - self.assertEqual(inst.item[2].item[1].item[0].item[4].answer[0].valueCoding.code, "LA32-8") - self.assertEqual(inst.item[2].item[1].item[0].item[4].answer[0].valueCoding.display, "No") - self.assertEqual(inst.item[2].item[1].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[1].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54121-9") - self.assertEqual(inst.item[2].item[1].item[0].item[4].linkId, "2.1.1.5") - self.assertEqual(inst.item[2].item[1].item[0].item[4].text, "Was this person born a twin?") - self.assertEqual(inst.item[2].item[1].item[0].item[5].answer[0].valueCoding.code, "LA32-8") - self.assertEqual(inst.item[2].item[1].item[0].item[5].answer[0].valueCoding.display, "No") - self.assertEqual(inst.item[2].item[1].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[1].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54122-7") - self.assertEqual(inst.item[2].item[1].item[0].item[5].linkId, "2.1.1.6") - self.assertEqual(inst.item[2].item[1].item[0].item[5].text, "Was this person adopted?") - self.assertEqual(inst.item[2].item[1].item[0].linkId, "2.1.1") - self.assertEqual(inst.item[2].item[1].item[1].item[0].answer[0].valueCoding.code, "LA10550-4") - self.assertEqual(inst.item[2].item[1].item[1].item[0].answer[0].valueCoding.display, "-- Other Cancer") - self.assertEqual(inst.item[2].item[1].item[1].item[0].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[1].item[1].item[0].linkId, "2.1.2.1") - self.assertEqual(inst.item[2].item[1].item[1].item[0].text, "Disease or Condition") - self.assertEqual(inst.item[2].item[1].item[1].item[1].answer[0].valueCoding.code, "LA10397-0") - self.assertEqual(inst.item[2].item[1].item[1].item[1].answer[0].valueCoding.display, "30-39") - self.assertEqual(inst.item[2].item[1].item[1].item[1].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[1].item[1].item[1].linkId, "2.1.2.2") - self.assertEqual(inst.item[2].item[1].item[1].item[1].text, "Age at Diagnosis") - self.assertEqual(inst.item[2].item[1].item[1].linkId, "2.1.2") - self.assertEqual(inst.item[2].item[1].item[1].text, "This family member's history of disease") - self.assertEqual(inst.item[2].item[1].linkId, "2.1") - self.assertEqual(inst.item[2].item[2].item[0].item[0].answer[0].valueCoding.code, "LA10418-4") - self.assertEqual(inst.item[2].item[2].item[0].item[0].answer[0].valueCoding.display, "Sister") - self.assertEqual(inst.item[2].item[2].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[2].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54136-7") - self.assertEqual(inst.item[2].item[2].item[0].item[0].linkId, "2.1.1.1") - self.assertEqual(inst.item[2].item[2].item[0].item[0].text, "Relationship to you") - self.assertEqual(inst.item[2].item[2].item[0].item[1].answer[0].valueString, "Janet") - self.assertEqual(inst.item[2].item[2].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54138-3") - self.assertEqual(inst.item[2].item[2].item[0].item[1].linkId, "2.1.1.2") - self.assertEqual(inst.item[2].item[2].item[0].item[1].text, "Name") - self.assertEqual(inst.item[2].item[2].item[0].item[2].answer[0].valueCoding.code, "LA3-6") - self.assertEqual(inst.item[2].item[2].item[0].item[2].answer[0].valueCoding.display, "Female") - self.assertEqual(inst.item[2].item[2].item[0].item[2].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[2].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/54123-5") - self.assertEqual(inst.item[2].item[2].item[0].item[2].linkId, "2.1.1.3") - self.assertEqual(inst.item[2].item[2].item[0].item[2].text, "Gender") - self.assertEqual(inst.item[2].item[2].item[0].item[3].answer[0].item[0].item[0].answer[0].valueDecimal, 36) - self.assertEqual(inst.item[2].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[2].item[0].item[3].answer[0].item[0].item[0].linkId, "2.1.1.4.2.2") - self.assertEqual(inst.item[2].item[2].item[0].item[3].answer[0].item[0].item[0].text, "Age") - self.assertEqual(inst.item[2].item[2].item[0].item[3].answer[0].item[0].linkId, "2.1.1.4.2") - self.assertEqual(inst.item[2].item[2].item[0].item[3].answer[0].valueCoding.code, "LA33-6") - self.assertEqual(inst.item[2].item[2].item[0].item[3].answer[0].valueCoding.display, "Yes") - self.assertEqual(inst.item[2].item[2].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[2].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54139-1") - self.assertEqual(inst.item[2].item[2].item[0].item[3].linkId, "2.1.1.4") - self.assertEqual(inst.item[2].item[2].item[0].item[3].text, "Living?") - self.assertEqual(inst.item[2].item[2].item[0].item[4].answer[0].valueCoding.code, "LA32-8") - self.assertEqual(inst.item[2].item[2].item[0].item[4].answer[0].valueCoding.display, "No") - self.assertEqual(inst.item[2].item[2].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[2].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54121-9") - self.assertEqual(inst.item[2].item[2].item[0].item[4].linkId, "2.1.1.5") - self.assertEqual(inst.item[2].item[2].item[0].item[4].text, "Was this person born a twin?") - self.assertEqual(inst.item[2].item[2].item[0].item[5].answer[0].valueCoding.code, "LA32-8") - self.assertEqual(inst.item[2].item[2].item[0].item[5].answer[0].valueCoding.display, "No") - self.assertEqual(inst.item[2].item[2].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[2].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54122-7") - self.assertEqual(inst.item[2].item[2].item[0].item[5].linkId, "2.1.1.6") - self.assertEqual(inst.item[2].item[2].item[0].item[5].text, "Was this person adopted?") - self.assertEqual(inst.item[2].item[2].item[0].linkId, "2.1.1") - self.assertEqual(inst.item[2].item[2].item[1].item[0].answer[0].valueCoding.code, "LA10536-3") - self.assertEqual(inst.item[2].item[2].item[1].item[0].answer[0].valueCoding.display, "-- Breast Cancer") - self.assertEqual(inst.item[2].item[2].item[1].item[0].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[2].item[1].item[0].linkId, "2.1.2.1") - self.assertEqual(inst.item[2].item[2].item[1].item[0].text, "Disease or Condition") - self.assertEqual(inst.item[2].item[2].item[1].item[1].answer[0].valueCoding.code, "LA10397-0") - self.assertEqual(inst.item[2].item[2].item[1].item[1].answer[0].valueCoding.display, "30-39") - self.assertEqual(inst.item[2].item[2].item[1].item[1].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[2].item[1].item[1].linkId, "2.1.2.2") - self.assertEqual(inst.item[2].item[2].item[1].item[1].text, "Age at Diagnosis") - self.assertEqual(inst.item[2].item[2].item[1].linkId, "2.1.2") - self.assertEqual(inst.item[2].item[2].item[1].text, "This family member's history of disease") - self.assertEqual(inst.item[2].item[2].linkId, "2.1") - self.assertEqual(inst.item[2].item[3].item[0].item[0].answer[0].valueCoding.code, "LA10419-2") - self.assertEqual(inst.item[2].item[3].item[0].item[0].answer[0].valueCoding.display, "Nephew") - self.assertEqual(inst.item[2].item[3].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[3].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54136-7") - self.assertEqual(inst.item[2].item[3].item[0].item[0].linkId, "2.1.1.1") - self.assertEqual(inst.item[2].item[3].item[0].item[0].text, "Relationship to you") - self.assertEqual(inst.item[2].item[3].item[0].item[1].answer[0].valueString, "Ian") - self.assertEqual(inst.item[2].item[3].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54138-3") - self.assertEqual(inst.item[2].item[3].item[0].item[1].linkId, "2.1.1.2") - self.assertEqual(inst.item[2].item[3].item[0].item[1].text, "Name") - self.assertEqual(inst.item[2].item[3].item[0].item[2].answer[0].valueCoding.code, "LA2-8") - self.assertEqual(inst.item[2].item[3].item[0].item[2].answer[0].valueCoding.display, "Male") - self.assertEqual(inst.item[2].item[3].item[0].item[2].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[3].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/54123-5") - self.assertEqual(inst.item[2].item[3].item[0].item[2].linkId, "2.1.1.3") - self.assertEqual(inst.item[2].item[3].item[0].item[2].text, "Gender") - self.assertEqual(inst.item[2].item[3].item[0].item[3].answer[0].item[0].item[0].answer[0].valueDecimal, 16) - self.assertEqual(inst.item[2].item[3].item[0].item[3].answer[0].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54141-7") - self.assertEqual(inst.item[2].item[3].item[0].item[3].answer[0].item[0].item[0].linkId, "2.1.1.4.2.2") - self.assertEqual(inst.item[2].item[3].item[0].item[3].answer[0].item[0].item[0].text, "Age") - self.assertEqual(inst.item[2].item[3].item[0].item[3].answer[0].item[0].linkId, "2.1.1.4.2") - self.assertEqual(inst.item[2].item[3].item[0].item[3].answer[0].valueCoding.code, "LA33-6") - self.assertEqual(inst.item[2].item[3].item[0].item[3].answer[0].valueCoding.display, "Yes") - self.assertEqual(inst.item[2].item[3].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[3].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54139-1") - self.assertEqual(inst.item[2].item[3].item[0].item[3].linkId, "2.1.1.4") - self.assertEqual(inst.item[2].item[3].item[0].item[3].text, "Living?") - self.assertEqual(inst.item[2].item[3].item[0].item[4].answer[0].valueCoding.code, "LA32-8") - self.assertEqual(inst.item[2].item[3].item[0].item[4].answer[0].valueCoding.display, "No") - self.assertEqual(inst.item[2].item[3].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[3].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54121-9") - self.assertEqual(inst.item[2].item[3].item[0].item[4].linkId, "2.1.1.5") - self.assertEqual(inst.item[2].item[3].item[0].item[4].text, "Was this person born a twin?") - self.assertEqual(inst.item[2].item[3].item[0].item[5].answer[0].valueCoding.code, "LA32-8") - self.assertEqual(inst.item[2].item[3].item[0].item[5].answer[0].valueCoding.display, "No") - self.assertEqual(inst.item[2].item[3].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[3].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54122-7") - self.assertEqual(inst.item[2].item[3].item[0].item[5].linkId, "2.1.1.6") - self.assertEqual(inst.item[2].item[3].item[0].item[5].text, "Was this person adopted?") - self.assertEqual(inst.item[2].item[3].item[0].linkId, "2.1.1") - self.assertEqual(inst.item[2].item[3].linkId, "2.1") - self.assertEqual(inst.item[2].item[4].item[0].item[0].answer[0].valueCoding.code, "LA10420-0") - self.assertEqual(inst.item[2].item[4].item[0].item[0].answer[0].valueCoding.display, "Niece") - self.assertEqual(inst.item[2].item[4].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[4].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54136-7") - self.assertEqual(inst.item[2].item[4].item[0].item[0].linkId, "2.1.1.1") - self.assertEqual(inst.item[2].item[4].item[0].item[0].text, "Relationship to you") - self.assertEqual(inst.item[2].item[4].item[0].item[1].answer[0].valueString, "Helen") - self.assertEqual(inst.item[2].item[4].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54138-3") - self.assertEqual(inst.item[2].item[4].item[0].item[1].linkId, "2.1.1.2") - self.assertEqual(inst.item[2].item[4].item[0].item[1].text, "Name") - self.assertEqual(inst.item[2].item[4].item[0].item[2].answer[0].valueCoding.code, "LA3-6") - self.assertEqual(inst.item[2].item[4].item[0].item[2].answer[0].valueCoding.display, "Female") - self.assertEqual(inst.item[2].item[4].item[0].item[2].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[4].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/54123-5") - self.assertEqual(inst.item[2].item[4].item[0].item[2].linkId, "2.1.1.3") - self.assertEqual(inst.item[2].item[4].item[0].item[2].text, "Gender") - self.assertEqual(inst.item[2].item[4].item[0].item[3].answer[0].item[0].item[0].answer[0].valueDecimal, 15) - self.assertEqual(inst.item[2].item[4].item[0].item[3].answer[0].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54141-7") - self.assertEqual(inst.item[2].item[4].item[0].item[3].answer[0].item[0].item[0].linkId, "2.1.1.4.2.2") - self.assertEqual(inst.item[2].item[4].item[0].item[3].answer[0].item[0].item[0].text, "Age") - self.assertEqual(inst.item[2].item[4].item[0].item[3].answer[0].item[0].linkId, "2.1.1.4.2") - self.assertEqual(inst.item[2].item[4].item[0].item[3].answer[0].valueCoding.code, "LA33-6") - self.assertEqual(inst.item[2].item[4].item[0].item[3].answer[0].valueCoding.display, "Yes") - self.assertEqual(inst.item[2].item[4].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[4].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54139-1") - self.assertEqual(inst.item[2].item[4].item[0].item[3].linkId, "2.1.1.4") - self.assertEqual(inst.item[2].item[4].item[0].item[3].text, "Living?") - self.assertEqual(inst.item[2].item[4].item[0].item[4].answer[0].valueCoding.code, "LA32-8") - self.assertEqual(inst.item[2].item[4].item[0].item[4].answer[0].valueCoding.display, "No") - self.assertEqual(inst.item[2].item[4].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[4].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54121-9") - self.assertEqual(inst.item[2].item[4].item[0].item[4].linkId, "2.1.1.5") - self.assertEqual(inst.item[2].item[4].item[0].item[4].text, "Was this person born a twin?") - self.assertEqual(inst.item[2].item[4].item[0].item[5].answer[0].valueCoding.code, "LA32-8") - self.assertEqual(inst.item[2].item[4].item[0].item[5].answer[0].valueCoding.display, "No") - self.assertEqual(inst.item[2].item[4].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[4].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54122-7") - self.assertEqual(inst.item[2].item[4].item[0].item[5].linkId, "2.1.1.6") - self.assertEqual(inst.item[2].item[4].item[0].item[5].text, "Was this person adopted?") - self.assertEqual(inst.item[2].item[4].item[0].linkId, "2.1.1") - self.assertEqual(inst.item[2].item[4].linkId, "2.1") - self.assertEqual(inst.item[2].item[5].item[0].item[0].answer[0].valueCoding.code, "LA10416-8") - self.assertEqual(inst.item[2].item[5].item[0].item[0].answer[0].valueCoding.display, "Father") - self.assertEqual(inst.item[2].item[5].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[5].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54136-7") - self.assertEqual(inst.item[2].item[5].item[0].item[0].linkId, "2.1.1.1") - self.assertEqual(inst.item[2].item[5].item[0].item[0].text, "Relationship to you") - self.assertEqual(inst.item[2].item[5].item[0].item[1].answer[0].valueString, "Donald") - self.assertEqual(inst.item[2].item[5].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54138-3") - self.assertEqual(inst.item[2].item[5].item[0].item[1].linkId, "2.1.1.2") - self.assertEqual(inst.item[2].item[5].item[0].item[1].text, "Name") - self.assertEqual(inst.item[2].item[5].item[0].item[2].answer[0].valueCoding.code, "LA2-8") - self.assertEqual(inst.item[2].item[5].item[0].item[2].answer[0].valueCoding.display, "Male") - self.assertEqual(inst.item[2].item[5].item[0].item[2].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[5].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/54123-5") - self.assertEqual(inst.item[2].item[5].item[0].item[2].linkId, "2.1.1.3") - self.assertEqual(inst.item[2].item[5].item[0].item[2].text, "Gender") - self.assertEqual(inst.item[2].item[5].item[0].item[3].answer[0].item[0].item[0].answer[0].valueDecimal, 52) - self.assertEqual(inst.item[2].item[5].item[0].item[3].answer[0].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54141-7") - self.assertEqual(inst.item[2].item[5].item[0].item[3].answer[0].item[0].item[0].linkId, "2.1.1.4.2.2") - self.assertEqual(inst.item[2].item[5].item[0].item[3].answer[0].item[0].item[0].text, "Age") - self.assertEqual(inst.item[2].item[5].item[0].item[3].answer[0].item[0].linkId, "2.1.1.4.2") - self.assertEqual(inst.item[2].item[5].item[0].item[3].answer[0].valueCoding.code, "LA33-6") - self.assertEqual(inst.item[2].item[5].item[0].item[3].answer[0].valueCoding.display, "Yes") - self.assertEqual(inst.item[2].item[5].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[5].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54139-1") - self.assertEqual(inst.item[2].item[5].item[0].item[3].linkId, "2.1.1.4") - self.assertEqual(inst.item[2].item[5].item[0].item[3].text, "Living?") - self.assertEqual(inst.item[2].item[5].item[0].item[4].answer[0].valueCoding.code, "LA32-8") - self.assertEqual(inst.item[2].item[5].item[0].item[4].answer[0].valueCoding.display, "No") - self.assertEqual(inst.item[2].item[5].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[5].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54121-9") - self.assertEqual(inst.item[2].item[5].item[0].item[4].linkId, "2.1.1.5") - self.assertEqual(inst.item[2].item[5].item[0].item[4].text, "Was this person born a twin?") - self.assertEqual(inst.item[2].item[5].item[0].item[5].answer[0].valueCoding.code, "LA32-8") - self.assertEqual(inst.item[2].item[5].item[0].item[5].answer[0].valueCoding.display, "No") - self.assertEqual(inst.item[2].item[5].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[5].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54122-7") - self.assertEqual(inst.item[2].item[5].item[0].item[5].linkId, "2.1.1.6") - self.assertEqual(inst.item[2].item[5].item[0].item[5].text, "Was this person adopted?") - self.assertEqual(inst.item[2].item[5].item[0].linkId, "2.1.1") - self.assertEqual(inst.item[2].item[5].linkId, "2.1") - self.assertEqual(inst.item[2].item[6].item[0].item[0].answer[0].valueCoding.code, "LA10425-9") - self.assertEqual(inst.item[2].item[6].item[0].item[0].answer[0].valueCoding.display, "Paternal Uncle") - self.assertEqual(inst.item[2].item[6].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[6].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54136-7") - self.assertEqual(inst.item[2].item[6].item[0].item[0].linkId, "2.1.1.1") - self.assertEqual(inst.item[2].item[6].item[0].item[0].text, "Relationship to you") - self.assertEqual(inst.item[2].item[6].item[0].item[1].answer[0].valueString, "Eric") - self.assertEqual(inst.item[2].item[6].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54138-3") - self.assertEqual(inst.item[2].item[6].item[0].item[1].linkId, "2.1.1.2") - self.assertEqual(inst.item[2].item[6].item[0].item[1].text, "Name") - self.assertEqual(inst.item[2].item[6].item[0].item[2].answer[0].valueCoding.code, "LA2-8") - self.assertEqual(inst.item[2].item[6].item[0].item[2].answer[0].valueCoding.display, "Male") - self.assertEqual(inst.item[2].item[6].item[0].item[2].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[6].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/54123-5") - self.assertEqual(inst.item[2].item[6].item[0].item[2].linkId, "2.1.1.3") - self.assertEqual(inst.item[2].item[6].item[0].item[2].text, "Gender") - self.assertEqual(inst.item[2].item[6].item[0].item[3].answer[0].item[0].item[0].answer[0].valueDecimal, 56) - self.assertEqual(inst.item[2].item[6].item[0].item[3].answer[0].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54141-7") - self.assertEqual(inst.item[2].item[6].item[0].item[3].answer[0].item[0].item[0].linkId, "2.1.1.4.2.2") - self.assertEqual(inst.item[2].item[6].item[0].item[3].answer[0].item[0].item[0].text, "Age") - self.assertEqual(inst.item[2].item[6].item[0].item[3].answer[0].item[0].linkId, "2.1.1.4.2") - self.assertEqual(inst.item[2].item[6].item[0].item[3].answer[0].valueCoding.code, "LA33-6") - self.assertEqual(inst.item[2].item[6].item[0].item[3].answer[0].valueCoding.display, "Yes") - self.assertEqual(inst.item[2].item[6].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[6].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54139-1") - self.assertEqual(inst.item[2].item[6].item[0].item[3].linkId, "2.1.1.4") - self.assertEqual(inst.item[2].item[6].item[0].item[3].text, "Living?") - self.assertEqual(inst.item[2].item[6].item[0].item[4].answer[0].valueCoding.code, "LA32-8") - self.assertEqual(inst.item[2].item[6].item[0].item[4].answer[0].valueCoding.display, "No") - self.assertEqual(inst.item[2].item[6].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[6].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54121-9") - self.assertEqual(inst.item[2].item[6].item[0].item[4].linkId, "2.1.1.5") - self.assertEqual(inst.item[2].item[6].item[0].item[4].text, "Was this person born a twin?") - self.assertEqual(inst.item[2].item[6].item[0].item[5].answer[0].valueCoding.code, "LA32-8") - self.assertEqual(inst.item[2].item[6].item[0].item[5].answer[0].valueCoding.display, "No") - self.assertEqual(inst.item[2].item[6].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[6].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54122-7") - self.assertEqual(inst.item[2].item[6].item[0].item[5].linkId, "2.1.1.6") - self.assertEqual(inst.item[2].item[6].item[0].item[5].text, "Was this person adopted?") - self.assertEqual(inst.item[2].item[6].item[0].linkId, "2.1.1") - self.assertEqual(inst.item[2].item[6].linkId, "2.1") - self.assertEqual(inst.item[2].item[7].item[0].item[0].answer[0].valueCoding.code, "LA10421-8") - self.assertEqual(inst.item[2].item[7].item[0].item[0].answer[0].valueCoding.display, "Paternal Aunt") - self.assertEqual(inst.item[2].item[7].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[7].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54136-7") - self.assertEqual(inst.item[2].item[7].item[0].item[0].linkId, "2.1.1.1") - self.assertEqual(inst.item[2].item[7].item[0].item[0].text, "Relationship to you") - self.assertEqual(inst.item[2].item[7].item[0].item[1].answer[0].valueString, "Fiona") - self.assertEqual(inst.item[2].item[7].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54138-3") - self.assertEqual(inst.item[2].item[7].item[0].item[1].linkId, "2.1.1.2") - self.assertEqual(inst.item[2].item[7].item[0].item[1].text, "Name") - self.assertEqual(inst.item[2].item[7].item[0].item[2].answer[0].valueCoding.code, "LA3-6") - self.assertEqual(inst.item[2].item[7].item[0].item[2].answer[0].valueCoding.display, "Female") - self.assertEqual(inst.item[2].item[7].item[0].item[2].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[7].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/54123-5") - self.assertEqual(inst.item[2].item[7].item[0].item[2].linkId, "2.1.1.3") - self.assertEqual(inst.item[2].item[7].item[0].item[2].text, "Gender") - self.assertEqual(inst.item[2].item[7].item[0].item[3].answer[0].item[0].item[0].answer[0].valueDecimal, 57) - self.assertEqual(inst.item[2].item[7].item[0].item[3].answer[0].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54141-7") - self.assertEqual(inst.item[2].item[7].item[0].item[3].answer[0].item[0].item[0].linkId, "2.1.1.4.2.2") - self.assertEqual(inst.item[2].item[7].item[0].item[3].answer[0].item[0].item[0].text, "Age") - self.assertEqual(inst.item[2].item[7].item[0].item[3].answer[0].item[0].linkId, "2.1.1.4.2") - self.assertEqual(inst.item[2].item[7].item[0].item[3].answer[0].valueCoding.code, "LA33-6") - self.assertEqual(inst.item[2].item[7].item[0].item[3].answer[0].valueCoding.display, "Yes") - self.assertEqual(inst.item[2].item[7].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[7].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54139-1") - self.assertEqual(inst.item[2].item[7].item[0].item[3].linkId, "2.1.1.4") - self.assertEqual(inst.item[2].item[7].item[0].item[3].text, "Living?") - self.assertEqual(inst.item[2].item[7].item[0].item[4].answer[0].valueCoding.code, "LA32-8") - self.assertEqual(inst.item[2].item[7].item[0].item[4].answer[0].valueCoding.display, "No") - self.assertEqual(inst.item[2].item[7].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[7].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54121-9") - self.assertEqual(inst.item[2].item[7].item[0].item[4].linkId, "2.1.1.5") - self.assertEqual(inst.item[2].item[7].item[0].item[4].text, "Was this person born a twin?") - self.assertEqual(inst.item[2].item[7].item[0].item[5].answer[0].valueCoding.code, "LA32-8") - self.assertEqual(inst.item[2].item[7].item[0].item[5].answer[0].valueCoding.display, "No") - self.assertEqual(inst.item[2].item[7].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[7].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54122-7") - self.assertEqual(inst.item[2].item[7].item[0].item[5].linkId, "2.1.1.6") - self.assertEqual(inst.item[2].item[7].item[0].item[5].text, "Was this person adopted?") - self.assertEqual(inst.item[2].item[7].item[0].linkId, "2.1.1") - self.assertEqual(inst.item[2].item[7].item[1].item[0].answer[0].valueCoding.code, "LA10543-9") - self.assertEqual(inst.item[2].item[7].item[1].item[0].answer[0].valueCoding.display, "-- Skin Cancer") - self.assertEqual(inst.item[2].item[7].item[1].item[0].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[7].item[1].item[0].linkId, "2.1.2.1") - self.assertEqual(inst.item[2].item[7].item[1].item[0].text, "Disease or Condition") - self.assertEqual(inst.item[2].item[7].item[1].linkId, "2.1.2") - self.assertEqual(inst.item[2].item[7].item[1].text, "This family member's history of disease") - self.assertEqual(inst.item[2].item[7].linkId, "2.1") - self.assertEqual(inst.item[2].item[8].item[0].item[0].answer[0].valueCoding.code, "LA10423-4") - self.assertEqual(inst.item[2].item[8].item[0].item[0].answer[0].valueCoding.display, "Paternal Grandfather") - self.assertEqual(inst.item[2].item[8].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[8].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54136-7") - self.assertEqual(inst.item[2].item[8].item[0].item[0].linkId, "2.1.1.1") - self.assertEqual(inst.item[2].item[8].item[0].item[0].text, "Relationship to you") - self.assertEqual(inst.item[2].item[8].item[0].item[1].answer[0].valueString, "Bob") - self.assertEqual(inst.item[2].item[8].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54138-3") - self.assertEqual(inst.item[2].item[8].item[0].item[1].linkId, "2.1.1.2") - self.assertEqual(inst.item[2].item[8].item[0].item[1].text, "Name") - self.assertEqual(inst.item[2].item[8].item[0].item[2].answer[0].valueCoding.code, "LA2-8") - self.assertEqual(inst.item[2].item[8].item[0].item[2].answer[0].valueCoding.display, "Male") - self.assertEqual(inst.item[2].item[8].item[0].item[2].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[8].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/54123-5") - self.assertEqual(inst.item[2].item[8].item[0].item[2].linkId, "2.1.1.3") - self.assertEqual(inst.item[2].item[8].item[0].item[2].text, "Gender") - self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[0].answer[0].valueCoding.code, "LA10537-1") - self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[0].answer[0].valueCoding.display, "-- Colon Cancer") - self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54112-8") - self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[0].linkId, "2.1.1.4.1.1") - self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[0].text, "Cause of Death") - self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[1].answer[0].valueCoding.code, "LA10400-2") - self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[1].answer[0].valueCoding.display, "OVER 60") - self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[1].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54113-6") - self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[1].linkId, "2.1.1.4.1.2") - self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].item[1].text, "Age at Death") - self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].item[0].linkId, "2.1.1.4.1") - self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].valueCoding.code, "LA32-8") - self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].valueCoding.display, "No") - self.assertEqual(inst.item[2].item[8].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[8].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54139-1") - self.assertEqual(inst.item[2].item[8].item[0].item[3].linkId, "2.1.1.4") - self.assertEqual(inst.item[2].item[8].item[0].item[3].text, "Living?") - self.assertEqual(inst.item[2].item[8].item[0].item[4].answer[0].valueCoding.code, "LA32-8") - self.assertEqual(inst.item[2].item[8].item[0].item[4].answer[0].valueCoding.display, "No") - self.assertEqual(inst.item[2].item[8].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[8].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54121-9") - self.assertEqual(inst.item[2].item[8].item[0].item[4].linkId, "2.1.1.5") - self.assertEqual(inst.item[2].item[8].item[0].item[4].text, "Was this person born a twin?") - self.assertEqual(inst.item[2].item[8].item[0].item[5].answer[0].valueCoding.code, "LA32-8") - self.assertEqual(inst.item[2].item[8].item[0].item[5].answer[0].valueCoding.display, "No") - self.assertEqual(inst.item[2].item[8].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[8].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54122-7") - self.assertEqual(inst.item[2].item[8].item[0].item[5].linkId, "2.1.1.6") - self.assertEqual(inst.item[2].item[8].item[0].item[5].text, "Was this person adopted?") - self.assertEqual(inst.item[2].item[8].item[0].linkId, "2.1.1") - self.assertEqual(inst.item[2].item[8].item[1].item[0].answer[0].valueCoding.code, "LA10537-1") - self.assertEqual(inst.item[2].item[8].item[1].item[0].answer[0].valueCoding.display, "-- Colon Cancer") - self.assertEqual(inst.item[2].item[8].item[1].item[0].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[8].item[1].item[0].linkId, "2.1.2.1") - self.assertEqual(inst.item[2].item[8].item[1].item[0].text, "Disease or Condition") - self.assertEqual(inst.item[2].item[8].item[1].item[1].answer[0].valueCoding.code, "LA10400-2") - self.assertEqual(inst.item[2].item[8].item[1].item[1].answer[0].valueCoding.display, "OVER 60") - self.assertEqual(inst.item[2].item[8].item[1].item[1].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[8].item[1].item[1].linkId, "2.1.2.2") - self.assertEqual(inst.item[2].item[8].item[1].item[1].text, "Age at Diagnosis") - self.assertEqual(inst.item[2].item[8].item[1].linkId, "2.1.2") - self.assertEqual(inst.item[2].item[8].item[1].text, "This family member's history of disease") - self.assertEqual(inst.item[2].item[8].linkId, "2.1") - self.assertEqual(inst.item[2].item[9].item[0].item[0].answer[0].valueCoding.code, "LA10424-2") - self.assertEqual(inst.item[2].item[9].item[0].item[0].answer[0].valueCoding.display, "Paternal Grandmother") - self.assertEqual(inst.item[2].item[9].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[9].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54136-7") - self.assertEqual(inst.item[2].item[9].item[0].item[0].linkId, "2.1.1.1") - self.assertEqual(inst.item[2].item[9].item[0].item[0].text, "Relationship to you") - self.assertEqual(inst.item[2].item[9].item[0].item[1].answer[0].valueString, "Claire") - self.assertEqual(inst.item[2].item[9].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54138-3") - self.assertEqual(inst.item[2].item[9].item[0].item[1].linkId, "2.1.1.2") - self.assertEqual(inst.item[2].item[9].item[0].item[1].text, "Name") - self.assertEqual(inst.item[2].item[9].item[0].item[2].answer[0].valueCoding.code, "LA3-6") - self.assertEqual(inst.item[2].item[9].item[0].item[2].answer[0].valueCoding.display, "Female") - self.assertEqual(inst.item[2].item[9].item[0].item[2].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[9].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/54123-5") - self.assertEqual(inst.item[2].item[9].item[0].item[2].linkId, "2.1.1.3") - self.assertEqual(inst.item[2].item[9].item[0].item[2].text, "Gender") - self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[0].answer[0].item[0].answer[0].valueString, "Lou Gehrigs") - self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[0].answer[0].item[0].linkId, "2.1.1.4.1.1.1") - self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[0].answer[0].item[0].text, "Please specify") - self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[0].answer[0].valueCoding.code, "LA10589-2") - self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[0].answer[0].valueCoding.display, "-- Other/Unexpected") - self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54112-8") - self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[0].linkId, "2.1.1.4.1.1") - self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[0].text, "Cause of Death") - self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[1].answer[0].valueCoding.code, "LA10400-2") - self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[1].answer[0].valueCoding.display, "OVER 60") - self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[1].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54113-6") - self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[1].linkId, "2.1.1.4.1.2") - self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].item[1].text, "Age at Death") - self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].item[0].linkId, "2.1.1.4.1") - self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].valueCoding.code, "LA32-8") - self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].valueCoding.display, "No") - self.assertEqual(inst.item[2].item[9].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[9].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54139-1") - self.assertEqual(inst.item[2].item[9].item[0].item[3].linkId, "2.1.1.4") - self.assertEqual(inst.item[2].item[9].item[0].item[3].text, "Living?") - self.assertEqual(inst.item[2].item[9].item[0].item[4].answer[0].valueCoding.code, "LA32-8") - self.assertEqual(inst.item[2].item[9].item[0].item[4].answer[0].valueCoding.display, "No") - self.assertEqual(inst.item[2].item[9].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[9].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54121-9") - self.assertEqual(inst.item[2].item[9].item[0].item[4].linkId, "2.1.1.5") - self.assertEqual(inst.item[2].item[9].item[0].item[4].text, "Was this person born a twin?") - self.assertEqual(inst.item[2].item[9].item[0].item[5].answer[0].valueCoding.code, "LA32-8") - self.assertEqual(inst.item[2].item[9].item[0].item[5].answer[0].valueCoding.display, "No") - self.assertEqual(inst.item[2].item[9].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[9].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54122-7") - self.assertEqual(inst.item[2].item[9].item[0].item[5].linkId, "2.1.1.6") - self.assertEqual(inst.item[2].item[9].item[0].item[5].text, "Was this person adopted?") - self.assertEqual(inst.item[2].item[9].item[0].linkId, "2.1.1") - 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-gcs.json") - self.assertIsNotNone(inst, "Must have instantiated a QuestionnaireResponse instance") - self.implQuestionnaireResponse5(inst) - - js = inst.as_json() - self.assertEqual("QuestionnaireResponse", js["resourceType"]) - inst2 = questionnaireresponse.QuestionnaireResponse(js) - self.implQuestionnaireResponse5(inst2) - - def implQuestionnaireResponse5(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/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 deleted file mode 100644 index 0118d0749..000000000 --- a/fhirclient/models/range.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Range) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import element - -class Range(element.Element): - """ Set of values bounded by low and high. - - A set of ordered Quantities defined by a low and high limit. - """ - - resource_type = "Range" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.high = None - """ High limit. - Type `Quantity` (represented as `dict` in JSON). """ - - self.low = None - """ Low limit. - Type `Quantity` (represented as `dict` in JSON). """ - - super(Range, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Range, self).elementProperties() - js.extend([ - ("high", "high", quantity.Quantity, False, None, False), - ("low", "low", quantity.Quantity, False, None, False), - ]) - return js - - -import sys -try: - from . import quantity -except ImportError: - quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/ratio.py b/fhirclient/models/ratio.py deleted file mode 100644 index 277570a87..000000000 --- a/fhirclient/models/ratio.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Ratio) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import element - -class Ratio(element.Element): - """ A ratio of two Quantity values - a numerator and a denominator. - - A relationship of two Quantity values - expressed as a numerator and a - denominator. - """ - - resource_type = "Ratio" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.denominator = None - """ Denominator value. - Type `Quantity` (represented as `dict` in JSON). """ - - self.numerator = None - """ Numerator value. - Type `Quantity` (represented as `dict` in JSON). """ - - super(Ratio, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Ratio, self).elementProperties() - js.extend([ - ("denominator", "denominator", quantity.Quantity, False, None, False), - ("numerator", "numerator", quantity.Quantity, False, None, False), - ]) - return js - - -import sys -try: - from . import quantity -except ImportError: - quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/reference.py b/fhirclient/models/reference.py deleted file mode 100644 index c9a93374e..000000000 --- a/fhirclient/models/reference.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Reference) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import element - -class Reference(element.Element): - """ A reference from one resource to another. - """ - - resource_type = "Reference" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.display = None - """ Text alternative for the resource. - Type `str`. """ - - self.identifier = None - """ Logical reference, when literal reference is not known. - Type `Identifier` (represented as `dict` in JSON). """ - - self.reference = None - """ 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): - js = super(Reference, self).elementProperties() - js.extend([ - ("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 - - -import sys -try: - from . import identifier -except ImportError: - identifier = sys.modules[__package__ + '.identifier'] diff --git a/fhirclient/models/relatedartifact.py b/fhirclient/models/relatedartifact.py deleted file mode 100644 index 5c0fb219c..000000000 --- a/fhirclient/models/relatedartifact.py +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/RelatedArtifact) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import element - -class RelatedArtifact(element.Element): - """ Related artifacts for a knowledge resource. - - Related artifacts such as additional documentation, justification, or - bibliographic references. - """ - - resource_type = "RelatedArtifact" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.citation = None - """ Bibliographic citation for the artifact. - Type `str`. """ - - self.display = None - """ Brief description of the related artifact. - Type `str`. """ - - self.document = None - """ 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 `str`. """ - - self.type = None - """ documentation | justification | citation | predecessor | successor - | derived-from | depends-on | composed-of. - Type `str`. """ - - self.url = None - """ Where the artifact can be accessed. - Type `str`. """ - - super(RelatedArtifact, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(RelatedArtifact, self).elementProperties() - js.extend([ - ("citation", "citation", str, False, None, False), - ("display", "display", str, False, None, False), - ("document", "document", attachment.Attachment, 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), - ]) - return js - - -import sys -try: - from . import attachment -except ImportError: - attachment = sys.modules[__package__ + '.attachment'] diff --git a/fhirclient/models/relatedperson.py b/fhirclient/models/relatedperson.py deleted file mode 100644 index cb37a0b02..000000000 --- a/fhirclient/models/relatedperson.py +++ /dev/null @@ -1,171 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# 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): - """ 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 - who is not the target of healthcare, nor has a formal responsibility in the - care process. - """ - - resource_type = "RelatedPerson" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 related person's record is in active use. - Type `bool`. """ - - self.address = None - """ Address where the related person can be contacted or visited. - List of `Address` items (represented as `dict` in JSON). """ - - self.birthDate = None - """ 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`. """ - - self.identifier = None - """ A human identifier for this person. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.name = None - """ A name associated with the person. - List of `HumanName` items (represented as `dict` in JSON). """ - - self.patient = None - """ The patient this person is related to. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.period = None - """ Period of time that this relationship is considered valid. - Type `Period` (represented as `dict` in JSON). """ - - self.photo = None - """ Image of the person. - List of `Attachment` items (represented as `dict` in JSON). """ - - self.relationship = None - """ The nature of the relationship. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.telecom = None - """ A contact detail for the person. - List of `ContactPoint` items (represented as `dict` in JSON). """ - - super(RelatedPerson, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(RelatedPerson, self).elementProperties() - js.extend([ - ("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, 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 -except ImportError: - address = sys.modules[__package__ + '.address'] -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 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: - 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 period -except ImportError: - period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/relatedperson_tests.py b/fhirclient/models/relatedperson_tests.py deleted file mode 100644 index 55546bba6..000000000 --- a/fhirclient/models/relatedperson_tests.py +++ /dev/null @@ -1,195 +0,0 @@ -#!/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 relatedperson -from .fhirdate import FHIRDate - - -class RelatedPersonTests(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("RelatedPerson", js["resourceType"]) - return relatedperson.RelatedPerson(js) - - def testRelatedPerson1(self): - inst = self.instantiate_from("relatedperson-example-peter.json") - self.assertIsNotNone(inst, "Must have instantiated a RelatedPerson instance") - self.implRelatedPerson1(inst) - - js = inst.as_json() - self.assertEqual("RelatedPerson", js["resourceType"]) - inst2 = relatedperson.RelatedPerson(js) - self.implRelatedPerson1(inst2) - - def implRelatedPerson1(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.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, "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-f001-sarah.json") - self.assertIsNotNone(inst, "Must have instantiated a RelatedPerson instance") - self.implRelatedPerson2(inst) - - js = inst.as_json() - self.assertEqual("RelatedPerson", js["resourceType"]) - inst2 = relatedperson.RelatedPerson(js) - self.implRelatedPerson2(inst2) - - def implRelatedPerson2(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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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.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, "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-newborn-mom.json") - self.assertIsNotNone(inst, "Must have instantiated a RelatedPerson instance") - self.implRelatedPerson3(inst) - - js = inst.as_json() - self.assertEqual("RelatedPerson", js["resourceType"]) - inst2 = relatedperson.RelatedPerson(js) - self.implRelatedPerson3(inst2) - - def implRelatedPerson3(self, inst): - self.assertTrue(inst.active) - self.assertEqual(inst.address[0].line[0], "2222 Home Street") - self.assertEqual(inst.address[0].use, "home") - 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.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, "555-555-2003") - self.assertEqual(inst.text.status, "generated") - - def testRelatedPerson4(self): - inst = self.instantiate_from("relatedperson-example.json") - self.assertIsNotNone(inst, "Must have instantiated a RelatedPerson instance") - self.implRelatedPerson4(inst) - - js = inst.as_json() - self.assertEqual("RelatedPerson", js["resourceType"]) - inst2 = relatedperson.RelatedPerson(js) - self.implRelatedPerson4(inst2) - - def implRelatedPerson4(self, inst): - self.assertTrue(inst.active) - self.assertEqual(inst.address[0].city, "Paris") - self.assertEqual(inst.address[0].country, "FRA") - self.assertEqual(inst.address[0].line[0], "43, Place du Marché Sainte Catherine") - self.assertEqual(inst.address[0].postalCode, "75004") - self.assertEqual(inst.gender, "female") - self.assertEqual(inst.id, "benedicte") - self.assertEqual(inst.identifier[0].system, "urn:oid:1.2.250.1.61") - 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[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 deleted file mode 100644 index 1ebe7039c..000000000 --- a/fhirclient/models/requestgroup.py +++ /dev/null @@ -1,406 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/RequestGroup) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class RequestGroup(domainresource.DomainResource): - """ A group of related requests. - - A group of related requests that can be used to capture intended activities - that have inter-dependencies such as "give this medication after that one". - """ - - resource_type = "RequestGroup" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Proposed actions, if any. - List of `RequestGroupAction` items (represented as `dict` in JSON). """ - - self.author = None - """ Device or practitioner that authored the request group. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.authoredOn = None - """ When the request group was authored. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.basedOn = None - """ Fulfills plan, proposal, or order. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.code = None - """ What's being requested/ordered. - Type `CodeableConcept` (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. - Type `Identifier` (represented as `dict` in JSON). """ - - self.identifier = None - """ 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`. """ - - self.note = None - """ Additional notes about the response. - List of `Annotation` items (represented as `dict` in JSON). """ - - self.priority = None - """ routine | urgent | asap | stat. - Type `str`. """ - - self.reasonCode = None - """ Why the request group is needed. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.reasonReference = None - """ 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 (represented as `dict` in JSON). """ - - self.status = None - """ draft | active | suspended | cancelled | completed | entered-in- - error | unknown. - Type `str`. """ - - self.subject = None - """ Who the request group is about. - Type `FHIRReference` (represented as `dict` in JSON). """ - - super(RequestGroup, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(RequestGroup, self).elementProperties() - js.extend([ - ("action", "action", RequestGroupAction, True, None, False), - ("author", "author", fhirreference.FHIRReference, False, None, False), - ("authoredOn", "authoredOn", fhirdate.FHIRDate, False, None, False), - ("basedOn", "basedOn", 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), - ("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), - ]) - return js - - -from . import backboneelement - -class RequestGroupAction(backboneelement.BackboneElement): - """ Proposed actions, if any. - - The actions, if any, produced by the evaluation of the artifact. - """ - - resource_type = "RequestGroupAction" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Sub action. - List of `RequestGroupAction` items (represented as `dict` in JSON). """ - - self.cardinalityBehavior = None - """ single | multiple. - Type `str`. """ - - self.code = None - """ Code representing the meaning of the action or sub-actions. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.condition = None - """ Whether or not the action is applicable. - List of `RequestGroupActionCondition` items (represented as `dict` in JSON). """ - - self.description = None - """ Short description of the action. - Type `str`. """ - - self.documentation = None - """ Supporting documentation for the intended performer of the action. - List of `RelatedArtifact` items (represented as `dict` in JSON). """ - - self.groupingBehavior = None - """ visual-group | logical-group | sentence-group. - Type `str`. """ - - self.participant = None - """ Who should perform the action. - 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). """ - - self.requiredBehavior = None - """ must | could | must-unless-documented. - Type `str`. """ - - self.resource = None - """ The target of the action. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.selectionBehavior = None - """ any | all | all-or-none | exactly-one | at-most-one | one-or-more. - Type `str`. """ - - 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). """ - - self.timingDuration = None - """ When the action should take place. - Type `Duration` (represented as `dict` in JSON). """ - - self.timingPeriod = None - """ When the action should take place. - Type `Period` (represented as `dict` in JSON). """ - - self.timingRange = None - """ When the action should take place. - Type `Range` (represented as `dict` in JSON). """ - - self.timingTiming = None - """ When the action should take place. - Type `Timing` (represented as `dict` in JSON). """ - - self.title = None - """ User-visible title. - Type `str`. """ - - self.type = None - """ create | update | remove | fire-event. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(RequestGroupAction, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(RequestGroupAction, self).elementProperties() - js.extend([ - ("action", "action", RequestGroupAction, True, None, False), - ("cardinalityBehavior", "cardinalityBehavior", str, False, None, False), - ("code", "code", codeableconcept.CodeableConcept, True, None, False), - ("condition", "condition", RequestGroupActionCondition, True, None, False), - ("description", "description", str, False, None, False), - ("documentation", "documentation", relatedartifact.RelatedArtifact, True, None, False), - ("groupingBehavior", "groupingBehavior", 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", codeableconcept.CodeableConcept, False, None, False), - ]) - return js - - -class RequestGroupActionCondition(backboneelement.BackboneElement): - """ Whether or not the action is applicable. - - An expression that describes applicability criteria, or start/stop - conditions for the action. - """ - - resource_type = "RequestGroupActionCondition" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Boolean-valued expression. - Type `Expression` (represented as `dict` in JSON). """ - - self.kind = None - """ applicability | start | stop. - Type `str`. """ - - super(RequestGroupActionCondition, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(RequestGroupActionCondition, self).elementProperties() - js.extend([ - ("expression", "expression", expression.Expression, False, None, False), - ("kind", "kind", str, False, None, True), - ]) - return js - - -class RequestGroupActionRelatedAction(backboneelement.BackboneElement): - """ Relationship to another action. - - A relationship to another action such as "before" or "30-60 minutes after - start of". - """ - - resource_type = "RequestGroupActionRelatedAction" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.actionId = None - """ What action this is related to. - Type `str`. """ - - self.offsetDuration = None - """ Time offset for the relationship. - Type `Duration` (represented as `dict` in JSON). """ - - self.offsetRange = None - """ Time offset for the relationship. - Type `Range` (represented as `dict` in JSON). """ - - self.relationship = None - """ before-start | before | before-end | concurrent-with-start | - concurrent | concurrent-with-end | after-start | after | after-end. - Type `str`. """ - - super(RequestGroupActionRelatedAction, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(RequestGroupActionRelatedAction, self).elementProperties() - js.extend([ - ("actionId", "actionId", str, False, None, True), - ("offsetDuration", "offsetDuration", duration.Duration, False, "offset", False), - ("offsetRange", "offsetRange", range.Range, False, "offset", False), - ("relationship", "relationship", str, False, None, True), - ]) - return js - - -import sys -try: - from . import age -except ImportError: - age = sys.modules[__package__ + '.age'] -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 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 range -except ImportError: - range = sys.modules[__package__ + '.range'] -try: - from . import relatedartifact -except ImportError: - relatedartifact = sys.modules[__package__ + '.relatedartifact'] -try: - from . import timing -except ImportError: - timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/requestgroup_tests.py b/fhirclient/models/requestgroup_tests.py deleted file mode 100644 index 32585934b..000000000 --- a/fhirclient/models/requestgroup_tests.py +++ /dev/null @@ -1,124 +0,0 @@ -#!/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 requestgroup -from .fhirdate import FHIRDate - - -class RequestGroupTests(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("RequestGroup", js["resourceType"]) - return requestgroup.RequestGroup(js) - - def testRequestGroup1(self): - inst = self.instantiate_from("requestgroup-kdn5-example.json") - self.assertIsNotNone(inst, "Must have instantiated a RequestGroup instance") - self.implRequestGroup1(inst) - - js = inst.as_json() - self.assertEqual("RequestGroup", js["resourceType"]) - inst2 = requestgroup.RequestGroup(js) - self.implRequestGroup1(inst2) - - def implRequestGroup1(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") - self.assertEqual(inst.action[0].action[0].action[0].action[0].action[0].extension[0].extension[1].valueInteger, 8) - 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].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") - self.assertEqual(inst.action[0].action[0].action[0].action[0].action[1].id, "action-2") - self.assertEqual(inst.action[0].action[0].action[0].action[0].action[1].relatedAction[0].actionId, "action-1") - self.assertEqual(inst.action[0].action[0].action[0].action[0].action[1].relatedAction[0].relationship, "concurrent-with-start") - self.assertEqual(inst.action[0].action[0].action[0].action[0].action[1].textEquivalent, "CARBOplatin AUC 5 IV over 30 minutes on Day 1") - self.assertEqual(inst.action[0].action[0].action[0].action[0].id, "cycle-definition-1") - self.assertEqual(inst.action[0].action[0].action[0].action[0].textEquivalent, "21-day cycle for 6 cycles") - self.assertEqual(inst.action[0].action[0].action[0].action[0].timingTiming.repeat.count, 6) - self.assertEqual(inst.action[0].action[0].action[0].action[0].timingTiming.repeat.duration, 21) - self.assertEqual(inst.action[0].action[0].action[0].action[0].timingTiming.repeat.durationUnit, "d") - self.assertEqual(inst.action[0].action[0].action[0].groupingBehavior, "sentence-group") - self.assertEqual(inst.action[0].action[0].action[0].selectionBehavior, "exactly-one") - self.assertEqual(inst.action[0].action[0].selectionBehavior, "all") - self.assertEqual(inst.action[0].selectionBehavior, "exactly-one") - 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, "1111") - 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/researchstudy.py b/fhirclient/models/researchstudy.py deleted file mode 100644 index 92aba893b..000000000 --- a/fhirclient/models/researchstudy.py +++ /dev/null @@ -1,275 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ResearchStudy) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class ResearchStudy(domainresource.DomainResource): - """ Investigation to increase healthcare-related patient-independent knowledge. - - 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. - """ - - resource_type = "ResearchStudy" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.arm = None - """ Defined path through the study for a subject. - List of `ResearchStudyArm` items (represented as `dict` in JSON). """ - - self.category = None - """ 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). """ - - self.description = None - """ What this is study doing. - Type `str`. """ - - self.enrollment = None - """ Inclusion & exclusion criteria. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.focus = None - """ 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.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 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 (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 - """ 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 (represented as `dict` in JSON). """ - - self.reasonStopped = None - """ 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 - """ References and dependencies. - List of `RelatedArtifact` items (represented as `dict` in JSON). """ - - self.site = None - """ Facility where study activities are conducted. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.sponsor = None - """ Organization that initiates and is legally responsible for the - study. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.status = None - """ 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 - """ Name for this study. - Type `str`. """ - - super(ResearchStudy, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ResearchStudy, self).elementProperties() - 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), - ("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), - ("relatedArtifact", "relatedArtifact", relatedartifact.RelatedArtifact, True, None, False), - ("site", "site", fhirreference.FHIRReference, True, None, False), - ("sponsor", "sponsor", fhirreference.FHIRReference, False, None, False), - ("status", "status", str, False, None, True), - ("title", "title", str, False, None, False), - ]) - return js - - -from . import backboneelement - -class ResearchStudyArm(backboneelement.BackboneElement): - """ Defined path through the study for a subject. - - Describes an expected sequence of events for one of the participants of a - study. E.g. Exposure to drug A, wash-out, exposure to drug B, wash-out, - follow-up. - """ - - resource_type = "ResearchStudyArm" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Short explanation of study path. - Type `str`. """ - - self.name = None - """ 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([ - ("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 - - -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 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'] diff --git a/fhirclient/models/researchstudy_tests.py b/fhirclient/models/researchstudy_tests.py deleted file mode 100644 index df674f516..000000000 --- a/fhirclient/models/researchstudy_tests.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/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 researchstudy -from .fhirdate import FHIRDate - - -class ResearchStudyTests(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("ResearchStudy", js["resourceType"]) - return researchstudy.ResearchStudy(js) - - def testResearchStudy1(self): - inst = self.instantiate_from("researchstudy-example.json") - self.assertIsNotNone(inst, "Must have instantiated a ResearchStudy instance") - self.implResearchStudy1(inst) - - js = inst.as_json() - self.assertEqual("ResearchStudy", js["resourceType"]) - inst2 = researchstudy.ResearchStudy(js) - self.implResearchStudy1(inst2) - - def implResearchStudy1(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, "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 deleted file mode 100644 index ffa51d163..000000000 --- a/fhirclient/models/researchsubject.py +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# 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): - """ Physical entity which is the primary unit of interest in the study. - - A physical entity which is the primary unit of operational and/or - administrative interest in a study. - """ - - resource_type = "ResearchSubject" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.actualArm = None - """ What path was followed. - Type `str`. """ - - self.assignedArm = None - """ What path should be followed. - Type `str`. """ - - self.consent = None - """ Agreement to participate in study. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.identifier = None - """ 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` (represented as `dict` in JSON). """ - - self.period = None - """ Start and end of participation. - Type `Period` (represented as `dict` in JSON). """ - - self.status = None - """ 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` (represented as `dict` in JSON). """ - - super(ResearchSubject, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ResearchSubject, self).elementProperties() - js.extend([ - ("actualArm", "actualArm", str, False, None, False), - ("assignedArm", "assignedArm", str, False, None, False), - ("consent", "consent", fhirreference.FHIRReference, 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), - ("study", "study", fhirreference.FHIRReference, False, None, True), - ]) - return js - - -import sys -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/researchsubject_tests.py b/fhirclient/models/researchsubject_tests.py deleted file mode 100644 index 6477f4926..000000000 --- a/fhirclient/models/researchsubject_tests.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/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 researchsubject -from .fhirdate import FHIRDate - - -class ResearchSubjectTests(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("ResearchSubject", js["resourceType"]) - return researchsubject.ResearchSubject(js) - - def testResearchSubject1(self): - inst = self.instantiate_from("researchsubject-example.json") - self.assertIsNotNone(inst, "Must have instantiated a ResearchSubject instance") - self.implResearchSubject1(inst) - - js = inst.as_json() - self.assertEqual("ResearchSubject", js["resourceType"]) - inst2 = researchsubject.ResearchSubject(js) - self.implResearchSubject1(inst2) - - def implResearchSubject1(self, inst): - self.assertEqual(inst.id, "example") - 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 deleted file mode 100644 index 04652dc85..000000000 --- a/fhirclient/models/resource.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Resource) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import fhirabstractresource - -class Resource(fhirabstractresource.FHIRAbstractResource): - """ Base Resource. - - This is the base resource type for everything. - """ - - resource_type = "Resource" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.id = None - """ Logical id of this artifact. - Type `str`. """ - - self.implicitRules = None - """ A set of rules under which this content was created. - Type `str`. """ - - self.language = None - """ Language of the resource content. - Type `str`. """ - - self.meta = None - """ Metadata about the resource. - Type `Meta` (represented as `dict` in JSON). """ - - super(Resource, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Resource, self).elementProperties() - js.extend([ - ("id", "id", str, False, None, False), - ("implicitRules", "implicitRules", str, False, None, False), - ("language", "language", str, False, None, False), - ("meta", "meta", meta.Meta, False, None, False), - ]) - return js - - -import sys -try: - from . import meta -except ImportError: - meta = sys.modules[__package__ + '.meta'] diff --git a/fhirclient/models/riskassessment.py b/fhirclient/models/riskassessment.py deleted file mode 100644 index 3c7283f1d..000000000 --- a/fhirclient/models/riskassessment.py +++ /dev/null @@ -1,221 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/RiskAssessment) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class RiskAssessment(domainresource.DomainResource): - """ Potential outcomes for a subject with likelihood. - - An assessment of the likely outcome(s) for a patient or other subject as - well as the likelihood of each outcome. - """ - - resource_type = "RiskAssessment" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.basedOn = None - """ Request fulfilled by this assessment. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.basis = None - """ Information used in assessment. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.code = None - """ Type of assessment. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.condition = None - """ Condition assessed. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.encounter = None - """ Where was assessment performed?. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.identifier = None - """ Unique identifier for the assessment. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.method = None - """ Evaluation mechanism. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.mitigation = None - """ 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). """ - - self.occurrencePeriod = None - """ When was assessment made?. - Type `Period` (represented as `dict` in JSON). """ - - self.parent = None - """ Part of this occurrence. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.performer = None - """ Who did assessment?. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.prediction = None - """ Outcome predicted. - List of `RiskAssessmentPrediction` items (represented as `dict` in JSON). """ - - self.reasonCode = None - """ Why the assessment was necessary?. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.reasonReference = None - """ Why the assessment was necessary?. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.status = None - """ registered | preliminary | final | amended +. - Type `str`. """ - - self.subject = None - """ Who/what does assessment apply to?. - Type `FHIRReference` (represented as `dict` in JSON). """ - - super(RiskAssessment, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(RiskAssessment, self).elementProperties() - js.extend([ - ("basedOn", "basedOn", fhirreference.FHIRReference, False, None, False), - ("basis", "basis", fhirreference.FHIRReference, True, None, False), - ("code", "code", codeableconcept.CodeableConcept, False, None, False), - ("condition", "condition", fhirreference.FHIRReference, 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), - ("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, True), - ]) - return js - - -from . import backboneelement - -class RiskAssessmentPrediction(backboneelement.BackboneElement): - """ Outcome predicted. - - Describes the expected outcome for the subject. - """ - - resource_type = "RiskAssessmentPrediction" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.outcome = None - """ Possible outcome for the subject. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.probabilityDecimal = None - """ Likelihood of specified outcome. - Type `float`. """ - - self.probabilityRange = None - """ Likelihood of specified outcome. - Type `Range` (represented as `dict` in JSON). """ - - self.qualitativeRisk = None - """ Likelihood of specified outcome as a qualitative value. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.rationale = None - """ Explanation of prediction. - Type `str`. """ - - self.relativeRisk = None - """ Relative likelihood. - Type `float`. """ - - self.whenPeriod = None - """ Timeframe or age range. - Type `Period` (represented as `dict` in JSON). """ - - self.whenRange = None - """ Timeframe or age range. - Type `Range` (represented as `dict` in JSON). """ - - super(RiskAssessmentPrediction, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(RiskAssessmentPrediction, self).elementProperties() - js.extend([ - ("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), - ("rationale", "rationale", str, False, None, False), - ("relativeRisk", "relativeRisk", float, False, None, False), - ("whenPeriod", "whenPeriod", period.Period, False, "when", False), - ("whenRange", "whenRange", range.Range, False, "when", 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'] -try: - from . import range -except ImportError: - range = sys.modules[__package__ + '.range'] diff --git a/fhirclient/models/riskassessment_tests.py b/fhirclient/models/riskassessment_tests.py deleted file mode 100644 index 28c50b6e4..000000000 --- a/fhirclient/models/riskassessment_tests.py +++ /dev/null @@ -1,225 +0,0 @@ -#!/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 riskassessment -from .fhirdate import FHIRDate - - -class RiskAssessmentTests(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("RiskAssessment", js["resourceType"]) - return riskassessment.RiskAssessment(js) - - def testRiskAssessment1(self): - inst = self.instantiate_from("riskassessment-example-population.json") - self.assertIsNotNone(inst, "Must have instantiated a RiskAssessment instance") - self.implRiskAssessment1(inst) - - js = inst.as_json() - self.assertEqual("RiskAssessment", js["resourceType"]) - inst2 = riskassessment.RiskAssessment(js) - 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[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") - self.assertEqual(inst.prediction[0].probabilityDecimal, 0.02) - self.assertEqual(inst.prediction[0].whenRange.high.code, "a") - self.assertEqual(inst.prediction[0].whenRange.high.system, "http://unitsofmeasure.org") - self.assertEqual(inst.prediction[0].whenRange.high.unit, "years") - self.assertEqual(inst.prediction[0].whenRange.high.value, 49) - self.assertEqual(inst.prediction[0].whenRange.low.code, "a") - self.assertEqual(inst.prediction[0].whenRange.low.system, "http://unitsofmeasure.org") - self.assertEqual(inst.prediction[0].whenRange.low.unit, "years") - self.assertEqual(inst.prediction[0].whenRange.low.value, 39) - self.assertEqual(inst.status, "final") - self.assertEqual(inst.text.status, "additional") - - def testRiskAssessment3(self): - inst = self.instantiate_from("riskassessment-example.json") - self.assertIsNotNone(inst, "Must have instantiated a RiskAssessment instance") - self.implRiskAssessment3(inst) - - js = inst.as_json() - self.assertEqual("RiskAssessment", js["resourceType"]) - inst2 = riskassessment.RiskAssessment(js) - self.implRiskAssessment3(inst2) - - def implRiskAssessment3(self, inst): - 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") - self.assertEqual(inst.prediction[0].probabilityDecimal, 0.000168) - self.assertEqual(inst.prediction[0].whenRange.high.code, "a") - self.assertEqual(inst.prediction[0].whenRange.high.system, "http://unitsofmeasure.org") - self.assertEqual(inst.prediction[0].whenRange.high.unit, "years") - self.assertEqual(inst.prediction[0].whenRange.high.value, 53) - self.assertEqual(inst.prediction[1].outcome.text, "Breast Cancer") - self.assertEqual(inst.prediction[1].probabilityDecimal, 0.000368) - self.assertEqual(inst.prediction[1].whenRange.high.code, "a") - self.assertEqual(inst.prediction[1].whenRange.high.system, "http://unitsofmeasure.org") - self.assertEqual(inst.prediction[1].whenRange.high.unit, "years") - self.assertEqual(inst.prediction[1].whenRange.high.value, 57) - self.assertEqual(inst.prediction[1].whenRange.low.code, "a") - self.assertEqual(inst.prediction[1].whenRange.low.system, "http://unitsofmeasure.org") - self.assertEqual(inst.prediction[1].whenRange.low.unit, "years") - self.assertEqual(inst.prediction[1].whenRange.low.value, 54) - self.assertEqual(inst.prediction[2].outcome.text, "Breast Cancer") - self.assertEqual(inst.prediction[2].probabilityDecimal, 0.000594) - self.assertEqual(inst.prediction[2].whenRange.high.code, "a") - self.assertEqual(inst.prediction[2].whenRange.high.system, "http://unitsofmeasure.org") - self.assertEqual(inst.prediction[2].whenRange.high.unit, "years") - self.assertEqual(inst.prediction[2].whenRange.high.value, 62) - self.assertEqual(inst.prediction[2].whenRange.low.code, "a") - self.assertEqual(inst.prediction[2].whenRange.low.system, "http://unitsofmeasure.org") - self.assertEqual(inst.prediction[2].whenRange.low.unit, "years") - self.assertEqual(inst.prediction[2].whenRange.low.value, 58) - self.assertEqual(inst.prediction[3].outcome.text, "Breast Cancer") - self.assertEqual(inst.prediction[3].probabilityDecimal, 0.000838) - self.assertEqual(inst.prediction[3].whenRange.high.code, "a") - self.assertEqual(inst.prediction[3].whenRange.high.system, "http://unitsofmeasure.org") - self.assertEqual(inst.prediction[3].whenRange.high.unit, "years") - self.assertEqual(inst.prediction[3].whenRange.high.value, 67) - self.assertEqual(inst.prediction[3].whenRange.low.code, "a") - self.assertEqual(inst.prediction[3].whenRange.low.system, "http://unitsofmeasure.org") - self.assertEqual(inst.prediction[3].whenRange.low.unit, "years") - self.assertEqual(inst.prediction[3].whenRange.low.value, 63) - self.assertEqual(inst.prediction[4].outcome.text, "Breast Cancer") - self.assertEqual(inst.prediction[4].probabilityDecimal, 0.001089) - self.assertEqual(inst.prediction[4].whenRange.high.code, "a") - self.assertEqual(inst.prediction[4].whenRange.high.system, "http://unitsofmeasure.org") - self.assertEqual(inst.prediction[4].whenRange.high.unit, "years") - self.assertEqual(inst.prediction[4].whenRange.high.value, 72) - self.assertEqual(inst.prediction[4].whenRange.low.code, "a") - self.assertEqual(inst.prediction[4].whenRange.low.system, "http://unitsofmeasure.org") - self.assertEqual(inst.prediction[4].whenRange.low.unit, "years") - self.assertEqual(inst.prediction[4].whenRange.low.value, 68) - self.assertEqual(inst.prediction[5].outcome.text, "Breast Cancer") - self.assertEqual(inst.prediction[5].probabilityDecimal, 0.001327) - self.assertEqual(inst.prediction[5].whenRange.high.code, "a") - self.assertEqual(inst.prediction[5].whenRange.high.system, "http://unitsofmeasure.org") - self.assertEqual(inst.prediction[5].whenRange.high.unit, "years") - self.assertEqual(inst.prediction[5].whenRange.high.value, 77) - self.assertEqual(inst.prediction[5].whenRange.low.code, "a") - self.assertEqual(inst.prediction[5].whenRange.low.system, "http://unitsofmeasure.org") - self.assertEqual(inst.prediction[5].whenRange.low.unit, "years") - self.assertEqual(inst.prediction[5].whenRange.low.value, 73) - self.assertEqual(inst.prediction[6].outcome.text, "Breast Cancer") - self.assertEqual(inst.prediction[6].probabilityDecimal, 0.00153) - self.assertEqual(inst.prediction[6].whenRange.high.code, "a") - self.assertEqual(inst.prediction[6].whenRange.high.system, "http://unitsofmeasure.org") - self.assertEqual(inst.prediction[6].whenRange.high.unit, "years") - self.assertEqual(inst.prediction[6].whenRange.high.value, 82) - self.assertEqual(inst.prediction[6].whenRange.low.code, "a") - self.assertEqual(inst.prediction[6].whenRange.low.system, "http://unitsofmeasure.org") - self.assertEqual(inst.prediction[6].whenRange.low.unit, "years") - self.assertEqual(inst.prediction[6].whenRange.low.value, 78) - self.assertEqual(inst.prediction[7].outcome.text, "Breast Cancer") - self.assertEqual(inst.prediction[7].probabilityDecimal, 0.001663) - self.assertEqual(inst.prediction[7].whenRange.high.code, "a") - self.assertEqual(inst.prediction[7].whenRange.high.system, "http://unitsofmeasure.org") - self.assertEqual(inst.prediction[7].whenRange.high.unit, "years") - self.assertEqual(inst.prediction[7].whenRange.high.value, 88) - self.assertEqual(inst.prediction[7].whenRange.low.code, "a") - self.assertEqual(inst.prediction[7].whenRange.low.system, "http://unitsofmeasure.org") - self.assertEqual(inst.prediction[7].whenRange.low.unit, "years") - 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/sampleddata.py b/fhirclient/models/sampleddata.py deleted file mode 100644 index d716ee69e..000000000 --- a/fhirclient/models/sampleddata.py +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SampledData) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import element - -class SampledData(element.Element): - """ A series of measurements taken by a device. - - A series of measurements taken by a device, with upper and lower limits. - There may be more than one dimension in the data. - """ - - resource_type = "SampledData" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.data = None - """ Decimal values with spaces, or "E" | "U" | "L". - Type `str`. """ - - self.dimensions = None - """ Number of sample points at each time point. - Type `int`. """ - - self.factor = None - """ Multiply data by this before adding to origin. - Type `float`. """ - - self.lowerLimit = None - """ Lower limit of detection. - Type `float`. """ - - self.origin = None - """ Zero value and units. - Type `Quantity` (represented as `dict` in JSON). """ - - self.period = None - """ Number of milliseconds between samples. - Type `float`. """ - - self.upperLimit = None - """ Upper limit of detection. - Type `float`. """ - - super(SampledData, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(SampledData, self).elementProperties() - js.extend([ - ("data", "data", str, False, None, False), - ("dimensions", "dimensions", int, False, None, True), - ("factor", "factor", float, False, None, False), - ("lowerLimit", "lowerLimit", float, False, None, False), - ("origin", "origin", quantity.Quantity, False, None, True), - ("period", "period", float, False, None, True), - ("upperLimit", "upperLimit", float, False, None, False), - ]) - return js - - -import sys -try: - from . import quantity -except ImportError: - quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/schedule.py b/fhirclient/models/schedule.py deleted file mode 100644 index 9085ff750..000000000 --- a/fhirclient/models/schedule.py +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Schedule) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class Schedule(domainresource.DomainResource): - """ A container for slots of time that may be available for booking - appointments. - """ - - resource_type = "Schedule" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 schedule is in active use. - Type `bool`. """ - - self.actor = None - """ Resource(s) that availability information is being provided for. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.comment = None - """ Comments on availability. - Type `str`. """ - - self.identifier = None - """ External Ids for this item. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.planningHorizon = None - """ Period of time covered by schedule. - Type `Period` (represented as `dict` in JSON). """ - - self.serviceCategory = None - """ High-level category. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.serviceType = None - """ Specific service. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.specialty = None - """ Type of specialty needed. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - super(Schedule, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Schedule, self).elementProperties() - js.extend([ - ("active", "active", bool, False, None, False), - ("actor", "actor", fhirreference.FHIRReference, True, None, True), - ("comment", "comment", str, False, None, False), - ("identifier", "identifier", identifier.Identifier, True, None, False), - ("planningHorizon", "planningHorizon", period.Period, False, None, False), - ("serviceCategory", "serviceCategory", codeableconcept.CodeableConcept, True, None, False), - ("serviceType", "serviceType", codeableconcept.CodeableConcept, True, None, False), - ("specialty", "specialty", codeableconcept.CodeableConcept, 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 period -except ImportError: - period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/schedule_tests.py b/fhirclient/models/schedule_tests.py deleted file mode 100644 index 258487fc2..000000000 --- a/fhirclient/models/schedule_tests.py +++ /dev/null @@ -1,119 +0,0 @@ -#!/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 schedule -from .fhirdate import FHIRDate - - -class ScheduleTests(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("Schedule", js["resourceType"]) - return schedule.Schedule(js) - - def testSchedule1(self): - inst = self.instantiate_from("schedule-provider-location1-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Schedule instance") - self.implSchedule1(inst) - - js = inst.as_json() - self.assertEqual("Schedule", js["resourceType"]) - inst2 = schedule.Schedule(js) - self.implSchedule1(inst2) - - def implSchedule1(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.identifier[0].system, "http://example.org/scheduleid") - self.assertEqual(inst.identifier[0].use, "usual") - 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-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Schedule instance") - self.implSchedule2(inst) - - js = inst.as_json() - self.assertEqual("Schedule", js["resourceType"]) - inst2 = schedule.Schedule(js) - self.implSchedule2(inst2) - - def implSchedule2(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.identifier[0].system, "http://example.org/scheduleid") - self.assertEqual(inst.identifier[0].use, "usual") - 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): - inst = self.instantiate_from("schedule-provider-location2-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Schedule instance") - self.implSchedule3(inst) - - js = inst.as_json() - self.assertEqual("Schedule", js["resourceType"]) - inst2 = schedule.Schedule(js) - self.implSchedule3(inst2) - - def implSchedule3(self, inst): - self.assertTrue(inst.active) - self.assertEqual(inst.comment, "The slots attached to this schedule are for neurosurgery operations at Starfleet HQ only.") - self.assertEqual(inst.id, "exampleloc2") - 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[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") - self.assertEqual(inst.specialty[0].coding[0].display, "Surgery-Neurosurgery") - self.assertEqual(inst.text.status, "generated") - diff --git a/fhirclient/models/searchparameter.py b/fhirclient/models/searchparameter.py deleted file mode 100644 index b638eb571..000000000 --- a/fhirclient/models/searchparameter.py +++ /dev/null @@ -1,222 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# 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. - - A search parameter that defines a named search item that can be used to - search/filter on a resource. - """ - - resource_type = "SearchParameter" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.base = None - """ The resource type(s) this search parameter applies to. - List of `str` items. """ - - self.chain = None - """ Chained names supported. - List of `str` items. """ - - self.code = None - """ Code used in URL. - Type `str`. """ - - self.comparator = None - """ eq | ne | gt | lt | ge | le | sa | eb | ap. - List of `str` items. """ - - self.component = None - """ For Composite resources to define the parts. - List of `SearchParameterComponent` items (represented as `dict` in JSON). """ - - self.contact = None - """ Contact details for the publisher. - List of `ContactDetail` items (represented as `dict` in JSON). """ - - self.date = None - """ Date last changed. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.derivedFrom = None - """ Original definition for the search parameter. - Type `str`. """ - - self.description = None - """ Natural language description of the search parameter. - Type `str`. """ - - self.experimental = None - """ For testing purposes, not real usage. - Type `bool`. """ - - self.expression = None - """ FHIRPath expression that extracts the values. - Type `str`. """ - - self.jurisdiction = None - """ Intended jurisdiction for search parameter (if applicable). - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.modifier = None - """ missing | exact | contains | not | text | in | not-in | below | - 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`. """ - - self.publisher = None - """ Name of the publisher (organization or individual). - Type `str`. """ - - self.purpose = None - """ Why this search parameter is defined. - Type `str`. """ - - self.status = None - """ draft | active | retired | unknown. - Type `str`. """ - - self.target = None - """ Types of resource (if a resource reference). - List of `str` items. """ - - self.type = None - """ number | date | string | token | reference | composite | quantity | - uri | special. - Type `str`. """ - - self.url = None - """ Canonical identifier for this search parameter, 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 search parameter. - Type `str`. """ - - self.xpath = None - """ XPath that extracts the values. - Type `str`. """ - - self.xpathUsage = None - """ normal | phonetic | nearby | distance | other. - Type `str`. """ - - super(SearchParameter, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(SearchParameter, self).elementProperties() - js.extend([ - ("base", "base", str, True, None, True), - ("chain", "chain", str, True, None, False), - ("code", "code", str, False, None, True), - ("comparator", "comparator", str, True, None, False), - ("component", "component", SearchParameterComponent, True, None, False), - ("contact", "contact", contactdetail.ContactDetail, True, None, False), - ("date", "date", fhirdate.FHIRDate, False, None, False), - ("derivedFrom", "derivedFrom", str, False, None, False), - ("description", "description", str, False, None, True), - ("experimental", "experimental", bool, False, None, False), - ("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), - ("status", "status", str, False, None, True), - ("target", "target", str, True, None, False), - ("type", "type", str, False, None, True), - ("url", "url", str, False, None, True), - ("useContext", "useContext", usagecontext.UsageContext, True, None, False), - ("version", "version", str, False, None, False), - ("xpath", "xpath", str, False, None, False), - ("xpathUsage", "xpathUsage", str, False, None, False), - ]) - return js - - -from . import backboneelement - -class SearchParameterComponent(backboneelement.BackboneElement): - """ For Composite resources to define the parts. - - Used to define the parts of a composite search parameter. - """ - - resource_type = "SearchParameterComponent" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Defines how the part works. - Type `str`. """ - - self.expression = None - """ Subexpression relative to main expression. - Type `str`. """ - - super(SearchParameterComponent, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(SearchParameterComponent, self).elementProperties() - js.extend([ - ("definition", "definition", str, False, None, True), - ("expression", "expression", 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 usagecontext -except ImportError: - usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/searchparameter_tests.py b/fhirclient/models/searchparameter_tests.py deleted file mode 100644 index 3129889ce..000000000 --- a/fhirclient/models/searchparameter_tests.py +++ /dev/null @@ -1,129 +0,0 @@ -#!/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 searchparameter -from .fhirdate import FHIRDate - - -class SearchParameterTests(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("SearchParameter", js["resourceType"]) - return searchparameter.SearchParameter(js) - - def testSearchParameter1(self): - inst = self.instantiate_from("searchparameter-example-extension.json") - self.assertIsNotNone(inst, "Must have instantiated a SearchParameter instance") - self.implSearchParameter1(inst) - - js = inst.as_json() - self.assertEqual("SearchParameter", js["resourceType"]) - inst2 = searchparameter.SearchParameter(js) - self.implSearchParameter1(inst2) - - def implSearchParameter1(self, inst): - self.assertEqual(inst.base[0], "Patient") - self.assertEqual(inst.code, "part-agree") - self.assertEqual(inst.contact[0].telecom[0].system, "url") - self.assertEqual(inst.contact[0].telecom[0].value, "http://hl7.org/fhir") - self.assertEqual(inst.description, "Search by url for a participation agreement, which is stored in a DocumentReference") - self.assertTrue(inst.experimental) - self.assertEqual(inst.expression, "DocumentReference.extension('http://example.org/fhir/StructureDefinition/participation-agreement')") - self.assertEqual(inst.id, "example-extension") - self.assertEqual(inst.name, "Example Search Parameter on an extension") - self.assertEqual(inst.publisher, "Health Level Seven International (FHIR Infrastructure)") - self.assertEqual(inst.status, "draft") - self.assertEqual(inst.target[0], "DocumentReference") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type, "reference") - self.assertEqual(inst.url, "http://hl7.org/fhir/SearchParameter/example-extension") - self.assertEqual(inst.xpath, "f:DocumentReference/f:extension[@url='http://example.org/fhir/StructureDefinition/participation-agreement']") - self.assertEqual(inst.xpathUsage, "normal") - - def testSearchParameter2(self): - inst = self.instantiate_from("searchparameter-example-reference.json") - self.assertIsNotNone(inst, "Must have instantiated a SearchParameter instance") - self.implSearchParameter2(inst) - - js = inst.as_json() - self.assertEqual("SearchParameter", js["resourceType"]) - inst2 = searchparameter.SearchParameter(js) - self.implSearchParameter2(inst2) - - def implSearchParameter2(self, inst): - self.assertEqual(inst.base[0], "Condition") - self.assertEqual(inst.chain[0], "name") - self.assertEqual(inst.chain[1], "identifier") - self.assertEqual(inst.code, "subject") - self.assertEqual(inst.contact[0].name, "[string]") - 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-10-23").date) - self.assertEqual(inst.date.as_json(), "2013-10-23") - self.assertEqual(inst.description, "Search by condition subject") - self.assertTrue(inst.experimental) - self.assertEqual(inst.expression, "Condition.subject") - self.assertEqual(inst.id, "example-reference") - self.assertEqual(inst.modifier[0], "missing") - self.assertEqual(inst.name, "Example Search Parameter") - self.assertEqual(inst.publisher, "Health Level Seven International (FHIR Infrastructure)") - self.assertEqual(inst.purpose, "Need to search Condition by subject") - self.assertEqual(inst.status, "draft") - 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-reference") - self.assertEqual(inst.xpathUsage, "normal") - - def testSearchParameter3(self): - inst = self.instantiate_from("searchparameter-example.json") - self.assertIsNotNone(inst, "Must have instantiated a SearchParameter instance") - self.implSearchParameter3(inst) - - js = inst.as_json() - self.assertEqual("SearchParameter", js["resourceType"]) - inst2 = searchparameter.SearchParameter(js) - self.implSearchParameter3(inst2) - - def implSearchParameter3(self, inst): - self.assertEqual(inst.base[0], "Resource") - self.assertEqual(inst.code, "_id") - self.assertEqual(inst.comparator[0], "eq") - self.assertEqual(inst.contact[0].name, "[string]") - 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-10-23").date) - self.assertEqual(inst.date.as_json(), "2013-10-23") - self.assertEqual(inst.derivedFrom, "http://hl7.org/fhir/SearchParameter/Resource-id") - self.assertEqual(inst.description, "Search by resource identifier - e.g. same as the read interaction, but can return included resources") - self.assertTrue(inst.experimental) - self.assertEqual(inst.expression, "id") - 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, "ID-SEARCH-PARAMETER") - self.assertEqual(inst.publisher, "Health Level Seven International (FHIR Infrastructure)") - self.assertEqual(inst.purpose, "Need to search by identifier for various infrastructural cases - mainly retrieving packages, and matching as part of a chain") - self.assertEqual(inst.status, "draft") - self.assertEqual(inst.text.status, "generated") - 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://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://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/signature.py b/fhirclient/models/signature.py deleted file mode 100644 index 873a37e8a..000000000 --- a/fhirclient/models/signature.py +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# 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 Signature - XML DigSig, JWS, Graphical image of signature, etc.. - - 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" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.data = None - """ The actual signature content (XML DigSig. JWS, picture, etc.). - Type `str`. """ - - 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.targetFormat = None - """ The technical format of the signed resources. - Type `str`. """ - - self.type = None - """ Indication of the reason the entity signed the object(s). - List of `Coding` items (represented as `dict` in JSON). """ - - self.when = None - """ When the signature was created. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.who = None - """ Who signed. - 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([ - ("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), - ("who", "who", fhirreference.FHIRReference, False, None, True), - ]) - return js - - -import sys -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'] diff --git a/fhirclient/models/slot.py b/fhirclient/models/slot.py deleted file mode 100644 index c052d631d..000000000 --- a/fhirclient/models/slot.py +++ /dev/null @@ -1,113 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Slot) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class Slot(domainresource.DomainResource): - """ A slot of time on a schedule that may be available for booking appointments. - """ - - resource_type = "Slot" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.appointmentType = None - """ The style of appointment or patient that may be booked in the slot - (not service type). - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.comment = None - """ Comments on the slot to describe any extended information. Such as - custom constraints on the slot. - Type `str`. """ - - self.end = None - """ Date/Time that the slot is to conclude. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.identifier = None - """ External Ids for this item. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.overbooked = None - """ This slot has already been overbooked, appointments are unlikely to - be accepted for this time. - Type `bool`. """ - - self.schedule = None - """ The schedule resource that this slot defines an interval of status - information. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.serviceCategory = None - """ A broad categorization of the service that is to be performed - during this appointment. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.serviceType = None - """ The type of appointments that can be booked into this slot (ideally - this would be an identifiable service - which is at a location, - rather than the location itself). If provided then this overrides - the value provided on the availability resource. - 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. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.start = None - """ Date/Time that the slot is to begin. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.status = None - """ busy | free | busy-unavailable | busy-tentative | entered-in-error. - Type `str`. """ - - super(Slot, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Slot, self).elementProperties() - js.extend([ - ("appointmentType", "appointmentType", codeableconcept.CodeableConcept, False, None, False), - ("comment", "comment", str, False, None, False), - ("end", "end", fhirdate.FHIRDate, False, None, True), - ("identifier", "identifier", identifier.Identifier, True, None, False), - ("overbooked", "overbooked", bool, False, None, False), - ("schedule", "schedule", fhirreference.FHIRReference, False, None, True), - ("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), - ("status", "status", 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'] diff --git a/fhirclient/models/slot_tests.py b/fhirclient/models/slot_tests.py deleted file mode 100644 index 63ec61e60..000000000 --- a/fhirclient/models/slot_tests.py +++ /dev/null @@ -1,133 +0,0 @@ -#!/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 slot -from .fhirdate import FHIRDate - - -class SlotTests(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("Slot", js["resourceType"]) - return slot.Slot(js) - - def testSlot1(self): - inst = self.instantiate_from("slot-example-busy.json") - self.assertIsNotNone(inst, "Must have instantiated a Slot instance") - self.implSlot1(inst) - - js = inst.as_json() - self.assertEqual("Slot", js["resourceType"]) - inst2 = slot.Slot(js) - self.implSlot1(inst2) - - def implSlot1(self, inst): - self.assertEqual(inst.comment, "Assessments should be performed before requesting appointments in this slot.") - self.assertEqual(inst.end.date, FHIRDate("2013-12-25T09:15:00Z").date) - self.assertEqual(inst.end.as_json(), "2013-12-25T09:15:00Z") - 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[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.json") - self.assertIsNotNone(inst, "Must have instantiated a Slot instance") - self.implSlot2(inst) - - js = inst.as_json() - self.assertEqual("Slot", js["resourceType"]) - inst2 = slot.Slot(js) - self.implSlot2(inst2) - - def implSlot2(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://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): - inst = self.instantiate_from("slot-example-unavailable.json") - self.assertIsNotNone(inst, "Must have instantiated a Slot instance") - self.implSlot3(inst) - - js = inst.as_json() - self.assertEqual("Slot", js["resourceType"]) - inst2 = slot.Slot(js) - self.implSlot3(inst2) - - def implSlot3(self, inst): - self.assertEqual(inst.comment, "Dr Careful is out of the office") - 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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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-tentative.json") - self.assertIsNotNone(inst, "Must have instantiated a Slot instance") - self.implSlot4(inst) - - js = inst.as_json() - self.assertEqual("Slot", js["resourceType"]) - inst2 = slot.Slot(js) - self.implSlot4(inst2) - - def implSlot4(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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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 deleted file mode 100644 index e1dd9b5ba..000000000 --- a/fhirclient/models/specimen.py +++ /dev/null @@ -1,317 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Specimen) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class Specimen(domainresource.DomainResource): - """ Sample for analysis. - - A sample to be used for analysis. - """ - - resource_type = "Specimen" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.accessionIdentifier = None - """ Identifier assigned by the lab. - Type `Identifier` (represented as `dict` in JSON). """ - - self.collection = None - """ 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). """ - - self.identifier = None - """ External Identifier. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.note = None - """ Comments. - List of `Annotation` items (represented as `dict` in JSON). """ - - self.parent = None - """ Specimen from which this specimen originated. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.processing = None - """ Processing and processing step details. - List of `SpecimenProcessing` items (represented as `dict` in JSON). """ - - self.receivedTime = None - """ The time when specimen was received for processing. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.request = None - """ Why the specimen was collected. - 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 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. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(Specimen, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Specimen, self).elementProperties() - 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), - ("parent", "parent", fhirreference.FHIRReference, True, None, False), - ("processing", "processing", SpecimenProcessing, True, None, False), - ("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, False), - ("type", "type", codeableconcept.CodeableConcept, False, None, False), - ]) - return js - - -from . import backboneelement - -class SpecimenCollection(backboneelement.BackboneElement): - """ Collection details. - - Details concerning the specimen collection. - """ - - resource_type = "SpecimenCollection" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.bodySite = None - """ Anatomical collection site. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.collectedDateTime = None - """ Collection time. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.collectedPeriod = None - """ Collection time. - Type `Period` (represented as `dict` in JSON). """ - - self.collector = None - """ Who collected the specimen. - 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. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.quantity = None - """ The quantity of specimen collected. - Type `Quantity` (represented as `dict` in JSON). """ - - super(SpecimenCollection, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(SpecimenCollection, self).elementProperties() - js.extend([ - ("bodySite", "bodySite", codeableconcept.CodeableConcept, False, None, False), - ("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), - ]) - return js - - -class SpecimenContainer(backboneelement.BackboneElement): - """ Direct container of specimen (tube/slide, etc.). - - The container holding the specimen. The recursive nature of containers; - i.e. blood in tube in tray in rack is not addressed here. - """ - - resource_type = "SpecimenContainer" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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). """ - - self.capacity = None - """ Container volume or size. - Type `Quantity` (represented as `dict` in JSON). """ - - self.description = None - """ Textual description of the container. - Type `str`. """ - - self.identifier = None - """ Id for the container. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.specimenQuantity = None - """ Quantity of specimen within container. - Type `Quantity` (represented as `dict` in JSON). """ - - self.type = None - """ Kind of container directly associated with specimen. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(SpecimenContainer, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(SpecimenContainer, self).elementProperties() - js.extend([ - ("additiveCodeableConcept", "additiveCodeableConcept", codeableconcept.CodeableConcept, False, "additive", False), - ("additiveReference", "additiveReference", fhirreference.FHIRReference, False, "additive", False), - ("capacity", "capacity", quantity.Quantity, False, None, False), - ("description", "description", str, False, None, False), - ("identifier", "identifier", identifier.Identifier, True, None, False), - ("specimenQuantity", "specimenQuantity", quantity.Quantity, False, None, False), - ("type", "type", codeableconcept.CodeableConcept, False, None, False), - ]) - return js - - -class SpecimenProcessing(backboneelement.BackboneElement): - """ Processing and processing step details. - - Details concerning processing and processing steps for the specimen. - """ - - resource_type = "SpecimenProcessing" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Material used in the processing step. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.description = None - """ Textual description of procedure. - Type `str`. """ - - self.procedure = None - """ Indicates the treatment step applied to the specimen. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.timeDateTime = None - """ Date and time of specimen processing. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.timePeriod = None - """ Date and time of specimen processing. - Type `Period` (represented as `dict` in JSON). """ - - super(SpecimenProcessing, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(SpecimenProcessing, self).elementProperties() - js.extend([ - ("additive", "additive", fhirreference.FHIRReference, True, 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 - - -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 duration -except ImportError: - duration = sys.modules[__package__ + '.duration'] -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 quantity -except ImportError: - quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/specimen_tests.py b/fhirclient/models/specimen_tests.py deleted file mode 100644 index 21afe0aa2..000000000 --- a/fhirclient/models/specimen_tests.py +++ /dev/null @@ -1,194 +0,0 @@ -#!/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 specimen -from .fhirdate import FHIRDate - - -class SpecimenTests(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("Specimen", js["resourceType"]) - return specimen.Specimen(js) - - def testSpecimen1(self): - inst = self.instantiate_from("specimen-example-isolate.json") - self.assertIsNotNone(inst, "Must have instantiated a Specimen instance") - self.implSpecimen1(inst) - - js = inst.as_json() - self.assertEqual("Specimen", js["resourceType"]) - inst2 = specimen.Specimen(js) - self.implSpecimen1(inst2) - - def implSpecimen1(self, inst): - self.assertEqual(inst.accessionIdentifier.system, "http://lab.acme.org/specimens/2011") - self.assertEqual(inst.accessionIdentifier.value, "X352356-ISO1") - 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://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") - self.assertEqual(inst.status, "available") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.coding[0].code, "429951000124103") - self.assertEqual(inst.type.coding[0].display, "Bacterial isolate specimen") - self.assertEqual(inst.type.coding[0].system, "http://snomed.info/sct") - - def testSpecimen2(self): - inst = self.instantiate_from("specimen-example-pooled-serum.json") - self.assertIsNotNone(inst, "Must have instantiated a Specimen instance") - self.implSpecimen2(inst) - - js = inst.as_json() - self.assertEqual("Specimen", js["resourceType"]) - inst2 = specimen.Specimen(js) - self.implSpecimen2(inst2) - - def implSpecimen2(self, inst): - 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, "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") - self.assertIsNotNone(inst, "Must have instantiated a Specimen instance") - self.implSpecimen3(inst) - - js = inst.as_json() - self.assertEqual("Specimen", js["resourceType"]) - inst2 = specimen.Specimen(js) - self.implSpecimen3(inst2) - - def implSpecimen3(self, inst): - self.assertEqual(inst.accessionIdentifier.system, "http://lab.acme.org/specimens/2015") - self.assertEqual(inst.accessionIdentifier.value, "X352356") - self.assertEqual(inst.collection.collectedDateTime.date, FHIRDate("2015-08-18T07:03:00Z").date) - self.assertEqual(inst.collection.collectedDateTime.as_json(), "2015-08-18T07:03:00Z") - self.assertEqual(inst.container[0].capacity.unit, "mls") - self.assertEqual(inst.container[0].capacity.value, 50) - self.assertEqual(inst.container[0].specimenQuantity.unit, "mls") - 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://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) - self.assertEqual(inst.receivedTime.as_json(), "2015-08-18T07:03:00Z") - self.assertEqual(inst.status, "available") - 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://terminology.hl7.org/CodeSystem/v2-0487") - - def testSpecimen4(self): - inst = self.instantiate_from("specimen-example-serum.json") - self.assertIsNotNone(inst, "Must have instantiated a Specimen instance") - self.implSpecimen4(inst) - - js = inst.as_json() - self.assertEqual("Specimen", js["resourceType"]) - inst2 = specimen.Specimen(js) - 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") - self.assertEqual(inst.collection.bodySite.coding[0].display, "Structure of median cubital vein (body structure)") - self.assertEqual(inst.collection.bodySite.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.collection.bodySite.text, "Right median cubital vein") - 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://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") - self.assertEqual(inst.container[0].capacity.unit, "mL") - self.assertEqual(inst.container[0].capacity.value, 10) - self.assertEqual(inst.container[0].description, "Green Gel tube") - self.assertEqual(inst.container[0].identifier[0].value, "48736-15394-75465") - self.assertEqual(inst.container[0].specimenQuantity.unit, "mL") - self.assertEqual(inst.container[0].specimenQuantity.value, 6) - self.assertEqual(inst.container[0].type.text, "Vacutainer") - 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") - self.assertEqual(inst.status, "available") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.coding[0].code, "122555007") - self.assertEqual(inst.type.coding[0].display, "Venous blood specimen") - self.assertEqual(inst.type.coding[0].system, "http://snomed.info/sct") - diff --git a/fhirclient/models/structuredefinition.py b/fhirclient/models/structuredefinition.py deleted file mode 100644 index 684031b5a..000000000 --- a/fhirclient/models/structuredefinition.py +++ /dev/null @@ -1,346 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/StructureDefinition) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class StructureDefinition(domainresource.DomainResource): - """ Structural Definition. - - A definition of a FHIR structure. This resource is used to describe the - underlying resources, data types defined in FHIR, and also for describing - extensions and constraints on resources and data types. - """ - - resource_type = "StructureDefinition" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.abstract = None - """ Whether the structure is abstract. - Type `bool`. """ - - self.baseDefinition = None - """ Definition that this type is constrained/specialized from. - Type `str`. """ - - self.contact = None - """ Contact details for the publisher. - List of `ContactDetail` items (represented as `dict` in JSON). """ - - self.context = None - """ 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.copyright = None - """ Use and/or publishing restrictions. - Type `str`. """ - - self.date = None - """ Date last changed. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.derivation = None - """ specialization | constraint - How relates to base definition. - Type `str`. """ - - self.description = None - """ Natural language description of the structure definition. - Type `str`. """ - - self.differential = None - """ Differential view of the structure. - Type `StructureDefinitionDifferential` (represented as `dict` in JSON). """ - - self.experimental = None - """ For testing purposes, not real usage. - Type `bool`. """ - - self.fhirVersion = None - """ FHIR Version this StructureDefinition targets. - Type `str`. """ - - self.identifier = None - """ Additional identifier for the structure definition. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.jurisdiction = None - """ Intended jurisdiction for structure definition (if applicable). - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.keyword = None - """ Assist with indexing and finding. - List of `Coding` items (represented as `dict` in JSON). """ - - self.kind = None - """ primitive-type | complex-type | resource | logical. - Type `str`. """ - - self.mapping = None - """ External specification that the content is mapped to. - List of `StructureDefinitionMapping` items (represented as `dict` in JSON). """ - - self.name = None - """ Name for this structure definition (computer friendly). - Type `str`. """ - - self.publisher = None - """ Name of the publisher (organization or individual). - Type `str`. """ - - self.purpose = None - """ Why this structure definition is defined. - Type `str`. """ - - self.snapshot = None - """ Snapshot view of the structure. - Type `StructureDefinitionSnapshot` (represented as `dict` in JSON). """ - - self.status = None - """ draft | active | retired | unknown. - Type `str`. """ - - self.title = None - """ Name for this structure definition (human friendly). - Type `str`. """ - - self.type = None - """ Type defined or constrained by this structure. - Type `str`. """ - - self.url = None - """ Canonical identifier for this structure 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 structure definition. - Type `str`. """ - - super(StructureDefinition, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(StructureDefinition, self).elementProperties() - js.extend([ - ("abstract", "abstract", bool, False, None, True), - ("baseDefinition", "baseDefinition", str, False, None, False), - ("contact", "contact", contactdetail.ContactDetail, True, None, False), - ("context", "context", StructureDefinitionContext, True, None, False), - ("contextInvariant", "contextInvariant", str, True, None, False), - ("copyright", "copyright", str, False, None, False), - ("date", "date", fhirdate.FHIRDate, False, None, False), - ("derivation", "derivation", str, False, None, False), - ("description", "description", str, False, None, False), - ("differential", "differential", StructureDefinitionDifferential, False, None, False), - ("experimental", "experimental", bool, False, None, False), - ("fhirVersion", "fhirVersion", str, False, None, False), - ("identifier", "identifier", identifier.Identifier, True, None, False), - ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), - ("keyword", "keyword", coding.Coding, True, None, False), - ("kind", "kind", str, False, None, True), - ("mapping", "mapping", StructureDefinitionMapping, True, None, False), - ("name", "name", str, False, None, True), - ("publisher", "publisher", str, False, None, False), - ("purpose", "purpose", str, False, None, False), - ("snapshot", "snapshot", StructureDefinitionSnapshot, False, None, False), - ("status", "status", str, False, None, True), - ("title", "title", str, False, None, False), - ("type", "type", str, False, None, True), - ("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 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. - - A differential view is expressed relative to the base StructureDefinition - - a statement of differences that it applies. - """ - - resource_type = "StructureDefinitionDifferential" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Definition of elements in the resource (if no StructureDefinition). - List of `ElementDefinition` items (represented as `dict` in JSON). """ - - super(StructureDefinitionDifferential, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(StructureDefinitionDifferential, self).elementProperties() - js.extend([ - ("element", "element", elementdefinition.ElementDefinition, True, None, True), - ]) - return js - - -class StructureDefinitionMapping(backboneelement.BackboneElement): - """ External specification that the content is mapped to. - - An external specification that the content is mapped to. - """ - - resource_type = "StructureDefinitionMapping" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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(StructureDefinitionMapping, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(StructureDefinitionMapping, 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 - - -class StructureDefinitionSnapshot(backboneelement.BackboneElement): - """ Snapshot view of the structure. - - A snapshot view is expressed in a standalone form that can be used and - interpreted without considering the base StructureDefinition. - """ - - resource_type = "StructureDefinitionSnapshot" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Definition of elements in the resource (if no StructureDefinition). - List of `ElementDefinition` items (represented as `dict` in JSON). """ - - super(StructureDefinitionSnapshot, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(StructureDefinitionSnapshot, self).elementProperties() - js.extend([ - ("element", "element", elementdefinition.ElementDefinition, True, 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 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/structuredefinition_tests.py b/fhirclient/models/structuredefinition_tests.py deleted file mode 100644 index 322449678..000000000 --- a/fhirclient/models/structuredefinition_tests.py +++ /dev/null @@ -1,144 +0,0 @@ -#!/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 structuredefinition -from .fhirdate import FHIRDate - - -class StructureDefinitionTests(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("StructureDefinition", js["resourceType"]) - return structuredefinition.StructureDefinition(js) - - def testStructureDefinition1(self): - inst = self.instantiate_from("structuredefinition-example-section-library.json") - self.assertIsNotNone(inst, "Must have instantiated a StructureDefinition instance") - self.implStructureDefinition1(inst) - - js = inst.as_json() - self.assertEqual("StructureDefinition", js["resourceType"]) - inst2 = structuredefinition.StructureDefinition(js) - 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/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.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, "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 deleted file mode 100644 index a3ed67756..000000000 --- a/fhirclient/models/structuremap.py +++ /dev/null @@ -1,915 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/StructureMap) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class StructureMap(domainresource.DomainResource): - """ A Map of relationships between 2 structures that can be used to transform - data. - """ - - resource_type = "StructureMap" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 last changed. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.description = None - """ Natural language description of the structure map. - Type `str`. """ - - self.experimental = None - """ For testing purposes, not real usage. - Type `bool`. """ - - self.group = None - """ Named sections for reader convenience. - List of `StructureMapGroup` items (represented as `dict` in JSON). """ - - self.identifier = None - """ Additional identifier for the structure map. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.import_fhir = None - """ Other maps used by this map (canonical URLs). - List of `str` items. """ - - self.jurisdiction = None - """ Intended jurisdiction for structure map (if applicable). - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.name = None - """ Name for this structure map (computer friendly). - Type `str`. """ - - self.publisher = None - """ Name of the publisher (organization or individual). - Type `str`. """ - - self.purpose = None - """ Why this structure map is defined. - Type `str`. """ - - self.status = None - """ draft | active | retired | unknown. - Type `str`. """ - - self.structure = None - """ Structure Definition used by this map. - List of `StructureMapStructure` items (represented as `dict` in JSON). """ - - self.title = None - """ Name for this structure map (human friendly). - Type `str`. """ - - self.url = None - """ Canonical identifier for this structure map, 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 structure map. - Type `str`. """ - - super(StructureMap, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(StructureMap, self).elementProperties() - js.extend([ - ("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), - ("experimental", "experimental", bool, False, None, False), - ("group", "group", StructureMapGroup, True, None, True), - ("identifier", "identifier", identifier.Identifier, True, None, False), - ("import_fhir", "import", str, True, 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), - ("status", "status", str, False, None, True), - ("structure", "structure", StructureMapStructure, True, None, False), - ("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 StructureMapGroup(backboneelement.BackboneElement): - """ Named sections for reader convenience. - - Organizes the mapping into manageable chunks for human review/ease of - maintenance. - """ - - resource_type = "StructureMapGroup" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Additional description/explanation for group. - Type `str`. """ - - self.extends = None - """ Another group that this group adds rules to. - Type `str`. """ - - self.input = None - """ Named instance provided when invoking the map. - List of `StructureMapGroupInput` items (represented as `dict` in JSON). """ - - self.name = None - """ Human-readable label. - Type `str`. """ - - self.rule = None - """ Transform Rule from source to target. - List of `StructureMapGroupRule` items (represented as `dict` in JSON). """ - - self.typeMode = None - """ none | types | type-and-types. - Type `str`. """ - - super(StructureMapGroup, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(StructureMapGroup, self).elementProperties() - js.extend([ - ("documentation", "documentation", str, False, None, False), - ("extends", "extends", str, False, None, False), - ("input", "input", StructureMapGroupInput, True, None, True), - ("name", "name", str, False, None, True), - ("rule", "rule", StructureMapGroupRule, True, None, True), - ("typeMode", "typeMode", str, False, None, True), - ]) - return js - - -class StructureMapGroupInput(backboneelement.BackboneElement): - """ Named instance provided when invoking the map. - - A name assigned to an instance of data. The instance must be provided when - the mapping is invoked. - """ - - resource_type = "StructureMapGroupInput" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Documentation for this instance of data. - Type `str`. """ - - self.mode = None - """ source | target. - Type `str`. """ - - self.name = None - """ Name for this instance of data. - Type `str`. """ - - self.type = None - """ Type for this instance of data. - Type `str`. """ - - super(StructureMapGroupInput, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(StructureMapGroupInput, self).elementProperties() - js.extend([ - ("documentation", "documentation", str, False, None, False), - ("mode", "mode", str, False, None, True), - ("name", "name", str, False, None, True), - ("type", "type", str, False, None, False), - ]) - return js - - -class StructureMapGroupRule(backboneelement.BackboneElement): - """ Transform Rule from source to target. - """ - - resource_type = "StructureMapGroupRule" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.dependent = None - """ Which other rules to apply in the context of this rule. - List of `StructureMapGroupRuleDependent` items (represented as `dict` in JSON). """ - - self.documentation = None - """ Documentation for this instance of data. - Type `str`. """ - - self.name = None - """ Name of the rule for internal references. - Type `str`. """ - - self.rule = None - """ Rules contained in this rule. - List of `StructureMapGroupRule` items (represented as `dict` in JSON). """ - - self.source = None - """ Source inputs to the mapping. - List of `StructureMapGroupRuleSource` items (represented as `dict` in JSON). """ - - self.target = None - """ Content to create because of this mapping rule. - List of `StructureMapGroupRuleTarget` items (represented as `dict` in JSON). """ - - super(StructureMapGroupRule, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(StructureMapGroupRule, self).elementProperties() - js.extend([ - ("dependent", "dependent", StructureMapGroupRuleDependent, True, None, False), - ("documentation", "documentation", str, False, None, False), - ("name", "name", str, False, None, True), - ("rule", "rule", StructureMapGroupRule, True, None, False), - ("source", "source", StructureMapGroupRuleSource, True, None, True), - ("target", "target", StructureMapGroupRuleTarget, True, None, False), - ]) - return js - - -class StructureMapGroupRuleDependent(backboneelement.BackboneElement): - """ Which other rules to apply in the context of this rule. - """ - - resource_type = "StructureMapGroupRuleDependent" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 a rule or group to apply. - Type `str`. """ - - self.variable = None - """ Variable to pass to the rule or group. - List of `str` items. """ - - super(StructureMapGroupRuleDependent, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(StructureMapGroupRuleDependent, self).elementProperties() - js.extend([ - ("name", "name", str, False, None, True), - ("variable", "variable", str, True, None, True), - ]) - return js - - -class StructureMapGroupRuleSource(backboneelement.BackboneElement): - """ Source inputs to the mapping. - """ - - resource_type = "StructureMapGroupRuleSource" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.check = None - """ FHIRPath expression - must be true or the mapping engine throws an - error instead of completing. - Type `str`. """ - - self.condition = None - """ FHIRPath expression - must be true or the rule does not apply. - Type `str`. """ - - self.context = None - """ Type or variable this rule applies to. - Type `str`. """ - - self.defaultValueAddress = None - """ Default value if no value exists. - Type `Address` (represented as `dict` in JSON). """ - - self.defaultValueAge = None - """ Default value if no value exists. - Type `Age` (represented as `dict` in JSON). """ - - self.defaultValueAnnotation = None - """ Default value if no value exists. - Type `Annotation` (represented as `dict` in JSON). """ - - self.defaultValueAttachment = None - """ Default value if no value exists. - Type `Attachment` (represented as `dict` in JSON). """ - - self.defaultValueBase64Binary = None - """ Default value if no value exists. - Type `str`. """ - - self.defaultValueBoolean = None - """ 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`. """ - - self.defaultValueCodeableConcept = None - """ Default value if no value exists. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.defaultValueCoding = None - """ 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). """ - - self.defaultValueDateTime = None - """ Default value if no value exists. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.defaultValueDecimal = None - """ Default value if no value exists. - Type `float`. """ - - self.defaultValueDistance = None - """ 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). """ - - self.defaultValueId = None - """ Default value if no value exists. - Type `str`. """ - - self.defaultValueIdentifier = None - """ Default value if no value exists. - Type `Identifier` (represented as `dict` in JSON). """ - - self.defaultValueInstant = None - """ Default value if no value exists. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.defaultValueInteger = None - """ Default value if no value exists. - Type `int`. """ - - self.defaultValueMarkdown = None - """ Default value if no value exists. - Type `str`. """ - - self.defaultValueMoney = None - """ Default value if no value exists. - Type `Money` (represented as `dict` in JSON). """ - - self.defaultValueOid = None - """ 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). """ - - self.defaultValuePositiveInt = None - """ Default value if no value exists. - Type `int`. """ - - self.defaultValueQuantity = None - """ Default value if no value exists. - Type `Quantity` (represented as `dict` in JSON). """ - - self.defaultValueRange = None - """ Default value if no value exists. - Type `Range` (represented as `dict` in JSON). """ - - self.defaultValueRatio = None - """ Default value if no value exists. - Type `Ratio` (represented as `dict` in JSON). """ - - self.defaultValueReference = None - """ 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). """ - - self.defaultValueSignature = None - """ Default value if no value exists. - Type `Signature` (represented as `dict` in JSON). """ - - self.defaultValueString = None - """ Default value if no value exists. - Type `str`. """ - - self.defaultValueTime = None - """ Default value if no value exists. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.defaultValueTiming = None - """ 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`. """ - - self.defaultValueUri = None - """ 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`. """ - - self.listMode = None - """ 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`. """ - - self.min = None - """ Specified minimum cardinality. - Type `int`. """ - - self.type = None - """ Rule only applies if source has this type. - Type `str`. """ - - self.variable = None - """ Named context for field, if a field is specified. - Type `str`. """ - - super(StructureMapGroupRuleSource, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(StructureMapGroupRuleSource, self).elementProperties() - js.extend([ - ("check", "check", str, False, None, False), - ("condition", "condition", str, False, None, False), - ("context", "context", str, False, None, True), - ("defaultValueAddress", "defaultValueAddress", address.Address, False, "defaultValue", False), - ("defaultValueAge", "defaultValueAge", age.Age, False, "defaultValue", False), - ("defaultValueAnnotation", "defaultValueAnnotation", annotation.Annotation, False, "defaultValue", False), - ("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), - ("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), - ("variable", "variable", str, False, None, False), - ]) - return js - - -class StructureMapGroupRuleTarget(backboneelement.BackboneElement): - """ Content to create because of this mapping rule. - """ - - resource_type = "StructureMapGroupRuleTarget" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.context = None - """ Type or variable this rule applies to. - Type `str`. """ - - self.contextType = None - """ type | variable. - Type `str`. """ - - self.element = None - """ Field to create in the context. - Type `str`. """ - - self.listMode = None - """ first | share | last | collate. - List of `str` items. """ - - self.listRuleId = None - """ Internal rule reference for shared list items. - Type `str`. """ - - self.parameter = None - """ Parameters to the transform. - List of `StructureMapGroupRuleTargetParameter` items (represented as `dict` in JSON). """ - - self.transform = None - """ create | copy +. - Type `str`. """ - - self.variable = None - """ Named context for field, if desired, and a field is specified. - Type `str`. """ - - super(StructureMapGroupRuleTarget, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(StructureMapGroupRuleTarget, self).elementProperties() - js.extend([ - ("context", "context", str, False, None, False), - ("contextType", "contextType", str, False, None, False), - ("element", "element", str, False, None, False), - ("listMode", "listMode", str, True, None, False), - ("listRuleId", "listRuleId", str, False, None, False), - ("parameter", "parameter", StructureMapGroupRuleTargetParameter, True, None, False), - ("transform", "transform", str, False, None, False), - ("variable", "variable", str, False, None, False), - ]) - return js - - -class StructureMapGroupRuleTargetParameter(backboneelement.BackboneElement): - """ Parameters to the transform. - """ - - resource_type = "StructureMapGroupRuleTargetParameter" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.valueBoolean = None - """ Parameter value - variable or literal. - Type `bool`. """ - - self.valueDecimal = None - """ Parameter value - variable or literal. - Type `float`. """ - - self.valueId = None - """ Parameter value - variable or literal. - Type `str`. """ - - self.valueInteger = None - """ Parameter value - variable or literal. - Type `int`. """ - - self.valueString = None - """ Parameter value - variable or literal. - Type `str`. """ - - super(StructureMapGroupRuleTargetParameter, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(StructureMapGroupRuleTargetParameter, self).elementProperties() - js.extend([ - ("valueBoolean", "valueBoolean", bool, False, "value", True), - ("valueDecimal", "valueDecimal", float, False, "value", True), - ("valueId", "valueId", str, False, "value", True), - ("valueInteger", "valueInteger", int, False, "value", True), - ("valueString", "valueString", str, False, "value", True), - ]) - return js - - -class StructureMapStructure(backboneelement.BackboneElement): - """ Structure Definition used by this map. - - A structure definition used by this map. The structure definition may - describe instances that are converted, or the instances that are produced. - """ - - resource_type = "StructureMapStructure" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.alias = None - """ Name for type in this map. - Type `str`. """ - - self.documentation = None - """ Documentation on use of structure. - Type `str`. """ - - self.mode = None - """ source | queried | target | produced. - Type `str`. """ - - self.url = None - """ Canonical reference to structure definition. - Type `str`. """ - - super(StructureMapStructure, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(StructureMapStructure, self).elementProperties() - js.extend([ - ("alias", "alias", str, False, None, False), - ("documentation", "documentation", str, False, None, False), - ("mode", "mode", str, False, None, True), - ("url", "url", str, False, None, True), - ]) - return js - - -import sys -try: - from . import address -except ImportError: - address = sys.modules[__package__ + '.address'] -try: - from . import age -except ImportError: - age = sys.modules[__package__ + '.age'] -try: - from . import annotation -except ImportError: - annotation = sys.modules[__package__ + '.annotation'] -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 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: - fhirdate = sys.modules[__package__ + '.fhirdate'] -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 parameterdefinition -except ImportError: - parameterdefinition = sys.modules[__package__ + '.parameterdefinition'] -try: - 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 relatedartifact -except ImportError: - relatedartifact = sys.modules[__package__ + '.relatedartifact'] -try: - from . import sampleddata -except ImportError: - sampleddata = sys.modules[__package__ + '.sampleddata'] -try: - from . import signature -except ImportError: - signature = sys.modules[__package__ + '.signature'] -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/structuremap_tests.py b/fhirclient/models/structuremap_tests.py deleted file mode 100644 index 04f57f7d2..000000000 --- a/fhirclient/models/structuremap_tests.py +++ /dev/null @@ -1,67 +0,0 @@ -#!/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 structuremap -from .fhirdate import FHIRDate - - -class StructureMapTests(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("StructureMap", js["resourceType"]) - return structuremap.StructureMap(js) - - def testStructureMap1(self): - inst = self.instantiate_from("structuremap-example.json") - self.assertIsNotNone(inst, "Must have instantiated a StructureMap instance") - self.implStructureMap1(inst) - - js = inst.as_json() - self.assertEqual("StructureMap", js["resourceType"]) - inst2 = structuremap.StructureMap(js) - self.implStructureMap1(inst2) - - def implStructureMap1(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.date.date, FHIRDate("2017-03-09").date) - self.assertEqual(inst.date.as_json(), "2017-03-09") - self.assertEqual(inst.description, "Example Structure Map") - self.assertEqual(inst.group[0].documentation, "test -> testValue") - self.assertEqual(inst.group[0].input[0].mode, "source") - self.assertEqual(inst.group[0].input[0].name, "test") - self.assertEqual(inst.group[0].name, "Examples") - self.assertEqual(inst.group[0].rule[0].name, "rule1") - self.assertEqual(inst.group[0].rule[0].source[0].context, "Source") - self.assertEqual(inst.group[0].rule[0].source[0].element, "test") - self.assertEqual(inst.group[0].rule[0].source[0].type, "SourceClassA") - self.assertEqual(inst.group[0].rule[0].source[0].variable, "t") - self.assertEqual(inst.group[0].rule[0].target[0].context, "Destination") - self.assertEqual(inst.group[0].rule[0].target[0].contextType, "variable") - self.assertEqual(inst.group[0].rule[0].target[0].element, "testValue") - self.assertEqual(inst.group[0].rule[0].target[0].transform, "copy") - self.assertEqual(inst.group[0].typeMode, "none") - self.assertEqual(inst.id, "example") - self.assertEqual(inst.identifier[0].system, "urn:ietf:rfc:3986") - self.assertEqual(inst.identifier[0].value, "urn:oid:37843577-95fb-4adb-84c0-8837188a7bf3") - self.assertEqual(inst.jurisdiction[0].coding[0].code, "009") - self.assertEqual(inst.jurisdiction[0].coding[0].display, "Oceania") - self.assertEqual(inst.jurisdiction[0].coding[0].system, "http://unstats.un.org/unsd/methods/m49/m49.htm") - self.assertEqual(inst.name, "ExampleMap") - self.assertEqual(inst.publisher, "HL7 FHIR Standard") - self.assertEqual(inst.status, "draft") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.title, "Example Map") - self.assertEqual(inst.url, "http://hl7.org/fhir/StructureMap/example") - self.assertEqual(inst.version, "0.1") - diff --git a/fhirclient/models/subscription.py b/fhirclient/models/subscription.py deleted file mode 100644 index 104df3020..000000000 --- a/fhirclient/models/subscription.py +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# 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): - """ Server push subscription criteria. - - 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 can take an appropriate action. - """ - - resource_type = "Subscription" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.channel = None - """ The channel on which to report matches to the criteria. - Type `SubscriptionChannel` (represented as `dict` in JSON). """ - - self.contact = None - """ Contact details for source (e.g. troubleshooting). - List of `ContactPoint` items (represented as `dict` in JSON). """ - - self.criteria = None - """ Rule for server push. - Type `str`. """ - - self.end = None - """ When to automatically delete the subscription. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.error = None - """ Latest error note. - Type `str`. """ - - self.reason = None - """ Description of why this subscription was created. - Type `str`. """ - - self.status = None - """ requested | active | error | off. - Type `str`. """ - - super(Subscription, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Subscription, self).elementProperties() - js.extend([ - ("channel", "channel", SubscriptionChannel, False, None, True), - ("contact", "contact", contactpoint.ContactPoint, True, None, False), - ("criteria", "criteria", str, False, None, True), - ("end", "end", fhirdate.FHIRDate, False, None, False), - ("error", "error", str, False, None, False), - ("reason", "reason", str, False, None, True), - ("status", "status", str, False, None, True), - ]) - return js - - -from . import backboneelement - -class SubscriptionChannel(backboneelement.BackboneElement): - """ The channel on which to report matches to the criteria. - - Details where to send notifications when resources are received that meet - the criteria. - """ - - resource_type = "SubscriptionChannel" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Where the channel points to. - Type `str`. """ - - self.header = None - """ Usage depends on the channel type. - List of `str` items. """ - - self.payload = None - """ MIME type to send, or omit for no payload. - Type `str`. """ - - self.type = None - """ rest-hook | websocket | email | sms | message. - Type `str`. """ - - super(SubscriptionChannel, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(SubscriptionChannel, self).elementProperties() - js.extend([ - ("endpoint", "endpoint", str, False, None, False), - ("header", "header", str, True, None, False), - ("payload", "payload", str, False, None, False), - ("type", "type", str, False, None, True), - ]) - return js - - -import sys -try: - from . import contactpoint -except ImportError: - contactpoint = sys.modules[__package__ + '.contactpoint'] -try: - from . import fhirdate -except ImportError: - fhirdate = sys.modules[__package__ + '.fhirdate'] diff --git a/fhirclient/models/subscription_tests.py b/fhirclient/models/subscription_tests.py deleted file mode 100644 index 61934a379..000000000 --- a/fhirclient/models/subscription_tests.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/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 subscription -from .fhirdate import FHIRDate - - -class SubscriptionTests(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("Subscription", js["resourceType"]) - return subscription.Subscription(js) - - def testSubscription1(self): - inst = self.instantiate_from("subscription-example-error.json") - self.assertIsNotNone(inst, "Must have instantiated a Subscription instance") - self.implSubscription1(inst) - - js = inst.as_json() - self.assertEqual("Subscription", js["resourceType"]) - inst2 = subscription.Subscription(js) - self.implSubscription1(inst2) - - def implSubscription1(self, inst): - self.assertEqual(inst.channel.endpoint, "https://biliwatch.com/customers/mount-auburn-miu/on-result") - self.assertEqual(inst.channel.header[0], "Authorization: Bearer secret-token-abc-123") - self.assertEqual(inst.channel.payload, "application/fhir+json") - self.assertEqual(inst.channel.type, "rest-hook") - self.assertEqual(inst.contact[0].system, "phone") - self.assertEqual(inst.contact[0].value, "ext 4123") - self.assertEqual(inst.criteria, "Observation?code=http://loinc.org|1975-2") - 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.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.text.div, "
[Put rendering here]
") - self.assertEqual(inst.text.status, "generated") - - def testSubscription2(self): - inst = self.instantiate_from("subscription-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Subscription instance") - self.implSubscription2(inst) - - js = inst.as_json() - self.assertEqual("Subscription", js["resourceType"]) - inst2 = subscription.Subscription(js) - self.implSubscription2(inst2) - - def implSubscription2(self, inst): - self.assertEqual(inst.channel.endpoint, "https://biliwatch.com/customers/mount-auburn-miu/on-result") - self.assertEqual(inst.channel.header[0], "Authorization: Bearer secret-token-abc-123") - self.assertEqual(inst.channel.payload, "application/fhir+json") - self.assertEqual(inst.channel.type, "rest-hook") - self.assertEqual(inst.contact[0].system, "phone") - self.assertEqual(inst.contact[0].value, "ext 4123") - self.assertEqual(inst.criteria, "Observation?code=http://loinc.org|1975-2") - 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.text.div, "
[Put rendering here]
") - self.assertEqual(inst.text.status, "generated") - diff --git a/fhirclient/models/substance.py b/fhirclient/models/substance.py deleted file mode 100644 index 20f7995e7..000000000 --- a/fhirclient/models/substance.py +++ /dev/null @@ -1,175 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Substance) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class Substance(domainresource.DomainResource): - """ A homogeneous material with a definite composition. - """ - - resource_type = "Substance" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ What class/type of substance this is. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.code = None - """ What substance this is. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.description = None - """ Textual description of the substance, comments. - Type `str`. """ - - self.identifier = None - """ Unique identifier. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.ingredient = None - """ Composition information about the substance. - List of `SubstanceIngredient` items (represented as `dict` in JSON). """ - - self.instance = None - """ If this describes a specific package/container of the substance. - List of `SubstanceInstance` items (represented as `dict` in JSON). """ - - self.status = None - """ active | inactive | entered-in-error. - Type `str`. """ - - super(Substance, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Substance, self).elementProperties() - js.extend([ - ("category", "category", codeableconcept.CodeableConcept, True, None, False), - ("code", "code", codeableconcept.CodeableConcept, False, None, True), - ("description", "description", str, False, None, False), - ("identifier", "identifier", identifier.Identifier, True, None, False), - ("ingredient", "ingredient", SubstanceIngredient, True, None, False), - ("instance", "instance", SubstanceInstance, True, None, False), - ("status", "status", str, False, None, False), - ]) - return js - - -from . import backboneelement - -class SubstanceIngredient(backboneelement.BackboneElement): - """ Composition information about the substance. - - A substance can be composed of other substances. - """ - - resource_type = "SubstanceIngredient" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Optional amount (concentration). - Type `Ratio` (represented as `dict` in JSON). """ - - self.substanceCodeableConcept = None - """ A component of the substance. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.substanceReference = None - """ A component of the substance. - Type `FHIRReference` (represented as `dict` in JSON). """ - - super(SubstanceIngredient, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(SubstanceIngredient, self).elementProperties() - js.extend([ - ("quantity", "quantity", ratio.Ratio, False, None, False), - ("substanceCodeableConcept", "substanceCodeableConcept", codeableconcept.CodeableConcept, False, "substance", True), - ("substanceReference", "substanceReference", fhirreference.FHIRReference, False, "substance", True), - ]) - return js - - -class SubstanceInstance(backboneelement.BackboneElement): - """ If this describes a specific package/container of the substance. - - Substance may be used to describe a kind of substance, or a specific - package/container of the substance: an instance. - """ - - resource_type = "SubstanceInstance" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.expiry = None - """ When no longer valid to use. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.identifier = None - """ Identifier of the package/container. - Type `Identifier` (represented as `dict` in JSON). """ - - self.quantity = None - """ Amount of substance in the package. - Type `Quantity` (represented as `dict` in JSON). """ - - super(SubstanceInstance, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(SubstanceInstance, self).elementProperties() - js.extend([ - ("expiry", "expiry", fhirdate.FHIRDate, False, None, False), - ("identifier", "identifier", identifier.Identifier, False, None, False), - ("quantity", "quantity", quantity.Quantity, 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 quantity -except ImportError: - quantity = sys.modules[__package__ + '.quantity'] -try: - from . import ratio -except ImportError: - ratio = sys.modules[__package__ + '.ratio'] diff --git a/fhirclient/models/substance_tests.py b/fhirclient/models/substance_tests.py deleted file mode 100644 index 292977f55..000000000 --- a/fhirclient/models/substance_tests.py +++ /dev/null @@ -1,188 +0,0 @@ -#!/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 substance -from .fhirdate import FHIRDate - - -class SubstanceTests(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("Substance", js["resourceType"]) - return substance.Substance(js) - - def testSubstance1(self): - inst = self.instantiate_from("substance-example-silver-nitrate-product.json") - self.assertIsNotNone(inst, "Must have instantiated a Substance instance") - self.implSubstance1(inst) - - js = inst.as_json() - self.assertEqual("Substance", js["resourceType"]) - inst2 = substance.Substance(js) - 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://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") - self.assertEqual(inst.contained[0].id, "ingr1") - self.assertEqual(inst.contained[1].id, "ingr2") - self.assertEqual(inst.description, "Augmentin 875") - self.assertEqual(inst.id, "f205") - self.assertEqual(inst.ingredient[0].quantity.denominator.code, "mg") - self.assertEqual(inst.ingredient[0].quantity.denominator.system, "http://unitsofmeasure.org") - self.assertEqual(inst.ingredient[0].quantity.denominator.unit, "mg") - self.assertEqual(inst.ingredient[0].quantity.denominator.value, 1000) - self.assertEqual(inst.ingredient[0].quantity.numerator.code, "mg") - self.assertEqual(inst.ingredient[0].quantity.numerator.system, "http://unitsofmeasure.org") - self.assertEqual(inst.ingredient[0].quantity.numerator.unit, "mg") - self.assertEqual(inst.ingredient[0].quantity.numerator.value, 875) - self.assertEqual(inst.ingredient[1].quantity.denominator.code, "mg") - self.assertEqual(inst.ingredient[1].quantity.denominator.system, "http://unitsofmeasure.org") - self.assertEqual(inst.ingredient[1].quantity.denominator.unit, "mg") - self.assertEqual(inst.ingredient[1].quantity.denominator.value, 1000) - self.assertEqual(inst.ingredient[1].quantity.numerator.code, "mg") - 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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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-f203-potassium.json") - self.assertIsNotNone(inst, "Must have instantiated a Substance instance") - self.implSubstance3(inst) - - js = inst.as_json() - self.assertEqual("Substance", js["resourceType"]) - inst2 = substance.Substance(js) - self.implSubstance3(inst2) - - def implSubstance3(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, "88480006") - self.assertEqual(inst.code.coding[0].display, "Potassium") - 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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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-f201-dust.json") - self.assertIsNotNone(inst, "Must have instantiated a Substance instance") - self.implSubstance4(inst) - - js = inst.as_json() - self.assertEqual("Substance", js["resourceType"]) - inst2 = substance.Substance(js) - self.implSubstance4(inst2) - - def implSubstance4(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 testSubstance5(self): - inst = self.instantiate_from("substance-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Substance instance") - self.implSubstance5(inst) - - js = inst.as_json() - self.assertEqual("Substance", js["resourceType"]) - inst2 = substance.Substance(js) - self.implSubstance5(inst2) - - def implSubstance5(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://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, "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-f202-staphylococcus.json") - self.assertIsNotNone(inst, "Must have instantiated a Substance instance") - self.implSubstance6(inst) - - js = inst.as_json() - self.assertEqual("Substance", js["resourceType"]) - inst2 = substance.Substance(js) - self.implSubstance6(inst2) - - def implSubstance6(self, inst): - 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/supplydelivery.py b/fhirclient/models/supplydelivery.py deleted file mode 100644 index 1d9ef8407..000000000 --- a/fhirclient/models/supplydelivery.py +++ /dev/null @@ -1,170 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SupplyDelivery) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class SupplyDelivery(domainresource.DomainResource): - """ Delivery of bulk Supplies. - - Record of delivery of what is supplied. - """ - - resource_type = "SupplyDelivery" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :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.destination = None - """ Where the Supply was sent. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.identifier = None - """ External identifier. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.occurrenceDateTime = None - """ When event occurred. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.occurrencePeriod = None - """ When event occurred. - Type `Period` (represented as `dict` in JSON). """ - - self.occurrenceTiming = None - """ When event occurred. - Type `Timing` (represented as `dict` in JSON). """ - - self.partOf = None - """ Part of referenced event. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.patient = None - """ Patient for whom the item is supplied. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.receiver = None - """ Who collected the Supply. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.status = None - """ in-progress | completed | abandoned | entered-in-error. - Type `str`. """ - - self.suppliedItem = None - """ The item that is delivered or supplied. - Type `SupplyDeliverySuppliedItem` (represented as `dict` in JSON). """ - - self.supplier = None - """ Dispenser. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.type = None - """ Category of dispense event. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(SupplyDelivery, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(SupplyDelivery, self).elementProperties() - js.extend([ - ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), - ("destination", "destination", fhirreference.FHIRReference, 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), - ("partOf", "partOf", fhirreference.FHIRReference, True, None, False), - ("patient", "patient", fhirreference.FHIRReference, False, None, False), - ("receiver", "receiver", fhirreference.FHIRReference, True, None, False), - ("status", "status", str, False, None, False), - ("suppliedItem", "suppliedItem", SupplyDeliverySuppliedItem, False, None, False), - ("supplier", "supplier", fhirreference.FHIRReference, False, None, False), - ("type", "type", codeableconcept.CodeableConcept, False, None, False), - ]) - return js - - -from . import backboneelement - -class SupplyDeliverySuppliedItem(backboneelement.BackboneElement): - """ The item that is delivered or supplied. - - The item that is being delivered or has been supplied. - """ - - resource_type = "SupplyDeliverySuppliedItem" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Medication, Substance, or Device supplied. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.itemReference = None - """ Medication, Substance, or Device supplied. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.quantity = None - """ Amount dispensed. - Type `Quantity` (represented as `dict` in JSON). """ - - super(SupplyDeliverySuppliedItem, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(SupplyDeliverySuppliedItem, self).elementProperties() - js.extend([ - ("itemCodeableConcept", "itemCodeableConcept", codeableconcept.CodeableConcept, False, "item", False), - ("itemReference", "itemReference", fhirreference.FHIRReference, False, "item", False), - ("quantity", "quantity", quantity.Quantity, 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'] -try: - from . import quantity -except ImportError: - quantity = sys.modules[__package__ + '.quantity'] -try: - from . import timing -except ImportError: - timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/supplydelivery_tests.py b/fhirclient/models/supplydelivery_tests.py deleted file mode 100644 index 85fb29c16..000000000 --- a/fhirclient/models/supplydelivery_tests.py +++ /dev/null @@ -1,70 +0,0 @@ -#!/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 supplydelivery -from .fhirdate import FHIRDate - - -class SupplyDeliveryTests(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("SupplyDelivery", js["resourceType"]) - return supplydelivery.SupplyDelivery(js) - - def testSupplyDelivery1(self): - inst = self.instantiate_from("supplydelivery-example.json") - self.assertIsNotNone(inst, "Must have instantiated a SupplyDelivery instance") - self.implSupplyDelivery1(inst) - - js = inst.as_json() - self.assertEqual("SupplyDelivery", js["resourceType"]) - inst2 = supplydelivery.SupplyDelivery(js) - self.implSupplyDelivery1(inst2) - - def implSupplyDelivery1(self, inst): - 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-pumpdelivery.json") - self.assertIsNotNone(inst, "Must have instantiated a SupplyDelivery instance") - self.implSupplyDelivery2(inst) - - js = inst.as_json() - self.assertEqual("SupplyDelivery", js["resourceType"]) - inst2 = supplydelivery.SupplyDelivery(js) - self.implSupplyDelivery2(inst2) - - def implSupplyDelivery2(self, inst): - 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") - diff --git a/fhirclient/models/supplyrequest.py b/fhirclient/models/supplyrequest.py deleted file mode 100644 index 35983ab2e..000000000 --- a/fhirclient/models/supplyrequest.py +++ /dev/null @@ -1,211 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SupplyRequest) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class SupplyRequest(domainresource.DomainResource): - """ Request for a medication, substance or device. - - A record of a request for a medication, substance or device used in the - healthcare setting. - """ - - resource_type = "SupplyRequest" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ When the request was made. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.category = None - """ The kind of supply (central, non-stock, etc.). - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.deliverFrom = None - """ The origin of the supply. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.deliverTo = None - """ The destination of the supply. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.identifier = None - """ 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. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.occurrencePeriod = None - """ When the request should be fulfilled. - Type `Period` (represented as `dict` in JSON). """ - - self.occurrenceTiming = None - """ When the request should be fulfilled. - Type `Timing` (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.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 - """ The reason why the supply item was requested. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.requester = None - """ Individual making the request. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.status = None - """ draft | active | suspended +. - Type `str`. """ - - self.supplier = None - """ Who is intended to fulfill the request. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - super(SupplyRequest, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(SupplyRequest, self).elementProperties() - js.extend([ - ("authoredOn", "authoredOn", fhirdate.FHIRDate, False, None, False), - ("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, 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), - ("parameter", "parameter", SupplyRequestParameter, True, None, False), - ("priority", "priority", str, 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), - ]) - return js - - -from . import backboneelement - -class SupplyRequestParameter(backboneelement.BackboneElement): - """ Ordered item details. - - Specific parameters for the ordered item. For example, the size of the - indicated item. - """ - - resource_type = "SupplyRequestParameter" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Item 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.valueRange = None - """ Value of detail. - Type `Range` (represented as `dict` in JSON). """ - - super(SupplyRequestParameter, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(SupplyRequestParameter, self).elementProperties() - js.extend([ - ("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 - - -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'] -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: - timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/supplyrequest_tests.py b/fhirclient/models/supplyrequest_tests.py deleted file mode 100644 index f9203489d..000000000 --- a/fhirclient/models/supplyrequest_tests.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/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 supplyrequest -from .fhirdate import FHIRDate - - -class SupplyRequestTests(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("SupplyRequest", js["resourceType"]) - return supplyrequest.SupplyRequest(js) - - def testSupplyRequest1(self): - inst = self.instantiate_from("supplyrequest-example-simpleorder.json") - self.assertIsNotNone(inst, "Must have instantiated a SupplyRequest instance") - self.implSupplyRequest1(inst) - - js = inst.as_json() - self.assertEqual("SupplyRequest", js["resourceType"]) - inst2 = supplyrequest.SupplyRequest(js) - self.implSupplyRequest1(inst2) - - def implSupplyRequest1(self, inst): - self.assertEqual(inst.authoredOn.date, FHIRDate("2016-12-31").date) - self.assertEqual(inst.authoredOn.as_json(), "2016-12-31") - 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[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.priority, "asap") - 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 deleted file mode 100644 index c3bc04454..000000000 --- a/fhirclient/models/task.py +++ /dev/null @@ -1,907 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Task) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class Task(domainresource.DomainResource): - """ A task to be performed. - """ - - resource_type = "Task" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Task Creation Date. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.basedOn = None - """ Request fulfilled by this task. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.businessStatus = None - """ E.g. "Specimen collected", "IV prepped". - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.code = None - """ Task Type. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - 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` (represented as `dict` in JSON). """ - - self.for_fhir = None - """ Beneficiary of the Task. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.groupIdentifier = None - """ Requisition or grouper id. - Type `Identifier` (represented as `dict` in JSON). """ - - self.identifier = None - """ Task Instance Identifier. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.input = None - """ 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 - """ 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). """ - - self.output = None - """ Information produced as part of task. - List of `TaskOutput` items (represented as `dict` in JSON). """ - - self.owner = None - """ Responsible individual. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.partOf = None - """ Composite task. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.performerType = None - """ Requested performer. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.priority = None - """ routine | urgent | asap | stat. - Type `str`. """ - - 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 (represented as `dict` in JSON). """ - - self.requester = None - """ Who is asking for task to be done. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.restriction = None - """ Constraints on fulfillment tasks. - Type `TaskRestriction` (represented as `dict` in JSON). """ - - self.status = None - """ draft | requested | received | accepted | +. - Type `str`. """ - - self.statusReason = None - """ Reason for current status. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(Task, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Task, self).elementProperties() - js.extend([ - ("authoredOn", "authoredOn", fhirdate.FHIRDate, False, None, False), - ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), - ("businessStatus", "businessStatus", codeableconcept.CodeableConcept, False, None, False), - ("code", "code", codeableconcept.CodeableConcept, False, None, 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), - ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, False, None, False), - ("reasonReference", "reasonReference", fhirreference.FHIRReference, False, None, False), - ("relevantHistory", "relevantHistory", fhirreference.FHIRReference, True, 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), - ]) - return js - - -from . import backboneelement - -class TaskInput(backboneelement.BackboneElement): - """ Information used to perform task. - - Additional information that may be needed in the execution of the task. - """ - - resource_type = "TaskInput" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Label for the input. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.valueAddress = None - """ Content to use in performing the task. - Type `Address` (represented as `dict` in JSON). """ - - self.valueAge = None - """ Content to use in performing the task. - Type `Age` (represented as `dict` in JSON). """ - - self.valueAnnotation = None - """ Content to use in performing the task. - Type `Annotation` (represented as `dict` in JSON). """ - - self.valueAttachment = None - """ Content to use in performing the task. - Type `Attachment` (represented as `dict` in JSON). """ - - self.valueBase64Binary = None - """ Content to use in performing the task. - Type `str`. """ - - self.valueBoolean = None - """ 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`. """ - - self.valueCodeableConcept = None - """ Content to use in performing the task. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.valueCoding = None - """ 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). """ - - self.valueDateTime = None - """ Content to use in performing the task. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.valueDecimal = None - """ Content to use in performing the task. - Type `float`. """ - - self.valueDistance = None - """ 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). """ - - self.valueId = None - """ Content to use in performing the task. - Type `str`. """ - - self.valueIdentifier = None - """ Content to use in performing the task. - Type `Identifier` (represented as `dict` in JSON). """ - - self.valueInstant = None - """ Content to use in performing the task. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.valueInteger = None - """ Content to use in performing the task. - Type `int`. """ - - self.valueMarkdown = None - """ Content to use in performing the task. - Type `str`. """ - - self.valueMoney = None - """ Content to use in performing the task. - Type `Money` (represented as `dict` in JSON). """ - - self.valueOid = None - """ 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). """ - - self.valuePositiveInt = None - """ Content to use in performing the task. - Type `int`. """ - - self.valueQuantity = None - """ Content to use in performing the task. - Type `Quantity` (represented as `dict` in JSON). """ - - self.valueRange = None - """ Content to use in performing the task. - Type `Range` (represented as `dict` in JSON). """ - - self.valueRatio = None - """ Content to use in performing the task. - Type `Ratio` (represented as `dict` in JSON). """ - - self.valueReference = None - """ 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). """ - - self.valueSignature = None - """ Content to use in performing the task. - Type `Signature` (represented as `dict` in JSON). """ - - self.valueString = None - """ Content to use in performing the task. - Type `str`. """ - - self.valueTime = None - """ Content to use in performing the task. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.valueTiming = None - """ 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`. """ - - self.valueUri = None - """ 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): - js = super(TaskInput, self).elementProperties() - js.extend([ - ("type", "type", codeableconcept.CodeableConcept, False, None, True), - ("valueAddress", "valueAddress", address.Address, False, "value", True), - ("valueAge", "valueAge", age.Age, False, "value", True), - ("valueAnnotation", "valueAnnotation", annotation.Annotation, False, "value", True), - ("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), - ("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 - - -class TaskOutput(backboneelement.BackboneElement): - """ Information produced as part of task. - - Outputs produced by the Task. - """ - - resource_type = "TaskOutput" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Label for output. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.valueAddress = None - """ Result of output. - Type `Address` (represented as `dict` in JSON). """ - - self.valueAge = None - """ Result of output. - Type `Age` (represented as `dict` in JSON). """ - - self.valueAnnotation = None - """ Result of output. - Type `Annotation` (represented as `dict` in JSON). """ - - self.valueAttachment = None - """ Result of output. - Type `Attachment` (represented as `dict` in JSON). """ - - self.valueBase64Binary = None - """ Result of output. - Type `str`. """ - - self.valueBoolean = None - """ Result of output. - Type `bool`. """ - - self.valueCanonical = None - """ Result of output. - Type `str`. """ - - self.valueCode = None - """ Result of output. - Type `str`. """ - - self.valueCodeableConcept = None - """ Result of output. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.valueCoding = None - """ 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). """ - - self.valueDateTime = None - """ Result of output. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.valueDecimal = None - """ Result of output. - Type `float`. """ - - self.valueDistance = None - """ 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). """ - - self.valueId = None - """ Result of output. - Type `str`. """ - - self.valueIdentifier = None - """ Result of output. - Type `Identifier` (represented as `dict` in JSON). """ - - self.valueInstant = None - """ Result of output. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.valueInteger = None - """ Result of output. - Type `int`. """ - - self.valueMarkdown = None - """ Result of output. - Type `str`. """ - - self.valueMoney = None - """ Result of output. - Type `Money` (represented as `dict` in JSON). """ - - self.valueOid = None - """ 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). """ - - self.valuePositiveInt = None - """ Result of output. - Type `int`. """ - - self.valueQuantity = None - """ Result of output. - Type `Quantity` (represented as `dict` in JSON). """ - - self.valueRange = None - """ Result of output. - Type `Range` (represented as `dict` in JSON). """ - - self.valueRatio = None - """ Result of output. - Type `Ratio` (represented as `dict` in JSON). """ - - self.valueReference = None - """ 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). """ - - self.valueSignature = None - """ Result of output. - Type `Signature` (represented as `dict` in JSON). """ - - self.valueString = None - """ Result of output. - Type `str`. """ - - self.valueTime = None - """ Result of output. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.valueTiming = None - """ 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`. """ - - self.valueUri = None - """ 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): - js = super(TaskOutput, self).elementProperties() - js.extend([ - ("type", "type", codeableconcept.CodeableConcept, False, None, True), - ("valueAddress", "valueAddress", address.Address, False, "value", True), - ("valueAge", "valueAge", age.Age, False, "value", True), - ("valueAnnotation", "valueAnnotation", annotation.Annotation, False, "value", True), - ("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), - ("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 - - -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. - """ - - resource_type = "TaskRestriction" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ When fulfillment sought. - Type `Period` (represented as `dict` in JSON). """ - - self.recipient = None - """ For whom is fulfillment sought?. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.repetitions = None - """ How many times to repeat. - Type `int`. """ - - super(TaskRestriction, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TaskRestriction, self).elementProperties() - js.extend([ - ("period", "period", period.Period, False, None, False), - ("recipient", "recipient", fhirreference.FHIRReference, True, None, False), - ("repetitions", "repetitions", int, False, None, False), - ]) - return js - - -import sys -try: - from . import address -except ImportError: - address = sys.modules[__package__ + '.address'] -try: - from . import age -except ImportError: - age = sys.modules[__package__ + '.age'] -try: - from . import annotation -except ImportError: - annotation = sys.modules[__package__ + '.annotation'] -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 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: - fhirdate = sys.modules[__package__ + '.fhirdate'] -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 parameterdefinition -except ImportError: - parameterdefinition = sys.modules[__package__ + '.parameterdefinition'] -try: - 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 relatedartifact -except ImportError: - relatedartifact = sys.modules[__package__ + '.relatedartifact'] -try: - from . import sampleddata -except ImportError: - sampleddata = sys.modules[__package__ + '.sampleddata'] -try: - from . import signature -except ImportError: - signature = sys.modules[__package__ + '.signature'] -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/task_tests.py b/fhirclient/models/task_tests.py deleted file mode 100644 index 380c4737d..000000000 --- a/fhirclient/models/task_tests.py +++ /dev/null @@ -1,396 +0,0 @@ -#!/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 task -from .fhirdate import FHIRDate - - -class TaskTests(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("Task", js["resourceType"]) - return task.Task(js) - - def testTask1(self): - inst = self.instantiate_from("task-example6.json") - self.assertIsNotNone(inst, "Must have instantiated a Task instance") - self.implTask1(inst) - - js = inst.as_json() - self.assertEqual("Task", js["resourceType"]) - inst2 = task.Task(js) - self.implTask1(inst2) - - 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, "test completed and posted") - 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.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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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://terminology.hl7.org/CodeSystem/task-performer-type") - self.assertEqual(inst.performerType[0].text, "Performer") - self.assertEqual(inst.priority, "routine") - 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.text.status, "generated") - - def testTask2(self): - inst = self.instantiate_from("task-example-fm-poll.json") - self.assertIsNotNone(inst, "Must have instantiated a Task instance") - self.implTask2(inst) - - js = inst.as_json() - self.assertEqual("Task", js["resourceType"]) - inst2 = task.Task(js) - self.implTask2(inst2) - - def implTask2(self, inst): - 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, "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-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://terminology.hl7.org/CodeSystem/task-performer-type") - self.assertEqual(inst.performerType[0].text, "Performer") - self.assertEqual(inst.priority, "routine") - 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.text.status, "generated") - - 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.implTask5(inst) - - js = inst.as_json() - self.assertEqual("Task", js["resourceType"]) - inst2 = task.Task(js) - self.implTask5(inst2) - - 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") - self.assertEqual(inst.id, "example3") - 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 testTask6(self): - inst = self.instantiate_from("task-example-fm-status-resp.json") - self.assertIsNotNone(inst, "Must have instantiated a Task instance") - self.implTask6(inst) - - js = inst.as_json() - self.assertEqual("Task", js["resourceType"]) - inst2 = task.Task(js) - self.implTask6(inst2) - - 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.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, "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.meta.tag[0].code, "HTEST") - self.assertEqual(inst.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://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, "accepted") - self.assertEqual(inst.text.status, "generated") - - def testTask8(self): - inst = self.instantiate_from("task-example-fm-release.json") - self.assertIsNotNone(inst, "Must have instantiated a Task instance") - self.implTask8(inst) - - js = inst.as_json() - self.assertEqual("Task", js["resourceType"]) - inst2 = task.Task(js) - self.implTask8(inst2) - - 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, "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("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 testTask9(self): - inst = self.instantiate_from("task-example-fm-cancel.json") - self.assertIsNotNone(inst, "Must have instantiated a Task instance") - self.implTask9(inst) - - js = inst.as_json() - self.assertEqual("Task", js["resourceType"]) - inst2 = task.Task(js) - self.implTask9(inst2) - - 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, "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") - 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-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://terminology.hl7.org/CodeSystem/task-performer-type") - self.assertEqual(inst.performerType[0].text, "Performer") - self.assertEqual(inst.priority, "routine") - 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.text.status, "generated") - diff --git a/fhirclient/models/testreport.py b/fhirclient/models/testreport.py deleted file mode 100644 index 14ea7085c..000000000 --- a/fhirclient/models/testreport.py +++ /dev/null @@ -1,431 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/TestReport) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class TestReport(domainresource.DomainResource): - """ Describes the results of a TestScript execution. - - A summary of information based on the results of executing a TestScript. - """ - - resource_type = "TestReport" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ External identifier. - Type `Identifier` (represented as `dict` in JSON). """ - - self.issued = None - """ When the TestScript was executed and this TestReport was generated. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.name = None - """ Informal name of the executed TestScript. - Type `str`. """ - - self.participant = None - """ A participant in the test execution, either the execution engine, a - client, or a server. - List of `TestReportParticipant` items (represented as `dict` in JSON). """ - - self.result = None - """ pass | fail | pending. - Type `str`. """ - - self.score = None - """ The final score (percentage of tests passed) resulting from the - execution of the TestScript. - Type `float`. """ - - self.setup = None - """ The results of the series of required setup operations before the - tests were executed. - Type `TestReportSetup` (represented as `dict` in JSON). """ - - self.status = None - """ completed | in-progress | waiting | stopped | entered-in-error. - Type `str`. """ - - self.teardown = None - """ The results of running the series of required clean up steps. - Type `TestReportTeardown` (represented as `dict` in JSON). """ - - self.test = None - """ A test executed from the test script. - List of `TestReportTest` items (represented as `dict` in JSON). """ - - self.testScript = None - """ Reference to the version-specific TestScript that was executed to - produce this TestReport. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.tester = None - """ Name of the tester producing this report (Organization or - individual). - Type `str`. """ - - super(TestReport, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestReport, self).elementProperties() - js.extend([ - ("identifier", "identifier", identifier.Identifier, False, None, False), - ("issued", "issued", fhirdate.FHIRDate, False, None, False), - ("name", "name", str, False, None, False), - ("participant", "participant", TestReportParticipant, True, None, False), - ("result", "result", str, False, None, True), - ("score", "score", float, False, None, False), - ("setup", "setup", TestReportSetup, False, None, False), - ("status", "status", str, False, None, True), - ("teardown", "teardown", TestReportTeardown, False, None, False), - ("test", "test", TestReportTest, True, None, False), - ("testScript", "testScript", fhirreference.FHIRReference, False, None, True), - ("tester", "tester", str, False, None, False), - ]) - return js - - -from . import backboneelement - -class TestReportParticipant(backboneelement.BackboneElement): - """ A participant in the test execution, either the execution engine, a client, - or a server. - """ - - resource_type = "TestReportParticipant" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.display = None - """ The display name of the participant. - Type `str`. """ - - self.type = None - """ test-engine | client | server. - Type `str`. """ - - self.uri = None - """ The uri of the participant. An absolute URL is preferred. - Type `str`. """ - - super(TestReportParticipant, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestReportParticipant, self).elementProperties() - js.extend([ - ("display", "display", str, False, None, False), - ("type", "type", str, False, None, True), - ("uri", "uri", str, False, None, True), - ]) - return js - - -class TestReportSetup(backboneelement.BackboneElement): - """ The results of the series of required setup operations before the tests - were executed. - """ - - resource_type = "TestReportSetup" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ A setup operation or assert that was executed. - List of `TestReportSetupAction` items (represented as `dict` in JSON). """ - - super(TestReportSetup, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestReportSetup, self).elementProperties() - js.extend([ - ("action", "action", TestReportSetupAction, True, None, True), - ]) - return js - - -class TestReportSetupAction(backboneelement.BackboneElement): - """ A setup operation or assert that was executed. - - Action would contain either an operation or an assertion. - """ - - resource_type = "TestReportSetupAction" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.assert_fhir = None - """ The assertion to perform. - Type `TestReportSetupActionAssert` (represented as `dict` in JSON). """ - - self.operation = None - """ The operation to perform. - Type `TestReportSetupActionOperation` (represented as `dict` in JSON). """ - - super(TestReportSetupAction, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestReportSetupAction, self).elementProperties() - js.extend([ - ("assert_fhir", "assert", TestReportSetupActionAssert, False, None, False), - ("operation", "operation", TestReportSetupActionOperation, False, None, False), - ]) - return js - - -class TestReportSetupActionAssert(backboneelement.BackboneElement): - """ The assertion to perform. - - The results of the assertion performed on the previous operations. - """ - - resource_type = "TestReportSetupActionAssert" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.detail = None - """ A link to further details on the result. - Type `str`. """ - - self.message = None - """ A message associated with the result. - Type `str`. """ - - self.result = None - """ pass | skip | fail | warning | error. - Type `str`. """ - - super(TestReportSetupActionAssert, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestReportSetupActionAssert, self).elementProperties() - js.extend([ - ("detail", "detail", str, False, None, False), - ("message", "message", str, False, None, False), - ("result", "result", str, False, None, True), - ]) - return js - - -class TestReportSetupActionOperation(backboneelement.BackboneElement): - """ The operation to perform. - - The operation performed. - """ - - resource_type = "TestReportSetupActionOperation" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.detail = None - """ A link to further details on the result. - Type `str`. """ - - self.message = None - """ A message associated with the result. - Type `str`. """ - - self.result = None - """ pass | skip | fail | warning | error. - Type `str`. """ - - super(TestReportSetupActionOperation, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestReportSetupActionOperation, self).elementProperties() - js.extend([ - ("detail", "detail", str, False, None, False), - ("message", "message", str, False, None, False), - ("result", "result", str, False, None, True), - ]) - return js - - -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 all the - tests were executed (successfully or otherwise). - """ - - resource_type = "TestReportTeardown" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ One or more teardown operations performed. - List of `TestReportTeardownAction` items (represented as `dict` in JSON). """ - - super(TestReportTeardown, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestReportTeardown, self).elementProperties() - js.extend([ - ("action", "action", TestReportTeardownAction, True, None, True), - ]) - return js - - -class TestReportTeardownAction(backboneelement.BackboneElement): - """ One or more teardown operations performed. - - The teardown action will only contain an operation. - """ - - resource_type = "TestReportTeardownAction" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.operation = None - """ The teardown operation performed. - Type `TestReportSetupActionOperation` (represented as `dict` in JSON). """ - - super(TestReportTeardownAction, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestReportTeardownAction, self).elementProperties() - js.extend([ - ("operation", "operation", TestReportSetupActionOperation, False, None, True), - ]) - return js - - -class TestReportTest(backboneelement.BackboneElement): - """ A test executed from the test script. - """ - - resource_type = "TestReportTest" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ A test operation or assert that was performed. - List of `TestReportTestAction` items (represented as `dict` in JSON). """ - - self.description = None - """ Tracking/reporting short description of the test. - Type `str`. """ - - self.name = None - """ Tracking/logging name of this test. - Type `str`. """ - - super(TestReportTest, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestReportTest, self).elementProperties() - js.extend([ - ("action", "action", TestReportTestAction, True, None, True), - ("description", "description", str, False, None, False), - ("name", "name", str, False, None, False), - ]) - return js - - -class TestReportTestAction(backboneelement.BackboneElement): - """ A test operation or assert that was performed. - - Action would contain either an operation or an assertion. - """ - - resource_type = "TestReportTestAction" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.assert_fhir = None - """ The assertion performed. - Type `TestReportSetupActionAssert` (represented as `dict` in JSON). """ - - self.operation = None - """ The operation performed. - Type `TestReportSetupActionOperation` (represented as `dict` in JSON). """ - - super(TestReportTestAction, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestReportTestAction, self).elementProperties() - js.extend([ - ("assert_fhir", "assert", TestReportSetupActionAssert, False, None, False), - ("operation", "operation", TestReportSetupActionOperation, False, None, False), - ]) - 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/testreport_tests.py b/fhirclient/models/testreport_tests.py deleted file mode 100644 index 9108e005e..000000000 --- a/fhirclient/models/testreport_tests.py +++ /dev/null @@ -1,103 +0,0 @@ -#!/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 testreport -from .fhirdate import FHIRDate - - -class TestReportTests(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("TestReport", js["resourceType"]) - return testreport.TestReport(js) - - def testTestReport1(self): - inst = self.instantiate_from("testreport-example.json") - self.assertIsNotNone(inst, "Must have instantiated a TestReport instance") - self.implTestReport1(inst) - - js = inst.as_json() - self.assertEqual("TestReport", js["resourceType"]) - inst2 = testreport.TestReport(js) - self.implTestReport1(inst2) - - def implTestReport1(self, inst): - self.assertEqual(inst.id, "testreport-example") - 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.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") - self.assertEqual(inst.participant[0].uri, "http://projectcrucible.org") - self.assertEqual(inst.participant[1].display, "HealthIntersections STU3") - self.assertEqual(inst.participant[1].type, "server") - self.assertEqual(inst.participant[1].uri, "http://fhir3.healthintersections.com.au/open") - self.assertEqual(inst.result, "pass") - self.assertEqual(inst.score, 100.0) - self.assertEqual(inst.setup.action[0].operation.detail, "http://projectcrucible.org/permalink/1") - self.assertEqual(inst.setup.action[0].operation.message, "DELETE Patient") - self.assertEqual(inst.setup.action[0].operation.result, "pass") - self.assertEqual(inst.setup.action[1].assert_fhir.detail, "http://projectcrucible.org/permalink/1") - self.assertEqual(inst.setup.action[1].assert_fhir.message, "HTTP 204") - self.assertEqual(inst.setup.action[1].assert_fhir.result, "pass") - self.assertEqual(inst.setup.action[2].operation.detail, "http://projectcrucible.org/permalink/1") - self.assertEqual(inst.setup.action[2].operation.message, "POST Patient/fixture-patient-create") - self.assertEqual(inst.setup.action[2].operation.result, "pass") - self.assertEqual(inst.setup.action[3].assert_fhir.detail, "http://projectcrucible.org/permalink/1") - self.assertEqual(inst.setup.action[3].assert_fhir.message, "HTTP 201") - self.assertEqual(inst.setup.action[3].assert_fhir.result, "pass") - self.assertEqual(inst.status, "completed") - self.assertEqual(inst.teardown.action[0].operation.detail, "http://projectcrucible.org/permalink/3") - self.assertEqual(inst.teardown.action[0].operation.message, "DELETE Patient/fixture-patient-create.") - self.assertEqual(inst.teardown.action[0].operation.result, "pass") - self.assertEqual(inst.test[0].action[0].operation.detail, "http://projectcrucible.org/permalink/2") - self.assertEqual(inst.test[0].action[0].operation.message, "GET Patient/fixture-patient-create") - self.assertEqual(inst.test[0].action[0].operation.result, "pass") - self.assertEqual(inst.test[0].action[1].assert_fhir.detail, "http://projectcrucible.org/permalink/2") - self.assertEqual(inst.test[0].action[1].assert_fhir.message, "HTTP 200") - self.assertEqual(inst.test[0].action[1].assert_fhir.result, "pass") - self.assertEqual(inst.test[0].action[2].assert_fhir.detail, "http://projectcrucible.org/permalink/2") - self.assertEqual(inst.test[0].action[2].assert_fhir.message, "Last-Modified Present") - self.assertEqual(inst.test[0].action[2].assert_fhir.result, "pass") - self.assertEqual(inst.test[0].action[3].assert_fhir.detail, "http://projectcrucible.org/permalink/2") - self.assertEqual(inst.test[0].action[3].assert_fhir.message, "Response is Patient") - self.assertEqual(inst.test[0].action[3].assert_fhir.result, "pass") - self.assertEqual(inst.test[0].action[4].assert_fhir.detail, "http://projectcrucible.org/permalink/2") - self.assertEqual(inst.test[0].action[4].assert_fhir.message, "Response validates") - self.assertEqual(inst.test[0].action[4].assert_fhir.result, "pass") - self.assertEqual(inst.test[0].action[5].assert_fhir.detail, "http://projectcrucible.org/permalink/2") - self.assertEqual(inst.test[0].action[5].assert_fhir.message, "Patient.name.family 'Chalmers'") - self.assertEqual(inst.test[0].action[5].assert_fhir.result, "pass") - self.assertEqual(inst.test[0].action[6].assert_fhir.detail, "http://projectcrucible.org/permalink/2") - self.assertEqual(inst.test[0].action[6].assert_fhir.message, "Patient.name.given 'Peter'") - self.assertEqual(inst.test[0].action[6].assert_fhir.result, "pass") - self.assertEqual(inst.test[0].action[7].assert_fhir.detail, "http://projectcrucible.org/permalink/2") - self.assertEqual(inst.test[0].action[7].assert_fhir.message, "Patient.name.family 'Chalmers'") - self.assertEqual(inst.test[0].action[7].assert_fhir.result, "pass") - self.assertEqual(inst.test[0].action[8].assert_fhir.detail, "http://projectcrucible.org/permalink/2") - self.assertEqual(inst.test[0].action[8].assert_fhir.message, "Patient.name.family 'Chalmers'") - self.assertEqual(inst.test[0].action[8].assert_fhir.result, "pass") - self.assertEqual(inst.test[0].action[9].assert_fhir.detail, "http://projectcrucible.org/permalink/2") - self.assertEqual(inst.test[0].action[9].assert_fhir.message, "Patient expected values.") - self.assertEqual(inst.test[0].action[9].assert_fhir.result, "pass") - 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.tester, "HL7 Execution Engine") - self.assertEqual(inst.text.status, "generated") - diff --git a/fhirclient/models/testscript.py b/fhirclient/models/testscript.py deleted file mode 100644 index f85d0ad7f..000000000 --- a/fhirclient/models/testscript.py +++ /dev/null @@ -1,989 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/TestScript) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class TestScript(domainresource.DomainResource): - """ Describes a set of tests. - - A structured set of tests against a FHIR server or client implementation to - determine compliance against the FHIR specification. - """ - - resource_type = "TestScript" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 last changed. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.description = None - """ Natural language description of the test script. - Type `str`. """ - - self.destination = None - """ An abstract server representing a destination or receiver in a - message exchange. - List of `TestScriptDestination` items (represented as `dict` in JSON). """ - - self.experimental = None - """ For testing purposes, not real usage. - Type `bool`. """ - - self.fixture = None - """ Fixture in the test script - by reference (uri). - List of `TestScriptFixture` items (represented as `dict` in JSON). """ - - self.identifier = None - """ Additional identifier for the test script. - Type `Identifier` (represented as `dict` in JSON). """ - - self.jurisdiction = None - """ Intended jurisdiction for test script (if applicable). - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.metadata = None - """ Required capability that is assumed to function correctly on the - FHIR server being tested. - Type `TestScriptMetadata` (represented as `dict` in JSON). """ - - self.name = None - """ Name for this test script (computer friendly). - Type `str`. """ - - self.origin = None - """ An abstract server representing a client or sender in a message - exchange. - List of `TestScriptOrigin` items (represented as `dict` in JSON). """ - - self.profile = None - """ Reference of the validation profile. - List of `FHIRReference` items (represented as `dict` in JSON). """ - - self.publisher = None - """ Name of the publisher (organization or individual). - Type `str`. """ - - self.purpose = None - """ Why this test script is defined. - Type `str`. """ - - self.setup = None - """ A series of required setup operations before tests are executed. - Type `TestScriptSetup` (represented as `dict` in JSON). """ - - self.status = None - """ draft | active | retired | unknown. - Type `str`. """ - - self.teardown = None - """ A series of required clean up steps. - Type `TestScriptTeardown` (represented as `dict` in JSON). """ - - self.test = None - """ A test in this script. - List of `TestScriptTest` items (represented as `dict` in JSON). """ - - self.title = None - """ Name for this test script (human friendly). - Type `str`. """ - - self.url = None - """ Canonical identifier for this test script, 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.variable = None - """ Placeholder for evaluated elements. - List of `TestScriptVariable` items (represented as `dict` in JSON). """ - - self.version = None - """ Business version of the test script. - Type `str`. """ - - super(TestScript, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestScript, self).elementProperties() - js.extend([ - ("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), - ("destination", "destination", TestScriptDestination, True, None, False), - ("experimental", "experimental", bool, False, None, False), - ("fixture", "fixture", TestScriptFixture, True, None, False), - ("identifier", "identifier", identifier.Identifier, False, None, False), - ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), - ("metadata", "metadata", TestScriptMetadata, False, None, False), - ("name", "name", str, False, None, True), - ("origin", "origin", TestScriptOrigin, True, None, False), - ("profile", "profile", fhirreference.FHIRReference, True, None, False), - ("publisher", "publisher", str, False, None, False), - ("purpose", "purpose", str, False, None, False), - ("setup", "setup", TestScriptSetup, False, None, False), - ("status", "status", str, False, None, True), - ("teardown", "teardown", TestScriptTeardown, False, None, False), - ("test", "test", TestScriptTest, True, None, False), - ("title", "title", str, False, None, False), - ("url", "url", str, False, None, True), - ("useContext", "useContext", usagecontext.UsageContext, True, None, False), - ("variable", "variable", TestScriptVariable, True, None, False), - ("version", "version", str, False, None, False), - ]) - return js - - -from . import backboneelement - -class TestScriptDestination(backboneelement.BackboneElement): - """ An abstract server representing a destination or receiver in a message - exchange. - - An abstract server used in operations within this test script in the - destination element. - """ - - resource_type = "TestScriptDestination" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.index = None - """ The index of the abstract destination server starting at 1. - Type `int`. """ - - self.profile = None - """ FHIR-Server | FHIR-SDC-FormManager | FHIR-SDC-FormReceiver | FHIR- - SDC-FormProcessor. - Type `Coding` (represented as `dict` in JSON). """ - - super(TestScriptDestination, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestScriptDestination, self).elementProperties() - js.extend([ - ("index", "index", int, False, None, True), - ("profile", "profile", coding.Coding, False, None, True), - ]) - return js - - -class TestScriptFixture(backboneelement.BackboneElement): - """ Fixture in the test script - by reference (uri). - - Fixture in the test script - by reference (uri). All fixtures are required - for the test script to execute. - """ - - resource_type = "TestScriptFixture" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.autocreate = None - """ Whether or not to implicitly create the fixture during setup. - Type `bool`. """ - - self.autodelete = None - """ Whether or not to implicitly delete the fixture during teardown. - Type `bool`. """ - - self.resource = None - """ Reference of the resource. - 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, True), - ("autodelete", "autodelete", bool, False, None, True), - ("resource", "resource", fhirreference.FHIRReference, False, None, False), - ]) - return js - - -class TestScriptMetadata(backboneelement.BackboneElement): - """ Required capability that is assumed to function correctly on the FHIR - server being tested. - - The required capability must exist and are assumed to function correctly on - the FHIR server being tested. - """ - - resource_type = "TestScriptMetadata" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Capabilities that are assumed to function correctly on the FHIR - server being tested. - List of `TestScriptMetadataCapability` items (represented as `dict` in JSON). """ - - self.link = None - """ Links to the FHIR specification. - List of `TestScriptMetadataLink` items (represented as `dict` in JSON). """ - - super(TestScriptMetadata, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestScriptMetadata, self).elementProperties() - js.extend([ - ("capability", "capability", TestScriptMetadataCapability, True, None, True), - ("link", "link", TestScriptMetadataLink, True, None, False), - ]) - return js - - -class TestScriptMetadataCapability(backboneelement.BackboneElement): - """ Capabilities that are assumed to function correctly on the FHIR server - being tested. - - Capabilities that must exist and are assumed to function correctly on the - FHIR server being tested. - """ - - resource_type = "TestScriptMetadataCapability" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.capabilities = None - """ Required Capability Statement. - Type `str`. """ - - self.description = None - """ The expected capabilities of the server. - Type `str`. """ - - self.destination = None - """ Which server these requirements apply to. - Type `int`. """ - - self.link = None - """ Links to the FHIR specification. - List of `str` items. """ - - self.origin = None - """ Which origin server these requirements apply to. - List of `int` items. """ - - self.required = None - """ Are the capabilities required?. - Type `bool`. """ - - self.validated = None - """ Are the capabilities validated?. - Type `bool`. """ - - super(TestScriptMetadataCapability, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestScriptMetadataCapability, self).elementProperties() - js.extend([ - ("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, True), - ("validated", "validated", bool, False, None, True), - ]) - return js - - -class TestScriptMetadataLink(backboneelement.BackboneElement): - """ Links to the FHIR specification. - - A link to the FHIR specification that this test is covering. - """ - - resource_type = "TestScriptMetadataLink" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Short description. - Type `str`. """ - - self.url = None - """ URL to the specification. - Type `str`. """ - - super(TestScriptMetadataLink, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestScriptMetadataLink, self).elementProperties() - js.extend([ - ("description", "description", str, False, None, False), - ("url", "url", str, False, None, True), - ]) - return js - - -class TestScriptOrigin(backboneelement.BackboneElement): - """ An abstract server representing a client or sender in a message exchange. - - An abstract server used in operations within this test script in the origin - element. - """ - - resource_type = "TestScriptOrigin" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.index = None - """ The index of the abstract origin server starting at 1. - Type `int`. """ - - self.profile = None - """ FHIR-Client | FHIR-SDC-FormFiller. - Type `Coding` (represented as `dict` in JSON). """ - - super(TestScriptOrigin, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestScriptOrigin, self).elementProperties() - js.extend([ - ("index", "index", int, False, None, True), - ("profile", "profile", coding.Coding, False, None, True), - ]) - return js - - -class TestScriptSetup(backboneelement.BackboneElement): - """ A series of required setup operations before tests are executed. - """ - - resource_type = "TestScriptSetup" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ A setup operation or assert to perform. - List of `TestScriptSetupAction` items (represented as `dict` in JSON). """ - - super(TestScriptSetup, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestScriptSetup, self).elementProperties() - js.extend([ - ("action", "action", TestScriptSetupAction, True, None, True), - ]) - return js - - -class TestScriptSetupAction(backboneelement.BackboneElement): - """ A setup operation or assert to perform. - - Action would contain either an operation or an assertion. - """ - - resource_type = "TestScriptSetupAction" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.assert_fhir = None - """ The assertion to perform. - Type `TestScriptSetupActionAssert` (represented as `dict` in JSON). """ - - self.operation = None - """ The setup operation to perform. - Type `TestScriptSetupActionOperation` (represented as `dict` in JSON). """ - - super(TestScriptSetupAction, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestScriptSetupAction, self).elementProperties() - js.extend([ - ("assert_fhir", "assert", TestScriptSetupActionAssert, False, None, False), - ("operation", "operation", TestScriptSetupActionOperation, False, None, False), - ]) - return js - - -class TestScriptSetupActionAssert(backboneelement.BackboneElement): - """ The assertion to perform. - - Evaluates the results of previous operations to determine if the server - under test behaves appropriately. - """ - - resource_type = "TestScriptSetupActionAssert" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.compareToSourceExpression = None - """ The FHIRPath expression to evaluate against the source fixture. - Type `str`. """ - - self.compareToSourceId = None - """ Id of the source fixture to be evaluated. - Type `str`. """ - - self.compareToSourcePath = None - """ XPath or JSONPath expression to evaluate against the source fixture. - Type `str`. """ - - self.contentType = None - """ Mime type to compare against the 'Content-Type' header. - Type `str`. """ - - self.description = None - """ Tracking/reporting assertion description. - Type `str`. """ - - self.direction = None - """ response | request. - Type `str`. """ - - self.expression = None - """ The FHIRPath expression to be evaluated. - Type `str`. """ - - self.headerField = None - """ HTTP header field name. - Type `str`. """ - - self.label = None - """ Tracking/logging assertion label. - Type `str`. """ - - self.minimumId = None - """ Fixture Id of minimum content resource. - Type `str`. """ - - self.navigationLinks = None - """ Perform validation on navigation links?. - Type `bool`. """ - - self.operator = None - """ equals | notEquals | in | notIn | greaterThan | lessThan | empty | - notEmpty | contains | notContains | eval. - Type `str`. """ - - self.path = None - """ XPath or JSONPath expression. - Type `str`. """ - - self.requestMethod = None - """ delete | get | options | patch | post | put | head. - Type `str`. """ - - self.requestURL = None - """ Request URL comparison value. - Type `str`. """ - - self.resource = None - """ Resource type. - Type `str`. """ - - self.response = None - """ okay | created | noContent | notModified | bad | forbidden | - notFound | methodNotAllowed | conflict | gone | preconditionFailed - | unprocessable. - Type `str`. """ - - self.responseCode = None - """ HTTP response code to test. - Type `str`. """ - - self.sourceId = None - """ Fixture Id of source expression or headerField. - Type `str`. """ - - self.validateProfileId = None - """ Profile Id of validation profile reference. - Type `str`. """ - - self.value = None - """ The value to compare to. - Type `str`. """ - - self.warningOnly = None - """ Will this assert produce a warning only on error?. - Type `bool`. """ - - super(TestScriptSetupActionAssert, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestScriptSetupActionAssert, self).elementProperties() - js.extend([ - ("compareToSourceExpression", "compareToSourceExpression", str, False, None, False), - ("compareToSourceId", "compareToSourceId", str, False, None, False), - ("compareToSourcePath", "compareToSourcePath", str, False, None, False), - ("contentType", "contentType", str, False, None, False), - ("description", "description", str, False, None, False), - ("direction", "direction", str, False, None, False), - ("expression", "expression", str, False, None, False), - ("headerField", "headerField", str, False, None, False), - ("label", "label", str, False, None, False), - ("minimumId", "minimumId", str, False, None, False), - ("navigationLinks", "navigationLinks", bool, False, None, False), - ("operator", "operator", str, False, None, False), - ("path", "path", str, False, None, False), - ("requestMethod", "requestMethod", str, False, None, False), - ("requestURL", "requestURL", str, False, None, False), - ("resource", "resource", str, False, None, False), - ("response", "response", str, False, None, False), - ("responseCode", "responseCode", str, 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, True), - ]) - return js - - -class TestScriptSetupActionOperation(backboneelement.BackboneElement): - """ The setup operation to perform. - - The operation to perform. - """ - - resource_type = "TestScriptSetupActionOperation" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.accept = None - """ Mime type to accept in the payload of the response, with charset - etc.. - Type `str`. """ - - self.contentType = None - """ Mime type of the request payload contents, with charset etc.. - Type `str`. """ - - self.description = None - """ Tracking/reporting operation description. - Type `str`. """ - - self.destination = None - """ Server responding to the request. - Type `int`. """ - - self.encodeRequestUrl = None - """ Whether or not to send the request url in encoded format. - Type `bool`. """ - - self.label = None - """ 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`. """ - - self.params = None - """ Explicitly defined path parameters. - Type `str`. """ - - self.requestHeader = None - """ Each operation can have one or more header elements. - List of `TestScriptSetupActionOperationRequestHeader` items (represented as `dict` in JSON). """ - - self.requestId = None - """ Fixture Id of mapped request. - Type `str`. """ - - self.resource = None - """ Resource type. - Type `str`. """ - - self.responseId = None - """ Fixture Id of mapped response. - Type `str`. """ - - self.sourceId = None - """ Fixture Id of body for PUT and POST requests. - Type `str`. """ - - self.targetId = None - """ Id of fixture used for extracting the [id], [type], and [vid] for - GET requests. - Type `str`. """ - - self.type = None - """ The operation code type that will be executed. - Type `Coding` (represented as `dict` in JSON). """ - - self.url = None - """ Request URL. - Type `str`. """ - - super(TestScriptSetupActionOperation, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestScriptSetupActionOperation, self).elementProperties() - js.extend([ - ("accept", "accept", str, False, None, False), - ("contentType", "contentType", str, False, None, False), - ("description", "description", str, False, None, False), - ("destination", "destination", int, 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), - ("requestId", "requestId", str, False, None, False), - ("resource", "resource", str, False, None, False), - ("responseId", "responseId", str, False, None, False), - ("sourceId", "sourceId", str, False, None, False), - ("targetId", "targetId", str, False, None, False), - ("type", "type", coding.Coding, False, None, False), - ("url", "url", str, False, None, False), - ]) - return js - - -class TestScriptSetupActionOperationRequestHeader(backboneelement.BackboneElement): - """ Each operation can have one or more header elements. - - Header elements would be used to set HTTP headers. - """ - - resource_type = "TestScriptSetupActionOperationRequestHeader" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.field = None - """ HTTP header field name. - Type `str`. """ - - self.value = None - """ HTTP headerfield value. - Type `str`. """ - - super(TestScriptSetupActionOperationRequestHeader, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestScriptSetupActionOperationRequestHeader, self).elementProperties() - js.extend([ - ("field", "field", str, False, None, True), - ("value", "value", str, False, None, True), - ]) - return js - - -class TestScriptTeardown(backboneelement.BackboneElement): - """ A series of required clean up steps. - - A series of operations required to clean up after all the tests are - executed (successfully or otherwise). - """ - - resource_type = "TestScriptTeardown" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ One or more teardown operations to perform. - List of `TestScriptTeardownAction` items (represented as `dict` in JSON). """ - - super(TestScriptTeardown, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestScriptTeardown, self).elementProperties() - js.extend([ - ("action", "action", TestScriptTeardownAction, True, None, True), - ]) - return js - - -class TestScriptTeardownAction(backboneelement.BackboneElement): - """ One or more teardown operations to perform. - - The teardown action will only contain an operation. - """ - - resource_type = "TestScriptTeardownAction" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.operation = None - """ The teardown operation to perform. - Type `TestScriptSetupActionOperation` (represented as `dict` in JSON). """ - - super(TestScriptTeardownAction, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestScriptTeardownAction, self).elementProperties() - js.extend([ - ("operation", "operation", TestScriptSetupActionOperation, False, None, True), - ]) - return js - - -class TestScriptTest(backboneelement.BackboneElement): - """ A test in this script. - """ - - resource_type = "TestScriptTest" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ A test operation or assert to perform. - List of `TestScriptTestAction` items (represented as `dict` in JSON). """ - - self.description = None - """ Tracking/reporting short description of the test. - Type `str`. """ - - self.name = None - """ Tracking/logging name of this test. - Type `str`. """ - - super(TestScriptTest, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestScriptTest, self).elementProperties() - js.extend([ - ("action", "action", TestScriptTestAction, True, None, True), - ("description", "description", str, False, None, False), - ("name", "name", str, False, None, False), - ]) - return js - - -class TestScriptTestAction(backboneelement.BackboneElement): - """ A test operation or assert to perform. - - Action would contain either an operation or an assertion. - """ - - resource_type = "TestScriptTestAction" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.assert_fhir = None - """ The setup assertion to perform. - Type `TestScriptSetupActionAssert` (represented as `dict` in JSON). """ - - self.operation = None - """ The setup operation to perform. - Type `TestScriptSetupActionOperation` (represented as `dict` in JSON). """ - - super(TestScriptTestAction, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestScriptTestAction, self).elementProperties() - js.extend([ - ("assert_fhir", "assert", TestScriptSetupActionAssert, False, None, False), - ("operation", "operation", TestScriptSetupActionOperation, False, None, False), - ]) - return js - - -class TestScriptVariable(backboneelement.BackboneElement): - """ Placeholder for evaluated elements. - - Variable is set based either on element value in response body or on header - field value in the response headers. - """ - - resource_type = "TestScriptVariable" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.defaultValue = None - """ Default, hard-coded, or user-defined value for this variable. - Type `str`. """ - - self.description = None - """ Natural language description of the variable. - Type `str`. """ - - self.expression = None - """ The FHIRPath expression against the fixture body. - Type `str`. """ - - self.headerField = None - """ HTTP header field name for source. - Type `str`. """ - - self.hint = None - """ Hint help text for default value to enter. - Type `str`. """ - - self.name = None - """ Descriptive name for this variable. - Type `str`. """ - - self.path = None - """ XPath or JSONPath against the fixture body. - Type `str`. """ - - self.sourceId = None - """ Fixture Id of source expression or headerField within this variable. - Type `str`. """ - - super(TestScriptVariable, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestScriptVariable, self).elementProperties() - js.extend([ - ("defaultValue", "defaultValue", str, False, None, False), - ("description", "description", str, False, None, False), - ("expression", "expression", str, False, None, False), - ("headerField", "headerField", str, False, None, False), - ("hint", "hint", str, False, None, False), - ("name", "name", str, False, None, True), - ("path", "path", str, False, None, False), - ("sourceId", "sourceId", str, 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 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 usagecontext -except ImportError: - usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/testscript_tests.py b/fhirclient/models/testscript_tests.py deleted file mode 100644 index 5f1f74adf..000000000 --- a/fhirclient/models/testscript_tests.py +++ /dev/null @@ -1,774 +0,0 @@ -#!/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 testscript -from .fhirdate import FHIRDate - - -class TestScriptTests(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("TestScript", js["resourceType"]) - return testscript.TestScript(js) - - def testTestScript1(self): - inst = self.instantiate_from("testscript-example-multisystem.json") - self.assertIsNotNone(inst, "Must have instantiated a TestScript instance") - self.implTestScript1(inst) - - js = inst.as_json() - self.assertEqual("TestScript", js["resourceType"]) - inst2 = testscript.TestScript(js) - 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.assertEqual(inst.destination[0].index, 1) - self.assertEqual(inst.destination[0].profile.code, "FHIR-Server") - self.assertEqual(inst.destination[1].index, 2) - self.assertEqual(inst.destination[1].profile.code, "FHIR-Server") - self.assertTrue(inst.experimental) - self.assertEqual(inst.id, "testscript-example-multisystem") - 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.9878") - 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") - self.assertEqual(inst.metadata.capability[1].origin[0], 1) - self.assertTrue(inst.metadata.capability[1].required) - self.assertFalse(inst.metadata.capability[1].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-multisystem") - self.assertEqual(inst.origin[0].index, 1) - self.assertEqual(inst.origin[0].profile.code, "FHIR-Client") - 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.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://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") - self.assertEqual(inst.test[1].action[0].operation.accept, "xml") - 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://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") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.title, "Multisystem Test Script") - self.assertEqual(inst.url, "http://hl7.org/fhir/TestScript/testscript-example-multisystem") - self.assertEqual(inst.variable[0].defaultValue, "example") - self.assertEqual(inst.variable[0].name, "Dest1PatientResourceId") - self.assertEqual(inst.variable[1].defaultValue, "example") - self.assertEqual(inst.variable[1].name, "Dest2PatientResourceId") - self.assertEqual(inst.version, "1.0") - - def testTestScript2(self): - inst = self.instantiate_from("testscript-example-history.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") - 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].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 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.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, "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.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.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-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 testTestScript3(self): - inst = self.instantiate_from("testscript-example-update.json") - self.assertIsNotNone(inst, "Must have instantiated a TestScript instance") - self.implTestScript3(inst) - - js = inst.as_json() - self.assertEqual("TestScript", js["resourceType"]) - inst2 = testscript.TestScript(js) - self.implTestScript3(inst2) - - 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") - 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].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 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.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, "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://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.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.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.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.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].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 testTestScript4(self): - inst = self.instantiate_from("testscript-example-search.json") - self.assertIsNotNone(inst, "Must have instantiated a TestScript instance") - self.implTestScript4(inst) - - js = inst.as_json() - self.assertEqual("TestScript", js["resourceType"]) - inst2 = testscript.TestScript(js) - self.implTestScript4(inst2) - - 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") - 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 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") - self.assertEqual(inst.identifier.value, "urn:oid:1.3.6.1.4.1.21367.2005.3.7.9881") - 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") - self.assertEqual(inst.publisher, "HL7") - 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://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://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://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://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") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.url, "http://hl7.org/fhir/TestScript/testscript-example-search") - self.assertEqual(inst.variable[0].headerField, "Location") - self.assertEqual(inst.variable[0].name, "PatientCreateLocation") - self.assertEqual(inst.variable[0].sourceId, "PatientCreateResponse") - self.assertEqual(inst.variable[1].description, "Enter patient search criteria for a known family name on the target system") - self.assertEqual(inst.variable[1].hint, "[Family name]") - self.assertEqual(inst.variable[1].name, "PatientSearchFamilyName") - self.assertEqual(inst.variable[2].description, "Enter patient search criteria for a known given name on the target system") - self.assertEqual(inst.variable[2].hint, "[Given name]") - self.assertEqual(inst.variable[2].name, "PatientSearchGivenName") - self.assertEqual(inst.variable[3].description, "Evaluate the returned Patient searchset Bundle.total value") - self.assertEqual(inst.variable[3].expression, "Bundle.total.toInteger()") - self.assertEqual(inst.variable[3].name, "PatientSearchBundleTotal") - self.assertEqual(inst.version, "1.0") - - def testTestScript5(self): - inst = self.instantiate_from("testscript-example.json") - self.assertIsNotNone(inst, "Must have instantiated a TestScript instance") - self.implTestScript5(inst) - - js = inst.as_json() - self.assertEqual("TestScript", js["resourceType"]) - inst2 = testscript.TestScript(js) - self.implTestScript5(inst2) - - 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") - 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 read the created 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") - 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.9876") - 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") - self.assertEqual(inst.publisher, "HL7") - 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://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.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://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://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://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.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) - 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.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://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://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 deleted file mode 100644 index 9b10bc131..000000000 --- a/fhirclient/models/timing.py +++ /dev/null @@ -1,186 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Timing) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import backboneelement - -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 - to record when things are planned, expected or requested to occur. The most - common usage is in dosage instructions for medications. They are also used - when planning care of various kinds, and may be used for reporting the - schedule to which past regular activities were carried out. - """ - - resource_type = "Timing" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ BID | TID | QID | AM | PM | QD | QOD | +. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.event = None - """ When the event occurs. - List of `FHIRDate` items (represented as `str` in JSON). """ - - self.repeat = None - """ When the event is to occur. - Type `TimingRepeat` (represented as `dict` in JSON). """ - - super(Timing, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(Timing, self).elementProperties() - js.extend([ - ("code", "code", codeableconcept.CodeableConcept, False, None, False), - ("event", "event", fhirdate.FHIRDate, True, None, False), - ("repeat", "repeat", TimingRepeat, False, None, False), - ]) - return js - - -from . import element - -class TimingRepeat(element.Element): - """ When the event is to occur. - - A set of rules that describe when the event is scheduled. - """ - - resource_type = "TimingRepeat" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.boundsDuration = None - """ Length/Range of lengths, or (Start and/or end) limits. - Type `Duration` (represented as `dict` in JSON). """ - - self.boundsPeriod = None - """ Length/Range of lengths, or (Start and/or end) limits. - Type `Period` (represented as `dict` in JSON). """ - - self.boundsRange = None - """ Length/Range of lengths, or (Start and/or end) limits. - Type `Range` (represented as `dict` in JSON). """ - - self.count = None - """ Number of times to repeat. - Type `int`. """ - - self.countMax = None - """ Maximum number of times to repeat. - Type `int`. """ - - self.dayOfWeek = None - """ mon | tue | wed | thu | fri | sat | sun. - List of `str` items. """ - - self.duration = None - """ How long when it happens. - Type `float`. """ - - self.durationMax = None - """ How long when it happens (Max). - Type `float`. """ - - self.durationUnit = None - """ s | min | h | d | wk | mo | a - unit of time (UCUM). - Type `str`. """ - - self.frequency = None - """ Event occurs frequency times per period. - Type `int`. """ - - self.frequencyMax = None - """ Event occurs up to frequencyMax times per period. - Type `int`. """ - - self.offset = None - """ Minutes from event (before or after). - Type `int`. """ - - self.period = None - """ Event occurs frequency times per period. - Type `float`. """ - - self.periodMax = None - """ Upper limit of period (3-4 hours). - Type `float`. """ - - self.periodUnit = None - """ s | min | h | d | wk | mo | a - unit of time (UCUM). - Type `str`. """ - - self.timeOfDay = None - """ Time of day for action. - List of `FHIRDate` items (represented as `str` in JSON). """ - - self.when = None - """ Code for time period of occurrence. - List of `str` items. """ - - super(TimingRepeat, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TimingRepeat, self).elementProperties() - js.extend([ - ("boundsDuration", "boundsDuration", duration.Duration, False, "bounds", False), - ("boundsPeriod", "boundsPeriod", period.Period, False, "bounds", False), - ("boundsRange", "boundsRange", range.Range, False, "bounds", False), - ("count", "count", int, False, None, False), - ("countMax", "countMax", int, False, None, False), - ("dayOfWeek", "dayOfWeek", str, True, None, False), - ("duration", "duration", float, False, None, False), - ("durationMax", "durationMax", float, False, None, False), - ("durationUnit", "durationUnit", str, False, None, False), - ("frequency", "frequency", int, False, None, False), - ("frequencyMax", "frequencyMax", int, False, None, False), - ("offset", "offset", int, False, None, False), - ("period", "period", float, False, None, False), - ("periodMax", "periodMax", float, False, None, False), - ("periodUnit", "periodUnit", str, False, None, False), - ("timeOfDay", "timeOfDay", fhirdate.FHIRDate, True, None, False), - ("when", "when", str, True, 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 fhirdate -except ImportError: - fhirdate = sys.modules[__package__ + '.fhirdate'] -try: - 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/triggerdefinition.py b/fhirclient/models/triggerdefinition.py deleted file mode 100644 index b3004606e..000000000 --- a/fhirclient/models/triggerdefinition.py +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/TriggerDefinition) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import element - -class TriggerDefinition(element.Element): - """ Defines an expected trigger for a module. - - 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" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.condition = None - """ Whether the event triggers (boolean expression). - Type `Expression` (represented as `dict` in JSON). """ - - 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.timingDate = None - """ Timing of the event. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.timingDateTime = None - """ Timing of the event. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.timingReference = None - """ Timing of the event. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.timingTiming = None - """ Timing of the event. - Type `Timing` (represented as `dict` in JSON). """ - - self.type = None - """ 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) - - def elementProperties(self): - js = super(TriggerDefinition, self).elementProperties() - js.extend([ - ("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 - - -import sys -try: - 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: - fhirdate = sys.modules[__package__ + '.fhirdate'] -try: - from . import fhirreference -except ImportError: - fhirreference = sys.modules[__package__ + '.fhirreference'] -try: - from . import timing -except ImportError: - timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/usagecontext.py b/fhirclient/models/usagecontext.py deleted file mode 100644 index 24056aed8..000000000 --- a/fhirclient/models/usagecontext.py +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/UsageContext) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import element - -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, - 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). - """ - - resource_type = "UsageContext" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 context being specified. - Type `Coding` (represented as `dict` in JSON). """ - - self.valueCodeableConcept = None - """ Value that defines the context. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.valueQuantity = None - """ Value that defines the context. - Type `Quantity` (represented as `dict` in JSON). """ - - self.valueRange = None - """ 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): - js = super(UsageContext, self).elementProperties() - js.extend([ - ("code", "code", coding.Coding, False, None, True), - ("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 - - -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 fhirreference -except ImportError: - fhirreference = sys.modules[__package__ + '.fhirreference'] -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/valueset.py b/fhirclient/models/valueset.py deleted file mode 100644 index 5465bdabd..000000000 --- a/fhirclient/models/valueset.py +++ /dev/null @@ -1,566 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ValueSet) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class ValueSet(domainresource.DomainResource): - """ 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" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.compose = None - """ Content logical definition of the value set (CLD). - Type `ValueSetCompose` (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 value set. - Type `str`. """ - - self.expansion = None - """ Used when the value set is "expanded". - Type `ValueSetExpansion` (represented as `dict` in JSON). """ - - self.experimental = None - """ For testing purposes, not real usage. - Type `bool`. """ - - self.identifier = None - """ Additional identifier for the value set (business identifier). - List of `Identifier` items (represented as `dict` in JSON). """ - - self.immutable = None - """ Indicates whether or not any change to the content logical - definition may occur. - Type `bool`. """ - - self.jurisdiction = None - """ Intended jurisdiction for value set (if applicable). - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.name = None - """ Name for this value set (computer friendly). - Type `str`. """ - - self.publisher = None - """ Name of the publisher (organization or individual). - Type `str`. """ - - self.purpose = None - """ Why this value set is defined. - Type `str`. """ - - self.status = None - """ draft | active | retired | unknown. - Type `str`. """ - - self.title = None - """ Name for this value set (human friendly). - Type `str`. """ - - self.url = None - """ Canonical identifier for this value set, 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 value set. - Type `str`. """ - - super(ValueSet, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ValueSet, self).elementProperties() - js.extend([ - ("compose", "compose", ValueSetCompose, False, 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), - ("expansion", "expansion", ValueSetExpansion, False, None, False), - ("experimental", "experimental", bool, False, None, False), - ("identifier", "identifier", identifier.Identifier, True, None, False), - ("immutable", "immutable", bool, False, None, False), - ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), - ("name", "name", str, False, None, False), - ("publisher", "publisher", str, False, None, False), - ("purpose", "purpose", str, False, None, False), - ("status", "status", str, False, None, True), - ("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 ValueSetCompose(backboneelement.BackboneElement): - """ Content logical definition of the value set (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" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ Explicitly exclude codes from a code system or other value sets. - List of `ValueSetComposeInclude` items (represented as `dict` in JSON). """ - - self.inactive = None - """ Whether inactive codes are in the value set. - Type `bool`. """ - - self.include = None - """ Include one or more codes from a code system or other value set(s). - List of `ValueSetComposeInclude` items (represented as `dict` in JSON). """ - - self.lockedDate = None - """ Fixed date for references with no specified version (transitive). - Type `FHIRDate` (represented as `str` in JSON). """ - - super(ValueSetCompose, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ValueSetCompose, self).elementProperties() - js.extend([ - ("exclude", "exclude", ValueSetComposeInclude, True, None, False), - ("inactive", "inactive", bool, False, None, False), - ("include", "include", ValueSetComposeInclude, True, None, True), - ("lockedDate", "lockedDate", fhirdate.FHIRDate, False, None, False), - ]) - return js - - -class ValueSetComposeInclude(backboneelement.BackboneElement): - """ Include one or more codes from a code system or other value set(s). - """ - - resource_type = "ValueSetComposeInclude" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.concept = None - """ A concept defined in the system. - List of `ValueSetComposeIncludeConcept` items (represented as `dict` in JSON). """ - - self.filter = None - """ Select codes/concepts by their properties (including relationships). - List of `ValueSetComposeIncludeFilter` items (represented as `dict` in JSON). """ - - self.system = None - """ The system the codes come from. - Type `str`. """ - - self.valueSet = None - """ Select the contents included in this value set. - List of `str` items. """ - - self.version = None - """ Specific version of the code system referred to. - Type `str`. """ - - super(ValueSetComposeInclude, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ValueSetComposeInclude, self).elementProperties() - js.extend([ - ("concept", "concept", ValueSetComposeIncludeConcept, True, None, False), - ("filter", "filter", ValueSetComposeIncludeFilter, True, None, False), - ("system", "system", str, False, None, False), - ("valueSet", "valueSet", str, True, None, False), - ("version", "version", str, False, None, False), - ]) - return js - - -class ValueSetComposeIncludeConcept(backboneelement.BackboneElement): - """ A concept defined in the system. - - Specifies a concept to be included or excluded. - """ - - resource_type = "ValueSetComposeIncludeConcept" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 or expression from system. - Type `str`. """ - - self.designation = None - """ Additional representations for this concept. - List of `ValueSetComposeIncludeConceptDesignation` items (represented as `dict` in JSON). """ - - self.display = None - """ Text to display for this code for this value set in this valueset. - Type `str`. """ - - super(ValueSetComposeIncludeConcept, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ValueSetComposeIncludeConcept, self).elementProperties() - js.extend([ - ("code", "code", str, False, None, True), - ("designation", "designation", ValueSetComposeIncludeConceptDesignation, True, None, False), - ("display", "display", str, False, None, False), - ]) - return js - - -class ValueSetComposeIncludeConceptDesignation(backboneelement.BackboneElement): - """ Additional representations for this concept. - - Additional representations for this concept when used in this value set - - other languages, aliases, specialized purposes, used for particular - purposes, etc. - """ - - resource_type = "ValueSetComposeIncludeConceptDesignation" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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. - Type `str`. """ - - self.use = None - """ Types of uses of designations. - Type `Coding` (represented as `dict` in JSON). """ - - self.value = None - """ The text value for this designation. - Type `str`. """ - - super(ValueSetComposeIncludeConceptDesignation, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ValueSetComposeIncludeConceptDesignation, self).elementProperties() - js.extend([ - ("language", "language", str, False, None, False), - ("use", "use", coding.Coding, False, None, False), - ("value", "value", str, False, None, True), - ]) - return js - - -class ValueSetComposeIncludeFilter(backboneelement.BackboneElement): - """ Select codes/concepts by their properties (including relationships). - - 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" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.op = None - """ = | is-a | descendent-of | is-not-a | regex | in | not-in | - generalizes | exists. - Type `str`. """ - - self.property = None - """ A property/filter defined by the code system. - Type `str`. """ - - self.value = None - """ Code from the system, or regex criteria, or boolean value for - exists. - Type `str`. """ - - super(ValueSetComposeIncludeFilter, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ValueSetComposeIncludeFilter, self).elementProperties() - js.extend([ - ("op", "op", str, False, None, True), - ("property", "property", str, False, None, True), - ("value", "value", str, False, None, True), - ]) - return js - - -class ValueSetExpansion(backboneelement.BackboneElement): - """ Used when the value set is "expanded". - - A value set can also be "expanded", where the value set is turned into a - simple collection of enumerated codes. This element holds the expansion, if - it has been performed. - """ - - resource_type = "ValueSetExpansion" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.contains = None - """ Codes in the value set. - List of `ValueSetExpansionContains` items (represented as `dict` in JSON). """ - - self.identifier = None - """ Identifies the value set expansion (business identifier). - Type `str`. """ - - self.offset = None - """ Offset at which this resource starts. - Type `int`. """ - - self.parameter = None - """ Parameter that controlled the expansion process. - List of `ValueSetExpansionParameter` items (represented as `dict` in JSON). """ - - self.timestamp = None - """ Time ValueSet expansion happened. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.total = None - """ Total number of codes in the expansion. - Type `int`. """ - - super(ValueSetExpansion, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ValueSetExpansion, self).elementProperties() - js.extend([ - ("contains", "contains", ValueSetExpansionContains, True, None, False), - ("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), - ("total", "total", int, False, None, False), - ]) - return js - - -class ValueSetExpansionContains(backboneelement.BackboneElement): - """ Codes in the value set. - - The codes that are contained in the value set expansion. - """ - - resource_type = "ValueSetExpansionContains" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.abstract = None - """ If user cannot select this entry. - Type `bool`. """ - - self.code = None - """ Code - if blank, this is not a selectable code. - Type `str`. """ - - self.contains = None - """ Codes contained under this entry. - List of `ValueSetExpansionContains` items (represented as `dict` in JSON). """ - - self.designation = None - """ Additional representations for this item. - List of `ValueSetComposeIncludeConceptDesignation` items (represented as `dict` in JSON). """ - - self.display = None - """ User display for the concept. - Type `str`. """ - - self.inactive = None - """ If concept is inactive in the code system. - Type `bool`. """ - - self.system = None - """ System value for the code. - Type `str`. """ - - self.version = None - """ Version in which this code/display is defined. - Type `str`. """ - - super(ValueSetExpansionContains, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ValueSetExpansionContains, self).elementProperties() - js.extend([ - ("abstract", "abstract", bool, False, None, False), - ("code", "code", str, False, None, False), - ("contains", "contains", ValueSetExpansionContains, True, None, False), - ("designation", "designation", ValueSetComposeIncludeConceptDesignation, True, None, False), - ("display", "display", str, False, None, False), - ("inactive", "inactive", bool, False, None, False), - ("system", "system", str, False, None, False), - ("version", "version", str, False, None, False), - ]) - return js - - -class ValueSetExpansionParameter(backboneelement.BackboneElement): - """ Parameter that controlled the expansion process. - - A parameter that controlled the expansion process. These parameters may be - used by users of expanded value sets to check whether the expansion is - suitable for a particular purpose, or to pick the correct expansion. - """ - - resource_type = "ValueSetExpansionParameter" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 as assigned by the client or server. - Type `str`. """ - - self.valueBoolean = None - """ Value of the named parameter. - Type `bool`. """ - - self.valueCode = None - """ 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`. """ - - self.valueInteger = None - """ Value of the named parameter. - Type `int`. """ - - self.valueString = None - """ Value of the named parameter. - Type `str`. """ - - self.valueUri = None - """ Value of the named parameter. - Type `str`. """ - - super(ValueSetExpansionParameter, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ValueSetExpansionParameter, self).elementProperties() - js.extend([ - ("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), - ("valueUri", "valueUri", str, False, "value", 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 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/valueset_tests.py b/fhirclient/models/valueset_tests.py deleted file mode 100644 index 385ad8979..000000000 --- a/fhirclient/models/valueset_tests.py +++ /dev/null @@ -1,516 +0,0 @@ -#!/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 valueset -from .fhirdate import FHIRDate - - -class ValueSetTests(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("ValueSet", js["resourceType"]) - return valueset.ValueSet(js) - - def testValueSet1(self): - inst = self.instantiate_from("valueset-example.json") - self.assertIsNotNone(inst, "Must have instantiated a ValueSet instance") - self.implValueSet1(inst) - - js = inst.as_json() - self.assertEqual("ValueSet", js["resourceType"]) - inst2 = valueset.ValueSet(js) - 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") - self.assertEqual(inst.compose.include[0].system, "http://loinc.org") - 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.expansion.contains[0].code, "14647-2") - self.assertEqual(inst.expansion.contains[0].display, "Cholesterol [Moles/volume] in Serum or Plasma") - self.assertEqual(inst.expansion.contains[0].system, "http://loinc.org") - self.assertEqual(inst.expansion.contains[0].version, "2.50") - self.assertTrue(inst.expansion.contains[1].abstract) - self.assertEqual(inst.expansion.contains[1].contains[0].code, "2093-3") - self.assertEqual(inst.expansion.contains[1].contains[0].display, "Cholesterol [Mass/volume] in Serum or Plasma") - self.assertEqual(inst.expansion.contains[1].contains[0].system, "http://loinc.org") - self.assertEqual(inst.expansion.contains[1].contains[0].version, "2.50") - self.assertEqual(inst.expansion.contains[1].contains[1].code, "48620-9") - self.assertEqual(inst.expansion.contains[1].contains[1].display, "Cholesterol [Mass/volume] in Serum or Plasma ultracentrifugate") - self.assertEqual(inst.expansion.contains[1].contains[1].system, "http://loinc.org") - self.assertEqual(inst.expansion.contains[1].contains[1].version, "2.50") - self.assertEqual(inst.expansion.contains[1].contains[2].code, "9342-7") - self.assertEqual(inst.expansion.contains[1].contains[2].display, "Cholesterol [Percentile]") - self.assertEqual(inst.expansion.contains[1].contains[2].system, "http://loinc.org") - self.assertEqual(inst.expansion.contains[1].contains[2].version, "2.50") - self.assertEqual(inst.expansion.contains[1].display, "Cholesterol codes") - self.assertTrue(inst.expansion.contains[2].abstract) - self.assertEqual(inst.expansion.contains[2].contains[0].code, "2096-6") - self.assertEqual(inst.expansion.contains[2].contains[0].display, "Cholesterol/Triglyceride [Mass Ratio] in Serum or Plasma") - self.assertEqual(inst.expansion.contains[2].contains[0].system, "http://loinc.org") - self.assertEqual(inst.expansion.contains[2].contains[0].version, "2.50") - self.assertEqual(inst.expansion.contains[2].contains[1].code, "35200-5") - self.assertEqual(inst.expansion.contains[2].contains[1].display, "Cholesterol/Triglyceride [Mass Ratio] in Serum or Plasma") - self.assertEqual(inst.expansion.contains[2].contains[1].system, "http://loinc.org") - self.assertEqual(inst.expansion.contains[2].contains[1].version, "2.50") - self.assertEqual(inst.expansion.contains[2].contains[2].code, "48089-7") - self.assertEqual(inst.expansion.contains[2].contains[2].display, "Cholesterol/Apolipoprotein B [Molar ratio] in Serum or Plasma") - self.assertEqual(inst.expansion.contains[2].contains[2].system, "http://loinc.org") - self.assertEqual(inst.expansion.contains[2].contains[2].version, "2.50") - self.assertEqual(inst.expansion.contains[2].contains[3].code, "55838-7") - self.assertEqual(inst.expansion.contains[2].contains[3].display, "Cholesterol/Phospholipid [Molar ratio] in Serum or Plasma") - self.assertEqual(inst.expansion.contains[2].contains[3].system, "http://loinc.org") - self.assertEqual(inst.expansion.contains[2].contains[3].version, "2.50") - self.assertEqual(inst.expansion.contains[2].display, "Cholesterol Ratios") - self.assertEqual(inst.expansion.extension[0].url, "http://hl7.org/fhir/StructureDefinition/valueset-expansionSource") - self.assertEqual(inst.expansion.extension[0].valueUri, "http://hl7.org/fhir/ValueSet/example-extensional") - self.assertEqual(inst.expansion.identifier, "urn:uuid:42316ff8-2714-4680-9980-f37a6d1a71bc") - self.assertEqual(inst.expansion.offset, 0) - self.assertEqual(inst.expansion.parameter[0].name, "version") - self.assertEqual(inst.expansion.parameter[0].valueString, "2.50") - self.assertEqual(inst.expansion.timestamp.date, FHIRDate("2015-06-22T13:56:07Z").date) - self.assertEqual(inst.expansion.timestamp.as_json(), "2015-06-22T13:56:07Z") - self.assertEqual(inst.expansion.total, 8) - self.assertTrue(inst.experimental) - self.assertEqual(inst.id, "example-expansion") - 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, "FHIR Project team") - self.assertEqual(inst.status, "draft") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.url, "http://hl7.org/fhir/ValueSet/example-expansion") - self.assertEqual(inst.version, "20150622") - - def testValueSet4(self): - inst = self.instantiate_from("valueset-example-inactive.json") - self.assertIsNotNone(inst, "Must have instantiated a ValueSet instance") - self.implValueSet4(inst) - - js = inst.as_json() - self.assertEqual("ValueSet", js["resourceType"]) - inst2 = valueset.ValueSet(js) - self.implValueSet4(inst2) - - 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://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://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://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://terminology.hl7.org/CodeSystem/v3-ActMood") - self.assertEqual(inst.expansion.contains[1].display, "expectation") - 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://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") - self.assertEqual(inst.id, "inactive") - self.assertEqual(inst.name, "Example-inactive") - self.assertEqual(inst.status, "draft") - 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 testValueSet5(self): - inst = self.instantiate_from("valueset-example-filter.json") - self.assertIsNotNone(inst, "Must have instantiated a ValueSet instance") - self.implValueSet5(inst) - - js = inst.as_json() - self.assertEqual("ValueSet", js["resourceType"]) - inst2 = valueset.ValueSet(js) - self.implValueSet5(inst2) - - def implValueSet5(self, inst): - self.assertEqual(inst.compose.include[0].filter[0].op, "=") - 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.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-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.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 testValueSet6(self): - inst = self.instantiate_from("valueset-example-yesnodontknow.json") - self.assertIsNotNone(inst, "Must have instantiated a ValueSet instance") - self.implValueSet6(inst) - - js = inst.as_json() - self.assertEqual("ValueSet", js["resourceType"]) - inst2 = valueset.ValueSet(js) - self.implValueSet6(inst2) - - 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://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://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://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://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") - self.assertEqual(inst.id, "yesnodontknow") - self.assertEqual(inst.name, "Yes/No/Don't Know") - 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 testValueSet7(self): - inst = self.instantiate_from("valueset-examplescenario-actor-type.json") - self.assertIsNotNone(inst, "Must have instantiated a ValueSet instance") - self.implValueSet7(inst) - - js = inst.as_json() - self.assertEqual("ValueSet", js["resourceType"]) - inst2 = valueset.ValueSet(js) - self.implValueSet7(inst2) - - 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.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, "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/ValueSet/examplescenario-actor-type") - self.assertEqual(inst.version, "4.0.0") - - def testValueSet8(self): - inst = self.instantiate_from("valueset-list-example-codes.json") - self.assertIsNotNone(inst, "Must have instantiated a ValueSet instance") - self.implValueSet8(inst) - - js = inst.as_json() - self.assertEqual("ValueSet", js["resourceType"]) - inst2 = valueset.ValueSet(js) - self.implValueSet8(inst2) - - 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("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.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.316") - 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, "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, "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/visionprescription.py b/fhirclient/models/visionprescription.py deleted file mode 100644 index e94052e81..000000000 --- a/fhirclient/models/visionprescription.py +++ /dev/null @@ -1,233 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/VisionPrescription) on 2019-05-07. -# 2019, SMART Health IT. - - -from . import domainresource - -class VisionPrescription(domainresource.DomainResource): - """ Prescription for vision correction products for a patient. - - An authorization for the provision of glasses and/or contact lenses to a - patient. - """ - - resource_type = "VisionPrescription" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :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 - """ 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.encounter = None - """ Created during encounter / admission / stay. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.identifier = None - """ 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` (represented as `dict` in JSON). """ - - self.prescriber = None - """ Who authorized the vision prescription. - Type `FHIRReference` (represented as `dict` in JSON). """ - - self.status = None - """ active | cancelled | draft | entered-in-error. - Type `str`. """ - - super(VisionPrescription, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(VisionPrescription, self).elementProperties() - js.extend([ - ("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), - ("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 VisionPrescriptionLensSpecification(backboneelement.BackboneElement): - """ Vision lens authorization. - - Contain the details of the individual lens specifications and serves as - the authorization for the fullfillment by certified professionals. - """ - - resource_type = "VisionPrescriptionLensSpecification" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.add = None - """ Added power for multifocal levels. - Type `float`. """ - - self.axis = None - """ Lens meridian which contain no power for astigmatism. - Type `int`. """ - - self.backCurve = None - """ Contact lens back curvature. - Type `float`. """ - - self.brand = None - """ Brand required. - Type `str`. """ - - self.color = None - """ Color required. - Type `str`. """ - - self.cylinder = None - """ Lens power for astigmatism. - Type `float`. """ - - self.diameter = None - """ Contact lens diameter. - Type `float`. """ - - self.duration = None - """ Lens wear duration. - Type `Quantity` (represented as `dict` in JSON). """ - - self.eye = None - """ right | left. - Type `str`. """ - - self.note = None - """ Notes for coatings. - List of `Annotation` items (represented as `dict` in JSON). """ - - self.power = None - """ Contact lens power. - Type `float`. """ - - self.prism = None - """ 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 - """ Power of the lens. - Type `float`. """ - - super(VisionPrescriptionLensSpecification, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - 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), - ("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, True), - ("note", "note", annotation.Annotation, True, None, False), - ("power", "power", float, 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 -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 quantity -except ImportError: - quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/visionprescription_tests.py b/fhirclient/models/visionprescription_tests.py deleted file mode 100644 index 01a2d0a9d..000000000 --- a/fhirclient/models/visionprescription_tests.py +++ /dev/null @@ -1,120 +0,0 @@ -#!/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 visionprescription -from .fhirdate import FHIRDate - - -class VisionPrescriptionTests(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("VisionPrescription", js["resourceType"]) - return visionprescription.VisionPrescription(js) - - def testVisionPrescription1(self): - inst = self.instantiate_from("visionprescription-example-1.json") - self.assertIsNotNone(inst, "Must have instantiated a VisionPrescription instance") - self.implVisionPrescription1(inst) - - js = inst.as_json() - self.assertEqual("VisionPrescription", js["resourceType"]) - inst2 = visionprescription.VisionPrescription(js) - 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.id, "33124") - self.assertEqual(inst.identifier[0].system, "http://www.happysight.com/prescription") - self.assertEqual(inst.identifier[0].value, "15014") - 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") - - def testVisionPrescription2(self): - inst = self.instantiate_from("visionprescription-example.json") - self.assertIsNotNone(inst, "Must have instantiated a VisionPrescription instance") - self.implVisionPrescription2(inst) - - js = inst.as_json() - self.assertEqual("VisionPrescription", js["resourceType"]) - inst2 = visionprescription.VisionPrescription(js) - 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.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.py b/fhirclient/server.py index f97a1cd29..891d46f53 100644 --- a/fhirclient/server.py +++ b/fhirclient/server.py @@ -2,16 +2,23 @@ import json import requests -import urllib import logging +import importlib try: # Python 2.x import urlparse -except ImportError as e: # Python 3 +except ImportError: # Python 3 import urllib.parse as urlparse -from auth import FHIRAuth +from .auth import FHIRAuth +from .constants import FHIRVersion -FHIRJSONMimeType = 'application/fhir+json' +# DSTU2 is application/json+fhir, STU3/R4 is application/fhir+json +# https://www.hl7.org/fhir/DSTU2/http.html#mime-type +# https://www.hl7.org/fhir/R4/http.html#mime-type +FHIRJSONMimeTypes = { + FHIRVersion.DSTU2: "application/json+fhir" +} +FHIRJSONMimeTypeDefault = 'application/fhir+json' logger = logging.getLogger(__name__) @@ -40,8 +47,9 @@ def __init__(self, response): class FHIRServer(object): """ Handles talking to a FHIR server. """ - - def __init__(self, client, base_uri=None, state=None): + + def __init__(self, client, base_uri=None, state=None, version=None): + self.version = client.version if (version is None and client) else (version or FHIRVersion.R4) self.client = client self.auth = None self.base_uri = None @@ -49,111 +57,113 @@ def __init__(self, client, base_uri=None, state=None): # Use a single requests Session for all "requests" self.session = requests.Session() - + # A URI can't possibly be less than 11 chars # make sure we end with "/", otherwise the last path component will be # lost when creating URLs with urllib if base_uri is not None and len(base_uri) > 10: self.base_uri = base_uri if '/' == base_uri[-1] else base_uri + '/' self.aud = base_uri - self._capability = None + self._statement = None if state is not None: self.from_state(state) if not self.base_uri or len(self.base_uri) <= 10: raise Exception("FHIRServer must be initialized with `base_uri` or `state` containing the base-URI, but neither happened") - + def should_save_state(self): if self.client is not None: self.client.save_state() - - - # MARK: Server CapabilityStatement - + + # MARK: Server CapabilityStatement/Conformance + @property - def capabilityStatement(self): - self.get_capability() - return self._capability - - def get_capability(self, force=False): - """ Returns the server's CapabilityStatement, retrieving it if needed + def statement(self): + self.get_statement() + return self._statement + + def get_statement(self, force=False): + """ Returns the server's CapabilityStatement/Conformance, retrieving it if needed or forced. """ - if self._capability is None or force: - logger.info('Fetching CapabilityStatement from {0}'.format(self.base_uri)) - from models import capabilitystatement - conf = capabilitystatement.CapabilityStatement.read_from('metadata', self) - self._capability = conf - + if self._statement is None or force: + if self.version == FHIRVersion.DSTU2: + logger.info('Fetching Conformance statement from {0}'.format(self.base_uri)) + conformance = importlib.import_module("fhirclient.models.{}.conformance".format(self.version)) + conf = conformance.Conformance.read_from('metadata', self) + else: + logger.info('Fetching CapabilityStatement from {0}'.format(self.base_uri)) + capabilitystatement = importlib.import_module("fhirclient.models.{}.capabilitystatement".format(self.version)) + conf = capabilitystatement.CapabilityStatement.read_from('metadata', self) + self._statement = conf + security = None try: security = conf.rest[0].security - except Exception as e: + except Exception: logger.info("No REST security statement found in server capability statement") - + settings = { 'aud': self.aud, 'app_id': self.client.app_id if self.client is not None else None, 'app_secret': self.client.app_secret if self.client is not None else None, 'redirect_uri': self.client.redirect if self.client is not None else None, } - self.auth = FHIRAuth.from_capability_security(security, settings) + self.auth = FHIRAuth.from_security(security, settings) self.should_save_state() - - + # MARK: Authorization - + @property def desired_scope(self): return self.client.desired_scope if self.client is not None else None - + @property def launch_token(self): return self.client.launch_token if self.client is not None else None - + @property def authorize_uri(self): if self.auth is None: - self.get_capability() + self.get_statement() return self.auth.authorize_uri(self) - + def handle_callback(self, url): if self.auth is None: raise Exception("Not ready to handle callback, I do not have an auth instance") return self.auth.handle_callback(url, self) - + def reauthorize(self): if self.auth is None: raise Exception("Not ready to reauthorize, I do not have an auth instance") return self.auth.reauthorize(self) if self.auth is not None else None - - + # MARK: Requests - + @property def ready(self): """ Check whether the server is ready to make calls, i.e. is has fetched its capability statement and its `auth` instance is ready. - + :returns: True if the server can make authenticated calls """ return self.auth.ready if self.auth is not None else False - + def prepare(self): """ Check whether the server is ready to make calls, i.e. is has fetched its capability statement and its `auth` instance is ready. This method will fetch the capability statement if it hasn't already been fetched. - + :returns: True if the server can make authenticated calls """ if self.auth is None: - self.get_capability() + self.get_statement() return self.auth.ready if self.auth is not None else False - + def request_json(self, path, nosign=False): """ Perform a request for JSON data against the server's base with the given relative path. - + :param str path: The path to append to `base_uri` :param bool nosign: If set to True, the request will not be signed :throws: Exception on HTTP status >= 400 @@ -161,40 +171,40 @@ def request_json(self, path, nosign=False): """ headers = {'Accept': 'application/json'} res = self._get(path, headers, nosign) - + return res.json() - + def request_data(self, path, headers={}, nosign=False): """ Perform a data request data against the server's base with the given relative path. """ res = self._get(path, None, nosign) return res.content - + def _get(self, path, headers={}, nosign=False): """ Issues a GET request. - + :returns: The response object """ assert self.base_uri and path url = urlparse.urljoin(self.base_uri, path) - + headers = { - 'Accept': FHIRJSONMimeType, + 'Accept': FHIRJSONMimeTypes.get(self.version, FHIRJSONMimeTypeDefault), 'Accept-Charset': 'UTF-8', } if not nosign and self.auth is not None and self.auth.can_sign_headers(): headers = self.auth.signed_headers(headers) - + # perform the request but intercept 401 responses, raising our own Exception res = self.session.get(url, headers=headers) self.raise_for_status(res) return res - + def put_json(self, path, resource_json, nosign=False): """ Performs a PUT request of the given JSON, which should represent a resource, to the given relative path. - + :param str path: The path to append to `base_uri` :param dict resource_json: The JSON representing the resource :param bool nosign: If set to True, the request will not be signed @@ -203,22 +213,22 @@ def put_json(self, path, resource_json, nosign=False): """ url = urlparse.urljoin(self.base_uri, path) headers = { - 'Content-type': FHIRJSONMimeType, - 'Accept': FHIRJSONMimeType, + 'Content-type': FHIRJSONMimeTypes.get(self.version, FHIRJSONMimeTypeDefault), + 'Accept': FHIRJSONMimeTypes.get(self.version, FHIRJSONMimeTypeDefault), 'Accept-Charset': 'UTF-8', } if not nosign and self.auth is not None and self.auth.can_sign_headers(): headers = self.auth.signed_headers(headers) - + # perform the request but intercept 401 responses, raising our own Exception res = self.session.put(url, headers=headers, data=json.dumps(resource_json)) self.raise_for_status(res) return res - + def post_json(self, path, resource_json, nosign=False): """ Performs a POST of the given JSON, which should represent a resource, to the given relative path. - + :param str path: The path to append to `base_uri` :param dict resource_json: The JSON representing the resource :param bool nosign: If set to True, the request will not be signed @@ -227,59 +237,55 @@ def post_json(self, path, resource_json, nosign=False): """ url = urlparse.urljoin(self.base_uri, path) headers = { - 'Content-type': FHIRJSONMimeType, - 'Accept': FHIRJSONMimeType, + 'Content-type': FHIRJSONMimeTypes.get(self.version, FHIRJSONMimeTypeDefault), + 'Accept': FHIRJSONMimeTypes.get(self.version, FHIRJSONMimeTypeDefault), 'Accept-Charset': 'UTF-8', } if not nosign and self.auth is not None and self.auth.can_sign_headers(): headers = self.auth.signed_headers(headers) - + # perform the request but intercept 401 responses, raising our own Exception res = self.session.post(url, headers=headers, data=json.dumps(resource_json)) self.raise_for_status(res) return res - + def post_as_form(self, url, formdata, auth=None): """ Performs a POST request with form-data, expecting to receive JSON. This method is used in the OAuth2 token exchange and thus doesn't request fhir+json. - + :throws: Exception on HTTP status >= 400 :returns: The response object """ - headers = { - 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8', - 'Accept': 'application/json', - } res = self.session.post(url, data=formdata, auth=auth) self.raise_for_status(res) return res - + def delete_json(self, path, nosign=False): """ Issues a DELETE command against the given relative path, accepting a JSON response. - + :param str path: The relative URL path to issue a DELETE against :param bool nosign: If set to True, the request will not be signed :returns: The response object """ url = urlparse.urljoin(self.base_uri, path) headers = { - 'Accept': FHIRJSONMimeType, + 'Accept': FHIRJSONMimeTypes.get(self.version, FHIRJSONMimeTypeDefault), 'Accept-Charset': 'UTF-8', } if not nosign and self.auth is not None and self.auth.can_sign_headers(): headers = self.auth.signed_headers(headers) - + # perform the request but intercept 401 responses, raising our own Exception res = self.session.delete(url) self.raise_for_status(res) return res - + def raise_for_status(self, response): if response.status_code < 400: return - + if 401 == response.status_code: raise FHIRUnauthorizedException(response) elif 403 == response.status_code: @@ -288,24 +294,24 @@ def raise_for_status(self, response): raise FHIRNotFoundException(response) else: response.raise_for_status() - - + # MARK: State Handling - + @property def state(self): """ Return current state. """ return { + 'version': self.version, 'base_uri': self.base_uri, 'auth_type': self.auth.auth_type if self.auth is not None else 'none', 'auth': self.auth.state if self.auth is not None else None, } - + def from_state(self, state): """ Update ivars from given state information. """ assert state + self.version = state.get('version', self.version) self.base_uri = state.get('base_uri') or self.base_uri self.auth = FHIRAuth.create(state.get('auth_type'), state=state.get('auth')) - diff --git a/fhirclient/server_tests.py b/fhirclient/server_tests.py index 22ce2ebdf..2039359f5 100755 --- a/fhirclient/server_tests.py +++ b/fhirclient/server_tests.py @@ -5,41 +5,51 @@ import io import json import shutil -import server import unittest -import models.fhirabstractbase as fabst +from . import server +from .models.R4 import fhirabstractbase as fabst +from .constants import FHIRVersion class TestServer(unittest.TestCase): - + def tearDown(self): if os.path.exists('metadata'): os.remove('metadata') - - def testValidCapabilityStatement(self): - shutil.copyfile('test_metadata_valid.json', 'metadata') - mock = MockServer() - mock.get_capability() - + + def doValidStatement(self, metadata, version): + shutil.copyfile(metadata, 'metadata') + mock = MockServer(version=version) + mock.get_statement() + self.assertIsNotNone(mock.auth._registration_uri) self.assertIsNotNone(mock.auth._authorize_uri) self.assertIsNotNone(mock.auth._token_uri) - + + def testValidStatement_R4(self): + self.doValidStatement('fhirclient/fixtures/test_metadata_valid_R4.json', FHIRVersion.R4) + + def testValidStatement_STU3(self): + self.doValidStatement('fhirclient/fixtures/test_metadata_valid_STU3.json', FHIRVersion.STU3) + + def testValidStatement_DSTU2(self): + self.doValidStatement('fhirclient/fixtures/test_metadata_valid_DSTU2.json', FHIRVersion.DSTU2) + def testStateConservation(self): - shutil.copyfile('test_metadata_valid.json', 'metadata') + shutil.copyfile('fhirclient/fixtures/test_metadata_valid_R4.json', 'metadata') mock = MockServer() - self.assertIsNotNone(mock.capabilityStatement) - + self.assertIsNotNone(mock.statement) + fhir = server.FHIRServer(None, state=mock.state) self.assertIsNotNone(fhir.auth._registration_uri) self.assertIsNotNone(fhir.auth._authorize_uri) self.assertIsNotNone(fhir.auth._token_uri) - - def testInvalidCapabilityStatement(self): - shutil.copyfile('test_metadata_invalid.json', 'metadata') + + def testInvalidStatement(self): + shutil.copyfile('fhirclient/fixtures/test_metadata_invalid_R4.json', 'metadata') mock = MockServer() try: - mock.get_capability() + mock.statement() self.assertTrue(False, "Must have thrown exception") except fabst.FHIRValidationError as e: self.assertEqual(4, len(e.errors)) @@ -48,7 +58,7 @@ def testInvalidCapabilityStatement(self): 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("Wrong type ", str(e.errors[2].errors[0].errors[0].errors[0])[:25]) + self.assertIn("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]) @@ -59,14 +69,13 @@ def testInvalidCapabilityStatement(self): class MockServer(server.FHIRServer): """ Reads local files. """ - - def __init__(self): - super().__init__(None, base_uri='https://fhir.smarthealthit.org') - + + def __init__(self, version=None): + super(MockServer, self).__init__(None, base_uri='https://fhir.smarthealthit.org', version=version) + def request_json(self, path, nosign=False): assert path with io.open(path, encoding='utf-8') as handle: return json.load(handle) - + return None - diff --git a/flask_app.py b/flask_app.py index 6c06218e6..308e2e86e 100644 --- a/flask_app.py +++ b/flask_app.py @@ -2,8 +2,8 @@ import logging from fhirclient import client -from fhirclient.models.medication import Medication -from fhirclient.models.medicationrequest import MedicationRequest +from fhirclient.models.R4.medication import Medication +from fhirclient.models.R4.medicationrequest import MedicationRequest from flask import Flask, request, redirect, session @@ -16,9 +16,11 @@ app = Flask(__name__) + def _save_state(state): session['state'] = state + def _get_smart(): state = session.get('state') if state: @@ -26,15 +28,18 @@ def _get_smart(): else: return client.FHIRClient(settings=smart_defaults, save_func=_save_state) + def _logout(): if 'state' in session: smart = _get_smart() smart.reset_patient() + def _reset(): if 'state' in session: del session['state'] + def _get_prescriptions(smart): bundle = MedicationRequest.where({'patient': smart.patient_id}).perform(smart.server) pres = [be.resource for be in bundle.entry] if bundle is not None and bundle.entry is not None else None @@ -42,10 +47,12 @@ def _get_prescriptions(smart): return pres return None + def _get_medication_by_ref(ref, smart): med_id = ref.split("/")[1] return Medication.read(med_id, smart.server).code + def _med_name(med): if med.coding: name = next((coding.display for coding in med.coding if coding.system == 'http://www.nlm.nih.gov/research/umls/rxnorm'), None) @@ -55,6 +62,7 @@ def _med_name(med): return med.text return "Unnamed Medication(TM)" + def _get_med_name(prescription, client=None): if prescription.medicationCodeableConcept is not None: med = prescription.medicationCodeableConcept @@ -67,6 +75,7 @@ def _get_med_name(prescription, client=None): # views + @app.route('/') @app.route('/index.html') def index(): @@ -74,15 +83,15 @@ def index(): """ smart = _get_smart() body = "

Hello

" - + if smart.ready and smart.patient is not None: # "ready" may be true but the access token may have expired, making smart.patient = None name = smart.human_name(smart.patient.name[0] if smart.patient.name and len(smart.patient.name) > 0 else 'Unknown') - + # generate simple body text body += "

You are authorized and ready to make API requests for {0}.

".format(name) pres = _get_prescriptions(smart) if pres is not None: - body += "

{0} prescriptions:

  • {1}

".format("His" if 'male' == smart.patient.gender else "Her", '
  • '.join([_get_med_name(p,smart) for p in pres])) + body += "

    {0} prescriptions:

    • {1}

    ".format("His" if 'male' == smart.patient.gender else "Her", '
  • '.join([_get_med_name(p, smart) for p in pres])) else: body += "

    (There are no prescriptions for {0})

    ".format("him" if 'male' == smart.patient.gender else "her") body += """

    Change patient

    """ @@ -124,6 +133,6 @@ def reset(): if '__main__' == __name__: import flaskbeaker flaskbeaker.FlaskBeaker.setup_app(app) - + logging.basicConfig(level=logging.DEBUG) app.run(debug=True, port=8000) diff --git a/flaskbeaker.py b/flaskbeaker.py index daf3d2cb6..e856899e9 100644 --- a/flaskbeaker.py +++ b/flaskbeaker.py @@ -19,13 +19,13 @@ def setup_app(cls, app, session_opts=None): 'session.data_dir': './session_data', 'session.auto': True } - + app.wsgi_app = SessionMiddleware(app.wsgi_app, session_opts) app.session_interface = cls() - + def open_session(self, app, request): session = request.environ['beaker.session'] return session - + def save_session(self, app, session, response): session.save() diff --git a/generate_models.sh b/generate_models.sh index 9a162da62..eb7164070 100755 --- a/generate_models.sh +++ b/generate_models.sh @@ -1,9 +1,24 @@ #!/bin/bash -if [ ! -e fhir-parser ]; then - git submodule update --init --recursive -fi -cp fhir-parser-resources/settings.py fhir-parser/settings.py -cd fhir-parser -./generate.py $1 -cd .. +set -o errexit + +git submodule update --init --recursive + +for FHIR_VERSION in DSTU2 STU3 R4; do + if [ -d fhir-parser-$FHIR_VERSION ]; then + FHIR_PARSER=fhir-parser-$FHIR_VERSION + sed s/{FHIR_VERSION}/$FHIR_VERSION/g fhir-parser-resources/settings-$FHIR_VERSION.py > $FHIR_PARSER/settings.py + # We can't use tpl_unittest_source in settings because jinja2 won't load templates outside current dir, + # So we copy our template into the submodule in env which is .gitignored + mkdir -p $FHIR_PARSER/env + cp fhir-parser-resources/template-unittest.py $FHIR_PARSER/env + else + FHIR_PARSER=fhir-parser + sed s/{FHIR_VERSION}/$FHIR_VERSION/g fhir-parser-resources/settings.py > $FHIR_PARSER/settings.py + fi + ( + cd $FHIR_PARSER + #XXX this rmtrees with -f + ./generate.py -f $1 + ) +done diff --git a/setup.py b/setup.py index 6f7c22f80..7c6ed7ba0 100644 --- a/setup.py +++ b/setup.py @@ -4,6 +4,7 @@ from setuptools import setup, find_packages + def read(*parts): """ Build an absolute path from *parts* and and return the contents of the @@ -13,6 +14,7 @@ def read(*parts): with codecs.open(os.path.join(here, *parts), 'rb', 'utf-8') as f: return f.read() + def find_version(*file_paths): """ Build a path from *file_paths* and search for a ``__version__`` @@ -25,6 +27,7 @@ def find_version(*file_paths): return version_match.group(1) raise RuntimeError("Unable to find version string.") + setup( name='fhirclient', version=find_version("fhirclient/client.py"), @@ -38,6 +41,7 @@ def find_version(*file_paths): author_email='support@smarthealthit.org', packages=find_packages(exclude=['test*', '*_tests.py']), install_requires=['requests', 'isodate'], + tests_require=["flake8"], classifiers=[ 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', diff --git a/test_models.sh b/test_models.sh index 3441ab686..693a6f62f 100755 --- a/test_models.sh +++ b/test_models.sh @@ -1,30 +1,45 @@ #!/bin/bash -# set this to a relative path, from inside the fhirclient/models directory, to the downloaded FHIR spec directory -export FHIR_UNITTEST_DATADIR="../fhir-parser/downloads" +export PYTHONPATH=. +EXITCODE=0 -cd fhirclient +# set this to the downloaded FHIR spec directory +export FHIR_UNITTEST_DATADIR="./fhir-parser/downloads" -if [ ! -e $FHIR_UNITTEST_DATADIR ]; then - echo Unit tests depend on the downloaded FHIR spec, which is not present at $FHIR_UNITTEST_DATADIR. Cannot run unit tests. - exit 1 -fi echo 'import isodate' | python 2>/dev/null if [ $? -ne 0 ]; then echo You need to have the 'isodate' module installed in order to run the tests exit 1 fi -#python -m unittest discover ./models '*_tests.py' # ImportError -tests=(models/*_tests.py) -python -m unittest ${tests[@]} +for FHIR_VERSION in DSTU2 STU3 R4; do + +cat > fhir-parser/settings.py </dev/null if [ $? -eq 0 ]; then - python -m unittest server_tests.py fhirreference_tests.py + python -m unittest fhirclient.server_tests fhirclient.fhirreference_tests fhirclient.integration_tests || EXITCODE=1 else echo "You don't have the 'requests' module installed, will skip extra tests" fi -cd .. +echo 'import flake8' | python 2>/dev/null +if [ $? -eq 0 ]; then + flake8 --max-line-length=200 *.py fhirclient/*.py || EXITCODE=1 +else + echo "You don't have the 'flake8' module installed, will skip checks" +fi + +exit $EXITCODE