Source code for bioregistry.external.hl7

# -*- coding: utf-8 -*-

"""Utilities for getting HL7 OIDs.

1. Navigate to
2. In ``OID_Type``, select 6) for external code system
3. Download CSV and copy in this directory (this might be automatable)

import csv
from pathlib import Path
from typing import Mapping

__all__ = [

HERE = Path(__file__).parent.resolve()
DATA = HERE.joinpath("OID_Report.csv")

    "Comp_OID": "prefix",
    "Symbolic_name": "preferred_prefix",
    "CodingSystemName": "name",
    "assignment_status": "status",
    "Resp_body_URL": "homepage",
    "Resp_body_name": "organization",
    "Object_description": "description",

[docs]def get_hl7(force_download: bool = False) -> Mapping[str, Mapping[str, str]]: """Get HL7 OIDs.""" rv = {} with as file: reader = csv.reader(file) header = next(reader) for row in reader: row_dict = dict(zip(header, row)) record = {COLUMNS[k]: v for k, v in row_dict.items() if k in COLUMNS and v} rv[record.pop("prefix")] = record return rv
if __name__ == "__main__": print(len(get_hl7(force_download=True))) # noqa:T201