tablassert 19.6.0__tar.gz → 19.7.0__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 (48) hide show
  1. {tablassert-19.6.0 → tablassert-19.7.0}/PKG-INFO +2 -2
  2. {tablassert-19.6.0 → tablassert-19.7.0}/pyproject.toml +3 -3
  3. {tablassert-19.6.0 → tablassert-19.7.0}/src/tablassert/biolink.py +12 -7
  4. {tablassert-19.6.0 → tablassert-19.7.0}/src/tablassert/cli.py +81 -0
  5. tablassert-19.7.0/src/tablassert/data/infores_catalog.yaml +6166 -0
  6. {tablassert-19.6.0 → tablassert-19.7.0}/src/tablassert/errors.py +1 -0
  7. tablassert-19.7.0/src/tablassert/infores_registry.py +318 -0
  8. {tablassert-19.6.0 → tablassert-19.7.0}/LICENSE +0 -0
  9. {tablassert-19.6.0 → tablassert-19.7.0}/README.md +0 -0
  10. {tablassert-19.6.0 → tablassert-19.7.0}/rust/Cargo.lock +0 -0
  11. {tablassert-19.6.0 → tablassert-19.7.0}/rust/Cargo.toml +0 -0
  12. {tablassert-19.6.0 → tablassert-19.7.0}/rust/examples/count_tables.rs +0 -0
  13. {tablassert-19.6.0 → tablassert-19.7.0}/rust/src/fullmap.rs +0 -0
  14. {tablassert-19.6.0 → tablassert-19.7.0}/rust/src/json.rs +0 -0
  15. {tablassert-19.6.0 → tablassert-19.7.0}/rust/src/lib.rs +0 -0
  16. {tablassert-19.6.0 → tablassert-19.7.0}/rust/src/ndjson.rs +0 -0
  17. {tablassert-19.6.0 → tablassert-19.7.0}/rust/src/nlp.rs +0 -0
  18. {tablassert-19.6.0 → tablassert-19.7.0}/rust/src/uuid.rs +0 -0
  19. {tablassert-19.6.0 → tablassert-19.7.0}/rust/tests/build_golden.rs +0 -0
  20. {tablassert-19.6.0 → tablassert-19.7.0}/rust/tests/common/mod.rs +0 -0
  21. {tablassert-19.6.0 → tablassert-19.7.0}/rust/tests/extract_prebuilt.rs +0 -0
  22. {tablassert-19.6.0 → tablassert-19.7.0}/rust/tests/fixtures/nlp_golden.tsv +0 -0
  23. {tablassert-19.6.0 → tablassert-19.7.0}/rust/tests/nlp_golden.rs +0 -0
  24. {tablassert-19.6.0 → tablassert-19.7.0}/src/tablassert/__init__.py +0 -0
  25. {tablassert-19.6.0 → tablassert-19.7.0}/src/tablassert/_lazy.py +0 -0
  26. {tablassert-19.6.0 → tablassert-19.7.0}/src/tablassert/agent.py +0 -0
  27. {tablassert-19.6.0 → tablassert-19.7.0}/src/tablassert/cli_entry.py +0 -0
  28. {tablassert-19.6.0 → tablassert-19.7.0}/src/tablassert/coerce.py +0 -0
  29. {tablassert-19.6.0 → tablassert-19.7.0}/src/tablassert/data/experimental_taxa.yaml +0 -0
  30. {tablassert-19.6.0 → tablassert-19.7.0}/src/tablassert/distill.py +0 -0
  31. {tablassert-19.6.0 → tablassert-19.7.0}/src/tablassert/distill_reward.py +0 -0
  32. {tablassert-19.6.0 → tablassert-19.7.0}/src/tablassert/enums.py +0 -0
  33. {tablassert-19.6.0 → tablassert-19.7.0}/src/tablassert/extras.py +0 -0
  34. {tablassert-19.6.0 → tablassert-19.7.0}/src/tablassert/fullmap.py +0 -0
  35. {tablassert-19.6.0 → tablassert-19.7.0}/src/tablassert/graph_target.py +0 -0
  36. {tablassert-19.6.0 → tablassert-19.7.0}/src/tablassert/ingests.py +0 -0
  37. {tablassert-19.6.0 → tablassert-19.7.0}/src/tablassert/lib.py +0 -0
  38. {tablassert-19.6.0 → tablassert-19.7.0}/src/tablassert/log.py +0 -0
  39. {tablassert-19.6.0 → tablassert-19.7.0}/src/tablassert/models.py +0 -0
  40. {tablassert-19.6.0 → tablassert-19.7.0}/src/tablassert/net.py +0 -0
  41. {tablassert-19.6.0 → tablassert-19.7.0}/src/tablassert/nlp.py +0 -0
  42. {tablassert-19.6.0 → tablassert-19.7.0}/src/tablassert/progress.py +0 -0
  43. {tablassert-19.6.0 → tablassert-19.7.0}/src/tablassert/qc.py +0 -0
  44. {tablassert-19.6.0 → tablassert-19.7.0}/src/tablassert/rig.py +0 -0
  45. {tablassert-19.6.0 → tablassert-19.7.0}/src/tablassert/rs.pyi +0 -0
  46. {tablassert-19.6.0 → tablassert-19.7.0}/src/tablassert/runcache.py +0 -0
  47. {tablassert-19.6.0 → tablassert-19.7.0}/src/tablassert/study.py +0 -0
  48. {tablassert-19.6.0 → tablassert-19.7.0}/src/tablassert/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tablassert
3
- Version: 19.6.0
3
+ Version: 19.7.0
4
4
  Classifier: License :: OSI Approved :: Apache Software License
5
5
  Classifier: Development Status :: 5 - Production/Stable
6
6
  Classifier: Intended Audience :: Science/Research
@@ -22,7 +22,7 @@ Classifier: Framework :: Pydantic :: 2
22
22
  Classifier: Operating System :: POSIX :: Linux
23
23
  Classifier: Operating System :: MacOS :: MacOS X
24
24
  Classifier: Environment :: Console
25
- Requires-Dist: biolink-model>=4.4.5
25
+ Requires-Dist: biolink-model>=4.4.6
26
26
  Requires-Dist: polars>=2.0.0rc2
27
27
  Requires-Dist: pyarrow>=21.0.0
28
28
  Requires-Dist: rapidfuzz>=3.14.3
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "tablassert"
3
- version = "19.6.0"
3
+ version = "19.7.0"
4
4
  description = "Tablassert turns biomedical spreadsheets (Excel, CSV, TSV) into knowledge graphs ready for NCATS Translator. Declare how your columns map to subject–predicate–object statements in YAML; Tablassert resolves free text to standard CURIEs, attaches provenance and statistical annotations, and emits KGX-compliant nodes and edges."
5
5
  authors = [
6
6
  { name = "Skye Lane Goetz", email = "sgoetz@isbscience.org" }
@@ -47,7 +47,7 @@ classifiers = [
47
47
  ]
48
48
  requires-python = ">=3.11"
49
49
  dependencies = [
50
- "biolink-model>=4.4.5",
50
+ "biolink-model>=4.4.6",
51
51
  "polars>=2.0.0rc2",
52
52
  "pyarrow>=21.0.0",
53
53
  "rapidfuzz>=3.14.3",
@@ -71,7 +71,7 @@ module-name = "tablassert.rs"
71
71
  bindings = "pyo3"
72
72
  manifest-path = "rust/Cargo.toml"
73
73
  features = ["extension-module"]
74
- include = ["src/tablassert/data/experimental_taxa.yaml"]
74
+ include = ["src/tablassert/data/experimental_taxa.yaml", "src/tablassert/data/infores_catalog.yaml"]
75
75
 
76
76
  [project.scripts]
77
77
  tablassert = "tablassert.cli_entry:main"
@@ -593,8 +593,12 @@ release from making ``species_context_qualifier`` silently emittable again.
593
593
 
594
594
 
595
595
  CLASS_FIELD_OVERRIDES: dict[str, frozenset[str]] = {
596
- "EntityToDiseaseAssociation": frozenset({"population_context_qualifier", "sex_qualifier", "temporal_context_qualifier"}),
597
- "EntityToPhenotypicFeatureAssociation": frozenset({"population_context_qualifier", "temporal_context_qualifier"}),
596
+ # Absorbed by biolink-model 4.4.6 (now declared natively on both pinned classes,
597
+ # removed by the tripwire; kept here commented as the pattern for future grants):
598
+ # "EntityToDiseaseAssociation": frozenset({"population_context_qualifier", "sex_qualifier", "temporal_context_qualifier"}),
599
+ # "EntityToPhenotypicFeatureAssociation": frozenset({"population_context_qualifier", "temporal_context_qualifier"}),
600
+ "EntityToDiseaseAssociation": frozenset({"sex_qualifier", "temporal_context_qualifier"}),
601
+ "EntityToPhenotypicFeatureAssociation": frozenset({"temporal_context_qualifier"}),
598
602
  }
599
603
  """Per-class grants of edge fields the resolved association class does not declare.
600
604
 
@@ -612,11 +616,12 @@ mixin consolidation attached ``disease_context_qualifier``,
612
616
  ``anatomical_context_qualifier``, and ``frequency_qualifier`` to the whole
613
617
  disease/phenotype family, renamed ``FDA_regulatory_approvals`` to the canonical
614
618
  ``regulatory_approvals`` on the pinned classes, and added ``sex_qualifier`` to
615
- ``EntityToPhenotypicFeatureAssociation``); the tripwire removed those grants the day
616
- the release landed, and the remaining ones stay deliberately ahead of the model
617
- (pending an upstream Biolink widening). ``_validation_record`` strips granted fields
618
- before record validation so the deliberate gap is not reported as
619
- ``extra_forbidden``.
619
+ ``EntityToPhenotypicFeatureAssociation``; biolink-model 4.4.6 then attached
620
+ ``population_context_qualifier`` to both pinned classes, so the tripwire removed
621
+ those grants the day each release landed). The remaining ones stay deliberately
622
+ ahead of the model (pending an upstream Biolink widening).
623
+ ``_validation_record`` strips granted fields before record validation so the
624
+ deliberate gap is not reported as ``extra_forbidden``.
620
625
 
621
626
  A tripwire test asserts every granted field is still absent from its class: the moment
622
627
  a biolink-model release attaches the slot, the suite fails and the stale grant is
@@ -1045,6 +1045,87 @@ def validate_kgx_command(
1045
1045
  print("KGX output is Biolink-compliant.", file=sys.stderr)
1046
1046
 
1047
1047
 
1048
+ @APP.command(name="validate-infores")
1049
+ def validate_infores_command(
1050
+ nodes: Annotated[Path, cyclopts.Parameter(name=["--nodes", "-n"])],
1051
+ edges: Annotated[Path, cyclopts.Parameter(name=["--edges", "-e"])],
1052
+ rig: Annotated[Path | None, cyclopts.Parameter(name=["--rig"])] = None,
1053
+ allow_infores: Annotated[list[str] | None, cyclopts.Parameter(name=["--allow-infores"], negative="", allow_leading_hyphen=False)] = None,
1054
+ registry: Annotated[Literal["snapshot", "refresh", "off"], cyclopts.Parameter(name=["--registry"])] = "snapshot",
1055
+ strict: Annotated[bool, cyclopts.Parameter(name=["--strict"])] = False,
1056
+ limit: Annotated[int, cyclopts.Parameter(name=["--limit"])] = 20,
1057
+ ) -> None:
1058
+ """Validate emitted infores CURIEs against the NCATS Translator registry.
1059
+
1060
+ Every knowledge-source identifier the build emits -- edge ``primary_knowledge_source``,
1061
+ ``sources[].resource_id`` and ``sources[].upstream_resource_ids``, node ``provided_by``,
1062
+ and, with ``--rig``, the RIG document's infores values -- is classified against
1063
+ ``biolink/information-resource-registry``'s ``infores_catalog.yaml`` (vendored as the
1064
+ bundled snapshot, so the default path is offline). Values without the ``infores:``
1065
+ prefix are malformed, not unregistered.
1066
+
1067
+ The default posture is advisory: unregistered CURIEs are reported and the command
1068
+ exits 0, because Tablassert legitimately mints graph-local CURIEs that will never sit
1069
+ in the registry. ``--strict`` (CI gates) exits 1 when any unregistered CURIE remains;
1070
+ allowlist legitimate local ids with repeatable ``--allow-infores``. Missing input
1071
+ files fail in every mode: a typo'd path must never read as a clean bill of health.
1072
+
1073
+ Args:
1074
+ nodes: Path to the built nodes NDJSON file (``<name>_<version>.nodes.ndjson``).
1075
+ edges: Path to the built edges NDJSON file (``<name>_<version>.edges.ndjson``).
1076
+ rig: Optional RIG yaml (``<name>_<version>.RIG.yaml``); its infores values are
1077
+ classified too.
1078
+ allow-infores: Registry-exempt CURIE, repeatable; use for the locally-minted
1079
+ graph identifier (``rig.infores()``) and other deliberate locals.
1080
+ registry: Registry source. ``snapshot`` (default) validates offline against the
1081
+ bundled copy; ``refresh`` fetches the live upstream catalog (network) and
1082
+ caches it under the user cache dir; ``off`` skips membership classification
1083
+ and reports structure only.
1084
+ strict: Exit non-zero when any unregistered CURIE remains. Without it the run
1085
+ is advisory and always exits 0 once inputs exist.
1086
+ limit: Maximum number of example unregistered/malformed CURIEs retained for the
1087
+ ``e.g.`` report lines; every observation is still classified regardless.
1088
+ """
1089
+ from tablassert.infores_registry import REGISTRY_RAW_URL, refresh_registry, validate_infores
1090
+
1091
+ ids: frozenset[str] | None = None
1092
+ if registry == "refresh":
1093
+ ids = refresh_registry()
1094
+ report: dict[str, Any] = validate_infores(
1095
+ nodes, edges, rig_path=rig, allow=tuple(allow_infores or ()), registry=ids, check_registry=registry != "off", limit=limit
1096
+ )
1097
+ if ids is not None:
1098
+ report["registry"]["source"] = f"{REGISTRY_RAW_URL} (refreshed)"
1099
+ for label, absent in report["missing"].items():
1100
+ if absent:
1101
+ path_label = {"nodes": nodes, "edges": edges, "rig": rig}.get(label)
1102
+ print(f"{label}: file not found ({path_label})", file=sys.stderr)
1103
+ if any(report["missing"].values()):
1104
+ print("infores validation failed: missing input files.", file=sys.stderr)
1105
+ raise SystemExit(1)
1106
+ print(f"registry: {report['registry']['source']} ({report['registry']['entries']} entries)", file=sys.stderr)
1107
+ counts: str = (
1108
+ f"curies: {report['registered']} registered, {report['allowed']} allowed, "
1109
+ f"{report['unregistered']} unregistered, {report['malformed']} malformed"
1110
+ )
1111
+ print(counts, file=sys.stderr)
1112
+ logger.info(f"validate-infores: {counts}")
1113
+ for example in report["examples"][:3]:
1114
+ print(f" e.g. {example['curie']} ({example['where']}.{example['field']}): {example['problem']}", file=sys.stderr)
1115
+ clean: bool = not report["unregistered"] and not report["malformed"]
1116
+ passed: str = "infores membership check skipped (--registry off)." if registry == "off" else "All emitted infores CURIEs are registered."
1117
+ if strict:
1118
+ if report["ok_strict"]:
1119
+ print(passed if clean else "infores validation passed (strict).", file=sys.stderr)
1120
+ return
1121
+ print("infores validation failed (strict): unregistered CURIEs remain.", file=sys.stderr)
1122
+ raise SystemExit(1)
1123
+ if not clean:
1124
+ print("infores warnings present; pass --strict to fail on them.", file=sys.stderr)
1125
+ return
1126
+ print(passed, file=sys.stderr)
1127
+
1128
+
1048
1129
  @APP.command(name="quick-map")
1049
1130
  def quick_map_command(
1050
1131
  # negative="" suppresses cyclopts' auto-generated --empty-terms help row: the reset