Skip to content

Commit

Permalink
Cnft1 3377 UI new patient extended default value and first option for…
Browse files Browse the repository at this point in the history
… country should be united states of america (#2128)

* Add initial value of united states to extended address field

* reorder United States to be at the top in country code util

* explicitly add US before applying ordering to the rest of the countries

* try and add US to the beginning of the array list

* import arraylist and list

* swap key val

* put United States back in Country Code Util because it was not causing the duplication issue

* exclude US from fetched coded values
  • Loading branch information
benlam-ignw authored Dec 20, 2024
1 parent 7b21215 commit 4b001bf
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package gov.cdc.nbs.codes;

import java.util.ArrayList;
import java.util.List;
import com.querydsl.core.Tuple;
import com.querydsl.core.types.Order;
import com.querydsl.core.types.OrderSpecifier;
Expand All @@ -21,14 +23,23 @@ class CountryCodedValueFinder {
}

Collection<CodedValue> all() {
return this.factory.select(
values.id,
values.codeDescTxt).from(values)
.orderBy(new OrderSpecifier<>(Order.ASC, values.codeDescTxt))
.fetch()
.stream()
.map(this::map)
.toList();
List<CodedValue> result = new ArrayList<>();

result.add(new CodedValue("840", "United States"));

List<CodedValue> fetchedValues = this.factory.select(
values.id,
values.codeDescTxt)
.from(values)
.where(values.codeDescTxt.ne("United States"))
.orderBy(new OrderSpecifier<>(Order.ASC, values.codeDescTxt))
.fetch()
.stream()
.map(this::map)
.toList();

result.addAll(fetchedValues);
return result;
}

private CodedValue map(final Tuple tuple) {
Expand Down
5 changes: 4 additions & 1 deletion apps/modernization-ui/src/apps/patient/data/address/entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ const initial = (asOf: string = today()): Partial<AddressEntry> => ({
state: undefined,
zipcode: '',
county: undefined,
country: undefined,
country: {
value: '840',
name: 'United States'
},
censusTract: '',
comment: ''
});
Expand Down

0 comments on commit 4b001bf

Please sign in to comment.