def get_type(item, data): type = item["type"] if type == "choice" or type == "open-choice": option_type = get_by_path(item, ["answerOption", 0, "value"]) if option_type: type = next(iter(option_type.keys())) else: type = "Coding" if isinstance(data[0], str): return "string" elif type == "text": type = "string" elif type == "integer": type = "integer" elif type == "decimal": type = "decimal" elif type == "attachment": type = "Attachment" elif type == "email": type = "string" elif type == "phone": type = "string" elif type == "display": type = "string" elif type == "reference": type = "Reference" return type
async def __aiter__(self): next_link = None while True: if next_link: bundle_data = await self.client._fetch_resource( *parse_pagination_url(next_link)) else: bundle_data = await self.client._fetch_resource( self.resource_type, self.params) new_resources = self._get_bundle_resources(bundle_data) next_link = get_by_path(bundle_data, ['link', { 'relation': 'next' }, 'url']) for item in new_resources: yield item if not next_link: break
def get_type(item): type = item["type"] if type == "choice": option_type = get_by_path(item, ["answerOption", 0, "value"]) if option_type: type = next(iter(option_type.keys())) else: type = "Coding" elif type == "text": type = "string" elif type == "attachment": type = "Attachment" elif type == "email": type = "string" elif type == "phone": type = "string" elif type == 'display': type = "string" return type
def __iter__(self): next_link = None while True: if next_link: bundle_data = self.client._fetch_resource( *parse_pagination_url(next_link)) else: bundle_data = self.client._fetch_resource( self.resource_type, self.params) new_resources = self._get_bundle_resources(bundle_data) next_link = get_by_path(bundle_data, ["link", { "relation": "next" }, "url"]) for item in new_resources: yield item if not next_link: break
def get_by_path(self, path, default=None): keys = parse_path(path) return get_by_path(self, keys, default)