Tidy things from preliminary review

This commit is contained in:
Tadgh 2021-02-24 17:16:54 -05:00
parent 3937d2ef01
commit a56060a096
8 changed files with 5 additions and 47 deletions

View File

@ -93,7 +93,7 @@ public class BulkItemReader implements ItemReader<List<ResourcePersistentId>> {
ISearchBuilder sb = mySearchBuilderFactory.newSearchBuilder(dao, myResourceType, nextTypeClass); ISearchBuilder sb = mySearchBuilderFactory.newSearchBuilder(dao, myResourceType, nextTypeClass);
SearchParameterMap map = createSearchParameterMapFromTypeFilter(jobEntity, def); SearchParameterMap map = createSearchParameterMapFromTypeFilter(jobEntity, def);
if (jobEntity.getSince() != null) { if (jobEntity.getSince() != null) {
map.setLastUpdated(new DateRangeParam(jobEntity.getSince(), null)); map.setLastUpdated(new DateRangeParam(jobEntity.getSince(), null));
} }

View File

@ -2,7 +2,7 @@ package ca.uhn.fhir.jpa.bulk.job;
public class GroupBulkExportJobParametersBuilder extends BulkExportJobParametersBuilder { public class GroupBulkExportJobParametersBuilder extends BulkExportJobParametersBuilder {
public GroupBulkExportJobParametersBuilder setGroupId(String theGroupId) { public GroupBulkExportJobParametersBuilder setGroupId(String theGroupId) {
this.addString("groupId", theGroupId); this.addString(BulkExportJobConfig.GROUP_ID_PARAMETER, theGroupId);
return this; return this;
} }
} }

View File

@ -100,7 +100,6 @@ public class ResourceToFileWriter implements ItemWriter<List<IBaseResource>> {
IBaseBinary binary = BinaryUtil.newBinary(myFhirContext); IBaseBinary binary = BinaryUtil.newBinary(myFhirContext);
binary.setContentType(Constants.CT_FHIR_NDJSON); binary.setContentType(Constants.CT_FHIR_NDJSON);
binary.setContent(myOutputStream.toByteArray()); binary.setContent(myOutputStream.toByteArray());
DaoMethodOutcome outcome = myBinaryDao.create(binary); DaoMethodOutcome outcome = myBinaryDao.create(binary);
return outcome.getResource().getIdElement(); return outcome.getResource().getIdElement();
} }
@ -116,8 +115,6 @@ public class ResourceToFileWriter implements ItemWriter<List<IBaseResource>> {
int count = 0; int count = 0;
for (List<IBaseResource> resourceList : theList) { for (List<IBaseResource> resourceList : theList) {
for (IBaseResource nextFileResource : resourceList) { for (IBaseResource nextFileResource : resourceList) {
System.out.println("ZOOP");
System.out.println(myParser.setPrettyPrint(true).encodeResourceToString(nextFileResource));
myParser.encodeResourceToWriter(nextFileResource, myWriter); myParser.encodeResourceToWriter(nextFileResource, myWriter);
myWriter.append("\n"); myWriter.append("\n");
count++; count++;

View File

@ -39,9 +39,6 @@ public class ResourceTypePartitioner implements Partitioner {
@Value("#{jobExecutionContext['jobUUID']}") @Value("#{jobExecutionContext['jobUUID']}")
private String myJobUUID; private String myJobUUID;
@Value("#{jobExecutionContext['groupId']}")
private String myGroupId;
@Autowired @Autowired
private BulkExportDaoSvc myBulkExportDaoSvc; private BulkExportDaoSvc myBulkExportDaoSvc;
@ -63,7 +60,7 @@ public class ResourceTypePartitioner implements Partitioner {
// The worker step needs to know which parent job it is processing for, and which collection entity it will be // The worker step needs to know which parent job it is processing for, and which collection entity it will be
// attaching its results to. // attaching its results to.
context.putString("jobUUID", myJobUUID); context.putString(BulkExportJobConfig.JOB_UUID_PARAMETER, myJobUUID);
context.putLong("bulkExportCollectionEntityId", collectionEntityId); context.putLong("bulkExportCollectionEntityId", collectionEntityId);
// Name the partition based on the resource type // Name the partition based on the resource type

View File

@ -663,7 +663,7 @@ public class TermLoaderSvcImpl implements ITermLoaderSvc {
Counter circularCounter = new Counter(); Counter circularCounter = new Counter();
for (TermConcept next : rootConcepts.values()) { for (TermConcept next : rootConcepts.values()) {
long count = circularCounter.getnAdd(); long count = circularCounter.getThenAdd();
float pct = ((float) count / rootConcepts.size()) * 100.0f; float pct = ((float) count / rootConcepts.size()) * 100.0f;
ourLog.info(" * Scanning for circular refs - have scanned {} / {} codes ({}%)", count, rootConcepts.size(), pct); ourLog.info(" * Scanning for circular refs - have scanned {} / {} codes ({}%)", count, rootConcepts.size(), pct);
dropCircularRefs(next, new ArrayList<>(), code2concept); dropCircularRefs(next, new ArrayList<>(), code2concept);

View File

@ -24,7 +24,7 @@ public class Counter {
private long myCount; private long myCount;
public long getnAdd() { public long getThenAdd() {
return myCount++; return myCount++;
} }

View File

@ -270,32 +270,6 @@ public class FhirResourceDaoR4LegacySearchBuilderTest extends BaseJpaR4Test {
assertThat(ids, hasItems(patientId)); assertThat(ids, hasItems(patientId));
} }
@Test
public void testPatientHasGroupImmunization(){
Patient patient = new Patient();
String patientId = myPatientDao.create(patient).getId().toUnqualifiedVersionless().getValue();
Group group = new Group();
group.addMember().setEntity(new Reference(patientId));
myGroupDao.create(group).getId().getIdPartAsLong();
Immunization immunization = new Immunization();
immunization.setPatient(new Reference(patientId));
String immunizationId = myImmunizationDao.create(immunization).getId().toUnqualifiedVersionless().getValue();
// String criteria = "?_has:Group:member:_id="+ daoMethodOutcome + "&_revinclude=Immunization:patient";
String criteria = "?_revinclude=Immunization:patient";
//TODO GGG the matchUrlService _doesnt translate rev includes!
SearchParameterMap searchParameterMap = myMatchUrlService.translateMatchUrl(criteria, myFhirCtx.getResourceDefinition(Patient.class));
searchParameterMap.addRevInclude(new Include("Immunization:patient").toLocked());
searchParameterMap.setLoadSynchronous(true);
IBundleProvider search = myPatientDao.search(searchParameterMap);
List<String> strings = toUnqualifiedVersionlessIdValues(search);
assertThat(strings, hasItems(patientId, immunizationId));
}
@Test @Test
public void testHasConditionOr() { public void testHasConditionOr() {
Patient patient = new Patient(); Patient patient = new Patient();

View File

@ -21,14 +21,4 @@ public class SearchParameterMapTest extends BaseTest {
String criteria = params.toNormalizedQueryString(myContext); String criteria = params.toNormalizedQueryString(myContext);
assertEquals(criteria, "?_has:Observation:identifier:urn:system|FOO=urn%3Asystem%7CFOO"); assertEquals(criteria, "?_has:Observation:identifier:urn:system|FOO=urn%3Asystem%7CFOO");
} }
@Test
public void testGroupToImmunizationHas() {
SearchParameterMap params = new SearchParameterMap();
params.add("_has", new HasParam("Group", "member", "_id", "1000"));
params.addRevInclude(new Include("Immunization:patient"));
String criteria = params.toNormalizedQueryString(myContext);
assertEquals("?_has:Group:member:_id=1000&_revinclude=Immunization:patient", criteria);
}
} }