Search in sources :

Example 41 with Address

use of com.adobe.target.delivery.v1.model.Address in project eCRNow by drajer-health.

the class CdaHeaderGenerator method getAddressDetails.

public static List<Address> getAddressDetails() {
    List<Address> addrs = new ArrayList<>();
    Address addr = new Address();
    List<StringType> addrLine = new ArrayList<>();
    addrLine.add(new StringType("0987 Facility Drive"));
    addr.setLine(addrLine);
    addr.setCity("alt Lake City");
    addr.setState("UT");
    addr.setCountry("US");
    addr.setPostalCode("84101");
    addr.setUse(AddressUse.WORK);
    addrs.add(addr);
    return addrs;
}
Also used : Address(org.hl7.fhir.r4.model.Address) StringType(org.hl7.fhir.r4.model.StringType) ArrayList(java.util.ArrayList)

Example 42 with Address

use of com.adobe.target.delivery.v1.model.Address in project eCRNow by drajer-health.

the class CdaHeaderGenerator method getPractitionerXml.

public static String getPractitionerXml(Practitioner pr) {
    StringBuilder sb = new StringBuilder(500);
    if (pr != null) {
        Identifier npi = CdaFhirUtilities.getIdentifierForSystem(pr.getIdentifier(), CdaGeneratorConstants.FHIR_NPI_URL);
        if (npi != null) {
            sb.append(CdaGeneratorUtils.getXmlForII(CdaGeneratorConstants.AUTHOR_NPI_AA, npi.getValue()));
        } else {
            sb.append(CdaGeneratorUtils.getXmlForII(CdaGeneratorConstants.AUTHOR_NPI_AA));
        }
        sb.append(CdaFhirUtilities.getAddressXml(pr.getAddress()));
        sb.append(CdaFhirUtilities.getTelecomXml(pr.getTelecom(), false));
        sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.ASSIGNED_PERSON_EL_NAME));
        sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.NAME_EL_NAME));
        List<HumanName> hns = pr.getName();
        sb.append(CdaFhirUtilities.getNameXml(hns));
        sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.NAME_EL_NAME));
        sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.ASSIGNED_PERSON_EL_NAME));
    } else {
        sb.append(CdaGeneratorUtils.getXmlForII(CdaGeneratorConstants.AUTHOR_NPI_AA));
        List<Address> addrs = null;
        sb.append(CdaFhirUtilities.getAddressXml(addrs));
        List<ContactPoint> cps = null;
        sb.append(CdaFhirUtilities.getTelecomXml(cps, false));
        sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.ASSIGNED_PERSON_EL_NAME));
        sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.NAME_EL_NAME));
        List<HumanName> hns = null;
        sb.append(CdaFhirUtilities.getNameXml(hns));
        sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.NAME_EL_NAME));
        sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.ASSIGNED_PERSON_EL_NAME));
    }
    return sb.toString();
}
Also used : HumanName(org.hl7.fhir.r4.model.HumanName) ContactPoint(org.hl7.fhir.r4.model.ContactPoint) Identifier(org.hl7.fhir.r4.model.Identifier) Address(org.hl7.fhir.r4.model.Address)

Example 43 with Address

use of com.adobe.target.delivery.v1.model.Address in project eCRNow by drajer-health.

the class CdaFhirUtilitiesTest method testGetAddressXml.

@Test
public void testGetAddressXml() {
    List<Address> addrs = new ArrayList<Address>();
    Address ad1 = new Address();
    ad1.setUse(AddressUse.HOME);
    StringType line = new StringType();
    line.setValue("142 Example Drive");
    List<StringType> lines = new ArrayList<StringType>();
    lines.add(line);
    ad1.setLine(lines);
    ad1.setCity("Rockville");
    ad1.setState("MD");
    ad1.setPostalCode("20874");
    ad1.setCountry("US");
    addrs.add(ad1);
    String result = CdaFhirUtilities.getAddressXml(addrs);
    assertTrue(result.contains("142 Example Drive"));
    assertTrue(result.contains("20874"));
    assertTrue(result.contains("MD"));
    assertTrue(result.contains("Rockville"));
    addrs.clear();
    Address ad2 = new Address();
    ad1.setUse(AddressUse.BILLING);
    StringType line2 = new StringType();
    line2.setValue("142 Example Drive");
    List<StringType> lines2 = new ArrayList<StringType>();
    lines2.add(line2);
    ad2.setLine(lines2);
    ad2.setCity("Rockville");
    ad2.setState("MD");
    ad2.setPostalCode("20874");
    ad2.setCountry("US");
    addrs.add(ad2);
    String result2 = CdaFhirUtilities.getAddressXml(addrs);
    assertTrue(result2.contains("142 Example Drive"));
    assertTrue(result2.contains("20874"));
    assertTrue(result2.contains("MD"));
    assertTrue(result2.contains("Rockville"));
    addrs.clear();
    String result3 = CdaFhirUtilities.getAddressXml(addrs);
    assertTrue(result3.contains("nullFlavor=\"NI\""));
    addrs.clear();
    Address ad3 = new Address();
    StringType line3 = new StringType();
    line3.setValue("142 Example Drive");
    List<StringType> lines3 = new ArrayList<StringType>();
    lines3.add(line3);
    ad3.setLine(lines3);
    ad3.setCity("Rockville");
    ad3.setState("MD");
    ad3.setPostalCode("20874");
    ad3.setCountry("US");
    addrs.add(ad3);
    String result4 = CdaFhirUtilities.getAddressXml(addrs);
    assertTrue(result4.contains("142 Example Drive"));
    assertTrue(result4.contains("20874"));
    assertTrue(result4.contains("MD"));
    assertTrue(result4.contains("Rockville"));
}
Also used : Address(org.hl7.fhir.r4.model.Address) StringType(org.hl7.fhir.r4.model.StringType) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 44 with Address

use of com.adobe.target.delivery.v1.model.Address in project GNS by MobilityFirst.

the class AWSEC2 method describeElasticIPs.

/**
   *
   * @param ec2
   */
public static void describeElasticIPs(AmazonEC2 ec2) {
    StringBuilder output = new StringBuilder();
    String prefix = currentTab + "Elastic IPs: ";
    DescribeAddressesResult describeAddressesResult = ec2.describeAddresses();
    for (Address address : describeAddressesResult.getAddresses()) {
        output.append(prefix);
        prefix = ", ";
        output.append(address.getPublicIp());
    }
    System.out.println(output);
}
Also used : Address(com.amazonaws.services.ec2.model.Address) DescribeAddressesResult(com.amazonaws.services.ec2.model.DescribeAddressesResult)

Example 45 with Address

use of com.adobe.target.delivery.v1.model.Address in project data-transfer-project by google.

the class VCardToGoogleContactConverterTest 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 = VCardToGoogleContactConverter.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);
}
Also used : VCard(ezvcard.VCard) VCARD_PRIMARY_PREF(org.dataportabilityproject.serviceProviders.google.contacts.GoogleContactsConstants.VCARD_PRIMARY_PREF) EmailAddress(com.google.api.services.people.v1.model.EmailAddress) Telephone(ezvcard.property.Telephone) SOURCE_PARAM_NAME_TYPE(org.dataportabilityproject.serviceProviders.google.contacts.GoogleContactsConstants.SOURCE_PARAM_NAME_TYPE) Test(org.junit.Test) PhoneNumber(com.google.api.services.people.v1.model.PhoneNumber) Truth.assertThat(com.google.common.truth.Truth.assertThat) Function(java.util.function.Function) Collectors(java.util.stream.Collectors) StructuredName(ezvcard.property.StructuredName) Pair(com.google.gdata.util.common.base.Pair) Person(com.google.api.services.people.v1.model.Person) List(java.util.List) CONTACT_SOURCE_TYPE(org.dataportabilityproject.serviceProviders.google.contacts.GoogleContactsConstants.CONTACT_SOURCE_TYPE) Nullable(com.google.gdata.util.common.base.Nullable) Address(com.google.api.services.people.v1.model.Address) Email(ezvcard.property.Email) Name(com.google.api.services.people.v1.model.Name) Collections(java.util.Collections) Before(org.junit.Before) EmailAddress(com.google.api.services.people.v1.model.EmailAddress) Address(com.google.api.services.people.v1.model.Address) VCard(ezvcard.VCard) Person(com.google.api.services.people.v1.model.Person) Test(org.junit.Test)

Aggregations

Address (org.hl7.fhir.r4.model.Address)75 Test (org.junit.Test)35 Address (org.hl7.fhir.dstu3.model.Address)22 PersonAddress (org.openmrs.PersonAddress)21 HumanName (org.hl7.fhir.r4.model.HumanName)20 Patient (org.hl7.fhir.r4.model.Patient)18 ArrayList (java.util.ArrayList)17 Identifier (org.hl7.fhir.r4.model.Identifier)17 ContactPoint (org.hl7.fhir.r4.model.ContactPoint)16 Test (org.junit.jupiter.api.Test)13 Organization (org.hl7.fhir.r4.model.Organization)12 Address (com.amazonaws.services.ec2.model.Address)7 HumanName (org.hl7.fhir.dstu3.model.HumanName)7 PatientCommunicationComponent (org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent)7 ByteArrayOutputStream (java.io.ByteArrayOutputStream)6 DescribeAddressesResult (com.amazonaws.services.ec2.model.DescribeAddressesResult)5 HashSet (java.util.HashSet)5 Coding (org.hl7.fhir.r4.model.Coding)5 StringType (org.hl7.fhir.r4.model.StringType)5 Before (org.junit.Before)5