Skip to content

Fix sample matching and data retrieval in dashboard graph for percentage of reads #298

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

Merged
merged 3 commits into from
Jun 6, 2025
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
27 changes: 17 additions & 10 deletions dashboard/utils/generic_process_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,21 +395,29 @@ def pre_proc_based_pairs_sequenced():
pcr_ct_1_values = core.utils.rest_api.get_sample_parameter_data(
{"sample_project_name": "Relecov", "parameter": "diagnostic_pcr_Ct_value_1"}
)
samps_db = core.models.Sample.objects.all().values_list("collecting_lab_sample_id")
samps_db = set(
x[0]
for x in core.models.Sample.objects.all().values_list(
"collecting_lab_sample_id"
)
)
if "ERROR" in pcr_ct_1_values:
return pcr_ct_1_values
for ct_value in pcr_ct_1_values:
sample_name = ct_value["Sample name"]

if sample_name not in samps_db:
continue
base_value = (
core.models.BioinfoAnalysisValue.objects.filter(
bioinfo_analysis_fieldID__property_name__exact="number_of_reads_sequenced",
sample__collecting_lab_sample_id__exact=sample_name,
)
.last()
.get_value()
)

base_value_qs = core.models.BioinfoAnalysisValue.objects.filter(
bioinfo_analysis_fieldID__property_name__exact="number_of_reads_sequenced",
sample__collecting_lab_sample_id__exact=sample_name,
).last()

if base_value_qs is None:
continue

base_value = base_value_qs.get_value()
try:
float_base_value = float(ct_value["diagnostic_pcr_Ct_value_1"])
base_value_int = int(base_value)
Expand All @@ -425,7 +433,6 @@ def pre_proc_based_pairs_sequenced():
"graphic_data": based_pairs,
}
)

return {"SUCCESS": "Success"}


Expand Down
2 changes: 1 addition & 1 deletion dashboard/utils/met_sequencing.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def get_pre_proc_data(graphic_name, out_format):
json_data = dashboard.utils.generic_graphic_data.get_graphic_json_data(
graphic_name
)
if json_data is None:
if json_data is None or json_data == {}:
# Execute the pre-processed task to get the data
if graphic_name == "library_kit_pcr_1":
result = (
Expand Down