Skip to content

Commit

Permalink
Enable curating broad/narrow
Browse files Browse the repository at this point in the history
  • Loading branch information
cthoyt committed Sep 23, 2023
1 parent 038670d commit 4a3166e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
18 changes: 17 additions & 1 deletion src/biomappings/templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ <h5 class="card-header text-center">
{% endif %}
<th scope="col">Target</th>
<th scope="col">Target Name</th>
<th scope="col">Confidence</th>
<th scope="col">Conf.</th>
<th scope="col"></th>
<th scope="col"></th>
<th scope="col"></th>
<th scope="col"></th>
<th scope="col"></th>
Expand Down Expand Up @@ -111,6 +113,20 @@ <h5 class="card-header text-center">
<i class="far fa-thumbs-up"></i>
</a>
</td>
<td>
<a data-toggle="tooltip"
title="{{ p['source name'] }} is broader than {{ p['target name'] }}."
href="{{ url_for_state('.mark', state, line=line, value='broad') }}">
-B-
</a>
</td>
<td>
<a data-toggle="tooltip"
title="{{ p['source name'] }} is narrower than {{ p['target name'] }}."
href="{{ url_for_state('.mark', state, line=line, value='narrow') }}">
-N-
</a>
</td>
<td>
<a data-toggle="tooltip"
title="These two entities do not have the {{ p['relation'] }} relationship. You should still click this even if you think there could be a different relationship."
Expand Down
15 changes: 14 additions & 1 deletion src/biomappings/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ def mark(self, line: int, value: str) -> None:
"""
if line not in self._marked:
self.total_curated += 1
if value not in {"correct", "incorrect", "unsure"}:
if value not in {"correct", "incorrect", "unsure", "broad", "narrow"}:
raise ValueError
self._marked[line] = value

Expand Down Expand Up @@ -459,6 +459,15 @@ def persist(self):
prediction["prediction_confidence"] = prediction.pop("confidence")
prediction["source"] = _manual_source()
prediction["type"] = "semapv:ManualMappingCuration"

# note these go backwards because of the way they are read
if value == "broad":
value = "correct"
prediction['relation'] = "skos:narrowMatch"
elif value == "narrow":
value = "correct"
prediction['relation'] = "skos:broadMatch"

entries[value].append(prediction)

append_true_mappings(entries["correct"], path=self.positives_path)
Expand Down Expand Up @@ -581,6 +590,10 @@ def _normalize_mark(value: str) -> str:
return "incorrect"
elif value in UNSURE:
return "unsure"
elif value in {"broader", "broad"}:
return "broad"
elif value in {"narrow", "narrower"}:
return "narrow"
else:
raise ValueError

Expand Down

0 comments on commit 4a3166e

Please sign in to comment.