eimerdb_helper module

This can be used to create a functioning eimerdb instance for your Altinn3 statistic.

It is intended to be a shortcut for quickly getting an editing application up and running, and serve as an example for those making their own setup.

If you’d rather make your own setup, you are free to do so.

class DatabaseBuilderAltinnEimerdb(database_name, storage_location, periods)

Bases: object

This class provides help for creating an eimerdb datastorage for Altinn3 surveys.

It provides the recommended tables which makes sure your datastructure is compatible with the framework.

To use this class for building your storage follow these steps: 1. Create an instance of the class.

db_builder = DatabaseBuilderAltinnEimerdb(

database_name = “my-database-name”, storage_location = “path/to/storage”, periods = “year” # can be list for more time identifiers

)

  1. Now that we have our builder ready, check that the schemas are correct.

    print(db_builder.schemas)

  2. Assuming that the schemas are correct, you can now build the eimerdb.

    db_builder.build_storage()

  3. Your database is now done! The only thing that remains is to insert your data into the storage.

Note

You can add your own custom ‘skjemadata’ tables if you so wish, just make sure their names start with ‘skjemadata_’. It is possible to use this functionality to create your data storage even if your data are not from Altinn, but you might need to adapt your data.

Parameters:
  • database_name (str)

  • storage_location (str)

  • periods (str | list[str])

build_storage()

Calling this method builds your eimerdb storage with the supplied name at the specified location and creates partitions for the defined periods.

Return type:

None