Skip to content

Commit

Permalink
Merge pull request tech-by-design#1058 from sabith-nadakkavil/csvConv…
Browse files Browse the repository at this point in the history
…ersion

fix: Patient and Organization Converter Test tech-by-design#745
  • Loading branch information
ratheesh-kr authored Jan 16, 2025
2 parents 9cf0e0e + 35c0dab commit ed8796f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public static List<ScreeningObservationData> createScreeningObservationData() th

public static QeAdminData createQeAdminData() throws IOException {
final String csv = """
PATIENT_MR_ID_VALUE,FACILITY_ACTIVE,FACILITY_ID,FACILITY_NAME,ORGANIZATION_TYPE_DISPLAY,ORGANIZATION_TYPE_CODE,ORGANIZATION_TYPE_SYSTEM,FACILITY_ADDRESS1,FACILITY_ADDRESS2,FACILITY_CITY,FACILITY_STATE,FACILITY_DISTRICT,FACILITY_ZIP,FACILITY_LAST_UPDATED,FACILITY_PROFILE,FACILITY_SCN_IDENTIFIER_TYPE_DISPLAY,FACILITY_SCN_IDENTIFIER_TYPE_VALUE,FACILITY_SCN_IDENTIFIER_TYPE_SYSTEM,FACILITY_NPI_IDENTIFIER_TYPE_CODE,FACILITY_NPI_IDENTIFIER_TYPE_VALUE,FACILITY_NPI_IDENTIFIER_TYPE_SYSTEM,FACILITY_CMS_IDENTIFIER_TYPE_CODE,FACILITY_CMS_IDENTIFIER_TYPE_VALUE,FACILITY_CMS_IDENTIFIER_TYPE_SYSTEM,FACILITY_TEXT_STATUS
11223344,TRUE,CUMC,Care Ridge SCN,Other,other,http://terminology.hl7.org/CodeSystem/organization-type,111 Care Ridge St,Suite 1,Plainview,NY,Nassau County,11803,2024-02-23T00:00:00Z,http://shinny.org/us/ny/hrsn/StructureDefinition/shin-ny-organization,Care Ridge,SCNExample,http://www.scn.gov/scn_1,NPITypeCodeDummy,NPIValueDummy,http://example.org/npi-system,CMSTypeCodeDummy,CMSValueDummy,http://example.org/cms-system,generated
PATIENT_MR_ID_VALUE,FACILITY_ID,FACILITY_NAME,ORGANIZATION_TYPE_DISPLAY,ORGANIZATION_TYPE_CODE,FACILITY_ADDRESS1,FACILITY_CITY,FACILITY_STATE,FACILITY_DISTRICT,FACILITY_ZIP,FACILITY_LAST_UPDATED,FACILITY_IDENTIFIER_TYPE_DISPLAY,FACILITY_IDENTIFIER_TYPE_VALUE,FACILITY_IDENTIFIER_TYPE_SYSTEM
11223344,CUMC,Care Ridge SCN,Other,other,111 Care Ridge St,Plainview,NY,Nassau County,11803,2024-02-23T00:00:00Z,Care Ridge,SCNExample,http://www.scn.ny.gov/
""";
return CsvConversionUtil.convertCsvStringToQeAdminData(csv).get("11223344").get(0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import org.hl7.fhir.r4.model.CodeableConcept;
import org.hl7.fhir.r4.model.Identifier;
import org.hl7.fhir.r4.model.Organization;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
Expand All @@ -37,7 +36,7 @@ class OrganizationConverterTest {
private OrganizationConverter organizationConverter;

@Test
@Disabled
// @Disabled
void testConvert() throws Exception {
// Create the necessary data objects for the test
final Bundle bundle = new Bundle();
Expand Down Expand Up @@ -76,13 +75,13 @@ void testConvert() throws Exception {

// Assert that the organization has the correct identifier
final Identifier mrIdentifier = organization.getIdentifier().stream()
.filter(identifier -> "Care Ridge SCN".equals(identifier.getValue()))
.filter(identifier -> "SCNExample".equals(identifier.getValue()))
.findFirst()
.orElse(null);

softly.assertThat(mrIdentifier).isNotNull();
// softly.assertThat(mrIdentifier.getSystem()).isEqualTo("http://example.org/cms-system");
softly.assertThat(mrIdentifier.getValue()).isEqualTo("Care Ridge SCN");
softly.assertThat(mrIdentifier.getSystem()).isEqualTo("http://www.scn.ny.gov/");
softly.assertThat(mrIdentifier.getValue()).isEqualTo("SCNExample");

// Assert that the organization has no extensions (since the output does not
// have extensions)
Expand All @@ -96,6 +95,8 @@ void testConvert() throws Exception {
softly.assertThat(address.getDistrict()).isEqualTo("Nassau County");
softly.assertThat(address.getState()).isEqualTo("NY");
softly.assertThat(address.getPostalCode()).isEqualTo("11803");
softly.assertThat(address.getLine()).hasSize(1);
softly.assertThat(address.getLine().get(0).getValue()).isEqualTo("111 Care Ridge St");

// Assert that the organization has the correct type
softly.assertThat(organization.getType()).hasSize(1);
Expand All @@ -105,12 +106,20 @@ void testConvert() throws Exception {
softly.assertThat(type.getCodingFirstRep().getCode()).isEqualTo("other");
softly.assertThat(type.getCodingFirstRep().getDisplay()).isEqualTo("Other");

//Assert that organization active is true
softly.assertThat(organization.getActive()).isTrue();

// Assert fullUrl
softly.assertThat(result.getFullUrl()).isEqualTo("http://shinny.org/us/ny/hrsn/Organization/" + organization.getId());
softly.assertThat(result.getRequest().getMethod()).isEqualTo(org.hl7.fhir.r4.model.Bundle.HTTPVerb.POST);
softly.assertThat(result.getRequest().getUrl()).isEqualTo("http://shinny.org/us/ny/hrsn/Organization/" + organization.getId());

// Assert all soft assertions
softly.assertAll();
}

@Test
@Disabled
// @Disabled
void testGeneratedJson() throws Exception {
final var bundle = new Bundle();
final var demographicData = CsvTestHelper.createDemographicData();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.hl7.fhir.r4.model.Identifier;
import org.hl7.fhir.r4.model.Patient;
import org.hl7.fhir.r4.model.StringType;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
Expand All @@ -38,7 +37,7 @@ class PatientConverterTest {
private PatientConverter patientConverter;

@Test
@Disabled
// @Disabled
void testConvert() throws Exception {
final Bundle bundle = new Bundle();
final DemographicData demographicData = CsvTestHelper.createDemographicData();
Expand Down Expand Up @@ -85,7 +84,7 @@ void testConvert() throws Exception {
softly.assertThat(maIdentifier.getSystem()).isEqualTo("http://www.medicaid.gov/");
softly.assertThat(maIdentifier.getValue()).isEqualTo("AA12345C");
final Identifier ssnIdentifier = patient.getIdentifier().stream()
.filter(identifier -> "SSN".equals(identifier.getType().getCodingFirstRep().getCode()))
.filter(identifier -> "SS".equals(identifier.getType().getCodingFirstRep().getCode()))
.findFirst()
.orElse(null);
softly.assertThat(ssnIdentifier).isNotNull();
Expand All @@ -98,8 +97,15 @@ void testConvert() throws Exception {
softly.assertThat(ssnIdentifier.getType().getCodingFirstRep().getSystem())
.isEqualTo("http://terminology.hl7.org/CodeSystem/v2-0203");
softly.assertThat(ssnIdentifier.getType().getCodingFirstRep().getCode())
.isEqualTo("SSN");
softly.assertThat(patient.getExtension()).hasSize(7);
.isEqualTo("SS");

softly.assertThat(patient.getExtension()).hasSize(5);
softly.assertThat(patient.getExtensionByUrl("http://hl7.org/fhir/us/core/StructureDefinition/us-core-race")).isNotNull();
softly.assertThat(patient.getExtensionByUrl("http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity")).isNotNull();
softly.assertThat(patient.getExtensionByUrl("http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex")).isNotNull();
softly.assertThat(patient.getExtensionByUrl("http://shinny.org/us/ny/hrsn/StructureDefinition/shinny-personal-pronouns")).isNotNull();
softly.assertThat(patient.getExtensionByUrl("http://shinny.org/us/ny/hrsn/StructureDefinition/shinny-gender-identity")).isNotNull();

softly.assertThat(patient.hasAddress()).isTrue();
final Address address = patient.getAddressFirstRep();
softly.assertThat(address.getLine().stream()
Expand All @@ -109,6 +115,7 @@ void testConvert() throws Exception {
softly.assertThat(address.getState()).isEqualTo("NY");
softly.assertThat(address.getPostalCode()).isEqualTo("10032");
softly.assertThat(address.getDistrict()).isEqualTo("MANHATTAN");

softly.assertThat(patient.hasContact()).isTrue();
final Patient.ContactComponent contact = patient.getContactFirstRep();
softly.assertThat(contact.getRelationshipFirstRep().getCodingFirstRep().getSystem())
Expand All @@ -124,6 +131,7 @@ void testConvert() throws Exception {
softly.assertThat(contact.getTelecomFirstRep().getSystem())
.isEqualTo(ContactPoint.ContactPointSystem.PHONE);
softly.assertThat(contact.getTelecomFirstRep().getValue()).isEqualTo("1234567890");

softly.assertThat(patient.hasCommunication()).isTrue();
final Patient.PatientCommunicationComponent communication = patient.getCommunicationFirstRep();
softly.assertThat(communication.getLanguage().getCodingFirstRep().getSystem())
Expand All @@ -135,7 +143,7 @@ void testConvert() throws Exception {
}

@Test
@Disabled
// @Disabled
void testGeneratedJson() throws Exception {
final var bundle = new Bundle();
final var demographicData = CsvTestHelper.createDemographicData();
Expand Down

0 comments on commit ed8796f

Please sign in to comment.