thisness 0.1.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 (225) hide show
  1. thisness-0.1.0/.github/workflows/ci.yml +41 -0
  2. thisness-0.1.0/.github/workflows/publish.yml +53 -0
  3. thisness-0.1.0/.gitignore +13 -0
  4. thisness-0.1.0/CHANGELOG.md +12 -0
  5. thisness-0.1.0/LICENSE +201 -0
  6. thisness-0.1.0/PKG-INFO +183 -0
  7. thisness-0.1.0/README.md +151 -0
  8. thisness-0.1.0/docs/design/01-resolution-runs.md +434 -0
  9. thisness-0.1.0/docs/design/02-core-model-and-storage.md +476 -0
  10. thisness-0.1.0/docs/design/03-resolution-pipeline.md +379 -0
  11. thisness-0.1.0/docs/design/04-m2-review-dossier-workbench-person.md +248 -0
  12. thisness-0.1.0/docs/design/05-m3-llm-layer.md +226 -0
  13. thisness-0.1.0/docs/design/06-m4-taxonomy.md +306 -0
  14. thisness-0.1.0/docs/design/07-m5-real-organizations.md +158 -0
  15. thisness-0.1.0/docs/design/sketches/02_schema.sql +241 -0
  16. thisness-0.1.0/docs/design/sketches/02_schema_check.out +31 -0
  17. thisness-0.1.0/docs/design/sketches/02_schema_check.py +501 -0
  18. thisness-0.1.0/docs/design/sketches/03_fs_sketch.out +53 -0
  19. thisness-0.1.0/docs/design/sketches/03_fs_sketch.py +979 -0
  20. thisness-0.1.0/docs/design/sketches/consensus_sketch.out +76 -0
  21. thisness-0.1.0/docs/design/sketches/consensus_sketch.py +691 -0
  22. thisness-0.1.0/docs/prd-appendix-a-llm-resolution.md +1312 -0
  23. thisness-0.1.0/docs/prd.md +2444 -0
  24. thisness-0.1.0/docs/research/entity-resolution-landscape.md +1733 -0
  25. thisness-0.1.0/docs/vision.md +845 -0
  26. thisness-0.1.0/pyproject.toml +92 -0
  27. thisness-0.1.0/src/thisness/__init__.py +13 -0
  28. thisness-0.1.0/src/thisness/_canonical.py +41 -0
  29. thisness-0.1.0/src/thisness/adjudicate.py +173 -0
  30. thisness-0.1.0/src/thisness/assistant.py +246 -0
  31. thisness-0.1.0/src/thisness/benchmark/__init__.py +0 -0
  32. thisness-0.1.0/src/thisness/benchmark/__main__.py +87 -0
  33. thisness-0.1.0/src/thisness/benchmark/data/README.md +13 -0
  34. thisness-0.1.0/src/thisness/benchmark/data/uk/README.md +7 -0
  35. thisness-0.1.0/src/thisness/benchmark/data/uk/ch.parquet +0 -0
  36. thisness-0.1.0/src/thisness/benchmark/data/uk/gleif.parquet +0 -0
  37. thisness-0.1.0/src/thisness/benchmark/data/uk/gleif_rr.parquet +0 -0
  38. thisness-0.1.0/src/thisness/benchmark/data/wfo_fixture.csv.gz +0 -0
  39. thisness-0.1.0/src/thisness/benchmark/evaluate.py +290 -0
  40. thisness-0.1.0/src/thisness/benchmark/oracle.py +142 -0
  41. thisness-0.1.0/src/thisness/benchmark/organizations.py +338 -0
  42. thisness-0.1.0/src/thisness/benchmark/people.py +716 -0
  43. thisness-0.1.0/src/thisness/benchmark/taxa.py +453 -0
  44. thisness-0.1.0/src/thisness/benchmark/uk.py +788 -0
  45. thisness-0.1.0/src/thisness/browse.py +148 -0
  46. thisness-0.1.0/src/thisness/candidates.py +171 -0
  47. thisness-0.1.0/src/thisness/canonicalize.py +146 -0
  48. thisness-0.1.0/src/thisness/cli.py +546 -0
  49. thisness-0.1.0/src/thisness/comparisons/__init__.py +0 -0
  50. thisness-0.1.0/src/thisness/comparisons/base.py +59 -0
  51. thisness-0.1.0/src/thisness/comparisons/organization.py +227 -0
  52. thisness-0.1.0/src/thisness/comparisons/person.py +249 -0
  53. thisness-0.1.0/src/thisness/comparisons/taxon.py +232 -0
  54. thisness-0.1.0/src/thisness/consensus.py +424 -0
  55. thisness-0.1.0/src/thisness/core/__init__.py +106 -0
  56. thisness-0.1.0/src/thisness/core/base.py +14 -0
  57. thisness-0.1.0/src/thisness/core/components.py +53 -0
  58. thisness-0.1.0/src/thisness/core/decisions.py +185 -0
  59. thisness-0.1.0/src/thisness/core/evidence.py +58 -0
  60. thisness-0.1.0/src/thisness/core/identity.py +134 -0
  61. thisness-0.1.0/src/thisness/core/invocation.py +49 -0
  62. thisness-0.1.0/src/thisness/core/ledger.py +49 -0
  63. thisness-0.1.0/src/thisness/core/observation.py +86 -0
  64. thisness-0.1.0/src/thisness/core/review.py +34 -0
  65. thisness-0.1.0/src/thisness/core/run.py +266 -0
  66. thisness-0.1.0/src/thisness/core/types.py +51 -0
  67. thisness-0.1.0/src/thisness/dossier.py +554 -0
  68. thisness-0.1.0/src/thisness/edges.py +92 -0
  69. thisness-0.1.0/src/thisness/engine.py +1108 -0
  70. thisness-0.1.0/src/thisness/fellegi_sunter.py +369 -0
  71. thisness-0.1.0/src/thisness/ids.py +176 -0
  72. thisness-0.1.0/src/thisness/labels.py +87 -0
  73. thisness-0.1.0/src/thisness/llm/__init__.py +23 -0
  74. thisness-0.1.0/src/thisness/llm/client.py +219 -0
  75. thisness-0.1.0/src/thisness/llm/prices.py +31 -0
  76. thisness-0.1.0/src/thisness/llm/privacy.py +57 -0
  77. thisness-0.1.0/src/thisness/llm/prompts/.keep +0 -0
  78. thisness-0.1.0/src/thisness/llm/prompts/adjudicate_pairs.v1.md +22 -0
  79. thisness-0.1.0/src/thisness/llm/prompts/adjudicate_pairs.v2.md +20 -0
  80. thisness-0.1.0/src/thisness/llm/prompts/group_names.v1.md +14 -0
  81. thisness-0.1.0/src/thisness/llm/prompts/group_names.v2.md +13 -0
  82. thisness-0.1.0/src/thisness/llm/prompts/recommend_review.v1.md +21 -0
  83. thisness-0.1.0/src/thisness/llm/prompts/recommend_review.v2.md +21 -0
  84. thisness-0.1.0/src/thisness/llm/prompts.py +83 -0
  85. thisness-0.1.0/src/thisness/llm/providers/__init__.py +7 -0
  86. thisness-0.1.0/src/thisness/llm/providers/anthropic.py +60 -0
  87. thisness-0.1.0/src/thisness/llm/providers/function.py +24 -0
  88. thisness-0.1.0/src/thisness/llm/providers/openai_compatible.py +90 -0
  89. thisness-0.1.0/src/thisness/llm/providers/replay.py +55 -0
  90. thisness-0.1.0/src/thisness/llm/types.py +57 -0
  91. thisness-0.1.0/src/thisness/name_only.py +450 -0
  92. thisness-0.1.0/src/thisness/normalize/__init__.py +0 -0
  93. thisness-0.1.0/src/thisness/normalize/organization.py +283 -0
  94. thisness-0.1.0/src/thisness/normalize/person.py +417 -0
  95. thisness-0.1.0/src/thisness/normalize/taxon.py +317 -0
  96. thisness-0.1.0/src/thisness/policy.py +54 -0
  97. thisness-0.1.0/src/thisness/profiles/__init__.py +0 -0
  98. thisness-0.1.0/src/thisness/profiles/base.py +306 -0
  99. thisness-0.1.0/src/thisness/profiles/data/organization_starter.json +184 -0
  100. thisness-0.1.0/src/thisness/profiles/data/person_starter.json +240 -0
  101. thisness-0.1.0/src/thisness/profiles/data/taxon_starter.json +189 -0
  102. thisness-0.1.0/src/thisness/profiles/organization.py +100 -0
  103. thisness-0.1.0/src/thisness/profiles/person.py +129 -0
  104. thisness-0.1.0/src/thisness/profiles/taxon.py +129 -0
  105. thisness-0.1.0/src/thisness/py.typed +0 -0
  106. thisness-0.1.0/src/thisness/relationships.py +113 -0
  107. thisness-0.1.0/src/thisness/reviews.py +294 -0
  108. thisness-0.1.0/src/thisness/scoring.py +196 -0
  109. thisness-0.1.0/src/thisness/starter.py +108 -0
  110. thisness-0.1.0/src/thisness/storage/__init__.py +21 -0
  111. thisness-0.1.0/src/thisness/storage/_commit.py +632 -0
  112. thisness-0.1.0/src/thisness/storage/duckdb/__init__.py +3 -0
  113. thisness-0.1.0/src/thisness/storage/duckdb/invariants.py +243 -0
  114. thisness-0.1.0/src/thisness/storage/duckdb/migrations/0001_initial.sql +243 -0
  115. thisness-0.1.0/src/thisness/storage/duckdb/migrations/0002_pair_constraints.sql +13 -0
  116. thisness-0.1.0/src/thisness/storage/duckdb/migrations/0003_model_invocations.sql +28 -0
  117. thisness-0.1.0/src/thisness/storage/duckdb/store.py +1615 -0
  118. thisness-0.1.0/src/thisness/storage/errors.py +49 -0
  119. thisness-0.1.0/src/thisness/storage/protocol.py +136 -0
  120. thisness-0.1.0/src/thisness/training.py +151 -0
  121. thisness-0.1.0/src/thisness/ui/__init__.py +5 -0
  122. thisness-0.1.0/src/thisness/ui/app.py +538 -0
  123. thisness-0.1.0/src/thisness/ui/static/THIRD_PARTY.md +203 -0
  124. thisness-0.1.0/src/thisness/ui/static/app.css +408 -0
  125. thisness-0.1.0/src/thisness/ui/static/app.js +135 -0
  126. thisness-0.1.0/src/thisness/ui/static/icons/adjustments-horizontal.svg +23 -0
  127. thisness-0.1.0/src/thisness/ui/static/icons/alert-triangle.svg +17 -0
  128. thisness-0.1.0/src/thisness/ui/static/icons/arrow-back-up.svg +16 -0
  129. thisness-0.1.0/src/thisness/ui/static/icons/arrows-join.svg +17 -0
  130. thisness-0.1.0/src/thisness/ui/static/icons/arrows-split.svg +18 -0
  131. thisness-0.1.0/src/thisness/ui/static/icons/briefcase.svg +18 -0
  132. thisness-0.1.0/src/thisness/ui/static/icons/building.svg +22 -0
  133. thisness-0.1.0/src/thisness/ui/static/icons/cake.svg +17 -0
  134. thisness-0.1.0/src/thisness/ui/static/icons/chart-dots.svg +20 -0
  135. thisness-0.1.0/src/thisness/ui/static/icons/chevron-down.svg +15 -0
  136. thisness-0.1.0/src/thisness/ui/static/icons/chevron-right.svg +15 -0
  137. thisness-0.1.0/src/thisness/ui/static/icons/circle-check.svg +16 -0
  138. thisness-0.1.0/src/thisness/ui/static/icons/circle-dashed.svg +22 -0
  139. thisness-0.1.0/src/thisness/ui/static/icons/circle-x.svg +16 -0
  140. thisness-0.1.0/src/thisness/ui/static/icons/clock.svg +16 -0
  141. thisness-0.1.0/src/thisness/ui/static/icons/database.svg +17 -0
  142. thisness-0.1.0/src/thisness/ui/static/icons/external-link.svg +17 -0
  143. thisness-0.1.0/src/thisness/ui/static/icons/file-text.svg +19 -0
  144. thisness-0.1.0/src/thisness/ui/static/icons/filter.svg +15 -0
  145. thisness-0.1.0/src/thisness/ui/static/icons/fingerprint.svg +19 -0
  146. thisness-0.1.0/src/thisness/ui/static/icons/git-branch.svg +20 -0
  147. thisness-0.1.0/src/thisness/ui/static/icons/git-merge.svg +19 -0
  148. thisness-0.1.0/src/thisness/ui/static/icons/hash.svg +18 -0
  149. thisness-0.1.0/src/thisness/ui/static/icons/history.svg +16 -0
  150. thisness-0.1.0/src/thisness/ui/static/icons/home.svg +17 -0
  151. thisness-0.1.0/src/thisness/ui/static/icons/id.svg +19 -0
  152. thisness-0.1.0/src/thisness/ui/static/icons/layout-sidebar-right.svg +16 -0
  153. thisness-0.1.0/src/thisness/ui/static/icons/leaf.svg +16 -0
  154. thisness-0.1.0/src/thisness/ui/static/icons/link.svg +17 -0
  155. thisness-0.1.0/src/thisness/ui/static/icons/list-check.svg +20 -0
  156. thisness-0.1.0/src/thisness/ui/static/icons/mail.svg +16 -0
  157. thisness-0.1.0/src/thisness/ui/static/icons/map-pin.svg +16 -0
  158. thisness-0.1.0/src/thisness/ui/static/icons/message-question.svg +19 -0
  159. thisness-0.1.0/src/thisness/ui/static/icons/phone.svg +15 -0
  160. thisness-0.1.0/src/thisness/ui/static/icons/player-play.svg +15 -0
  161. thisness-0.1.0/src/thisness/ui/static/icons/plus.svg +16 -0
  162. thisness-0.1.0/src/thisness/ui/static/icons/scale.svg +19 -0
  163. thisness-0.1.0/src/thisness/ui/static/icons/search.svg +16 -0
  164. thisness-0.1.0/src/thisness/ui/static/icons/sparkles.svg +15 -0
  165. thisness-0.1.0/src/thisness/ui/static/icons/timeline-event.svg +18 -0
  166. thisness-0.1.0/src/thisness/ui/static/icons/user.svg +16 -0
  167. thisness-0.1.0/src/thisness/ui/static/icons/users.svg +18 -0
  168. thisness-0.1.0/src/thisness/ui/static/icons/world.svg +19 -0
  169. thisness-0.1.0/src/thisness/ui/static/icons/x.svg +16 -0
  170. thisness-0.1.0/src/thisness/ui/static/theme.css +525 -0
  171. thisness-0.1.0/src/thisness/ui/static/vendor/Sortable.min.js +2 -0
  172. thisness-0.1.0/src/thisness/ui/static/vendor/htmx.min.js +1 -0
  173. thisness-0.1.0/src/thisness/ui/static/vendor/inter-latin-ext-wght-normal.woff2 +0 -0
  174. thisness-0.1.0/src/thisness/ui/static/vendor/inter-latin-wght-normal.woff2 +0 -0
  175. thisness-0.1.0/src/thisness/ui/templates/_macros.html +27 -0
  176. thisness-0.1.0/src/thisness/ui/templates/_panel_head.html +4 -0
  177. thisness-0.1.0/src/thisness/ui/templates/base.html +53 -0
  178. thisness-0.1.0/src/thisness/ui/templates/entities.html +48 -0
  179. thisness-0.1.0/src/thisness/ui/templates/entity.html +71 -0
  180. thisness-0.1.0/src/thisness/ui/templates/entity_tab.html +106 -0
  181. thisness-0.1.0/src/thisness/ui/templates/llm.html +32 -0
  182. thisness-0.1.0/src/thisness/ui/templates/model.html +35 -0
  183. thisness-0.1.0/src/thisness/ui/templates/not_found.html +4 -0
  184. thisness-0.1.0/src/thisness/ui/templates/panel_candidate.html +23 -0
  185. thisness-0.1.0/src/thisness/ui/templates/panel_decision.html +41 -0
  186. thisness-0.1.0/src/thisness/ui/templates/panel_entity.html +37 -0
  187. thisness-0.1.0/src/thisness/ui/templates/panel_invocation.html +16 -0
  188. thisness-0.1.0/src/thisness/ui/templates/panel_observation.html +22 -0
  189. thisness-0.1.0/src/thisness/ui/templates/relationships.html +32 -0
  190. thisness-0.1.0/src/thisness/ui/templates/review.html +106 -0
  191. thisness-0.1.0/src/thisness/ui/templates/reviews.html +32 -0
  192. thisness-0.1.0/src/thisness/ui/templates/runs.html +20 -0
  193. thisness-0.1.0/src/thisness/ui/templates/search_results.html +7 -0
  194. thisness-0.1.0/tests/__init__.py +0 -0
  195. thisness-0.1.0/tests/conftest.py +43 -0
  196. thisness-0.1.0/tests/storage_helpers.py +91 -0
  197. thisness-0.1.0/tests/synthetic.py +99 -0
  198. thisness-0.1.0/tests/test_adjudicate.py +232 -0
  199. thisness-0.1.0/tests/test_assistant.py +191 -0
  200. thisness-0.1.0/tests/test_benchmark.py +144 -0
  201. thisness-0.1.0/tests/test_candidates.py +184 -0
  202. thisness-0.1.0/tests/test_canonical.py +38 -0
  203. thisness-0.1.0/tests/test_cli.py +172 -0
  204. thisness-0.1.0/tests/test_comparisons.py +119 -0
  205. thisness-0.1.0/tests/test_consensus.py +220 -0
  206. thisness-0.1.0/tests/test_constraints.py +99 -0
  207. thisness-0.1.0/tests/test_core_models.py +342 -0
  208. thisness-0.1.0/tests/test_dossier.py +142 -0
  209. thisness-0.1.0/tests/test_engine.py +264 -0
  210. thisness-0.1.0/tests/test_engine_plan.py +109 -0
  211. thisness-0.1.0/tests/test_fellegi_sunter.py +160 -0
  212. thisness-0.1.0/tests/test_ids.py +84 -0
  213. thisness-0.1.0/tests/test_llm.py +311 -0
  214. thisness-0.1.0/tests/test_name_only.py +154 -0
  215. thisness-0.1.0/tests/test_normalize_organization.py +164 -0
  216. thisness-0.1.0/tests/test_person.py +247 -0
  217. thisness-0.1.0/tests/test_prompt_hints.py +114 -0
  218. thisness-0.1.0/tests/test_relationships_labels.py +91 -0
  219. thisness-0.1.0/tests/test_reviews.py +110 -0
  220. thisness-0.1.0/tests/test_store.py +836 -0
  221. thisness-0.1.0/tests/test_taxon.py +448 -0
  222. thisness-0.1.0/tests/test_training.py +151 -0
  223. thisness-0.1.0/tests/test_ui.py +200 -0
  224. thisness-0.1.0/tests/test_uk.py +136 -0
  225. thisness-0.1.0/uv.lock +989 -0
@@ -0,0 +1,41 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ env:
9
+ # Resolution must not depend on set or dict iteration order. A fixed seed makes
10
+ # any accidental dependence fail the same way every run instead of flaking.
11
+ PYTHONHASHSEED: "0"
12
+
13
+ jobs:
14
+ lint:
15
+ name: Lint and format
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - uses: astral-sh/setup-uv@v5
20
+ with:
21
+ enable-cache: true
22
+ - run: uv sync --dev
23
+ # Both, always: they catch different things.
24
+ - run: uv run ruff check .
25
+ - run: uv run ruff format --check .
26
+
27
+ test:
28
+ name: Tests (Python ${{ matrix.python }})
29
+ runs-on: ubuntu-latest
30
+ strategy:
31
+ fail-fast: false
32
+ matrix:
33
+ python: ["3.12", "3.13"]
34
+ steps:
35
+ - uses: actions/checkout@v4
36
+ - uses: astral-sh/setup-uv@v5
37
+ with:
38
+ enable-cache: true
39
+ python-version: ${{ matrix.python }}
40
+ - run: uv sync --dev
41
+ - run: uv run pytest --cov --cov-report=term-missing
@@ -0,0 +1,53 @@
1
+ name: Publish
2
+
3
+ # A version tag publishes to PyPI (tag-push, not a GitHub Release):
4
+ # git tag v0.1.0 && git push origin v0.1.0
5
+ # Bump `version` in pyproject.toml and add a CHANGELOG.md entry first; the tag must match.
6
+ #
7
+ # One-time setup on pypi.org: add a trusted publisher for mfbaig35r/thisness, workflow
8
+ # publish.yml, environment pypi. No API token is stored anywhere.
9
+ on:
10
+ push:
11
+ tags: ["v*"]
12
+
13
+ env:
14
+ PYTHONHASHSEED: "0"
15
+
16
+ jobs:
17
+ build:
18
+ name: Test and build
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+ - uses: astral-sh/setup-uv@v5
23
+ with:
24
+ python-version: "3.12"
25
+ - run: uv sync --dev
26
+ - run: uv run ruff check .
27
+ - run: uv run ruff format --check .
28
+ - run: uv run pytest
29
+ - name: The tag matches the version
30
+ run: |
31
+ version=$(uv run python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
32
+ test "v$version" = "$GITHUB_REF_NAME" || { echo "::error::tag $GITHUB_REF_NAME, pyproject $version"; exit 1; }
33
+ - run: uv build
34
+ - name: Metadata and README render for PyPI
35
+ run: uvx twine check dist/*
36
+ - uses: actions/upload-artifact@v4
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: pypi
46
+ permissions:
47
+ id-token: write # trusted publishing (OIDC)
48
+ steps:
49
+ - uses: actions/download-artifact@v4
50
+ with:
51
+ name: dist
52
+ path: dist/
53
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,13 @@
1
+ .DS_Store
2
+ __pycache__/
3
+ *.pyc
4
+ .ruff_cache/
5
+ .venv/
6
+ .coverage
7
+ htmlcov/
8
+ .pytest_cache/
9
+ dist/
10
+ *.egg-info/
11
+
12
+ # Private reference material (book chapters, drafts): kept locally, never committed.
13
+ docs/reference/
@@ -0,0 +1,12 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 (2026-10-10)
4
+
5
+ The first release.
6
+
7
+ - **Core** (design 01 to 03). Observations, stable entities, and a ledger of reversible merges and splits in DuckDB. Candidate generation by blocking keys, typed comparisons, Fellegi-Sunter weights fitted by EM with term-frequency adjustments, and validated-components consensus that commits only what the evidence supports and opens a review for the rest. Every decision is stored with its evidence and can be explained.
8
+ - **Review and the Workbench** (design 04). Pair constraints, a review queue ranked by impact, dossiers, relationship candidates (a shared brand, a household), and a local web Workbench to browse entities, answer reviews by dragging records, relate or merge entities, and page through possible relationships.
9
+ - **Three domains.** Organizations, people, and taxa (scientific plant names, with World Flora Online and the Catalogue of Life as authorities; design 06). Each ships a starter model for stores too small to fit their own.
10
+ - **The language-model layer** (design 05). Anthropic and OpenAI-compatible providers, budgets, retries on transient errors, record and replay. An adjudicator for contested pairs (shadow or decide; a model's "same" yields to its own "different" and to cannot-link constraints), a review assistant that suggests answers, name-only resolution, and a per-profile `model_role`.
11
+ - **Benchmarks.** Synthetic organizations and people, WFO plant names, and real UK companies from GLEIF and Companies House with company numbers as truth (design 07). `thisness eval` reports precision, recall, false-merge clusters, and a model's accuracy against the truth.
12
+ - **Scale.** Tested to 46,565 real records: bounded boundary reviews and relationship neighborhoods, a paginated relationships page, penalty-only common-value adjustments for shared addresses.
thisness-0.1.0/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or Derivative
95
+ Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work, excluding
103
+ those notices that do not pertain to any part of the Derivative
104
+ Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and do
117
+ not modify the License. You may add Your own attribution notices
118
+ within Derivative Works that You distribute, alongside or as an
119
+ addendum to the NOTICE text from the Work, provided that such
120
+ additional attribution notices cannot be construed as modifying
121
+ the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions for
125
+ use, reproduction, or distribution of Your modifications, or for any
126
+ such Derivative Works as a whole, provided Your use, reproduction,
127
+ and distribution of the Work otherwise complies with the conditions
128
+ stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Fahad Baig
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,183 @@
1
+ Metadata-Version: 2.5
2
+ Name: thisness
3
+ Version: 0.1.0
4
+ Summary: Identity resolution for imperfect observations: evidence, stable identities, reversible history.
5
+ Project-URL: Homepage, https://thisness.dev
6
+ Project-URL: Repository, https://github.com/mfbaig35r/thisness
7
+ Author: Fahad Baig
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ Keywords: deduplication,entity resolution,identity resolution,record linkage
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Typing :: Typed
17
+ Requires-Python: >=3.12
18
+ Requires-Dist: duckdb>=1.3
19
+ Requires-Dist: pyarrow>=17
20
+ Requires-Dist: pydantic>=2.9
21
+ Requires-Dist: rapidfuzz>=3.9
22
+ Provides-Extra: anthropic
23
+ Requires-Dist: anthropic>=0.40; extra == 'anthropic'
24
+ Provides-Extra: openai
25
+ Requires-Dist: httpx>=0.27; extra == 'openai'
26
+ Provides-Extra: ui
27
+ Requires-Dist: fastapi>=0.115; extra == 'ui'
28
+ Requires-Dist: jinja2>=3.1; extra == 'ui'
29
+ Requires-Dist: python-multipart>=0.0.9; extra == 'ui'
30
+ Requires-Dist: uvicorn>=0.30; extra == 'ui'
31
+ Description-Content-Type: text/markdown
32
+
33
+ # Thisness
34
+
35
+ **Identity resolution for imperfect observations.**
36
+
37
+ For centuries, Hesperus (the evening star) and Phosphorus (the morning star) were two things. Then observation showed they were the same planet. Two observations, from different times and contexts, of one underlying thing, and the identity established by evidence rather than by definition.
38
+
39
+ Thisness does that for data. It takes observations from many sources ("IBM", "IBM Corp.", "International Business Machines Corporation", an invoice line, a contract party) and decides what they refer to, keeping the evidence, the decision, and the history behind every conclusion, so any of them can be explained, reviewed, or reversed.
40
+
41
+ > Status: alpha. Three domains resolve end to end: organizations, people, and taxa (scientific plant names). Each has a review queue, dossiers, a local Workbench, and an optional language model that adjudicates contested pairs or suggests review answers. The API will change. The design is in [`docs/design/`](docs/design/).
42
+
43
+ ```bash
44
+ pip install 'thisness[ui]'
45
+ ```
46
+
47
+ ```python
48
+ import csv
49
+ from thisness import Thisness
50
+ from thisness.profiles.organization import organization
51
+
52
+ engine = Thisness("identity.duckdb", profiles=[organization()])
53
+
54
+ # Columns such as name, website, email, registration_ids, country, city, postal_code.
55
+ with open("vendors.csv", newline="") as f:
56
+ engine.ingest(
57
+ [
58
+ engine.observe(
59
+ "organization", row, {"type": "csv", "id": "vendors.csv", "locator": {"row": i}}
60
+ )
61
+ for i, row in enumerate(csv.DictReader(f))
62
+ ]
63
+ )
64
+
65
+ result = engine.resolve_many("organization") # fits a model on first use, then resolves
66
+ print(result.stats) # pairs scored, clusters, reviews opened
67
+
68
+ # Later records resolve against what already exists.
69
+ outcome = engine.resolve(
70
+ "organization",
71
+ {"name": "IBM Corp.", "website": "https://www.ibm.com"},
72
+ {"type": "crm", "id": "account-17"},
73
+ )
74
+ print(outcome.outcome, outcome.entity_id) # ATTACH_TO_EXISTING / CREATE_ENTITY / REQUIRES_REVIEW
75
+ engine.explain(outcome.decision_id) # the decision, its evidence, the pairs behind it
76
+ ```
77
+
78
+ A store needs a few hundred records of a type to fit its own model. Below that, Thisness uses a shipped starter model, and replaces it with a fitted one on the first run with enough data.
79
+
80
+ Every decision is stored with its evidence; merges and splits are reversible ledger events (`engine.merge_entities`, `engine.split_entity`, `engine.history`).
81
+
82
+ ## Domains
83
+
84
+ A domain is a resolution profile: its attributes, normalizers, comparisons, constraints and the guidance a model is given. Three ship.
85
+
86
+ - **Organizations** (`thisness.profiles.organization`): names with legal forms, abbreviations, acronyms and group-company qualifiers; websites, emails, registration IDs, addresses. A shared brand or a group's sibling companies are relationship candidates, never merges.
87
+ - **People** (`thisness.profiles.person`): names with nicknames, initials and spelling variants; dates of birth, emails, phones, addresses. Same name at the same address (a household, a parent and child) stays a relationship until evidence says otherwise.
88
+ - **Taxa** (`thisness.profiles.taxon`): scientific names parsed into genus, epithets, rank and authorship. Synonyms join their accepted taxon when an authority such as World Flora Online or the Catalogue of Life is loaded, and every label says which authority supplied it.
89
+
90
+ ## From the command line
91
+
92
+ ```bash
93
+ thisness ingest vendors.csv --resolve # into identity.duckdb
94
+ thisness ui # the Workbench: entities, reviews, history, context
95
+ thisness --store demo.duckdb demo && thisness ui demo.duckdb # try it on synthetic data
96
+ thisness --store people.duckdb demo --type person # synthetic people
97
+ thisness --store taxa.duckdb demo --type taxon --reference # real plant names, labelled by WFO
98
+ ```
99
+
100
+ The Workbench is a local web app over the same API: browse entities with the evidence for every value, answer the review queue by dragging records between entities, relate or merge entities that share a brand, page through possible relationships, and see exactly what a language model was given and what it answered.
101
+
102
+ ## With a language model
103
+
104
+ A model is optional, and the engine never needs one. Where it helps, it is given the contested pairs or the open reviews, with the evidence for each, and its answers are recorded like any other decision.
105
+
106
+ ```bash
107
+ pip install 'thisness[ui,openai]' # or [ui,anthropic]; keys from OPENAI_API_KEY / ANTHROPIC_API_KEY
108
+
109
+ thisness resolve --provider openai --model gpt-6-luna --budget 2 # contested pairs to the model
110
+ thisness recommend --provider openai --model gpt-6-luna --limit 50 # suggested answers for reviews
111
+ thisness ui --provider openai --model gpt-6-luna # ask from the Workbench
112
+ ```
113
+
114
+ What the model does is set per profile (`model_role`): for organizations and taxa it decides contested pairs, and its "same" yields to its own "different" or to a cannot-link constraint; for people it only suggests review answers, since measured on people it was both too cautious and too credulous. `--model-role decide|suggest|shadow|off` overrides that for a run. `--record` keeps every exchange in a cassette and `--replay` answers from one, free and offline. Any OpenAI-compatible server works with `--base-url` (and `--local` when it is yours).
115
+
116
+ Set `--budget`: there is no default limit.
117
+
118
+ ## How well it works
119
+
120
+ `thisness eval` resolves a benchmark with known truth and reports precision, recall and false-merge clusters. Measured so far (design 07 §13; design 06 §10):
121
+
122
+ | Benchmark | Records | P | R | False-merge clusters |
123
+ |---|---|---|---|---|
124
+ | Real UK companies (GLEIF + Companies House), identifiers hidden | 3,507 | .9992 | .912 | 1 |
125
+ | The same, gpt-6-luna deciding contested pairs ($0.62) | 3,507 | .9965 | .938 | 5 |
126
+ | Real UK companies, at scale | 46,565 | .9965 | .934 | 63 |
127
+ | Synthetic organizations, 4,000 | | .9995 | .938 | 4 |
128
+
129
+ ```bash
130
+ thisness eval --size 805 4000 # synthetic organizations (or --type person)
131
+ thisness eval --type taxon --reference # WFO plant names, with WFO's own rows
132
+ python -m thisness.benchmark uk-stage # download GLEIF and Companies House (~1 GB, once)
133
+ thisness eval --source uk --size 400 # real UK companies, identifiers hidden
134
+ thisness eval --source uk --adjudicator openai --model gpt-6-luna --mode decide --budget 2
135
+ ```
136
+
137
+ The UK benchmark's hard cases are real: 62% of live UK companies share a registered address, and a record that says only "Sports Direct" sits beside four real Sports Direct companies. The record variations (shortened names, typos, partial addresses) are generated from the true company, so the truth is known.
138
+
139
+ ## Known limits
140
+
141
+ - **Memory grows with candidate pairs.** 46,565 records took 7.5 minutes of CPU and 7.8 GB peak memory; scoring holds every candidate pair in Python. Tested to about fifty thousand records.
142
+ - **Candidates come from blocking keys.** There is no embedding-based candidate generator yet, so two records that share no blocking key (a renamed company with nothing else in common, a heterotypic synonym with no authority loaded) are never compared directly.
143
+ - **Model costs are real.** About $0.62 for 400 UK companies with gpt-6-luna; the default model is `claude-sonnet-5`. Use `--budget`, and `--replay` to re-run without paying again.
144
+ - **The network benchmarks download data.** WFO families beyond the shipped three, the Catalogue of Life, and the UK sources are fetched on demand and cached under `~/.cache/thisness`. Everything else, including the Workbench, runs offline.
145
+
146
+ ## What it is
147
+
148
+ - **Observations are not entities.** A source record is an observation of something. Entities are stable identities above them, with IDs that never change when names do.
149
+ - **Similarity is not identity.** Candidate retrieval, evidence, decisions and identity state are separate steps with separate records. Scores are typed; there is no universal `confidence` float.
150
+ - **Identity is not relationship.** "Subsidiary of" and "brand of" are relationships between distinct entities, never merges.
151
+ - **Everything is reversible.** Merges and splits are ledger events over memberships. Nothing is destructively collapsed, and the ledger alone can rebuild current state.
152
+ - **Models propose; policy decides.** Rules, Fellegi-Sunter, LLMs and people all contribute decisions. Only a commit, citing those decisions, changes identity state.
153
+
154
+ ## Documents
155
+
156
+ - [Vision](docs/vision.md)
157
+ - [Product requirements](docs/prd.md) and [Appendix A: LLM-assisted resolution](docs/prd-appendix-a-llm-resolution.md)
158
+ - [Research: the entity-resolution landscape](docs/research/entity-resolution-landscape.md)
159
+ - Design:
160
+ - [01 resolution runs and consensus](docs/design/01-resolution-runs.md)
161
+ - [02 core model and storage](docs/design/02-core-model-and-storage.md)
162
+ - [03 resolution pipeline](docs/design/03-resolution-pipeline.md)
163
+ - [04 review, dossier, Workbench, people](docs/design/04-m2-review-dossier-workbench-person.md)
164
+ - [05 the language-model layer](docs/design/05-m3-llm-layer.md)
165
+ - [06 taxonomy, the third domain](docs/design/06-m4-taxonomy.md)
166
+ - [07 real organizations](docs/design/07-m5-real-organizations.md)
167
+ - [Changelog](CHANGELOG.md)
168
+
169
+ ## Development
170
+
171
+ ```bash
172
+ uv sync --dev # includes the ui extra
173
+ uv run pytest
174
+ uv run ruff check . && uv run ruff format --check .
175
+ ```
176
+
177
+ Releases publish to PyPI from a version tag: bump `version` in `pyproject.toml`, add a `CHANGELOG.md` entry, then `git tag vX.Y.Z && git push origin vX.Y.Z`.
178
+
179
+ ## Data and license
180
+
181
+ Thisness is Apache-2.0. See [LICENSE](LICENSE).
182
+
183
+ Bundled and fetched data keep their own terms, credited where they ship: World Flora Online (CC0 1.0) in `benchmark/data`; GLEIF Golden Copy (CC0 1.0) and Companies House data (Open Government Licence v3.0) in `benchmark/data/uk`; the Catalogue of Life (CC BY 4.0), fetched on demand with attribution; and the Workbench's fonts, icons and scripts in `ui/static/THIRD_PARTY.md`.
@@ -0,0 +1,151 @@
1
+ # Thisness
2
+
3
+ **Identity resolution for imperfect observations.**
4
+
5
+ For centuries, Hesperus (the evening star) and Phosphorus (the morning star) were two things. Then observation showed they were the same planet. Two observations, from different times and contexts, of one underlying thing, and the identity established by evidence rather than by definition.
6
+
7
+ Thisness does that for data. It takes observations from many sources ("IBM", "IBM Corp.", "International Business Machines Corporation", an invoice line, a contract party) and decides what they refer to, keeping the evidence, the decision, and the history behind every conclusion, so any of them can be explained, reviewed, or reversed.
8
+
9
+ > Status: alpha. Three domains resolve end to end: organizations, people, and taxa (scientific plant names). Each has a review queue, dossiers, a local Workbench, and an optional language model that adjudicates contested pairs or suggests review answers. The API will change. The design is in [`docs/design/`](docs/design/).
10
+
11
+ ```bash
12
+ pip install 'thisness[ui]'
13
+ ```
14
+
15
+ ```python
16
+ import csv
17
+ from thisness import Thisness
18
+ from thisness.profiles.organization import organization
19
+
20
+ engine = Thisness("identity.duckdb", profiles=[organization()])
21
+
22
+ # Columns such as name, website, email, registration_ids, country, city, postal_code.
23
+ with open("vendors.csv", newline="") as f:
24
+ engine.ingest(
25
+ [
26
+ engine.observe(
27
+ "organization", row, {"type": "csv", "id": "vendors.csv", "locator": {"row": i}}
28
+ )
29
+ for i, row in enumerate(csv.DictReader(f))
30
+ ]
31
+ )
32
+
33
+ result = engine.resolve_many("organization") # fits a model on first use, then resolves
34
+ print(result.stats) # pairs scored, clusters, reviews opened
35
+
36
+ # Later records resolve against what already exists.
37
+ outcome = engine.resolve(
38
+ "organization",
39
+ {"name": "IBM Corp.", "website": "https://www.ibm.com"},
40
+ {"type": "crm", "id": "account-17"},
41
+ )
42
+ print(outcome.outcome, outcome.entity_id) # ATTACH_TO_EXISTING / CREATE_ENTITY / REQUIRES_REVIEW
43
+ engine.explain(outcome.decision_id) # the decision, its evidence, the pairs behind it
44
+ ```
45
+
46
+ A store needs a few hundred records of a type to fit its own model. Below that, Thisness uses a shipped starter model, and replaces it with a fitted one on the first run with enough data.
47
+
48
+ Every decision is stored with its evidence; merges and splits are reversible ledger events (`engine.merge_entities`, `engine.split_entity`, `engine.history`).
49
+
50
+ ## Domains
51
+
52
+ A domain is a resolution profile: its attributes, normalizers, comparisons, constraints and the guidance a model is given. Three ship.
53
+
54
+ - **Organizations** (`thisness.profiles.organization`): names with legal forms, abbreviations, acronyms and group-company qualifiers; websites, emails, registration IDs, addresses. A shared brand or a group's sibling companies are relationship candidates, never merges.
55
+ - **People** (`thisness.profiles.person`): names with nicknames, initials and spelling variants; dates of birth, emails, phones, addresses. Same name at the same address (a household, a parent and child) stays a relationship until evidence says otherwise.
56
+ - **Taxa** (`thisness.profiles.taxon`): scientific names parsed into genus, epithets, rank and authorship. Synonyms join their accepted taxon when an authority such as World Flora Online or the Catalogue of Life is loaded, and every label says which authority supplied it.
57
+
58
+ ## From the command line
59
+
60
+ ```bash
61
+ thisness ingest vendors.csv --resolve # into identity.duckdb
62
+ thisness ui # the Workbench: entities, reviews, history, context
63
+ thisness --store demo.duckdb demo && thisness ui demo.duckdb # try it on synthetic data
64
+ thisness --store people.duckdb demo --type person # synthetic people
65
+ thisness --store taxa.duckdb demo --type taxon --reference # real plant names, labelled by WFO
66
+ ```
67
+
68
+ The Workbench is a local web app over the same API: browse entities with the evidence for every value, answer the review queue by dragging records between entities, relate or merge entities that share a brand, page through possible relationships, and see exactly what a language model was given and what it answered.
69
+
70
+ ## With a language model
71
+
72
+ A model is optional, and the engine never needs one. Where it helps, it is given the contested pairs or the open reviews, with the evidence for each, and its answers are recorded like any other decision.
73
+
74
+ ```bash
75
+ pip install 'thisness[ui,openai]' # or [ui,anthropic]; keys from OPENAI_API_KEY / ANTHROPIC_API_KEY
76
+
77
+ thisness resolve --provider openai --model gpt-6-luna --budget 2 # contested pairs to the model
78
+ thisness recommend --provider openai --model gpt-6-luna --limit 50 # suggested answers for reviews
79
+ thisness ui --provider openai --model gpt-6-luna # ask from the Workbench
80
+ ```
81
+
82
+ What the model does is set per profile (`model_role`): for organizations and taxa it decides contested pairs, and its "same" yields to its own "different" or to a cannot-link constraint; for people it only suggests review answers, since measured on people it was both too cautious and too credulous. `--model-role decide|suggest|shadow|off` overrides that for a run. `--record` keeps every exchange in a cassette and `--replay` answers from one, free and offline. Any OpenAI-compatible server works with `--base-url` (and `--local` when it is yours).
83
+
84
+ Set `--budget`: there is no default limit.
85
+
86
+ ## How well it works
87
+
88
+ `thisness eval` resolves a benchmark with known truth and reports precision, recall and false-merge clusters. Measured so far (design 07 §13; design 06 §10):
89
+
90
+ | Benchmark | Records | P | R | False-merge clusters |
91
+ |---|---|---|---|---|
92
+ | Real UK companies (GLEIF + Companies House), identifiers hidden | 3,507 | .9992 | .912 | 1 |
93
+ | The same, gpt-6-luna deciding contested pairs ($0.62) | 3,507 | .9965 | .938 | 5 |
94
+ | Real UK companies, at scale | 46,565 | .9965 | .934 | 63 |
95
+ | Synthetic organizations, 4,000 | | .9995 | .938 | 4 |
96
+
97
+ ```bash
98
+ thisness eval --size 805 4000 # synthetic organizations (or --type person)
99
+ thisness eval --type taxon --reference # WFO plant names, with WFO's own rows
100
+ python -m thisness.benchmark uk-stage # download GLEIF and Companies House (~1 GB, once)
101
+ thisness eval --source uk --size 400 # real UK companies, identifiers hidden
102
+ thisness eval --source uk --adjudicator openai --model gpt-6-luna --mode decide --budget 2
103
+ ```
104
+
105
+ The UK benchmark's hard cases are real: 62% of live UK companies share a registered address, and a record that says only "Sports Direct" sits beside four real Sports Direct companies. The record variations (shortened names, typos, partial addresses) are generated from the true company, so the truth is known.
106
+
107
+ ## Known limits
108
+
109
+ - **Memory grows with candidate pairs.** 46,565 records took 7.5 minutes of CPU and 7.8 GB peak memory; scoring holds every candidate pair in Python. Tested to about fifty thousand records.
110
+ - **Candidates come from blocking keys.** There is no embedding-based candidate generator yet, so two records that share no blocking key (a renamed company with nothing else in common, a heterotypic synonym with no authority loaded) are never compared directly.
111
+ - **Model costs are real.** About $0.62 for 400 UK companies with gpt-6-luna; the default model is `claude-sonnet-5`. Use `--budget`, and `--replay` to re-run without paying again.
112
+ - **The network benchmarks download data.** WFO families beyond the shipped three, the Catalogue of Life, and the UK sources are fetched on demand and cached under `~/.cache/thisness`. Everything else, including the Workbench, runs offline.
113
+
114
+ ## What it is
115
+
116
+ - **Observations are not entities.** A source record is an observation of something. Entities are stable identities above them, with IDs that never change when names do.
117
+ - **Similarity is not identity.** Candidate retrieval, evidence, decisions and identity state are separate steps with separate records. Scores are typed; there is no universal `confidence` float.
118
+ - **Identity is not relationship.** "Subsidiary of" and "brand of" are relationships between distinct entities, never merges.
119
+ - **Everything is reversible.** Merges and splits are ledger events over memberships. Nothing is destructively collapsed, and the ledger alone can rebuild current state.
120
+ - **Models propose; policy decides.** Rules, Fellegi-Sunter, LLMs and people all contribute decisions. Only a commit, citing those decisions, changes identity state.
121
+
122
+ ## Documents
123
+
124
+ - [Vision](docs/vision.md)
125
+ - [Product requirements](docs/prd.md) and [Appendix A: LLM-assisted resolution](docs/prd-appendix-a-llm-resolution.md)
126
+ - [Research: the entity-resolution landscape](docs/research/entity-resolution-landscape.md)
127
+ - Design:
128
+ - [01 resolution runs and consensus](docs/design/01-resolution-runs.md)
129
+ - [02 core model and storage](docs/design/02-core-model-and-storage.md)
130
+ - [03 resolution pipeline](docs/design/03-resolution-pipeline.md)
131
+ - [04 review, dossier, Workbench, people](docs/design/04-m2-review-dossier-workbench-person.md)
132
+ - [05 the language-model layer](docs/design/05-m3-llm-layer.md)
133
+ - [06 taxonomy, the third domain](docs/design/06-m4-taxonomy.md)
134
+ - [07 real organizations](docs/design/07-m5-real-organizations.md)
135
+ - [Changelog](CHANGELOG.md)
136
+
137
+ ## Development
138
+
139
+ ```bash
140
+ uv sync --dev # includes the ui extra
141
+ uv run pytest
142
+ uv run ruff check . && uv run ruff format --check .
143
+ ```
144
+
145
+ Releases publish to PyPI from a version tag: bump `version` in `pyproject.toml`, add a `CHANGELOG.md` entry, then `git tag vX.Y.Z && git push origin vX.Y.Z`.
146
+
147
+ ## Data and license
148
+
149
+ Thisness is Apache-2.0. See [LICENSE](LICENSE).
150
+
151
+ Bundled and fetched data keep their own terms, credited where they ship: World Flora Online (CC0 1.0) in `benchmark/data`; GLEIF Golden Copy (CC0 1.0) and Companies House data (Open Government Licence v3.0) in `benchmark/data/uk`; the Catalogue of Life (CC BY 4.0), fetched on demand with attribution; and the Workbench's fonts, icons and scripts in `ui/static/THIRD_PARTY.md`.