Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- medium
- low
- disputed
- N/A (no access to publication)

How to run the command:
python manage.py load_mined_publications_scores --data_file <json data file> --email <user account email>
Expand Down Expand Up @@ -71,17 +72,22 @@ def handle(self, *args, **options):
for record_data in data_reader:
g2p_id = record_data["id"]
for publication in record_data["publications"]:
if publication["status"] and publication["status"] != "incomplete":
if publication["status"]:
pmid = publication["id"]
score = publication["status"]
score_comment = publication["comment"]
full_text = publication["fulltext"]
n_scores += 1

if full_text:
score_comment += " (Score based on full text)"
if publication["status"] == "incomplete":
score = "N/A" # Overwrite score for incomplete publications
score_comment = "No access to this publication"
else:
score_comment += " (Score based on abstract only)"
score_comment = publication["comment"]
full_text = publication["fulltext"]

if full_text:
score_comment += " (Score based on full text)"
else:
score_comment += " (Score based on abstract only)"

try:
lgd_mined_pub_obj = LGDMinedPublication.objects.get(
Expand All @@ -100,6 +106,6 @@ def handle(self, *args, **options):
lgd_mined_pub_obj._history_user = user_obj
lgd_mined_pub_obj.save()
n_scores_updated += 1

print(f"\nTotal scores in the input file: {n_scores}")
print(f"Total scores updated in the database: {n_scores_updated}\n")
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by Django 5.2.9 on 2026-01-23 11:30

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
(
"gene2phenotype_app",
"0015_curationdata_status_historicalcurationdata_status",
),
]

operations = [
migrations.RemoveConstraint(
model_name="lgdminedpublication",
name="score_valid",
),
migrations.AddConstraint(
model_name="lgdminedpublication",
constraint=models.CheckConstraint(
condition=models.Q(
("score__in", ["high", "medium", "low", "disputed", "N/A", None])
),
name="score_valid",
),
),
]
2 changes: 1 addition & 1 deletion gene2phenotype_project/gene2phenotype_app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ class Meta:
name="status_valid",
),
models.CheckConstraint(
condition=Q(score__in=["high", "medium", "low", "disputed", None]),
condition=Q(score__in=["high", "medium", "low", "disputed", "N/A", None]),
name="score_valid",
),
]
Expand Down