Module transform

The basic entry module. It offers methods to be used right away:

  • run

  • run_batch

geolink2oereb.transform.assign_uuids(unique_dokumente, unique_aemter)[source]

Assigns UUIDs to a list of unique Aemter and Dokumente. It needs the lists to be in predefined order to match the correct objects.

Parameters:
  • unique_dokumente (list of geolink2oereb.lib.interfaces.oerebkrmtrsfr.v2_0.classes.OeREBKRM_V2_0_Dokumente_Dokument) – # noqa: E501 List of unique dokumente where each dokument should receive a UUID.

  • unique_aemter (list of geolink2oereb.lib.interfaces.oerebkrmtrsfr.v2_0.classes.OeREBKRM_V2_0_Amt_Amt) – List of unique aemter where each amt should receive a UUID.

Returns:

tuple containing:
list of geolink2oereb.lib.interfaces.oerebkrmtrsfr.v2_0.classes.OeREBKRM_V2_0_Dokumente_Dokument:

The list of unique Dokumente where each Dokument has a valid UUID assigned.

list of geolink2oereb.lib.interfaces.oerebkrmtrsfr.v2_0.classes.OeREBKRM_V2_0_Amt_Amt):

The list of unique Ämter where each Amt has a valid UUID assigned.

Return type:

(tuple)

geolink2oereb.transform.run(geolink_id, theme_code, pyramid_oereb_config_path, section, source_class_path='geolink2oereb.lib.interfaces.pyramid_oereb.OEREBlexSourceCustom', c2ctemplate_style=False)[source]

Loads documents from one ÖREBlex geolink and transforms it to OeREBKRMtrsfr objects.

Parameters:
  • geolink_id (int) – The lexlink/geolink of the ÖREBlex document to download.

  • theme_code (str) – The theme code which is used to read the ÖREBlex specific config from the pyramid_oereb yml configuration.

  • pyramid_oereb_config_path (str) – The absolute path to the pyramid_oereb yml configuration file.

  • section (str) – The section inside the yml configuration where the pyramid_oereb configuration can be found.

  • source_class_path (str) – The pythonic dotted path to the ÖREBlex Source class definition which is used to construct pyramid_oereb DocumentRecords.

  • c2ctemplate_style (bool) – If the C2C way of parsing a yml should be used or not.

Returns:

list of geolink2oereb.lib.interfaces.oerebkrmtrsfr.v2_0.classes.OeREBKRM_V2_0_Dokumente_Dokument

geolink2oereb.transform.run_batch(geolink_ids, theme_code, pyramid_oereb_config_path, section, source_class_path='geolink2oereb.lib.interfaces.pyramid_oereb.OEREBlexSourceCustom', c2ctemplate_style=False)[source]

Loads documents from multiple ÖREBlex geolinks and transforms it to OeREBKRMtrsfr objects.

Parameters:
  • geolink_id (list of int) – A list of the lexlinks/geolinks of the ÖREBlex document to download.

  • theme_code (str) – The theme code which is used to read the ÖREBlex specific config from the pyramid_oereb yml configuration.

  • pyramid_oereb_config_path (str) – The absolute path to the pyramid_oereb yml configuration file.

  • section (str) – The section inside the yml configuration where the pyramid_oereb configuration can be found.

  • source_class_path (str) – The pythonic dotted path to the ÖREBlex Source class definition which is used to construct pyramid_oereb DocumentRecords.

  • c2ctemplate_style (bool) – If the C2C way of parsing a yml should be used or not.

Returns:

list of geolink2oereb.lib.interfaces.oerebkrmtrsfr.v2_0.classes.OeREBKRM_V2_0_Dokumente_Dokument

geolink2oereb.transform.unify_gathered(gathered)[source]

add docs

Parameters:

gathered (list) –

consists of (tuple):
geolink2oereb.lib.interfaces.oerebkrmtrsfr.v2_0.classes.OeREBKRM_V2_0_Dokumente_Dokument:

The Dokument

geolink2oereb.lib.interfaces.oerebkrmtrsfr.v2_0.classes.OeREBKRM_V2_0_Amt_Amt:

The Amt

Returns:

tuple containing:
list of geolink2oereb.lib.interfaces.oerebkrmtrsfr.v2_0.classes.OeREBKRM_V2_0_Dokumente_Dokument:

The list of unified Dokumente.

list of geolink2oereb.lib.interfaces.oerebkrmtrsfr.v2_0.classes.OeREBKRM_V2_0_Amt_Amt:

The list of unified Ämter.

Return type:

(tuple)