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 :
- 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)
- 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)
- 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).