跳转到主要内容

Python表示FHIR®规范 https://www.hl7.org/fhir/。

项目描述

https://img.shields.io/pypi/v/fhirspec.svg Supported Python Versions https://img.shields.io/travis/com/nazrulworld/fhirspec.svg Test Coverage Language grade: Python License https://img.shields.io/badge/code%20style-black-000000.svg HL7® FHIR®

Python表示FHIR® https://www.hl7.org/fhir/规范。基于https://github.com/smart-on-fhir/fhir-parser的思想和类结构。

用法

fhirspec.Configuration

控制fhirspec.FHIRSpec行为的类,功能强大且非常方便。可以通过多种方式构建实例,例如从JSON文件(支持json5),从Python模块,从TOML文件,从纯文本文件等。 只接受大写字母变量

>>> import pathlib
>>> import os
>>> from foo.module import bar
>>> from fhirspec import Configuration
>>> config1 = Configuration.from_module(bar)
>>> config2 = Configuration.from_json_file(pathlib.Path("/json/file/location"))
>>> data_dict = {
... "BASE_URL": pathlib.Path(os.path.abspath(__file__))
... }
>>> config3 = Configuration(data_dict=data_dict)

fhirspec.FHIRSpec

主要加载类,构建此实例需要参数以及JSON文件的来源。以下变量必须存在于配置中。

required_variables = [

“WRITE_RESOURCES”, “CLASS_MAP”, “REPLACE_MAP”, “NATIVES”, “JSON_MAP”, “JSON_MAP_DEFAULT”, “RESERVED_MAP”, “ENUM_MAP”, “ENUM_NAME_MAP”, “DEFAULT_BASES”, “MANUAL_PROFILES”, “CAMELCASE_CLASSES”, “CAMELCASE_ENUMS”, “BACKBONE_CLASS_ADDS_PARENT”, “RESOURCE_MODULE_LOWERCASE”,]

>>> from fhirspec import Configuration
>>> from fhirspec import FHIRSpec
>>> config = Configuration(
... {
...   "BASE_PATH": "",
      "WRITE_RESOURCES": True
... }
... )
>>> spec = FHIRSpec(config)
>>> "patient" in spec.profiles
True

download

从服务器下载任何文件的完美工具,无需依赖第三方库。

>>> from fhirspec import download
>>> url = "http://www.africau.edu/images/default/sample.pdf"
>>> download_directory = pathlib.Path(os.path.expanduser("~/Downloads"))
>>> download(url, download_directory)
>>> (download_directory / "sample.pdf").exists()
True

历史

0.4.0 (22-12-2022)

  • FHIR R4B规范支持已添加。

0.3.0 (18-03-2021)

  • 现在每个FHIRClass都包含在规范中定义的其属性(元素)的原始序列。

  • 此外,FHIRClass.expanded_properties_sequence按顺序返回所有可用的属性(与父级合并)。

0.2.5 (02-11-2020)

  • 本版本包含对FHIRStructureDefinitionElement.represents_class问题的全面修复。

0.2.4 (02-11-2020)

  • 没有更多改进,只是与0.2.1相同的版本,并对有问题的0.2.3版本进行覆盖。

0.2.3 (24-09-2020)

建议更新到版本0.2.4

  • 使用FHIRStructureDefinitionElement.is_main_profile_element代替FHIRStructureDefinitionElement.represents_class

0.2.1 (15-06-2020)

  • FHIRUnitTest处理空值的微小改进。

0.2.0 (06-06-2020)

  • FHIRClass.known属性已更改为FHIRClass.__know_classes__FHIRClass.is_known_class

  • 支持Python 3.6和3.9

0.1.0 (28-04-2020)

  • 初始版本[nazrulworld]


©版权所有HL7®标志、FHIR®标志和燃烧的火焰是Health Level Seven International拥有的注册商标健康层级七国际

“FHIR®是HL7的注册商标,并经HL7许可使用。FHIR商标的使用并不构成HL7对产品的认可”

项目详情


下载文件

下载适用于您的平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分布

fhirspec-0.4.0.tar.gz (27.3 kB 查看哈希)

上传时间:

构建分布

fhirspec-0.4.0-py3-none-any.whl (21.3 kB 查看哈希)

上传时间: Python 3

由以下机构支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面