Skip to content

Commit fc6146c

Browse files
committed
fix OARec contact object
1 parent d3e3d14 commit fc6146c

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

pygeometa/schemas/ogcapi_records/__init__.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,9 @@ def generate_party(self, contact: dict,
262262
organization_name = get_charstring(contact.get('organization'),
263263
self.lang1, self.lang2)
264264

265+
individual_name = get_charstring(contact.get('individualname'),
266+
self.lang1, self.lang2)
267+
265268
position_name = get_charstring(contact.get('positionname'),
266269
self.lang1, self.lang2)
267270

@@ -290,14 +293,14 @@ def generate_party(self, contact: dict,
290293
'roles': []
291294
}
292295

293-
if organization_name[0] == contact.get('organization'):
294-
LOGGER.debug('Contact name is organization')
295-
rp['name'] = organization_name[0]
296-
296+
if organization_name[0] is not None:
297+
rp['organization'] = organization_name[0]
298+
if individual_name[0] is not None:
299+
rp['name'] = individual_name[0]
297300
if position_name[0] is not None:
298-
rp['positionName'] = position_name[0]
301+
rp['position'] = position_name[0]
299302
if hours_of_service[0] is not None:
300-
rp['positionName'] = hours_of_service[0]
303+
rp['hoursOfService'] = hours_of_service[0]
301304
if contact_instructions[0] is not None:
302305
rp['contactInstructions'] = contact_instructions[0]
303306

@@ -319,6 +322,7 @@ def generate_party(self, contact: dict,
319322
phone = phone.replace('+0', '+').replace(' ', '')
320323

321324
rp['phones'] = [{'value': phone}]
325+
322326
if contact.get('email') is not None:
323327
rp['emails'] = [{'value': contact.get('email')}]
324328

0 commit comments

Comments
 (0)