Code Duplication    Length = 26-29 lines in 5 locations

src/egon/data/datasets/power_plants/mastr_db_classes.py 5 locations

@@ 269-297 (lines=29) @@
266
    geom = Column(Geometry("POINT", 4326), index=True, nullable=True)
267
268
269
class EgonPowerPlantsStorage(Base):
270
    __tablename__ = "egon_power_plants_storage"
271
    __table_args__ = {"schema": "supply"}
272
273
    id = Column(Integer, Sequence("pp_storage_seq"), primary_key=True)
274
    bus_id = Column(Integer, nullable=True)  # Grid district id
275
    gens_id = Column(String, nullable=True)  # EinheitMastrNummer
276
277
    status = Column(String, nullable=True)  # EinheitBetriebsstatus
278
    commissioning_date = Column(DateTime, nullable=True)  # Inbetriebnahmedatum
279
    postcode = Column(String(5), nullable=True)  # Postleitzahl
280
    city = Column(String(50), nullable=True)  # Ort
281
    municipality = Column(String, nullable=True)  # Gemeinde
282
    federal_state = Column(String(31), nullable=True)  # Bundesland
283
    zip_and_municipality = Column(String, nullable=True)
284
285
    carrier = Column(String)  # Energietraeger
286
    technology = Column(String)  # Technologie
287
    battery_type = Column(String)  # Batterietechnologie
288
    pump_storage_type = Column(String)  # Pumpspeichertechnologie
289
290
    capacity = Column(Float, nullable=True)  # Nettonennleistung
291
    th_capacity = Column(Float, nullable=True)  # ThermischeNutzleistung
292
    feedin_type = Column(String(47), nullable=True)  # Einspeisungsart
293
    voltage_level = Column(Integer, nullable=True)
294
    voltage_level_inferred = Column(Boolean, nullable=True)
295
296
    geometry_geocoded = Column(Boolean)
297
    geom = Column(Geometry("POINT", 4326), index=True, nullable=True)
298
299
300
def add_metadata():
@@ 180-208 (lines=29) @@
177
    geom = Column(Geometry("POINT", 4326), index=True, nullable=True)
178
179
180
class EgonPowerPlantsCombustion(Base):
181
    __tablename__ = "egon_power_plants_combustion"
182
    __table_args__ = {"schema": "supply"}
183
184
    id = Column(Integer, Sequence("pp_combustion_seq"), primary_key=True)
185
    bus_id = Column(Integer, nullable=True)  # Grid district id
186
    gens_id = Column(String, nullable=True)  # EinheitMastrNummer
187
188
    status = Column(String, nullable=True)  # EinheitBetriebsstatus
189
    commissioning_date = Column(DateTime, nullable=True)  # Inbetriebnahmedatum
190
    postcode = Column(String(5), nullable=True)  # Postleitzahl
191
    city = Column(String(50), nullable=True)  # Ort
192
    municipality = Column(String, nullable=True)  # Gemeinde
193
    federal_state = Column(String(31), nullable=True)  # Bundesland
194
    zip_and_municipality = Column(String, nullable=True)
195
196
    carrier = Column(String)  # Energietraeger
197
    main_fuel = Column(String)  # Hauptbrennstoff
198
    other_main_fuel = Column(String)  # WeitererHauptbrennstoff
199
    technology = Column(String)  # Technologie
200
201
    capacity = Column(Float, nullable=True)  # Nettonennleistung
202
    th_capacity = Column(Float, nullable=True)  # ThermischeNutzleistung
203
    feedin_type = Column(String(47), nullable=True)  # Einspeisungsart
204
    voltage_level = Column(Integer, nullable=True)
205
    voltage_level_inferred = Column(Boolean, nullable=True)
206
207
    geometry_geocoded = Column(Boolean)
208
    geom = Column(Geometry("POINT", 4326), index=True, nullable=True)
209
210
211
class EgonPowerPlantsGsgk(Base):
@@ 240-266 (lines=27) @@
237
    geom = Column(Geometry("POINT", 4326), index=True, nullable=True)
238
239
240
class EgonPowerPlantsNuclear(Base):
241
    __tablename__ = "egon_power_plants_nuclear"
242
    __table_args__ = {"schema": "supply"}
243
244
    id = Column(Integer, Sequence("pp_nuclear_seq"), primary_key=True)
245
    bus_id = Column(Integer, nullable=True)  # Grid district id
246
    gens_id = Column(String, nullable=True)  # EinheitMastrNummer
247
248
    status = Column(String, nullable=True)  # EinheitBetriebsstatus
249
    commissioning_date = Column(DateTime, nullable=True)  # Inbetriebnahmedatum
250
    postcode = Column(String(5), nullable=True)  # Postleitzahl
251
    city = Column(String(50), nullable=True)  # Ort
252
    municipality = Column(String, nullable=True)  # Gemeinde
253
    federal_state = Column(String(31), nullable=True)  # Bundesland
254
    zip_and_municipality = Column(String, nullable=True)
255
256
    carrier = Column(String)  # Energietraeger
257
    technology = Column(String)  # Technologie
258
259
    capacity = Column(Float, nullable=True)  # Nettonennleistung
260
    th_capacity = Column(Float, nullable=True)  # ThermischeNutzleistung
261
    feedin_type = Column(String(47), nullable=True)  # Einspeisungsart
262
    voltage_level = Column(Integer, nullable=True)
263
    voltage_level_inferred = Column(Boolean, nullable=True)
264
265
    geometry_geocoded = Column(Boolean)
266
    geom = Column(Geometry("POINT", 4326), index=True, nullable=True)
267
268
269
class EgonPowerPlantsStorage(Base):
@@ 211-237 (lines=27) @@
208
    geom = Column(Geometry("POINT", 4326), index=True, nullable=True)
209
210
211
class EgonPowerPlantsGsgk(Base):
212
    __tablename__ = "egon_power_plants_gsgk"
213
    __table_args__ = {"schema": "supply"}
214
215
    id = Column(Integer, Sequence("pp_gsgk_seq"), primary_key=True)
216
    bus_id = Column(Integer, nullable=True)  # Grid district id
217
    gens_id = Column(String, nullable=True)  # EinheitMastrNummer
218
219
    status = Column(String, nullable=True)  # EinheitBetriebsstatus
220
    commissioning_date = Column(DateTime, nullable=True)  # Inbetriebnahmedatum
221
    postcode = Column(String(5), nullable=True)  # Postleitzahl
222
    city = Column(String(50), nullable=True)  # Ort
223
    municipality = Column(String, nullable=True)  # Gemeinde
224
    federal_state = Column(String(31), nullable=True)  # Bundesland
225
    zip_and_municipality = Column(String, nullable=True)
226
227
    carrier = Column(String)  # Energietraeger
228
    technology = Column(String)  # Technologie
229
230
    capacity = Column(Float, nullable=True)  # Nettonennleistung
231
    th_capacity = Column(Float, nullable=True)  # ThermischeNutzleistung
232
    feedin_type = Column(String(47), nullable=True)  # Einspeisungsart
233
    voltage_level = Column(Integer, nullable=True)
234
    voltage_level_inferred = Column(Boolean, nullable=True)
235
236
    geometry_geocoded = Column(Boolean)
237
    geom = Column(Geometry("POINT", 4326), index=True, nullable=True)
238
239
240
class EgonPowerPlantsNuclear(Base):
@@ 152-177 (lines=26) @@
149
    geom = Column(Geometry("POINT", 4326), index=True, nullable=True)
150
151
152
class EgonPowerPlantsHydro(Base):
153
    __tablename__ = "egon_power_plants_hydro"
154
    __table_args__ = {"schema": "supply"}
155
156
    id = Column(Integer, Sequence("pp_hydro_seq"), primary_key=True)
157
    bus_id = Column(Integer, nullable=True)  # Grid district id
158
    gens_id = Column(String, nullable=True)  # EinheitMastrNummer
159
160
    status = Column(String, nullable=True)  # EinheitBetriebsstatus
161
    commissioning_date = Column(DateTime, nullable=True)  # Inbetriebnahmedatum
162
    postcode = Column(String(5), nullable=True)  # Postleitzahl
163
    city = Column(String(50), nullable=True)  # Ort
164
    municipality = Column(String, nullable=True)  # Gemeinde
165
    federal_state = Column(String(31), nullable=True)  # Bundesland
166
    zip_and_municipality = Column(String, nullable=True)
167
168
    plant_type = Column(String(39), nullable=True)  # ArtDerWasserkraftanlage
169
    water_origin = Column(String(20), nullable=True)  # ArtDesZuflusses
170
171
    capacity = Column(Float, nullable=True)  # Nettonennleistung
172
    feedin_type = Column(String(47), nullable=True)  # Einspeisungsart
173
    voltage_level = Column(Integer, nullable=True)
174
    voltage_level_inferred = Column(Boolean, nullable=True)
175
176
    geometry_geocoded = Column(Boolean)
177
    geom = Column(Geometry("POINT", 4326), index=True, nullable=True)
178
179
180
class EgonPowerPlantsCombustion(Base):