ckanext-ai-metadata 0.3.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 (112) hide show
  1. ckanext_ai_metadata-0.3.0/AI_ASSISTANCE.md +14 -0
  2. ckanext_ai_metadata-0.3.0/CHANGELOG.md +165 -0
  3. ckanext_ai_metadata-0.3.0/CONTRIBUTING.md +35 -0
  4. ckanext_ai_metadata-0.3.0/LICENSE +21 -0
  5. ckanext_ai_metadata-0.3.0/MANIFEST.in +9 -0
  6. ckanext_ai_metadata-0.3.0/PKG-INFO +800 -0
  7. ckanext_ai_metadata-0.3.0/README.md +762 -0
  8. ckanext_ai_metadata-0.3.0/SECURITY.md +31 -0
  9. ckanext_ai_metadata-0.3.0/TROUBLESHOOTING.md +87 -0
  10. ckanext_ai_metadata-0.3.0/babel.cfg +4 -0
  11. ckanext_ai_metadata-0.3.0/babel_ckan_tag_shims.py +53 -0
  12. ckanext_ai_metadata-0.3.0/ckanext/__init__.py +9 -0
  13. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/__init__.py +0 -0
  14. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/actions.py +758 -0
  15. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/admin_settings.py +239 -0
  16. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/ai.py +77 -0
  17. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/api.py +60 -0
  18. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/assets/.gitkeep +0 -0
  19. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/assets/css/review.css +194 -0
  20. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/assets/js/review.js +2464 -0
  21. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/assets/vendor/codemirror/LICENSE +21 -0
  22. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/assets/vendor/codemirror/README.md +16 -0
  23. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/assets/vendor/codemirror/codemirror.css +344 -0
  24. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/assets/vendor/codemirror/codemirror.min.js +24 -0
  25. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/assets/vendor/codemirror/mark-selection.js +119 -0
  26. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/assets/webassets.yml +12 -0
  27. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/auth.py +5 -0
  28. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/cache.py +129 -0
  29. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/checks.py +202 -0
  30. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/cli.py +105 -0
  31. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/config_declaration.yaml +47 -0
  32. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/extra_fields.py +499 -0
  33. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/guidance.py +71 -0
  34. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/i18n/ckanext-ai-metadata.pot +1819 -0
  35. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/i18n/sv/LC_MESSAGES/ckanext-ai-metadata.mo +0 -0
  36. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/i18n/sv/LC_MESSAGES/ckanext-ai-metadata.po +2079 -0
  37. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/i18n/sv_SE/LC_MESSAGES/ckanext-ai-metadata.mo +0 -0
  38. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/i18n/sv_SE/LC_MESSAGES/ckanext-ai-metadata.po +2079 -0
  39. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/jobs.py +322 -0
  40. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/language_codes.py +65 -0
  41. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/limits.py +293 -0
  42. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/link_results.py +122 -0
  43. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/llm/__init__.py +27 -0
  44. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/llm/assistant.py +235 -0
  45. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/llm/base.py +38 -0
  46. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/llm/contracts.py +212 -0
  47. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/llm/prompts.py +248 -0
  48. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/localization.py +100 -0
  49. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/markdown.py +67 -0
  50. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/migration/__init__.py +0 -0
  51. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/migration/ai_metadata/__init__.py +0 -0
  52. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/migration/ai_metadata/alembic.ini +30 -0
  53. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/migration/ai_metadata/env.py +44 -0
  54. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/migration/ai_metadata/script.py.mako +22 -0
  55. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/migration/ai_metadata/versions/001_create_review_cache.py +36 -0
  56. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/model.py +28 -0
  57. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/page_fetch.py +239 -0
  58. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/plugin.py +136 -0
  59. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/profiles.py +235 -0
  60. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/rules/__init__.py +12 -0
  61. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/rules/data_services.py +205 -0
  62. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/rules/engine.py +422 -0
  63. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/rules/links.py +92 -0
  64. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/rules/profile.py +232 -0
  65. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/templates/.gitkeep +0 -0
  66. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/templates/admin/base.html +6 -0
  67. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/templates/ai_metadata/admin/_nav.html +7 -0
  68. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/templates/ai_metadata/admin/ai_instructions.html +78 -0
  69. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/templates/ai_metadata/admin/check_settings.html +141 -0
  70. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/templates/ai_metadata/admin/overview.html +41 -0
  71. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/templates/ai_metadata/help.html +42 -0
  72. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/templates/ai_metadata/snippets/review_panel.html +156 -0
  73. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/templates/package/snippets/package_form.html +6 -0
  74. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/tests/__init__.py +0 -0
  75. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/tests/conftest.py +46 -0
  76. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/tests/test_actions_ai.py +579 -0
  77. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/tests/test_admin_settings.py +169 -0
  78. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/tests/test_ai_contract.py +128 -0
  79. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/tests/test_ai_wiring.py +80 -0
  80. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/tests/test_buttons.py +21 -0
  81. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/tests/test_checks.py +107 -0
  82. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/tests/test_extra_fields.py +283 -0
  83. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/tests/test_i18n.py +51 -0
  84. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/tests/test_instructions.py +165 -0
  85. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/tests/test_jobs.py +379 -0
  86. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/tests/test_language_codes.py +35 -0
  87. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/tests/test_languages.py +71 -0
  88. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/tests/test_limits.py +184 -0
  89. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/tests/test_llm.py +396 -0
  90. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/tests/test_markdown.py +92 -0
  91. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/tests/test_migration.py +46 -0
  92. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/tests/test_overview.py +78 -0
  93. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/tests/test_overview_translation.py +45 -0
  94. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/tests/test_page_fetch.py +357 -0
  95. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/tests/test_profile_selection.py +74 -0
  96. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/tests/test_profiles.py +219 -0
  97. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/tests/test_review_translation.py +94 -0
  98. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/tests/test_rules.py +511 -0
  99. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/tests/test_without_tables.py +32 -0
  100. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/translation_results.py +106 -0
  101. ckanext_ai_metadata-0.3.0/ckanext/ai_metadata/views.py +234 -0
  102. ckanext_ai_metadata-0.3.0/ckanext_ai_metadata.egg-info/PKG-INFO +800 -0
  103. ckanext_ai_metadata-0.3.0/ckanext_ai_metadata.egg-info/SOURCES.txt +110 -0
  104. ckanext_ai_metadata-0.3.0/ckanext_ai_metadata.egg-info/dependency_links.txt +1 -0
  105. ckanext_ai_metadata-0.3.0/ckanext_ai_metadata.egg-info/entry_points.txt +2 -0
  106. ckanext_ai_metadata-0.3.0/ckanext_ai_metadata.egg-info/namespace_packages.txt +1 -0
  107. ckanext_ai_metadata-0.3.0/ckanext_ai_metadata.egg-info/requires.txt +2 -0
  108. ckanext_ai_metadata-0.3.0/ckanext_ai_metadata.egg-info/top_level.txt +1 -0
  109. ckanext_ai_metadata-0.3.0/pytest.ini +4 -0
  110. ckanext_ai_metadata-0.3.0/setup.cfg +4 -0
  111. ckanext_ai_metadata-0.3.0/setup.py +64 -0
  112. ckanext_ai_metadata-0.3.0/test.ini +38 -0
@@ -0,0 +1,14 @@
1
+ # AI assistance disclosure
2
+
3
+ The implementation and documentation of ckanext-ai-metadata were developed by Björn Hagström with assistance from
4
+ Anthropic's Claude Code and OpenAI's Codex.
5
+
6
+ AI tools assisted with design discussion, code drafting, refactoring, review and documentation. Product decisions and
7
+ acceptance of the resulting work remain human decisions.
8
+
9
+ The human maintainer is the author, copyright holder and accountable project maintainer. AI systems are not listed as
10
+ authors or maintainers. Before a public release, the maintainer is expected to review the released diff, verify the
11
+ documented behavior and accept responsibility for correctness, security, licensing and provenance.
12
+
13
+ Contributors should disclose material generative-AI assistance in their pull request description. Disclosure does not
14
+ replace review, tests or the contributor's responsibility for the submitted material.
@@ -0,0 +1,165 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file. The format
4
+ is based on Keep a Changelog, and the project follows Semantic Versioning.
5
+
6
+ ## [Unreleased]
7
+
8
+ ## [0.3.0] - 2026-11-29
9
+
10
+ ### Changed (breaking)
11
+
12
+ - **Renamed from ckanext-metadata-assistant to ckanext-ai-metadata**, next to ckanext-ai-connector and
13
+ ckanext-ai-translation. Nothing is carried over from the old name, and the names below up to 0.2.1 are the old ones.
14
+ The interface still calls it "Metadata assistant". New names: the package `ckanext-ai-metadata`, the module
15
+ `ckanext.ai_metadata`, the plugin `ai_metadata`, the options `ckanext.ai_metadata.*`, the actions and auth functions
16
+ `ai_metadata_*`, the pages `/ai-metadata/…` and `/ckan-admin/ai-metadata/…`, the commands `ckan ai-metadata …`, the
17
+ consumer `ai_metadata` in ckanext-ai-connector (purposes `review` and `landing_page`), the schema block `ai_metadata:`,
18
+ the queues `ai_metadata` and `ai_metadata_bulk`, the Redis keys `ai_metadata:…` and the translation domain
19
+ `ckanext-ai-metadata`.
20
+ - **A new migration history.** `ckan db upgrade -p ai_metadata` creates the table `ai_metadata_review_cache` (migration
21
+ `ai_metadata_001`). The old tables (`metadata_assistant_review_cache`, `metadata_assistant_translation_proposal`,
22
+ `metadata_assistant_alembic_version`; open translation proposals do not carry over) and the old `system_info` rows (`ckanext.metadata_assistant.*`, `ckanext.ai_connector.purpose.metadata_assistant.*`) are not
23
+ read; an installation that ran 0.2 can drop them.
24
+ - **The AI needs a signed-in user.** The AI review and the landing page read (the actions and the jobs) refuse an
25
+ anonymous caller even where `ckan.auth.anon_create_dataset` lets anyone create a dataset: an AI request is a paid call
26
+ counted per user. Commands run as the site user. The rule check is unchanged.
27
+ - With ckanext-ai-translation's plugin on (its API 1), the catalogue overview also counts its findings about missing and
28
+ outdated translations, and the review uses its source language; without it, the metadata language is
29
+ `ckan.locale_default`. The assistant does not need it.
30
+
31
+ ### Removed (breaking)
32
+
33
+ - **Translation moved to [ckanext-ai-translation](https://github.com/bjornhagstrom/ckanext-ai-translation).** The
34
+ assistant is metadata review only. Gone: the panel's translate button and its suggestions, the translate action and the
35
+ job kind `translate`, the translations page and its admin tab, the translation half of the instructions page and its
36
+ option, the purpose `translate`, the rule about missing or outdated translations and the `languages` setup check, the
37
+ validators for translation state and ckanext-fluent, the stand-in helper `scheming_missing_required_fields`, the
38
+ commands `propose-translations` and `migrate-multilingual`, the schema block keys `translation_source` and
39
+ `translation_level`, and the example schema `examples/multilingual_migration_schema.yaml`. ckanext-ai-translation has
40
+ all of it under its own names (`ai_translation_*`, schema block `ai_translation`), with its own settings, model, queue,
41
+ limits and proposals table. A schema that names the old validators stops CKAN from starting: install
42
+ ckanext-ai-translation and rename them as the README's "Upgrading from ckanext-metadata-assistant" says.
43
+ - **The command `migrate-ai-settings`** and the setup check "AI settings from before": they moved settings kept under
44
+ the old name, which this version does not read.
45
+ - The `[ai]` extra, which added nothing since 0.1.0.
46
+
47
+ ### Added
48
+
49
+ - **AI suggestions for more fields.** Besides title, description, keywords and theme, the AI can suggest values for
50
+ further fields of the schema that the portal turns on, one at a time: on the *Settings* page (*AI suggestions
51
+ for more fields*, a box per field), with `ckanext.ai_metadata.suggest_fields`, or with `ai_suggest` on the field in
52
+ the schema, in that order. Short and long texts and lists of choices written in the schema are supported; the kind
53
+ is read from the schema. The AI gets each field's label, help text, current value and choices; a suggestion outside
54
+ the choices, of the wrong shape, too long or unchanged is dropped on the server. At most 8 fields, 60 choices per
55
+ field and 150 in all. Without further fields the request, the prompt and the cache are as before, except for a
56
+ schema that gives a role to a field of its own (`description_field: abstract` …): its guidance and rule findings now
57
+ go to the AI under the model's names (`notes`), so its prepared reviews are asked for once more.
58
+ - **Sensitive fields are pointed out, not blocked:** a field whose name suggests personal data, confidentiality, rights,
59
+ a licence or the law can be turned on, and the page and the setup check say so. `ckanext.ai_metadata.blocked_fields`
60
+ (names or patterns) keeps fields from the AI whatever is turned on.
61
+ - **`ckanext.ai_metadata.api` (version 1)** for other extensions: `describe_fields` says how the AI should treat a field
62
+ an extension owns (`kind`, `guidance`, `max_length`, or `never`); it never turns a field on.
63
+ - Further fields of three more kinds: fields in several languages (ckanext-fluent; the AI writes the metadata
64
+ language's box), lists of texts (`multiple_text`, at most 20 items) and a time period (a repeating field with `start`
65
+ and `end`, such as ckanext-dcat's `temporal_coverage`; full dates only, never guessed).
66
+ - The setup check lists the further fields sent to the AI service, those turned on but left out and why, and those with
67
+ a sensitive name.
68
+
69
+ ### Changed
70
+
71
+ - **The completeness check names missing and out-of-date translations** when ckanext-ai-translation's plugin is on,
72
+ with that extension's own check (`ai_translation_check`), so both say the same; before, it said "nothing to remark
73
+ on" above a list of missing translations. Only for someone who may edit the dataset;
74
+ without the extension nothing changes.
75
+ - The text while a request waits for the AI says so ("Waiting for its turn with the AI…"), not "Waiting for a free place…",
76
+ which editors did not understand.
77
+ - The help page says an AI review usually takes up to half a minute, not a few seconds (20–30 s with Claude Haiku).
78
+ - The sysadmin pages are called **Metadata assistant** (was *Metadata check*), with the tabs *Catalogue overview*,
79
+ *Settings* (was *Check settings*), *Instructions to the AI* and *AI settings (shared)*. The panel names the further
80
+ fields it may send; the question about unused suggestions lists them; "Use the server defaults" asks first and says
81
+ that it resets the whole page; CKAN's licence box is explained as the editor's choice.
82
+ - A suggestion's `field` may be any field the request names (`FieldSuggestion.field` is a string; the answer's schema
83
+ sent to the model lists the request's fields). The panel's note for a list says "The value is chosen in the list in the
84
+ form" instead of naming themes.
85
+
86
+ ### Fixed
87
+
88
+ - The review action answers a `dataset` that is not an object (a JSON text, a list) with a validation error, not a
89
+ server error.
90
+ - **A suggestion used no longer starts a new review** when the editor leaves a field, which replaced the suggestions
91
+ not used yet ("the panel changes by itself"). A theme suggestion is one theme for a plain select (two set it to the
92
+ last one) and is left out when the theme is chosen already; a keyword holds only what CKAN saves in a tag. The AI is
93
+ asked to leave out a suggestion that changes nothing. The status line names a field as the form does.
94
+ - **Language codes follow one rule** (`language_codes.py`, the same as ckanext-ai-translation's): `pt-BR` is `pt_BR`;
95
+ `sv_SE` finds `sv`, and `sv` its one regional variant; `pt_PT` and `pt_BR` stay two languages. Labels, the fluent
96
+ form draft (`title_translated-pt-BR`, as ckanext-fluent writes it) and the panel follow it.
97
+ - **A field of the schema's own for a role** (`description_field`, `keywords_field`, `title_field`, `theme_field`) gets
98
+ the AI's suggestions. The model answers with the contract's names (`notes`, `tag_string`…), and the suggestions now
99
+ come back under the schema's names, checked as for CKAN's own fields (an unchanged text and keywords the dataset has
100
+ are dropped, Markdown follows the setting); before, the panel found no field for them. The guidance and the rule
101
+ findings the AI gets name the field as the model knows it. The panel is given the fields as a list (name, kind:
102
+ `data-fields`) and writes a suggestion by the field's kind, under its own translated name for the field. Nothing
103
+ changes for a schema that keeps CKAN's names: the same request, prompt and cache. The API's `field` is the schema's
104
+ name, and a suggestion for a role the schema has no field for is dropped.
105
+ - The AI's summary, reasons and questions are in the language of the page the editor reads them on, when that is not
106
+ the metadata language; the suggested values stay in the metadata language. A page in the metadata language gets the
107
+ same request, and the same cached reviews, as before. A review kept for one page language is not shown on a page in
108
+ another; `review-all` prepares them in `ckan.locale_default`, so where that is not the metadata language, the
109
+ prepared reviews are made once more.
110
+ - The rule check no longer reads the name of a standard in *Conforms to* ("EU Air Quality Directive 2008/50/EC") as an
111
+ address with spaces in it; text with spaces and no `://` is only checked as an address in `url`.
112
+ - The panel counts only the suggestions it shows, and with none says so instead of "AI suggestions are ready". The AI
113
+ is asked to name fields by their labels, not by technical names. The settings page says what applies without a value
114
+ set on it.
115
+
116
+ ## [0.2.1] - 2026-11-21
117
+
118
+ ### Changed
119
+
120
+ - Works with ckanext-ai-connector 0.3 (`>=0.2,<0.4`).
121
+ - With ckanext-ai-connector's API 3, the AI settings page names the assistant ("Metadata assistant") over its purposes,
122
+ not by its short name. Older versions of the connector work as before.
123
+
124
+ ## [0.2.0] - 2026-11-20
125
+
126
+ ### Added
127
+
128
+ - **A model per kind of work:** the review, the translation and the reading of landing pages are the purposes
129
+ `review`, `translate` and `landing_page` of ckanext-ai-connector's API 2, so each can have a model of its own on the AI
130
+ settings page. Prepared reviews and page reads are kept per model. Needs ckanext-ai-connector 0.2.
131
+
132
+ ## [0.1.0] - 2026-11-20
133
+
134
+ The first public release.
135
+
136
+ ### Added
137
+
138
+ - **A review panel in CKAN's dataset form.** A rule check without AI (required and recommended fields, themes outside the
139
+ vocabulary, short descriptions, duplicate keywords, a missing licence, address slips, missing or outdated translations,
140
+ and more), under its own heading and run again as the form changes; and, optionally, AI suggestions for the title,
141
+ description, keywords and theme, each applied by the editor or not at all.
142
+ - **Translation suggestions** for title, description and keywords into the schema's other languages (ckanext-fluent),
143
+ in the form and in bulk (`propose-translations`), stored as proposals that an editor reads and applies.
144
+ - **The portal's own languages:** labels, help texts and theme labels given per language follow the page's language and
145
+ the portal's main language (`ckan.locale_default`), and landing pages are asked for in the metadata's language; no language is
146
+ preferred by default.
147
+ - **Landing pages as material:** the portal fetches a public https page itself (or the AI service does, for models that
148
+ can), summarises it once and reuses the summary; a page that was not used says why.
149
+ - **Administration pages** for sysadmins: the check settings with a setup check (including the landing page field and
150
+ the AI connection), the instructions to the AI (editable, with a trial on a dataset), a catalogue-wide overview of
151
+ what the rules find, and the translation proposals page for editors.
152
+ - **Background jobs and limits** for many editors at once: a worker (`ckan metadata-assistant worker`), queues, limits
153
+ per user and site, and a breaker for a failing AI service; without a worker the requests run in the web request.
154
+ - **Commands:** `doctor`, `worker`, `queue`, `review-all`, `propose-translations`, `migrate-multilingual` and
155
+ `migrate-ai-settings`.
156
+ - **The AI connection through [ckanext-ai-connector](https://github.com/bjornhagstrom/ckanext-ai-connector)** (`>=0.1,<0.2`),
157
+ shared with other extensions: model, key, own AI server and time limits are set there. A review or translation that
158
+ fails says why (the service busy, too slow, or out of quota).
159
+ - English source texts with a Swedish catalogue (`sv`, `sv_SE`).
160
+
161
+ ### Upgrading from a development version
162
+
163
+ Development versions kept their AI settings under this extension's own names. `ckan metadata-assistant
164
+ migrate-ai-settings [--dry-run]` copies them to ckanext-ai-connector once, and `--remove-old` removes the old rows; the
165
+ setup check says when something still waits. See the README, "Upgrading from the settings this extension had".
@@ -0,0 +1,35 @@
1
+ # Contributing
2
+
3
+ Thank you for helping improve ckanext-ai-metadata. The extension is in development (0.x), so bug reports,
4
+ compatibility results (CKAN version, dataset schema, AI service and model) and feedback on the rule check and the
5
+ suggestions are especially useful.
6
+
7
+ ## Before opening an issue
8
+
9
+ - search existing issues;
10
+ - include the CKAN, Python and ckanext-ai-connector versions, the dataset schema (ckanext-scheming, ckanext-fluent or none)
11
+ and the model (`service/name`) used;
12
+ - describe the expected and actual result;
13
+ - include reproducible steps and relevant logs with keys, credentials and personal data removed.
14
+
15
+ Use a private security report instead of a public issue for vulnerabilities; see [SECURITY.md](SECURITY.md).
16
+
17
+ ## Pull requests
18
+
19
+ 1. Keep each pull request focused.
20
+ 2. Add or update tests when changing behavior. Run the suite as the README's "Testing" section shows; continuous
21
+ integration runs it on CKAN 2.11.1, the newest 2.11 patch and 2.12, and runs the JavaScript tests.
22
+ 3. Update the README, TROUBLESHOOTING and changelog when user-visible behavior changes.
23
+ 4. Internationalize all new user-visible strings: wrap them in `_(...)` with English source text (in JavaScript, through
24
+ the panel's `data-i18n` strings), then add the Swedish `msgstr` to
25
+ `ckanext/ai_metadata/i18n/sv/LC_MESSAGES/ckanext-ai-metadata.po` and `sv_SE`, and compile the `.mo`
26
+ files. The tests fail when an extracted string has no translation or a `.mo` does not match its `.po`.
27
+ 5. Never let the AI save or publish anything: suggestions are applied by an editor. Never log a key, a prompt or an
28
+ answer from the AI service; log failures by type and status code.
29
+ 6. Disclose material generative-AI assistance in the pull request description (see [AI_ASSISTANCE.md](AI_ASSISTANCE.md)).
30
+
31
+ ## Translations
32
+
33
+ A new language is welcome as a pull request: add
34
+ `ckanext/ai_metadata/i18n/<locale>/LC_MESSAGES/ckanext-ai-metadata.po` and its compiled `.mo`. No code
35
+ change is needed; the plugin offers every compiled catalogue.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Björn Hagström
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,9 @@
1
+ include README.md LICENSE CHANGELOG.md TROUBLESHOOTING.md SECURITY.md CONTRIBUTING.md AI_ASSISTANCE.md
2
+ include ckanext/ai_metadata/config_declaration.yaml
3
+ recursive-include ckanext/ai_metadata/templates *
4
+ recursive-include ckanext/ai_metadata/assets *
5
+ recursive-include ckanext/ai_metadata/i18n *
6
+ recursive-include ckanext/ai_metadata/migration *
7
+ include babel.cfg babel_ckan_tag_shims.py pytest.ini test.ini
8
+ global-exclude *.py[cod]
9
+ prune **/__pycache__