Skip to content
Snippets Groups Projects
Commit d87ca381 authored by Matevž Markovič's avatar Matevž Markovič
Browse files

Prevodi v Slovenščino.

parent e1f44a93
No related branches found
Tags OPSIv0.5
No related merge requests found
...@@ -25,6 +25,123 @@ class QAPlugin(p.SingletonPlugin, p.toolkit.DefaultDatasetForm): ...@@ -25,6 +25,123 @@ class QAPlugin(p.SingletonPlugin, p.toolkit.DefaultDatasetForm):
p.implements(p.ITemplateHelpers) p.implements(p.ITemplateHelpers)
p.implements(p.IPackageController, inherit=True) p.implements(p.IPackageController, inherit=True)
#++++++++++++++++++++++++++++++++ MJU-POPS change +++++++++++++++++++++++++++++++++++++
#Ckanext-QA notifies itself on package update, and not through archiver
p.implements(p.IDomainObjectModification, inherit=True)
# IDomainObjectModification
def notify(self, entity, operation=None):
if not isinstance(entity, model.Package):
return
log.debug('Ckanext-QA: Notified of package event: %s %s', entity.name, operation)
run_notify = self._is_it_sufficient_change_to_run_notifyQA(entity, operation)
if not run_notify:
return
log.debug('Creating notifier task: %s', entity.name)
#!!!!!!!!!!
#lib.create_archiver_package_task(entity, 'priority')
#?????????? --> za posamezen vir (resorce) Celeryd ni potrebno obveščati.
lib.create_qa_package_task(entity, 'priority')
def _is_it_sufficient_change_to_run_notifyQA(self, package, operation):
''' Returns True if in this revision any of these happened:
* it is a new dataset
* dataset licence changed (affects qa)
* there are resources that have been added or deleted
* resources have changed their URL or format (affects qa)
'''
if operation == 'new':
log.debug('New package - will archive')
# even if it has no resources, QA needs to show 0 stars against it
return True
elif operation == 'deleted':
log.debug('Deleted package - won\'t notify QA')
return False
# therefore operation=changed
# check to see if resources are added, deleted or URL changed
# look for the latest revision
rev_list = package.all_related_revisions
if not rev_list:
log.debug('No sign of previous revisions - will notify QA')
return True
# I am not confident we can rely on the info about the current
# revision, because we are still in the 'before_commit' stage. So
# simply ignore that if it's returned.
if rev_list[0][0].id == model.Session.revision.id:
rev_list = rev_list[1:]
if not rev_list:
log.warn('No sign of previous revisions - will notify QA')
return True
previous_revision = rev_list[0][0]
log.debug('Comparing with revision: %s %s',
previous_revision.timestamp, previous_revision.id)
# get the package as it was at that previous revision
context = {'model': model, 'session': model.Session,
#'user': c.user or c.author,
'ignore_auth': True,
'revision_id': previous_revision.id}
data_dict = {'id': package.id}
try:
old_pkg_dict = p.toolkit.get_action('package_show')(
context, data_dict)
except p.toolkit.NotFound:
log.warn('No sign of previous package - will notify QA anyway')
return True
# has the licence changed?
old_licence = (old_pkg_dict['license_id'],
lib.get_extra_from_pkg_dict(old_pkg_dict, 'licence')
or None)
new_licence = (package.license_id,
package.extras.get('licence') or None)
if old_licence != new_licence:
log.debug('Licence has changed - will notify QA: %r->%r',
old_licence, new_licence)
return True
# have any resources been added or deleted?
old_resources = dict((res['id'], res)
for res in old_pkg_dict['resources'])
old_res_ids = set(old_resources.keys())
new_res_ids = set((res.id for res in package.resources))
deleted_res_ids = old_res_ids - new_res_ids
if deleted_res_ids:
log.debug('Deleted resources - will notify QA. res_ids=%r',
deleted_res_ids)
return True
added_res_ids = new_res_ids - old_res_ids
if added_res_ids:
log.debug('Added resources - will notify QA. res_ids=%r',
added_res_ids)
return True
# have any resources' url/format changed?
for res in package.resources:
for key in ('url', 'format'):
old_res_value = old_resources[res.id][key]
new_res_value = getattr(res, key)
if old_res_value != new_res_value:
log.debug('Resource %s changed - will archive. '
'id=%s pos=%s url="%s"->"%s"',
key, res.id[:4], res.position,
old_res_value, new_res_value)
return True
log.debug('Resource unchanged. pos=%s id=%s',
res.position, res.id[:4])
log.debug('No new, deleted or changed resources - won\'t notify QA')
return False
#-------------------------------- MJU-POPS change -------------------------------------
# IConfigurer # IConfigurer
def update_config(self, config): def update_config(self, config):
...@@ -46,8 +163,8 @@ class QAPlugin(p.SingletonPlugin, p.toolkit.DefaultDatasetForm): ...@@ -46,8 +163,8 @@ class QAPlugin(p.SingletonPlugin, p.toolkit.DefaultDatasetForm):
def receive_data(self, operation, queue, **params): def receive_data(self, operation, queue, **params):
'''Receive notification from ckan-archiver that a dataset has been '''Receive notification from ckan-archiver that a dataset has been
archived.''' archived.'''
if not operation == 'package-archived': #if not operation == 'package-archived':
return # return
dataset_id = params['package_id'] dataset_id = params['package_id']
dataset = model.Package.get(dataset_id) dataset = model.Package.get(dataset_id)
......
[ [
["_comment", ["_comment",
"JSON field order as follows:", "Zaporedje zapisov JSON:",
["Format", "Score"], ["Format", "Ocena"],
"where:", "kjer:",
" * Format - the short name for it, corresponding to the name in ckan's resource_formats.json.", " * Format - kratko ime formata, v skladu z zapisom v ckanovem resource_formats.json.",
" * Score - openness score to award it. Integer from 0 to 5. 0 means it is likely not data e.g. a web page is probably just a link to the data, an OWL file is an ontology rather than data, an EXE is probably not data, ZIP will be looked inside but we can't be sure its data so gets 1, images may be satellite weather images so give benefit of doubt. RDFa is likely basic document info for a web page added automatically by a CMS, not real data." " * Ocena - ocena odprtosti. Celo število od 0 do 5. 0 pomeni, da verjetno ne gre za podatke, na primer spletna stran, ki le kaže na podatke, datoteka OWL (le ontologija in ne sami podatki), izvršljiva datoteka EXE, datoteka ZIP, v katero se bo pogledalo vendar pa ne moremo biti zagotovi, ali gre za podatke (zaradi tega dobi oceno 1), slike so lahke satelitske slike vremena. RDFa je najverjetneje dokument z osnovnimi podatki o spletni strani, ki je bila avtomatsko dodana preko CSM in ne vsebuje pravih podatkov."
], ],
["N3", 5], ["N3", 5],
["SPARQL", 5], ["SPARQL", 5],
......
...@@ -20,15 +20,22 @@ class QAError(Exception): ...@@ -20,15 +20,22 @@ class QAError(Exception):
# Description of each score, used elsewhere # Description of each score, used elsewhere
OPENNESS_SCORE_DESCRIPTION = { OPENNESS_SCORE_DESCRIPTION = {
'''
0: 'Not obtainable or license is not open', 0: 'Not obtainable or license is not open',
1: 'Obtainable and open license', 1: 'Obtainable and open license',
2: 'Machine readable format', 2: 'Machine readable format',
3: 'Open and standardized format', 3: 'Open and standardized format',
4: 'Ontologically represented', 4: 'Ontologically represented',
5: 'Fully Linked Open Data as appropriate', 5: 'Fully Linked Open Data as appropriate',
'''
0: 'Ni dosegljivo ali pa licenca ni odprta',
1: 'Dosegljivo ter odprta licenca',
2: 'Strojno-berljiv format',
3: 'Odprt ter standardiziran format',
4: 'Ontološko predstavljiv',
5: 'Popolnoma povezani odprti podatki',
} }
def load_config(ckan_ini_filepath): def load_config(ckan_ini_filepath):
import paste.deploy import paste.deploy
config_abs_path = os.path.abspath(ckan_ini_filepath) config_abs_path = os.path.abspath(ckan_ini_filepath)
......
...@@ -20,11 +20,11 @@ OR the package_show's package['qa'] e.g. ...@@ -20,11 +20,11 @@ OR the package_show's package['qa'] e.g.
#} #}
<div class="qa openness-{{ openness_score }}"> <div class="qa openness-{{ openness_score }}">
{% if openness_score != None %} {% if openness_score != None %}
Openness: {% snippet "qa/stars.html", stars=openness_score %} <br> Odprtost: {% snippet "qa/stars.html", stars=openness_score %} <br>
Reason: {{ openness_score_reason }} <br> Razlog: {{ openness_score_reason }} <br>
<span>Checked: {{ h.render_datetime(updated) }}</span><br> <span>Preverjeno: {{ h.render_datetime(updated) }}</span><br>
{% else %} {% else %}
No openness information yet. Update expected soon. Ni še informacij glede odprtosti. Le-te se pričakujejo v kratkem.
{% endif %} {% endif %}
</div> </div>
...@@ -20,10 +20,10 @@ OR the package_show's package['qa'] e.g. ...@@ -20,10 +20,10 @@ OR the package_show's package['qa'] e.g.
#} #}
<div class="qa openness-{{ openness_score }}"> <div class="qa openness-{{ openness_score }}">
{% if openness_score != None %} {% if openness_score != None %}
<span title="Reason: {{ openness_score_reason }} Checked: {{ h.render_datetime(updated) }}"> <span title="Reason: {{ openness_score_reason }} Preverjeno: {{ h.render_datetime(updated) }}">
{% snippet "qa/stars.html", stars=openness_score %} <br> {% snippet "qa/stars.html", stars=openness_score %} <br>
{% else %} {% else %}
No openness information yet Informacij glede odprtosti še ni
{% endif %} {% endif %}
</div> </div>
...@@ -4,13 +4,17 @@ Pass in: ...@@ -4,13 +4,17 @@ Pass in:
openness_score - number of stars (or None if you don't want to highlight a particular one) openness_score - number of stars (or None if you don't want to highlight a particular one)
#} #}
<div class="star-openness_score-entry {% if openness_score != None and openness_score < 5 %}fail{% endif %}">&#9733&#9733&#9733&#9733&#9733&nbsp; Linked data - data URIs and linked to other data (e.g. RDF)</div> {# <div class="star-openness_score-entry {% if openness_score != None and openness_score < 5 %}fail{% endif %}">&#9733&#9733&#9733&#9733&#9733&nbsp; Linked data - data URIs and linked to other data (e.g. RDF)</div> #}
<div class="star-openness_score-entry {% if openness_score != None and openness_score < 5 %}fail{% endif %}">&#9733&#9733&#9733&#9733&#9733&nbsp; Povezani podatki - podatkovni URI-ji ter povezave na ostale podatke (na primer RDF)</div>
<div class="star-openness_score-entry {% if openness_score != None and openness_score < 4 %}fail{% endif %}">&#9733&#9733&#9733&#9733&#9734&nbsp; Linkable data - served at URIs (e.g. RDF)</div> {# <div class="star-openness_score-entry {% if openness_score != None and openness_score < 4 %}fail{% endif %}">&#9733&#9733&#9733&#9733&#9734&nbsp; Linkable data - served at URIs (e.g. RDF)</div> #}
<div class="star-openness_score-entry {% if openness_score != None and openness_score < 4 %}fail{% endif %}">&#9733&#9733&#9733&#9733&#9734&nbsp; Povezljivi podatki - servirani na URI-jih (na primer RDF)</div>
<div class="star-openness_score-entry {% if openness_score != None and openness_score < 3 %}fail{% endif %}">&#9733&#9733&#9733&#9734&#9734&nbsp; Structured data in open format (e.g. CSV)</div> {# <div class="star-openness_score-entry {% if openness_score != None and openness_score < 3 %}fail{% endif %}">&#9733&#9733&#9733&#9734&#9734&nbsp; Structured data in open format (e.g. CSV)</div> #}
<div class="star-openness_score-entry {% if openness_score != None and openness_score < 3 %}fail{% endif %}">&#9733&#9733&#9733&#9734&#9734&nbsp; Strukturirani podatki ter odprt format (na primer CSV)</div>
<div class="star-openness_score-entry {% if openness_score != None and openness_score < 2 %}fail{% endif %}fail">&#9733&#9733&#9734&#9734&#9734&nbsp; Structured data but proprietry format (e.g. Excel)</div> {# <div class="star-openness_score-entry {% if openness_score != None and openness_score < 2 %}fail{% endif %}fail">&#9733&#9733&#9734&#9734&#9734&nbsp; Structured data but proprietry format (e.g. Excel)</div> #}
<div class="star-openness_score-entry {% if openness_score != None and openness_score < 2 %}fail{% endif %}fail">&#9733&#9733&#9734&#9734&#9734&nbsp; Strukturirani podatki, a lastniški format (na primer Excel)</div>
<div class="star-openness_score-entry {% if openness_score != None and openness_score < 1 %}fail{% endif %}">&#9733&#9734&#9734&#9734&#9734&nbsp; Unstructured data (e.g. PDF)</div>
{# <div class="star-openness_score-entry {% if openness_score != None and openness_score < 1 %}fail{% endif %}">&#9733&#9734&#9734&#9734&#9734&nbsp; Unstructured data (e.g. PDF)</div> #}
<div class="star-openness_score-entry {% if openness_score != None and openness_score < 1 %}fail{% endif %}">&#9733&#9734&#9734&#9734&#9734&nbsp; Nestrukturirani podatki (na primer PDF)</div>
{% if c.options['organization'] == None %} {% if c.options['organization'] == None %}
<ul> <ul>
<li>Datasets given a score: {{ c.data['num_packages_scored'] }} / {{ c.data['num_packages'] }}</li> <li>Ocenjene podatkovne zbirke: {{ c.data['num_packages_scored'] }} / {{ c.data['num_packages'] }}</li>
<li>Totals <li>Skupno
<table class="table table-striped table-bordered table-condensed"> <table class="table table-striped table-bordered table-condensed">
<thead> <thead>
<tr> <tr>
<th>Score TBC</th> <th>Ocene TBC</th>
{% for n in range(6) %} {% for n in range(6) %}
<th>Score {{n}}</th> <th>Ocena {{n}}</th>
{% endfor %} {% endfor %}
</tr> </tr>
</thead> </thead>
...@@ -25,13 +25,13 @@ ...@@ -25,13 +25,13 @@
<table class="table table-striped table-bordered table-condensed tablesorter" id="report-table"> <table class="table table-striped table-bordered table-condensed tablesorter" id="report-table">
<thead> <thead>
<tr> <tr>
<th>Publisher</th> <th>Izdajatelj</th>
<th>Score TBC</th> <th>Ocene TBC</th>
{% for n in range(6) %} {% for n in range(6) %}
<th>Score {{n}}</th> <th>Ocena {{n}}</th>
{% endfor %} {% endfor %}
<th>Total stars</th> <th>Skupaj zvezd</th>
<th>Average stars</th> <th>Skupna ocena</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
...@@ -52,16 +52,16 @@ ...@@ -52,16 +52,16 @@
{% else %} {% else %}
<ul> <ul>
<li>Average score: {{ c.data['average_stars'] }}</li> <li>Povprečje: {{ c.data['average_stars'] }}</li>
<li>Total stars: {{ c.data['total_stars'] }}</li> <li>Skupna ocena: {{ c.data['total_stars'] }}</li>
<li>Datasets given a score: {{ c.data['num_packages_scored'] }} / {{ c.data['num_packages'] }}</li> <li>Ocenjene podatkovne zbirke: {{ c.data['num_packages_scored'] }} / {{ c.data['num_packages'] }}</li>
<li>Score frequencies: <li>Frekvence ocen:
<table class="table table-striped table-bordered table-condensed"> <table class="table table-striped table-bordered table-condensed">
<thead> <thead>
<tr> <tr>
<th>Score TBC</th> <th>Ocene TBC</th>
{% for n in range(6) %} {% for n in range(6) %}
<th>Score {{n}}</th> <th>Ocena {{n}}</th>
{% endfor %} {% endfor %}
</tr> </tr>
</thead> </thead>
...@@ -79,13 +79,13 @@ ...@@ -79,13 +79,13 @@
<table class="table table-striped table-bordered table-condensed tablesorter" id="report-table"> <table class="table table-striped table-bordered table-condensed tablesorter" id="report-table">
<thead> <thead>
<tr> <tr>
<th>Dataset</th> <th>Podatkovna zbirka</th>
<th>Notes</th> <th>Zapiski</th>
{% if c.options['include_sub_organizations'] %} {% if c.options['include_sub_organizations'] %}
<th>Publisher</th> <th>Izdajatelj</th>
{% endif %} {% endif %}
<th>Score</th> <th>Ocena</th>
<th>Score reason</th> <th>Razlog ocene</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment