Skip to content

Commit

Permalink
feat(app): use different guideline tooltip wording for 'not tested' o…
Browse files Browse the repository at this point in the history
…n drug page
  • Loading branch information
tamslo committed Feb 28, 2024
1 parent 3057181 commit 9326faf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
14 changes: 9 additions & 5 deletions app/lib/common/models/userdata/genotype_result.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,13 @@ class GenotypeResult implements Genotype {
}

extension FindGenotypeResultByKey on Map<String, GenotypeResult> {
bool isMissing(String genotypeKey) => this[genotypeKey] == null;

GenotypeResult findOrMissing(String genotypeKey, BuildContext context) =>
this[genotypeKey] ?? GenotypeResult.missingResult(
GenotypeKey.extractGene(genotypeKey),
context,
);
}
isMissing(genotypeKey)
? GenotypeResult.missingResult(
GenotypeKey.extractGene(genotypeKey),
context,
)
: this[genotypeKey]!;
}
10 changes: 8 additions & 2 deletions app/lib/drug/widgets/annotation_cards/guideline.dart
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,20 @@ class GuidelineAnnotationCard extends StatelessWidget {

String _buildGuidelineTooltipText(BuildContext context) {
final actualTooltip = drug.userGuideline != null
// Case 1: a guideline is present
? context.l10n.drugs_page_tooltip_guideline(
drug.userGuideline!.externalData.first.source
)
: drug.userOrFirstGuideline != null
// Guideline for drug is present but not for genotype
? context.l10n.drugs_page_tooltip_missing_guideline_for_drug_or_genotype(
// Case 2: a guideline for the drug is present but not for the genotype
? drug.guidelineGenotypes.all(UserData.instance.genotypeResults!.isMissing)
// Case 2.1: all genes are not tested
? context.l10n.drugs_page_tooltip_missing_guideline_not_tested
// Case 2.2: at least some genes tested
: context.l10n.drugs_page_tooltip_missing_guideline_for_drug_or_genotype(
context.l10n.drugs_page_tooltip_missing_genotype
)
// Case 3: the drug has no guidelines
: context.l10n.drugs_page_tooltip_missing_guideline_for_drug_or_genotype(
context.l10n.drugs_page_tooltip_missing_drug
);
Expand Down
1 change: 1 addition & 0 deletions app/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@
}
}
},
"drugs_page_tooltip_missing_guideline_not_tested": "Guidelines provide recommendations on which drugs to use based on your DNA. However, your genetic test result does not include the information needed to make such a recommendation for this drug.",

"drugs_page_tooltip_warfarin": "CPIC guidelines provide recommendations on which drugs to use based on your DNA. However, to calculate your warfarin dose, more information is needed.",
"drugs_page_implication_warfarin": "More information is needed to calculate your warfarin dose.",
Expand Down

0 comments on commit 9326faf

Please sign in to comment.