tablassert 22.0.0__tar.gz → 22.0.1__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 (44) hide show
  1. {tablassert-22.0.0 → tablassert-22.0.1}/PKG-INFO +2 -2
  2. {tablassert-22.0.0 → tablassert-22.0.1}/README.md +1 -1
  3. {tablassert-22.0.0 → tablassert-22.0.1}/pyproject.toml +1 -1
  4. {tablassert-22.0.0 → tablassert-22.0.1}/src/tablassert/fullmap.py +27 -2
  5. {tablassert-22.0.0 → tablassert-22.0.1}/src/tablassert/lib.py +17 -7
  6. {tablassert-22.0.0 → tablassert-22.0.1}/LICENSE +0 -0
  7. {tablassert-22.0.0 → tablassert-22.0.1}/rust/Cargo.lock +0 -0
  8. {tablassert-22.0.0 → tablassert-22.0.1}/rust/Cargo.toml +0 -0
  9. {tablassert-22.0.0 → tablassert-22.0.1}/rust/examples/count_tables.rs +0 -0
  10. {tablassert-22.0.0 → tablassert-22.0.1}/rust/src/fullmap.rs +0 -0
  11. {tablassert-22.0.0 → tablassert-22.0.1}/rust/src/json.rs +0 -0
  12. {tablassert-22.0.0 → tablassert-22.0.1}/rust/src/lib.rs +0 -0
  13. {tablassert-22.0.0 → tablassert-22.0.1}/rust/src/ndjson.rs +0 -0
  14. {tablassert-22.0.0 → tablassert-22.0.1}/rust/src/nlp.rs +0 -0
  15. {tablassert-22.0.0 → tablassert-22.0.1}/rust/src/uuid.rs +0 -0
  16. {tablassert-22.0.0 → tablassert-22.0.1}/rust/tests/build_golden.rs +0 -0
  17. {tablassert-22.0.0 → tablassert-22.0.1}/rust/tests/common/mod.rs +0 -0
  18. {tablassert-22.0.0 → tablassert-22.0.1}/rust/tests/extract_prebuilt.rs +0 -0
  19. {tablassert-22.0.0 → tablassert-22.0.1}/rust/tests/fixtures/nlp_golden.tsv +0 -0
  20. {tablassert-22.0.0 → tablassert-22.0.1}/rust/tests/nlp_golden.rs +0 -0
  21. {tablassert-22.0.0 → tablassert-22.0.1}/src/tablassert/__init__.py +0 -0
  22. {tablassert-22.0.0 → tablassert-22.0.1}/src/tablassert/_lazy.py +0 -0
  23. {tablassert-22.0.0 → tablassert-22.0.1}/src/tablassert/biolink.py +0 -0
  24. {tablassert-22.0.0 → tablassert-22.0.1}/src/tablassert/cli.py +0 -0
  25. {tablassert-22.0.0 → tablassert-22.0.1}/src/tablassert/cli_entry.py +0 -0
  26. {tablassert-22.0.0 → tablassert-22.0.1}/src/tablassert/coerce.py +0 -0
  27. {tablassert-22.0.0 → tablassert-22.0.1}/src/tablassert/data/experimental_taxa.yaml +0 -0
  28. {tablassert-22.0.0 → tablassert-22.0.1}/src/tablassert/data/infores_catalog.yaml +0 -0
  29. {tablassert-22.0.0 → tablassert-22.0.1}/src/tablassert/enums.py +0 -0
  30. {tablassert-22.0.0 → tablassert-22.0.1}/src/tablassert/errors.py +0 -0
  31. {tablassert-22.0.0 → tablassert-22.0.1}/src/tablassert/extras.py +0 -0
  32. {tablassert-22.0.0 → tablassert-22.0.1}/src/tablassert/infores_registry.py +0 -0
  33. {tablassert-22.0.0 → tablassert-22.0.1}/src/tablassert/ingests.py +0 -0
  34. {tablassert-22.0.0 → tablassert-22.0.1}/src/tablassert/log.py +0 -0
  35. {tablassert-22.0.0 → tablassert-22.0.1}/src/tablassert/models.py +0 -0
  36. {tablassert-22.0.0 → tablassert-22.0.1}/src/tablassert/net.py +0 -0
  37. {tablassert-22.0.0 → tablassert-22.0.1}/src/tablassert/nlp.py +0 -0
  38. {tablassert-22.0.0 → tablassert-22.0.1}/src/tablassert/progress.py +0 -0
  39. {tablassert-22.0.0 → tablassert-22.0.1}/src/tablassert/qc.py +0 -0
  40. {tablassert-22.0.0 → tablassert-22.0.1}/src/tablassert/rig.py +0 -0
  41. {tablassert-22.0.0 → tablassert-22.0.1}/src/tablassert/rs.pyi +0 -0
  42. {tablassert-22.0.0 → tablassert-22.0.1}/src/tablassert/runcache.py +0 -0
  43. {tablassert-22.0.0 → tablassert-22.0.1}/src/tablassert/study.py +0 -0
  44. {tablassert-22.0.0 → tablassert-22.0.1}/src/tablassert/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tablassert
3
- Version: 22.0.0
3
+ Version: 22.0.1
4
4
  Classifier: License :: OSI Approved :: Apache Software License
5
5
  Classifier: Development Status :: 5 - Production/Stable
6
6
  Classifier: Intended Audience :: Science/Research
@@ -273,5 +273,5 @@ described in:
273
273
 
274
274
  - [Skye Lane Goetz](mailto:sgoetz@isbscience.org), Institute for Systems Biology
275
275
  - [Gwênlyn Glusman](mailto:gglusman@isbscience.org), Institute for Systems Biology
276
- - Jared C. Roach, Institute for Systems Biology
276
+ - [Jared C. Roach](mailto:jroach@isbscience.org), Institute for Systems Biology
277
277
 
@@ -219,4 +219,4 @@ described in:
219
219
 
220
220
  - [Skye Lane Goetz](mailto:sgoetz@isbscience.org), Institute for Systems Biology
221
221
  - [Gwênlyn Glusman](mailto:gglusman@isbscience.org), Institute for Systems Biology
222
- - Jared C. Roach, Institute for Systems Biology
222
+ - [Jared C. Roach](mailto:jroach@isbscience.org), Institute for Systems Biology
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "tablassert"
3
- version = "22.0.0"
3
+ version = "22.0.1"
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" }
@@ -4,6 +4,7 @@ import time
4
4
  from collections import OrderedDict
5
5
  from collections.abc import Callable
6
6
  from enum import Enum
7
+ from functools import cache
7
8
  from pathlib import Path
8
9
  from typing import TYPE_CHECKING, Any, NamedTuple, cast
9
10
 
@@ -269,6 +270,28 @@ def lookup_rows(db: Path, terms: list[str]) -> list[dict[str, object]]:
269
270
  return rows
270
271
 
271
272
 
273
+ @cache
274
+ def _generic_probe_keys() -> frozenset[str]:
275
+ """Apply the real lookup normalizers to the existing excluded generic labels."""
276
+ labels = [
277
+ "none",
278
+ "nan",
279
+ "na",
280
+ "null",
281
+ "unknown",
282
+ "not applicable",
283
+ "p_value",
284
+ "p value",
285
+ "variable",
286
+ "result",
287
+ "exposure",
288
+ "expression",
289
+ "symbol",
290
+ ]
291
+ normalized = level_two(level_one(pl.LazyFrame({"term": labels}), "term"), "term").collect()
292
+ return frozenset(labels) | frozenset(normalized["term"]) | frozenset(normalized["term_two"])
293
+
294
+
272
295
  def distinct(lf: pl.LazyFrame, l1: str, l2: str, col: str = "term") -> pl.LazyFrame:
273
296
  """Extract unique terms from two text-normalization columns as a LazyFrame.
274
297
 
@@ -297,8 +320,10 @@ def distinct(lf: pl.LazyFrame, l1: str, l2: str, col: str = "term") -> pl.LazyFr
297
320
  # concat/unique, so first-seen tier selection would be scheduling-dependent.
298
321
  terms: pl.LazyFrame = pl.concat([t1, t2]).group_by(col).agg(pl.col("nlp_level").min())
299
322
 
300
- bad: str = r"^\d+$|^(none|nan|na|null|unknown|not applicable|p_value|variable|result|exposure|expression|symbol)$|^$"
301
- return terms.filter(~pl.col(col).str.contains(bad))
323
+ # Probe keys are stemmed/sorted at level one, then stripped at level two.
324
+ # Filtering only the original spellings lets headers such as "Expression"
325
+ # ("express") and "Not applicable" ("applic not") resolve as entities.
326
+ return terms.filter(~pl.col(col).str.contains(r"^\d+$|^$") & ~pl.col(col).is_in(_generic_probe_keys()))
302
327
 
303
328
 
304
329
  def deduplicate_result(result: pl.DataFrame, column_context: bool) -> pl.DataFrame:
@@ -6,6 +6,7 @@ import re
6
6
  from collections.abc import Callable, Iterable
7
7
  from functools import cache
8
8
  from pathlib import Path
9
+ from tempfile import TemporaryDirectory
9
10
  from typing import TYPE_CHECKING, Any, Literal, Self
10
11
 
11
12
  from pydantic import Field, NonNegativeInt
@@ -1844,15 +1845,24 @@ def dedup_stream(p_in: Path, is_edges: bool, domain: str = "TABLASSERT", uuid_fi
1844
1845
  so it never ships in the final NDJSON.
1845
1846
 
1846
1847
  Returns:
1847
- ``None``; writes the deduplicated stream alongside ``p_in`` with no
1848
- ``.tmp`` suffix, then deletes ``p_in``.
1848
+ ``None``; atomically replaces the deduplicated stream alongside ``p_in`` with no
1849
+ ``.tmp`` suffix, then deletes ``p_in``. Parsing, collision, and native writer
1850
+ failures preserve the existing output and the input for diagnosis.
1849
1851
  """
1850
1852
  p_out: Path = p_in.with_suffix("")
1851
-
1852
- if p_out.is_file():
1853
- p_out.unlink()
1854
-
1855
- merged, scalar_conflicts = rs.dedup_ndjson(p_in, p_out, is_edges, domain, uuid_fields, on_collision)
1853
+ if p_out == p_in:
1854
+ raise ValueError("dedup_stream requires an input filename with a removable suffix")
1855
+
1856
+ # Keep the previous artifact intact until native parsing/dedup completes.
1857
+ # A sibling directory keeps replacement on the same filesystem and retains
1858
+ # the public basename for native collision diagnostics and fold reports.
1859
+ with TemporaryDirectory(prefix=f".{p_out.name}.dedup-", dir=p_out.parent) as stage_dir:
1860
+ staged: Path = Path(stage_dir) / p_out.name
1861
+ merged, scalar_conflicts = rs.dedup_ndjson(p_in, staged, is_edges, domain, uuid_fields, on_collision)
1862
+ report: Path = staged.with_name(staged.name + ".foldreport.json")
1863
+ staged.replace(p_out)
1864
+ if report.exists():
1865
+ report.replace(p_out.with_name(p_out.name + ".foldreport.json"))
1856
1866
  if merged:
1857
1867
  logger.warning(
1858
1868
  "uuid_on_collision=merge folded {merged} divergent edge records into their first-seen edges; {conflicts} conflicting scalar fields kept the first value",
File without changes
File without changes
File without changes
File without changes
File without changes