-
Notifications
You must be signed in to change notification settings - Fork 11
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
Zuordnen von Datensätzen zu Herausgebern #22
base: master
Are you sure you want to change the base?
Conversation
# At this point a configuration of the Harvest Source should be considered if there should be an error if the publisher is missing. | ||
raise ValueError("We need a new publisher with the name "+ str(publisher_name)) | ||
|
||
dataset_dict['owner_org'] = owner_org |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Das dataset_dict
könnte bereits einen Eintrag für owner_org
haben, falls das in der Harvester-Konfiguration so hinterlegt wurde. Siehe [https://github.com/ckan/ckanext-dcat/blob/eb1aee013687a40d0366a2fe44546917ee960bfc/ckanext/dcat/harvesters/rdf.py#L226]. Priorität hätten in dem Fall die remote_orgs
. In dem Falle wäre es zwar eine widersprüchliche Konfiguration, aber ich bin mir nicht sicher, ob das nicht anders herum besser wäre.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beim Aufruf dieser Methode hat jeder Datensatz schon einen Eintrag in owner_org
, nämlich die der Harvest Source.
@@ -26,7 +27,8 @@ | |||
GET_URIS_FROM_HARVEST_INFO_QUERY | |||
from ckanext.dcatde.validation.shacl_validation import ShaclValidator | |||
from ckanext.harvest.model import HarvestObject, HarvestObjectExtra | |||
|
|||
from ckan.lib.search.common import SearchIndexError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicht genutzter Import, der entfernt werden kann.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
entfernt
@@ -26,7 +27,8 @@ | |||
GET_URIS_FROM_HARVEST_INFO_QUERY | |||
from ckanext.dcatde.validation.shacl_validation import ShaclValidator | |||
from ckanext.harvest.model import HarvestObject, HarvestObjectExtra | |||
|
|||
from ckan.lib.search.common import SearchIndexError | |||
from pysolr import SolrError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicht genutzter Import, der entfernt werden kann.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
entfernt
base_context = {'model': model, 'session': model.Session, | ||
'user': self._get_user_name()} | ||
|
||
remote_orgs = json.loads(harvest_object.job.source.config).get('remote_orgs', None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sollte vorher in der Methode validate_config
[https://github.com/GovDataOfficial/ckanext-dcatde/blob/873db9a980da72859f99bb4d23c9a27c74f0424a/ckanext/dcatde/harvesters/dcatde_rdf.py#L407] geprüft werden, so dass zumindest kein ungültiges JSON abgespeichert werden kann. Ansonsten könnte es hier zu einer Exception kommen.
if remote_orgs == 'create': | ||
org = {} | ||
org['title'] = publisher_name | ||
org['name'] = publisher_name.lower().replace(" ", "-").replace('ü','ue').replace('ä','ae').replace('ö','oe').replace('ß','ss') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besser wäre es stattdessen die vorhandene Methode _gen_new_name
dafür zu nutzen, so wie in [https://github.com/ckan/ckanext-dcat/blob/eb1aee013687a40d0366a2fe44546917ee960bfc/ckanext/dcat/harvesters/rdf.py#L217] das gemacht wird.
Danke @jze für das Einreichen des Pull-Requests. Nach einem kurzen Durchsehen der Änderungen haben wir die ersten Anmerkungen abgegeben. Eventuell ist es später zu überlegen, ob die Erweiterung nicht sogar direkt in |
überflüssige Imports entfernt _gen_new_name Funktion verwendet bessere Fehlermeldung bei fehlendem Herausgeber
Ich habe die Stelle, an der nach Herausgebern gesucht wird, nochmal geändert. Statt in In der |
Hier ist ein erster Diskussionsstand für die Implementierung der Zuordnen von Datensätzen zu Herausgebern.
Wie beim CKAN-CKAN-Harvester wird die Konfiguration
remote_orgs
verwendet, um zu steuern, ob überhaupt eine Suche nach Herausgebern stattfinden soll und wenn ja, ob auch fehlende Herausgeber automatisch angelegt werden sollen.Als Name wir zunächst der Titel der Organsation gesucht. Gibt es keine passende Organisation, wird in Extra-Feldern
alternate_name_x
nach weiteren Bezeichnungen einer Organisation gesucht.Fixes #19