From fc6146ced72fbc3a5915498df6f30adc766c23c0 Mon Sep 17 00:00:00 2001 From: Tom Kralidis Date: Thu, 12 Oct 2023 23:01:26 -0400 Subject: [PATCH] fix OARec contact object --- pygeometa/schemas/ogcapi_records/__init__.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pygeometa/schemas/ogcapi_records/__init__.py b/pygeometa/schemas/ogcapi_records/__init__.py index 3abd77a..361936d 100644 --- a/pygeometa/schemas/ogcapi_records/__init__.py +++ b/pygeometa/schemas/ogcapi_records/__init__.py @@ -262,6 +262,9 @@ def generate_party(self, contact: dict, organization_name = get_charstring(contact.get('organization'), self.lang1, self.lang2) + individual_name = get_charstring(contact.get('individualname'), + self.lang1, self.lang2) + position_name = get_charstring(contact.get('positionname'), self.lang1, self.lang2) @@ -290,14 +293,14 @@ def generate_party(self, contact: dict, 'roles': [] } - if organization_name[0] == contact.get('organization'): - LOGGER.debug('Contact name is organization') - rp['name'] = organization_name[0] - + if organization_name[0] is not None: + rp['organization'] = organization_name[0] + if individual_name[0] is not None: + rp['name'] = individual_name[0] if position_name[0] is not None: - rp['positionName'] = position_name[0] + rp['position'] = position_name[0] if hours_of_service[0] is not None: - rp['positionName'] = hours_of_service[0] + rp['hoursOfService'] = hours_of_service[0] if contact_instructions[0] is not None: rp['contactInstructions'] = contact_instructions[0] @@ -319,6 +322,7 @@ def generate_party(self, contact: dict, phone = phone.replace('+0', '+').replace(' ', '') rp['phones'] = [{'value': phone}] + if contact.get('email') is not None: rp['emails'] = [{'value': contact.get('email')}]