Skip to content

Commit

Permalink
feat(#684): rename geneSymbol in CpicLookup to gene
Browse files Browse the repository at this point in the history
  • Loading branch information
tamslo committed Jan 3, 2024
1 parent 4c5eab9 commit 8423f3e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion app/integration_test/drugs_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void main() {
]);
UserData.instance.lookups = {
'CYP2C9': CpicLookup(
geneSymbol: 'CYP2C9',
gene: 'CYP2C9',
phenotype: 'Normal Metabolizer',
genotype: '*1/*1',
lookupkey: '2')
Expand Down
2 changes: 1 addition & 1 deletion app/lib/common/models/drug/drug_inhibitors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ List<String> inhibitorsFor(String geneSymbol) {
}

bool canBeInhibited(CpicLookup phenotype) {
return inhibitableGenes.contains(phenotype.geneSymbol) &&
return inhibitableGenes.contains(phenotype.gene) &&
phenotype.lookupkey != '0.0';
}
4 changes: 2 additions & 2 deletions app/lib/common/models/userdata/cpic_lookup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ part 'cpic_lookup.g.dart';
@JsonSerializable()
class CpicLookup{
CpicLookup({
required this.geneSymbol,
required this.gene,
required this.phenotype,
required this.genotype,
required this.lookupkey,
Expand All @@ -21,7 +21,7 @@ class CpicLookup{

@HiveField(0)
@JsonKey(name: 'genesymbol')
String geneSymbol;
String gene;

@HiveField(1)
@JsonKey(name: 'diplotype')
Expand Down
12 changes: 6 additions & 6 deletions app/lib/report/pages/gene.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import '../../drug/widgets/module.dart';
class GenePage extends HookWidget {
GenePage(this.phenotype)
: cubit = DrugListCubit(
initialFilter: FilterState.forGene(phenotype.geneSymbol),
initialFilter: FilterState.forGene(phenotype.gene),
);

final CpicLookup phenotype;
Expand All @@ -20,7 +20,7 @@ class GenePage extends HookWidget {
create: (context) => cubit,
child: BlocBuilder<DrugListCubit, DrugListState>(
builder: (context, state) => pageScaffold(
title: context.l10n.gene_page_headline(phenotype.geneSymbol),
title: context.l10n.gene_page_headline(phenotype.gene),
body: [
Padding(
padding: EdgeInsets.symmetric(
Expand All @@ -31,9 +31,9 @@ class GenePage extends HookWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SubHeader(
context.l10n.gene_page_your_variant(phenotype.geneSymbol),
context.l10n.gene_page_your_variant(phenotype.gene),
tooltip: context.l10n
.gene_page_name_tooltip(phenotype.geneSymbol),
.gene_page_name_tooltip(phenotype.gene),
),
SizedBox(height: PharMeTheme.smallToMediumSpace),
RoundedCard(
Expand All @@ -58,7 +58,7 @@ class GenePage extends HookWidget {
if (canBeInhibited(phenotype))
...buildDrugInteractionInfo(
context,
phenotype.geneSymbol,
phenotype.gene,
),
],
)),
Expand All @@ -80,7 +80,7 @@ class GenePage extends HookWidget {

TableRow _buildPhenotypeRow(BuildContext context) {
final phenotypeInformation = UserData.phenotypeInformationFor(
phenotype.geneSymbol,
phenotype.gene,
context,
);
final phenotypeText = phenotypeInformation.adaptionText.isNotNullOrBlank
Expand Down
12 changes: 6 additions & 6 deletions app/lib/report/pages/report.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ class ReportPage extends StatelessWidget {
(geneSymbol) => UserData.instance.lookups![geneSymbol] ??
// Add CpicLookup for unmatched lookup
CpicLookup(
geneSymbol: geneSymbol,
gene: geneSymbol,
// 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 ??
notTestedString,
lookupkey: notTestedString
)
).sortedBy((phenotype) => phenotype.geneSymbol);
).sortedBy((phenotype) => phenotype.gene);
return PopScope(
canPop: false,
child: unscrollablePageScaffold(
Expand All @@ -38,7 +38,7 @@ class ReportPage extends StatelessWidget {
scrollList(
userPhenotypes.map((phenotype) => GeneCard(
phenotype,
key: Key('gene-card-${phenotype.geneSymbol}')
key: Key('gene-card-${phenotype.gene}')
)).toList(),
),
if (hasActiveInhibitors) PageIndicatorExplanation(
Expand All @@ -62,14 +62,14 @@ class GeneCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
final phenotypeInformation = UserData.phenotypeInformationFor(
phenotype.geneSymbol,
phenotype.gene,
context,
);
final phenotypeText = phenotypeInformation.adaptionText.isNullOrBlank
? phenotypeInformation.phenotype
: '${phenotypeInformation.phenotype}$drugInteractionIndicator';
final affectedDrugs = CachedDrugs.instance.drugs?.filter(
(drug) => drug.guidelineGenes.contains(phenotype.geneSymbol)
(drug) => drug.guidelineGenes.contains(phenotype.gene)
) ?? [];
final warningLevelIndicators = WarningLevel.values.map(
(warningLevel) {
Expand Down Expand Up @@ -106,7 +106,7 @@ class GeneCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
phenotype.geneSymbol,
phenotype.gene,
style: PharMeTheme.textTheme.titleMedium
),
SizedBox(height: 8),
Expand Down

0 comments on commit 8423f3e

Please sign in to comment.