Skip to content

Commit

Permalink
Merge branch 'dev_thomas' of https://github.com/IFB-ElixirFr/fair-che…
Browse files Browse the repository at this point in the history
…cker into dev_thomas
  • Loading branch information
thomasrosnet committed Jul 9, 2021
2 parents a28a9de + e453583 commit 8c0909f
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 35 deletions.
16 changes: 8 additions & 8 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -994,21 +994,21 @@ def check_kg(data):
if util.ask_OLS(c['name']):
c['tag'].append('OLS')
emit('done_check', table_content)
# if util.ask_LOV(c['name']):
# c['tag'].append('LOV')
# emit('done_check', table_content)
if util.ask_BioPortal(c['name']):
if util.ask_LOV(c['name']):
c['tag'].append('LOV')
emit('done_check', table_content)
if util.ask_BioPortal(c['name'], "class"):
c['tag'].append('BioPortal')
emit('done_check', table_content)

for p in table_content['properties']:
if util.ask_OLS(p['name']):
p['tag'].append('OLS')
emit('done_check', table_content)
# if util.ask_LOV(p['name']):
# p['tag'].append('LOV')
# emit('done_check', table_content)
if util.ask_BioPortal(p['name']):
if util.ask_LOV(p['name']):
p['tag'].append('LOV')
emit('done_check', table_content)
if util.ask_BioPortal(p['name'], "property"):
p['tag'].append('BioPortal')
emit('done_check', table_content)

Expand Down
10 changes: 7 additions & 3 deletions metrics/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ def get_DOI(uri):
match = re.search(regex, uri, re.MULTILINE | re.IGNORECASE)
return match.group(0)

def ask_BioPortal(uri):

def ask_BioPortal(uri, type):

print(f'Call to the BioPortal REST API for [ {uri} ]')
# print(app.config)
Expand All @@ -164,8 +165,11 @@ def ask_BioPortal(uri):
'Accept': 'application/json',
'Authorization': 'apikey token=' + api_key
}
# res = requests.get("https://data.bioontology.org/property_search?q=" + uri, headers=h, verify=True)
res = requests.get("https://data.bioontology.org/search?q=" + uri + "&require_exact_match=true", headers=h, verify=True)

if type == "property":
res = requests.get("https://data.bioontology.org/property_search?q=" + uri, headers=h, verify=True)
elif type == "class":
res = requests.get("https://data.bioontology.org/search?q=" + uri + "&require_exact_match=true", headers=h, verify=True)
# print(res)


Expand Down
20 changes: 12 additions & 8 deletions templates/kg_metrics_2.html
Original file line number Diff line number Diff line change
Expand Up @@ -565,14 +565,18 @@ <h1 class="title">How to enhance metadata quality for my tools, datasets, workfl
</div>
<!-- <div class="section"> -->
{% for k in sample_data.keys() %}
<!-- <p class="button is-info is-small">{{k}}<i class="fa fa-chevron-down fa-fw"></i></p>-->
<!-- <br>-->
<!-- <br>-->
<div class="field is-grouped is-grouped-centered">
{% for s in sample_data[k] %}
<p id="resource_{{k}}_{{loop.index}}"class="control"><a class="button is-small is-text" data-url="{{ s.url }}">{{ s.text }}</a></p>
{% endfor %}
</div>
<p class="button is-info is-small">{{k}}<i class="fa fa-chevron-down fa-fw"></i></p>
<!-- <br> -->
<!-- <br> -->
<div class="panel">
<div class="panel-block is-centered">
<div class="field is-grouped is-grouped-centered">
{% for s in sample_data[k] %}
<p id="resource_{{k}}_{{loop.index}}"class="control"><a class="button is-small is-text" data-url="{{ s.url }}">{{ s.text }}</a></p>
{% endfor %}
</div>
</div>
</div>
{% endfor %}
<!-- </div> -->
</div>
Expand Down
24 changes: 14 additions & 10 deletions templates/metrics_summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -433,16 +433,20 @@ <h1 class="title">How FAIR is my resource ?</h1>
</article>
</div> -->
<!-- <div class="section"> -->
{% for k in sample_data.keys() %}
<!-- <p class="button is-info is-small">{{k}}<i class="fa fa-chevron-down fa-fw"></i></p> -->
<!-- <br> -->
<!-- <br> -->
<div class="field is-grouped is-grouped-centered">
{% for s in sample_data[k] %}
<p id="resource_{{k}}_{{loop.index}}"class="control"><a class="button is-small is-text" data-url="{{ s.url }}">{{ s.text }}</a></p>
{% endfor %}
</div>
{% endfor %}
{% for k in sample_data.keys() %}
<p class="button is-info is-small">{{k}}<i class="fa fa-chevron-down fa-fw"></i></p>
<!-- <br> -->
<!-- <br> -->
<div class="panel">
<div class="panel-block is-centered">
<div class="field is-grouped is-grouped-centered">
{% for s in sample_data[k] %}
<p id="resource_{{k}}_{{loop.index}}"class="control"><a class="button is-small is-text" data-url="{{ s.url }}">{{ s.text }}</a></p>
{% endfor %}
</div>
</div>
</div>
{% endfor %}

<!-- </div> -->
</div>
Expand Down
12 changes: 6 additions & 6 deletions tests/test_vocab.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,19 @@ def test_validate_shape_tool(self):
print(f'{row["prop"]}')

for c in table_content['classes']:
print(util.ask_BioPortal(c['name']))
print(util.ask_BioPortal(c['name'], "class"))
if util.ask_OLS(c['name']):
c['tag'].append('OLS')
# if util.ask_LOV(c['name']):
# c['tag'].append('LOV')
if util.ask_LOV(c['name']):
c['tag'].append('LOV')

for p in table_content['properties']:
print(util.ask_BioPortal(p['name']))
print(util.ask_BioPortal(p['name'], "property"))
# print(util.ask_OLS(p['name']))
if util.ask_OLS(p['name']):
p['tag'].append('OLS')
# if util.ask_LOV(p['name']):
# p['tag'].append('LOV')
if util.ask_LOV(p['name']):
p['tag'].append('LOV')


if __name__ == '__main__':
Expand Down

0 comments on commit 8c0909f

Please sign in to comment.