Config and Flow Creation
This page covers the tools that build and consume the workflow config file, the JSON file that determines which journals get harvested and which modules run for each one. (This is a different file from the credentials/secrets config file, config_harvesting.json,see the constants.py documentation for that one.)
The shape of a workflow config file
Every module that follows the standard pipeline convention reads its config via common/configuration.py's get_module_context(). The file has a fixed shape, for example:
{
"Sources": [
{
"source-name": "MDPI",
"standard-schemas": ["Schemadateien2/mdpi_jats_relaxng_schema.rng"],
"standard-metadata-format": "crossref",
"standard-modules": ["crossrefcrawler", "validate_metadata"],
"Journals": [
{
"issn-e": "2673-4532",
"journal-name": "Analytica",
"modules": ["crossrefcrawler", "validate_metadata", "mdpi", "create_bags"]
},
{
"issn-e": "2076-0825",
"journal-name": "Actuators"
}
]
}
]
}
Sources— a list of publishers/data sources. Each has asource-nameand aJournalslist.Journals— a list of journals under that source, each identified byissn-e.modules— an ordered list of module names describing the pipeline this journal goes through, e.g.["crossrefcrawler", "validate_metadata", "mdpi", "create_bags"]. A journal can also omitmodules/schemas/metadata-formatand inherit the source'sstandard-modules/standard-schemas/standard-metadata-formatinstead (see theActuatorsentry above, which has nomodulesof its own).
When a module calls get_module_context(config_path, module_name), the function scans every journal's modules list looking for the calling module's name. If found, it returns one context entry per matching journal, containing:
ISSN— the journal'sissn-eposition— the calling module's index within that journal'smoduleslist (0if it's the first module)previous_module— the module name immediately before it in the list (Noneifpositionis0)schemas/metadata-format— inherited from the journal or its source
A module doesn't know in advance what module came before it, it's entirely determined by this config file, per journal. The same module code can run immediately after crossrefcrawler for one journal, and after validate_metadata for another, purely based on how each journal's modules list is written.
The three things this page covers
- How a workflow config file gets built or extended:
config_file_creation_from_selection_lists, which appends new journals to an existing config file from a spreadsheet of approval decisions. - How a workflow config file gets consumed to run a pipeline: the three
parent_*_flowmodules, each of which chains a fixed sequence of module flows together, all reading from the same config file.
For setting up harvesting for an entirely new journal or publisher, the usual order is: get the journal added to a config file (by hand, or via config_file_creation_from_selection_lists), make sure every module the config file lists is actually implemented and reachable, then either call each module flow individually or use/adapt one of the parent flows to run the whole chain in one go.
config_file_creation_from_selection_lists
Reads a spreadsheet of journals that should be harvested, and adds any not-yet-present journals to an existing workflow config JSON file, thereby automating what would otherwise be manual editing of the config file every time a new journal is approved for harvesting.
This is the tool that actually populates the config files every other module reads, so understanding it clarifies where those "Journals": [...] entries come from in practice.
Working
- Reads an Excel file (
.xlsx) viapandas, expecting at least three columns: Erwerbungsentscheidung (initials of the person who requested the journal be harvested, used as a "has this been decided on" filter), ISSN, and Journal title. - Filters rows down to only those where
Erwerbungsentscheidungcontains at least one letter (via a regex matching any alphabetic character, including German umlauts), i.e. rows that have actually been signed off by someone, not blank/pending entries. - Reads the existing config JSON file, finds (or creates) the entry for the given
source_name(publisher), and appends any journal from the filtered spreadsheet rows that isn't already present (matched by ISSN), assigning it a hardcoded default module list (["crossrefcrawler", "validate_metadata", "mdpi", "dtd_scanner", "toolbox_ids", "create_bags", "archivematica_ingest"]). - Writes the updated config back out, overwriting the same file it read from.
- Caps the number of newly-added journals per run at
max_added = 2(a module-level constant, not a function parameter), existing entries are never removed, so it will not touch journals that are already present, but on a first run against a large spreadsheet, only 2 new journals will be added at a time.
parent_argumentext_flow / parent_crossref_flow / parent_relaxng_scanner_flow
These three modules aren't harvesting modules, but each one is a thin orchestration wrapper that imports several real modules' flow functions and calls them in sequence, one after another, all using the same config file. Rather than running crossrefcrawler, then validate_metadata, then mdpi, etc. as separate manually-triggered Prefect runs, a "parent flow" runs the whole chain (or a chosen subset of it) as one Prefect flow execution, with each called module becoming a Prefect subflow.
The pattern is always the same:
from crossrefcrawler.flow import crossrefcrawler
from validate_metadata.flow import validate_metadata
from mdpi.flow import mdpi
# ... import whichever module flows you need
@flow(name="your_parent_flow_name")
def your_parent_flow(name_of_config_file="your_config.json"):
crossrefcrawler(name_of_config_file)
validate_metadata(name_of_config_file)
mdpi(name_of_config_file)
# ... call each module flow in pipeline order
Each call is a direct Python function call (not .submit() or .delay()), since these are Prefect @flow-decorated functions, calling one from within another automatically registers it as a subflow in Prefect's UI, giving a single run that can be inspected end-to-end, with each stage nested underneath it.
Important: the sequence of calls inside a parent flow's function body must match the modules list each journal declares in the same config file, the parent flow doesn't read or enforce that ordering itself, it's just hardcoded Python calls that happen to match what the config file's modules lists are expected to say. If the two ever drift out of sync (e.g. someone edits a journal's modules list but forgets to update the parent flow, or vice versa), a module might find no matching journals in its context (silently doing nothing for that journal) or run in an unexpected position.
The three specific pipelines
parent_crossref_flow— the broadest one, chainingcrossrefcrawler→validate_metadata→frontiers→copernicus→mdpi_with_images→relaxng_scanner→toolbox_ids→create_bags→archivematica_parallel_ingest→archivematica_dip_export→remove_source_content→dspace_article_ingest→remove_dip→metadata_toolbox_upload→toolbox_conversion.parent_relaxng_scanner_flow— a shorter chain focused on getting content through RelaxNG validation and into Archivematica/DSpace.parent_argumentext_flow— the one built specifically for the ArgumenText delivery pipeline: it starts by callingconfig_file_creation_from_selection_liststo add newly-selected journals to the config file, then runscrossrefcrawler→validate_metadata→mdpi→copernicus, then resolves the ISSN list for the given publishers and hands it toargumentext_ftp_file_transferfor upload. This is the one place in the repo where config-file creation and pipeline orchestration are directly wired together.