Skip to content

Commit

Permalink
test(app): add less complex any not handled fallback fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
tamslo committed Sep 20, 2024
1 parent 4cb24b0 commit 6f32805
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 4 deletions.
6 changes: 3 additions & 3 deletions app/integration_test/drugs_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:mocktail/mocktail.dart';
import 'package:provider/provider.dart';

import 'fixtures/drugs/with_any_fallback_guideline.dart';
import 'fixtures/drugs/with_multiple_any_other_fallback_guidelines.dart';
import 'fixtures/drugs/with_multiple_any_not_handled_fallback_guidelines.dart';
import 'fixtures/drugs/with_proper_guideline.dart';
import 'fixtures/drugs/without_guidelines.dart';
import 'fixtures/set_user_data_for_drug.dart';
Expand Down Expand Up @@ -76,7 +76,7 @@ void main() {
);
});

testWidgets('test drug content with any other fallback guidelines', (tester) async {
testWidgets('test drug content with any not handled fallback guidelines', (tester) async {
// Work in progress; this should fail!
// Open TODOs:
// 1. Start with easy case (not pazopanib, add fixture for FDA w/ HLA-B)
Expand All @@ -97,7 +97,7 @@ void main() {
}
}
// await testPerGuideline(drugWithAnyOtherFallbackGuideline);
await testPerGuideline(drugWithMultipleAnyOtherFallbackGuidelines);
await testPerGuideline(drugWithMultipleAnyNotHandledFallbackGuidelines);
});
});
}
Expand Down
41 changes: 41 additions & 0 deletions app/integration_test/fixtures/drugs/drug.dart.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import 'package:app/common/models/drug/drug.dart';
import 'package:app/common/models/drug/guideline.dart';
import 'package:app/common/models/drug/warning_level.dart';

final drugWithNonCompilingPlaceholders = Drug(
id: null,
version: null,
name: null,
rxNorm: null,
annotations: DrugAnnotations(
drugclass: null,
indication: null,
brandNames: [null],
),
guidelines: [
Guideline(
id: null,
version: null,
lookupkey: {
null: [null],
},
externalData: [
GuidelineExtData(
source: null,
guidelineName: null,
guidelineUrl: null,
implications: {
null: null,
},
recommendation: null,
comments: null,
),
],
annotations: GuidelineAnnotations(
implication: null,
recommendation: null,
warningLevel: WarningLevel.null,
),
),
],
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import 'package:app/common/models/drug/drug.dart';
import 'package:app/common/models/drug/guideline.dart';
import 'package:app/common/models/drug/warning_level.dart';

final drugWithAnyNotHandledFallbackGuideline = Drug(
id: '6492f8e9918ddcae7349c30c',
version: 1,
name: 'aripiprazole',
rxNorm: 'RxNorm:89013',
annotations: DrugAnnotations(
drugclass: 'Anti-psychotic',
indication: 'Aripiprazole is used to manage and treat schizophrenia, major depressive disorder, and other psychotic disorders.',
brandNames: ['Abilify'],
),
guidelines: [
Guideline(
id: '6492f8e9918ddcae7349c304',
version: 1,
lookupkey: {
'CYP2D6': ['0.0'],
},
externalData: [
GuidelineExtData(
source: 'FDA',
guidelineName: 'Table of Pharmacogenetic Associations (Section 1)',
guidelineUrl: 'https://www.fda.gov/medical-devices/precision-medicine/table-pharmacogenetic-associations#section1',
implications: {
'CYP2D6': 'Results in higher systemic concentrations and higher adverse reaction risk. Dosage adjustment is recommended. Refer to FDA labeling for specific dosing recommendations.',
},
recommendation: 'Might be included in implication text (imported from FDA, source only states one text per guideline)',
comments: null,
),
],
annotations: GuidelineAnnotations(
implication: 'You break down aripiprazole slower than expected. You have an increased risk for side effects.',
recommendation: 'Aripiprazole may be used at a lower dose. Consult your pharmacist or doctor for more information.',
warningLevel: WarningLevel.yellow,
),
),
Guideline(
id: '66b50b2433cbe5c07ee311d7',
version: 1,
lookupkey: {
'CYP2D6': ['~'],
},
externalData: [
GuidelineExtData(
source: 'FDA',
guidelineName: 'Table of Pharmacogenetic Associations (Section 1)',
guidelineUrl: 'https://www.fda.gov/medical-devices/precision-medicine/table-pharmacogenetic-associations#section1',
implications: {
'CYP2D6': 'Standard procedure',
},
recommendation: 'Might be included in implication text (imported from FDA, source only states one text per guideline)',
comments: null,
),
],
annotations: GuidelineAnnotations(
implication: 'Your phenotype does not have a clinically significant influence on aripiprazole.',
recommendation: 'You can use aripiprazole at standard dose. Consult your pharmacist or doctor for more information.',
warningLevel: WarningLevel.green,
),
),
],
);
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:app/common/models/drug/drug.dart';
import 'package:app/common/models/drug/guideline.dart';
import 'package:app/common/models/drug/warning_level.dart';

final drugWithMultipleAnyOtherFallbackGuidelines = Drug(
final drugWithMultipleAnyNotHandledFallbackGuidelines = Drug(
id: '6686a865826414ec5b05c44e',
version: 1,
name: 'pazopanib',
Expand Down
1 change: 1 addition & 0 deletions pharme.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"settings": {
"typescript.preferences.importModuleSpecifier": "relative",
"cSpell.words": [
"Abilify",
"abiraterone",
"anni",
"atorvastatin",
Expand Down

0 comments on commit 6f32805

Please sign in to comment.