Files
adminandClaude Opus 5.5 df4290f688 Add an optional 3D view to the act-structure and act-links graphs
A "2D | 3D" switch on /graph/act, /graph/acts and the console's #/graph tabs.
2D (Cytoscape) stays the default. 3D draws legal-memory's "burst": the act,
its units and articles as a tree, the references inside the act, linked acts
on an outer shell and, once case law is ready, the judgments citing it. It
uses three.js 0.183.0 and 3d-force-graph 1.80.0 (both MIT), vendored,
same-origin and lazy-loaded, with UnrealBloomPass glow. The CSP is unchanged.

Python caps the data at 2,500 nodes (/graph/act/3d, /graph/acts/3d). The
choice is kept in localStorage (default 2D) and in ?view=3d. The selection
and the side panel survive a switch, and going back to 2D disposes the
renderer. Without WebGL the page stays in 2D.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 12:41:32 +02:00

12 KiB
Raw Permalink Blame History

Credits

Insider is Apache-2.0. Every shipped dependency is permissively licensed — the CI license gate (backend/scripts/license_gate.py) fails the build on GPL, AGPL or SSPL.

Runtime dependencies

Project License Why
FastAPI MIT the API framework
Starlette BSD-3-Clause ASGI toolkit under FastAPI
Uvicorn BSD-3-Clause ASGI server
python-multipart Apache-2.0 multipart/form-data parsing for FastAPI
Pydantic / pydantic-settings MIT validation + typed settings
SQLAlchemy MIT ORM
Alembic MIT migrations
pg8000 BSD-3-Clause pure-Python PostgreSQL driver — no libpq, no LGPL
argon2-cffi MIT Argon2id password hashing
httpx BSD-3-Clause the one outbound HTTP client
OpenTelemetry Python Apache-2.0 optional tracing, off by default
MCP Python SDK (mcp) MIT the MCP server at /mcp
sse-starlette BSD-3-Clause the MCP SDK's streaming dependency
pypdfium2 / PDFium Apache-2.0 OR BSD-3-Clause / BSD-3-Clause a PDF's text layer — the always-available OCR tier
PostgreSQL PostgreSQL License the database
Lark MIT the citation grammar of the reference graph (backend/app/services/legalref.lark)
Jinja2 (+ MarkupSafe) BSD-3-Clause the reference graph's server-rendered pages at /graph (backend/app/templates/graph/, autoescaped)

Models for search (backend/app/ai/)

Project License Why
ONNX Runtime MIT runs the local embedder and reranker on CPU
tokenizers (+ huggingface-hub) Apache-2.0 the models' tokenizers
NumPy BSD-3-Clause vectors, exact cosine search
cryptography Apache-2.0 OR BSD-3-Clause reads the platform's encrypted provider keys

Accepted (owner's decision, 2026-10-21): tqdm (MPL-2.0 AND MIT, an indirect dependency via tokenizers → huggingface-hub) and certifi (MPL-2.0, via httpx). MPL-2.0 is a file-level licence: it covers those libraries' own files, which Insider neither modifies nor vendors, and does not extend to Insider's code.

Model weights (downloaded on first use into INSIDER_MODEL_CACHE_DIR, never shipped in the image):

Model License Role
intfloat/multilingual-e5-small (its own ONNX export) MIT embedder (INSIDER_EMBEDDER)
BAAI/bge-reranker-v2-m3, as the int8 ONNX export onnx-community/bge-reranker-v2-m3-ONNX Apache-2.0 (the base model's; the export is an automatic conversion) the suggested reranker (INSIDER_RERANKER, off by default)

No generator is configured by default. A model an operator configures (Bielik, Mistral, Claude…) comes under that model's own terms — check them before you point Insider at it.

Optional OCR image (requirements-ocr.txt, compose profile ocr)

Project License Why
PaddleOCR / PaddlePaddle Apache-2.0 PP-OCRv5 + PP-StructureV3 on CPU; PaddleOCR-VL with a GPU
Tesseract / pytesseract Apache-2.0 the fallback engine, Polish traineddata

Deliberately not used: Surya (GPL + restricted weights), MinerU (AGPL), marker (GPL), PyMuPDF (AGPL) — the licence gate denies them by name.

Vendored code

Project License What Insider took
eurlex-builder (Timo Seidl), commit 4d61904, 0.3.0 MIT the CELLAR SPARQL shapes (type/sector filters, corrigendum and consolidated-CELEX exclusions) and the EUR-Lex XHTML structure pass (ti-art / oj-ti-art / title-article-norm headings, sti-art subtitles, annex and stop classes, consolidation markers) — vendored and adapted in backend/app/integrations/cellar_builder/ (licence header kept). Not a dependency: its closure (duckdb, polars, pyarrow, lxml, SPARQLWrapper, requests…) is far heavier than what Insider uses, and its HTTP would bypass SourceClient

| Cytoscape.js 3.30.4 (dist/cytoscape.min.js, sha256 1bb5340e…b3b9) | MIT | the 2D drawing of the reference graph — frontend/vendor/cytoscape-3.30.4.min.js beside its LICENSE, same-origin | | three.js 0.183.0 (build/three.module.min.js sha256 e3ec4d5d…6eda + build/three.core.min.js sha256 c5f69a04…c4fd; from examples/jsm: postprocessing/Pass.js, postprocessing/UnrealBloomPass.js, shaders/CopyShader.js, shaders/LuminosityHighPassShader.js, their bare 'three' import rewritten to the relative ../../three.module.min.js — the only change) | MIT | the OPTIONAL 3D view of the reference graph (frontend/graph3d.js) and its glow (UnrealBloomPass: GLSL shaders compiled by WebGL, no JavaScript eval) — frontend/vendor/three-0.183.0/ beside its LICENSE, same-origin, loaded only when a viewer picks "3D" | | 3d-force-graph 1.80.0 (dist/3d-force-graph.min.js, sha256 d96e738e…2e42; bundles its MIT/ISC/BSD dependencies — three-render-objects, three-forcegraph, d3-force-3d, kapsule) | MIT | the 3D force layout and camera controls of the optional 3D view — frontend/vendor/3d-force-graph-1.80.0.min.js beside its LICENSE, same-origin, loaded only on "3D"; it reads the vendored three.js from window.THREE. Its ngraph engine (which builds code with new Function) is never selected — the default d3 engine runs, so the CSP needs no unsafe-eval (checked in a browser: no violation) | | htmx 2.0.4 (dist/htmx.min.js, sha256 e209dda5…b447) | 0BSD | the /graph pages' partial requests — frontend/vendor/htmx-2.0.4.min.js beside its LICENSE, configured with allowEval: false (no eval, so the console's CSP holds) |

Ideas and fixtures ported

Project License What Insider took
tobayah/legal-memory (Tobiasz; commit bb93733) Apache-2.0 (LICENSE in the repository) the graph model (Act › Księga › Tytuł › Dział › Rozdział › Oddział › Article; article→article edges with their type and the citing sentence), the in-body reference rules of src/refs-inbody.ts (the list / range continuation, the 80-article range cap, ODSYLA_DO / STOSUJE_ODPOWIEDNIO / Z_ZASTRZEZENIEM with their confidences, precision over recall), the MCP shape find_article / references / trace_path, and its self-checks as backend/tests/test_legalref.py. From its RAG reader (rag/answer_l1.py, HANDOFF.md): the second few-shot example that refuses although the right act is among the sources (backend/app/ai/prompts/answer.json), the citation checks of its _check (source numbers in range, "art. N" / act dates absent from the context, no citation), the "graph as expander over retrieval, not instead of it" design, and the ops note that amending-act titles quote whole EU acts — re-implemented and extended in services/grounding.py (checks against the CITED passage, lexical support through Insider's analyzer) Re-implemented in Python (a lark grammar instead of the TypeScript regexes, Postgres instead of a JSON file); no code copied verbatim. The optional 3D view (frontend/graph3d.js) follows its web/ look — the act as a glowing burst, node colours pushed above 1.0 so the bloom makes coronas, edge weight as colour intensity under additive blending, framing on the 92nd percentile of distance — re-implemented, not copied

Data sources

Source Terms Attribution Insider carries
Sejm ELI API (api.sejm.gov.pl/eli) public; no robots.txt "Źródło: Kancelaria Sejmu RP, API ELI"
SAOS (saos.org.pl) its robots.txt disallows /api/ — used only for user-initiated live queries (README, "SAOS") "Źródło: SAOS — System Analizy Orzeczeń Sądowych"
EUR-Lex / CELLAR (publications.europa.eu) Commission Decision 2011/833/EU: commercial and non-commercial reuse; metadata CC0, consolidated texts CC BY 4.0 "© European Union, https://eur-lex.europa.eu …", plus a note on every EU text that Insider converted it to plain text (CC BY 4.0 asks that changes be indicated)

Language data

Data Licence What Insider does with it
Słownik SJP.PL — lista słów z odmianami (sjp.pl) offered under GPL 2, LGPL 2.1, CC BY 4.0 or Apache 2.0; Insider uses it under CC BY 4.0 downloaded while the image is built (backend/scripts/build_lexicon.py) and changed: proper names, multi-word entries and negated "nie…" forms under a positive headword dropped; forms lower-cased and diacritic-folded; a headword whose whole paradigm sits inside another's keeps its own lemma; stored as a binary form → lemma(s) table. Only an 80-line verbatim subset is committed, as a test fixture (backend/tests/fixtures/odm_fixture.txt)

Patterns borrowed (no code, no dependency)

Project License What
Honeyfield-Org/eurlex-mcp-server MIT CELLAR know-how: the newest consolidated version as the largest anchored 0…-YYYYMMDD CELEX, 9999-12-31 as "no end of validity"

Console

Project License Why
Open Color MIT the colour palette, light and dark
ui/v1 (the family's shared shell: frontend/ui/v1/tokens.css, shell.css, shell.js, copied from Atrium) Apache-2.0 (the family's own) the shell, controls, tables, dialogs and palette; its look was read from legalwork (MIT) — no legalwork code is included
Inter SIL OFL 1.1 the console font, frontend/ui/v1/InterVariable.woff2 beside its licence
Tabler Icons MIT outline icon set — path data is vendored into frontend/app.js's ICN map, never loaded from a CDN, because the console's CSP allows no third-party origins

No framework, no bundler, no CDN: the console is index.html + app.css + app.js.

Design credit

The console's shape — grouped sidebar navigation, data tables with row actions, full-page create forms with edit modals, dashboard tiles, a command palette — is inspired by Open Mercato. It is an homage, not a copy or a fork: no Open Mercato code is included, and small deviations are intentional.

Identity, sessions, auth, authz, the org tree and the append-only audit log come from dredd-core, the family's shared package (Apache-2.0), pinned in backend/requirements.txt. The least-privilege database model (app DML / migrator DDL) follows it.