Skip to content

Commit

Permalink
Add missing DSS classes. Fix #98
Browse files Browse the repository at this point in the history
  • Loading branch information
domi4484 committed Jan 23, 2024
1 parent 56b652f commit e69d63f
Show file tree
Hide file tree
Showing 3 changed files with 219 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,26 @@ def _export_dss(self):
self._export_waste_water_treatment_plant()
self._check_for_stop()

logger.info("Exporting TWW.wwtp_energy_use -> ABWASSER.araenergienutzung")
self._export_wwtp_energy_use()
self._check_for_stop()

logger.info("Exporting TWW.waste_water_treatment -> ABWASSER.abwasserbehandlung")
self._export_waste_water_treatment()
self._check_for_stop()

logger.info("Exporting TWW.sludge_treatment -> ABWASSER.schlammbehandlung")
self._export_sludge_treatment()
self._check_for_stop()

logger.info("Exporting TWW.wwtp_structure -> ABWASSER.arabauwerk")
self._export_wwtp_structure()
self._check_for_stop()

logger.info("Exporting TWW.control_center -> ABWASSER.steuerungszentrale")
self._export_control_center()
self._check_for_stop()

def _export_vsa_kek(self):
logger.info("Exporting TWW.examination -> ABWASSER.untersuchung")
self._export_examination()
Expand Down Expand Up @@ -723,6 +739,79 @@ def _export_waste_water_treatment_plant(self):
logger.info("done")
self.abwasser_session.flush()

def _export_wwtp_energy_use(self):
query = self.tww_session.query(self.model_classes_tww_od.wwtp_energy_use)
if self.filtered:
query = query.filter(
self.model_classes_tww_od.wwtp_energy_use.obj_id.in_(self.subset_ids)
)
for row in query:
araenergienutzung = self.model_classes_interlis.araenergienutzung(
**self.vsa_base_common(row, "araenergienutzung"),
# --- araenergienutzung ---
gasmotor=row.gas_motor,
waermepumpe=row.heat_pump,
bezeichnung=row.identifier,
bemerkung=row.remark,
turbinierung=row.turbining,
abwasserreinigungsanlageref=self.get_tid(row.fk_waste_water_treatment_plant__REL),
)
self.abwasser_session.add(araenergienutzung)
print(".", end="")
logger.info("done")
self.abwasser_session.flush()

def _export_waste_water_treatment(self):
query = self.tww_session.query(self.model_classes_tww_od.waste_water_treatment)
if self.filtered:
query = query.filter(
self.model_classes_tww_od.waste_water_treatment.obj_id.in_(self.subset_ids)
)
for row in query:
abwasserbehandlung = self.model_classes_interlis.abwasserbehandlung(
**self.vsa_base_common(row, "abwasserbehandlung"),
# --- abwasserbehandlung ---
bezeichnung=row.identifier,
art=self.get_vl(row.kind__REL),
bemerkung=row.remark,
abwasserreinigungsanlageref=self.get_tid(row.fk_waste_water_treatment_plant__REL),
)
self.abwasser_session.add(abwasserbehandlung)
print(".", end="")
logger.info("done")
self.abwasser_session.flush()

def _export_sludge_treatment(self):
query = self.tww_session.query(self.model_classes_tww_od.sludge_treatment)
if self.filtered:
query = query.filter(
self.model_classes_tww_od.sludge_treatment.obj_id.in_(self.subset_ids)
)
for row in query:
schlammbehandlung = self.model_classes_interlis.schlammbehandlung(
**self.vsa_base_common(row, "schlammbehandlung"),
# --- schlammbehandlung ---
kompostierung=row.composting,
entwaesserung=row.dehydration,
faulschlammverbrennung=row.digested_sludge_combustion,
trocknung=row.drying,
frischschlammverbrennung=row.fresh_sludge_combustion,
hygienisierung=row.hygenisation,
bezeichnung=row.identifier,
ueberschusschlammvoreindickung=row.predensification_of_excess_sludge,
mischschlammvoreindickung=row.predensification_of_mixed_sludge,
primaerschlammvoreindickung=row.predensification_of_primary_sludge,
bemerkung=row.remark,
stabilisierung=self.get_vl(row.stabilisation__REL),
entwaessertklaerschlammstapelung=row.stacking_of_dehydrated_sludge,
fluessigklaerschlammstapelung=row.stacking_of_liquid_sludge,
abwasserreinigungsanlageref=self.get_tid(row.fk_waste_water_treatment_plant__REL),
)
self.abwasser_session.add(schlammbehandlung)
print(".", end="")
logger.info("done")
self.abwasser_session.flush()

def _export_wwtp_structure(self):
query = self.tww_session.query(self.model_classes_tww_od.wwtp_structure)
if self.filtered:
Expand All @@ -744,6 +833,24 @@ def _export_wwtp_structure(self):
logger.info("done")
self.abwasser_session.flush()

def _export_control_center(self):
query = self.tww_session.query(self.model_classes_tww_od.control_center)
if self.filtered:
query = query.filter(
self.model_classes_tww_od.control_center.obj_id.in_(self.subset_ids)
)
for row in query:
steuerungszentrale = self.model_classes_interlis.steuerungszentrale(
**self.vsa_base_common(row, "steuerungszentrale"),
# --- steuerungszentrale ---
bezeichnung=row.identifier,
lage=row.situation_geometry,
)
self.abwasser_session.add(steuerungszentrale)
print(".", end="")
logger.info("done")
self.abwasser_session.flush()

def _export_examination(self):
query = self.tww_session.query(self.model_classes_tww_od.examination)
if self.filtered:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,116 +84,111 @@ def _tww_import(self, skip_closing_tww_session):
def _import_sia405_abwasser(self):
logger.info("Importing ABWASSER.organisation -> TWW.organisation")
self._import_organisation()
logger.info("Done")
self._check_for_stop()

logger.info("Importing ABWASSER.kanal -> TWW.channel")
self._import_kanal()
logger.info("Done")
self._check_for_stop()

logger.info("Importing ABWASSER.normschacht -> TWW.manhole")
self._import_normschacht()
logger.info("Done")
self._check_for_stop()

logger.info("Importing ABWASSER.einleitstelle -> TWW.discharge_point")
self._import_einleitstelle()
logger.info("Done")
self._check_for_stop()

logger.info("Importing ABWASSER.spezialbauwerk -> TWW.special_structure")
self._import_spezialbauwerk()
logger.info("Done")
self._check_for_stop()

logger.info("Importing ABWASSER.versickerungsanlage -> TWW.infiltration_installation")
self._import_versickerungsanlage()
logger.info("Done")
self._check_for_stop()

logger.info("Importing ABWASSER.rohrprofil -> TWW.pipe_profile")
self._import_rohrprofil()
logger.info("Done")
self._check_for_stop()

logger.info("Importing ABWASSER.abwasserknoten -> TWW.wastewater_node")
self._import_abwasserknoten()
logger.info("Done")
self._check_for_stop()

logger.info("Importing ABWASSER.haltung -> TWW.reach")
self._import_haltung()
logger.info("Done")
self._check_for_stop()

logger.info("Importing ABWASSER.haltungspunkt -> TWW.reach_point")
self._import_haltungspunkt()
logger.info("Done")
self._check_for_stop()

logger.info("Importing ABWASSER.trockenwetterfallrohr -> TWW.dryweather_downspout")
self._import_trockenwetterfallrohr()
logger.info("Done")
self._check_for_stop()

logger.info("Importing ABWASSER.einstiegshilfe -> TWW.access_aid")
self._import_einstiegshilfe()
logger.info("Done")
self._check_for_stop()

logger.info("Importing ABWASSER.trockenwetterrinne -> TWW.dryweather_flume")
self._import_trockenwetterrinne()
logger.info("Done")
self._check_for_stop()

logger.info("Importing ABWASSER.deckel -> TWW.cover")
self._import_deckel()
logger.info("Done")
self._check_for_stop()

logger.info("Importing ABWASSER.bankett -> TWW.benching")
self._import_bankett()
logger.info("Done")
self._check_for_stop()

def _import_dss(self):
logger.info(
"Importing ABWASSER.abwasserreinigungsanlage -> TWW.waste_water_treatment_plant"
)
self._import_abwasserreinigungsanlage()
logger.info("Done")
self._check_for_stop()

logger.info("Importing ABWASSER.araenergienutzung -> TWW.wwtp_energy_use")
self._import_araenergienutzung()
self._check_for_stop()

logger.info("Importing ABWASSER.abwasserbehandlung -> TWW.waste_water_treatment")
self._import_abwasserbehandlung()
self._check_for_stop()

logger.info("Importing ABWASSER.schlammbehandlung -> TWW.sludge_treatment")
self._import_schlammbehandlung()
self._check_for_stop()

logger.info("Importing ABWASSER.arabauwerk -> TWW.wwtp_structure")
self._import_arabauwerk()
logger.info("Done")
self._check_for_stop()

logger.info("Importing ABWASSER.steuerungszentrale -> TWW.control_center")
self._import_steuerungszentrale()
self._check_for_stop()

def _import_vsa_kek(self):
logger.info("Importing ABWASSER.untersuchung -> TWW.examination")
self._import_untersuchung()
logger.info("Done")
self._check_for_stop()

logger.info("Importing ABWASSER.normschachtschaden -> TWW.damage_manhole")
self._import_normschachtschaden()
logger.info("Done")
self._check_for_stop()

logger.info("Importing ABWASSER.kanalschaden -> TWW.damage_channel")
self._import_kanalschaden()
logger.info("Done")
self._check_for_stop()

logger.info("Importing ABWASSER.datentraeger -> TWW.data_media")
self._import_datentraeger()
logger.info("Done")
self._check_for_stop()

logger.info("Importing ABWASSER.datei -> TWW.file")
self._import_datei()
logger.info("Done")
self._check_for_stop()

def close_sessions(self, skip_closing_tww_session=False):
# Calling the precommit callback if provided, allowing to filter before final import
Expand Down Expand Up @@ -539,6 +534,65 @@ def _import_abwasserreinigungsanlage(self):
self.session_tww.add(waste_water_treatment_plant)
print(".", end="")

def _import_araenergienutzung(self):
for row in self.session_interlis.query(self.model_classes_interlis.araenergienutzung):
wwtp_energy_use = self.create_or_update(
self.model_classes_tww_od.wwtp_energy_use,
**self.base_common(row),
# --- wwtp_energy_use ---
gas_motor=row.gasmotor,
heat_pump=row.waermepumpe,
identifier=row.bezeichnung,
remark=row.bemerkung,
turbining=row.turbinierung,
fk_waste_water_treatment_plant=self.get_pk(row.abwasserreinigungsanlageref__REL),
)
self.session_tww.add(wwtp_energy_use)
print(".", end="")

def _import_abwasserbehandlung(self):
for row in self.session_interlis.query(self.model_classes_interlis.abwasserbehandlung):
waste_water_treatment = self.create_or_update(
self.model_classes_tww_od.waste_water_treatment,
**self.base_common(row),
# --- waste_water_treatment ---
identifier=row.bezeichnung,
kind=self.get_vl_code(
self.model_classes_tww_vl.waste_water_treatment_kind, row.art
),
remark=row.bemerkung,
fk_waste_water_treatment_plant=self.get_pk(row.abwasserreinigungsanlageref__REL),
)
self.session_tww.add(waste_water_treatment)
print(".", end="")

def _import_schlammbehandlung(self):
for row in self.session_interlis.query(self.model_classes_interlis.schlammbehandlung):
sludge_treatment = self.create_or_update(
self.model_classes_tww_od.sludge_treatment,
**self.base_common(row),
# --- sludge_treatment ---
composting=row.kompostierung,
dehydration=row.entwaesserung,
digested_sludge_combustion=row.faulschlammverbrennung,
drying=row.trocknung,
fresh_sludge_combustion=row.frischschlammverbrennung,
hygenisation=row.hygienisierung,
identifier=row.bezeichnung,
predensification_of_excess_sludge=row.ueberschusschlammvoreindickung,
predensification_of_mixed_sludge=row.mischschlammvoreindickung,
predensification_of_primary_sludge=row.primaerschlammvoreindickung,
remark=row.bemerkung,
stabilisation=self.get_vl_code(
self.model_classes_tww_vl.sludge_treatment_stabilisation, row.stabilisierung
),
stacking_of_dehydrated_sludge=row.entwaessertklaerschlammstapelung,
stacking_of_liquid_sludge=row.fluessigklaerschlammstapelung,
fk_waste_water_treatment_plant=self.get_pk(row.abwasserreinigungsanlageref__REL),
)
self.session_tww.add(sludge_treatment)
print(".", end="")

def _import_arabauwerk(self):
for row in self.session_interlis.query(self.model_classes_interlis.arabauwerk):
wwtp_structure = self.create_or_update(
Expand All @@ -553,6 +607,18 @@ def _import_arabauwerk(self):
self.session_tww.add(wwtp_structure)
print(".", end="")

def _import_steuerungszentrale(self):
for row in self.session_interlis.query(self.model_classes_interlis.steuerungszentrale):
control_center = self.create_or_update(
self.model_classes_tww_od.control_center,
**self.base_common(row),
# --- control_center ---
identifier=row.bezeichnung,
situation_geometry=row.lage,
)
self.session_tww.add(control_center)
print(".", end="")

def _import_rohrprofil(self):
for row in self.session_interlis.query(self.model_classes_interlis.rohrprofil):
pipe_profile = self.create_or_update(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,32 @@ class abwasserreinigungsanlage(ModelInterlisSia405Abwasser.vsa_baseclass):

ModelInterlisDss.abwasserreinigungsanlage = abwasserreinigungsanlage

class araenergienutzung(ModelInterlisSia405Abwasser.vsa_baseclass):
__tablename__ = "araenergienutzung"
__table_args__ = {"schema": config.ABWASSER_SCHEMA}

ModelInterlisDss.araenergienutzung = araenergienutzung

class abwasserbehandlung(ModelInterlisSia405Abwasser.vsa_baseclass):
__tablename__ = "abwasserbehandlung"
__table_args__ = {"schema": config.ABWASSER_SCHEMA}

ModelInterlisDss.abwasserbehandlung = abwasserbehandlung

class schlammbehandlung(ModelInterlisSia405Abwasser.vsa_baseclass):
__tablename__ = "schlammbehandlung"
__table_args__ = {"schema": config.ABWASSER_SCHEMA}

ModelInterlisDss.schlammbehandlung = schlammbehandlung

class arabauwerk(ModelInterlisSia405Abwasser.abwasserbauwerk):
__tablename__ = "arabauwerk"
__table_args__ = {"schema": config.ABWASSER_SCHEMA}

ModelInterlisDss.arabauwerk = arabauwerk

class steuerungszentrale(ModelInterlisSia405Abwasser.vsa_baseclass):
__tablename__ = "steuerungszentrale"
__table_args__ = {"schema": config.ABWASSER_SCHEMA}

ModelInterlisDss.steuerungszentrale = steuerungszentrale

0 comments on commit e69d63f

Please sign in to comment.