示例#1
0
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
示例#2
0
文件: lib.py 项目: ufocoder/fhir-py
    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
示例#3
0
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
示例#4
0
    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
示例#5
0
文件: resource.py 项目: sudev/fhir-py
    def get_by_path(self, path, default=None):
        keys = parse_path(path)

        return get_by_path(self, keys, default)