Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -67,6 +67,7 @@ public interface DatasetDAO extends Transactional<DatasetDAO> {
s.description AS s_description,
s.data_types AS s_data_types,
s.pi_name AS s_pi_name,
s.pi_email AS s_pi_email,
s.create_user_id AS s_create_user_id,
s.create_date AS s_create_date,
s.update_user_id AS s_user_id,
Expand Down Expand Up @@ -176,6 +177,7 @@ void updateDatasetByDatasetId(
s.description AS s_description,
s.data_types AS s_data_types,
s.pi_name AS s_pi_name,
s.pi_email AS s_pi_email,
s.create_user_id AS s_create_user_id,
s.create_date AS s_create_date,
s.update_user_id AS s_user_id,
Expand Down Expand Up @@ -349,6 +351,7 @@ LEFT JOIN (SELECT DISTINCT dataset_id AS id FROM dar_dataset) dar_ds_ids ON dar_
s.description AS s_description,
s.data_types AS s_data_types,
s.pi_name AS s_pi_name,
s.pi_email AS s_pi_email,
s.create_user_id AS s_create_user_id,
s.create_date AS s_create_date,
s.update_user_id AS s_user_id,
Expand Down
38 changes: 24 additions & 14 deletions src/main/java/org/broadinstitute/consent/http/db/StudyDAO.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import java.util.UUID;
import org.broadinstitute.consent.http.db.mapper.FileStorageObjectMapperWithFSOPrefix;
import org.broadinstitute.consent.http.db.mapper.StudyReducer;
import org.broadinstitute.consent.http.models.FileStorageObject;
import org.broadinstitute.consent.http.models.Study;
import org.broadinstitute.consent.http.models.StudyDatasetCountRecord;
import org.jdbi.v3.sqlobject.config.RegisterBeanMapper;
Expand Down Expand Up @@ -36,30 +35,38 @@ public interface StudyDAO extends Transactional<StudyDAO> {
sp.value AS sp_value,
sp.type AS sp_type,
d.dataset_id AS s_dataset_id,
"""
+ FileStorageObject.QUERY_FIELDS_WITH_FSO_PREFIX
+ " "
+ """
FROM
study s
LEFT JOIN study_property sp ON sp.study_id = s.study_id
LEFT JOIN file_storage_object fso ON fso.entity_id = s.uuid::text AND fso.deleted = false
LEFT JOIN dataset d ON d.study_id = s.study_id
WHERE s.study_id = :studyId
""")
fso.file_storage_object_id AS fso_file_storage_object_id,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

fso.entity_id AS fso_entity_id,
fso.file_name AS fso_file_name,
fso.category AS fso_category,
fso.gcs_file_uri AS fso_gcs_file_uri,
Comment thread
rushtong marked this conversation as resolved.
fso.media_type AS fso_media_type,
fso.create_date AS fso_create_date,
fso.create_user_id AS fso_create_user_id,
fso.update_date AS fso_update_date,
fso.update_user_id AS fso_update_user_id,
fso.deleted AS fso_deleted,
fso.delete_user_id AS fso_delete_user_id
FROM
study s
LEFT JOIN study_property sp ON sp.study_id = s.study_id
LEFT JOIN file_storage_object fso ON fso.entity_id = s.uuid::text AND fso.deleted = false
LEFT JOIN dataset d ON d.study_id = s.study_id
WHERE s.study_id = :studyId
""")
Study findStudyById(@Bind("studyId") Integer studyId);

@SqlUpdate(
"""
INSERT INTO study (
name, description,
pi_name, data_types,
pi_name, pi_email, data_types,
public_visibility,
create_user_id, create_date,
uuid
) VALUES (
:name, :description,
:piName, :dataTypes,
:piName, :piEmail, :dataTypes,
:publicVisibility,
:createUserId, :createDate,
:uuid
Expand All @@ -70,6 +77,7 @@ Integer insertStudy(
@Bind("name") String name,
@Bind("description") String description,
@Bind("piName") String piName,
@Bind("piEmail") String piEmail,
@Bind("dataTypes") List<String> dataTypes,
@Bind("publicVisibility") Boolean publicVisibility,
@Bind("createUserId") Integer createUserId,
Expand All @@ -82,6 +90,7 @@ Integer insertStudy(
SET name = :name,
description = :description,
pi_name = :piName,
pi_email = :piEmail,
data_types = :dataTypes,
public_visibility = :publicVisibility,
update_user_id = :updateUserId,
Expand All @@ -93,6 +102,7 @@ void updateStudy(
@Bind("name") String name,
@Bind("description") String description,
@Bind("piName") String piName,
@Bind("piEmail") String piEmail,
@Bind("dataTypes") List<String> dataTypes,
@Bind("publicVisibility") Boolean publicVisibility,
@Bind("updateUserId") Integer updateUserId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class Study {
private String description;
private Boolean publicVisibility;
private String piName;
private String piEmail;
private List<String> dataTypes;
private final Set<Integer> datasetIds = new HashSet<>();
private Set<Dataset> datasets;
Expand Down Expand Up @@ -65,6 +66,14 @@ public void setPiName(String piName) {
this.piName = piName;
}

public String getPiEmail() {
return piEmail;
}

public void setPiEmail(String piEmail) {
this.piEmail = piEmail;
}

public List<String> getDataTypes() {
return dataTypes;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class StudyConversion {
private String phenotype;
private String species;
private String piName;
private String piEmail;
private String dataSubmitterEmail;
private Boolean publicVisibility;
private String nihAnvilUse;
Expand Down Expand Up @@ -71,6 +72,14 @@ public void setPiName(String piName) {
this.piName = piName;
}

public String getPiEmail() {
return piEmail;
}

public void setPiEmail(String piEmail) {
this.piEmail = piEmail;
}

public String getDataSubmitterEmail() {
return dataSubmitterEmail;
}
Expand Down Expand Up @@ -149,6 +158,7 @@ public Study createNewStudyStub() {
study.setDescription(getDescription());
study.setPublicVisibility(getPublicVisibility());
study.setPiName(getPiName());
study.setPiEmail(getPiEmail());
study.setDataTypes(getDataTypes());
return study;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public record StudyPatch(
String phenotypeIndication,
String species,
String piName,
String piEmail,
List<String> dataCustodianEmail,
String alternativeDataSharingPlanTargetDeliveryDate,
String alternativeDataSharingPlanTargetPublicReleaseDate,
Expand Down Expand Up @@ -98,6 +99,7 @@ public boolean isPatchable(Study study) {
checks.add(checkPhenotypeIndication(study));
checks.add(checkSpecies(study));
checks.add(checkPiName(study));
checks.add(checkPiEmail(study));
checks.add(checkDataCustodians(study));
checks.add(checkTargetDate(study));
checks.add(checkTargetReleaseDate(study));
Expand Down Expand Up @@ -159,6 +161,10 @@ private boolean checkPiName(Study study) {
return piName() != null && !piName().equals(study.getPiName()) && !piName().isBlank();
}

private boolean checkPiEmail(Study study) {
return piEmail() != null && !piEmail().equals(study.getPiEmail()) && !piEmail().isBlank();
}

private boolean checkDataCustodians(Study study) {
Optional<StudyProperty> custodiansProp =
study.getProperties().stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"phenotypeIndication",
"species",
"piName",
"piEmail",
"dataSubmitterUserId",
"dataCustodianEmail",
"publicVisibility",
Expand Down Expand Up @@ -107,6 +108,11 @@ public class DatasetRegistrationSchemaV1 {
@JsonPropertyDescription("Principal Investigator Name")
private String piName;

/** Principal Investigator Email */
@JsonProperty("piEmail")
@JsonPropertyDescription("Principal Investigator Email")
private String piEmail;

/** The user creating the dataset submission (Required) */
@JsonProperty("dataSubmitterUserId")
@JsonPropertyDescription("The user creating the dataset submission")
Expand Down Expand Up @@ -379,6 +385,18 @@ public void setPiName(String piName) {
this.piName = piName;
}

/** Principal Investigator Email */
@JsonProperty("piEmail")
public String getPiEmail() {
return piEmail;
}

/** Principal Investigator Email */
@JsonProperty("piEmail")
public void setPiEmail(String piEmail) {
this.piEmail = piEmail;
}

/** The user creating the dataset submission (Required) */
@JsonProperty("dataSubmitterUserId")
public Integer getDataSubmitterUserId() {
Expand Down Expand Up @@ -839,6 +857,10 @@ public String toString() {
sb.append('=');
sb.append(((this.piName == null) ? "<null>" : this.piName));
sb.append(',');
sb.append("piEmail");
sb.append('=');
sb.append(((this.piEmail == null) ? "<null>" : this.piEmail));
sb.append(',');
sb.append("dataSubmitterUserId");
sb.append('=');
sb.append(((this.dataSubmitterUserId == null) ? "<null>" : this.dataSubmitterUserId));
Expand Down Expand Up @@ -1102,6 +1124,7 @@ public int hashCode() {
((result * 31)
+ ((this.nihICsSupportingStudy == null) ? 0 : this.nihICsSupportingStudy.hashCode()));
result = ((result * 31) + ((this.piName == null) ? 0 : this.piName.hashCode()));
result = ((result * 31) + ((this.piEmail == null) ? 0 : this.piEmail.hashCode()));
result = ((result * 31) + ((this.dbGaPPhsID == null) ? 0 : this.dbGaPPhsID.hashCode()));
result =
((result * 31)
Expand Down Expand Up @@ -1409,6 +1432,9 @@ public boolean equals(Object other) {
&& ((this.piName == rhs.piName)
|| ((this.piName != null)
&& this.piName.equals(rhs.piName))))
&& ((this.piEmail == rhs.piEmail)
|| ((this.piEmail != null)
&& this.piEmail.equals(rhs.piEmail)))
&& ((this.dbGaPPhsID == rhs.dbGaPPhsID)
|| ((this.dbGaPPhsID != null)
&& this.dbGaPPhsID.equals(rhs.dbGaPPhsID))))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public DatasetRegistrationSchemaV1 build(Study study) {
findStringPropValue(study.getProperties(), phenotypeIndication));
schemaV1.setSpecies(findStringPropValue(study.getProperties(), species));
schemaV1.setPiName(study.getPiName());
schemaV1.setPiEmail(study.getPiEmail());
schemaV1.setDataSubmitterUserId(study.getCreateUserId());
schemaV1.setDataCustodianEmail(
findListStringPropValue(study.getProperties(), dataCustodianEmail));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ public Study updateStudyFromRegistration(
registration.getStudyDescription(),
registration.getDataTypes(),
registration.getPiName(),
registration.getPiEmail(),
registration.getPublicVisibility(),
user.getUserId(),
studyProps,
Expand Down Expand Up @@ -250,6 +251,7 @@ private DatasetServiceDAO.StudyInsert createStudyInsert(
registration.getStudyDescription(),
registration.getDataTypes(),
registration.getPiName(),
registration.getPiEmail(),
registration.getPublicVisibility(),
user.getUserId(),
convertRegistrationToStudyProperties(registration),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,7 @@ private Integer updateStudyFromConversion(
study.getName(),
study.getDescription(),
study.getPiName(),
study.getPiEmail(),
study.getDataTypes(),
study.getPublicVisibility(),
userId,
Expand All @@ -727,6 +728,7 @@ private Integer updateStudyFromConversion(
studyConversion.getName(),
studyConversion.getDescription(),
studyConversion.getPiName(),
studyConversion.getPiEmail(),
studyConversion.getDataTypes(),
studyConversion.getPublicVisibility(),
userId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ private Integer executeInsertStudy(Handle handle, StudyInsert insert) {
insert.name,
insert.description,
insert.piName,
insert.piEmail,
insert.dataTypes,
insert.publicVisibility,
insert.userId,
Expand Down Expand Up @@ -291,6 +292,7 @@ private void executeUpdateStudy(Handle handle, StudyUpdate update, boolean repla
update.name,
update.description,
update.piName,
update.piEmail,
update.dataTypes,
update.publicVisibility,
update.userId,
Expand Down Expand Up @@ -459,6 +461,7 @@ private StudyUpdate convertToStudyUpdate(Study study, User user, StudyPatch patc
patch.description() != null ? patch.description() : study.getDescription(),
patch.dataTypes() != null ? patch.dataTypes() : study.getDataTypes(),
patch.piName() != null ? patch.piName() : study.getPiName(),
patch.piEmail() != null ? patch.piEmail() : study.getPiEmail(),
patch.publicVisibility() != null
? patch.publicVisibility()
: study.getPublicVisibility(),
Expand Down Expand Up @@ -698,6 +701,7 @@ public record StudyInsert(
String description,
List<String> dataTypes,
String piName,
String piEmail,
Boolean publicVisibility,
Integer userId,
List<StudyProperty> props,
Expand All @@ -709,6 +713,7 @@ public record StudyUpdate(
String description,
List<String> dataTypes,
String piName,
String piEmail,
Boolean publicVisibility,
Integer userId,
List<StudyProperty> props,
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/assets/schemas/Study.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ properties:
piName:
type: string
description: The name of the PI of the study.
piEmail:
type: string
format: email
description: Principal Investigator Email
publicVisibility:
type: boolean
description: Whether this study is publicly visible or not.
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/changelog-master.xml
Original file line number Diff line number Diff line change
Expand Up @@ -248,4 +248,5 @@
<include file="changesets/changelog-consent-2026-05-01-user-redaction-audit.xml" relativeToChangelogFile="true" />
<include file="changesets/changelog-consent-2026-04-08-dar-daa.xml" relativeToChangelogFile="true" />
<include file="changesets/changelog-consent-2026-04-28-dar-dataset-daa-snapshot.xml" relativeToChangelogFile="true" />
<include file="changesets/changelog-consent-2026-06-02-study-pi-email.xml" relativeToChangelogFile="true" />
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.33.xsd">
<changeSet id="changelog-consent-2026-06-02-study-pi-email" author="grushton">
<addColumn tableName="study">
<column name="pi_email" type="text"/>
</addColumn>
</changeSet>
</databaseChangeLog>
6 changes: 6 additions & 0 deletions src/main/resources/dataset-registration-schema_v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@
"description" : "Principal Investigator Name",
"minLength" : 1
},
"piEmail" : {
"type" : "string",
"format" : "email",
"label" : "Principal Investigator Email",
"description" : "Principal Investigator Email"
},
"dataSubmitterUserId" : {
"type" : "integer",
"label" : "Data Submitter",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1519,6 +1519,7 @@ private Study insertStudyWithProperties(User user) {
name,
description,
piName,
null,
dataTypes,
publicVisibility,
user.getUserId(),
Expand Down
Loading
Loading