From 68f548be84cf17eac4e7759cf836ee6072fc86df Mon Sep 17 00:00:00 2001 From: Tamara Slosarek Date: Thu, 19 Oct 2023 15:54:20 +0200 Subject: [PATCH] feat(#665): show all genes from annotations in report --- app/lib/common/utilities/guideline_utils.dart | 11 +++++++++++ app/lib/report/pages/report.dart | 15 ++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/app/lib/common/utilities/guideline_utils.dart b/app/lib/common/utilities/guideline_utils.dart index 94db5c87..06da81ed 100644 --- a/app/lib/common/utilities/guideline_utils.dart +++ b/app/lib/common/utilities/guideline_utils.dart @@ -1,4 +1,15 @@ +import '../models/drug/cached_drugs.dart'; import '../module.dart'; +List getGuidelineGenes() { + final genes = {}; + for (final drug in CachedDrugs.instance.drugs!) { + for (final guideline in drug.guidelines) { + guideline.lookupkey.keys.forEach(genes.add); + } + } + return List.from(genes); +} + WarningLevel getWarningLevel(Guideline? guideline) => guideline?.annotations.warningLevel ?? WarningLevel.none; \ No newline at end of file diff --git a/app/lib/report/pages/report.dart b/app/lib/report/pages/report.dart index eb9739f4..d5b6a065 100644 --- a/app/lib/report/pages/report.dart +++ b/app/lib/report/pages/report.dart @@ -1,16 +1,29 @@ import '../../common/module.dart'; +import '../../common/utilities/guideline_utils.dart'; class ReportPage extends StatelessWidget { @override Widget build(BuildContext context) { final hasActiveInhibitors = UserData.instance.activeDrugNames != null && UserData.instance.activeDrugNames!.any(isInhibitor); + final guidelineGenes = getGuidelineGenes(); + + final notTestedString = context.l10n.general_not_tested; + final userPhenotypes = guidelineGenes.map( + (geneSymbol) => UserData.instance.lookups![geneSymbol] ?? + CpicPhenotype( + geneSymbol: geneSymbol, + phenotype: notTestedString, + genotype: notTestedString, + lookupkey: notTestedString + ) + ); return unscrollablePageScaffold( title: context.l10n.tab_report, body: Column( children: [ scrollList( - UserData.instance.lookups!.values.map((phenotype) => + userPhenotypes.map((phenotype) => Column(children: [ GeneCard(phenotype), SizedBox(height: 8)