From 6269e0c19379d974610bc39c880bbb6514f2b4fb Mon Sep 17 00:00:00 2001 From: Tamara Slosarek Date: Wed, 3 Jan 2024 13:22:47 +0100 Subject: [PATCH] feat(#684): use gene instead of geneSymbol everywhere --- app/lib/common/models/drug/drug.dart | 4 ++-- .../common/models/drug/drug_inhibitors.dart | 16 +++++++-------- app/lib/common/utilities/genome_data.dart | 2 +- .../widgets/annotation_cards/guideline.dart | 6 +++--- app/lib/l10n/app_en.arb | 20 +++++++++---------- app/lib/report/pages/report.dart | 6 +++--- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/app/lib/common/models/drug/drug.dart b/app/lib/common/models/drug/drug.dart index 2c758a82..b5a4cb7e 100644 --- a/app/lib/common/models/drug/drug.dart +++ b/app/lib/common/models/drug/drug.dart @@ -80,8 +80,8 @@ extension DrugExtension on Drug { Guideline? get userGuideline => guidelines.firstOrNullWhere( (guideline) => guideline.lookupkey.all( - (geneSymbol, geneResults) => - geneResults.contains(UserData.lookupFor(geneSymbol, drug: name)) + (gene, geneResults) => + geneResults.contains(UserData.lookupFor(gene, drug: name)) ), ); diff --git a/app/lib/common/models/drug/drug_inhibitors.dart b/app/lib/common/models/drug/drug_inhibitors.dart index 3f29b1d3..6a470d03 100644 --- a/app/lib/common/models/drug/drug_inhibitors.dart +++ b/app/lib/common/models/drug/drug_inhibitors.dart @@ -37,9 +37,9 @@ final inhibitableGenes = List.from({ }); final _drugInhibitorsPerGene = { - for (final geneSymbol in inhibitableGenes) geneSymbol: [ - ...?strongDrugInhibitors[geneSymbol]?.keys, - ...?moderateDrugInhibitors[geneSymbol]?.keys, + for (final gene in inhibitableGenes) gene: [ + ...?strongDrugInhibitors[gene]?.keys, + ...?moderateDrugInhibitors[gene]?.keys, ] }; @@ -62,9 +62,9 @@ bool isModerateInhibitor(String drugName) { bool isInhibitor(String drugName) { var drugIsInhibitor = false; - for (final geneSymbol in _drugInhibitorsPerGene.keys) { - final influencingDrugs = _drugInhibitorsPerGene[geneSymbol]; - final originalLookup = UserData.lookupFor(geneSymbol, drug: drugName, useOverwrite: false); + for (final gene in _drugInhibitorsPerGene.keys) { + final influencingDrugs = _drugInhibitorsPerGene[gene]; + final originalLookup = UserData.lookupFor(gene, drug: drugName, useOverwrite: false); if (influencingDrugs!.contains(drugName) && originalLookup != '0.0') { drugIsInhibitor = true; break; @@ -79,8 +79,8 @@ List inhibitedGenes(Drug drug) { ).toList(); } -List inhibitorsFor(String geneSymbol) { - return _drugInhibitorsPerGene[geneSymbol] ?? []; +List inhibitorsFor(String gene) { + return _drugInhibitorsPerGene[gene] ?? []; } bool canBeInhibited(CpicLookup phenotype) { diff --git a/app/lib/common/utilities/genome_data.dart b/app/lib/common/utilities/genome_data.dart index 0881bac5..3542093a 100644 --- a/app/lib/common/utilities/genome_data.dart +++ b/app/lib/common/utilities/genome_data.dart @@ -56,7 +56,7 @@ Future fetchAndSaveLookups() async { // use a HashMap for better time complexity final lookupsHashMap = HashMap.fromIterable( lookups, - key: (lookup) => '${lookup.geneSymbol}__${lookup.genotype}', + key: (lookup) => '${lookup.gene}__${lookup.genotype}', value: (lookup) => lookup, ); // ignore: omit_local_variable_types diff --git a/app/lib/drug/widgets/annotation_cards/guideline.dart b/app/lib/drug/widgets/annotation_cards/guideline.dart index 32839d61..c049f5b6 100644 --- a/app/lib/drug/widgets/annotation_cards/guideline.dart +++ b/app/lib/drug/widgets/annotation_cards/guideline.dart @@ -164,9 +164,9 @@ class GuidelineAnnotationCard extends StatelessWidget { } else { final genes = drug.userGuideline?.lookupkey.keys ?? drug.guidelines.first.lookupkey.keys; - final geneDescriptions = genes.map((geneSymbol) { + final geneDescriptions = genes.map((gene) { final phenotypeInformation = UserData.phenotypeInformationFor( - geneSymbol, + gene, context, drug: drug.name, ); @@ -174,7 +174,7 @@ class GuidelineAnnotationCard extends StatelessWidget { if (phenotypeInformation.adaptionText.isNotNullOrBlank) { description = '$description (${phenotypeInformation.adaptionText})'; } - return TableRowDefinition(geneSymbol, description); + return TableRowDefinition(gene, description); }); return buildTable(geneDescriptions.toList()); } diff --git a/app/lib/l10n/app_en.arb b/app/lib/l10n/app_en.arb index 74669a96..b5e5f999 100644 --- a/app/lib/l10n/app_en.arb +++ b/app/lib/l10n/app_en.arb @@ -81,14 +81,14 @@ } }, "drugs_page_disclaimer": "Please note the information shown on this page is ONLY based on your DNA and relevant current medications. Other important factors like weight, age, pre-existing conditions, and drug interactions are not considered.", - "drugs_page_is_inhibitor": "Taking {drugName} can influence your results for the following gene(s): {geneSymbols}", + "drugs_page_is_inhibitor": "Taking {drugName} can influence your results for the following gene(s): {genes}", "@drugs_page_is_inhibitor": { "placeholders": { "drugName": { "type": "String", "example": "bupropion" }, - "geneSymbols": { + "genes": { "type": "String", "example": "CYP2D6, CYP2C19" } @@ -220,28 +220,28 @@ } }, - "gene_page_headline": "{geneSymbol} report", + "gene_page_headline": "{gene} report", "@gene_page_headline": { "placeholders": { - "geneSymbol": { + "gene": { "type": "String", "example": "CYP2D6" } } }, - "gene_page_your_variant": "Your {geneSymbol} variant", + "gene_page_your_variant": "Your {gene} variant", "@gene_page_your_variant": { "placeholders": { - "geneSymbol": { + "gene": { "type": "String", "example": "CYP2D6" } } }, - "gene_page_name_tooltip": "{geneSymbol} is the name of a gene.", + "gene_page_name_tooltip": "{gene} is the name of a gene.", "@gene_page_name_tooltip": { "placeholders": { - "geneSymbol": { + "gene": { "type": "String", "example": "CYP2D6" } @@ -285,14 +285,14 @@ } } }, - "pdf_guideline_gene_implication": "{guidelineSource} implication for {geneSymbol}", + "pdf_guideline_gene_implication": "{guidelineSource} implication for {gene}", "@pdf_guideline_gene_implication": { "placeholders": { "guidelineSource": { "type": "String", "example": "CPIC" }, - "geneSymbol": { + "gene": { "type": "String", "example": "CYP2D6" } diff --git a/app/lib/report/pages/report.dart b/app/lib/report/pages/report.dart index 9b040cde..01108c04 100644 --- a/app/lib/report/pages/report.dart +++ b/app/lib/report/pages/report.dart @@ -16,14 +16,14 @@ class ReportPage extends StatelessWidget { final hasActiveInhibitors = activeDrugs.names.any(isInhibitor); final notTestedString = context.l10n.general_not_tested; final userPhenotypes = CachedDrugs.instance.allGuidelineGenes.map( - (geneSymbol) => UserData.instance.lookups![geneSymbol] ?? + (gene) => UserData.instance.lookups![gene] ?? // Add CpicLookup for unmatched lookup CpicLookup( - gene: geneSymbol, + gene: gene, // phenotype will be overwritten with phenotype from lab or inhibited // phenotype using PhenotypeInformation in GeneCard and GenePage phenotype: notTestedString, - genotype: UserData.instance.diplotypes?[geneSymbol]?.genotype ?? + genotype: UserData.instance.diplotypes?[gene]?.genotype ?? notTestedString, lookupkey: notTestedString )