wmo-im / pywcmp

pywcmp provides validation and quality assessment capabilities for the WMO WIS Core Metadata Profile (WCMP)
https://community.wmo.int/activity-areas/wis
Other
9 stars 8 forks source link

fix contact role checking #105

Closed tomkralidis closed 10 months ago

tomkralidis commented 10 months ago

This PR fixes the check for contact roles against the WCMP2 codelists.

tomkralidis commented 10 months ago

Yes, we support 1..n contacts. For contact types, we are bound to STAC roles: https://github.com/wmo-im/wcmp2-codelists/blob/main/codelists/contact-role.csv

antje-s commented 10 months ago

My idea was whether we should leave the role information more open and only require specific roles from us as a minimum:

so instead of:

for c in self.record['properties']['contacts']:
            for role in c['roles']:
                if role not in contact_role_types:
                    status['code'] = 'FAILED'
                    status['message'] = f'Invalid role {role}'
                    break

e.g.

 producer_role_included = False
 for c in self.record['properties']['contacts']:
            for role in c['roles']:
                if "producer" in role:
                    producer_role_included = True
 if producer_role_included is False:
        status['code'] = 'FAILED'
        status['message'] = f'Missing producer role in contacts'

But maybe that makes it too complicated for maintenance/customization for additional roles and then we need to clarify which roles should always be included

tomkralidis commented 10 months ago

WCMP2 Requirement 12C specifies to use the controlled vocabulary.

In the context of this PR, the code is doing what the specification requires. If we wish to discuss further, we should cover as a WCMP2 item proper.

antje-s commented 10 months ago

ok