randonneur.templates

Attributes

LICENSES

MAPPINGS

ROLES

Functions

create_excel_template(→ pathlib.Path)

Create an Excel template with optionally some data for a new matching data file.

read_excel_template(→ randonneur.Datapackage)

Module Contents

randonneur.templates.create_excel_template(data: List[dict], filepath: pathlib.Path, replace_existing: bool = False) pathlib.Path[source]

Create an Excel template with optionally some data for a new matching data file.

data should be a list of dictionaries like {‘source’: {}, ‘target’: {}}. The keys and values in these sub-dictionaries should be strings, or castable to strings in a way that can be reversed. This function doesn’t do any type conversion or other data handling.

filepath should be the complete filepath of the file to be created, including directory and suffix.

replace_existing: Flag on whether to overwrite filepath if it exists.

Returns the filepath of the created file.

randonneur.templates.read_excel_template(filepath: pathlib.Path, worksheet: str = 'Matching', license_mapping: dict | None = None, field_mapping: dict | None = None) randonneur.Datapackage[source]
randonneur.templates.LICENSES = ['CC-BY-4.0', 'CC-BY-NC-SA-4.0', 'CC-BY-ND-4.0', 'CC-BY-SA-4.0', 'CC0-1.0', 'CDL-1.0', 'MIT',...[source]
randonneur.templates.MAPPINGS = ['SIMAPRO_CSV', 'ECOSPOLD2', 'ECOSPOLD1_BIO', 'ECOSPOLD2_BIO', 'ECOSPOLD2_BIO_FLOWMAPPER', 'CUSTOM'][source]
randonneur.templates.ROLES = ['author', 'publisher', 'maintainer', 'wrangler', 'contributor'][source]