Skip to content

Commit

Permalink
entities: add places
Browse files Browse the repository at this point in the history
Co-Authored-by: Peter Weber <[email protected]>
  • Loading branch information
rerowep committed Sep 12, 2023
1 parent ee7e3db commit 0f24697
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
9 changes: 7 additions & 2 deletions rero_ils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3039,13 +3039,18 @@ def _(x):
'filters': [
{'idref.bnf_type': 'genre/forme Rameau'}
]
}
},
'places': {
'base_url': os.environ.get('RERO_ILS_MEF_PLACES_URL', 'https://mef.rero.ch/api/places'),
'sources': ['idref']
},
}
RERO_ILS_ENTITY_TYPES = {
'bf:Person': 'agents',
'bf:Organisation': 'agents',
'bf:Topic': 'concepts',
'bf:Temporal': 'concepts'
'bf:Temporal': 'concepts',
'bf:Place': 'places'
}

# The absolute path to put the agent synchronization logs, default is the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"$ref": {
"title": "Subject",
"type": "string",
"pattern": "^(https://mef.rero.ch/api/(agents|concepts)/(gnd|idref|rero)/.*|https://bib.rero.ch/api/local_entities/.*?)$",
"pattern": "^(https://mef.rero.ch/api/(agents|concepts|places)/(gnd|idref|rero)/.*|https://bib.rero.ch/api/local_entities/.*?)$",
"widget": {
"formlyConfig": {
"type": "entityTypeahead",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"bf:Organisation",
"bf:Person",
"bf:Topic",
"bf:Temporal"
"bf:Temporal",
"bf:Place"
]
},
"viaf_pid": {
Expand Down
13 changes: 12 additions & 1 deletion rero_ils/modules/entities/remote_entities/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,18 @@ def create_proxy(category):
'concepts-genreForm': {
'class': MefConceptsGenreFormProxy,
'entities': (EntityType.TOPIC,)
}
},
'places': {
'class': MefPlacesProxy,
'entities': (EntityType.PLACE, )
},
}
# Create proxy configuration aliases
proxy_config[EntityType.PERSON] = proxy_config['person']
proxy_config[EntityType.ORGANISATION] = proxy_config['organisation']
proxy_config[EntityType.TOPIC] = proxy_config['topics']
proxy_config[EntityType.TEMPORAL] = proxy_config['temporals']
proxy_config[EntityType.PLACE] = proxy_config['places']

# Try to create the proxy, otherwise raise a ValueError
if data := proxy_config.get(category):
Expand Down Expand Up @@ -322,3 +327,9 @@ class MefConceptsGenreFormProxy(MefConceptsProxy):
"""Proxy on RERO-MEF authority system for specific `genreForm` concepts."""

mef_entrypoint = 'concepts-genreForm'


class MefPlacesProxy(MEFProxyMixin):
"""Proxy on RERO-MEF authority system when searching for `places`."""

mef_entrypoint = 'places'

0 comments on commit 0f24697

Please sign in to comment.