Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds the contactinfo from dedicated role fields #1014

Merged
merged 3 commits into from
Oct 5, 2024

Conversation

pvgenuchten
Copy link
Contributor

adds the contactinfo from dedicated role fields, if the role does not…already exists in contacts

Overview

the ogcapi- records json fully depends on record.contacts, however in some cases records.contacts is not populated (for example from dublin core), then fall back to the explicit role fields 'creator', 'publisher', 'contributor'.

(as per https://github.com/geopython/pycsw/blob/master/CONTRIBUTING.rst#contributions-and-licensing)

  • I'd like to contribute [feature X|bugfix Y|docs|something else] to pycsw. I confirm that my contributions to pycsw will be compatible with the pycsw license guidelines at the time of contribution.
  • I have already previously agreed to the pycsw Contributions and Licensing Guidelines

@@ -1215,6 +1217,13 @@ def record2json(record, url, collection, mode='ogcapi-records'):
})
except Exception as err:
LOGGER.exception(f"failed to parse contact of {record.identifier}: {err}")
for r2 in "creator,publisher,contributor".split(","): # match role-fields with contacts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think record is an object here (not a dict)? Perhaps the below can work?

            for r2 in ['creator', 'publisher', 'contributor']:  # match role-fields with contacts
                if r2 not in roles and getattr(record, r2, None) not in [None, '']:
                    rcnt.append({
                        'organization': getattr(record, r2),
                        'roles': [r2]
                    })

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanx tom, you're right, now fixed and tested

@@ -1651,6 +1651,8 @@ def _parse_dc(context, repos, exml):

md = CswRecord(exml)

print(md)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove print statement.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops

@tomkralidis tomkralidis merged commit c532be3 into geopython:master Oct 5, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants