citegraph 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 (123) hide show
  1. citegraph-0.2.0/.github/workflows/ci.yml +70 -0
  2. citegraph-0.2.0/.github/workflows/publish.yml +59 -0
  3. citegraph-0.2.0/.gitignore +54 -0
  4. citegraph-0.2.0/.jupyter-config/migrated +1 -0
  5. citegraph-0.2.0/CHANGELOG.md +47 -0
  6. citegraph-0.2.0/LICENSE +21 -0
  7. citegraph-0.2.0/PKG-INFO +870 -0
  8. citegraph-0.2.0/README.md +814 -0
  9. citegraph-0.2.0/docs/RELEASE.md +109 -0
  10. citegraph-0.2.0/docs/UI_ARCHITECTURE.md +331 -0
  11. citegraph-0.2.0/docs/USER_GUIDE.md +545 -0
  12. citegraph-0.2.0/docs/figures/cocitation_build.pdf +0 -0
  13. citegraph-0.2.0/docs/figures/cocitation_build.svg +146 -0
  14. citegraph-0.2.0/docs/figures/cocitation_projection.pdf +0 -0
  15. citegraph-0.2.0/docs/figures/cocitation_projection.svg +142 -0
  16. citegraph-0.2.0/docs/figures/cocitation_why.pdf +0 -0
  17. citegraph-0.2.0/docs/figures/cocitation_why.svg +98 -0
  18. citegraph-0.2.0/docs/figures/institutional_build.pdf +0 -0
  19. citegraph-0.2.0/docs/figures/institutional_build.svg +114 -0
  20. citegraph-0.2.0/docs/figures/institutional_layers.pdf +0 -0
  21. citegraph-0.2.0/docs/figures/institutional_layers.svg +125 -0
  22. citegraph-0.2.0/docs/figures/institutional_ties.pdf +0 -0
  23. citegraph-0.2.0/docs/figures/institutional_ties.svg +87 -0
  24. citegraph-0.2.0/docs/figures/pipeline.pdf +0 -0
  25. citegraph-0.2.0/docs/figures/pipeline.svg +141 -0
  26. citegraph-0.2.0/docs/figures/pipeline_v2.pdf +0 -0
  27. citegraph-0.2.0/docs/figures/pipeline_v2.svg +158 -0
  28. citegraph-0.2.0/docs/superpowers/plans/2026-09-06-unified-works-model.md +1230 -0
  29. citegraph-0.2.0/docs/superpowers/plans/2026-09-11-canonicalization-reliability.md +321 -0
  30. citegraph-0.2.0/docs/superpowers/plans/2026-09-12-canonicalization-reliability-results.md +61 -0
  31. citegraph-0.2.0/docs/superpowers/plans/2026-09-13-incremental-reruns.md +84 -0
  32. citegraph-0.2.0/docs/superpowers/plans/2026-09-13-pipeline-robustness.md +451 -0
  33. citegraph-0.2.0/docs/superpowers/plans/2026-09-19-pypi-release-hardening.md +393 -0
  34. citegraph-0.2.0/docs/superpowers/specs/2026-09-06-unified-works-model-design.md +255 -0
  35. citegraph-0.2.0/docs/superpowers/specs/2026-09-11-canonicalization-reliability-design.md +89 -0
  36. citegraph-0.2.0/docs/superpowers/specs/2026-09-13-enrichment-and-downstream-design.md +401 -0
  37. citegraph-0.2.0/docs/superpowers/specs/2026-09-13-incremental-reruns-design.md +27 -0
  38. citegraph-0.2.0/docs/superpowers/specs/2026-09-13-pipeline-robustness-design.md +191 -0
  39. citegraph-0.2.0/docs/superpowers/specs/2026-09-15-institutional-network-figures-design.md +257 -0
  40. citegraph-0.2.0/docs/superpowers/specs/2026-09-15-supervision-cocitation-figures-design.md +142 -0
  41. citegraph-0.2.0/docs/superpowers/specs/2026-09-19-pypi-release-hardening-design.md +144 -0
  42. citegraph-0.2.0/evaluation/README.md +52 -0
  43. citegraph-0.2.0/evaluation/RESULTS.md +28 -0
  44. citegraph-0.2.0/evaluation/evaluate.py +296 -0
  45. citegraph-0.2.0/evaluation/gold/sample_paper.json +26 -0
  46. citegraph-0.2.0/examples/quickstart.ipynb +604 -0
  47. citegraph-0.2.0/pyproject.toml +123 -0
  48. citegraph-0.2.0/scripts/evaluate_canonicalization.py +253 -0
  49. citegraph-0.2.0/scripts/smoke_test.sh +68 -0
  50. citegraph-0.2.0/src/citegraph/__init__.py +44 -0
  51. citegraph-0.2.0/src/citegraph/_progress.py +74 -0
  52. citegraph-0.2.0/src/citegraph/annotations.py +183 -0
  53. citegraph-0.2.0/src/citegraph/author_export.py +294 -0
  54. citegraph-0.2.0/src/citegraph/author_overrides.py +143 -0
  55. citegraph-0.2.0/src/citegraph/authors.py +1997 -0
  56. citegraph-0.2.0/src/citegraph/cli.py +926 -0
  57. citegraph-0.2.0/src/citegraph/cocitation_stats.py +370 -0
  58. citegraph-0.2.0/src/citegraph/config.py +73 -0
  59. citegraph-0.2.0/src/citegraph/cost_estimation.py +259 -0
  60. citegraph-0.2.0/src/citegraph/dedup.py +498 -0
  61. citegraph-0.2.0/src/citegraph/enrich.py +972 -0
  62. citegraph-0.2.0/src/citegraph/extract_metadata.py +81 -0
  63. citegraph-0.2.0/src/citegraph/extract_references.py +376 -0
  64. citegraph-0.2.0/src/citegraph/graph.py +660 -0
  65. citegraph-0.2.0/src/citegraph/html_report.py +1787 -0
  66. citegraph-0.2.0/src/citegraph/identity.py +199 -0
  67. citegraph-0.2.0/src/citegraph/ids.py +106 -0
  68. citegraph-0.2.0/src/citegraph/io.py +566 -0
  69. citegraph-0.2.0/src/citegraph/jel.py +167 -0
  70. citegraph-0.2.0/src/citegraph/journals.py +182 -0
  71. citegraph-0.2.0/src/citegraph/llm.py +186 -0
  72. citegraph-0.2.0/src/citegraph/pdf_to_markdown.py +394 -0
  73. citegraph-0.2.0/src/citegraph/pipeline.py +997 -0
  74. citegraph-0.2.0/src/citegraph/plotting.py +1214 -0
  75. citegraph-0.2.0/src/citegraph/reports.py +214 -0
  76. citegraph-0.2.0/src/citegraph/schemas.py +89 -0
  77. citegraph-0.2.0/src/citegraph/webui.py +624 -0
  78. citegraph-0.2.0/tests/__init__.py +0 -0
  79. citegraph-0.2.0/tests/conftest.py +59 -0
  80. citegraph-0.2.0/tests/fixtures/canonicalization/authors.json +367 -0
  81. citegraph-0.2.0/tests/fixtures/canonicalization/works.json +391 -0
  82. citegraph-0.2.0/tests/fixtures/sample_paper.md +14 -0
  83. citegraph-0.2.0/tests/fixtures/sample_paper.metadata.json +7 -0
  84. citegraph-0.2.0/tests/fixtures/sample_paper.references.json +16 -0
  85. citegraph-0.2.0/tests/test_annotations.py +302 -0
  86. citegraph-0.2.0/tests/test_author_export.py +336 -0
  87. citegraph-0.2.0/tests/test_author_external_ids.py +136 -0
  88. citegraph-0.2.0/tests/test_author_overrides.py +131 -0
  89. citegraph-0.2.0/tests/test_authors.py +1470 -0
  90. citegraph-0.2.0/tests/test_canonicalization_evaluation.py +122 -0
  91. citegraph-0.2.0/tests/test_cli.py +429 -0
  92. citegraph-0.2.0/tests/test_cocitation_stats.py +493 -0
  93. citegraph-0.2.0/tests/test_cost_estimation.py +350 -0
  94. citegraph-0.2.0/tests/test_dedup.py +529 -0
  95. citegraph-0.2.0/tests/test_demo_out.py +46 -0
  96. citegraph-0.2.0/tests/test_enrich.py +930 -0
  97. citegraph-0.2.0/tests/test_enrichment_author_agreement.py +325 -0
  98. citegraph-0.2.0/tests/test_failure_isolation.py +229 -0
  99. citegraph-0.2.0/tests/test_graph.py +554 -0
  100. citegraph-0.2.0/tests/test_ids.py +36 -0
  101. citegraph-0.2.0/tests/test_incremental_cache.py +340 -0
  102. citegraph-0.2.0/tests/test_incremental_enrichment.py +253 -0
  103. citegraph-0.2.0/tests/test_incremental_pipeline.py +313 -0
  104. citegraph-0.2.0/tests/test_inline_citation_check.py +175 -0
  105. citegraph-0.2.0/tests/test_io.py +84 -0
  106. citegraph-0.2.0/tests/test_jel.py +167 -0
  107. citegraph-0.2.0/tests/test_journals.py +264 -0
  108. citegraph-0.2.0/tests/test_llm_json_repair.py +51 -0
  109. citegraph-0.2.0/tests/test_multi_section_references.py +210 -0
  110. citegraph-0.2.0/tests/test_packaging.py +67 -0
  111. citegraph-0.2.0/tests/test_pdf_traversal.py +433 -0
  112. citegraph-0.2.0/tests/test_persistent_identity.py +113 -0
  113. citegraph-0.2.0/tests/test_pipeline.py +566 -0
  114. citegraph-0.2.0/tests/test_plotting.py +615 -0
  115. citegraph-0.2.0/tests/test_reliability_dedup.py +113 -0
  116. citegraph-0.2.0/tests/test_reliability_pipeline.py +299 -0
  117. citegraph-0.2.0/tests/test_report.py +326 -0
  118. citegraph-0.2.0/tests/test_resolution_audit.py +135 -0
  119. citegraph-0.2.0/tests/test_schemas.py +66 -0
  120. citegraph-0.2.0/tests/test_slice_references.py +71 -0
  121. citegraph-0.2.0/tests/test_smoke_script.py +35 -0
  122. citegraph-0.2.0/tests/test_truncation_retry.py +191 -0
  123. citegraph-0.2.0/tests/test_webui.py +184 -0
@@ -0,0 +1,70 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches:
7
+ - main
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ test:
14
+ name: Python ${{ matrix.python-version }}
15
+ runs-on: ubuntu-latest
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ python-version:
20
+ - "3.11"
21
+ - "3.12"
22
+ - "3.13"
23
+
24
+ steps:
25
+ - name: Check out repository
26
+ uses: actions/checkout@v7
27
+
28
+ - name: Set up Python
29
+ uses: actions/setup-python@v7
30
+ with:
31
+ python-version: ${{ matrix.python-version }}
32
+ cache: pip
33
+
34
+ - name: Install package
35
+ run: python -m pip install -e ".[dev]"
36
+
37
+ - name: Run tests
38
+ run: python -m pytest tests/test_*.py -vv
39
+
40
+ - name: Run Ruff
41
+ run: ruff check .
42
+
43
+ build:
44
+ name: Build distribution
45
+ runs-on: ubuntu-latest
46
+
47
+ steps:
48
+ - name: Check out repository
49
+ uses: actions/checkout@v7
50
+
51
+ - name: Set up Python
52
+ uses: actions/setup-python@v7
53
+ with:
54
+ python-version: "3.11"
55
+ cache: pip
56
+
57
+ - name: Install build tools
58
+ run: python -m pip install build twine
59
+
60
+ - name: Build package
61
+ run: python -m build
62
+
63
+ - name: Check package metadata
64
+ run: python -m twine check dist/*
65
+
66
+ - name: Upload distribution artifact
67
+ uses: actions/upload-artifact@v7
68
+ with:
69
+ name: dist
70
+ path: dist/*
@@ -0,0 +1,59 @@
1
+ name: Publish
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ build:
13
+ name: Build distribution
14
+ runs-on: ubuntu-latest
15
+
16
+ steps:
17
+ - name: Check out repository
18
+ uses: actions/checkout@v7
19
+
20
+ - name: Set up Python
21
+ uses: actions/setup-python@v7
22
+ with:
23
+ python-version: "3.11"
24
+ cache: pip
25
+
26
+ - name: Install build tools
27
+ run: python -m pip install build twine
28
+
29
+ - name: Build package
30
+ run: python -m build
31
+
32
+ - name: Check package metadata
33
+ run: python -m twine check dist/*
34
+
35
+ - name: Upload distribution artifact
36
+ uses: actions/upload-artifact@v7
37
+ with:
38
+ name: dist
39
+ path: dist/*
40
+
41
+ publish:
42
+ name: Publish to PyPI
43
+ needs: build
44
+ runs-on: ubuntu-latest
45
+ environment:
46
+ name: pypi
47
+ url: https://pypi.org/p/citegraph
48
+ permissions:
49
+ id-token: write
50
+
51
+ steps:
52
+ - name: Download distribution artifact
53
+ uses: actions/download-artifact@v8
54
+ with:
55
+ name: dist
56
+ path: dist
57
+
58
+ - name: Publish package
59
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,54 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ dist/
9
+ *.egg-info/
10
+ *.egg
11
+ .eggs/
12
+ pip-wheel-metadata/
13
+
14
+ # Virtual envs
15
+ .venv/
16
+ venv/
17
+ env/
18
+
19
+ # Tests / coverage
20
+ .pytest_cache/
21
+ .ruff_cache/
22
+ .coverage
23
+ .coverage.*
24
+ htmlcov/
25
+ .tox/
26
+
27
+ # Tooling
28
+ .mypy_cache/
29
+ .pyre/
30
+
31
+ # Editors / OS
32
+ .DS_Store
33
+ .idea/
34
+ .vscode/
35
+ *.swp
36
+
37
+ # Env / secrets
38
+ .env
39
+ .env.*
40
+ !.env.example
41
+
42
+ # Pipeline outputs (local runs)
43
+ out/
44
+ out_archive/
45
+
46
+ # Notebooks are local exploratory artifacts.
47
+ *.ipynb
48
+
49
+ # ...except the curated example notebook.
50
+ !examples/quickstart.ipynb
51
+
52
+ # Per-machine Claude Code settings (tool permissions, absolute paths).
53
+ # Project skills under .claude/skills/ are shared and stay tracked.
54
+ .claude/settings.local.json
@@ -0,0 +1 @@
1
+ 2026-09-06T15:21:04.556495+00:00
@@ -0,0 +1,47 @@
1
+ # Changelog
2
+
3
+ ## 0.2.0 — 2026-11-01
4
+
5
+ Public research beta. This release replaces the earlier papers/references model
6
+ with a unified works model. Review generated records before using them in research.
7
+
8
+ ### Breaking changes and migration
9
+
10
+ - Source papers and cited references now share canonical `w-` work IDs, with
11
+ discovery depth in `ring` and processed-PDF provenance in `source_file`.
12
+ - `sources.csv`, `citations_raw.csv`, `works.csv`, and `citation_graph.csv`
13
+ replace the old papers/references artifacts. `PipelineResult` and
14
+ `CitationGraph` expose the unified works model.
15
+ - Rebuild existing outputs in a copy using the
16
+ [migration guide](docs/USER_GUIDE.md#rebuild-an-existing-corpus-in-a-copy).
17
+ Preserve identity registries, correction files, and extraction caches. Corrected
18
+ clusters can change IDs, citation counts, and rankings; invalidated or missing
19
+ caches can require new provider calls.
20
+
21
+ ### Added and improved
22
+
23
+ - Work and author resolution safeguards, saved decision audits, manual identity
24
+ constraints, stable identity registries, and fingerprinted incremental caches.
25
+ - Enrichment over core and cited works, author-agreement checks, OpenAlex API-key
26
+ support, transient-failure retries, and conservative journal normalization.
27
+ - Automatic OCR retries for image-only and glyph-corrupted conversions, extraction
28
+ failure isolation, and atomic JSON and CSV checkpoints.
29
+ - Author co-citation networks and per-tie comparison tests, optional plotting,
30
+ core-author Excel export, work annotations, and title-page JEL extraction.
31
+ - A read-only local monitor, self-contained quality-control reports, a staged user
32
+ guide, and a finished demo corpus that can be queried without an API key.
33
+ - Optional PDF conversion dependencies; the PDF extras include EasyOCR support.
34
+
35
+ ### Known limitations
36
+
37
+ - Human-reviewed, held-out corpus accuracy has not been established. Synthetic
38
+ evaluation results measure regression coverage, not extraction or matching
39
+ accuracy on arbitrary literature.
40
+ - Work clustering can depend on input order for ambiguous matches. Archive inputs,
41
+ outputs, corrections, and the package version for reproducible analysis.
42
+ - Extraction requires Gemini and sends converted paper text to Google. Cost
43
+ estimates are approximate; the `metadata` command and Python API do not prompt
44
+ for cost approval.
45
+ - `CITEGRAPH_REQUEST_TIMEOUT_S` is defined but is not yet applied to Gemini calls.
46
+ - Overlapping author ties do not support a confirmatory combined p-value; the
47
+ Fisher diagnostic assumes independent ties.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 citegraph contributors
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.