Skip to content

Commit df276d5

Browse files
committed
analysis: fix CPIC annotator null guidelineid causing 400 errors #TASK-8076
Skip recommendation query when guidelineid is null in the /pair response instead of passing "None" as string to the API.
1 parent a3f4b2d commit df276d5

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

  • opencga-app/app/analysis/pharmacogenomics/src/pharmacogenomics/core

opencga-app/app/analysis/pharmacogenomics/src/pharmacogenomics/core/annotator.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,20 +144,20 @@ def _query_drugs(self, gene: str) -> list[CpicDrug]:
144144

145145
drugs = []
146146
for pair in self._pair_cache[gene]:
147-
drug_id = pair.get("drugid", "")
148-
guideline_id = pair.get("guidelineid", "")
147+
drug_id = pair.get("drugid") or ""
148+
guideline_id = pair.get("guidelineid")
149149

150150
# Resolve drug name from /drug endpoint
151151
drug_name = self._resolve_drug_name(drug_id)
152152

153-
# Query recommendations for this drug-gene pair
154-
recs = self._query_recommendations(drug_id, guideline_id)
153+
# Query recommendations only if both drugid and guidelineid are available
154+
recs = self._query_recommendations(drug_id, guideline_id) if drug_id and guideline_id else []
155155

156156
drug = CpicDrug(
157157
drug_id=str(drug_id),
158158
drug_name=drug_name,
159159
gene_symbol=pair.get("genesymbol", ""),
160-
guideline_id=str(guideline_id),
160+
guideline_id=str(guideline_id or ""),
161161
cpic_level=pair.get("cpiclevel", ""),
162162
pgkb_ca_level=pair.get("clinpgxlevel", ""),
163163
pgx_testing=pair.get("pgxtesting", "") or "",

0 commit comments

Comments
 (0)