Skip to main content

coldfront-plugin-dfg-fachsystematik

A ColdFront plugin that lets PIs select a field of science for their project according to the DFG Fachsystematik (2024–2028) — the classification of scientific disciplines, subject areas, review boards and subjects published by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation).

How it works

The plugin stores the DFG classification inside ColdFront's native field of science data:

  • Each of the 214 DFG subjects (Fächer) is imported as a selectable FieldOfScience row whose description is the official number plus the English name, e.g. 111-01 Prehistory and World Archaeology.
  • The subject chosen at project creation is saved on the project's core Project.field_of_science foreign key — no separate plugin model on the project. The subject therefore appears everywhere ColdFront uses the field of science: the project detail page, the project update form, project search, FOS-based reports and the REST API.
  • The plugin's only model, DfgSubject, is a side table mapping each such row to its DFG metadata: the German subject name and the numbers/names of the review board (Fachkollegium), subject area (Fachgebiet) and scientific discipline (Wissenschaftsbereich). This keeps the hierarchy queryable (e.g. "all projects in subject area 34 Geosciences") and powers the selection widget.

The hierarchy

Scientific Discipline (Wissenschaftsbereich)      e.g.  2 Life Sciences
└── Subject Area (Fachgebiet)                            21 Biology
    └── Review Board (Fachkollegium)                     213 Zoology
        └── Subject (Fach)                               213-01 Systematics and Morphology (Zoology)

Easing the selection in the frontend

ColdFront's built-in field of science dropdown is a flat list of all FieldOfScience rows. The plugin replaces the selection field in the project creation and update forms with a searchable select2 dropdown whose options are the 214 DFG subjects, grouped by review board (Fachkollegium) via <optgroup> headers:

111 Ancient Cultures · Alte Kulturen
    111-01 — Prehistory and World Archaeology · Ur- und Frühgeschichte (weltweit)
    111-02 — Greek and Latin Philology · Griechische und Lateinische Philologie
    …
112 History · Geschichtswissenschaften
    …

Both the English and the German subject names are searchable, so a German-speaking PI finds "Ur- und Frühgeschichte" as easily as an English-speaking one finds "Prehistory". No custom JavaScript is needed: ColdFront already ships select2 and applies it to the widget class reused here.

The data ships with the plugin (src/coldfront_plugin_dfg_fachsystematik/data/Fachsystematik_2024-2028.csv) and is the same bilingual CSV used by the DFG-Fachsystematik-Ontology project.

Reusing the selector in custom forms

The grouped DFG dropdown is a self-contained, reusable form field. Any custom form in your ColdFront deployment — allocation forms, user profile forms, your own views — can use it by importing DfgFieldOfScienceChoiceField:

from coldfront_plugin_dfg_fachsystematik.forms import DfgFieldOfScienceChoiceField

class MyAllocationForm(forms.Form):
    field_of_science = DfgFieldOfScienceChoiceField(required=False)

The field builds its own queryset, optgroups and select2 attributes; all standard ModelChoiceField kwargs (required, label, help_text, …) work as usual. The saved value is a plain FieldOfScience primary key, so anything expecting ColdFront's native field-of-science foreign key works with it directly. Two things to keep in mind:

  • The field is single-choice; a multi-select variant is not provided.
  • If you wire the field into forms yourself and don't want the plugin to touch ColdFront's project forms at all, set DFG_FACHSYSTEMATIK_PATCH_PROJECT_FORM=False (see Settings) and use the plugin purely as a data source.

Installation

The plugin requires a working ColdFront deployment (tested against ColdFront 1.1.x). Install it inside your ColdFront environment:

$ uv pip install coldfront-plugin-dfg-fachsystematik

ColdFront itself is not a declared dependency, because your deployment already provides it. If you want to track unreleased changes, install from the GitHub repository instead:

$ uv pip install git+https://github.com/yoshson/coldfront-plugin-dfg-fachsystematik.git

Enable the plugin by creating coldfront/config/plugins/dfg_fachsystematik.py in your ColdFront installation:

from coldfront.config.base import INSTALLED_APPS

INSTALLED_APPS += [
    'coldfront_plugin_dfg_fachsystematik',
]

and register it in coldfront/config/settings.py:

plugin_configs['PLUGIN_DFG_FACHSYSTEMATIK'] = 'plugins/dfg_fachsystematik.py'

Then set PLUGIN_DFG_FACHSYSTEMATIK=True in your environment (or local settings) and run migrations:

$ coldfront migrate

The initial migration automatically imports the Fachsystematik into the FieldOfScience table. The plugin hooks into the project forms at application startup — no further wiring is required.

Refreshing the data

The import is idempotent and non-destructive. To re-import or to load a new Fachsystematik period (e.g. 2028–2032) from a CSV file:

$ coldfront load_dfg_fachsystematik            # bundled 2024–2028 CSV
$ coldfront load_dfg_fachsystematik --path Fachsystematik_2028-2032.csv

Existing subjects are updated in place (matched by DFG number); subjects absent from the CSV remain in the database. Note that the importer manages the description of the DFG FieldOfScience rows — manual edits to those descriptions in the admin are reverted on the next import.

Settings

Setting Default Description
DFG_FACHSYSTEMATIK_PATCH_PROJECT_FORM True Automatically integrate with ColdFront: replace the field of science selection in the project create/update forms with the grouped DFG selector, add it to the project admin change form, and swap in the DFG-aware FieldOfScience admin. Set to False if you want to wire things up yourself (use coldfront_plugin_dfg_fachsystematik.forms.DfgFieldOfScienceChoiceField and admin.DfgFieldOfScienceAdmin) or use the plugin purely as a data importer.

Notes on the built-in field of science data

  • The prepopulated NSF FieldOfScience rows are left untouched, and existing projects keep their values. Only the create/update forms and the admin are narrowed to DFG subjects; is_selectable alone does not filter the core forms.
  • When a project with a legacy NSF value is edited, the update form offers only DFG subjects, so saving requires choosing a DFG subject — a natural way to reclassify legacy projects over time.
  • ColdFront's FOS-based reports and searches operate on the description, i.e. on the 214 DFG subjects (leaf level). Aggregations by Fachgebiet/Fachkollegium are possible by joining through the plugin's DfgSubject side table.

Interplay with import_field_of_science_data

ColdFront's own import_field_of_science_data command deletes and recreates all FieldOfScience rows. On a fresh setup where that command is run after migrate, the DFG rows created by this plugin's data migration are wiped — simply re-run load_dfg_fachsystematik afterwards to restore them (the plugin's side table cleans itself up via cascade and is recreated with the data).

⚠️ Do not re-run import_field_of_science_data on a database that has projects: Project.field_of_science is on_delete=CASCADE, so wiping the FieldOfScience table would delete the projects with it. This is core ColdFront behavior and applies with or without this plugin; it is mentioned here because DFG subjects live in the same table.

Django admin

The plugin adds a DFG subjects (Fächer) admin section listing all imported subjects with their metadata and a link to the underlying FieldOfScience row, filterable by scientific discipline and subject area.

ColdFront's own FieldOfScience admin is replaced with a DFG-aware variant: the list view links each row to its DFG subject metadata, search also matches DFG numbers and German names, and the canonical "<Fachnummer> <English name>" descriptions of DFG rows are read-only (the importer enforces them on every load, so manual edits would silently be reverted — see below). NSF rows remain editable as before, and the row behind FieldOfScience.DEFAULT_PK (the model-level default for new projects) is kept in place and selectable by the importer.

On the project change page, the field of science is shown with the same grouped DFG selector as the front-end forms — without this, ColdFront 1.1.x omits field_of_science from its hardcoded admin change-form fields, so a subject could not be seen or corrected in the admin. (Without select2 being initialized on admin pages, the dropdown degrades to a plain, still-grouped <select>.)

How the form integration works

ColdFront currently has no extension point for modifying form fields, and its forms select all FieldOfScience rows. At application startup (AppConfig.ready()), the plugin therefore:

  1. replaces ProjectCreateView.form_class with ProjectCreationFormWithDfgFieldOfScience, whose field_of_science field is the grouped DFG selector,
  2. wraps ProjectUpdateView.get_form to apply the same selector to the generated update form (only if it contains a field_of_science field, so a customized PROJECT_UPDATE_FIELDS is respected), and
  3. extends ProjectAdmin so the project admin change form shows field_of_science (omitted by ColdFront 1.1.x's fields_change tuple) with the same selector, via the formfield_for_foreignkey hook.

The selection is saved by ColdFront's own ModelForm machinery on the project's native field_of_science foreign key — there is no extra save step, and the project_new signal sees the final value. All patching lives in coldfront_plugin_dfg_fachsystematik/patch.py and is the only module that needs adapting if ColdFront's internals change.

Data quirks

The source CSV contains a hyphenation artifact for subject area 34 ("Geowissen-schaften"); the importer repairs this to "Geowissenschaften". Other hyphens in names (e.g. "Hals-Nasen-Ohrenheilkunde") are legitimate and are preserved.

Development

$ uv sync
$ uv run pytest
$ uv run ruff check
$ uv run ruff format --check

The parser is free of Django imports and covered by unit tests.

Integration tests

The Django integration is exercised against a basic ColdFront test instance booted in-process: tests/integration/settings.py assembles the settings from ColdFront's own config fragments, pytest-django creates and migrates an in-memory SQLite database (running the plugin's data migration), and the tests drive the real project create/update views with a logged-in PI. Run them with the integration dependency group, which installs ColdFront 1.1.x:

$ uv sync --group integration
$ uv run pytest tests/integration

Without the group, plain uv run pytest skips tests/integration at collection time and runs only the parser unit tests.

The repo root contains a minimal manage.py pointing at the test instance settings (pytest-django needs it to locate the project). It also allows exploring the instance by hand:

$ uv run --group integration python manage.py check
$ DB_URL=sqlite:///coldfront.db uv run --group integration python manage.py migrate

Metadata

Release files for coldfront-plugin-dfg-fachsystematik 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for coldfront-plugin-dfg-fachsystematik 0.1.1
File Size Uploaded Provenance Actions
coldfront_plugin_dfg_fachsystematik-0.1.1.tar.gz 36.6 kB Without provenance Details for coldfront_plugin_dfg_fachsystematik-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for coldfront-plugin-dfg-fachsystematik 0.1.1
File Interpreter ABI Platform Actions
coldfront_plugin_dfg_fachsystematik-0.1.1-py3-none-any.whl Python 3 none any Details for coldfront_plugin_dfg_fachsystematik-0.1.1-py3-none-any.whl

Total release size: 73.9 kB

Release files / coldfront_plugin_dfg_fachsystematik-0.1.1.tar.gz

Download URL coldfront_plugin_dfg_fachsystematik-0.1.1.tar.gz
Size 36.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d8df803f2898a085abc9b0cee925034b931a5e103a0e926ae1078743be4b6aa5
BLAKE2b-256 checksum
How to use checksums
5ba3f3dc65596bc83a1a6310aca823975aff72dd72b88ed028ba3d8a099c6920
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / coldfront_plugin_dfg_fachsystematik-0.1.1-py3-none-any.whl

Download URL coldfront_plugin_dfg_fachsystematik-0.1.1-py3-none-any.whl
Size 37.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
06b47b509d42fa8ff78a63ce7b206ece734b3f0c86b00df9d13cb60b8c79a19b
BLAKE2b-256 checksum
How to use checksums
5ba721eac8b2cfe238382c3926a091c4040226e13b077e3a2c3f0e51ea39f5f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for coldfront-plugin-dfg-fachsystematik 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page