Skip to content

Commit

Permalink
refactor(#706): use new phenoconversion description in PDF
Browse files Browse the repository at this point in the history
  • Loading branch information
tamslo committed Sep 5, 2024
1 parent 946d302 commit 96b6cfa
Show file tree
Hide file tree
Showing 7 changed files with 248 additions and 233 deletions.
12 changes: 12 additions & 0 deletions app/lib/common/models/drug/drug.dart
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,15 @@ extension CriticalDrugs on List<Drug> {
}).toList();
}
}

List<String> getDrugsWithBrandNames(List<String>? drugNames) {
return drugNames?.map(getDrugWithBrandNames).toList() ?? [];
}

String getDrugWithBrandNames(String drugName) {
final drug = CachedDrugs.instance.drugs!.firstWhere(
(drug) => drug.name == drugName
);
if (drug.annotations.brandNames.isEmpty) return drugName;
return '$drugName (${drug.annotations.brandNames.join(', ')})';
}
Loading

0 comments on commit 96b6cfa

Please sign in to comment.