use of com.adobe.target.delivery.v1.model.Address in project data-transfer-project by google.
the class GoogleContactsImportConversionTest method testConversionToGoogleAddresses.
@Test
public void testConversionToGoogleAddresses() {
// Set up vCard with a primary address and a secondary address
String primaryStreet = "221B Baker St";
String primaryLocality = "London";
ezvcard.property.Address primaryAddress = new ezvcard.property.Address();
primaryAddress.setStreetAddress(primaryStreet);
primaryAddress.setLocality(primaryLocality);
primaryAddress.setPref(VCARD_PRIMARY_PREF);
String altStreet = "42 Wallaby Way";
String altLocality = "Sydney";
ezvcard.property.Address altAddress = new ezvcard.property.Address();
altAddress.setStreetAddress(altStreet);
altAddress.setLocality(altLocality);
altAddress.setPref(VCARD_PRIMARY_PREF + 1);
// Add addresses to vCard. Order shouldn't matter.
VCard vCard = defaultVCard;
vCard.addAddress(primaryAddress);
vCard.addAddress(altAddress);
// Run test
Person person = GoogleContactsImporter.convert(vCard);
// Check results
// Check correct number of addresses
assertThat(person.getAddresses().size()).isEqualTo(2);
// Check primary address
List<Address> actualPrimaryAddresses = person.getAddresses().stream().filter(a -> a.getMetadata().getPrimary()).collect(Collectors.toList());
List<String> actualPrimaryAddressStreets = getValuesFromFields(actualPrimaryAddresses, Address::getStreetAddress);
assertThat(actualPrimaryAddressStreets).containsExactly(primaryStreet);
// Check secondary address
List<Address> actualSecondaryAddresses = person.getAddresses().stream().filter(a -> !a.getMetadata().getPrimary()).collect(Collectors.toList());
List<String> actualSecondaryAddressStreets = getValuesFromFields(actualSecondaryAddresses, Address::getStreetAddress);
assertThat(actualSecondaryAddressStreets).containsExactly(altStreet);
}
use of com.adobe.target.delivery.v1.model.Address in project wildfly-camel by wildfly-extras.
the class FhirJsonIntegrationTest method createPatient.
private Patient createPatient() {
Patient patient = new Patient();
patient.addName(new HumanName().addGiven("Sherlock").setFamily("Holmes")).addAddress(new Address().addLine("221b Baker St, Marylebone, London NW1 6XE, UK"));
return patient;
}
use of com.adobe.target.delivery.v1.model.Address in project data-transfer-project by google.
the class GoogleContactsImportConversionTest method testConversionToGoogleAddresses.
@Test
public void testConversionToGoogleAddresses() {
// Set up vCard with a primary address and a secondary address
String primaryStreet = "221B Baker St";
String primaryLocality = "London";
ezvcard.property.Address primaryAddress = new ezvcard.property.Address();
primaryAddress.setStreetAddress(primaryStreet);
primaryAddress.setLocality(primaryLocality);
primaryAddress.setPref(VCARD_PRIMARY_PREF);
String altStreet = "42 Wallaby Way";
String altLocality = "Sydney";
ezvcard.property.Address altAddress = new ezvcard.property.Address();
altAddress.setStreetAddress(altStreet);
altAddress.setLocality(altLocality);
altAddress.setPref(VCARD_PRIMARY_PREF + 1);
// Add addresses to vCard. Order shouldn't matter.
VCard vCard = defaultVCard;
vCard.addAddress(primaryAddress);
vCard.addAddress(altAddress);
// Run test
Person person = GoogleContactsImporter.convert(vCard);
// Check results
// Check correct number of addresses
assertThat(person.getAddresses().size()).isEqualTo(2);
// Check primary address
List<Address> actualPrimaryAddresses = person.getAddresses().stream().filter(a -> a.getMetadata().getPrimary()).collect(Collectors.toList());
List<String> actualPrimaryAddressStreets = getValuesFromFields(actualPrimaryAddresses, Address::getStreetAddress);
assertThat(actualPrimaryAddressStreets).containsExactly(primaryStreet);
// Check secondary address
List<Address> actualSecondaryAddresses = person.getAddresses().stream().filter(a -> !a.getMetadata().getPrimary()).collect(Collectors.toList());
List<String> actualSecondaryAddressStreets = getValuesFromFields(actualSecondaryAddresses, Address::getStreetAddress);
assertThat(actualSecondaryAddressStreets).containsExactly(altStreet);
}
use of com.adobe.target.delivery.v1.model.Address in project synthea by synthetichealth.
the class FhirR4 method provider.
/**
* Map the Provider into a FHIR Organization resource, and add it to the given Bundle.
*
* @param rand Source of randomness to use when generating ids etc
* @param bundle The Bundle to add to
* @param provider The Provider
* @return The added Entry
*/
protected static BundleEntryComponent provider(RandomNumberGenerator rand, Bundle bundle, Provider provider) {
Organization organizationResource = new Organization();
if (USE_US_CORE_IG) {
Meta meta = new Meta();
meta.addProfile("http://hl7.org/fhir/us/core/StructureDefinition/us-core-organization");
organizationResource.setMeta(meta);
} else if (USE_SHR_EXTENSIONS) {
organizationResource.setMeta(new Meta().addProfile(SHR_EXT + "shr-entity-Organization"));
organizationResource.addIdentifier().setSystem("urn:ietf:rfc:3986").setValue("urn:uuid" + provider.getResourceID());
organizationResource.addContact().setName(new HumanName().setText("Synthetic Provider"));
}
List<CodeableConcept> organizationType = new ArrayList<CodeableConcept>();
organizationType.add(mapCodeToCodeableConcept(new Code("http://terminology.hl7.org/CodeSystem/organization-type", "prov", "Healthcare Provider"), "http://terminology.hl7.org/CodeSystem/organization-type"));
organizationResource.addIdentifier().setSystem(SYNTHEA_IDENTIFIER).setValue((String) provider.getResourceID());
organizationResource.setActive(true);
organizationResource.setId(provider.getResourceID());
organizationResource.setName(provider.name);
organizationResource.setType(organizationType);
Address address = new Address().addLine(provider.address).setCity(provider.city).setPostalCode(provider.zip).setState(provider.state);
if (COUNTRY_CODE != null) {
address.setCountry(COUNTRY_CODE);
}
organizationResource.addAddress(address);
if (provider.phone != null && !provider.phone.isEmpty()) {
ContactPoint contactPoint = new ContactPoint().setSystem(ContactPointSystem.PHONE).setValue(provider.phone);
organizationResource.addTelecom(contactPoint);
} else if (USE_US_CORE_IG) {
ContactPoint contactPoint = new ContactPoint().setSystem(ContactPointSystem.PHONE).setValue("(555) 555-5555");
organizationResource.addTelecom(contactPoint);
}
org.hl7.fhir.r4.model.Location location = null;
if (USE_US_CORE_IG) {
location = providerLocation(rand, bundle, provider);
}
BundleEntryComponent entry = newEntry(bundle, organizationResource, provider.getResourceID());
// add location to bundle *after* organization to ensure no forward reference
if (location != null) {
newEntry(bundle, location, provider.getResourceLocationID());
}
return entry;
}
use of com.adobe.target.delivery.v1.model.Address in project synthea by synthetichealth.
the class FhirStu3 method practitioner.
/**
* Map the clinician into a FHIR Practitioner resource, and add it to the given Bundle.
* @param bundle The Bundle to add to
* @param clinician The clinician
* @return The added Entry
*/
protected static BundleEntryComponent practitioner(Bundle bundle, Clinician clinician) {
Practitioner practitionerResource = new Practitioner();
practitionerResource.addIdentifier().setSystem("http://hl7.org/fhir/sid/us-npi").setValue(clinician.npi);
practitionerResource.setActive(true);
practitionerResource.addName().setFamily((String) clinician.attributes.get(Clinician.LAST_NAME)).addGiven((String) clinician.attributes.get(Clinician.FIRST_NAME)).addPrefix((String) clinician.attributes.get(Clinician.NAME_PREFIX));
Address address = new Address().addLine((String) clinician.attributes.get(Clinician.ADDRESS)).setCity((String) clinician.attributes.get(Clinician.CITY)).setPostalCode((String) clinician.attributes.get(Clinician.ZIP)).setState((String) clinician.attributes.get(Clinician.STATE));
if (COUNTRY_CODE != null) {
address.setCountry(COUNTRY_CODE);
}
practitionerResource.addAddress(address);
if (clinician.attributes.get(Person.GENDER).equals("M")) {
practitionerResource.setGender(AdministrativeGender.MALE);
} else if (clinician.attributes.get(Person.GENDER).equals("F")) {
practitionerResource.setGender(AdministrativeGender.FEMALE);
}
return newEntry(bundle, practitionerResource, clinician.getResourceID());
}
Aggregations