sdc-mapper 4.3.1__tar.gz → 4.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. {sdc_mapper-4.3.1/src/sdc_mapper.egg-info → sdc_mapper-4.3.2}/PKG-INFO +2 -2
  2. {sdc_mapper-4.3.1 → sdc_mapper-4.3.2}/README.md +1 -1
  3. {sdc_mapper-4.3.1 → sdc_mapper-4.3.2}/pyproject.toml +1 -1
  4. {sdc_mapper-4.3.1 → sdc_mapper-4.3.2}/src/sdc_mapper/__init__.py +1 -1
  5. {sdc_mapper-4.3.1 → sdc_mapper-4.3.2}/src/sdc_mapper/codes.py +10 -4
  6. {sdc_mapper-4.3.1 → sdc_mapper-4.3.2/src/sdc_mapper.egg-info}/PKG-INFO +2 -2
  7. {sdc_mapper-4.3.1 → sdc_mapper-4.3.2}/tests/test_codes.py +15 -0
  8. {sdc_mapper-4.3.1 → sdc_mapper-4.3.2}/LICENSE +0 -0
  9. {sdc_mapper-4.3.1 → sdc_mapper-4.3.2}/NOTICE +0 -0
  10. {sdc_mapper-4.3.1 → sdc_mapper-4.3.2}/setup.cfg +0 -0
  11. {sdc_mapper-4.3.1 → sdc_mapper-4.3.2}/src/sdc_mapper/cli.py +0 -0
  12. {sdc_mapper-4.3.1 → sdc_mapper-4.3.2}/src/sdc_mapper/contract.py +0 -0
  13. {sdc_mapper-4.3.1 → sdc_mapper-4.3.2}/src/sdc_mapper/engine.py +0 -0
  14. {sdc_mapper-4.3.1 → sdc_mapper-4.3.2}/src/sdc_mapper/gate.py +0 -0
  15. {sdc_mapper-4.3.1 → sdc_mapper-4.3.2}/src/sdc_mapper/log.py +0 -0
  16. {sdc_mapper-4.3.1 → sdc_mapper-4.3.2}/src/sdc_mapper/mapping.py +0 -0
  17. {sdc_mapper-4.3.1 → sdc_mapper-4.3.2}/src/sdc_mapper/mcp_server.py +0 -0
  18. {sdc_mapper-4.3.1 → sdc_mapper-4.3.2}/src/sdc_mapper/placement.py +0 -0
  19. {sdc_mapper-4.3.1 → sdc_mapper-4.3.2}/src/sdc_mapper/report.py +0 -0
  20. {sdc_mapper-4.3.1 → sdc_mapper-4.3.2}/src/sdc_mapper/resolve.py +0 -0
  21. {sdc_mapper-4.3.1 → sdc_mapper-4.3.2}/src/sdc_mapper/schemas/log-entry.schema.json +0 -0
  22. {sdc_mapper-4.3.1 → sdc_mapper-4.3.2}/src/sdc_mapper/schemas/mapping.schema.json +0 -0
  23. {sdc_mapper-4.3.1 → sdc_mapper-4.3.2}/src/sdc_mapper/schemas/sdc4.xsd +0 -0
  24. {sdc_mapper-4.3.1 → sdc_mapper-4.3.2}/src/sdc_mapper/service.py +0 -0
  25. {sdc_mapper-4.3.1 → sdc_mapper-4.3.2}/src/sdc_mapper.egg-info/SOURCES.txt +0 -0
  26. {sdc_mapper-4.3.1 → sdc_mapper-4.3.2}/src/sdc_mapper.egg-info/dependency_links.txt +0 -0
  27. {sdc_mapper-4.3.1 → sdc_mapper-4.3.2}/src/sdc_mapper.egg-info/entry_points.txt +0 -0
  28. {sdc_mapper-4.3.1 → sdc_mapper-4.3.2}/src/sdc_mapper.egg-info/requires.txt +0 -0
  29. {sdc_mapper-4.3.1 → sdc_mapper-4.3.2}/src/sdc_mapper.egg-info/top_level.txt +0 -0
  30. {sdc_mapper-4.3.1 → sdc_mapper-4.3.2}/tests/test_core.py +0 -0
  31. {sdc_mapper-4.3.1 → sdc_mapper-4.3.2}/tests/test_placement.py +0 -0
  32. {sdc_mapper-4.3.1 → sdc_mapper-4.3.2}/tests/test_service.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sdc-mapper
3
- Version: 4.3.1
3
+ Version: 4.3.2
4
4
  Summary: The shared core of the Semantic Data Charter's Governed Data Record mappers: validate, resolve, map, and report every value; MCP server included.
5
5
  Author: Axius SDC, Inc.
6
6
  License-Expression: Apache-2.0
@@ -33,7 +33,7 @@ target could say it too. Every call is appended to a hash-chained log that holds
33
33
  Each target format is its own package (`sdc-gdr2ubl`, `sdc-gdr2edifact`, `sdc-gdr2omop`, ...) registered under the
34
34
  entry-point group `sdc_mapper.targets`. Outbound only. Apache 2.0.
35
35
 
36
- **Status:** 4.3.1. Five target mappers are released: `sdc-gdr2ubl` (OASIS UBL 2.3), `sdc-gdr2edifact` (UN/EDIFACT
36
+ **Status:** 4.3.2. Five target mappers are released: `sdc-gdr2ubl` (OASIS UBL 2.3), `sdc-gdr2edifact` (UN/EDIFACT
37
37
  D.24A), `sdc-gdr2omop` (OMOP CDM 5.4), `sdc-gdr2fhir` (HL7 FHIR R4) and `sdc-gdr2hl7v2` (HL7 v2.5.1).
38
38
 
39
39
  ## Use
@@ -11,7 +11,7 @@ target could say it too. Every call is appended to a hash-chained log that holds
11
11
  Each target format is its own package (`sdc-gdr2ubl`, `sdc-gdr2edifact`, `sdc-gdr2omop`, ...) registered under the
12
12
  entry-point group `sdc_mapper.targets`. Outbound only. Apache 2.0.
13
13
 
14
- **Status:** 4.3.1. Five target mappers are released: `sdc-gdr2ubl` (OASIS UBL 2.3), `sdc-gdr2edifact` (UN/EDIFACT
14
+ **Status:** 4.3.2. Five target mappers are released: `sdc-gdr2ubl` (OASIS UBL 2.3), `sdc-gdr2edifact` (UN/EDIFACT
15
15
  D.24A), `sdc-gdr2omop` (OMOP CDM 5.4), `sdc-gdr2fhir` (HL7 FHIR R4) and `sdc-gdr2hl7v2` (HL7 v2.5.1).
16
16
 
17
17
  ## Use
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "sdc-mapper"
7
- version = "4.3.1"
7
+ version = "4.3.2"
8
8
  description = "The shared core of the Semantic Data Charter's Governed Data Record mappers: validate, resolve, map, and report every value; MCP server included."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12"
@@ -20,7 +20,7 @@ from .placement import JOIN, LOOKUP_TRANSFORMS, ClusterPlacement, Extra, Placeme
20
20
  from .report import CoverageReport, IncompleteMapping, build_report
21
21
  from .resolve import Exceptional, ResolvedRecord, ResolvedValue, Units, resolve
22
22
 
23
- __version__ = "4.3.1"
23
+ __version__ = "4.3.2"
24
24
  __all__ = [
25
25
  "Engine", "CallResult", "Gate", "GateResult", "Recovery", "Log", "entry_hash", "Mapping", "MappingError", "Rule",
26
26
  "load_mapping", "place", "Placement", "ClusterPlacement", "Extra", "JOIN", "join_depth", "LOOKUP_TRANSFORMS", "CodeRef", "code_of",
@@ -73,12 +73,18 @@ def bound_code(value, system: str | None = None) -> CodeRef | None:
73
73
 
74
74
 
75
75
  def linked_code(value, system: str | None = None, predicates=CONCEPT_LINKS) -> CodeRef | None:
76
- """The first code the component links to (in `system`, when given), by the predicates in order: a code system's
77
- concept only, never a `#fragment` (a link names a concept; a fragment in a link is a term or a page anchor)."""
76
+ """The code the component links to (in `system`, when given), by the predicates in order: a code system's concept
77
+ only, never a `#fragment` (a link names a concept; a fragment in a link is a term or a page anchor).
78
+
79
+ An exact match is the component's concept. A subject is, only when it is the component's one subject: several
80
+ subjects are the parts of a compound concept (NIH's "Are you pregnant now?" is Person + Current + Pregnancy), no
81
+ part alone is the component, so a compound gives no code (4.3.2)."""
78
82
  links = getattr(value, "links", None) or {}
79
83
  for predicate in predicates:
80
- for iri in links.get(predicate, []):
81
- ref = code_of(iri, code_lists=False)
84
+ refs = [r for r in (code_of(iri, code_lists=False) for iri in links.get(predicate, [])) if r is not None]
85
+ if predicate == SUBJECT and len(refs) > 1:
86
+ return None
87
+ for ref in refs:
82
88
  if _in(ref, system):
83
89
  return ref
84
90
  return None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sdc-mapper
3
- Version: 4.3.1
3
+ Version: 4.3.2
4
4
  Summary: The shared core of the Semantic Data Charter's Governed Data Record mappers: validate, resolve, map, and report every value; MCP server included.
5
5
  Author: Axius SDC, Inc.
6
6
  License-Expression: Apache-2.0
@@ -33,7 +33,7 @@ target could say it too. Every call is appended to a hash-chained log that holds
33
33
  Each target format is its own package (`sdc-gdr2ubl`, `sdc-gdr2edifact`, `sdc-gdr2omop`, ...) registered under the
34
34
  entry-point group `sdc_mapper.targets`. Outbound only. Apache 2.0.
35
35
 
36
- **Status:** 4.3.1. Five target mappers are released: `sdc-gdr2ubl` (OASIS UBL 2.3), `sdc-gdr2edifact` (UN/EDIFACT
36
+ **Status:** 4.3.2. Five target mappers are released: `sdc-gdr2ubl` (OASIS UBL 2.3), `sdc-gdr2edifact` (UN/EDIFACT
37
37
  D.24A), `sdc-gdr2omop` (OMOP CDM 5.4), `sdc-gdr2fhir` (HL7 FHIR R4) and `sdc-gdr2hl7v2` (HL7 v2.5.1).
38
38
 
39
39
  ## Use
@@ -105,3 +105,18 @@ def test_a_term_or_a_page_anchor_is_no_concept_code(iri, tmp_path):
105
105
  def test_a_code_list_entry_still_binds_an_enumerated_value():
106
106
  assert code_of(f"{UBL_LIST}#2") == CodeRef(UBL_LIST, "2")
107
107
  assert code_of(f"{UBL_LIST}#2", code_lists=False) is None
108
+
109
+
110
+ def test_a_compound_concept_gives_no_linked_code():
111
+ """4.3.2: several subjects are the parts of a compound concept; no part alone is the component."""
112
+ from sdc_mapper import linked_code, NCIT
113
+ rs = resolved()
114
+ subject = "http://purl.org/dc/terms/subject"
115
+ parts = ["http://purl.obolibrary.org/obo/NCIT_C25190", "http://purl.obolibrary.org/obo/NCIT_C25471", "http://purl.obolibrary.org/obo/NCIT_C25742"]
116
+ compound = _value_with(rs, links={subject: parts})
117
+ assert linked_code(compound) is None and linked_code(compound, NCIT) is None
118
+ one = _value_with(rs, links={subject: ["http://snomed.info/id/73211009"]})
119
+ assert linked_code(one).code == "73211009", "a single subject is the component's concept"
120
+ exact = _value_with(rs, links={"http://www.w3.org/2004/02/skos/core#exactMatch": ["https://loinc.org/8480-6/"], subject: parts})
121
+ assert linked_code(exact).code == "8480-6", "an exact match wins over a compound's parts"
122
+ assert model_codes(compound) == {"C25190", "C25471", "C25742"}, "the parts are still codes the model names"
File without changes
File without changes
File without changes