Skip to content

Commit

Permalink
improve OARec contact serialization (#210)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkralidis committed Feb 19, 2023
1 parent 7398dde commit 07622c1
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions pygeometa/schemas/ogcapi_records/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,16 +244,20 @@ def generate_responsible_party(self, contact: dict,
country = get_charstring(contact.get('country'),
self.lang1, self.lang2)

rp = {
'name': organization_name[0],
'individual': contact['individualname'],
rp = {}

if organization_name[0] == contact.get('organization'):
LOGGER.debug('Contact name is organization')
rp['name'] = organization_name[0]

rp.update({
'positionName': position_name[0],
'contactInfo': {
'phone': {
'office': contact['phone']
'office': contact.get('phone')
},
'email': {
'office': contact['fax']
'office': contact.get('email')
},
'address': {
'office': {
Expand All @@ -262,18 +266,15 @@ def generate_responsible_party(self, contact: dict,
'administrativeArea': administrative_area[0],
'postalCode': postalcode[0],
'country': country[0]
},
'onlineResource': {
'href': contact['url']
},
}
},
'hoursOfService': hours_of_service[0],
'contactInstructions': contact_instructions[0]
},
'roles': [{
'name': role
}]
}
})

if 'url' in contact:
rp['contactInfo']['url'] = {
Expand Down

0 comments on commit 07622c1

Please sign in to comment.