How to configure the ProvenanceGenerator¶
This section deals with configuring the ProvenanceGenerator for your use case.
Accepted configurations¶
There are two possible ways to configure the ProvenanceGenerator:
Settings.py: You can define the configuration in your apps
settings.py. On initialization, the ProvenanceGenerator searches for aPROVENANCEdictionary in yoursettings.py, if you don’t explicitly pass in another configuration:Explicitly passing a dictionary: You can define a dictionary anywhere and pass it to the ProvenanceGenerator or create a ProvenanceGeneratorConfiguration beforehand:
config.py¶CONFIG = {...} # or create a ProvenanceGeneratorConfiguration GENERATOR_CONFIG = ProvenanceGeneratorConfiguration(CONFIG)
apps.py¶from config import CONFIG, GENERATOR_CONFIG class YourAppConfig: def ready(self): self.generator_instance = ProvenanceGenerator.get(CONFIG) # or use the already created GENERATOR_CONFIG self.generator_instance = ProvenanceGenerator.get(GENERATOR_CONFIG)
Important
The ProvenanceGenerator implements the Singleton pattern. Using this pattern, there can always be only one instance of a ProvenanceGenerator existing.
Whenever you want to instantiate a ProvenanceGenerator, you need to use the ProvenanceGenerator.get() method to always get the same instance.
This ensures that the ProvenanceGenerator always creates correct relations between provenance records later on.
Configuration sections¶
A valid configuration dictionary must contain at least the following sections, which have to be dictionaries themselves:
ENTITIESNAMESPACESconsisting of aDEFAULTnamespace and at least oneEXTRAnamespaceOUTPUTconsisting of at least one serialization format in sectionSERIALIZE
Additionally it is possible to add the following optional sections:
AGENTS(type: dictionary)PATH(type: string) in theOUTPUTdictionaryGRAPHIC(type: dictionary) in theOUTPUTdictionaryOTHER(type: dictionary)
See also
For further information about each section, please see the respective documents:
ENTITIES- How to record entitiesAGENTS- How to record agentsNAMESPACES- How to set correct namespacesOTHER- Supported extra options
Activities are not defined in the configuration, more information can be found here: How to record activities