Code development platform for open source projects from the European Union institutions 🔵 EU Login authentication by SMS has been phased out. To see alternatives please check here

Skip to content

PVGIS-native data models

PVGIS relies on a series of custom and rather complex data models to facilitate calculations and derive output. The current semi-automatic mechanism to generate native data models, while functional, isn't the greatest achievement in the context of the application.

So far, the mechanism to generate native data models was :

  1. define structured custom data models in YAML syntax (see https://gitlab.jrc.ec.europa.eu/jrc-projects/pvgis/pvis-be-prototype/-/blob/1da7311c2f17eb6102ffcd15badefb92a56e97d2/pvgisprototype/core/data_model_definitions.yaml)
  2. convert the above definitions into Python dictionaries (see https://gitlab.jrc.ec.europa.eu/jrc-projects/pvgis/pvis-be-prototype/-/blob/1da7311c2f17eb6102ffcd15badefb92a56e97d2/pvgisprototype/core/data_model_definitions.py) via a script (see https://gitlab.jrc.ec.europa.eu/jrc-projects/pvgis/pvis-be-prototype/-/blob/1da7311c2f17eb6102ffcd15badefb92a56e97d2/pvgisprototype/core/convert_yaml_to_py.py)
  3. let the data model factory (https://gitlab.jrc.ec.europa.eu/jrc-projects/pvgis/pvis-be-prototype/-/blob/1da7311c2f17eb6102ffcd15badefb92a56e97d2/pvgisprototype/core/data_model_factory.py#L244) generate the data models in form of advanced Pydantic (data) models (via the https://gitlab.jrc.ec.europa.eu/jrc-projects/pvgis/pvis-be-prototype/-/blob/1da7311c2f17eb6102ffcd15badefb92a56e97d2/pvgisprototype/__init__.py) and add them in the global scope

This is a semi-automatic way to get from a human-friendly YAML-syntax to complex Python-native data structures. There is a lot of room to improve this mechanism, make it simpler to read, understand, review and flexible enough to update (dynamic generation of complex data structures).