Skip to content

Commit

Permalink
Merge pull request fli-iam#2146 from youennmerel/fli-iam#2084
Browse files Browse the repository at this point in the history
[Fli iam#2084] Filter processed datasets in Solr
  • Loading branch information
jcomedouteau authored Apr 5, 2024
2 parents 89ea83a + 6da6b9d commit 4b2dbb2
Show file tree
Hide file tree
Showing 20 changed files with 419 additions and 415 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table shanoir_metadata add column processed bit(1);
1 change: 1 addition & 0 deletions docker-compose/solr/core/schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@
<field name="subjectId" type="plong"/>
<field name="subjectType" type="lowercase"/>
<field name="tags" type="strings"/>
<field name="processed" type="boolean" indexed="true" stored="true" required="true" />
<dynamicField name="*_txt_en_split_tight" type="text_en_splitting_tight" indexed="true" stored="true"/>
<dynamicField name="*_descendent_path" type="descendent_path" indexed="true" stored="true"/>
<dynamicField name="*_ancestor_path" type="ancestor_path" indexed="true" stored="true"/>
Expand Down
2 changes: 1 addition & 1 deletion shanoir-downloader
Submodule shanoir-downloader updated 1 files
+1 −3 Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
import org.shanoir.ng.shared.model.SubjectStudy;
import org.shanoir.ng.shared.quality.QualityTag;
import org.shanoir.ng.shared.service.SubjectStudyService;
import org.shanoir.ng.solr.service.SolrService;
import org.shanoir.ng.studycard.dto.QualityCardResult;
import org.shanoir.ng.studycard.model.QualityCard;
import org.shanoir.ng.studycard.model.QualityException;
Expand Down Expand Up @@ -142,6 +143,9 @@ public class ImporterService {
@Autowired
private WADODownloaderService downloader;

@Autowired
private SolrService solrService;

private DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS");

private static final String SUBJECT_PREFIX = "sub-";
Expand Down Expand Up @@ -459,7 +463,7 @@ public void cleanTempFiles(String workFolder) {
* Create a processed dataset dataset associated with a dataset processing.
* @param importJob the import job from importer MS.
*/
public Dataset createProcessedDataset(final ProcessedDatasetImportJob importJob) throws IOException, Exception {
public Dataset createProcessedDataset(final ProcessedDatasetImportJob importJob) throws Exception {

ShanoirEvent event = new ShanoirEvent(ShanoirEventType.IMPORT_DATASET_EVENT, importJob.getProcessedDatasetFilePath(), KeycloakUtil.getTokenUserId(), "Starting import...", ShanoirEvent.IN_PROGRESS, 0f);
eventService.publishEvent(event);
Expand Down Expand Up @@ -589,6 +593,7 @@ public Dataset createProcessedDataset(final ProcessedDatasetImportJob importJob)
dataset.setSubjectId(importJob.getSubjectId());

dataset = datasetService.create(dataset);
solrService.indexDataset(dataset.getId());

event.setStatus(ShanoirEvent.SUCCESS);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public ResponseEntity<Void> indexAll() throws RestServiceException, SolrServerEx
public ResponseEntity<SolrResultPage<ShanoirSolrDocument>> facetSearch(
@Parameter(name = "facets", required = true) @Valid @RequestBody ShanoirSolrQuery facet, Pageable pageable) throws RestServiceException {
SolrResultPage<ShanoirSolrDocument> documents = solrService.facetSearch(facet, pageable);
return new ResponseEntity<SolrResultPage<ShanoirSolrDocument>>(documents, HttpStatus.OK);
return new ResponseEntity<>(documents, HttpStatus.OK);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
@ColumnResult(name="studyName", type = String.class), @ColumnResult(name="studyId", type = Long.class),
@ColumnResult(name="centerName", type = String.class), @ColumnResult(name="centerId", type = Long.class),
@ColumnResult(name="sliceThickness", type = Double.class), @ColumnResult(name="pixelBandwidth", type = Double.class),
@ColumnResult(name="magneticFieldStrength", type = Double.class)
@ColumnResult(name="magneticFieldStrength", type = Double.class),
@ColumnResult(name="processed", type = Boolean.class)
})
})

Expand Down Expand Up @@ -91,14 +92,16 @@ public class ShanoirMetadata {

private Long subjectId;

private boolean processed;

public ShanoirMetadata () {

}

public ShanoirMetadata (Long datasetId, String datasetName, Integer datasetType, Integer datasetNature,
LocalDate datasetCreationDate, Long examinationId, String examinationComment, LocalDate examinationDate, String acquisitionEquipmentName,
String subjectName, Integer subjectType, Long subjectId, String studyName, Long studyId, String centerName, Long centerId, Double sliceThickness,
Double pixelBandwidth, Double magneticFieldStrength) {
Double pixelBandwidth, Double magneticFieldStrength, boolean processed) {
this.datasetId = datasetId;
this.datasetName = datasetName;
this.datasetType = datasetType;
Expand All @@ -118,6 +121,7 @@ public ShanoirMetadata (Long datasetId, String datasetName, Integer datasetType,
this.sliceThickness = sliceThickness;
this.pixelBandwidth = pixelBandwidth;
this.magneticFieldStrength = magneticFieldStrength;
this.processed = processed;
}

/**
Expand Down Expand Up @@ -353,4 +357,12 @@ public Long getCenterId() {
public void setCenterId(Long centerId) {
this.centerId = centerId;
}

public boolean isProcessed() {
return processed;
}

public void setProcessed(boolean processed) {
this.processed = processed;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,16 @@ public class ShanoirSolrDocument {
@Field
private List<String> tags;

@Field
private boolean processed;

public ShanoirSolrDocument () {
}

public ShanoirSolrDocument (String id, Long datasetId, String datasetName, String datasetType, String datasetNature,
Date datasetCreationDate, Long examinationId, String examinationComment, Date examinationDate, String acquisitionEquipmentName,
String subjectName, String subjectType, Long subjectId, String studyName, Long studyId, String centerName, Long centerId, Double sliceThickness,
Double pixelBandwidth, Double magneticFieldStrength) {
Double pixelBandwidth, Double magneticFieldStrength, boolean processed) {
this.id = id;
this.datasetId = datasetId;
this.datasetName = datasetName;
Expand All @@ -126,6 +129,7 @@ public ShanoirSolrDocument (String id, Long datasetId, String datasetName, Strin
this.sliceThickness = sliceThickness;
this.pixelBandwidth = pixelBandwidth;
this.magneticFieldStrength = magneticFieldStrength;
this.processed = processed;
}

public String getId() {
Expand Down Expand Up @@ -355,4 +359,12 @@ public Long getCenterId() {
public void setCenterId(Long centerId) {
this.centerId = centerId;
}

public boolean isProcessed() {
return processed;
}

public void setProcessed(boolean processed) {
this.processed = processed;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ public class ShanoirSolrQuery {
private Range<Float> pixelBandwidth;

private Range<Float> magneticFieldStrength;

private Collection<Boolean> processed;

private Map<String, FacetPageable> facetPaging;

Expand Down Expand Up @@ -317,4 +319,11 @@ public void setCenterId(Collection<Long> centerId) {
this.centerId = centerId;
}

public Collection<Boolean> getProcessed() {
return processed;
}

public void setProcessed(Collection<Boolean> processed) {
this.processed = processed;
}
}
Loading

0 comments on commit 4b2dbb2

Please sign in to comment.