tablassert 7.0.0__py3-none-any.whl
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.
- tablassert/__init__.py +0 -0
- tablassert/downloader.py +35 -0
- tablassert/enums.py +521 -0
- tablassert/fullmap.py +167 -0
- tablassert/ingests.py +43 -0
- tablassert/lib.py +602 -0
- tablassert/log.py +15 -0
- tablassert/models.py +131 -0
- tablassert/qc.py +124 -0
- tablassert/utils.py +43 -0
- tablassert-7.0.0.dist-info/METADATA +141 -0
- tablassert-7.0.0.dist-info/RECORD +15 -0
- tablassert-7.0.0.dist-info/WHEEL +4 -0
- tablassert-7.0.0.dist-info/entry_points.txt +2 -0
- tablassert-7.0.0.dist-info/licenses/LICENSE +201 -0
tablassert/models.py
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
from tablassert.enums import EncodingMethods
|
|
2
|
+
from tablassert.enums import Contributions
|
|
3
|
+
from tablassert.enums import Repositories
|
|
4
|
+
from tablassert.enums import Comparisons
|
|
5
|
+
from tablassert.enums import FillMethods
|
|
6
|
+
from tablassert.enums import Predicates
|
|
7
|
+
from tablassert.enums import Qualifiers
|
|
8
|
+
from tablassert.enums import Categories
|
|
9
|
+
from tablassert.enums import Functions
|
|
10
|
+
from tablassert.enums import Statuses
|
|
11
|
+
from tablassert.enums import Syntaxes
|
|
12
|
+
from tablassert.enums import Tokens
|
|
13
|
+
from pydantic import NonNegativeInt
|
|
14
|
+
from tablassert.enums import Files
|
|
15
|
+
from pydantic import PositiveInt
|
|
16
|
+
from pydantic import ConfigDict
|
|
17
|
+
from pydantic import BaseModel
|
|
18
|
+
from pydantic import HttpUrl
|
|
19
|
+
from typing import Optional
|
|
20
|
+
from pydantic import Field
|
|
21
|
+
from typing import Literal
|
|
22
|
+
from typing import Union
|
|
23
|
+
from pathlib import Path
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class TablaBase(BaseModel):
|
|
27
|
+
model_config: ConfigDict = ConfigDict( # pyright: ignore
|
|
28
|
+
str_strip_whitespace=False, validate_assignment=True, use_enum_values=True, extra="forbid", populate_by_name=True
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class Reindex(TablaBase):
|
|
33
|
+
column: str = Field(...)
|
|
34
|
+
comparison: Comparisons = Field(Comparisons.NE)
|
|
35
|
+
comparator: Union[str, int, float] = Field(...)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class BaseSource(TablaBase):
|
|
39
|
+
local: Path = Field(...)
|
|
40
|
+
url: HttpUrl = Field(...)
|
|
41
|
+
rows: Optional[list[NonNegativeInt]] = Field(None)
|
|
42
|
+
row_slice: Optional[list[Union[NonNegativeInt, Literal[Tokens.AUTO]]]] = Field(None)
|
|
43
|
+
reindex: Optional[list[Reindex]] = Field(None)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class Excel(BaseSource):
|
|
47
|
+
kind: Literal[Files.EXCEL] = Field(Files.EXCEL)
|
|
48
|
+
sheet: Optional[str] = Field("Sheet1")
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class Text(BaseSource):
|
|
52
|
+
kind: Literal[Files.TEXT] = Field(Files.TEXT)
|
|
53
|
+
delimiter: Optional[str] = Field(",")
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class Regex(TablaBase):
|
|
57
|
+
pattern: Union[int, float, str] = Field(...)
|
|
58
|
+
replacement: Union[int, float, str] = Field(...)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class Math(TablaBase):
|
|
62
|
+
function: Functions = Field(...)
|
|
63
|
+
arguments: list[Union[Literal[Tokens.VALUES], float, int]] = Field(...)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class Encoding(TablaBase):
|
|
67
|
+
method: EncodingMethods = Field(EncodingMethods.VALUE)
|
|
68
|
+
encoding: Union[str, int, float] = Field(...)
|
|
69
|
+
regex: Optional[list[Regex]] = Field(None)
|
|
70
|
+
fill: Optional[FillMethods] = Field(None)
|
|
71
|
+
remove: Optional[list[str]] = Field(None)
|
|
72
|
+
prefix: Optional[str] = Field(None)
|
|
73
|
+
suffix: Optional[str] = Field(None)
|
|
74
|
+
explode_by: Optional[str] = Field(None)
|
|
75
|
+
transformations: Optional[list[Math]] = Field(None)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class NodeEncoding(Encoding):
|
|
79
|
+
taxon: Optional[PositiveInt] = Field(None)
|
|
80
|
+
prioritize: Optional[list[Categories]] = Field(None)
|
|
81
|
+
avoid: Optional[list[Categories]] = Field(None)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
class Qualifier(NodeEncoding):
|
|
85
|
+
qualifier: Qualifiers = Field(...)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class Statement(TablaBase):
|
|
89
|
+
subject: NodeEncoding = Field(...)
|
|
90
|
+
object: NodeEncoding = Field(...)
|
|
91
|
+
predicate: Predicates = Field(Predicates.RELATED_TO)
|
|
92
|
+
qualifiers: Optional[list[Qualifier]] = Field(None)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
class Contributor(TablaBase):
|
|
96
|
+
kind: Contributions = Field(Contributions.CURATION)
|
|
97
|
+
name: str = Field(...)
|
|
98
|
+
date: str = Field(...)
|
|
99
|
+
organizations: Optional[list[str]] = Field(None)
|
|
100
|
+
comment: Optional[str] = Field(None)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class Provenance(TablaBase):
|
|
104
|
+
repo: Repositories = Field(Repositories.PUBMED_CENTRAL)
|
|
105
|
+
publication: str = Field(...)
|
|
106
|
+
contributors: list[Contributor] = Field(...)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class Annotation(Encoding):
|
|
110
|
+
annotation: str = Field(...)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
class Section(TablaBase):
|
|
114
|
+
# ? Pydantic "Section" Model And Coercion
|
|
115
|
+
syntax: Syntaxes = Field(Syntaxes.TC3)
|
|
116
|
+
status: Statuses = Field(Statuses.ALPHA)
|
|
117
|
+
source: Union[Excel, Text] = Field(...)
|
|
118
|
+
statement: Statement = Field(...)
|
|
119
|
+
provenance: Provenance = Field(...)
|
|
120
|
+
annotations: Optional[list[Annotation]] = Field(None)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
class Graph(TablaBase):
|
|
124
|
+
# ? Pydantic "Graph" Configuration
|
|
125
|
+
syntax: Syntaxes = Field(Syntaxes.GC2)
|
|
126
|
+
name: str = Field(...)
|
|
127
|
+
version: str = Field(...)
|
|
128
|
+
tables: list[Path] = Field(...)
|
|
129
|
+
dbssert: Path = Field(...)
|
|
130
|
+
pubmed_db: Optional[Path] = Field(None)
|
|
131
|
+
pmc_db: Optional[Path] = Field(None)
|
tablassert/qc.py
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
from sklearn.metrics.pairwise import cosine_similarity
|
|
2
|
+
from sentence_transformers import SentenceTransformer
|
|
3
|
+
from tablassert.utils import DISKCACHE
|
|
4
|
+
from tablassert.log import logger
|
|
5
|
+
from typing import Optional
|
|
6
|
+
from typing import Literal
|
|
7
|
+
from rapidfuzz import fuzz
|
|
8
|
+
import onnxruntime as ort
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
from operator import add
|
|
11
|
+
from operator import ge
|
|
12
|
+
from operator import eq
|
|
13
|
+
import polars as pl
|
|
14
|
+
|
|
15
|
+
SESSION_OPTS: object = ort.SessionOptions()
|
|
16
|
+
SESSION_OPTS.graph_optimization_level = ort.GraphOptimizationLevel.ORT_ENABLE_ALL # pyright: ignore
|
|
17
|
+
|
|
18
|
+
MODEL: Path = Path("./.onnxassert/")
|
|
19
|
+
MODEL_BACKEND: Literal["onnx"] = "onnx"
|
|
20
|
+
MODEL_KWARGS: dict[str, object] = {"provider": "CPUExecutionProvider", "session_options": SESSION_OPTS}
|
|
21
|
+
|
|
22
|
+
# TODO: Explore Best Model For QC
|
|
23
|
+
BIOBERT: Optional[object] = None
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def get_biobert() -> object:
|
|
27
|
+
# ? Lazy-loads BioBERT once on first BERT_audit call, then caches globally
|
|
28
|
+
global BIOBERT
|
|
29
|
+
if BIOBERT:
|
|
30
|
+
return BIOBERT
|
|
31
|
+
elif not BIOBERT and MODEL.exists():
|
|
32
|
+
BIOBERT = SentenceTransformer(str(MODEL), backend=MODEL_BACKEND, model_kwargs=MODEL_KWARGS) # pyright: ignore
|
|
33
|
+
else:
|
|
34
|
+
BIOBERT = SentenceTransformer(
|
|
35
|
+
"pritamdeka/BioBERT-mnli-snli-scinli-scitail-mednli-stsb", backend=MODEL_BACKEND, model_kwargs=MODEL_KWARGS
|
|
36
|
+
) # pyright: ignore
|
|
37
|
+
MODEL.mkdir(parents=True, exist_ok=True)
|
|
38
|
+
BIOBERT.save(MODEL) # pyright: ignore
|
|
39
|
+
return BIOBERT
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@DISKCACHE.memoize() # pyright: ignore
|
|
43
|
+
def fuzz_audit(x: object, original: str, preferred: str, min_fuzz: float = 20) -> bool:
|
|
44
|
+
# ? Decides Whether To Remove A Suspected Fullmap Error Based On Fuzzy Matching
|
|
45
|
+
o: str = x[original] # pyright: ignore
|
|
46
|
+
p: str = x[preferred] # pyright: ignore
|
|
47
|
+
return bool(ge(fuzz.ratio(o, p), min_fuzz) or ge(fuzz.partial_token_sort_ratio(o, p), min_fuzz))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@DISKCACHE.memoize() # pyright: ignore
|
|
51
|
+
def BERT_audit(x: object, original: str, preferred: str, min_cos: float = 0.2) -> bool:
|
|
52
|
+
# ? Decides Whether To Remove A Suspected Fullmap Error Based On BERT EMBEDDINGS
|
|
53
|
+
o: str = x[original] # pyright: ignore
|
|
54
|
+
p: str = x[preferred] # pyright: ignore
|
|
55
|
+
|
|
56
|
+
embeddings: object = get_biobert().encode([o, p]) # pyright: ignore
|
|
57
|
+
similarity: float = cosine_similarity([embeddings[0]], [embeddings[1]])[0][0] # pyright: ignore
|
|
58
|
+
return bool(ge(similarity, min_cos))
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def fullmap_audit(lf: pl.LazyFrame, col: str, section_hash: str, config_file: str, out: str = "passed") -> pl.LazyFrame:
|
|
62
|
+
# ? Ensures Fullmap Correct Processes Strings To CURIES
|
|
63
|
+
# * Deletes Suspected Errors
|
|
64
|
+
# ! Collection Points: map_elements With Custom Functions Require Eager
|
|
65
|
+
original: str = add("original ", col)
|
|
66
|
+
preferred: str = add(col, " name")
|
|
67
|
+
cols: list[str] = [col, original, preferred]
|
|
68
|
+
|
|
69
|
+
# * Stage 1: Exact String Matching Or Is Curie (Can Stay Lazy Until Filter)
|
|
70
|
+
df: pl.DataFrame = lf.collect()
|
|
71
|
+
pairs: pl.DataFrame = df.select(cols).unique()
|
|
72
|
+
pairs = pairs.with_columns(eq(pl.col(cols[1]), pl.col(cols[2])).alias(out))
|
|
73
|
+
|
|
74
|
+
passed: pl.DataFrame = pairs.filter(pl.col(out))
|
|
75
|
+
pending: pl.DataFrame = pairs.filter(~pl.col(out))
|
|
76
|
+
|
|
77
|
+
exempt_curies: str = r"^CHEBI|^PR|^UniProtKB"
|
|
78
|
+
is_exempt: pl.DataFrame = pending.with_columns(pl.col(cols[0]).str.contains(exempt_curies).alias(out))
|
|
79
|
+
pairs = pl.concat((passed, is_exempt))
|
|
80
|
+
|
|
81
|
+
passed = pairs.filter(pl.col(out))
|
|
82
|
+
pending = pairs.filter(~pl.col(out))
|
|
83
|
+
|
|
84
|
+
is_curie: pl.DataFrame = pending.with_columns(pl.col(cols[1]).str.contains(":").alias(out))
|
|
85
|
+
pairs = pl.concat((passed, is_curie))
|
|
86
|
+
|
|
87
|
+
passed = pairs.filter(pl.col(out))
|
|
88
|
+
pending = pairs.filter(~pl.col(out))
|
|
89
|
+
|
|
90
|
+
exceptions: str = r"^LOC|^si:"
|
|
91
|
+
is_exception: pl.DataFrame = pending.with_columns(pl.col(cols[2]).str.contains(exceptions).alias(out))
|
|
92
|
+
pairs = pl.concat((passed, is_exception))
|
|
93
|
+
|
|
94
|
+
passed = pairs.filter(pl.col(out))
|
|
95
|
+
pending = pairs.filter(~pl.col(out))
|
|
96
|
+
|
|
97
|
+
# * Stage 2: Fuzzy Matching Via RapidFuzz (Requires Eager)
|
|
98
|
+
masked_fuzz: pl.DataFrame = pending.with_columns(
|
|
99
|
+
pl.struct(cols[1:]).map_elements(lambda x: fuzz_audit(x, original, preferred), return_dtype=pl.Boolean).alias(out)
|
|
100
|
+
)
|
|
101
|
+
pairs = pl.concat((passed, masked_fuzz))
|
|
102
|
+
|
|
103
|
+
passed = pairs.filter(pl.col(out))
|
|
104
|
+
pending = pairs.filter(~pl.col(out))
|
|
105
|
+
|
|
106
|
+
# * Stage 3: BioBERT Embeddings (Requires Eager)
|
|
107
|
+
BERT_fuzz: pl.DataFrame = pending.with_columns(
|
|
108
|
+
pl.struct(cols[1:]).map_elements(lambda x: BERT_audit(x, original, preferred), return_dtype=pl.Boolean).alias(out)
|
|
109
|
+
)
|
|
110
|
+
pairs = pl.concat((passed, BERT_fuzz))
|
|
111
|
+
|
|
112
|
+
passed = pairs.filter(pl.col(out))
|
|
113
|
+
pending = pairs.filter(~pl.col(out))
|
|
114
|
+
|
|
115
|
+
# * Add Logging For Failed CURIES
|
|
116
|
+
if pending.height > 0:
|
|
117
|
+
for c, o, p in zip(
|
|
118
|
+
pending.get_column(col).to_list(), pending.get_column(original).to_list(), pending.get_column(preferred).to_list()
|
|
119
|
+
):
|
|
120
|
+
logger.info(
|
|
121
|
+
f"FAILED QC | STORE: {section_hash} | CONFIG: {config_file} | COL: {col} | ORIGINAL: {o!r} | PREFERRED: {p!r} | CURIE: {c!r}"
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
return df.join(passed.select(col), on=col, how="semi").lazy()
|
tablassert/utils.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from diskcache import Cache
|
|
2
|
+
from functools import cache
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Any
|
|
5
|
+
from uuid import uuid3
|
|
6
|
+
from uuid import UUID
|
|
7
|
+
import polars as pl
|
|
8
|
+
import xxhash
|
|
9
|
+
|
|
10
|
+
STORE: Path = Path("./.storassert")
|
|
11
|
+
STORE.mkdir(parents=True, exist_ok=True)
|
|
12
|
+
|
|
13
|
+
DISKCACHE: object = Cache(
|
|
14
|
+
"./.cachassert",
|
|
15
|
+
size_limit=100_000_000, # ~100MB
|
|
16
|
+
eviction_policy="least-recently-used",
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def mkhash(x: Any) -> str:
|
|
21
|
+
b: bytes = str(x).encode("utf-8")
|
|
22
|
+
return xxhash.xxh64(b).hexdigest()
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def samphash(df: pl.DataFrame, n: int = 20) -> str:
|
|
26
|
+
# ? Hash Of Sampled DataFrame For Tempfile Naming
|
|
27
|
+
# ! Requires eager DataFrame input - call .collect() before passing LazyFrame
|
|
28
|
+
samp: pl.DataFrame = df.sample(min(n, df.height))
|
|
29
|
+
return mkhash(samp.to_init_repr())
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@cache
|
|
33
|
+
def basespace(domain: str) -> UUID:
|
|
34
|
+
namespace: UUID = UUID("00000000-0000-0000-0000-000000000000")
|
|
35
|
+
return uuid3(namespace, domain)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def namespace_uuid(domain: Any, *values: list[Any]) -> str:
|
|
39
|
+
domain = str(domain)
|
|
40
|
+
values = [str(x) for x in values if x] # pyright: ignore
|
|
41
|
+
domainspace: UUID = basespace(domain)
|
|
42
|
+
joined: str = "\t".join(values) # pyright: ignore
|
|
43
|
+
return str(uuid3(domainspace, joined))
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tablassert
|
|
3
|
+
Version: 7.0.0
|
|
4
|
+
Summary: Add your description here
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Requires-Python: >=3.13
|
|
7
|
+
Requires-Dist: diskcache>=5.6.3
|
|
8
|
+
Requires-Dist: duckdb>=1.5.0
|
|
9
|
+
Requires-Dist: fastexcel>=0.19.0
|
|
10
|
+
Requires-Dist: loguru>=0.7.3
|
|
11
|
+
Requires-Dist: mkdocs>=1.6.1
|
|
12
|
+
Requires-Dist: onnxruntime>=1.24.3
|
|
13
|
+
Requires-Dist: optimum-onnx>=0.1.0
|
|
14
|
+
Requires-Dist: orjson>=3.11.7
|
|
15
|
+
Requires-Dist: playwright>=1.58.0
|
|
16
|
+
Requires-Dist: polars>=1.39.0
|
|
17
|
+
Requires-Dist: pyarrow>=23.0.1
|
|
18
|
+
Requires-Dist: pydantic>=2.12.5
|
|
19
|
+
Requires-Dist: pyexcel>=0.7.4
|
|
20
|
+
Requires-Dist: pyyaml>=6.0.3
|
|
21
|
+
Requires-Dist: rapidfuzz>=3.14.3
|
|
22
|
+
Requires-Dist: scikit-learn>=1.8.0
|
|
23
|
+
Requires-Dist: sentence-transformers>=5.3.0
|
|
24
|
+
Requires-Dist: sqlite-utils>=3.39
|
|
25
|
+
Requires-Dist: typer>=0.24.1
|
|
26
|
+
Requires-Dist: xxhash>=3.6.0
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# Tablassert
|
|
30
|
+
|
|
31
|
+
### By Skye Lane Goetz, Gwênlyn Glusman, and Jared C. Roach
|
|
32
|
+
|
|
33
|
+
Tablassert is a highly performant declarative knowledge graph backend designed to extract knowledge assertions from tabular data while exporting NCATS Translator-compliant Knowledge Graph Exchange (KGX) NDJSON.
|
|
34
|
+
|
|
35
|
+
## Documentation
|
|
36
|
+
|
|
37
|
+
**[Full Documentation](https://skyeav.github.io/Tablassert/)**
|
|
38
|
+
|
|
39
|
+
Complete guides covering installation, configuration, tutorials, and API reference.
|
|
40
|
+
|
|
41
|
+
## Quick Start
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Clone repository
|
|
45
|
+
git clone https://github.com/SkyeAv/Tablassert.git
|
|
46
|
+
cd Tablassert
|
|
47
|
+
|
|
48
|
+
# Install with UV (requires Python 3.13+)
|
|
49
|
+
uv sync
|
|
50
|
+
|
|
51
|
+
# Run CLI
|
|
52
|
+
uv run tablassert --help
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Or install the CLI directly from PyPI:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Option A: UV tool install
|
|
59
|
+
uv tool install tablassert
|
|
60
|
+
|
|
61
|
+
# Option B: pip install
|
|
62
|
+
pip install tablassert
|
|
63
|
+
|
|
64
|
+
tablassert --help
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Usage (With UV)
|
|
68
|
+
|
|
69
|
+
### Prerequisites
|
|
70
|
+
|
|
71
|
+
- Python 3.13 or higher
|
|
72
|
+
- UV package manager
|
|
73
|
+
|
|
74
|
+
### Method 1: Development Installation (Recommended)
|
|
75
|
+
|
|
76
|
+
Best for exploring Tablassert or active development.
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# Clone and install dependencies
|
|
80
|
+
git clone https://github.com/SkyeAv/Tablassert.git
|
|
81
|
+
cd Tablassert
|
|
82
|
+
uv sync
|
|
83
|
+
|
|
84
|
+
# Run CLI through UV
|
|
85
|
+
uv run tablassert build-knowledge-graph /path/to/graph-config.yaml
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Method 2: Install from PyPI
|
|
89
|
+
|
|
90
|
+
Recommended for most users.
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# Option A: UV tool install
|
|
94
|
+
uv tool install tablassert
|
|
95
|
+
|
|
96
|
+
# Option B: pip install
|
|
97
|
+
pip install tablassert
|
|
98
|
+
|
|
99
|
+
tablassert build-knowledge-graph /path/to/graph-config.yaml
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Method 3: Install from GitHub main
|
|
103
|
+
|
|
104
|
+
Use this when you want the latest main-branch build before a tagged release.
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
uv tool install git+https://github.com/SkyeAv/Tablassert.git@main
|
|
108
|
+
tablassert build-knowledge-graph /path/to/graph-config.yaml
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Method 4: Local source install
|
|
112
|
+
|
|
113
|
+
For contributors testing local changes.
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Clone repository
|
|
117
|
+
git clone https://github.com/SkyeAv/Tablassert.git
|
|
118
|
+
cd Tablassert
|
|
119
|
+
|
|
120
|
+
# Install CLI tool from local source
|
|
121
|
+
uv tool install .
|
|
122
|
+
|
|
123
|
+
# CLI is now available
|
|
124
|
+
tablassert build-knowledge-graph /path/to/graph-config.yaml
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Key Features
|
|
128
|
+
|
|
129
|
+
- **Declarative Configuration:** YAML-based, no code required
|
|
130
|
+
- **Entity Resolution:** Maps text to biological entities (genes, diseases, chemicals)
|
|
131
|
+
- **Quality Control:** Three-stage validation (exact → fuzzy → BERT embeddings)
|
|
132
|
+
- **KGX Compliance:** NCATS Translator-compatible NDJSON output
|
|
133
|
+
- **Performance:** Parallel processing with disk caching
|
|
134
|
+
|
|
135
|
+
## Contributors
|
|
136
|
+
|
|
137
|
+
[Skye Lane Goetz](mailto:sgoetz@isbscience.org) - Institute for Systems Biology, CalPoly SLO
|
|
138
|
+
|
|
139
|
+
[Gwênlyn Glusman](mailto:gglusman@isbscience.org) - Institute for Systems Biology
|
|
140
|
+
|
|
141
|
+
Jared C. Roach - Institute for Systems Biology
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
tablassert/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
tablassert/downloader.py,sha256=UEMABrr2MBKLLfwU5L_qaaZz5FyIUhVLpED0G_ORhag,1071
|
|
3
|
+
tablassert/enums.py,sha256=nptjto2Q1ajrOGZwpbA0DQZXtfabqMWTC1fvumYjlJA,20298
|
|
4
|
+
tablassert/fullmap.py,sha256=XsVeD41DPX0BwnE2GuOUmXzF-fYSBwVm1CraiSgVIwE,6168
|
|
5
|
+
tablassert/ingests.py,sha256=BhsiJfLLuB8wddx-yidOmetPmnqrFkWHQLVSsJTmJ48,1235
|
|
6
|
+
tablassert/lib.py,sha256=fb6W-NAnJ_RuG9C_qGTFmWerfZJY5mHxD9_0jeu0mGI,21516
|
|
7
|
+
tablassert/log.py,sha256=Vj6BjOZHUi3VXenDio02L76C0saaHIEUHPj1i0KtSYs,330
|
|
8
|
+
tablassert/models.py,sha256=lgTW53aTIghIakFeIlqKZug1Zew1DTt2ez17xoZ-5Sk,3930
|
|
9
|
+
tablassert/qc.py,sha256=kL93c4unMyy2_GsyyBUSqTjRsvsCgCJePkUjT8oJ6h0,4946
|
|
10
|
+
tablassert/utils.py,sha256=cmnIKx9XlxrLCoRU__SCGNbCGmESLR8jI1jZ3X0FQC4,1187
|
|
11
|
+
tablassert-7.0.0.dist-info/METADATA,sha256=75ZVWxKCghM75DK-V_xISii-udJ_v1V2EziggWJum24,3473
|
|
12
|
+
tablassert-7.0.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
13
|
+
tablassert-7.0.0.dist-info/entry_points.txt,sha256=-bQngz2RIsHPcYHcICE7GO6aB9CgVSkfI4Id_cRX_IQ,50
|
|
14
|
+
tablassert-7.0.0.dist-info/licenses/LICENSE,sha256=OwLwApBpXalcfn9u_tsRU-hMA6aZ3apOuA2a136_aLs,11345
|
|
15
|
+
tablassert-7.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Skye Lane Goetz
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|