use of com.adobe.target.delivery.v1.model.Address in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7AddressFHIRConversionTest method patient_address_district_and_multiple_address_conversion_test.
@Test
// See Hl7RelatedGeneralUtils.getAddressDistrict for details on when district and county apply.
void patient_address_district_and_multiple_address_conversion_test() {
// When there is no county XAD.9 in the address, and there is only one address, use the PID county.
String patientSingleAddressYesAddressCountyNoPatientCounty = "MSH|^~\\&|MIICEHRApplication|MIIC|MIIC|MIIC|201705130822||VXU^V04^VXU_V04|test1100|P|2.5.1|||AL|AL|||||Z22^CDCPHINVS|^^^^^MIIC^SR^^^MIIC|MIIC\n" + "PID|1||12345678^^^^MR|ALTID|Moose^Mickey^J^III^^^|Mother^Micky|20060504|M|Alias^Alias|2106-3^White^ HL70005|111 1st Street^Suite #1^Minneapolis^MN^11111^USA^H^^AdrC^^^20011120&20081120^^^^Y^Z^V^c/o Pluto19||^PRN^^^PH^555^5555555|^PRN^^^PH^555^666666|english|married|bhuddist|1234567_account|111-22-3333|||2186-5^not Hispanic or Latino^CDCREC|Born in USA|||USA||||\n";
String patientSingleAddressNoAddressCountyNoPatientCounty = "MSH|^~\\&|MIICEHRApplication|MIIC|MIIC|MIIC|201705130822||VXU^V04^VXU_V04|test1100|P|2.5.1|||AL|AL|||||Z22^CDCPHINVS|^^^^^MIIC^SR^^^MIIC|MIIC\n" + "PID|1||12345678^^^^MR|ALTID|Moose^Mickey^J^III^^^|Mother^Micky|20060504|M|Alias^Alias|2106-3^White^ HL70005|111 1st Street^Suite #1^Minneapolis^MN^11111^USA^H^^^^^20011120&20081120^^^^Y^Z^V^c/o Pluto19||^PRN^^^PH^555^5555555|^PRN^^^PH^555^666666|english|married|bhuddist|1234567_account|111-22-3333|||2186-5^not Hispanic or Latino^CDCREC|Born in USA|||USA||||\n";
String patientSingleAddressYesAddressCountyYesPatientCounty = "MSH|^~\\&|MIICEHRApplication|MIIC|MIIC|MIIC|201705130822||VXU^V04^VXU_V04|test1100|P|2.5.1|||AL|AL|||||Z22^CDCPHINVS|^^^^^MIIC^SR^^^MIIC|MIIC\n" + "PID|1||12345678^^^^MR|ALTID|Moose^Mickey^J^III^^^|Mother^Micky|20060504|M|Alias^Alias|2106-3^White^ HL70005|111 1st Street^Suite #1^Minneapolis^MN^11111^USA^H^^AdrC^^^20011120&20081120^^^^Y^Z^V^c/o Pluto19|PatC|^PRN^^^PH^555^5555555|^PRN^^^PH^555^666666|english|married|bhuddist|1234567_account|111-22-3333|||2186-5^not Hispanic or Latino^CDCREC|Born in USA|||USA||||\n";
String patientSingleAddressNoAddressCountyYesPatientCounty = "MSH|^~\\&|MIICEHRApplication|MIIC|MIIC|MIIC|201705130822||VXU^V04^VXU_V04|test1100|P|2.5.1|||AL|AL|||||Z22^CDCPHINVS|^^^^^MIIC^SR^^^MIIC|MIIC\n" + "PID|1||12345678^^^^MR|ALTID|Moose^Mickey^J^III^^^|Mother^Micky|20060504|M|Alias^Alias|2106-3^White^ HL70005|111 1st Street^Suite #1^Minneapolis^MN^11111^USA^H^^^^^20011120&20081120^^^^Y^Z^V^c/o Pluto19|PatC|^PRN^^^PH^555^5555555|^PRN^^^PH^555^666666|english|married|bhuddist|1234567_account|111-22-3333|||2186-5^not Hispanic or Latino^CDCREC|Born in USA|||USA||||\n";
String patientMultipleAddressOneAddressCountyYesPatientCounty = "MSH|^~\\&|MIICEHRApplication|MIIC|MIIC|MIIC|201705130822||VXU^V04^VXU_V04|test1100|P|2.5.1|||AL|AL|||||Z22^CDCPHINVS|^^^^^MIIC^SR^^^MIIC|MIIC\n" + "PID|1||12345678^^^^MR|ALTID|Moose^Mickey^J^III^^^|Mother^Micky|20060504|M|Alias^Alias|2106-3^White^ HL70005|111 1st Street^Suite #1^Minneapolis^MN^11111^USA^H^^AdrC^^^20011120&20081120^^^^Y^Z^V^c/o Pluto19~222 2nd Ave^Suite #2^Salt Lake City^Utah^22222|PatC|^PRN^^^PH^555^5555555|^PRN^^^PH^555^666666|english|married|bhuddist|1234567_account|111-22-3333|||2186-5^not Hispanic or Latino^CDCREC|Born in USA|||USA||||\n";
// If address county, ignore patient county
Patient patient = PatientUtils.createPatientFromHl7Segment(ftv, patientSingleAddressYesAddressCountyNoPatientCounty);
assertThat(patient.hasAddress()).isTrue();
List<Address> addresses = patient.getAddress();
assertThat(addresses.size()).isEqualTo(1);
Address address = addresses.get(0);
assertThat(address.getDistrict()).isEqualTo("AdrC");
// If no address county, and no patient county, = no county
patient = PatientUtils.createPatientFromHl7Segment(ftv, patientSingleAddressNoAddressCountyNoPatientCounty);
assertThat(patient.hasAddress()).isTrue();
addresses = patient.getAddress();
assertThat(addresses.size()).isEqualTo(1);
address = addresses.get(0);
assertThat(address.getDistrict()).isNull();
// If address county, ignore patient county
patient = PatientUtils.createPatientFromHl7Segment(ftv, patientSingleAddressYesAddressCountyYesPatientCounty);
assertThat(patient.hasAddress()).isTrue();
addresses = patient.getAddress();
assertThat(addresses.size()).isEqualTo(1);
address = addresses.get(0);
assertThat(address.getDistrict()).isEqualTo("AdrC");
// If no address county, a patient county is present, and EXACTLY one (repeatable) address then Patient County
patient = PatientUtils.createPatientFromHl7Segment(ftv, patientSingleAddressNoAddressCountyYesPatientCounty);
assertThat(patient.hasAddress()).isTrue();
addresses = patient.getAddress();
assertThat(addresses.size()).isEqualTo(1);
address = addresses.get(0);
assertThat(address.getDistrict()).isEqualTo("PatC");
// If more than one address, ignore the patient county and use only the address county, if it is present
patient = PatientUtils.createPatientFromHl7Segment(ftv, patientMultipleAddressOneAddressCountyYesPatientCounty);
assertThat(patient.hasAddress()).isTrue();
addresses = patient.getAddress();
assertThat(addresses.size()).isEqualTo(2);
address = addresses.get(0);
// Address 1 has a county
assertThat(address.getDistrict()).isEqualTo("AdrC");
address = addresses.get(1);
// Address 2 has no county; result is correctly NOT "PatC"
assertThat(address.getDistrict()).isNull();
// Check a few other things about the addresses to confirm they are different and correct
address = addresses.get(0);
assertThat(address.getCity()).isEqualTo("Minneapolis");
assertThat(address.getState()).isEqualTo("MN");
assertThat(address.getCountry()).isEqualTo("USA");
assertThat(address.getPostalCode()).isEqualTo("11111");
address = addresses.get(1);
assertThat(address.getCity()).isEqualTo("Salt Lake City");
assertThat(address.getState()).isEqualTo("Utah");
assertThat(address.getCountry()).isNull();
assertThat(address.getPostalCode()).isEqualTo("22222");
}
use of com.adobe.target.delivery.v1.model.Address in project openmrs-module-fhir2 by openmrs.
the class FhirRelatedPersonServiceImplTest method setup.
@Before
public void setup() {
relatedPersonService = new FhirRelatedPersonServiceImpl() {
@Override
protected void validateObject(Relationship object) {
}
};
relatedPersonService.setDao(dao);
relatedPersonService.setTranslator(translator);
relatedPersonService.setSearchQuery(searchQuery);
relatedPersonService.setSearchQueryInclude(searchQueryInclude);
PersonName name = new PersonName();
name.setUuid(PERSON_NAME_UUID);
name.setGivenName(GIVEN_NAME);
name.setFamilyName(FAMILY_NAME);
PersonAddress address = new PersonAddress();
address.setCityVillage(CITY);
address.setStateProvince(STATE);
address.setPostalCode(POSTAL_CODE);
address.setCountry(COUNTRY);
person = new org.openmrs.Person();
person.setUuid(PERSON_UUID);
person.setGender("M");
person.addName(name);
relationship = new org.openmrs.Relationship();
relationship.setRelationshipId(1000);
relationship.setPersonA(person);
HumanName humanName = new HumanName();
humanName.addGiven(GIVEN_NAME);
humanName.setFamily(FAMILY_NAME);
humanName.setId(PERSON_NAME_UUID);
Address relatedPersonAddress = new Address();
relatedPersonAddress.setCity(CITY);
relatedPersonAddress.setState(STATE);
relatedPersonAddress.setPostalCode(POSTAL_CODE);
relatedPersonAddress.setCountry(COUNTRY);
relatedPerson = new RelatedPerson();
relatedPerson.addName(humanName);
relatedPerson.addAddress(relatedPersonAddress);
relatedPerson.setGender(Enumerations.AdministrativeGender.MALE);
}
use of com.adobe.target.delivery.v1.model.Address in project openmrs-module-fhir2 by openmrs.
the class FhirLocationServiceImplTest method setUp.
@Before
public void setUp() {
fhirLocationService = new FhirLocationServiceImpl() {
@Override
protected void validateObject(org.openmrs.Location object) {
}
};
fhirLocationService.setDao(locationDao);
fhirLocationService.setTranslator(locationTranslator);
fhirLocationService.setSearchQuery(searchQuery);
fhirLocationService.setSearchQueryInclude(searchQueryInclude);
location = new org.openmrs.Location();
location.setUuid(LOCATION_UUID);
location.setName(LOCATION_NAME);
location.setDescription(LOCATION_DESCRIPTION);
location.setDateCreated(new Date());
location.setRetired(false);
Set<LocationTag> locationTags = new HashSet<>();
locationTags.add(new LocationTag(LOGIN_LOCATION_TAG_NAME, LOGIN_LOCATION_TAG_DESCRIPTION));
location.setTags(locationTags);
fhirLocation = new Location();
fhirLocation.setId(LOCATION_UUID);
fhirLocation.setName(LOCATION_NAME);
fhirLocation.setDescription(LOCATION_DESCRIPTION);
Address address = new Address();
address.setCity(LOCATION_CITY);
address.setPostalCode(POSTAL_CODE);
address.setCountry(LOCATION_COUNTRY);
address.setState(LOCATION_STATE);
fhirLocation.setAddress(address);
}
use of com.adobe.target.delivery.v1.model.Address in project openmrs-module-fhir2 by openmrs.
the class LocationFhirResourceProviderTest method initLocation.
@Before
public void initLocation() {
Address address = new Address();
address.setCity(CITY);
address.setCountry(COUNTRY);
address.setState(STATE);
address.setPostalCode(POSTAL_CODE);
location = new Location();
location.setId(LOCATION_UUID);
location.setName(LOCATION_NAME);
location.setAddress(address);
location.getMeta().addTag(new Coding(FhirConstants.OPENMRS_FHIR_EXT_LOCATION_TAG, LOGIN_LOCATION_TAG_NAME, LOGIN_LOCATION_TAG_DESCRIPTION));
setProvenanceResources(location);
}
use of com.adobe.target.delivery.v1.model.Address in project openmrs-module-fhir2 by openmrs.
the class PersonAddressTranslatorImplTest method shouldConvertFhirCountryToCountry.
@Test
public void shouldConvertFhirCountryToCountry() {
Address address = new Address();
address.setCountry(COUNTRY);
assertThat(addressTranslator.toOpenmrsType(address).getCountry(), equalTo(COUNTRY));
}
Aggregations