scitheory 0.1.0__tar.gz → 0.2.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 (120) hide show
  1. scitheory-0.2.0/.gitattributes +23 -0
  2. {scitheory-0.1.0 → scitheory-0.2.0}/.github/workflows/ci.yml +26 -26
  3. scitheory-0.2.0/.gitignore +33 -0
  4. scitheory-0.2.0/CHANGELOG.md +23 -0
  5. {scitheory-0.1.0 → scitheory-0.2.0}/CITATION.cff +12 -12
  6. {scitheory-0.1.0 → scitheory-0.2.0}/LICENSE +21 -21
  7. scitheory-0.2.0/PKG-INFO +133 -0
  8. scitheory-0.2.0/README.md +96 -0
  9. scitheory-0.2.0/corpora/wp02.json +29 -0
  10. scitheory-0.2.0/docs/annotation.md +186 -0
  11. scitheory-0.2.0/docs/explain.md +107 -0
  12. scitheory-0.2.0/docs/extract.md +291 -0
  13. scitheory-0.2.0/docs/gaps.md +103 -0
  14. scitheory-0.2.0/docs/graph.md +112 -0
  15. {scitheory-0.1.0 → scitheory-0.2.0}/docs/index.md +13 -10
  16. scitheory-0.2.0/docs/ingest.md +78 -0
  17. scitheory-0.2.0/docs/normalize.md +33 -0
  18. scitheory-0.2.0/docs/polarity.md +19 -0
  19. {scitheory-0.1.0 → scitheory-0.2.0}/docs/schema.md +34 -26
  20. {scitheory-0.1.0 → scitheory-0.2.0}/examples/claims_synthetic.json +47 -47
  21. scitheory-0.2.0/examples/theory_map_board_size.pdf +80 -0
  22. scitheory-0.2.0/examples/theory_map_board_size.svg +58 -0
  23. scitheory-0.2.0/examples/theory_map_job_satisfaction.pdf +86 -0
  24. scitheory-0.2.0/examples/theory_map_job_satisfaction.svg +126 -0
  25. scitheory-0.2.0/examples/theory_map_physical_activity.pdf +80 -0
  26. scitheory-0.2.0/examples/theory_map_physical_activity.svg +51 -0
  27. scitheory-0.2.0/mkdocs.yml +16 -0
  28. {scitheory-0.1.0 → scitheory-0.2.0}/pyproject.toml +63 -48
  29. scitheory-0.2.0/scripts/acceptance_wp02.py +141 -0
  30. scitheory-0.2.0/scripts/acceptance_wp03.py +162 -0
  31. scitheory-0.2.0/scripts/ei_match_sensitivity.py +124 -0
  32. scitheory-0.2.0/scripts/ei_to_reference.py +214 -0
  33. scitheory-0.2.0/scripts/evaluate_extraction.py +256 -0
  34. scitheory-0.2.0/scripts/external_bootstrap.py +99 -0
  35. scitheory-0.2.0/scripts/extract_sample.py +177 -0
  36. scitheory-0.2.0/scripts/make_annotation_sample.py +135 -0
  37. scitheory-0.2.0/scripts/paired_bootstrap.py +109 -0
  38. scitheory-0.2.0/scripts/probe_coverage.py +136 -0
  39. scitheory-0.2.0/scripts/rename_corpus_folders.py +68 -0
  40. scitheory-0.2.0/scripts/sciclaim_to_reference.py +205 -0
  41. scitheory-0.2.0/scripts/score_psy_to_reference.py +127 -0
  42. scitheory-0.2.0/scripts/score_to_reference.py +182 -0
  43. scitheory-0.2.0/scripts/threshold_sensitivity.py +74 -0
  44. scitheory-0.2.0/scripts/validate_annotation.py +114 -0
  45. {scitheory-0.1.0 → scitheory-0.2.0}/src/scitheory/__init__.py +37 -35
  46. scitheory-0.2.0/src/scitheory/batch.py +206 -0
  47. scitheory-0.2.0/src/scitheory/explain/__init__.py +61 -0
  48. scitheory-0.2.0/src/scitheory/explain/__main__.py +3 -0
  49. scitheory-0.2.0/src/scitheory/explain/build.py +169 -0
  50. scitheory-0.2.0/src/scitheory/explain/contradictions.py +541 -0
  51. scitheory-0.2.0/src/scitheory/explain/effects.py +92 -0
  52. scitheory-0.2.0/src/scitheory/explain/stats.py +201 -0
  53. scitheory-0.2.0/src/scitheory/extract/__init__.py +38 -0
  54. scitheory-0.2.0/src/scitheory/extract/base.py +75 -0
  55. scitheory-0.2.0/src/scitheory/extract/model.py +219 -0
  56. scitheory-0.2.0/src/scitheory/extract/model_openai.py +113 -0
  57. scitheory-0.2.0/src/scitheory/extract/prompt.py +203 -0
  58. scitheory-0.2.0/src/scitheory/extract/rules.py +344 -0
  59. scitheory-0.2.0/src/scitheory/extract/text.py +34 -0
  60. scitheory-0.2.0/src/scitheory/gaps/__init__.py +76 -0
  61. scitheory-0.2.0/src/scitheory/gaps/__main__.py +3 -0
  62. scitheory-0.2.0/src/scitheory/gaps/build.py +254 -0
  63. scitheory-0.2.0/src/scitheory/gaps/rank.py +500 -0
  64. scitheory-0.2.0/src/scitheory/gaps/value.py +76 -0
  65. scitheory-0.2.0/src/scitheory/graph/__init__.py +60 -0
  66. scitheory-0.2.0/src/scitheory/graph/__main__.py +3 -0
  67. scitheory-0.2.0/src/scitheory/graph/build.py +126 -0
  68. scitheory-0.2.0/src/scitheory/graph/constructs.py +266 -0
  69. scitheory-0.2.0/src/scitheory/graph/figure.py +336 -0
  70. scitheory-0.2.0/src/scitheory/graph/model.py +459 -0
  71. scitheory-0.2.0/src/scitheory/graph/records.py +235 -0
  72. scitheory-0.2.0/src/scitheory/ingest/__init__.py +35 -0
  73. scitheory-0.2.0/src/scitheory/ingest/openalex.py +229 -0
  74. scitheory-0.2.0/src/scitheory/ingest/records.py +81 -0
  75. scitheory-0.2.0/src/scitheory/ingest/report.py +48 -0
  76. scitheory-0.2.0/src/scitheory/ingest/select.py +130 -0
  77. scitheory-0.2.0/src/scitheory/ingest/store.py +131 -0
  78. scitheory-0.2.0/src/scitheory/normalize/__init__.py +44 -0
  79. scitheory-0.2.0/src/scitheory/normalize/adjudicate.py +288 -0
  80. scitheory-0.2.0/src/scitheory/normalize/evaluate.py +146 -0
  81. scitheory-0.2.0/src/scitheory/normalize/prompt.py +65 -0
  82. scitheory-0.2.0/src/scitheory/polarity/__init__.py +46 -0
  83. scitheory-0.2.0/src/scitheory/polarity/__main__.py +19 -0
  84. scitheory-0.2.0/src/scitheory/polarity/apply.py +267 -0
  85. scitheory-0.2.0/src/scitheory/polarity/rules.py +156 -0
  86. {scitheory-0.1.0 → scitheory-0.2.0}/src/scitheory/schema.py +183 -171
  87. scitheory-0.2.0/tests/test_batch.py +174 -0
  88. scitheory-0.2.0/tests/test_corpora.py +124 -0
  89. scitheory-0.2.0/tests/test_evaluate.py +71 -0
  90. scitheory-0.2.0/tests/test_evidence_inference.py +78 -0
  91. scitheory-0.2.0/tests/test_explain.py +325 -0
  92. scitheory-0.2.0/tests/test_extract.py +170 -0
  93. scitheory-0.2.0/tests/test_gaps.py +268 -0
  94. scitheory-0.2.0/tests/test_graph.py +302 -0
  95. scitheory-0.2.0/tests/test_ingest.py +199 -0
  96. scitheory-0.2.0/tests/test_model_extract.py +182 -0
  97. scitheory-0.2.0/tests/test_normalize.py +147 -0
  98. scitheory-0.2.0/tests/test_openai_extract.py +88 -0
  99. {scitheory-0.1.0 → scitheory-0.2.0}/tests/test_package.py +14 -14
  100. scitheory-0.2.0/tests/test_paired_bootstrap.py +38 -0
  101. scitheory-0.2.0/tests/test_polarity.py +276 -0
  102. scitheory-0.2.0/tests/test_probe.py +119 -0
  103. scitheory-0.2.0/tests/test_rename_folders.py +49 -0
  104. {scitheory-0.1.0 → scitheory-0.2.0}/tests/test_schema.py +62 -52
  105. scitheory-0.2.0/tests/test_sciclaim_mapping.py +88 -0
  106. scitheory-0.2.0/tests/test_score.py +97 -0
  107. scitheory-0.2.0/tests/test_theory_map.py +140 -0
  108. scitheory-0.2.0/tests/test_wp03_acceptance.py +52 -0
  109. scitheory-0.1.0/.gitignore +0 -16
  110. scitheory-0.1.0/CHANGELOG.md +0 -12
  111. scitheory-0.1.0/PKG-INFO +0 -93
  112. scitheory-0.1.0/README.md +0 -63
  113. scitheory-0.1.0/docs/decisions.md +0 -18
  114. scitheory-0.1.0/mkdocs.yml +0 -9
  115. scitheory-0.1.0/src/scitheory/explain/__init__.py +0 -1
  116. scitheory-0.1.0/src/scitheory/extract/__init__.py +0 -1
  117. scitheory-0.1.0/src/scitheory/gaps/__init__.py +0 -1
  118. scitheory-0.1.0/src/scitheory/graph/__init__.py +0 -1
  119. scitheory-0.1.0/src/scitheory/ingest/__init__.py +0 -1
  120. scitheory-0.1.0/src/scitheory/normalize/__init__.py +0 -1
@@ -0,0 +1,23 @@
1
+ # The SciClaim conversion script is frozen by its SHA-256 (tests/test_sciclaim_mapping.py);
2
+ # keep LF on every checkout so the hash holds on Windows with core.autocrlf=true.
3
+ scripts/sciclaim_to_reference.py text eol=lf
4
+ # The Evidence Inference conversion and sensitivity scripts are frozen the same way.
5
+ scripts/ei_to_reference.py text eol=lf
6
+ scripts/ei_match_sensitivity.py text eol=lf
7
+ # Evidence Inference run files are hashed; keep their bytes (CRLF in the extractor output) as stored.
8
+ data/external/evidence_inference/** -text
9
+ scripts/score_to_reference.py text eol=lf
10
+ scripts/score_psy_to_reference.py text eol=lf
11
+ # SCORE run files are hashed; keep their bytes as stored.
12
+ data/external/score/** -text
13
+ data/external/score_psy/** -text
14
+ # WP05 graphs are compared byte for byte (tests/test_graph.py); keep LF on every checkout.
15
+ data/graph/** text eol=lf
16
+ # PDFs are binary (reportlab writes mostly ASCII, so Git would otherwise convert line endings).
17
+ *.pdf binary
18
+ # WP06 outputs are compared byte for byte (tests/test_explain.py); keep LF on every checkout.
19
+ data/explain/** text eol=lf
20
+ # WP07 outputs are compared byte for byte (tests/test_gaps.py); keep LF on every checkout.
21
+ data/gaps/** text eol=lf
22
+ # Polarity outputs are compared byte for byte (tests/test_polarity.py); keep LF on every checkout.
23
+ data/polarity/** text eol=lf
@@ -1,26 +1,26 @@
1
- name: CI
2
-
3
- on:
4
- push:
5
- branches: [main]
6
- pull_request:
7
-
8
- jobs:
9
- test:
10
- runs-on: ubuntu-latest
11
- strategy:
12
- fail-fast: false
13
- matrix:
14
- python-version: ["3.10", "3.11", "3.12", "3.13"]
15
- steps:
16
- - uses: actions/checkout@v4
17
- - uses: actions/setup-python@v5
18
- with:
19
- python-version: ${{ matrix.python-version }}
20
- cache: pip
21
- - name: Install
22
- run: python -m pip install -e ".[dev]"
23
- - name: Lint
24
- run: ruff check .
25
- - name: Test
26
- run: pytest --cov=scitheory --cov-report=term-missing
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: actions/setup-python@v5
18
+ with:
19
+ python-version: ${{ matrix.python-version }}
20
+ cache: pip
21
+ - name: Install
22
+ run: python -m pip install -e ".[dev]"
23
+ - name: Lint
24
+ run: ruff check .
25
+ - name: Test
26
+ run: pytest --cov=scitheory --cov-report=term-missing
@@ -0,0 +1,33 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ build/
5
+ dist/
6
+ .venv/
7
+ venv/
8
+ .pytest_cache/
9
+ .ruff_cache/
10
+ .coverage
11
+ htmlcov/
12
+ site/
13
+ .env
14
+ .DS_Store
15
+ .ipynb_checkpoints/
16
+ # data/: small, hand-made or descriptive files are versioned (see data/README.md).
17
+ # Bulky corpus files are reproducible from the manifests and stay out of Git.
18
+ data/**/records.jsonl
19
+ data/**/analysis.jsonl
20
+ data/corpora/*__repeat/
21
+ data/probe/
22
+ # Old copy of the manual; the current one is docs/annotation.md.
23
+ data/annotation/annotation.md
24
+ cache/
25
+ # SciClaim external validation: the sentences are under the SciClaim/PubMed licences (GPL-3,
26
+ # CORD-19), so files that contain them stay out of this MIT repository. They are rebuilt with
27
+ # scripts/sciclaim_to_reference.py (see data/external/sciclaim/README.md).
28
+ data/external/sciclaim/SciClaim/
29
+ data/external/sciclaim/*.jsonl
30
+ data/external/sciclaim/*.csv
31
+ data/external/sciclaim/responses/
32
+ # Evidence Inference: the clone of the source repository (the sample and reference are versioned).
33
+ data/external/evidence_inference/source/
@@ -0,0 +1,23 @@
1
+ # Changelog
2
+
3
+ ## 0.2.0 (2026-11-26)
4
+
5
+ First release on PyPI with the full pipeline. The code, data and tests are those of 0.1.0. The
6
+ number moves to 0.2.0 because the names 0.0.1 and 0.1.0 on PyPI belong to an earlier empty
7
+ placeholder, which is withdrawn.
8
+
9
+ - Replaying the stored extraction runs gives the same claims; the `annotator` column now reads
10
+ `scitheory-model 0.2.0+claims-v2` instead of `0.1.0+claims-v2` (see docs/extract.md).
11
+
12
+ ## 0.1.0 (2026-11-26)
13
+
14
+ First release of the clean repository.
15
+
16
+ - Claim schema v0.2 and ingestion from OpenAlex (WP02).
17
+ - Claim extraction (WP03): rule baseline, model-based extractor with frozen prompt `claims-v2`,
18
+ stored responses and replay without an API key; OpenAI comparison; batch mode.
19
+ - Construct normalisation (WP04): pair adjudicator with frozen prompt `norm-v1`, evaluation.
20
+ - Polarity step (`pol-v2`) between normalisation and the graph.
21
+ - Claim graph and theory maps (WP05), contradictions and candidate moderators (WP06), research
22
+ gaps ranked by value of information (WP07).
23
+ - Reference data, test runs and external validation (SciClaim, Evidence Inference 2.0, SCORE).
@@ -1,12 +1,12 @@
1
- cff-version: 1.2.0
2
- message: "If you use this software, please cite it as below."
3
- title: "SciTheory"
4
- type: software
5
- version: 0.1.0
6
- date-released: 2026-10-09
7
- license: MIT
8
- repository-code: "https://github.com/MarcoFerreiraRibeiro/scitheory"
9
- authors:
10
- - family-names: "Ferreira Ribeiro"
11
- given-names: "Marco"
12
- abstract: "Claim graphs from the scientific literature to explain contradictions between studies and rank research gaps."
1
+ cff-version: 1.2.0
2
+ message: "If you use this software, please cite it as below."
3
+ title: "SciTheory"
4
+ type: software
5
+ version: 0.2.0
6
+ date-released: 2026-11-26
7
+ license: MIT
8
+ repository-code: "https://github.com/MarcoFerreiraRibeiro/scitheory"
9
+ authors:
10
+ # TODO: authors
11
+ - name: "The SciTheory authors"
12
+ abstract: "Claim graphs from the scientific literature to explain contradictions between studies and rank research gaps."
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Marco Ferreira Ribeiro
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 The SciTheory authors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,133 @@
1
+ Metadata-Version: 2.5
2
+ Name: scitheory
3
+ Version: 0.2.0
4
+ Summary: Claim graphs from the scientific literature: explain contradictions between studies and rank research gaps.
5
+ Project-URL: Homepage, https://github.com/MarcoFerreiraRibeiro/scitheory
6
+ Project-URL: Issues, https://github.com/MarcoFerreiraRibeiro/scitheory/issues
7
+ Author: The SciTheory authors
8
+ License: MIT
9
+ License-File: LICENSE
10
+ Keywords: bibliometrics,knowledge graph,literature synthesis,research gaps,scientometrics
11
+ Classifier: Development Status :: 2 - Pre-Alpha
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
20
+ Requires-Python: >=3.10
21
+ Requires-Dist: pydantic>=2.5
22
+ Provides-Extra: dev
23
+ Requires-Dist: pytest-cov>=5; extra == 'dev'
24
+ Requires-Dist: pytest>=8; extra == 'dev'
25
+ Requires-Dist: ruff>=0.5; extra == 'dev'
26
+ Provides-Extra: docs
27
+ Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
28
+ Requires-Dist: mkdocs>=1.6; extra == 'docs'
29
+ Provides-Extra: figures
30
+ Requires-Dist: reportlab>=4.0; extra == 'figures'
31
+ Requires-Dist: svglib>=1.5; extra == 'figures'
32
+ Provides-Extra: llm
33
+ Requires-Dist: anthropic>=1.0; extra == 'llm'
34
+ Provides-Extra: openai
35
+ Requires-Dist: openai>=3.40; extra == 'openai'
36
+ Description-Content-Type: text/markdown
37
+
38
+ # SciTheory
39
+
40
+ SciTheory turns empirical claims from scientific abstracts into a graph that keeps the context
41
+ and method of every claim. On that graph it does two things:
42
+
43
+ 1. **Explains contradictions.** When studies disagree about the same relation, it tests whether
44
+ context (country, period, sample) or method (design, estimator) accounts for the difference,
45
+ and lists candidate moderators.
46
+ 2. **Ranks research gaps.** It orders open questions by the expected value of new evidence, and
47
+ separates "nobody has studied this" from "studying this would change what we know".
48
+
49
+ **Input scope: titles and abstracts only**, not full texts. They can come from any bibliographic
50
+ database that exports abstracts, such as OpenAlex, Web of Science or Scopus. Version 0.2.0
51
+ includes a reader for OpenAlex. Records from other sources can be used once they are converted to
52
+ the SciTheory record format (see [docs/ingest.md](docs/ingest.md)). The validation reported below
53
+ was run on OpenAlex records. Working from abstracts keeps the tool usable at corpus scale and
54
+ independent of publisher access. Method and context fields are often missing, so they stay
55
+ optional in the schema.
56
+
57
+ > **Status: 0.2.0 (pre-alpha).** The whole pipeline runs end to end. The schema and the command
58
+ > line may still change before 1.0.
59
+
60
+ ## Install
61
+
62
+ ```bash
63
+ git clone https://github.com/MarcoFerreiraRibeiro/scitheory.git
64
+ cd scitheory
65
+ python -m pip install -e ".[dev]"
66
+ pytest
67
+ ```
68
+
69
+ Python 3.10 or later. The model-based steps are optional: `pip install -e ".[llm]"` (Anthropic,
70
+ `ANTHROPIC_API_KEY`) or `".[openai]"` (`OPENAI_API_KEY`). Keys are read from the environment only.
71
+ `OPENALEX_API_KEY` is needed for ingestion.
72
+
73
+ ## Pipeline
74
+
75
+ | Step | Module | What it does | Docs |
76
+ | --- | --- | --- | --- |
77
+ | 1. Ingest | `scitheory.ingest` | Metadata and abstracts from OpenAlex, with provenance and hashes | [ingest](docs/ingest.md) |
78
+ | 2. Extract | `scitheory.extract` | Claims (variables, direction, kind, context, method) from each abstract, in a fixed JSON schema | [extract](docs/extract.md) |
79
+ | 3. Normalise | `scitheory.normalize` | Decides which variable names denote the same construct | [normalize](docs/normalize.md) |
80
+ | 4. Polarity | `scitheory.polarity` | Rewrites low-pole names ("inactivity") and inverts signs; opposite poles are never merged | [polarity](docs/polarity.md) |
81
+ | 5. Graph | `scitheory.graph` | Aggregated claim graph per theme (JSON, GraphML) and theory maps | [graph](docs/graph.md) |
82
+ | 6. Explain | `scitheory.explain` | Contested relations and candidate moderators | [explain](docs/explain.md) |
83
+ | 7. Gaps | `scitheory.gaps` | Research gaps ranked by value of information | [gaps](docs/gaps.md) |
84
+
85
+ Steps 4 to 7 run from a configuration file:
86
+
87
+ ```bash
88
+ python -m scitheory.polarity data/polarity/config.json
89
+ python -m scitheory.graph data/polarity/graph/config.json
90
+ python -m scitheory.explain data/polarity/explain/config.json
91
+ python -m scitheory.gaps data/polarity/gaps/config.json
92
+ ```
93
+
94
+ Every model response is stored, so the model-based steps replay without an API key and give
95
+ byte-identical outputs.
96
+
97
+ ## Validation
98
+
99
+ The reference data are human, decided and validated by the authors before evaluation; details
100
+ are in [data/README.md](data/README.md#provenance-of-the-references). The scores below measure
101
+ agreement with those validated references.
102
+
103
+ **Claim extraction** (120 held-out abstracts, mean of three runs of the frozen prompt `claims-v2`):
104
+
105
+ | | Extractor (Claude Opus 5.5) | Comparison (gpt-6-astra) |
106
+ | --- | --- | --- |
107
+ | Precision / recall / F1 | 0.969 / 0.855 / 0.909 | 0.822 / 0.802 / 0.812 |
108
+ | Kappa, direction / relation type | 0.978 / 0.976 | 0.867 / 0.931 |
109
+
110
+ **Construct normalisation** (443 test pairs, prompt `norm-v1`, three runs): F1 of the `equivalent` class 0.971 (Claude) and 0.946 (OpenAI) against the authors' human reference (see data/README.md).
111
+
112
+ **External data sets**, annotated outside this project: SciClaim (signed pairs, F1 0.832),
113
+ Evidence Inference 2.0 (sentence recall 0.899, direction kappa 0.786) and SCORE (management and
114
+ psychology, sentence recall). Details in [data/external](data/external).
115
+
116
+ ## Data
117
+
118
+ Research data for the paper live in [data/](data/README.md) and are not part of the package
119
+ published on PyPI. The corpus files (about 140 MB) are attached to the release `data-2026-10-09`:
120
+
121
+ ```bash
122
+ gh release download data-2026-10-09 --pattern "*.zip"
123
+ ```
124
+
125
+ ## Related work
126
+
127
+ SciClaim (per-sentence claim graphs), THEORIZER (theory generation from literature), PaperQA2
128
+ (question answering and contradiction detection) and metaBUS (curated findings) cover parts of
129
+ this space. SciTheory's focus is explaining why studies diverge and valuing what is still unknown.
130
+
131
+ ## Licence and citation
132
+
133
+ MIT, see [LICENSE](LICENSE). To cite, use [CITATION.cff](CITATION.cff).
@@ -0,0 +1,96 @@
1
+ # SciTheory
2
+
3
+ SciTheory turns empirical claims from scientific abstracts into a graph that keeps the context
4
+ and method of every claim. On that graph it does two things:
5
+
6
+ 1. **Explains contradictions.** When studies disagree about the same relation, it tests whether
7
+ context (country, period, sample) or method (design, estimator) accounts for the difference,
8
+ and lists candidate moderators.
9
+ 2. **Ranks research gaps.** It orders open questions by the expected value of new evidence, and
10
+ separates "nobody has studied this" from "studying this would change what we know".
11
+
12
+ **Input scope: titles and abstracts only**, not full texts. They can come from any bibliographic
13
+ database that exports abstracts, such as OpenAlex, Web of Science or Scopus. Version 0.2.0
14
+ includes a reader for OpenAlex. Records from other sources can be used once they are converted to
15
+ the SciTheory record format (see [docs/ingest.md](docs/ingest.md)). The validation reported below
16
+ was run on OpenAlex records. Working from abstracts keeps the tool usable at corpus scale and
17
+ independent of publisher access. Method and context fields are often missing, so they stay
18
+ optional in the schema.
19
+
20
+ > **Status: 0.2.0 (pre-alpha).** The whole pipeline runs end to end. The schema and the command
21
+ > line may still change before 1.0.
22
+
23
+ ## Install
24
+
25
+ ```bash
26
+ git clone https://github.com/MarcoFerreiraRibeiro/scitheory.git
27
+ cd scitheory
28
+ python -m pip install -e ".[dev]"
29
+ pytest
30
+ ```
31
+
32
+ Python 3.10 or later. The model-based steps are optional: `pip install -e ".[llm]"` (Anthropic,
33
+ `ANTHROPIC_API_KEY`) or `".[openai]"` (`OPENAI_API_KEY`). Keys are read from the environment only.
34
+ `OPENALEX_API_KEY` is needed for ingestion.
35
+
36
+ ## Pipeline
37
+
38
+ | Step | Module | What it does | Docs |
39
+ | --- | --- | --- | --- |
40
+ | 1. Ingest | `scitheory.ingest` | Metadata and abstracts from OpenAlex, with provenance and hashes | [ingest](docs/ingest.md) |
41
+ | 2. Extract | `scitheory.extract` | Claims (variables, direction, kind, context, method) from each abstract, in a fixed JSON schema | [extract](docs/extract.md) |
42
+ | 3. Normalise | `scitheory.normalize` | Decides which variable names denote the same construct | [normalize](docs/normalize.md) |
43
+ | 4. Polarity | `scitheory.polarity` | Rewrites low-pole names ("inactivity") and inverts signs; opposite poles are never merged | [polarity](docs/polarity.md) |
44
+ | 5. Graph | `scitheory.graph` | Aggregated claim graph per theme (JSON, GraphML) and theory maps | [graph](docs/graph.md) |
45
+ | 6. Explain | `scitheory.explain` | Contested relations and candidate moderators | [explain](docs/explain.md) |
46
+ | 7. Gaps | `scitheory.gaps` | Research gaps ranked by value of information | [gaps](docs/gaps.md) |
47
+
48
+ Steps 4 to 7 run from a configuration file:
49
+
50
+ ```bash
51
+ python -m scitheory.polarity data/polarity/config.json
52
+ python -m scitheory.graph data/polarity/graph/config.json
53
+ python -m scitheory.explain data/polarity/explain/config.json
54
+ python -m scitheory.gaps data/polarity/gaps/config.json
55
+ ```
56
+
57
+ Every model response is stored, so the model-based steps replay without an API key and give
58
+ byte-identical outputs.
59
+
60
+ ## Validation
61
+
62
+ The reference data are human, decided and validated by the authors before evaluation; details
63
+ are in [data/README.md](data/README.md#provenance-of-the-references). The scores below measure
64
+ agreement with those validated references.
65
+
66
+ **Claim extraction** (120 held-out abstracts, mean of three runs of the frozen prompt `claims-v2`):
67
+
68
+ | | Extractor (Claude Opus 5.5) | Comparison (gpt-6-astra) |
69
+ | --- | --- | --- |
70
+ | Precision / recall / F1 | 0.969 / 0.855 / 0.909 | 0.822 / 0.802 / 0.812 |
71
+ | Kappa, direction / relation type | 0.978 / 0.976 | 0.867 / 0.931 |
72
+
73
+ **Construct normalisation** (443 test pairs, prompt `norm-v1`, three runs): F1 of the `equivalent` class 0.971 (Claude) and 0.946 (OpenAI) against the authors' human reference (see data/README.md).
74
+
75
+ **External data sets**, annotated outside this project: SciClaim (signed pairs, F1 0.832),
76
+ Evidence Inference 2.0 (sentence recall 0.899, direction kappa 0.786) and SCORE (management and
77
+ psychology, sentence recall). Details in [data/external](data/external).
78
+
79
+ ## Data
80
+
81
+ Research data for the paper live in [data/](data/README.md) and are not part of the package
82
+ published on PyPI. The corpus files (about 140 MB) are attached to the release `data-2026-10-09`:
83
+
84
+ ```bash
85
+ gh release download data-2026-10-09 --pattern "*.zip"
86
+ ```
87
+
88
+ ## Related work
89
+
90
+ SciClaim (per-sentence claim graphs), THEORIZER (theory generation from literature), PaperQA2
91
+ (question answering and contradiction detection) and metaBUS (curated findings) cover parts of
92
+ this space. SciTheory's focus is explaining why studies diverge and valuing what is still unknown.
93
+
94
+ ## Licence and citation
95
+
96
+ MIT, see [LICENSE](LICENSE). To cite, use [CITATION.cff](CITATION.cff).
@@ -0,0 +1,29 @@
1
+ {
2
+ "note": "WP02 corpus definitions. Field names must match OpenAlex. Edit here, not in the code.",
3
+ "defaults": {
4
+ "years": "2015-2025",
5
+ "type": "article",
6
+ "sample": 10000,
7
+ "seed": 42,
8
+ "topic_limit": 2000,
9
+ "languages": ["en"],
10
+ "journal_only": true
11
+ },
12
+ "corpora": [
13
+ {
14
+ "slug": "management",
15
+ "field": "Business, Management and Accounting",
16
+ "topic": "board gender diversity firm performance"
17
+ },
18
+ {
19
+ "slug": "psychology",
20
+ "field": "Psychology",
21
+ "topic": "leadership job satisfaction"
22
+ },
23
+ {
24
+ "slug": "medicine",
25
+ "field": "Medicine",
26
+ "topic": "physical activity depression"
27
+ }
28
+ ]
29
+ }
@@ -0,0 +1,186 @@
1
+ # Annotation manual
2
+
3
+ The rules used for the reference annotation of the 150-abstract sample (WP09) and for the
4
+ instructions of the model-based extractor (`claims-v2`).
5
+
6
+ ## Material
7
+
8
+ The reference sample has 150 abstracts (50 per area: Business/Management, Psychology,
9
+ Medicine), drawn by `scripts/make_annotation_sample.py` with a fixed seed. Each abstract is
10
+ in `data/annotation/sample.csv` with a `sample_id` (S001 to S150) and a `set`:
11
+
12
+ | set | rows | use |
13
+ | --- | --- | --- |
14
+ | calibration | S001-S030 | development: settle this manual and the prompt |
15
+ | overlap | S031-S050 | held-out test set |
16
+ | single | S051-S150 | held-out test set |
17
+
18
+ Annotate in order. Only the title and the abstract may be used. Do not open the full text.
19
+
20
+ ### Eligibility
21
+
22
+ The sample stands for the analysis set the tool meets in practice: journal articles in OpenAlex,
23
+ published 2015-2025, in English, with an abstract of at least 60 words (no maximum). It is not
24
+ limited to empirical research. Book reviews, commentaries, professional articles, conference
25
+ abstracts and excerpts stay in the sample as they are and are usually `no_claim`; they are listed
26
+ in `sample_flags.csv` with their document type. Detecting abstracts without claims is part of
27
+ the evaluation, and dropping such records after reading them would bias the sample.
28
+
29
+ A record is replaced only when it fails these criteria in fact (see below). The text is never
30
+ rewritten: no summaries of our own and no translations.
31
+
32
+ ### Sample versions and human review
33
+
34
+ | version | date | what changed |
35
+ | --- | --- | --- |
36
+ | 0.1 | 2026-10-09 | sample drawn (`make_annotation_sample.py`) |
37
+ | 0.2 | 2026-10-29 | S121 and S095 replaced; human review of the text of 11 records (`sample_changes.csv`) |
38
+
39
+ `data/annotation/sample_changes.csv` lists every change to the text of a record: the exact
40
+ passage before and after, the reason, the source checked and the reviewer.
41
+ The changes were applied once and the version is recorded in `sample_manifest.json`.
42
+ The review only removes material that is not part of the abstract (keywords, JEL codes,
43
+ conflict-of-interest statements, links, a second language) and restores punctuation or spacing
44
+ confirmed in the published version. An abstract in another language is replaced by the English
45
+ abstract published by the journal when one exists (S027); otherwise the record is replaced.
46
+
47
+ ### Replaced records
48
+
49
+ A record with a metadata error (for example a title and an abstract from different papers) is
50
+ replaced, not redrawn with the whole sample: the replacement is the first
51
+ eligible record of the same corpus that is not already in the sample, in the order shuffled with
52
+ the sample seed, and keeps the `sample_id` and `set`. `sample_manifest.json` lists each
53
+ replacement under `replacements` (old and new OpenAlex id, reason) with the new hash of the ids;
54
+ the original hash stays in `ids_sha256_original`.
55
+
56
+ | sample_id | replaced on | reason |
57
+ | --- | --- | --- |
58
+ | S121 | 2026-10-23 | title and abstract of the OpenAlex record describe different papers |
59
+ | S095 | 2026-10-29 | abstract in Korean although OpenAlex labels it English; no English abstract published by the journal was found |
60
+
61
+ A replaced abstract needs a new annotation: its old rows in the claims file no longer apply.
62
+
63
+ ## Validation and the reference file
64
+
65
+ `scripts/validate_annotation.py` checks a claims file against the sample and the schema
66
+ (allowed values, verbatim sentences, one row or `no_claim` per abstract) and prints a summary.
67
+
68
+ The reference is `data/annotation/claims_consensus.csv` (919 rows): the human reference annotation
69
+ of the 150 abstracts, produced and validated by the authors. Every row was reviewed and accepted
70
+ by all authors (`review_status` OK). The reference was finalized before the extractor test runs; model outputs were not used to create or revise it (see [data/README.md](../data/README.md#provenance-of-the-references)). Agreement between the authors is reported as reviewer agreement; they did not annotate the abstracts independently.
71
+
72
+ ## Unit of annotation
73
+
74
+ One **claim** is an empirical statement in the abstract about a relation between at least two
75
+ variables, with a direction (including "no effect"). One abstract can have zero, one or
76
+ several claims. Write one row per claim in `claims.csv`.
77
+
78
+ Annotate:
79
+
80
+ - results the authors report from their own data or analysis;
81
+ - results the authors report from a synthesis (meta-analysis, review), marked as such in `design`.
82
+
83
+ Reviews, meta-analyses and theoretical articles: annotate only their stated conclusions
84
+ (`evidence_type = synthesis`). Statements with no finding (aims, background, concept definitions)
85
+ are not claims, so the abstract is `no_claim`.
86
+
87
+ Do not annotate:
88
+
89
+ - aims, hypotheses and research questions ("we examine whether...");
90
+ - background claims about earlier literature ("prior research shows...", results attributed to cited studies);
91
+ - expected results of a study in progress or planned (projects, protocols);
92
+ - recommendations, implications and definitions;
93
+ - statements with a single variable (descriptive prevalence, means), unless compared across groups;
94
+ - differences between groups at baseline that only describe the sample before the study, such
95
+ as a balance check between treatment arms (decided 2026-10-29). Baseline associations that
96
+ answer the study's question ("at baseline, depression was related to fewer steps") are claims.
97
+
98
+ If the abstract has no claim, write one row with `no_claim = yes` and a short `note`.
99
+
100
+ ## Fields (one row per claim)
101
+
102
+ | column | content |
103
+ | --- | --- |
104
+ | `sample_id` | from the sample |
105
+ | `claim_no` | 1, 2, ... within the abstract |
106
+ | `sentence` | the sentence the claim comes from, copied verbatim |
107
+ | `sentence_group` | id of the sentence within the abstract (`S013-s1`, `S013-s2`, ...). Rows with the same id share the sentence, so it can be checked once. Filled by the tool, not by hand |
108
+ | `var_independent` | the variable as written in the abstract. Several: separate with ` ; ` |
109
+ | `var_dependent` | idem |
110
+ | `var_moderator` | only if the abstract says the relation depends on it |
111
+ | `var_mediator` | only if the abstract names the mechanism |
112
+ | `var_control` | only if named. Usually empty |
113
+ | `direction` | `positive`, `negative`, `null`, `mixed`, `non_monotonic`, `unspecified` |
114
+ | `kind` | `causal`, `associative`, `predictive`, `comparative` |
115
+ | `supported` | optional. `yes` / `no` only when the abstract says that a hypothesis or model is supported or rejected; empty means not stated |
116
+ | `evidence_type` | `own_study` (result of the study itself) or `synthesis` (conclusion of a review, meta-analysis or theoretical article) |
117
+ | `effect` | only if numbers are stated: measure, value, CI, p, n. Free text, for example `OR 1.8 (1.2-2.7)` |
118
+ | `population`, `country`, `period`, `industry`, `level`, `sample_size` | only what the abstract states |
119
+ | `design`, `estimator`, `data_source` | only what the abstract states. `design` from the schema list |
120
+ | `note` | doubts, ambiguity, why a field is empty |
121
+ | `annotator` | your id |
122
+
123
+ ## Rules
124
+
125
+ 1. **Missing is missing.** If the abstract does not state a field, leave it empty. Never infer it
126
+ from the title, the journal or your own knowledge. Missing context and method are expected
127
+ with abstracts only, and the share of missing fields is itself a result.
128
+ 2. **Use the words of the abstract** for variables. Do not normalise or translate. Mapping
129
+ different words to one construct is done later (WP04).
130
+ 3. **Roles.** The independent variable is the cause, predictor or exposure; the dependent is the
131
+ outcome. For purely associative statements, take the order in the sentence and write
132
+ `associative`.
133
+ 4. **Direction.** "Higher X, higher Y" is `positive`. "Higher X, lower Y" is `negative`. "No
134
+ significant relation" is `null`. Different results by subgroup or measure is `mixed`.
135
+ An inverted U or similar is `non_monotonic`. A significant difference or effect whose sign
136
+ the abstract does not state and that no reading makes clear (for example between groups with
137
+ no order, such as job titles, or "was significantly affected") is `unspecified` (decided
138
+ 2026-10-29); never leave it empty. If the wording or the numbers make one sign the natural
139
+ reading ("moderate correlation", "associated with", an odds ratio above 1, markers whose
140
+ higher values predict mortality), annotate that sign and write "sign assumed" in `note`
141
+ (decided 2026-11-05, as the reviewed reference does in 8 rows).
142
+ 5. **`kind` follows the wording of the sentence.** `causal` only if the sentence itself uses causal
143
+ wording for that relation ("effect", "impact", "influence", "leads to", "reduces") or the
144
+ design is a randomised or quasi experiment. "Relationship", "association", "correlated",
145
+ "related" is `associative`, even when the title or the rest of the abstract is causal. When in
146
+ doubt, `associative` and a note.
147
+ 6. **One claim per variable pair and direction.** The unit is one independent-dependent pair
148
+ (decided 2026-10-29). If a sentence reports three outcomes, or several predictors of one
149
+ outcome, write one row per pair. Rows already written with several variables separated by
150
+ ` ; ` stay valid: for evaluation they count as one row per pair
151
+ (`evaluate_extraction.py --atomic`). Split subgroup results into separate rows only if the
152
+ abstract gives separate directions.
153
+ 7. **Direct and indirect effects** are separate rows. A mediated (indirect) effect has the mediator
154
+ filled and its own direction; the direct association is another row.
155
+ 8. **Sentence unit.** `sentence` is the single sentence that states the result, never the whole
156
+ abstract. If the direction comes from another sentence (for example the conclusion), add it
157
+ after ` || ` and say so in `note`.
158
+ 9. **Hedged or exploratory statements** ("may", "suggests") are annotated, with the hedge in `note`.
159
+ 10. **Time:** the `period` is the period of the data, not the publication year.
160
+ 11. **Repeated results are annotated again** (decided 2026-10-29). A conclusion, discussion
161
+ sentence or second analysis that restates a result already annotated gets its own row, with
162
+ its own sentence and its own wording for the variables. Duplicates within one article are
163
+ merged later, when variables are normalised (WP04), not by the annotator. If the repeated
164
+ sentence does not state the direction, take it from the result sentence and say so in `note`.
165
+
166
+ ## Agreement
167
+
168
+ Every row of the reference was reviewed by all authors, who agreed with every row. Because they
169
+ reviewed the same draft, this is reported as agreement between reviewers, not as inter-annotator
170
+ agreement from independent annotation.
171
+
172
+ ## Decisions taken during calibration
173
+
174
+ - ~~Should several outcomes in one sentence be one row or several (rule 6)?~~ One row per
175
+ pair (2026-10-29).
176
+ - Treatment of narrative reviews with no numbers.
177
+ - ~~Conclusions that repeat a result already annotated, and the same result reported again in
178
+ other words~~: their own row (rule 11, 2026-10-29).
179
+ - ~~Differences between groups at baseline~~: not annotated (2026-10-29).
180
+ - ~~`direction` of a significant difference between unordered groups~~: `unspecified` (rule 4,
181
+ 2026-10-29).
182
+ - ~~A "significant effect" whose sign is not stated~~: an assumed sign is annotated with a note
183
+ when one reading is clearly the natural one; `unspecified` otherwise (rule 4, 2026-11-05). The
184
+ 13 pairs in S001-S030 where `claims-v2` says `unspecified` and the reviewed reference has a
185
+ sign stay as they are; the evaluation reports the direction kappa with and without them.
186
+ - Minimum abstract length (the sample uses 60 words; the threshold for the extractor is set from these results).