Commit 79b4b8cd authored by Rob Tomsick's avatar Rob Tomsick

Add upper-casing, dedupe

parent 7056dae5
......@@ -34,6 +34,8 @@ In these cases, the non-proprietary name will be used instead when modeling
the product's components (see below.) If no non-proprietary name is available
(rare, but possible), the proprietary name will be used.
All Drug names will be normalized to uppercase.
Notes on Products/Doses
---
......
......@@ -154,12 +154,16 @@ implements DictionaryService
final Field<String> nf = field(name("name"), String.class);
List<Drug> drugs = this.ctx
.selectDistinct(nf).from(N_TABLE)
.where(nf.likeIgnoreCase(query + "%"))
final List<Drug> drugs = this.ctx
.select(nf)
.from(N_TABLE)
.where(nf.containsIgnoreCase(query))
.orderBy(nf.asc())
.limit(limit)
.fetch(r -> new Drug(r.get(nf)));
.fetch(r -> new Drug(r.get(nf).toUpperCase()))
.stream()
.distinct()
.collect(Collectors.toCollection(ArrayList :: new));
drugs.sort(comparatorFor(query, d -> d.canonicalName()));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment