Skip to content
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: 2 additions & 0 deletions pycsw/core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ def setup_db(database, table, home, create_sfsql_tables=True, create_plpythonu_f
# distribution
# links: JSON list of dicts with properties: name, description, protocol, url
Column('links', Text, index=True),
# contacts: JSON list of dicts with owslib contact properties, name, organization, email, role, etc.
Column('contacts', Text, index=True),
)

# add extra columns that may have been passed via extra_columns
Expand Down
2 changes: 2 additions & 0 deletions pycsw/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ def __init__(self, prefix='csw30'):
'pycsw:Bands': 'bands',
# links: list of dicts with properties: name, description, protocol, url
'pycsw:Links': 'links',
# contacts: list of dicts with properties: name, organization, address, postcode, city, region, country, email, phone, fax, onlineresource, position, role
'pycsw:Contacts': 'contacts',
}
}

Expand Down
1 change: 1 addition & 0 deletions pycsw/core/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -1383,6 +1383,7 @@ def _parse_iso(context, repos, exml):
len(md.identification.contact) > 0):
all_orgs = set([item.organization for item in md.identification.contact if hasattr(item, 'organization') and item.organization is not None])
_set(context, recobj, 'pycsw:OrganizationName', ';'.join(all_orgs))
_set(context, recobj, 'pycsw:Contacts', json.dumps(md.identification.contact, default=lambda o: o.__dict__))

if len(md.identification.securityconstraints) > 0:
_set(context, recobj, 'pycsw:SecurityConstraints',
Expand Down
36 changes: 36 additions & 0 deletions pycsw/ogc/api/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,18 @@ def record2json(record, url, collection, stac_item=False):
'assets': {}
}

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

if record.otherconstraints:
if isinstance(record.otherconstraints, str):
record.otherconstraints = [record.otherconstraints]
record_dict['properties']['license'] = ", ".join(record.otherconstraints)

if stac_item:
record_dict['stac_version'] = '1.0.0'
record_dict['collection'] = 'metadata:main'
Expand Down Expand Up @@ -998,6 +1010,30 @@ def record2json(record, url, collection, stac_item=False):

if record.keywords:
record_dict['properties']['keywords'] = [x for x in record.keywords.split(',')]

if record.contacts:
rcnt = []
for cnt in json.loads(record.contacts):
rcnt.append({
'name': ' - '.join(filter(None,[cnt['name'], cnt['organization']])),
'positionName': cnt['position'],
'roles': [
{'name':cnt['role']}
],
'contactInfo': {
'phone': {'work': cnt['phone']},
'email': {'work':cnt['email']},
'address': {'work': {
'deliveryPoint': cnt['address'],
'city': cnt['city'],
'administrativeArea': cnt['region'],
'postalCode': cnt['postcode'],
'country': cnt['country'],
}},
'url': cnt['onlineresource']
}
})
record_dict['properties']['providers'] = rcnt

if record.links:
rdl = record_dict['links']
Expand Down
43 changes: 32 additions & 11 deletions pycsw/ogc/api/templates/item.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,41 @@ <h2>{{ data['id'] }}</h2>
</td>
{% elif key == 'themes' %}
<td>
<ul>
{% for concept in value['concepts'] %}
<li>{{ concept }}</li>
{% for theme in value %}
<b>{{ theme['scheme'] }}</b>
<ul>
{% for concept in theme['concepts'] %}
<li>{{ concept }}</li>
{% endfor %}
</ul>
{% endfor %}
</ul>
</td>
{% elif key == 'externalIds' %}
<td>
<ul>
{% for id in value %}
<li>{{ id['scheme'] | urlize }} {{ id['value'] | urlize }}</li>
{% endfor %}
</ul>
</td>
<td>
<ul>
{% for id in value %}
<li>{{ id['scheme'] | urlize }} {{ id['value'] | urlize }}</li>
{% endfor %}
</ul>
</td>
{% elif key == 'providers' %}
<td>
{% for cnt in data['properties']['providers'] %}
{{ cnt['name'] }} ({{ cnt.get('roles',[{}])[0].get('name','') }}/{{ cnt['positionName'] }})<br/>
{% for k,e in cnt['contactInfo'].get('phone',{}).items() %}
{% if e %}{{ k }}: {{ e }}<br/>{% endif %}
{% endfor %}
{% for k,e in cnt['contactInfo'].get('email',{}).items() %}
{% if e not in [None,''] %}{{ k }}: {{ e | urlize }}<br/>{% endif %}
{% endfor %}
{% for k,e in cnt['contactInfo'].get('address',{}).items() %}
{{ k }}: {% for a,b in e.items() %}{% if b %}{{ b }}, {% endif %}{% endfor %}<br/>
{% endfor %}
{% if cnt['contactInfo']['url'] %}
<a href="{{ cnt['contactInfo']['url'] | urlize }}">{{ cnt['url'] }}</a>
{% endif %}
{% endfor %}
</td>
{% else %}
<td>{{ value }}</td>
{% endif %}
Expand Down
Binary file not shown.
Binary file modified tests/functionaltests/suites/cite/data/cite.db
Binary file not shown.