Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .linkml-reference-validator.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
cache_dir: publications
download_supplementary_files: true
email: cjmungall@lbl.gov
# Committed, reviewed cache: never re-fetch an entry for a missing/old extractor stamp.
trust_cached_entries: true
8 changes: 8 additions & 0 deletions conf/reference_validator_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ unknown_prefix_severity: WARNING
# cache_dir: directory containing cached publication text files (PMID_12345.md)
cache_dir: publications

# trust_cached_entries: publications/ is a committed, reviewed cache. Since
# linkml-reference-validator 0.3.0, an entry without a current
# extractor_version stamp (nearly all of ours) is otherwise treated as stale
# and re-fetched and rewritten on every validation run, which can shorten a
# body or replace text a curator quoted. Refresh entries deliberately with the
# publication ETL instead.
trust_cached_entries: true

# reference_base_dir: base directory for resolving file: references
reference_base_dir: genes

Expand Down
47 changes: 47 additions & 0 deletions conf/reference_validator_warm_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Configuration for warming the committed publications/ cache through
# linkml-reference-validator.
#
# Deliberately do NOT set trust_cached_entries here. The warm sweep exists to
# revisit abstract-only/stale cache entries and upgrade them when full text has
# become available; the normal validation config trusts the cache to avoid this
# network/refetch path during CI.
unknown_prefix_severity: WARNING

# cache_dir: directory containing cached publication text files (PMID_12345.md)
cache_dir: publications

# reference_base_dir: base directory for resolving file: references
reference_base_dir: genes

# skip_prefixes: reference prefixes the validator cannot fetch and should
# silently skip. These are non-literature identifiers where snippet
# validation does not apply.
skip_prefixes:
- GO_REF
- GO
- Reactome
- UniProt
- UniProtKB
- PDB
- EC
- TEMP
- ISBN
- RHEA
- file
- curator_inference
- ComplexPortal
- HPA
- PROSITE
- CHEBI
- PMC
- CONTACT_INFO
- inference
- InterPro
- thesis
- unindexed

# literal_bracket_patterns: regex patterns for bracketed text that should
# NOT be treated as citation markers (e.g., [2Fe-2S], [MEK], [Ca2+])
literal_bracket_patterns:
- "[^a-zA-Z\\s]" # keep brackets with non-alpha chars: [2Fe-2S], [Ca2+]
- "^[A-Z]{2,5}$" # keep short uppercase abbreviations: [MEK], [ATP]
201 changes: 0 additions & 201 deletions docs/licenses/linkml-reference-validator-Apache-2.0.txt

This file was deleted.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ dependencies = [
"rapidfuzz>=3.14.3",
"scipy>=1.16.1",
"linkml-data-qc>=0.1.0",
# <0.3: publication_warm.py calls LRV's private ReferenceFetcher._materialize;
# lift the bound once a public API lands (tracked in issue #2789).
"linkml-reference-validator>=0.2.1,<0.3",
# publication_warm.py still calls LRV's private ReferenceFetcher._materialize;
# keep a contract test around that call shape until issue #2789 lands.
"linkml-reference-validator>=0.3.0,<0.4",
"linkml-term-validator>=0.4.5",
"gocam>=0.11.0",
"pyhmmer>=0.12.1",
Expand Down
5 changes: 1 addition & 4 deletions scripts/extract_supporting_text_fixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,13 @@

from linkml_reference_validator.validation.supporting_text_validator import SupportingTextValidator
from linkml_reference_validator.models import ReferenceValidationConfig
from ai_gene_review.validation.reference_cache_compat import (
install_reference_cache_compatibility,
)


config = ReferenceValidationConfig(
cache_dir="publications",
trust_cached_entries=True,
literal_bracket_patterns=[r"[^a-zA-Z\s]"],
)
install_reference_cache_compatibility()
validator = SupportingTextValidator(config)

SKIP_PREFIXES = {
Expand Down
5 changes: 1 addition & 4 deletions scripts/mark_full_text_unavailable.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
SupportingTextValidator,
)
from linkml_reference_validator.models import ReferenceValidationConfig
from ai_gene_review.validation.reference_cache_compat import (
install_reference_cache_compatibility,
)

yaml_rt = YAML()
yaml_rt.preserve_quotes = True
Expand Down Expand Up @@ -97,9 +94,9 @@ def check_full_text(ref_id: str) -> bool | None:
# Set up LRV to check if supporting_text passes strict validation
config = ReferenceValidationConfig(
cache_dir="publications",
trust_cached_entries=True,
literal_bracket_patterns=[r"[^a-zA-Z\s]", r"^[A-Z]{2,5}$"],
)
install_reference_cache_compatibility()
lrv = SupportingTextValidator(config)

total_marked = 0
Expand Down
10 changes: 5 additions & 5 deletions scripts/run_reference_validator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@
# so we pre-process the YAML to remove supporting_text from those entries.
#
# Accepts one OR many data files. With many files it strips them in a single
# pass and makes a single `validate data F1 F2 ...` call through the version-gated
# ai_gene_review.validation.reference_cli compatibility entry point (the validator builds/parses the schema once), which is dramatically
# faster than one process per file. Requires linkml-reference-validator >= 0.2.1
# (multi-file `validate data`).
# pass and makes a single `validate data F1 F2 ...` call (the validator
# builds/parses the schema once), which is dramatically faster than one process
# per file. Requires linkml-reference-validator >= 0.3.0 (trusted-cache
# `validate data`).
#
# Usage: scripts/run_reference_validator.sh validate data F1 [F2 ...] --schema S --target-class C --config CFG

set -euo pipefail

run_lrv() {
set +e
output="$(uv run python -m ai_gene_review.validation.reference_cli "$@" 2>&1)"
output="$(uv run linkml-reference-validator "$@" 2>&1)"
exit_code=$?
set -e

Expand Down
9 changes: 6 additions & 3 deletions scripts/warm_reference_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
corpus with full-text fetching on (the validator's default) populates the cache so
subsequent runs are cache-bound.

Unlike normal validation, this sweep intentionally does not trust cached entries:
its job is to re-fetch abstract-only or stale records and upgrade them when full
text has become available.

This processes the corpus in chunks for progress/resumability and ignores
validation pass/fail — the goal here is only to populate the cache. References are
read from the structured YAML fields (not a regex over prose), so no malformed
Expand All @@ -25,7 +29,7 @@
import time

SCHEMA = "src/ai_gene_review/schema/gene_review.yaml"
CONFIG = "conf/reference_validator_config.yaml"
CONFIG = "conf/reference_validator_warm_config.yaml"
CHUNK = 100


Expand All @@ -43,8 +47,7 @@ def main() -> int:
# expected and irrelevant here; we only want the references fetched into the cache.
subprocess.run(
[
"uv", "run", "python", "-m",
"ai_gene_review.validation.reference_cli", "validate", "data", *batch,
"uv", "run", "linkml-reference-validator", "validate", "data", *batch,
"--schema", SCHEMA, "--target-class", "GeneReview", "--config", CONFIG,
],
stdout=subprocess.DEVNULL,
Expand Down
Loading
Loading