bioai-evidence-validator 0.4.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 (58) hide show
  1. bioai_evidence_validator-0.4.1/.gitattributes +1 -0
  2. bioai_evidence_validator-0.4.1/.github/workflows/ci.yml +38 -0
  3. bioai_evidence_validator-0.4.1/.github/workflows/release.yml +74 -0
  4. bioai_evidence_validator-0.4.1/.gitignore +9 -0
  5. bioai_evidence_validator-0.4.1/CHANGELOG.md +44 -0
  6. bioai_evidence_validator-0.4.1/CITATION.cff +21 -0
  7. bioai_evidence_validator-0.4.1/LICENSE +202 -0
  8. bioai_evidence_validator-0.4.1/PKG-INFO +241 -0
  9. bioai_evidence_validator-0.4.1/README.md +211 -0
  10. bioai_evidence_validator-0.4.1/docs/ADR-001-canine-breed-first.md +41 -0
  11. bioai_evidence_validator-0.4.1/docs/ADR-002-domain-neutral-main.md +30 -0
  12. bioai_evidence_validator-0.4.1/docs/CASE_STUDY.md +50 -0
  13. bioai_evidence_validator-0.4.1/docs/ENGINEERING.md +83 -0
  14. bioai_evidence_validator-0.4.1/docs/GOLD_STANDARD.md +113 -0
  15. bioai_evidence_validator-0.4.1/docs/MIGRATION-0.4.md +32 -0
  16. bioai_evidence_validator-0.4.1/docs/PROFILES.md +97 -0
  17. bioai_evidence_validator-0.4.1/docs/assets/vbo_canine_benchmark.svg +2769 -0
  18. bioai_evidence_validator-0.4.1/evaluation/gold_standard/README.md +27 -0
  19. bioai_evidence_validator-0.4.1/evaluation/gold_standard/adjudications.template.csv +1 -0
  20. bioai_evidence_validator-0.4.1/evaluation/gold_standard/annotations.template.csv +1 -0
  21. bioai_evidence_validator-0.4.1/evaluation/gold_standard/manifest.template.json +17 -0
  22. bioai_evidence_validator-0.4.1/examples/custom_profile/assay.yaml +16 -0
  23. bioai_evidence_validator-0.4.1/examples/custom_profile/assay_record.json +61 -0
  24. bioai_evidence_validator-0.4.1/examples/dataset_label/curated_sample_label.json +88 -0
  25. bioai_evidence_validator-0.4.1/examples/dataset_label/missing_sample_link.json +76 -0
  26. bioai_evidence_validator-0.4.1/examples/general/curated_assertion.json +61 -0
  27. bioai_evidence_validator-0.4.1/examples/literature_claim/curated_association.json +61 -0
  28. bioai_evidence_validator-0.4.1/examples/literature_claim/llm_only.json +61 -0
  29. bioai_evidence_validator-0.4.1/examples/vbo_canine/README.md +138 -0
  30. bioai_evidence_validator-0.4.1/examples/vbo_canine/pipeline.py +157 -0
  31. bioai_evidence_validator-0.4.1/examples/vbo_canine/prepare_source.py +79 -0
  32. bioai_evidence_validator-0.4.1/examples/vbo_canine/profile.yaml +12 -0
  33. bioai_evidence_validator-0.4.1/examples/vbo_canine/reference_cases.json +750 -0
  34. bioai_evidence_validator-0.4.1/examples/vbo_canine/results/decisions.jsonl +248 -0
  35. bioai_evidence_validator-0.4.1/examples/vbo_canine/results/review_queue.csv +25 -0
  36. bioai_evidence_validator-0.4.1/examples/vbo_canine/results/summary.json +151 -0
  37. bioai_evidence_validator-0.4.1/examples/vbo_canine/results/summary.md +19 -0
  38. bioai_evidence_validator-0.4.1/examples/vbo_canine/run.py +85 -0
  39. bioai_evidence_validator-0.4.1/examples/vbo_canine/sources/README.md +21 -0
  40. bioai_evidence_validator-0.4.1/examples/vbo_canine/sources/manifest.json +17 -0
  41. bioai_evidence_validator-0.4.1/examples/vbo_canine/sources/vbo-dogs.json +20069 -0
  42. bioai_evidence_validator-0.4.1/pyproject.toml +52 -0
  43. bioai_evidence_validator-0.4.1/src/bioevidence_validator/__init__.py +3 -0
  44. bioai_evidence_validator-0.4.1/src/bioevidence_validator/cli.py +114 -0
  45. bioai_evidence_validator-0.4.1/src/bioevidence_validator/config.py +37 -0
  46. bioai_evidence_validator-0.4.1/src/bioevidence_validator/engine.py +265 -0
  47. bioai_evidence_validator-0.4.1/src/bioevidence_validator/profiles/dataset-label.yaml +35 -0
  48. bioai_evidence_validator-0.4.1/src/bioevidence_validator/profiles/general.yaml +28 -0
  49. bioai_evidence_validator-0.4.1/src/bioevidence_validator/profiles/literature-claim.yaml +26 -0
  50. bioai_evidence_validator-0.4.1/src/bioevidence_validator/schema/bioevidence_core.yaml +336 -0
  51. bioai_evidence_validator-0.4.1/tests/test_cli.py +148 -0
  52. bioai_evidence_validator-0.4.1/tests/test_engine.py +177 -0
  53. bioai_evidence_validator-0.4.1/tests/test_evidence_quality.py +50 -0
  54. bioai_evidence_validator-0.4.1/tests/test_fail_closed.py +104 -0
  55. bioai_evidence_validator-0.4.1/tests/test_profiles.py +78 -0
  56. bioai_evidence_validator-0.4.1/tests/test_vbo_case.py +64 -0
  57. bioai_evidence_validator-0.4.1/tools/check_distribution.py +60 -0
  58. bioai_evidence_validator-0.4.1/uv.lock +1791 -0
@@ -0,0 +1 @@
1
+ * text=auto eol=lf
@@ -0,0 +1,38 @@
1
+ name: Repository checks
2
+ on:
3
+ push:
4
+ branches: [main]
5
+ pull_request:
6
+ permissions:
7
+ contents: read
8
+ jobs:
9
+ verify:
10
+ timeout-minutes: 15
11
+ strategy:
12
+ matrix:
13
+ include:
14
+ - os: ubuntu-latest
15
+ python: '3.11'
16
+ - os: ubuntu-latest
17
+ python: '3.12'
18
+ - os: ubuntu-latest
19
+ python: '3.13'
20
+ - os: windows-latest
21
+ python: '3.13'
22
+ runs-on: ${{ matrix.os }}
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+ - uses: actions/setup-python@v5
26
+ with:
27
+ python-version: ${{ matrix.python }}
28
+ - name: Install locked tooling
29
+ run: python -m pip install uv==0.12.17
30
+ - name: Install locked project
31
+ run: uv sync --frozen --extra dev --python ${{ matrix.python }}
32
+ - name: Run tests
33
+ run: uv run --frozen pytest
34
+ - name: Build distributable
35
+ run: uv build
36
+ - name: Verify installed wheel and CLI outside editable source
37
+ shell: bash
38
+ run: uv run --isolated --no-project --python ${{ matrix.python }} --with ./dist/*.whl python tools/check_distribution.py
@@ -0,0 +1,74 @@
1
+ name: Release
2
+ on:
3
+ push:
4
+ tags: ['v*']
5
+ permissions:
6
+ contents: read
7
+ jobs:
8
+ build:
9
+ timeout-minutes: 15
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - uses: actions/setup-python@v5
14
+ with:
15
+ python-version: '3.12'
16
+ - name: Install locked tooling
17
+ run: python -m pip install uv==0.12.17
18
+ - name: Check tag matches package version
19
+ run: |
20
+ version=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
21
+ if [ "v$version" != "$GITHUB_REF_NAME" ]; then
22
+ echo "Tag $GITHUB_REF_NAME does not match pyproject version $version" >&2
23
+ exit 1
24
+ fi
25
+ - name: Install locked project
26
+ run: uv sync --frozen --extra dev
27
+ - name: Run tests
28
+ run: uv run --frozen pytest
29
+ - name: Build distributable
30
+ run: uv build
31
+ - name: Verify installed wheel and CLI outside editable source
32
+ run: uv run --isolated --no-project --with ./dist/*.whl python tools/check_distribution.py
33
+ - uses: actions/upload-artifact@v4
34
+ with:
35
+ name: dist
36
+ path: dist/
37
+
38
+ publish-pypi:
39
+ needs: build
40
+ runs-on: ubuntu-latest
41
+ environment:
42
+ name: pypi
43
+ url: https://pypi.org/project/bioai-evidence-validator/
44
+ permissions:
45
+ id-token: write
46
+ steps:
47
+ - uses: actions/download-artifact@v4
48
+ with:
49
+ name: dist
50
+ path: dist/
51
+ - uses: pypa/gh-action-pypi-publish@release/v1
52
+
53
+ github-release:
54
+ needs: publish-pypi
55
+ runs-on: ubuntu-latest
56
+ permissions:
57
+ contents: write
58
+ steps:
59
+ - uses: actions/checkout@v4
60
+ - uses: actions/download-artifact@v4
61
+ with:
62
+ name: dist
63
+ path: dist/
64
+ - name: Create GitHub release from the CHANGELOG section
65
+ env:
66
+ GH_TOKEN: ${{ github.token }}
67
+ run: |
68
+ version="${GITHUB_REF_NAME#v}"
69
+ awk -v v="$version" '
70
+ /^## / { if (found) exit; if (index($0, "## " v " ") == 1) { found = 1; next } }
71
+ found' CHANGELOG.md > release-notes.md
72
+ test -s release-notes.md
73
+ gh release create "$GITHUB_REF_NAME" dist/* --verify-tag \
74
+ --title "$GITHUB_REF_NAME" --notes-file release-notes.md
@@ -0,0 +1,9 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.py[cod]
4
+ .pytest_cache/
5
+ *.egg-info/
6
+ dist/
7
+ build/
8
+ artifacts/
9
+ validation_report.json
@@ -0,0 +1,44 @@
1
+ # Changelog
2
+
3
+ ## 0.4.1 — Required-evidence quality and real-source evaluation
4
+
5
+ - Apply extraction-method quality gates to each required evidence type independently.
6
+ - Prevent unrelated manual/parser evidence from admitting an LLM-only required result.
7
+ - Add an attributed, frozen VBO canine name-mapping case and source rebuild script.
8
+ - Evaluate 72 real-source names, 160 controlled faults, and 16 explicit trust-boundary cases separately.
9
+ - Preserve generic main and the legacy canine-breed branch.
10
+ - Publish to PyPI from version tags; add package metadata and citation file.
11
+ - Reject CLI input nested deeper than 100 levels (exit 3) on every platform and Python version.
12
+
13
+ ## 0.4.0 — Domain-neutral main
14
+
15
+ - Preserve canine 0.3 functionality on the `canine-breed` branch.
16
+ - Replace canine defaults with a generic entity/relation/evidence schema and strict YAML profiles.
17
+ - Add general, literature-claim, dataset-label, and custom assay examples.
18
+ - Bind human adjudications to statements and uses; enforce evidence scope and reference integrity.
19
+ - Replace `--policy` with `--profile`; add profile discovery and generic audit fields.
20
+ - Remove the canine SQLite command from main. See `docs/MIGRATION-0.4.md` for breaking changes.
21
+
22
+ ## 0.3.0 — Evidence and snapshot contract hardening
23
+
24
+ - Require resolved supporting evidence, selected-candidate consistency and
25
+ compatible claim predicates; block relationship claims from sample/frequency label use.
26
+ - Enforce scope exclusions from concept scope, use only supporting scope evidence,
27
+ reject blank provenance and unresolved references in unused evidence.
28
+ - Reject incomplete/duplicate/unknown policy configuration; custom schemas cannot
29
+ relax the packaged structural baseline. Snapshot validation context per batch.
30
+ - Reject duplicate database IDs, WAL/SHM/journal sidecars, malformed manifests
31
+ and unrecognized boolean evidence. Include resolution-row provenance,
32
+ limits/accounting and batch hashes; publish the completion summary last.
33
+ - Preserve earlier policy files, synthetic examples and operational CLI exit codes.
34
+
35
+ ## 0.2.0 — Evidence admission contracts and reproducible CLI
36
+
37
+ - Version schema/policy 0.2; preserve policy 0.1 and record generated-schema hashes.
38
+ - Prevent withdrawn statements or conflicting human judgments from silently being admitted.
39
+ - Reject missing, empty, malformed, duplicated or unknown requested uses.
40
+ - Make structural and identity errors block the entire record, including unknown uses.
41
+ - Require evidence collections and reject duplicate IDs before dictionary lookup.
42
+ - Return structured operational CLI errors; parse UTF-8 strictly and write reports atomically.
43
+ - Add regression tests, a Linux/Windows CI workflow and an installed-wheel smoke check.
44
+ - Include the Apache-2.0 license already declared in project metadata.
@@ -0,0 +1,21 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use this software, please cite it as below."
3
+ type: software
4
+ title: "BioAI Evidence Validator"
5
+ abstract: >-
6
+ Evidence validation and policy engine for AI-assisted biological curation.
7
+ It checks evidence structure, provenance consistency, scope and review
8
+ requirements, then reports an admission decision for each requested use.
9
+ authors:
10
+ - family-names: Sun
11
+ given-names: Ningyu
12
+ version: 0.4.1
13
+ license: Apache-2.0
14
+ repository-code: "https://github.com/NingyuSUN/bioai-evidence-validator"
15
+ keywords:
16
+ - bioinformatics
17
+ - biocuration
18
+ - evidence
19
+ - provenance
20
+ - LLM
21
+ - LinkML
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,241 @@
1
+ Metadata-Version: 2.5
2
+ Name: bioai-evidence-validator
3
+ Version: 0.4.1
4
+ Summary: Standards-aligned evidence policy validation for AI-assisted biological curation
5
+ Project-URL: Homepage, https://github.com/NingyuSUN/bioai-evidence-validator
6
+ Project-URL: Documentation, https://github.com/NingyuSUN/bioai-evidence-validator/tree/main/docs
7
+ Project-URL: Changelog, https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/CHANGELOG.md
8
+ Project-URL: Issues, https://github.com/NingyuSUN/bioai-evidence-validator/issues
9
+ Author: Ningyu Sun
10
+ License: Apache-2.0
11
+ License-File: LICENSE
12
+ Keywords: ai-safety,biocuration,bioinformatics,evidence,knowledge-graph,linkml,llm,ontology,provenance,validation
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
23
+ Requires-Python: >=3.11
24
+ Requires-Dist: jsonschema<5,>=4.23
25
+ Requires-Dist: linkml<2,>=1.8
26
+ Requires-Dist: pyyaml<7,>=6.0
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest<9,>=8; extra == 'dev'
29
+ Description-Content-Type: text/markdown
30
+
31
+ # BioAI Evidence Validator
32
+
33
+ [![CI](https://github.com/NingyuSUN/bioai-evidence-validator/actions/workflows/ci.yml/badge.svg)](https://github.com/NingyuSUN/bioai-evidence-validator/actions/workflows/ci.yml)
34
+ [![PyPI](https://img.shields.io/pypi/v/bioai-evidence-validator)](https://pypi.org/project/bioai-evidence-validator/)
35
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue)](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/pyproject.toml)
36
+ [![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue)](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/LICENSE)
37
+
38
+ **Stop AI-extracted biological claims from entering your knowledge base or
39
+ training set before their evidence is good enough for that use.**
40
+
41
+ An LLM can turn a paper into a tidy `gene → associated_with → phenotype` record
42
+ that passes every schema check. This toolkit asks the next question: *is the
43
+ evidence behind it sufficient for the specific use you have in mind?* It checks
44
+ evidence structure, provenance consistency, scope and human-review requirements,
45
+ then returns an auditable **admitted / review_required / rejected** decision for
46
+ each requested use.
47
+
48
+ ```bash
49
+ pip install bioai-evidence-validator
50
+ ```
51
+
52
+ ## 30-second example
53
+
54
+ The two records below are identical except for one field: how the supporting
55
+ evidence was extracted.
56
+
57
+ ```diff
58
+ "evidence_type": "publication_result",
59
+ - "extraction_method": "llm_extraction",
60
+ + "extraction_method": "manual_curation",
61
+ ```
62
+
63
+ ```console
64
+ $ bioevidence validate examples/literature_claim/llm_only.json --profile literature-claim
65
+ ```
66
+
67
+ ```json
68
+ {
69
+ "overall_status": "review_required",
70
+ "findings": [
71
+ {
72
+ "rule_id": "BEV008",
73
+ "severity": "review",
74
+ "message": "Required evidence type 'publication_result' comes only from LLM extraction.",
75
+ "blocking_uses": ["research_summary"]
76
+ }
77
+ ],
78
+ "use_decisions": [
79
+ { "use": "research_summary", "admission_status": "review_required", "reason_codes": ["BEV008"] }
80
+ ]
81
+ }
82
+ ```
83
+
84
+ The command exits with **2**, so a pipeline can route the record to a reviewer.
85
+ The manually curated version (`examples/literature_claim/curated_association.json`)
86
+ is `admitted` with exit code **0**. Every full report also records the input,
87
+ schema and profile SHA-256 hashes and versions for audit.
88
+
89
+ ## Why not just JSON Schema or Pydantic?
90
+
91
+ A schema tells you a record is well formed. It cannot tell you whether the
92
+ record is trustworthy enough for a particular purpose.
93
+
94
+ | | Schema validation | This validator |
95
+ |---|:---:|:---:|
96
+ | Record shape and types | ✅ | ✅ (LinkML) |
97
+ | Different evidence rules per intended use (summary vs. KB vs. training) | — | ✅ |
98
+ | Quality gate per required evidence type (LLM-only evidence cannot ride on unrelated manual evidence) | — | ✅ |
99
+ | Provenance consistency (source hashes, resolved references, scope) | — | ✅ |
100
+ | Human adjudications bound to a specific statement and use | — | ✅ |
101
+ | Machine-readable audit report with hashes of input, schema and profile | — | ✅ |
102
+
103
+ On the real-data benchmark below, schema-only checks admitted **160/160**
104
+ injected faults; the full validator admitted **0/160**.
105
+
106
+ ## Use it
107
+
108
+ ### Command line
109
+
110
+ ```bash
111
+ bioevidence profiles # list built-in profiles and their use contracts
112
+ bioevidence validate record.json --profile literature-claim
113
+ bioevidence validate record.json --profile my_profile.yaml --output report.json
114
+ bioevidence generate-schema --output record.schema.json # JSON Schema for the input format
115
+ ```
116
+
117
+ Exit codes: **0** admitted, **1** rejected, **2** review required, **3** input or configuration error.
118
+
119
+ ### Python
120
+
121
+ ```python
122
+ import json
123
+ from pathlib import Path
124
+
125
+ from bioevidence_validator.engine import validate_record
126
+
127
+ record = json.loads(Path("record.json").read_text(encoding="utf-8"))
128
+ report = validate_record(record, profile="literature-claim")
129
+
130
+ for decision in report["use_decisions"]:
131
+ print(decision["use"], decision["admission_status"], decision["reason_codes"])
132
+ ```
133
+
134
+ `profile` accepts a built-in name or a path to your own YAML profile.
135
+
136
+ ## How it works
137
+
138
+ ```mermaid
139
+ flowchart TD
140
+ A["Structured evidence JSON"] --> B["LinkML structure checks"]
141
+ B --> C["Reference and scope checks"]
142
+ P["Selected YAML profile"] --> C
143
+ C --> D["Evidence and human review requirements"]
144
+ D --> E["Decision for each requested use"]
145
+ E --> F["Audit report: findings, versions and hashes"]
146
+ S["Frozen source evidence + intended use"] --> R["Independent human annotation"]
147
+ R --> J["Resolve disagreements and record uncertainty"]
148
+ J --> G["Freeze gold-standard test set"]
149
+ G --> V["Compare held-out decisions with gold standard"]
150
+ F --> V
151
+ V --> M["False admission, false block and review rates"]
152
+ ```
153
+
154
+ This diagram defines the complete project workflow. Each project supplies its own
155
+ reviewed reference labels; the validator's decisions are evaluated against them.
156
+ Gold labels stay separate from runtime evidence and rule development.
157
+
158
+ Domain rules are YAML profiles: new entity types, relations, evidence types and
159
+ uses do not require engine edits.
160
+
161
+ | Example profile | Assertion | Use contract |
162
+ |---|---|---|
163
+ | `general` | Any typed entity–relation–entity statement | Provenance, scoped support, optional human review by use |
164
+ | `literature-claim` | Gene/variant associated with phenotype/disease | Publication evidence; human acceptance for knowledge-base admission |
165
+ | `dataset-label` | Sample assigned a label | Curated label plus sample link; human acceptance for training |
166
+ | Custom YAML | Compound measured response in an assay | Assay evidence; defined without changing Python code |
167
+
168
+ See [Create a profile](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/docs/PROFILES.md).
169
+
170
+ ## Run the examples from source
171
+
172
+ Python 3.11+ and [uv](https://docs.astral.sh/uv/), from the repository root:
173
+
174
+ ```bash
175
+ uv sync --frozen --extra dev
176
+ uv run bioevidence profiles
177
+ uv run bioevidence validate examples/general/curated_assertion.json
178
+ uv run bioevidence validate examples/literature_claim/llm_only.json --profile literature-claim
179
+ uv run bioevidence validate examples/custom_profile/assay_record.json --profile examples/custom_profile/assay.yaml
180
+ uv run pytest
181
+ ```
182
+
183
+ ## Build a gold standard for your project
184
+
185
+ 1. **Define the task:** specify the domain, intended uses, label definitions and evidence requirements in a written rubric.
186
+ 2. **Select and freeze cases:** retain source versions and record hashes; group related entities and aliases into the same development/test split.
187
+ 3. **Review independently:** domain reviewers label mapping correctness and use-specific admission without seeing validator predictions; record evidence and uncertainty.
188
+ 4. **Resolve and version:** preserve original reviews, document disagreements and adjudication, then freeze the labels and provenance manifest.
189
+ 5. **Evaluate:** compare held-out decisions with that reference; report false admissions, false blocks and review rates with counts and denominators.
190
+
191
+ Use the [annotation templates](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/evaluation/gold_standard/README.md) and
192
+ [detailed protocol](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/docs/GOLD_STANDARD.md). Each gold standard is specific to a task,
193
+ source version and intended use. Document reviewer roles and whether labels are
194
+ single-reviewed or independently reviewed by multiple people.
195
+
196
+ ## Real-data case
197
+
198
+ [VBO canine name mapping](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/examples/vbo_canine/README.md) uses a frozen public ontology:
199
+ 72 real-name cases, 160 controlled errors, and 16 separately reported trust-boundary
200
+ cases. It compares schema-only checks, the previous aggregate quality gate, and
201
+ per-required-evidence-type validation. Source-derived labels are not expert annotations.
202
+
203
+ ```bash
204
+ uv run python examples/vbo_canine/run.py --output artifacts/vbo-canine
205
+ ```
206
+
207
+ ### Benchmark results (v0.4.1)
208
+
209
+ ![VBO canine benchmark comparing false admissions across three validation methods](https://raw.githubusercontent.com/NingyuSUN/bioai-evidence-validator/main/docs/assets/vbo_canine_benchmark.svg)
210
+
211
+ On 72 real-source name mappings, the full validator admitted all 48 unambiguous cases and blocked automatic admission of all 24 ambiguous names (0/48 false blocks; 0/24 false admissions). Across 160 deliberately injected faults, false admissions were 160/160 for schema-only, 64/160 for the aggregate-quality ablation, and 0/160 for the full validator; the full validator sent 80 cases to review and rejected 80. All three methods admitted 16/16 falsified-target trust-boundary cases, showing the need for trustworthy source ingestion and supplied metadata.
212
+
213
+ **Interpretation limits:** Reference labels are derived from the pinned VBO source and authored fault specifications, not independent expert annotations. The 160 mutations share 16 seed cases and are correlated. This benchmark tests the mapping contract and controlled fault detection; it does not estimate biological accuracy or production error rates. See the [protocol and full results](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/examples/vbo_canine/README.md) and [machine-readable summary](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/examples/vbo_canine/results/summary.json).
214
+
215
+ ## Scope
216
+
217
+ The VBO case uses attributed public data; other fixtures are synthetic.
218
+ Admission means **the supplied record meets the selected
219
+ profile**, not that a biological claim is true. The toolkit does not retrieve papers,
220
+ verify reviewer identities, train models, or measure prediction accuracy. The generic core compares supplied hashes; the VBO importer also hashes its local source
221
+ projection. External source truth and cohort independence require upstream verification.
222
+
223
+ ## Versions and branches
224
+
225
+ `main` is the domain-neutral framework (0.4.1). The complete canine implementation
226
+ and SQLite adapter from 0.3 live on the
227
+ [`canine-breed` branch](https://github.com/NingyuSUN/bioai-evidence-validator/tree/canine-breed);
228
+ see the [0.4 migration guide](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/docs/MIGRATION-0.4.md) and
229
+ [changelog](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/CHANGELOG.md).
230
+
231
+ ## Citing
232
+
233
+ If you use this toolkit in research, please cite it using the metadata in
234
+ [`CITATION.cff`](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/CITATION.cff)
235
+ (GitHub's "Cite this repository" button generates APA and BibTeX).
236
+
237
+ [Create a profile](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/docs/PROFILES.md) ·
238
+ [Engineering contract](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/docs/ENGINEERING.md) ·
239
+ [Design case study](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/docs/CASE_STUDY.md) ·
240
+ [Architecture decision](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/docs/ADR-002-domain-neutral-main.md) ·
241
+ [Apache-2.0](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/LICENSE)