Address review comments
This commit is contained in:
parent
a2a3ffb7ec
commit
1663e367a6
|
@ -2,4 +2,5 @@
|
|||
type: add
|
||||
issue: 2401
|
||||
title: "Group Bulk exports are now supported. You can export all data for a Group of Patients via the
|
||||
`/Group/[id]/$export` endpoint for any resource type which contains a patient compartment."
|
||||
`/Group/[id]/$export` endpoint for any resource type which contains a patient compartment.
|
||||
The _typeFilter and _since criteria are currently not supported at this level, but may eventually be"
|
||||
|
|
|
@ -59,7 +59,7 @@ public class PidToIBaseResourceProcessor implements ItemProcessor<List<ResourceP
|
|||
@Override
|
||||
public List<IBaseResource> process(List<ResourcePersistentId> theResourcePersistentId) {
|
||||
String collect = theResourcePersistentId.stream().map(pid -> pid.getId().toString()).collect(Collectors.joining(","));
|
||||
ourLog.debug("Processing PIDs: {}" + collect);
|
||||
ourLog.trace("Processing PIDs: {}" + collect);
|
||||
|
||||
IFhirResourceDao<?> dao = myDaoRegistry.getResourceDao(myResourceType);
|
||||
Class<? extends IBaseResource> resourceTypeClass = myContext.getResourceDefinition(myResourceType).getImplementingClass();
|
||||
|
@ -68,7 +68,7 @@ public class PidToIBaseResourceProcessor implements ItemProcessor<List<ResourceP
|
|||
List<IBaseResource> outgoing = new ArrayList<>();
|
||||
sb.loadResourcesByPid(theResourcePersistentId, Collections.emptyList(), outgoing, false, null);
|
||||
|
||||
ourLog.debug("Loaded resources: {}", outgoing.stream().map(t->t.getIdElement().getValue()).collect(Collectors.joining(", ")));
|
||||
ourLog.trace("Loaded resources: {}", outgoing.stream().map(t->t.getIdElement().getValue()).collect(Collectors.joining(", ")));
|
||||
|
||||
return outgoing;
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ public class BulkExportJobConfig {
|
|||
public static final String READ_CHUNK_PARAMETER = "readChunkSize";
|
||||
public static final String GROUP_ID_PARAMETER = "groupId";
|
||||
public static final String RESOURCE_TYPES_PARAMETER = "resourceTypes";
|
||||
public static final int CHUNK_SIZE = 100;
|
||||
|
||||
@Autowired
|
||||
private StepBuilderFactory myStepBuilderFactory;
|
||||
|
@ -114,7 +115,7 @@ public class BulkExportJobConfig {
|
|||
@Bean
|
||||
public Step groupBulkExportGenerateResourceFilesStep() {
|
||||
return myStepBuilderFactory.get("groupBulkExportGenerateResourceFilesStep")
|
||||
.<List<ResourcePersistentId>, List<IBaseResource>> chunk(100) //1000 resources per generated file, as the reader returns 10 resources at a time.
|
||||
.<List<ResourcePersistentId>, List<IBaseResource>> chunk(CHUNK_SIZE) //1000 resources per generated file, as the reader returns 10 resources at a time.
|
||||
.reader(groupBulkItemReader())
|
||||
.processor(myPidToIBaseResourceProcessor)
|
||||
.writer(resourceToFileWriter())
|
||||
|
@ -132,7 +133,7 @@ public class BulkExportJobConfig {
|
|||
@Bean
|
||||
public Step bulkExportGenerateResourceFilesStep() {
|
||||
return myStepBuilderFactory.get("bulkExportGenerateResourceFilesStep")
|
||||
.<List<ResourcePersistentId>, List<IBaseResource>> chunk(100) //1000 resources per generated file, as the reader returns 10 resources at a time.
|
||||
.<List<ResourcePersistentId>, List<IBaseResource>> chunk(CHUNK_SIZE) //1000 resources per generated file, as the reader returns 10 resources at a time.
|
||||
.reader(bulkItemReader())
|
||||
.processor(myPidToIBaseResourceProcessor)
|
||||
.writer(resourceToFileWriter())
|
||||
|
|
|
@ -189,7 +189,6 @@ public class BulkDataExportProvider {
|
|||
@IdParam IIdType theIdParam,
|
||||
@OperationParam(name = JpaConstants.PARAM_EXPORT_OUTPUT_FORMAT, min = 0, max = 1, typeName = "string") IPrimitiveType<String> theOutputFormat,
|
||||
@OperationParam(name = JpaConstants.PARAM_EXPORT_TYPE, min = 0, max = 1, typeName = "string") IPrimitiveType<String> theType,
|
||||
@OperationParam(name = JpaConstants.PARAM_EXPORT_MDM, min = 0, max = 1, typeName = "boolean") IPrimitiveType<Boolean> theMdm,
|
||||
ServletRequestDetails theRequestDetails
|
||||
) {
|
||||
|
||||
|
@ -209,8 +208,9 @@ public class BulkDataExportProvider {
|
|||
//TODO GGG eventually, we will support these things.
|
||||
Set<String> filters = null;
|
||||
Date since = null;
|
||||
boolean theMdm = false;
|
||||
|
||||
IBulkDataExportSvc.JobInfo outcome = myBulkDataExportSvc.submitJob(new GroupBulkDataExportOptions(outputFormat, resourceTypes, since, filters, theIdParam, theMdm.getValue()));
|
||||
IBulkDataExportSvc.JobInfo outcome = myBulkDataExportSvc.submitJob(new GroupBulkDataExportOptions(outputFormat, resourceTypes, since, filters, theIdParam, theMdm));
|
||||
|
||||
String serverBase = getServerBase(theRequestDetails);
|
||||
String pollLocation = serverBase + "/" + JpaConstants.OPERATION_EXPORT_POLL_STATUS + "?" + JpaConstants.PARAM_EXPORT_POLL_STATUS_JOB_ID + "=" + outcome.getJobId();
|
||||
|
|
|
@ -189,9 +189,10 @@ public class JpaConstants {
|
|||
public static final Object PARAM_EXPORT_GROUP_ID = "_groupId";
|
||||
|
||||
/**
|
||||
* TODO GGG eventually we will support this.
|
||||
* Whether mdm should be performed on group export items to expand the group items to linked items before performing the export
|
||||
*/
|
||||
public static final String PARAM_EXPORT_MDM = "_mdm";
|
||||
// public static final String PARAM_EXPORT_MDM = "_mdm";
|
||||
|
||||
/**
|
||||
* Parameter for delete to indicate the deleted resources should also be expunged
|
||||
|
|
Loading…
Reference in New Issue