Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK-5964 - Clinical Improvements #2474

Merged
merged 35 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
fc84089
catalog: add 'version' to ClinicalAnalysis, #TASK-5964 #TASK-6289
pfurio May 27, 2024
b5d46c6
catalog: add new test for versioning, #TASK-5964 #TASK-6289
pfurio May 28, 2024
b62463f
catalog: fix issue in installIndexes, #TASK-5964
pfurio May 28, 2024
7ae6a0f
catalog: add new ADMIN permission for ClinicalAnalysis, #TASK-6288
pfurio May 28, 2024
a6c1789
catalog: test new ADMIN permission, #TASK-6288 #TASK-5964
pfurio May 29, 2024
68b33c1
Merge branch 'develop' into TASK-5964
pfurio Jun 5, 2024
983405d
catalog: apply data model changes, #TASK-5964
pfurio Jun 7, 2024
d45c720
app: add some migrations, #TASK-5964
pfurio Jun 10, 2024
2c1608e
app: add new ClinicalStatus migration, #TASK-5964
pfurio Jun 11, 2024
1ee2068
app: fix migration script, #TASK-5964
pfurio Jun 11, 2024
57b6b8d
app: improve scenario where status.id is null, #TASK-5964
pfurio Jun 11, 2024
4b41d65
catalog: fix status indexes, #TASK-5964
pfurio Jun 11, 2024
f53cb74
app: remove status name migration script, #TASK-5964
pfurio Jun 12, 2024
ec45ff3
Merge branch 'develop' into TASK-5964
pfurio Jun 26, 2024
0fec64a
catalog: check ADMIN permissions for DONE statuses, #TASK-5964
pfurio Jun 27, 2024
9c2e72d
app: move migration folder, #TASK-5964
pfurio Jun 27, 2024
9a92971
Merge branch 'develop' into TASK-5964
pfurio Jul 1, 2024
8063950
Merge branch 'develop' into TASK-5964
pfurio Jul 1, 2024
fc068d4
Merge branch 'develop' into TASK-5964
pfurio Jul 5, 2024
732f2ff
catalog: use panelLocked constant, #TASK-5964
pfurio Jul 5, 2024
af360fa
app: add missing migration for panelLock field, #TASK-5964
pfurio Jul 10, 2024
89fbe04
Merge branch 'develop' into TASK-5964
pfurio Jul 11, 2024
04be875
Merge branch 'develop' into TASK-5964
pfurio Jul 11, 2024
c21ef79
Merge branch 'release-3.2.x' into TASK-5964
pfurio Jul 19, 2024
9995ddb
app: improve migration, #TASK-5964
pfurio Jul 19, 2024
68a80b8
catalog: query case by version, #TASK-5964
pfurio Aug 5, 2024
ebf7bf1
Merge branch 'release-3.2.x' into TASK-5964
pfurio Aug 5, 2024
5035949
Merge branch 'release-3.2.x' into TASK-5964
pfurio Aug 6, 2024
97ebf2c
Merge branch 'release-3.2.x' into TASK-5964
pfurio Aug 8, 2024
b21b02d
Merge branch 'release-3.2.x' into TASK-5964
pfurio Aug 19, 2024
a2579af
catalog: add missing snapshot to parse query method, #TASK-5964
pfurio Aug 19, 2024
06ad286
catalog: allow users with ADMIN to update Interpretations, #TASK-5964
pfurio Aug 20, 2024
7c3f885
catalog: check Interpretations can't be touched when CLOSED, #TASK-5964
pfurio Aug 21, 2024
831c2cb
catalog: allow updating status from type CLOSED, #TASK-5964
pfurio Aug 22, 2024
40651f8
Merge branch 'release-3.2.x' into TASK-5964
pfurio Aug 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ private RestResponse<ClinicalAnalysis> create() throws Exception {
putNestedIfNotEmpty(beanParams, "disorder.id", commandOptions.disorderId, true);
putNestedIfNotEmpty(beanParams, "proband.id", commandOptions.probandId, true);
putNestedIfNotEmpty(beanParams, "family.id", commandOptions.familyId, true);
putNestedIfNotNull(beanParams, "panelLock", commandOptions.panelLock, true);
putNestedIfNotNull(beanParams, "panelLocked", commandOptions.panelLocked, true);
putNestedIfNotEmpty(beanParams, "analyst.id", commandOptions.analystId, true);
putNestedIfNotEmpty(beanParams, "report.title", commandOptions.reportTitle, true);
putNestedIfNotEmpty(beanParams, "report.overview", commandOptions.reportOverview, true);
Expand All @@ -367,6 +367,7 @@ private RestResponse<ClinicalAnalysis> create() throws Exception {
putNestedIfNotEmpty(beanParams, "responsible.address", commandOptions.responsibleAddress, true);
putNestedIfNotEmpty(beanParams, "responsible.city", commandOptions.responsibleCity, true);
putNestedIfNotEmpty(beanParams, "responsible.postcode", commandOptions.responsiblePostcode, true);
putNestedIfNotEmpty(beanParams, "interpretation.name", commandOptions.interpretationName, true);
putNestedIfNotEmpty(beanParams, "interpretation.description", commandOptions.interpretationDescription, true);
putNestedIfNotEmpty(beanParams, "interpretation.clinicalAnalysisId", commandOptions.interpretationClinicalAnalysisId, true);
putNestedIfNotEmpty(beanParams, "interpretation.creationDate", commandOptions.interpretationCreationDate, true);
Expand Down Expand Up @@ -419,6 +420,7 @@ private RestResponse<ObjectMap> distinct() throws Exception {
queryParams.putIfNotEmpty("dueDate", commandOptions.dueDate);
queryParams.putIfNotEmpty("qualityControlSummary", commandOptions.qualityControlSummary);
queryParams.putIfNotEmpty("release", commandOptions.release);
queryParams.putIfNotNull("snapshot", commandOptions.snapshot);
queryParams.putIfNotEmpty("status", commandOptions.status);
queryParams.putIfNotEmpty("internalStatus", commandOptions.internalStatus);
queryParams.putIfNotEmpty("annotation", commandOptions.annotation);
Expand All @@ -439,6 +441,7 @@ private RestResponse<ObjectMap> distinctInterpretation() throws Exception {
queryParams.putIfNotEmpty("study", commandOptions.study);
queryParams.putIfNotEmpty("id", commandOptions.id);
queryParams.putIfNotEmpty("uuid", commandOptions.uuid);
queryParams.putIfNotEmpty("name", commandOptions.name);
queryParams.putIfNotEmpty("clinicalAnalysisId", commandOptions.clinicalAnalysisId);
queryParams.putIfNotEmpty("analystId", commandOptions.analystId);
queryParams.putIfNotEmpty("methodName", commandOptions.methodName);
Expand Down Expand Up @@ -471,6 +474,7 @@ private RestResponse<Interpretation> searchInterpretation() throws Exception {
queryParams.putIfNotEmpty("study", commandOptions.study);
queryParams.putIfNotEmpty("id", commandOptions.id);
queryParams.putIfNotEmpty("uuid", commandOptions.uuid);
queryParams.putIfNotEmpty("name", commandOptions.name);
queryParams.putIfNotEmpty("clinicalAnalysisId", commandOptions.clinicalAnalysisId);
queryParams.putIfNotEmpty("analystId", commandOptions.analystId);
queryParams.putIfNotEmpty("methodName", commandOptions.methodName);
Expand Down Expand Up @@ -1144,6 +1148,7 @@ private RestResponse<ClinicalAnalysis> search() throws Exception {
queryParams.putIfNotEmpty("dueDate", commandOptions.dueDate);
queryParams.putIfNotEmpty("qualityControlSummary", commandOptions.qualityControlSummary);
queryParams.putIfNotEmpty("release", commandOptions.release);
queryParams.putIfNotNull("snapshot", commandOptions.snapshot);
queryParams.putIfNotEmpty("status", commandOptions.status);
queryParams.putIfNotEmpty("internalStatus", commandOptions.internalStatus);
queryParams.putIfNotEmpty("annotation", commandOptions.annotation);
Expand Down Expand Up @@ -1292,7 +1297,7 @@ private RestResponse<ClinicalAnalysis> update() throws Exception {
putNestedIfNotEmpty(beanParams, "description", commandOptions.description, true);
putNestedIfNotNull(beanParams, "type", commandOptions.type, true);
putNestedIfNotEmpty(beanParams, "disorder.id", commandOptions.disorderId, true);
putNestedIfNotNull(beanParams, "panelLock", commandOptions.panelLock, true);
putNestedIfNotNull(beanParams, "panelLocked", commandOptions.panelLocked, true);
putNestedIfNotEmpty(beanParams, "proband.id", commandOptions.probandId, true);
putNestedIfNotEmpty(beanParams, "family.id", commandOptions.familyId, true);
putNestedIfNotNull(beanParams, "locked", commandOptions.locked, true);
Expand Down Expand Up @@ -1324,6 +1329,7 @@ private RestResponse<ClinicalAnalysis> update() throws Exception {
putNestedIfNotEmpty(beanParams, "priority.id", commandOptions.priorityId, true);
putNestedMapIfNotEmpty(beanParams, "attributes", commandOptions.attributes, true);
putNestedIfNotEmpty(beanParams, "status.id", commandOptions.statusId, true);
putNestedIfNotNull(beanParams, "panelLock", commandOptions.panelLock, true);

clinicalAnalysisUpdateParams = JacksonUtils.getDefaultObjectMapper().copy()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
Expand Down Expand Up @@ -1368,6 +1374,7 @@ private RestResponse<ClinicalAnalysis> info() throws Exception {
queryParams.putIfNotEmpty("exclude", commandOptions.exclude);
queryParams.putIfNotNull("flattenAnnotations", commandOptions.flattenAnnotations);
queryParams.putIfNotEmpty("study", commandOptions.study);
queryParams.putIfNotEmpty("version", commandOptions.version);
queryParams.putIfNotNull("deleted", commandOptions.deleted);
if (queryParams.get("study") == null && OpencgaMain.isShellMode()) {
queryParams.putIfNotEmpty("study", sessionManager.getSession().getCurrentStudy());
Expand Down Expand Up @@ -1403,6 +1410,7 @@ private RestResponse<Interpretation> createInterpretation() throws Exception {
.readValue(new java.io.File(commandOptions.jsonFile), InterpretationCreateParams.class);
} else {
ObjectMap beanParams = new ObjectMap();
putNestedIfNotEmpty(beanParams, "name", commandOptions.name, true);
putNestedIfNotEmpty(beanParams, "description", commandOptions.description, true);
putNestedIfNotEmpty(beanParams, "clinicalAnalysisId", commandOptions.clinicalAnalysisId, true);
putNestedIfNotEmpty(beanParams, "creationDate", commandOptions.creationDate, true);
Expand Down Expand Up @@ -1492,6 +1500,7 @@ private RestResponse<Interpretation> updateInterpretation() throws Exception {
.readValue(new java.io.File(commandOptions.jsonFile), InterpretationUpdateParams.class);
} else {
ObjectMap beanParams = new ObjectMap();
putNestedIfNotEmpty(beanParams, "name", commandOptions.name, true);
putNestedIfNotEmpty(beanParams, "description", commandOptions.description, true);
putNestedIfNotEmpty(beanParams, "analyst.id", commandOptions.analystId, true);
putNestedIfNotEmpty(beanParams, "method.name", commandOptions.methodName, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ public class CreateCommandOptions {
@Parameter(names = {"--family-id"}, description = "The body web service id parameter", required = false, arity = 1)
public String familyId;

@Parameter(names = {"--panel-lock"}, description = "The body web service panelLock parameter", required = false, arity = 1)
public Boolean panelLock;
@Parameter(names = {"--panel-locked"}, description = "The body web service panelLocked parameter", required = false, arity = 1)
public Boolean panelLocked;

@Parameter(names = {"--analyst-id"}, description = "The body web service id parameter", required = false, arity = 1)
public String analystId;
Expand Down Expand Up @@ -301,6 +301,9 @@ public class CreateCommandOptions {
@Parameter(names = {"--responsible-postcode"}, description = "The body web service postcode parameter", required = false, arity = 1)
public String responsiblePostcode;

@Parameter(names = {"--interpretation-name"}, description = "The body web service name parameter", required = false, arity = 1)
public String interpretationName;

@Parameter(names = {"--interpretation-description"}, description = "The body web service description parameter", required = false, arity = 1)
public String interpretationDescription;

Expand Down Expand Up @@ -423,6 +426,9 @@ public class DistinctCommandOptions {
@Parameter(names = {"--release"}, description = "Release when it was created", required = false, arity = 1)
public String release;

@Parameter(names = {"--snapshot"}, description = "Snapshot value (Latest version of the entry in the specified release)", required = false, arity = 1)
public Integer snapshot;

@Parameter(names = {"--status"}, description = "Filter by status", required = false, arity = 1)
public String status;

Expand Down Expand Up @@ -455,6 +461,9 @@ public class DistinctInterpretationCommandOptions {
@Parameter(names = {"--uuid"}, description = "Comma separated list of Interpretation UUIDs up to a maximum of 100", required = false, arity = 1)
public String uuid;

@Parameter(names = {"--name", "-n"}, description = "Comma separated list of Interpretation names up to a maximum of 100", required = false, arity = 1)
public String name;

@Parameter(names = {"--clinical-analysis-id"}, description = "Clinical Analysis id", required = false, arity = 1)
public String clinicalAnalysisId;

Expand Down Expand Up @@ -523,6 +532,9 @@ public class SearchInterpretationCommandOptions {
@Parameter(names = {"--uuid"}, description = "Comma separated list of Interpretation UUIDs up to a maximum of 100", required = false, arity = 1)
public String uuid;

@Parameter(names = {"--name", "-n"}, description = "Comma separated list of Interpretation names up to a maximum of 100", required = false, arity = 1)
public String name;

@Parameter(names = {"--clinical-analysis-id"}, description = "Clinical Analysis id", required = false, arity = 1)
public String clinicalAnalysisId;

Expand Down Expand Up @@ -1737,6 +1749,9 @@ public class SearchCommandOptions {
@Parameter(names = {"--release"}, description = "Release when it was created", required = false, arity = 1)
public String release;

@Parameter(names = {"--snapshot"}, description = "Snapshot value (Latest version of the entry in the specified release)", required = false, arity = 1)
public Integer snapshot;

@Parameter(names = {"--status"}, description = "Filter by status", required = false, arity = 1)
public String status;

Expand Down Expand Up @@ -2024,8 +2039,8 @@ public class UpdateCommandOptions {
@Parameter(names = {"--disorder-id"}, description = "The body web service id parameter", required = false, arity = 1)
public String disorderId;

@Parameter(names = {"--panel-lock"}, description = "The body web service panelLock parameter", required = false, arity = 1)
public Boolean panelLock;
@Parameter(names = {"--panel-locked"}, description = "The body web service panelLocked parameter", required = false, arity = 1)
public Boolean panelLocked;

@Parameter(names = {"--proband-id"}, description = "The body web service id parameter", required = false, arity = 1)
public String probandId;
Expand Down Expand Up @@ -2120,6 +2135,9 @@ public class UpdateCommandOptions {
@Parameter(names = {"--status-id"}, description = "The body web service id parameter", required = false, arity = 1)
public String statusId;

@Parameter(names = {"--panel-lock"}, description = "The body web service panelLock parameter", required = false, arity = 1)
public Boolean panelLock;

}

@Parameters(commandNames = {"annotation-sets-annotations-update"}, commandDescription ="Update annotations from an annotationSet")
Expand Down Expand Up @@ -2169,6 +2187,9 @@ public class InfoCommandOptions {
@Parameter(names = {"--study", "-s"}, description = "Study [[organization@]project:]study where study and project can be either the ID or UUID", required = false, arity = 1)
public String study;

@Parameter(names = {"--version"}, description = "Comma separated list of clinical versions. 'all' to get all the clinical versions. Not supported if multiple clinical ids are provided", required = false, arity = 1)
public String version;

@Parameter(names = {"--deleted"}, description = "Boolean to retrieve deleted entries", required = false, help = true, arity = 0)
public boolean deleted = false;

Expand Down Expand Up @@ -2204,6 +2225,9 @@ public class CreateInterpretationCommandOptions {
@Parameter(names = {"--include-result"}, description = "Flag indicating to include the created or updated document result in the response", required = false, help = true, arity = 0)
public boolean includeResult = false;

@Parameter(names = {"--name", "-n"}, description = "The body web service name parameter", required = false, arity = 1)
public String name;

@Parameter(names = {"--description"}, description = "The body web service description parameter", required = false, arity = 1)
public String description;

Expand Down Expand Up @@ -2341,6 +2365,9 @@ public class UpdateInterpretationCommandOptions {
@Parameter(names = {"--include-result"}, description = "Flag indicating to include the created or updated document result in the response", required = false, help = true, arity = 0)
public boolean includeResult = false;

@Parameter(names = {"--name", "-n"}, description = "The body web service name parameter", required = false, arity = 1)
public String name;

@Parameter(names = {"--description"}, description = "The body web service description parameter", required = false, arity = 1)
public String description;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package org.opencb.opencga.app.migrations.v3.v3_2_0.TASK_5964;

import com.mongodb.client.model.Filters;
import com.mongodb.client.model.Projections;
import com.mongodb.client.model.UpdateOneModel;
import org.bson.Document;
import org.bson.conversions.Bson;
import org.opencb.opencga.catalog.db.mongodb.OrganizationMongoDBAdaptorFactory;
import org.opencb.opencga.catalog.migration.Migration;
import org.opencb.opencga.catalog.migration.MigrationTool;

import java.util.Arrays;

@Migration(id = "add_interpretation_name", description = "Add Interpretation name #TASK-5964", version = "3.2.0",
language = Migration.MigrationLanguage.JAVA, domain = Migration.MigrationDomain.CATALOG, date = 20240610)
public class AddInterpretationName extends MigrationTool {

@Override
protected void run() throws Exception {
// Add new Interpretation name field
Bson nameDoesNotExistQuery = Filters.exists("name", false);
Bson projection = Projections.include("id");
for (String collection : Arrays.asList(OrganizationMongoDBAdaptorFactory.INTERPRETATION_COLLECTION,
OrganizationMongoDBAdaptorFactory.INTERPRETATION_ARCHIVE_COLLECTION,
OrganizationMongoDBAdaptorFactory.DELETED_INTERPRETATION_COLLECTION)) {
migrateCollection(collection, nameDoesNotExistQuery, projection,
(document, bulk) -> {
Document updateDocument = new Document()
.append("name", document.get("id"));
bulk.add(new UpdateOneModel<>(Filters.eq("_id", document.get("_id")), new Document("$set", updateDocument)));
});
}
}

}
Loading