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

[risk=no][RW-13631] Add cdr config for the VWB template that will be cloned to create a workspace #8975

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
6 changes: 4 additions & 2 deletions api/config/cdr_config_local.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@
"hasCopeSurveyData": true,
"hasSurveyConductData": true,
"accessTier": "registered",
"tanagraEnabled": true
"tanagraEnabled": true,
"vwbTemplateId": "03e0a1e6-ddbc-499f-bdaa-6c0c91dc295a"
},
{
"cdrVersionId": 10,
Expand All @@ -168,7 +169,8 @@
"microarrayVcfSingleSampleStoragePath": "microarray/vcf/single_sample",
"accessTier": "controlled",
"tanagraEnabled": true,
"needsV8GenomicExtractionWorkflow": true
"needsV8GenomicExtractionWorkflow": true,
"vwbTemplateId": "03e0a1e6-ddbc-499f-bdaa-6c0c91dc295a"
}
]
}
14 changes: 14 additions & 0 deletions api/db/changelog/db.changelog-244-add-lab-column-to-workspace.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<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
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<changeSet author="tarekahmed" id="db.changelog-244-add-lab-column-to-workspace">
<addColumn tableName="workspace">
<column name="lab" type="ENUM('AOU', 'VWB')">
<constraints nullable="true"/>
</column>
</addColumn>
</changeSet>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<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
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<changeSet author="tarekahmed" id="db.changelog-245-add-vwb-template-id-cdr-version">
<addColumn tableName="cdr_version">
<column name="vwb_template_id" type="varchar(100)"/>
</addColumn>
</changeSet>
</databaseChangeLog>


2 changes: 2 additions & 0 deletions api/db/changelog/db.changelog-master.xml
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@
<include file="changelog/db.changelog-241-replace-user-initial-credits-expiration-status.xml"/>
<include file="changelog/db.changelog-242-remove-old-workspace-columns.xml"/>
<include file="changelog/db.changelog-243-replace-extension-count.xml"/>
<include file="changelog/db.changelog-244-add-lab-column-to-workspace.xml"/>
<include file="changelog/db.changelog-245-add-vwb-template-id-cdr-version.xml"/>
<!--
Note: to update the DB locally, do the following:
- Migrate schema changes: `./project.rb run-local-all-migrations`
Expand Down
18 changes: 16 additions & 2 deletions api/src/main/java/org/pmiops/workbench/db/model/DbCdrVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public class DbCdrVersion {

private Boolean needsV8GenomicExtractionWorkflow;

private String vwbTemplateID;

@Id
@Column(name = "cdr_version_id")
public long getCdrVersionId() {
Expand Down Expand Up @@ -506,6 +508,16 @@ public DbCdrVersion setNeedsV8GenomicExtractionWorkflow(
return this;
}

@Column(name = "vwb_template_id")
public String getVwbTemplateID() {
return vwbTemplateID;
}

public DbCdrVersion setVwbTemplateID(String vwbTemplateID) {
this.vwbTemplateID = vwbTemplateID;
return this;
}

@Override
public int hashCode() {
return Objects.hash(
Expand Down Expand Up @@ -550,7 +562,8 @@ public int hashCode() {
wgsLongReadsHailT2T,
wgsLongReadsJointVcfGRCh38,
wgsLongReadsJointVcfT2T,
needsV8GenomicExtractionWorkflow);
needsV8GenomicExtractionWorkflow,
vwbTemplateID);
}

@Override
Expand Down Expand Up @@ -604,6 +617,7 @@ public boolean equals(Object o) {
&& Objects.equals(wgsLongReadsHailT2T, that.wgsLongReadsHailT2T)
&& Objects.equals(wgsLongReadsJointVcfGRCh38, that.wgsLongReadsJointVcfGRCh38)
&& Objects.equals(wgsLongReadsJointVcfT2T, that.wgsLongReadsJointVcfT2T)
&& Objects.equals(needsV8GenomicExtractionWorkflow, that.needsV8GenomicExtractionWorkflow);
&& Objects.equals(needsV8GenomicExtractionWorkflow, that.needsV8GenomicExtractionWorkflow)
&& Objects.equals(vwbTemplateID, that.vwbTemplateID);
}
}
18 changes: 13 additions & 5 deletions api/src/main/java/org/pmiops/workbench/db/model/DbWorkspace.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.pmiops.workbench.db.model.DbFeaturedWorkspace.DbFeaturedCategory;
import org.pmiops.workbench.model.BillingStatus;
import org.pmiops.workbench.model.DisseminateResearchEnum;
import org.pmiops.workbench.model.ResearchOutcomeEnum;
import org.pmiops.workbench.model.SpecificPopulationEnum;
import org.pmiops.workbench.model.WorkspaceActiveStatus;
import org.pmiops.workbench.model.*;

@Entity
@SecondaryTable(
Expand Down Expand Up @@ -96,6 +92,8 @@ public class DbWorkspace {
private DbFeaturedCategory featuredCategory;
private boolean usesTanagra;

private Workspace.LabEnum lab;

public DbWorkspace() {
setWorkspaceActiveStatusEnum(WorkspaceActiveStatus.ACTIVE);
}
Expand Down Expand Up @@ -790,4 +788,14 @@ public DbWorkspace setUsesTanagra(boolean usesTanagra) {
public boolean isCDRAndWorkspaceTanagraEnabled() {
return usesTanagra && cdrVersion.getTanagraEnabled();
}

@Column(name = "lab")
@Enumerated(EnumType.STRING)
public Workspace.LabEnum getLab() {
return lab;
}

public void setLab(Workspace.LabEnum lab) {
this.lab = lab;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,6 @@ public class CdrVersionVO {
public String wgsLongReadsJointVcfT2T;

public Boolean needsV8GenomicExtractionWorkflow;

public String vwbTemplateID;
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public interface WorkspaceMapper {
@Mapping(target = "initialCredits.exhausted", source = "dbWorkspace.initialCreditsExhausted")
@Mapping(target = "initialCredits.expired", source = "dbWorkspace.initialCreditsExpired")
@Mapping(target = "usesTanagra", source = "dbWorkspace.usesTanagra")
@Mapping(target = "lab", source = "dbWorkspace.lab")
Workspace toApiWorkspace(
DbWorkspace dbWorkspace,
RawlsWorkspaceDetails fcWorkspace,
Expand Down Expand Up @@ -139,6 +140,7 @@ default List<WorkspaceResponse> toApiWorkspaceResponseList(
@Mapping(target = "namespace", source = "workspaceNamespace")
@Mapping(target = "researchPurpose", source = "dbWorkspace")
@Mapping(target = "accessTierShortName", source = "dbWorkspace.cdrVersion.accessTier.shortName")
@Mapping(target = "lab", source = "dbWorkspace.lab")
// provides an incomplete workspace! Only for use by the RecentWorkspace mapper
Workspace onlyForMappingRecentWorkspace(
DbWorkspace dbWorkspace, @Context InitialCreditsService initialCreditsService);
Expand Down Expand Up @@ -202,6 +204,7 @@ RecentWorkspace toApiRecentWorkspace(
@Mapping(target = "initialCreditsExpired", ignore = true)
@Mapping(target = "initialCreditsExhausted", ignore = true)
@Mapping(target = "usesTanagra", ignore = true)
@Mapping(target = "lab", ignore = true)
void mergeResearchPurposeIntoWorkspace(
@MappingTarget DbWorkspace workspace, ResearchPurpose researchPurpose);

Expand Down
6 changes: 6 additions & 0 deletions api/src/main/resources/workbench-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7321,6 +7321,12 @@ components:
type: boolean
description: Whether a workspace uses Tanagra
default: false
lab:
type: string
description: the lab that owns the workspace (aou or vwb)
enum:
- AOU
- VWB

example:
billingAccountName: billingAccounts/000000-AAAAAA-111111
Expand Down
Loading