Sdc Mapper

io.github.SemanticDataCharter由 GitHub 账号 SemanticDataCharter 发布v4.3.2更新于 Oct 29, 2026

Map Governed Data Records to documented formats, reporting what happened to every value.

已验证STDIO仅桌面开发者工具数据与分析

概览

AI 生成的概览

把受治理的数据记录映射为 UBL、EDIFACT、OMOP、FHIR、HL7 v2 等有文档的目标格式,并报告每个值的处理结果。

可以做什么
  • 列出已安装的目标映射器,并把记录映射到指定目标格式,可配合 YAML 映射文件
  • 按异常值并排比较所有已安装目标的保真度
  • 校验映射文件是否符合映射 schema
  • 查看哈希链调用日志:按天数汇总或校验完整性
  • 解析模型命名的代码(LOINC、SNOMED CT、NCI 词表、代码表),并报告每个值的去向
适用场景
当助手需要处理 Semantic Data Charter 的受治理数据记录,并把它转换为标准格式、同时保留每个值(包括缺失、掩码或不可用值)的可审计说明时适用。
运行要求
以 stdio 本地进程运行,从 PyPI 安装并用 uvx 启动。需要模型包目录或从 SDCStudio 主机获取的已发布模型标识,因此可能需要网络访问。每种目标格式是单独的包,需另行安装。未声明认证或环境变量。
安装前请注意
映射会把输出文件写入目标目录,每次调用都会追加到本地哈希链日志。若使用远程 SDCStudio 主机获取模型,记录内容会离开本机。被拒绝的记录不会写入任何内容,应检查退出状态与返回的原因。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Sdc Mapper,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

sdc-mapper

The shared core of the Semantic Data Charter's Governed Data Record mappers. It validates a record, reads the model the record names, resolves every value against what the model says about it, hands the result to a target mapper, and reports every value: how it reached the target, or that the target cannot hold it. Where the record says why a value is missing or unusable (an Exceptional Value, from the ISO 21090 null flavors), the report also says whether the target could say it too. Every call is appended to a hash-chained log that holds no values.

Each target format is its own package (sdc-gdr2ubl, sdc-gdr2edifact, sdc-gdr2omop, ...) registered under the entry-point group sdc_mapper.targets. Outbound only. Apache 2.0.

Status: 4.3.2. Five target mappers are released: sdc-gdr2ubl (OASIS UBL 2.3), sdc-gdr2edifact (UN/EDIFACT D.24A), sdc-gdr2omop (OMOP CDM 5.4), sdc-gdr2fhir (HL7 FHIR R4) and sdc-gdr2hl7v2 (HL7 v2.5.1).

Use

sdc-map targetssdc-map map TARGET record.xml --package DIR [--mapping m.yaml] [-o out/]sdc-map fidelity record.xml --package DIR          # every installed target, side by side, per Exceptional Valuesdc-map check-mapping m.yaml --package DIRsdc-map log summary --days 7 | sdc-map log verifysdc-mapper [--log-dir DIR] [--host URL]            # MCP stdio server (also sdc-mapper-mcp): the primary way agents use the mappers

A model is a package directory (dm-<ct>.jsonld, dm-<ct>.xsd) or a published model's --ct-id, fetched from the SDCStudio host; with neither, the record's own root names it. Exit status: 0 mapped, 1 refused, 2 error.

The three outcomes

  • valid: mapped.
  • valid with Exceptional Values: a value that failed its constraint is covered by an Exceptional Value (Invalid, with the constraint kept), and the rest of the record is mapped. Exceptional Values written at the source (a refusal, a masked field) are kept as written.
  • refused: a broken structure, the wrong model, or an error no Exceptional Value covers. Nothing is written; the reasons are returned and logged.

Mapping files

YAML, validated against schemas/mapping.schema.json, bound to one model schema version and one target version.

yaml
mapping: {id: credit-note-to-ubl, version: 1}model: {ct_id: jkuyr38hydqaiwlq5vhp2rjr, schema_sha256: "…"}target: {name: OASIS UBL, version: "2.3 CreditNote"}rules:  - cluster: <Accounting Supplier Party>        # a cluster to a target element    to: cac:AccountingSupplierParty  - cluster: <Party>                            # relative to the enclosing mapped cluster    to: cac:Party  - component: <Party Identification Value>    to: cac:PartyIdentification/cbc:ID    transform: copy  - component: <Party Identification Scheme>    to: cac:PartyIdentification/cbc:ID/@schemeName   # an attribute of the same element    transform: copy  - component: <Line Extension Amount>    to: cbc:LineExtensionAmount    transform: copy    units: {to: "@currencyID", transform: copy}  - cluster: <Party Contact>    to: "-"    transform: omit    reason: the target profile carries no contact

Transforms: copy, code (a table), format, constant, binding (the code the model defines an enumerated value by), link (the code of the concept the component links to), omit; clusters group or omit. binding and link take a system (http://loinc.org, http://snomed.info/sct, a code list's IRI); their text is the model's, so a mapper reports it as a lookup (LOOKUP_TRANSFORMS). Steps: .. up, . none, +name an element of the value's own, =name the element of that name the parent already has. within: restricts a rule to a context. A value no rule reaches is reported, never dropped. place(record, mapping) turns a record and its mapping into placements a mapper writes from.

Codes the model names

sdc_mapper.codes reads the IRIs the component libraries use for a concept as a code system and a code: LOINC codes and answers, SNOMED CT, NCI Thesaurus, and any code list whose IRI ends in #code (UBL's, HL7's). A code system is named by the IRI FHIR uses for it; a mapper turns that into its own name for the system (OMOP's vocabulary_id, HL7 v2's coding system). bound_code(value) is the code an enumerated value is defined by, linked_code(value) the code of the concept its component links to (skos:exactMatch, then dcterms:subject), and model_codes(value) every code the model names for it: a target code that is one of these came from the model.

Writing to a target

place() gives each value its target steps. Steps written =name join an element made by another value, so a writer holds those writes back until every other value is written, then writes them shallowest first: sort them by join_depth(steps). A row-oriented target (a set of tables, as OMOP's) can treat each step as a table or a column, +TABLE as one new row per value, and keep the record's own row (its person, its document) under a name of its own; sdc-gdr2omop does so with a RECORD table.

Writing a mapper

A mapper has name, target, target_version, package, version, an Exceptional Value table (ev_table: an EVRule per ISO 21090 code: preserved, degraded, carried or lost) and map(record, mapping) -> MapResult. It returns one ValueOutcome for every value it was given, never writes a rejected value as a value, and registers itself:

toml
[project.entry-points."sdc_mapper.targets"]ubl = "sdc_gdr2ubl:UBLMapper"

Tests

python -m pytest tests -q (offline). The fixture is a HalvorsenDemo Credit Note record and its model's package; the reference mapper in tests/refmapper.py is a flat CSV used only to exercise the contract.

License

Apache 2.0. See NOTICE for the shipped SDC4 reference model schema and the fixture.

来源:README.md,提交 a13e162

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

3
  1. v4.3.2最新Oct 29, 2026
  2. v4.3.1Oct 26, 2026
  3. v4.2.0Oct 25, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分