coronelli 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 (131) hide show
  1. coronelli-0.1.0/.gitignore +46 -0
  2. coronelli-0.1.0/PKG-INFO +112 -0
  3. coronelli-0.1.0/README.md +90 -0
  4. coronelli-0.1.0/alembic.ini +149 -0
  5. coronelli-0.1.0/app/__init__.py +0 -0
  6. coronelli-0.1.0/app/api/__init__.py +0 -0
  7. coronelli-0.1.0/app/api/admin.py +20 -0
  8. coronelli-0.1.0/app/api/atlas.py +15 -0
  9. coronelli-0.1.0/app/api/atlas_edit.py +313 -0
  10. coronelli-0.1.0/app/api/atlas_export.py +331 -0
  11. coronelli-0.1.0/app/api/atlas_hierarchy.py +372 -0
  12. coronelli-0.1.0/app/api/atlas_read.py +240 -0
  13. coronelli-0.1.0/app/api/atlas_suggestions.py +200 -0
  14. coronelli-0.1.0/app/api/candidates.py +259 -0
  15. coronelli-0.1.0/app/api/extraction.py +859 -0
  16. coronelli-0.1.0/app/api/series.py +120 -0
  17. coronelli-0.1.0/app/api/sources.py +199 -0
  18. coronelli-0.1.0/app/api/synthesis.py +194 -0
  19. coronelli-0.1.0/app/api/workspaces.py +37 -0
  20. coronelli-0.1.0/app/cli.py +32 -0
  21. coronelli-0.1.0/app/config.py +20 -0
  22. coronelli-0.1.0/app/db/__init__.py +0 -0
  23. coronelli-0.1.0/app/db/base.py +5 -0
  24. coronelli-0.1.0/app/db/engine.py +22 -0
  25. coronelli-0.1.0/app/db/migrations/README +1 -0
  26. coronelli-0.1.0/app/db/migrations/env.py +82 -0
  27. coronelli-0.1.0/app/db/migrations/script.py.mako +28 -0
  28. coronelli-0.1.0/app/db/migrations/versions/766ed4afcc51_initial_schema.py +55 -0
  29. coronelli-0.1.0/app/db/migrations/versions/a1b2c3d4e5f6_extraction_candidates.py +56 -0
  30. coronelli-0.1.0/app/db/migrations/versions/b2c3d4e5f6a7_candidate_temporal_relation_fields.py +49 -0
  31. coronelli-0.1.0/app/db/migrations/versions/c3d4e5f6a7b8_extraction_run_cost_and_cache.py +27 -0
  32. coronelli-0.1.0/app/db/migrations/versions/d4e5f6a7b8c9_synthesis_tables.py +54 -0
  33. coronelli-0.1.0/app/db/migrations/versions/e5f6a7b8c9d0_map_entity_aliases.py +21 -0
  34. coronelli-0.1.0/app/db/migrations/versions/f6a7b8c9d0e1_entity_mentions.py +34 -0
  35. coronelli-0.1.0/app/db/migrations/versions/g7h8i9j0k1l2_source_normalization.py +49 -0
  36. coronelli-0.1.0/app/db/migrations/versions/h8i9j0k1l2m3_document_author_year.py +23 -0
  37. coronelli-0.1.0/app/db/migrations/versions/i9j0k1l2m3n4_synthesis_current_phase.py +22 -0
  38. coronelli-0.1.0/app/db/migrations/versions/j0k1l2m3n4o5_extraction_current_phase.py +22 -0
  39. coronelli-0.1.0/app/db/migrations/versions/k1l2m3n4o5p6_candidate_source.py +22 -0
  40. coronelli-0.1.0/app/db/migrations/versions/l2m3n4o5p6q7_global_enrichment_runs.py +34 -0
  41. coronelli-0.1.0/app/db/models.py +67 -0
  42. coronelli-0.1.0/app/domain/__init__.py +0 -0
  43. coronelli-0.1.0/app/domain/review.py +198 -0
  44. coronelli-0.1.0/app/domain/series.py +131 -0
  45. coronelli-0.1.0/app/domain/sources.py +157 -0
  46. coronelli-0.1.0/app/domain/world.py +104 -0
  47. coronelli-0.1.0/app/evaluation/__init__.py +0 -0
  48. coronelli-0.1.0/app/evaluation/oracle.py +75 -0
  49. coronelli-0.1.0/app/events.py +35 -0
  50. coronelli-0.1.0/app/extraction/__init__.py +0 -0
  51. coronelli-0.1.0/app/extraction/display.py +71 -0
  52. coronelli-0.1.0/app/extraction/models.py +70 -0
  53. coronelli-0.1.0/app/extraction/openai_provider.py +543 -0
  54. coronelli-0.1.0/app/extraction/prompts.py +78 -0
  55. coronelli-0.1.0/app/extraction/prompts_catalog.py +283 -0
  56. coronelli-0.1.0/app/extraction/prompts_evidence.py +437 -0
  57. coronelli-0.1.0/app/extraction/prompts_taxonomy.py +88 -0
  58. coronelli-0.1.0/app/extraction/provider.py +37 -0
  59. coronelli-0.1.0/app/extraction/service.py +477 -0
  60. coronelli-0.1.0/app/extraction/validation.py +201 -0
  61. coronelli-0.1.0/app/ingestion/__init__.py +0 -0
  62. coronelli-0.1.0/app/ingestion/normalizer.py +128 -0
  63. coronelli-0.1.0/app/ingestion/parsers.py +130 -0
  64. coronelli-0.1.0/app/ingestion/sectioner.py +420 -0
  65. coronelli-0.1.0/app/ingestion/service.py +85 -0
  66. coronelli-0.1.0/app/main.py +61 -0
  67. coronelli-0.1.0/app/packages/__init__.py +0 -0
  68. coronelli-0.1.0/app/packages/models.py +8 -0
  69. coronelli-0.1.0/app/packages/schema_validator.py +27 -0
  70. coronelli-0.1.0/app/packages/semantic_validator.py +143 -0
  71. coronelli-0.1.0/app/static/assets/index-BAY1Dwtk.js +4283 -0
  72. coronelli-0.1.0/app/static/assets/index-CHdClfSm.css +1 -0
  73. coronelli-0.1.0/app/static/bg/background.png +0 -0
  74. coronelli-0.1.0/app/static/bg/background2.png +0 -0
  75. coronelli-0.1.0/app/static/bg/droplet-amber.png +0 -0
  76. coronelli-0.1.0/app/static/bg/droplet-aqua.png +0 -0
  77. coronelli-0.1.0/app/static/bg/droplet-blue.png +0 -0
  78. coronelli-0.1.0/app/static/bg/droplet-green.png +0 -0
  79. coronelli-0.1.0/app/static/bg/droplet-peach.png +0 -0
  80. coronelli-0.1.0/app/static/bg/droplet-pink.png +0 -0
  81. coronelli-0.1.0/app/static/index.html +16 -0
  82. coronelli-0.1.0/app/synthesis/__init__.py +0 -0
  83. coronelli-0.1.0/app/synthesis/display.py +49 -0
  84. coronelli-0.1.0/app/synthesis/models.py +52 -0
  85. coronelli-0.1.0/app/synthesis/prompts.py +284 -0
  86. coronelli-0.1.0/app/synthesis/provider.py +516 -0
  87. coronelli-0.1.0/app/synthesis/review.py +100 -0
  88. coronelli-0.1.0/app/synthesis/review_approve.py +249 -0
  89. coronelli-0.1.0/app/synthesis/review_enrich.py +319 -0
  90. coronelli-0.1.0/app/synthesis/service.py +583 -0
  91. coronelli-0.1.0/app/workspace/__init__.py +0 -0
  92. coronelli-0.1.0/app/workspace/schemas.py +24 -0
  93. coronelli-0.1.0/app/workspace/service.py +71 -0
  94. coronelli-0.1.0/package.json +7 -0
  95. coronelli-0.1.0/pyproject.toml +41 -0
  96. coronelli-0.1.0/tests/__init__.py +0 -0
  97. coronelli-0.1.0/tests/domain/__init__.py +0 -0
  98. coronelli-0.1.0/tests/domain/test_review.py +304 -0
  99. coronelli-0.1.0/tests/domain/test_series.py +267 -0
  100. coronelli-0.1.0/tests/domain/test_sources.py +129 -0
  101. coronelli-0.1.0/tests/evaluation/__init__.py +0 -0
  102. coronelli-0.1.0/tests/evaluation/test_oracle.py +134 -0
  103. coronelli-0.1.0/tests/extraction/__init__.py +0 -0
  104. coronelli-0.1.0/tests/extraction/test_alice_regression.py +706 -0
  105. coronelli-0.1.0/tests/extraction/test_cost_and_cache.py +133 -0
  106. coronelli-0.1.0/tests/extraction/test_display_summary.py +220 -0
  107. coronelli-0.1.0/tests/extraction/test_openai_provider.py +302 -0
  108. coronelli-0.1.0/tests/extraction/test_oz_regression.py +306 -0
  109. coronelli-0.1.0/tests/extraction/test_service.py +164 -0
  110. coronelli-0.1.0/tests/extraction/test_service_evidence.py +343 -0
  111. coronelli-0.1.0/tests/extraction/test_temporal_fields.py +215 -0
  112. coronelli-0.1.0/tests/extraction/test_validation.py +198 -0
  113. coronelli-0.1.0/tests/ingestion/__init__.py +0 -0
  114. coronelli-0.1.0/tests/ingestion/conftest.py +33 -0
  115. coronelli-0.1.0/tests/ingestion/fixtures/chapter-story.txt +14 -0
  116. coronelli-0.1.0/tests/ingestion/fixtures/headed-story.md +15 -0
  117. coronelli-0.1.0/tests/ingestion/test_parsers.py +50 -0
  118. coronelli-0.1.0/tests/ingestion/test_sectioner.py +361 -0
  119. coronelli-0.1.0/tests/ingestion/test_source_normalizer.py +274 -0
  120. coronelli-0.1.0/tests/packages/__init__.py +0 -0
  121. coronelli-0.1.0/tests/packages/test_schema_validator.py +44 -0
  122. coronelli-0.1.0/tests/packages/test_semantic_validator.py +60 -0
  123. coronelli-0.1.0/tests/synthesis/__init__.py +0 -0
  124. coronelli-0.1.0/tests/synthesis/test_review_approve.py +251 -0
  125. coronelli-0.1.0/tests/synthesis/test_review_enrich.py +285 -0
  126. coronelli-0.1.0/tests/test_atlas_hierarchy.py +305 -0
  127. coronelli-0.1.0/tests/test_health.py +7 -0
  128. coronelli-0.1.0/tests/test_sources_api.py +64 -0
  129. coronelli-0.1.0/tests/workspace/__init__.py +0 -0
  130. coronelli-0.1.0/tests/workspace/test_service.py +67 -0
  131. coronelli-0.1.0/uv.lock +1219 -0
@@ -0,0 +1,46 @@
1
+ # Private product-development material
2
+ /.planning/
3
+ CLAUDE.local.md
4
+
5
+ # Private workspace data — never commit corpus material or derived artifacts
6
+ /data/private/*
7
+ !/data/private/.gitkeep
8
+ /exports/private/*
9
+ !/exports/private/.gitkeep
10
+ *.atlas.private
11
+
12
+ # Environment variables
13
+ .env
14
+ .env.local
15
+ .env.*.local
16
+
17
+ # SQLite databases (local dev workspace)
18
+ *.db
19
+ *.db-shm
20
+ *.db-wal
21
+
22
+ # Python
23
+ __pycache__/
24
+ *.py[cod]
25
+ *.pyo
26
+ .pytest_cache/
27
+ *.egg-info/
28
+ dist/
29
+ .venv/
30
+ venv/
31
+
32
+ # Built frontend (generated by pnpm build — packaged into wheel, not committed)
33
+ /apps/api/app/static/
34
+
35
+ # Node / pnpm
36
+ node_modules/
37
+ dist/
38
+ .pnpm-store/
39
+ .vite/
40
+
41
+ # Editor
42
+ .vscode/
43
+ .idea/
44
+ *.swp
45
+ *.swo
46
+ *.tsbuildinfo
@@ -0,0 +1,112 @@
1
+ Metadata-Version: 2.5
2
+ Name: coronelli
3
+ Version: 0.1.0
4
+ Summary: Turn a book into an interactive atlas.
5
+ Project-URL: Homepage, https://github.com/JanviChawla/coronelli
6
+ Project-URL: Repository, https://github.com/JanviChawla/coronelli
7
+ Keywords: atlas,fiction,literature,maps,nlp
8
+ Requires-Python: >=3.12
9
+ Requires-Dist: alembic
10
+ Requires-Dist: fastapi
11
+ Requires-Dist: jsonschema
12
+ Requires-Dist: openai
13
+ Requires-Dist: pymupdf
14
+ Requires-Dist: python-dotenv
15
+ Requires-Dist: python-multipart
16
+ Requires-Dist: sqlalchemy
17
+ Requires-Dist: uvicorn[standard]
18
+ Provides-Extra: dev
19
+ Requires-Dist: httpx; extra == 'dev'
20
+ Requires-Dist: pytest; extra == 'dev'
21
+ Description-Content-Type: text/markdown
22
+
23
+ # Coronelli ◉
24
+
25
+ A literary atlas builder — upload a book and explore its world in 3D.
26
+
27
+ Coronelli is inspired by the craft of historical cartographers: it reads a novel section by section, finds every named place, maps spatial relationships and visual qualities, and builds a navigable world you can orbit and inspect.
28
+
29
+ ```
30
+ Upload → Catalog → Extract → Synthesize → Atlas Editor → 3D Explorer
31
+ ```
32
+
33
+ - Import `.txt`, `.md`, and text-bearing `.pdf` files
34
+ - LLM pipeline identifies places, containment hierarchies, spatial claims, and visual details
35
+ - Every extracted candidate is held for human review before it becomes canonical
36
+ - Edit the atlas — rename entities, merge duplicates, assign hierarchy, add relationships
37
+ - Explore in an interactive 3D scene: zone rings, floating nodes, force-directed layout
38
+
39
+ ## Installation
40
+
41
+ Requires Python 3.12+. Install with [uv](https://docs.astral.sh/uv/):
42
+
43
+ ```sh
44
+ uv tool install coronelli
45
+ ```
46
+
47
+ Then launch:
48
+
49
+ ```sh
50
+ coronelli
51
+ ```
52
+
53
+ Coronelli opens in your browser at `http://localhost:8000`. Your atlas data is stored locally:
54
+
55
+ | Platform | Location |
56
+ |----------|----------|
57
+ | Windows | `%LOCALAPPDATA%\Coronelli\coronelli.db` |
58
+ | macOS | `~/Library/Application Support/Coronelli/coronelli.db` |
59
+ | Linux | `~/.local/share/Coronelli/coronelli.db` |
60
+
61
+ Set your OpenAI API key before running extraction:
62
+
63
+ ```sh
64
+ # in your shell profile, or in %LOCALAPPDATA%\Coronelli\.env (Windows)
65
+ # ~/Library/Application Support/Coronelli/.env (macOS)
66
+ OPENAI_API_KEY=sk-...
67
+ ```
68
+
69
+ ## Requirements (for development)
70
+
71
+ - Python 3.12+, [uv](https://docs.astral.sh/uv/)
72
+ - Node 20+, pnpm 9+
73
+ - OpenAI API key
74
+
75
+ ## Setup
76
+
77
+ ```sh
78
+ # Backend
79
+ cd apps/api
80
+ uv sync --extra dev
81
+
82
+ # Frontend
83
+ pnpm install
84
+ ```
85
+
86
+ Copy `.env.example` to `apps/api/.env` and set `OPENAI_API_KEY`.
87
+
88
+ ## Running
89
+
90
+ ```sh
91
+ # Backend (http://localhost:8000)
92
+ cd apps/api
93
+ uv run uvicorn app.main:app --reload
94
+
95
+ # Frontend (http://localhost:5173)
96
+ pnpm dev
97
+ ```
98
+
99
+ ## Tests
100
+
101
+ ```sh
102
+ cd apps/api && uv run pytest -q
103
+ pnpm --filter web test --run
104
+ ```
105
+
106
+ ## Cost and caching
107
+
108
+ Estimated cost is shown before each pipeline stage. Repeated extraction on unchanged sections is served from cache — no new API call is made.
109
+
110
+ ## License
111
+
112
+ Source-available, personal non-commercial use only. See [LICENSE](LICENSE).
@@ -0,0 +1,90 @@
1
+ # Coronelli ◉
2
+
3
+ A literary atlas builder — upload a book and explore its world in 3D.
4
+
5
+ Coronelli is inspired by the craft of historical cartographers: it reads a novel section by section, finds every named place, maps spatial relationships and visual qualities, and builds a navigable world you can orbit and inspect.
6
+
7
+ ```
8
+ Upload → Catalog → Extract → Synthesize → Atlas Editor → 3D Explorer
9
+ ```
10
+
11
+ - Import `.txt`, `.md`, and text-bearing `.pdf` files
12
+ - LLM pipeline identifies places, containment hierarchies, spatial claims, and visual details
13
+ - Every extracted candidate is held for human review before it becomes canonical
14
+ - Edit the atlas — rename entities, merge duplicates, assign hierarchy, add relationships
15
+ - Explore in an interactive 3D scene: zone rings, floating nodes, force-directed layout
16
+
17
+ ## Installation
18
+
19
+ Requires Python 3.12+. Install with [uv](https://docs.astral.sh/uv/):
20
+
21
+ ```sh
22
+ uv tool install coronelli
23
+ ```
24
+
25
+ Then launch:
26
+
27
+ ```sh
28
+ coronelli
29
+ ```
30
+
31
+ Coronelli opens in your browser at `http://localhost:8000`. Your atlas data is stored locally:
32
+
33
+ | Platform | Location |
34
+ |----------|----------|
35
+ | Windows | `%LOCALAPPDATA%\Coronelli\coronelli.db` |
36
+ | macOS | `~/Library/Application Support/Coronelli/coronelli.db` |
37
+ | Linux | `~/.local/share/Coronelli/coronelli.db` |
38
+
39
+ Set your OpenAI API key before running extraction:
40
+
41
+ ```sh
42
+ # in your shell profile, or in %LOCALAPPDATA%\Coronelli\.env (Windows)
43
+ # ~/Library/Application Support/Coronelli/.env (macOS)
44
+ OPENAI_API_KEY=sk-...
45
+ ```
46
+
47
+ ## Requirements (for development)
48
+
49
+ - Python 3.12+, [uv](https://docs.astral.sh/uv/)
50
+ - Node 20+, pnpm 9+
51
+ - OpenAI API key
52
+
53
+ ## Setup
54
+
55
+ ```sh
56
+ # Backend
57
+ cd apps/api
58
+ uv sync --extra dev
59
+
60
+ # Frontend
61
+ pnpm install
62
+ ```
63
+
64
+ Copy `.env.example` to `apps/api/.env` and set `OPENAI_API_KEY`.
65
+
66
+ ## Running
67
+
68
+ ```sh
69
+ # Backend (http://localhost:8000)
70
+ cd apps/api
71
+ uv run uvicorn app.main:app --reload
72
+
73
+ # Frontend (http://localhost:5173)
74
+ pnpm dev
75
+ ```
76
+
77
+ ## Tests
78
+
79
+ ```sh
80
+ cd apps/api && uv run pytest -q
81
+ pnpm --filter web test --run
82
+ ```
83
+
84
+ ## Cost and caching
85
+
86
+ Estimated cost is shown before each pipeline stage. Repeated extraction on unchanged sections is served from cache — no new API call is made.
87
+
88
+ ## License
89
+
90
+ Source-available, personal non-commercial use only. See [LICENSE](LICENSE).
@@ -0,0 +1,149 @@
1
+ # A generic, single database configuration.
2
+
3
+ [alembic]
4
+ # path to migration scripts.
5
+ # this is typically a path given in POSIX (e.g. forward slashes)
6
+ # format, relative to the token %(here)s which refers to the location of this
7
+ # ini file
8
+ script_location = %(here)s/app/db/migrations
9
+
10
+ # template used to generate migration file names; The default value is %%(rev)s_%%(slug)s
11
+ # Uncomment the line below if you want the files to be prepended with date and time
12
+ # see https://alembic.sqlalchemy.org/en/latest/tutorial.html#editing-the-ini-file
13
+ # for all available tokens
14
+ # file_template = %%(year)d_%%(month).2d_%%(day).2d_%%(hour).2d%%(minute).2d-%%(rev)s_%%(slug)s
15
+ # Or organize into date-based subdirectories (requires recursive_version_locations = true)
16
+ # file_template = %%(year)d/%%(month).2d/%%(day).2d_%%(hour).2d%%(minute).2d_%%(second).2d_%%(rev)s_%%(slug)s
17
+
18
+ # sys.path path, will be prepended to sys.path if present.
19
+ # defaults to the current working directory. for multiple paths, the path separator
20
+ # is defined by "path_separator" below.
21
+ prepend_sys_path = .
22
+
23
+
24
+ # timezone to use when rendering the date within the migration file
25
+ # as well as the filename.
26
+ # If specified, requires the tzdata library which can be installed by adding
27
+ # `alembic[tz]` to the pip requirements.
28
+ # string value is passed to ZoneInfo()
29
+ # leave blank for localtime
30
+ # timezone =
31
+
32
+ # max length of characters to apply to the "slug" field
33
+ # truncate_slug_length = 40
34
+
35
+ # set to 'true' to run the environment during
36
+ # the 'revision' command, regardless of autogenerate
37
+ # revision_environment = false
38
+
39
+ # set to 'true' to allow .pyc and .pyo files without
40
+ # a source .py file to be detected as revisions in the
41
+ # versions/ directory
42
+ # sourceless = false
43
+
44
+ # version location specification; This defaults
45
+ # to <script_location>/versions. When using multiple version
46
+ # directories, initial revisions must be specified with --version-path.
47
+ # The path separator used here should be the separator specified by "path_separator"
48
+ # below.
49
+ # version_locations = %(here)s/bar:%(here)s/bat:%(here)s/alembic/versions
50
+
51
+ # path_separator; This indicates what character is used to split lists of file
52
+ # paths, including version_locations and prepend_sys_path within configparser
53
+ # files such as alembic.ini.
54
+ # The default rendered in new alembic.ini files is "os", which uses os.pathsep
55
+ # to provide os-dependent path splitting.
56
+ #
57
+ # Note that in order to support legacy alembic.ini files, this default does NOT
58
+ # take place if path_separator is not present in alembic.ini. If this
59
+ # option is omitted entirely, fallback logic is as follows:
60
+ #
61
+ # 1. Parsing of the version_locations option falls back to using the legacy
62
+ # "version_path_separator" key, which if absent then falls back to the legacy
63
+ # behavior of splitting on spaces and/or commas.
64
+ # 2. Parsing of the prepend_sys_path option falls back to the legacy
65
+ # behavior of splitting on spaces, commas, or colons.
66
+ #
67
+ # Valid values for path_separator are:
68
+ #
69
+ # path_separator = :
70
+ # path_separator = ;
71
+ # path_separator = space
72
+ # path_separator = newline
73
+ #
74
+ # Use os.pathsep. Default configuration used for new projects.
75
+ path_separator = os
76
+
77
+ # set to 'true' to search source files recursively
78
+ # in each "version_locations" directory
79
+ # new in Alembic version 1.10
80
+ # recursive_version_locations = false
81
+
82
+ # the output encoding used when revision files
83
+ # are written from script.py.mako
84
+ # output_encoding = utf-8
85
+
86
+ # database URL. This is consumed by the user-maintained env.py script only.
87
+ # other means of configuring database URLs may be customized within the env.py
88
+ # file.
89
+ sqlalchemy.url = sqlite:///./coronelli.db
90
+
91
+
92
+ [post_write_hooks]
93
+ # post_write_hooks defines scripts or Python functions that are run
94
+ # on newly generated revision scripts. See the documentation for further
95
+ # detail and examples
96
+
97
+ # format using "black" - use the console_scripts runner, against the "black" entrypoint
98
+ # hooks = black
99
+ # black.type = console_scripts
100
+ # black.entrypoint = black
101
+ # black.options = -l 79 REVISION_SCRIPT_FILENAME
102
+
103
+ # lint with attempts to fix using "ruff" - use the module runner, against the "ruff" module
104
+ # hooks = ruff
105
+ # ruff.type = module
106
+ # ruff.module = ruff
107
+ # ruff.options = check --fix REVISION_SCRIPT_FILENAME
108
+
109
+ # Alternatively, use the exec runner to execute a binary found on your PATH
110
+ # hooks = ruff
111
+ # ruff.type = exec
112
+ # ruff.executable = ruff
113
+ # ruff.options = check --fix REVISION_SCRIPT_FILENAME
114
+
115
+ # Logging configuration. This is also consumed by the user-maintained
116
+ # env.py script only.
117
+ [loggers]
118
+ keys = root,sqlalchemy,alembic
119
+
120
+ [handlers]
121
+ keys = console
122
+
123
+ [formatters]
124
+ keys = generic
125
+
126
+ [logger_root]
127
+ level = WARNING
128
+ handlers = console
129
+ qualname =
130
+
131
+ [logger_sqlalchemy]
132
+ level = WARNING
133
+ handlers =
134
+ qualname = sqlalchemy.engine
135
+
136
+ [logger_alembic]
137
+ level = INFO
138
+ handlers =
139
+ qualname = alembic
140
+
141
+ [handler_console]
142
+ class = StreamHandler
143
+ args = (sys.stderr,)
144
+ level = NOTSET
145
+ formatter = generic
146
+
147
+ [formatter_generic]
148
+ format = %(levelname)-5.5s [%(name)s] %(message)s
149
+ datefmt = %H:%M:%S
File without changes
File without changes
@@ -0,0 +1,20 @@
1
+ from fastapi import APIRouter, Depends
2
+ from sqlalchemy.orm import Session
3
+
4
+ from app.db.engine import get_db
5
+ from app.db.models import SourceDocument
6
+ from app.domain.world import EntityMention, MapClaim, MapEntity, MapTravelRule
7
+
8
+ router = APIRouter(tags=["admin"])
9
+
10
+
11
+ @router.delete("/api/admin/reset", status_code=200)
12
+ def reset_library(db: Session = Depends(get_db)) -> dict:
13
+ """Delete everything: all documents and all derived map data."""
14
+ db.query(MapClaim).delete(synchronize_session=False)
15
+ db.query(MapTravelRule).delete(synchronize_session=False)
16
+ db.query(EntityMention).delete(synchronize_session=False)
17
+ db.query(MapEntity).delete(synchronize_session=False)
18
+ db.query(SourceDocument).delete(synchronize_session=False)
19
+ db.commit()
20
+ return {"reset": True}
@@ -0,0 +1,15 @@
1
+ from fastapi import APIRouter
2
+
3
+ from app.api.atlas_edit import router as edit_router
4
+ from app.api.atlas_export import router as export_router
5
+ from app.api.atlas_hierarchy import router as hierarchy_router
6
+ from app.api.atlas_read import router as read_router
7
+ from app.api.atlas_suggestions import router as suggestions_router
8
+
9
+ router = APIRouter(tags=["atlas"])
10
+
11
+ router.include_router(read_router)
12
+ router.include_router(export_router)
13
+ router.include_router(edit_router)
14
+ router.include_router(hierarchy_router)
15
+ router.include_router(suggestions_router)