From 1bc95ea85a52dfe40febd778da4bd997f68f51d9 Mon Sep 17 00:00:00 2001 From: Tamara Slosarek Date: Tue, 17 Oct 2023 12:36:15 +0200 Subject: [PATCH] feat(#666): show phenotype as 'Not tested' if missing in diplotypes --- app/lib/common/models/userdata/userdata.dart | 8 +++++--- .../pages/drug/widgets/annotation_cards/guideline.dart | 6 +----- app/lib/l10n/app_en.arb | 2 +- app/lib/report/pages/gene.dart | 2 +- app/lib/report/pages/report.dart | 2 +- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/app/lib/common/models/userdata/userdata.dart b/app/lib/common/models/userdata/userdata.dart index aaa54349..34de155d 100644 --- a/app/lib/common/models/userdata/userdata.dart +++ b/app/lib/common/models/userdata/userdata.dart @@ -13,12 +13,12 @@ const _boxName = 'userdata'; class PhenotypeInformation { PhenotypeInformation({ - this.phenotype, + required this.phenotype, this.adaptionText, this.overwrittenPhenotype, }); - String? phenotype; + String phenotype; String? adaptionText; String? overwrittenPhenotype; } @@ -58,7 +58,9 @@ class UserData { ) { final originalPhenotype = UserData.instance.diplotypes?[gene]?.phenotype; if (originalPhenotype == null) { - return PhenotypeInformation(); + return PhenotypeInformation( + phenotype: context.l10n.general_not_tested, + ); } final activeInhibitors = UserData.activeInhibitorsFor(gene, drug: drug); if (activeInhibitors.isEmpty) { diff --git a/app/lib/common/pages/drug/widgets/annotation_cards/guideline.dart b/app/lib/common/pages/drug/widgets/annotation_cards/guideline.dart index 062c6dfe..893c3b63 100644 --- a/app/lib/common/pages/drug/widgets/annotation_cards/guideline.dart +++ b/app/lib/common/pages/drug/widgets/annotation_cards/guideline.dart @@ -86,11 +86,7 @@ class GuidelineAnnotationCard extends StatelessWidget { context, drug: drug?.name, ); - var description = - '$geneSymbol: ${ - phenotypeInformation.phenotype ?? - context.l10n.drugs_page_cast_indeterminate - }'; + var description = '$geneSymbol: ${phenotypeInformation.phenotype}'; if (phenotypeInformation.adaptionText.isNotNullOrBlank) { description = '$description (${phenotypeInformation.adaptionText})'; } diff --git a/app/lib/l10n/app_en.arb b/app/lib/l10n/app_en.arb index e1bc795a..5c8ae587 100644 --- a/app/lib/l10n/app_en.arb +++ b/app/lib/l10n/app_en.arb @@ -27,6 +27,7 @@ "general_and": "and", "general_poor_metabolizer": "Poor Metabolizer", "general_the_user": "the user", + "general_not_tested": "Not tested", "search_page_tooltip_search": "Search for drugs by their name, brand name or class.", "search_page_filter_inactive": "Show currently not taken drugs", @@ -187,7 +188,6 @@ } }, "drugs_page_tooltip_guideline": "Clinical guidelines help understand how drug therapy can be optimized for one's genetics. They put specific genes in relation with a drug.", - "drugs_page_cast_indeterminate": "Indeterminate", "report_page_indicator_explanation": "Phenotypes followed by an {indicatorName} ({indicator}) might be influenced by drugs you are currently taking", "@report_page_indicator_explanation": { diff --git a/app/lib/report/pages/gene.dart b/app/lib/report/pages/gene.dart index 38bc4608..562a81e1 100644 --- a/app/lib/report/pages/gene.dart +++ b/app/lib/report/pages/gene.dart @@ -52,7 +52,7 @@ class GenePage extends HookWidget { UserData.phenotypeFor( phenotype.geneSymbol, context, - ).phenotype!, + ).phenotype, tooltip: context.l10n.gene_page_phenotype_tooltip ), diff --git a/app/lib/report/pages/report.dart b/app/lib/report/pages/report.dart index afbfe974..eb9739f4 100644 --- a/app/lib/report/pages/report.dart +++ b/app/lib/report/pages/report.dart @@ -47,7 +47,7 @@ class GeneCard extends StatelessWidget { context, ); final phenotypeText = phenotypeInformation.adaptionText.isNullOrBlank - ? phenotypeInformation.phenotype! + ? phenotypeInformation.phenotype : '${phenotypeInformation.phenotype}$drugInteractionIndicator'; return RoundedCard( onTap: () => context.router.push(GeneRoute(phenotype: phenotype)),