Architecture overview

Document specification

To define how a document will be generated a document specification has to be created. This specification is a directory with the necessary information to generate documents; it includes templates, source files, configuration files or data files among others (more information on Document specification).

_images/report-specification-files.svg

The content of the generated documents can be split up and defined in fragments, each having a corresponding template (describing its visualization) and source file (describing its data processing).

_images/source-templates.svg

These directory structures fully represent a document generation workflow and they can be easily moved, extended or distributed without any unnecessary dependencies. Furthermore, a file structure is a code-friendly environment, being able to seamlessly debug or use version control like any other software project, for example.

Document generation

_images/report-generation.svg

Once a document specification is made, a document can be generated: first, a document parameter is provided as a dictionary. This parameter is augmented with additional information if necessary and, along with the document metadata, each fragment’s context is generated (see below). These fragments are merged into a full context that is used to render the templates (using one of the available template rendering plugins, see Template renderers) to create the document. Optionally, some postprocessing plugins (see Postprocessors) can be applied to the document.

Fragment generation

_images/fragment-generation.svg

Each fragment follows a three-step process. First, the fragment source file is inspected (see Source parsers) for possible metadata to be added or overriden into the document metadata. Then, this metadata and the document parameter is used to fetch the required data from one of the available sources implemented via plugins (see Data fetchers). Finally, this data along with the document parameter and the metadata is used to generate a dictionary (with the same source parser plugin) that will be returned as the context to fill the corresponding template in the template rendering stage (see above).