Skip to content

Commit

Permalink
feat(#684): use gene instead of geneSymbol everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
tamslo committed Jan 3, 2024
1 parent 8423f3e commit 6269e0c
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 27 deletions.
4 changes: 2 additions & 2 deletions app/lib/common/models/drug/drug.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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))
),
);

Expand Down
16 changes: 8 additions & 8 deletions app/lib/common/models/drug/drug_inhibitors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ final inhibitableGenes = List<String>.from(<String>{
});

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,
]
};

Expand All @@ -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;
Expand All @@ -79,8 +79,8 @@ List<String> inhibitedGenes(Drug drug) {
).toList();
}

List<String> inhibitorsFor(String geneSymbol) {
return _drugInhibitorsPerGene[geneSymbol] ?? [];
List<String> inhibitorsFor(String gene) {
return _drugInhibitorsPerGene[gene] ?? [];
}

bool canBeInhibited(CpicLookup phenotype) {
Expand Down
2 changes: 1 addition & 1 deletion app/lib/common/utilities/genome_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Future<void> fetchAndSaveLookups() async {
// use a HashMap for better time complexity
final lookupsHashMap = HashMap<String, CpicLookup>.fromIterable(
lookups,
key: (lookup) => '${lookup.geneSymbol}__${lookup.genotype}',
key: (lookup) => '${lookup.gene}__${lookup.genotype}',
value: (lookup) => lookup,
);
// ignore: omit_local_variable_types
Expand Down
6 changes: 3 additions & 3 deletions app/lib/drug/widgets/annotation_cards/guideline.dart
Original file line number Diff line number Diff line change
Expand Up @@ -164,17 +164,17 @@ 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,
);
var description = phenotypeInformation.phenotype;
if (phenotypeInformation.adaptionText.isNotNullOrBlank) {
description = '$description (${phenotypeInformation.adaptionText})';
}
return TableRowDefinition(geneSymbol, description);
return TableRowDefinition(gene, description);
});
return buildTable(geneDescriptions.toList());
}
Expand Down
20 changes: 10 additions & 10 deletions app/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down Expand Up @@ -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"
}
Expand Down Expand Up @@ -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"
}
Expand Down
6 changes: 3 additions & 3 deletions app/lib/report/pages/report.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down

0 comments on commit 6269e0c

Please sign in to comment.