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

Oarec themes keywords #1024

Merged
merged 2 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pycsw/core/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -1727,7 +1727,7 @@ def _parse_json_record(context, repos, record):

recobj = None

if 'http://www.opengis.net/spec/ogcapi-records-1/1.0/req/record-core' in record.get('conformsTo', []):
if 'conformsTo' in record:
LOGGER.debug('Parsing OGC API - Records record model')
recobj = _parse_oarec_record(context, repos, record)
elif 'stac_version' in record:
Expand Down
13 changes: 9 additions & 4 deletions pycsw/ogc/api/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -1147,9 +1147,14 @@ def record2json(record, url, collection, mode='ogcapi-records'):

# todo; for keywords with a scheme use the theme property
if record.topicategory:
themes = []
themes.append({'concepts': [record.topicategory],
'scheme': 'https://standards.iso.org/iso/19139/resources/gmxCodelists.xml#MD_TopicCategoryCode'})
themes = [{
'concepts': [],
'scheme': 'https://standards.iso.org/iso/19139/resources/gmxCodelists.xml#MD_TopicCategoryCode'
}]

for rtp in record.topicategory:
themes['concepts'].append({'id': rtp})

record_dict['properties']['themes'] = themes

if record.otherconstraints:
Expand Down Expand Up @@ -1229,7 +1234,7 @@ def record2json(record, url, collection, mode='ogcapi-records'):
try:
ogcapi_themes.append({
'scheme': theme['thesaurus'].get('url', theme['thesaurus'].get('title', '')),
'concepts': [c for c in theme.get('keywords_object', []) if c not in [None, '']]
'concepts': [{'id': c} for c in theme.get('keywords_object', []) if c not in [None, '']]
})
except Exception as err:
LOGGER.exception(f"failed to parse theme of {record.identifier}: {err}")
Expand Down
Loading