Fix, test changelog (#5266)

This commit is contained in:
Tadgh 2023-08-31 11:58:28 -07:00 committed by GitHub
parent cc283b7732
commit 5f5b3db4a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,4 @@
---
type: fix
jira: SMILE-7307
title: "Previously, executing a Group Bulk Export without defining the `_type` parameter would accidentally omit `Patient` and `Organization` types. This has been corrected."

View File

@ -604,6 +604,47 @@ public class BulkExportUseCaseTest extends BaseResourceProviderR4Test {
@Nested @Nested
public class GroupBulkExportTests { public class GroupBulkExportTests {
@Test
public void testGroupExportSuccessfulyExportsPatientForwardReferences() {
BundleBuilder bb = new BundleBuilder(myFhirContext);
Group group = new Group();
group.setId("Group/G");
group.setActive(true);
bb.addTransactionUpdateEntry(group);
Practitioner pract = new Practitioner();
pract.setId("PRACT-IN-GROUP");
bb.addTransactionUpdateEntry(pract);
Organization organization = new Organization();
organization.setId("ORG-IN-GROUP");
bb.addTransactionUpdateEntry(organization);
Patient patient = new Patient();
patient.setId("PAT-IN-GROUP");
patient.setGender(Enumerations.AdministrativeGender.FEMALE);
patient.setActive(true);
patient.setManagingOrganization(new Reference("Organization/ORG-IN-GROUP"));
patient.setGeneralPractitioner(List.of(new Reference("Practitioner/PRACT-IN-GROUP")));
bb.addTransactionUpdateEntry(patient);
group.addMember().getEntity().setReference("Patient/PAT-IN-GROUP");
myClient.transaction().withBundle(bb.getBundle()).execute();
HashSet<String> resourceTypes = Sets.newHashSet();
BulkExportJobResults bulkExportJobResults = startGroupBulkExportJobAndAwaitCompletion(resourceTypes, new HashSet<>(), "G");
Map<String, List<IBaseResource>> firstMap = convertJobResultsToResources(bulkExportJobResults);
assertThat(firstMap.keySet(), hasSize(4));
assertThat(firstMap.get("Group"), hasSize(1));
assertThat(firstMap.get("Patient"), hasSize(1));
assertThat(firstMap.get("Practitioner"), hasSize(1));
assertThat(firstMap.get("Organization"), hasSize(1));
}
@Test @Test
public void testVeryLargeGroup() { public void testVeryLargeGroup() {

View File

@ -264,6 +264,10 @@ public class BulkDataExportProvider {
} else { } else {
// all patient resource types // all patient resource types
Set<String> groupTypes = new HashSet<>(getPatientCompartmentResources()); Set<String> groupTypes = new HashSet<>(getPatientCompartmentResources());
// Add the forward reference resource types from the patients, e.g. Practitioner, Organization
groupTypes.addAll(PATIENT_BULK_EXPORT_FORWARD_REFERENCE_RESOURCE_TYPES);
groupTypes.removeIf(t -> !myDaoRegistry.isResourceTypeSupported(t)); groupTypes.removeIf(t -> !myDaoRegistry.isResourceTypeSupported(t));
BulkExportJobParameters.setResourceTypes(groupTypes); BulkExportJobParameters.setResourceTypes(groupTypes);
} }