Skip to content

Commit

Permalink
Merge pull request #510 from OpenEnergyPlatform/bugfix-509-new-table
Browse files Browse the repository at this point in the history
bugfix #509 Create new table `changed_dso_assignment`
Tests are failing since the new tests from production are not used here yet. We will test again before the next release.
  • Loading branch information
FlorianK13 authored Apr 23, 2024
2 parents 463b38e + d10d558 commit ed7125b
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ and the versioning aims to respect [Semantic Versioning](http://semver.org/spec/

## [v0.XX.X] - 202X-XX-XX
### Added
- Add new table `changed_dso_assignment` [#510](https://github.com/OpenEnergyPlatform/open-MaStR/pull/510)
- Add deprecation warning for `MaStRMirror` and `MaStRDownload` [#492](https://github.com/OpenEnergyPlatform/open-MaStR/pull/492)
### Changed
### Removed
- Remove outdated and deprecated dependencies [#506](https://github.com/OpenEnergyPlatform/open-MaStR/pull/506)

## [v0.14.2] Maintenance - 2024-04-10
### Changed
Expand All @@ -22,7 +24,7 @@ and the versioning aims to respect [Semantic Versioning](http://semver.org/spec/
- Implement relevant API WSDL Patchnotes V24.1.128 [#499](https://github.com/OpenEnergyPlatform/open-MaStR/pull/499)
### Removed
- Remove unused Docker File [#501](https://github.com/OpenEnergyPlatform/open-MaStR/pull/501)
- Remove outdated and deprecated dependencies [#506](https://github.com/OpenEnergyPlatform/open-MaStR/pull/506)


## [v0.14.1] Hotfix - 2024-01-17
### Changed
Expand Down
2 changes: 2 additions & 0 deletions docs/dataset.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ After downloading the MaStR, you will find a database with a large number of tab
| Table name | Comments |
|------|------|
| balancing_area | *Related to the energy market* |
| changed_dso_assignment | *Units where the DSO responsibility changed* |
| electricity_consumer | *Only large consumers* |
| gas_consumer | *Only large consumers* |
| gas_producer | |
Expand All @@ -81,6 +82,7 @@ After downloading the MaStR, you will find a database with a large number of tab
| storage_units | |
| kwk | *short for: Combined heat and power (CHP)* |


### MaStR data model
A useful overview of the MaStR data model can be found [here (in german)](https://www.marktstammdatenregister.de/MaStRHilfe/files/webdienst/Objektmodell%20-%20Fachliche%20Ansicht%20V1.2.0.pdf). A translated version using the names from the tables you can find in your local database is presented here:

Expand Down
5 changes: 5 additions & 0 deletions open_mastr/utils/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"permit",
"deleted_units",
"retrofit_units",
"changed_dso_assignment",
]

# Possible values for parameter 'data' with API download method
Expand Down Expand Up @@ -62,6 +63,7 @@
"permit",
"deleted_units",
"retrofit_units",
"changed_dso_assignment",
]

# Possible data types for API download
Expand Down Expand Up @@ -102,6 +104,7 @@
"permit": ["einheitengenehmigung"],
"deleted_units": ["geloeschteunddeaktivierteeinheiten"],
"retrofit_units": ["ertuechtigungen"],
"changed_dso_assignment": ["einheitenaenderungnetzbetreiberzuordnungen"],
}

# Map bulk data to database table names, for csv export
Expand All @@ -120,6 +123,7 @@
"permit": ["permit"],
"deleted_units": ["deleted_units"],
"retrofit_units": ["retrofit_units"],
"changed_dso_assignment": ["changed_dso_assignment"],
}

# used to map the parameter options in open-mastr to the exact table class names in orm.py
Expand Down Expand Up @@ -176,6 +180,7 @@
"permit": "Permit",
"deleted_units": "DeletedUnits",
"retrofit_units": "RetrofitUnits",
"changed_dso_assignment": "ChangedDSOAssignment",
}

UNIT_TYPE_MAP = {
Expand Down
20 changes: 20 additions & 0 deletions open_mastr/utils/orm.py
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,21 @@ class RetrofitUnits(ParentAllTables, Base):
ErtuechtigungIstZulassungspflichtig = Column(Boolean)


class ChangedDSOAssignment(ParentAllTables, Base):
__tablename__ = "changed_dso_assignment"

EinheitMastrNummer = Column(String, primary_key=True)
LokationMastrNummer = Column(String)
NetzanschlusspunktMastrNummer = Column(String)
NetzbetreiberMastrNummerNeu = Column(String)
NetzbetreiberMastrNummerAlt = Column(String)
ArtDerAenderung = Column(String)
RegistrierungsdatumNetzbetreiberzuordnungsaenderung = Column(
DateTime(timezone=True)
)
Netzbetreiberzuordnungsaenderungsdatum = Column(DateTime(timezone=True))


tablename_mapping = {
"anlageneegbiomasse": {
"__name__": BiomassEeg.__tablename__,
Expand Down Expand Up @@ -923,6 +938,11 @@ class RetrofitUnits(ParentAllTables, Base):
"__class__": BalancingArea,
"replace_column_names": None,
},
"einheitenaenderungnetzbetreiberzuordnungen": {
"__name__": ChangedDSOAssignment.__tablename__,
"__class__": ChangedDSOAssignment,
"replace_column_names": None,
},
"einheitengaserzeuger": {
"__name__": GasProducer.__tablename__,
"__class__": GasProducer,
Expand Down
2 changes: 2 additions & 0 deletions open_mastr/xml_download/colums_to_replace.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
# anlagengasspeicher
# anlagenkwk
# bilanzierungsgebiete
# einheitenaenderungnetzbetreiberzuordnungen
"ArtDerAenderung",
# einheitenbiomasse
"Hauptbrennstoff",
"Biomasseart",
Expand Down

0 comments on commit ed7125b

Please # to comment.