Empty value egon fix

* adds support for missing values so that EGON can properly handle these entries
pull/282/head
mpeltriaux 2 years ago
parent 5008bdaaf0
commit a786023e75

@ -178,6 +178,23 @@ class EgonGmlBuilder:
reg_date = self.intervention.legal.registration_date reg_date = self.intervention.legal.registration_date
bind_date = self.intervention.legal.binding_date bind_date = self.intervention.legal.binding_date
# EGON needs special treatment in case of missing data
if reg_office is None:
reg_office_element = {}
else:
reg_office_element = {
"@xlink:href": f"http://register.naturschutz.rlp.de/repository/services/referenzliste/1053/{reg_office.atom_id}",
"#text": reg_office.long_name
}
if cons_office is None:
cons_office_element = {}
else:
cons_office_element = {
"@xlink:href": f"http://register.naturschutz.rlp.de/repository/services/referenzliste/907/{cons_office.atom_id}",
"#text": cons_office.long_name
}
xml_dict = { xml_dict = {
"wfs:FeatureCollection": { "wfs:FeatureCollection": {
"@xmlns:wfs": "http://www.opengis.net/wfs", "@xmlns:wfs": "http://www.opengis.net/wfs",
@ -191,14 +208,8 @@ class EgonGmlBuilder:
"oneo:azEintragungsstelle": self.intervention.responsible.conservation_file_number, "oneo:azEintragungsstelle": self.intervention.responsible.conservation_file_number,
"oneo:azZulassungsstelle": self.intervention.responsible.registration_file_number, "oneo:azZulassungsstelle": self.intervention.responsible.registration_file_number,
"oneo:bemerkungZulassungsstelle": "", "oneo:bemerkungZulassungsstelle": "",
"oneo:eintragungsstelle": { "oneo:eintragungsstelle": cons_office_element,
"@xlink:href": f"http://register.naturschutz.rlp.de/repository/services/referenzliste/907/{cons_office.atom_id if cons_office else ''}", "oneo:zulassungsstelle": reg_office_element,
"#text": cons_office.long_name if cons_office else ""
},
"oneo:zulassungsstelle": {
"@xlink:href": f"http://register.naturschutz.rlp.de/repository/services/referenzliste/1053/{reg_office.atom_id if reg_office else ''}",
"#text": reg_office.long_name if reg_office else ""
},
"oneo:ersatzzahlung": self._float_to_localized_string(self._sum_all_payments()), "oneo:ersatzzahlung": self._float_to_localized_string(self._sum_all_payments()),
"oneo:kompensationsart": { "oneo:kompensationsart": {
"@xlink:href": f"http://register.naturschutz.rlp.de/repository/services/referenzliste/88140/{comp_type_code}", "@xlink:href": f"http://register.naturschutz.rlp.de/repository/services/referenzliste/88140/{comp_type_code}",

Loading…
Cancel
Save