Study Information
+ {generateStudyInputFormTextField(setStudy, 'studyName', study?.name, 'Study Name', 'Enter the study name', [FormValidators.REQUIRED])}
-
{
- setStudyPropertyByKey(formData, onChange, input, new StudyType(input.value as string))
+ setStudyPropertyByKey(study, setStudy, input, new StudyTypeProperty(input.value as string))
}}
/>
id="studyDescription"
title="Study Description"
placeholder="Description"
- defaultValue={formData?.description}
+ defaultValue={study?.description}
validators={[FormValidators.REQUIRED]}
- onChange={onChange}
+ onChange={setStudy}
/>
isCreatable={true}
isMulti={true}
optionsAreString={true}
- selectOptions={[
- // The top properties were extracted from the prod database and deduplicated using the query:
- // SELECT property_value, COUNT(*) FROM dataset_property WHERE property_key = 2 GROUP BY property_value ORDER BY COUNT(*) DESC;
- 'CITE-seq',
- 'Hybrid Capture',
- 'RNA-Seq',
- 'scRNA-Seq',
- 'Spatial Transcriptomics',
- 'snRNA-Seq',
- 'Whole Genome (WGS)',
- 'Whole Exome (WES)',
- ]}
- defaultValue={formData?.dataTypes}
- onChange={onChange}
- />
- {generateFormTextField(formData, onChange, new PhenotypeIndication())}
- {generateFormTextField(formData, onChange, new Species())}
- (`${entry.name}` + (entry.abbreviation ? ` (${entry.abbreviation})` : '')))}
+ defaultValue={study?.dataTypes}
+ onChange={setStudy}
/>
+ {generateStudyPropertyFormTextField(study, setStudy, new PhenotypeIndication())}
+ {generateStudyPropertyFormTextField(study, setStudy, new Species())}
+ {generateStudyInputFormTextField(setStudy, 'piName', study?.piName, 'Principal Investigator Name', 'Enter the Principal Investigator\'s name', [FormValidators.REQUIRED])}
},
}}
placeholder="Add one or more emails"
- defaultValue={getStudyPropertyByKey(formData, 'dataCustodianEmail')}
+ defaultValue={getStudyPropertyValueByKey(study, 'dataCustodianEmail')}
onChange={(input: { key: string[], value: unknown, isValid: boolean }) => {
- setStudyPropertyByKey(formData, onChange, input, new DataCustodianEmail(input.value as string[]))
+ setStudyPropertyByKey(study, setStudy, input, new DataCustodianEmail(input.value as string[]))
}}
/>
- {generateFormDateField(formData, onChange, new AlternativeDataSharingPlanTargetDeliveryDate(), [FormValidators.DATE], { width: '45%' })}
- {generateFormDateField(formData, onChange, new AlternativeDataSharingPlanTargetPublicReleaseDate(), [FormValidators.DATE], { width: '45%' })}
+ {generateStudyPropertyFormDateField(study, setStudy, new AlternativeDataSharingPlanTargetDeliveryDate(), [FormValidators.DATE], { width: '45%' })}
+ {generateStudyPropertyFormDateField(study, setStudy, new AlternativeDataSharingPlanTargetPublicReleaseDate(), [FormValidators.DATE], { width: '45%' })}
{ name: true, text: 'Yes, I want my dataset info to be visible and available for requests' },
{ name: false, text: 'No, I do not want my dataset info to be visible and available for requests' },
]}
- defaultValue={formData?.publicVisibility}
- onChange={onChange}
+ defaultValue={study?.publicVisibility}
+ onChange={setStudy}
/>
)
diff --git a/src/pages/data_submission/v2/NihAdministrativeInformation.tsx b/src/pages/data_submission/v2/NihAdministrativeInformation.tsx
new file mode 100644
index 0000000000..efc9a4e5f4
--- /dev/null
+++ b/src/pages/data_submission/v2/NihAdministrativeInformation.tsx
@@ -0,0 +1,153 @@
+import React, { useEffect, useState } from 'react'
+import {
+ CollaboratingSites,
+ ControlledAccessRequiredForGenomicSummaryResultsGSR,
+ ControlledAccessRequiredForGenomicSummaryResultsGSRRequiredExplanation,
+ MultiCenterStudy,
+ NihAnvilUse,
+ NihGenomicProgramAdministratorName,
+ NihGrantContractNumber,
+ NihICsSupportingStudy,
+ NihInstitutionCenterSubmission,
+ NihProgramOfficerName,
+ PiInstitution,
+ Study,
+} from 'src/pages/data_submission/v2/v2-models'
+import {
+ generateStudyPropertyFormTextField, getStudyPropertyValueByKey,
+ removeStudyPropertiesByKeys, setStudyPropertyByKey,
+} from 'src/pages/data_submission/v2/v2-common-functions'
+import { FormField, FormFieldTypes, FormValidators } from 'src/components/forms/forms'
+import {
+ SelectInterfacePickerSelection,
+ SelectOptionsInterfacePicker,
+} from 'src/components/forms/SelectOptionsInterfacePicker'
+import { InstitutionPicker } from 'src/components/forms/InstitutionPicker'
+import { NIHInstitutesAndCenters } from 'src/components/forms/NIHInstitutesAndCenters'
+import { cloneDeep } from 'lodash'
+
+export interface NihAdministrativeInformationProps {
+ study: Study
+ setStudy: React.Dispatch>
+}
+
+export const NihAdministrativeInformation = (props: NihAdministrativeInformationProps) => {
+ const { setStudy, study } = props
+ const [isRequired, setIsRequired] = useState(false)
+
+ useEffect(() => {
+ const nihAnvilUse = getStudyPropertyValueByKey(study, new NihAnvilUse().key) as string
+ setIsRequired(NihAnvilUse.requiresNIHAdministrativeInformation(nihAnvilUse))
+ }, [study])
+
+ return (
+ <>{isRequired && (
+
+
NIH Administrative Information
+
+ {generateStudyPropertyFormTextField(study, setStudy, new NihGrantContractNumber(), [FormValidators.REQUIRED])}
+ entry.key)
+ setStudyPropertyByKey(study, setStudy, { isValid: isValid }, new NihICsSupportingStudy(myMap))
+ }
+ else if (value) {
+ const myVal = value as SelectInterfacePickerSelection
+ const keys = [] as string[]
+ keys.push(myVal.key)
+ setStudyPropertyByKey(study, setStudy, { isValid: isValid }, new NihICsSupportingStudy(keys))
+ }
+ else {
+ setStudyPropertyByKey(study, setStudy, { isValid: isValid }, new NihICsSupportingStudy([]))
+ }
+ }}
+ optionList={NIHInstitutesAndCenters.VALUES}
+ fieldTitle={NihICsSupportingStudy.fieldTitle}
+ fieldPlaceholder={NihICsSupportingStudy.fieldPlaceholderText}
+ isMulti={true}
+ />
+ {generateStudyPropertyFormTextField(study, setStudy, new NihProgramOfficerName(), [FormValidators.REQUIRED])}
+
+ {generateStudyPropertyFormTextField(study, setStudy, new NihGenomicProgramAdministratorName())}
+ {
+ setStudyPropertyByKey(study, setStudy, { isValid: true }, new MultiCenterStudy(value))
+ if (!value) {
+ setStudy((val) => {
+ const newVal = cloneDeep(val)
+ removeStudyPropertiesByKeys(newVal, new Set([CollaboratingSites.key]))
+ return newVal
+ })
+ }
+ }}
+ />
+ {getStudyPropertyValueByKey(study, MultiCenterStudy.key) === true && (
+ null,
+ },
+ }}
+ placeholder="List site and hit enter here..."
+ defaultValue={getStudyPropertyValueByKey(study, CollaboratingSites.key)}
+ onChange={(_key: string, value: string[], isValid: boolean) => setStudyPropertyByKey(study, setStudy, { isValid: isValid }, new CollaboratingSites(value))}
+ />
+ )}
+
+ {
+ setStudyPropertyByKey(study, setStudy, { isValid: true }, new ControlledAccessRequiredForGenomicSummaryResultsGSR(value))
+ if (!value) {
+ setStudy((val) => {
+ const newVal = cloneDeep(val)
+ removeStudyPropertiesByKeys(newVal, new Set([ControlledAccessRequiredForGenomicSummaryResultsGSRRequiredExplanation.key]))
+ return newVal
+ })
+ }
+ }}
+ />
+ {getStudyPropertyValueByKey(study, ControlledAccessRequiredForGenomicSummaryResultsGSR.key) === true && generateStudyPropertyFormTextField(study, setStudy, new ControlledAccessRequiredForGenomicSummaryResultsGSRRequiredExplanation())}
+
+ )}
+ >
+ )
+}
diff --git a/src/pages/data_submission/v2/NihAnvilUseRelated.tsx b/src/pages/data_submission/v2/NihAnvilUseRelated.tsx
index c0bf89fbe7..cdd889a16d 100644
--- a/src/pages/data_submission/v2/NihAnvilUseRelated.tsx
+++ b/src/pages/data_submission/v2/NihAnvilUseRelated.tsx
@@ -2,26 +2,34 @@ import React from 'react'
import {
Study,
NihAnvilUse, DbGaPPhsID,
- DbGaPStudyRegistrationName, EmbargoReleaseDate, SequencingCenter,
+ DbGaPStudyRegistrationName, EmbargoReleaseDate, SequencingCenter, PiInstitution, NihGrantContractNumber,
+ NihICsSupportingStudy, NihProgramOfficerName, NihInstitutionCenterSubmission, NihGenomicProgramAdministratorName,
+ MultiCenterStudy, CollaboratingSites, ControlledAccessRequiredForGenomicSummaryResultsGSR,
+ ControlledAccessRequiredForGenomicSummaryResultsGSRRequiredExplanation, AlternativeDataSharingPlan,
+ AlternativeDataSharingPlanReasons, AlternativeDataSharingPlanExplanation, AlternativeDataSharingPlanDataSubmitted,
+ AlternativeDataSharingPlanDataReleased,
} from 'src/pages/data_submission/v2/v2-models'
import { FormField, FormFieldTypes, FormValidators } from 'src/components/forms/forms'
import {
- generateFormDateField,
- generateFormTextField,
- getStudyPropertyByKey,
- MasterChangeHandler,
+ generateStudyPropertyFormDateField,
+ generateStudyPropertyFormTextField,
+ getStudyPropertyValueByKey, removeStudyPropertiesByKeys,
setStudyPropertyByKey,
} from 'src/pages/data_submission/v2/v2-common-functions'
+import { cloneDeep, unset } from 'lodash'
+import { ALTERNATIVE_DATA_SHARING_PLAN_FILE, FileProperty } from 'src/pages/data_submission/v2/DataSubmissionFormV2'
export interface NihAnvilUseRelatedProps {
- formData: Study
- onChange: MasterChangeHandler
+ study: Study
+ setStudy: React.Dispatch>
+ setFiles: React.Dispatch>
}
export const NihAnvilUseRelated = (props: NihAnvilUseRelatedProps) => {
const {
- onChange,
- formData,
+ setStudy,
+ study,
+ setFiles,
} = props
return (
@@ -32,18 +40,51 @@ export const NihAnvilUseRelated = (props: NihAnvilUseRelatedProps) => {
title="Will you or did you submit data to the NIH?"
type={FormFieldTypes.RADIOGROUP}
options={NihAnvilUse.NIH_ANVIL_USE_RADIOGROUP_OPTIONS}
- defaultValue={getStudyPropertyByKey(formData, 'nihAnvilUse')}
+ defaultValue={getStudyPropertyValueByKey(study, 'nihAnvilUse')}
validators={[FormValidators.REQUIRED]}
- onChange={(input: { key: string, value: unknown, isValid: boolean }) => {
- setStudyPropertyByKey(formData, onChange, input, new NihAnvilUse(input.value as string))
+ onChange={(input: { key: string, value: string | undefined, isValid: boolean }) => {
+ setStudyPropertyByKey(study, setStudy, input, new NihAnvilUse(input.value as string))
+ if (NihAnvilUse.requiresNIHAdministrativeInformation(input.value)) {
+ setStudy((val) => {
+ const newVal = cloneDeep(val)
+ removeStudyPropertiesByKeys(newVal, new Set([DbGaPPhsID.key,
+ DbGaPStudyRegistrationName.key,
+ EmbargoReleaseDate.key,
+ SequencingCenter.key,
+ PiInstitution.key,
+ NihGrantContractNumber.key,
+ NihICsSupportingStudy.key,
+ NihProgramOfficerName.key,
+ NihInstitutionCenterSubmission.key,
+ NihGenomicProgramAdministratorName.key,
+ MultiCenterStudy.key,
+ CollaboratingSites.key,
+ ControlledAccessRequiredForGenomicSummaryResultsGSR.key,
+ ControlledAccessRequiredForGenomicSummaryResultsGSRRequiredExplanation.key,
+ AlternativeDataSharingPlan.key,
+ AlternativeDataSharingPlanReasons.key,
+ AlternativeDataSharingPlanExplanation.key,
+ AlternativeDataSharingPlanDataSubmitted.key,
+ AlternativeDataSharingPlanDataReleased.key,
+ ]))
+ return newVal
+ })
+ setFiles((val) => {
+ const newVal = cloneDeep(val)
+ if (val?.key === ALTERNATIVE_DATA_SHARING_PLAN_FILE) {
+ unset(newVal, ALTERNATIVE_DATA_SHARING_PLAN_FILE)
+ }
+ return newVal
+ })
+ }
}}
/>
- {getStudyPropertyByKey(formData, 'nihAnvilUse') === NihAnvilUse.YES_NHGRI_YES_PHS_ID && (
+ {getStudyPropertyValueByKey(study, 'nihAnvilUse') === NihAnvilUse.YES_NHGRI_YES_PHS_ID && (
<>
- {generateFormTextField(formData, onChange, new DbGaPPhsID(), [FormValidators.REQUIRED])}
- {generateFormTextField(formData, onChange, new DbGaPStudyRegistrationName())}
- {generateFormDateField(formData, onChange, new EmbargoReleaseDate(), [FormValidators.DATE])}
- {generateFormTextField(formData, onChange, new SequencingCenter())}
+ {generateStudyPropertyFormTextField(study, setStudy, new DbGaPPhsID(), [FormValidators.REQUIRED])}
+ {generateStudyPropertyFormTextField(study, setStudy, new DbGaPStudyRegistrationName())}
+ {generateStudyPropertyFormDateField(study, setStudy, new EmbargoReleaseDate(), [FormValidators.DATE])}
+ {generateStudyPropertyFormTextField(study, setStudy, new SequencingCenter())}
>
)}
diff --git a/src/pages/data_submission/v2/NihDataManagement.tsx b/src/pages/data_submission/v2/NihDataManagement.tsx
new file mode 100644
index 0000000000..17aa008bb8
--- /dev/null
+++ b/src/pages/data_submission/v2/NihDataManagement.tsx
@@ -0,0 +1,185 @@
+import React from 'react'
+import {
+ AlternativeDataSharingPlan,
+ AlternativeDataSharingPlanDataReleased, AlternativeDataSharingPlanDataSubmitted,
+ AlternativeDataSharingPlanExplanation, AlternativeDataSharingPlanReasons,
+ NihAnvilUse,
+ Study,
+} from 'src/pages/data_submission/v2/v2-models'
+import {
+ generateStudyPropertyFormTextField,
+ generateStudyPropertyYesNoField,
+ getStudyPropertyValueByKey,
+ removeStudyPropertiesByKeys, setStudyPropertyByKey,
+} from 'src/pages/data_submission/v2/v2-common-functions'
+import { FormField, FormFieldTypes, FormValidators } from 'src/components/forms/forms'
+import { cloneDeep, set, unset } from 'lodash'
+import { ALTERNATIVE_DATA_SHARING_PLAN_FILE, FileProperty } from 'src/pages/data_submission/v2/DataSubmissionFormV2'
+
+export interface NihDataManagementProps {
+ study: Study
+ setStudy: React.Dispatch>
+ files: FileProperty
+ setFiles: React.Dispatch>
+}
+export const NihDataManagement = (props: NihDataManagementProps) => {
+ const { setStudy, setFiles, files, study } = props
+
+ const onAlternativeDataSharingPlanReasonsChange = ({ key }: { key: string }) => {
+ let setReasons: string[] = getStudyPropertyValueByKey(study, AlternativeDataSharingPlanReasons.key) as string[] ?? []
+ if (Object.keys(AlternativeDataSharingPlanReasons.VALUES).includes(key)) {
+ const target = AlternativeDataSharingPlanReasons.VALUES[key as keyof typeof AlternativeDataSharingPlanReasons.VALUES]
+ const index = setReasons.indexOf(target)
+ let removed = false
+ if (index > -1) {
+ setReasons.splice(index, 1)
+ removed = true
+ }
+ else {
+ setReasons.push(target)
+ }
+ if ((target === AlternativeDataSharingPlanReasons.VALUES.isInformedConsentProcessesInadequate) && removed) {
+ if (setReasons.includes(AlternativeDataSharingPlanReasons.VALUES.legalRestrictions)) {
+ setReasons = [AlternativeDataSharingPlanReasons.VALUES.legalRestrictions]
+ }
+ else {
+ setReasons = []
+ }
+ }
+ setStudyPropertyByKey(study, setStudy, { isValid: true }, new AlternativeDataSharingPlanReasons(setReasons))
+ }
+ }
+
+ return (
+
+ {(
+ NihAnvilUse.requiresNIHAdministrativeInformation(getStudyPropertyValueByKey(study, NihAnvilUse.key) as string | undefined) && (
+ <>
+
NIH Data Management & Sharing Policy Details
+
{
+ setStudyPropertyByKey(study, setStudy, { isValid: true }, new AlternativeDataSharingPlan(value))
+ if (!value) {
+ setStudy((val) => {
+ const newVal = cloneDeep(val)
+ removeStudyPropertiesByKeys(newVal, new Set([AlternativeDataSharingPlanReasons.key,
+ AlternativeDataSharingPlanExplanation.key,
+ AlternativeDataSharingPlanDataSubmitted.key,
+ AlternativeDataSharingPlanDataReleased.key]))
+ unset(study, 'alternativeDataSharingPlanFile')
+ return newVal
+ })
+ }
+ }}
+ />
+ {(getStudyPropertyValueByKey(study, AlternativeDataSharingPlan.key) === true) && (
+
+
Please mark the reasons for which you are requesting an Alternative Data Sharing plan (check all that apply)*
+
+
+ {(getStudyPropertyValueByKey(study, AlternativeDataSharingPlanReasons.key) as string[] ?? []).includes(AlternativeDataSharingPlanReasons.VALUES.isInformedConsentProcessesInadequate) && (
+
+
+
+
+
+
+
+
+ )}
+ {generateStudyPropertyFormTextField(study, setStudy, new AlternativeDataSharingPlanExplanation(), [FormValidators.REQUIRED])}
+
{
+ setFiles((val: FileProperty) => {
+ const newFiles = cloneDeep(val)
+ set(newFiles, key, value)
+ return newFiles
+ })
+ }}
+ />
+ {
+ setStudyPropertyByKey(study, setStudy, input, new AlternativeDataSharingPlanDataSubmitted(input.value as string))
+ }}
+ />
+ {generateStudyPropertyYesNoField(study, setStudy, new AlternativeDataSharingPlanDataReleased())}
+
+ )}
+ >
+ ))}
+
+ )
+}
diff --git a/src/pages/data_submission/v2/v2-common-functions.tsx b/src/pages/data_submission/v2/v2-common-functions.tsx
index 5493e15d23..366937da53 100644
--- a/src/pages/data_submission/v2/v2-common-functions.tsx
+++ b/src/pages/data_submission/v2/v2-common-functions.tsx
@@ -3,29 +3,63 @@ import {
Study,
StudyProperty,
StringStudyProperty,
- DateStudyProperty,
+ DateStudyProperty, BooleanStudyProperty,
} from 'src/pages/data_submission/v2/v2-models'
-import { FormField } from 'src/components/forms/forms'
+import { FormField, FormFieldTypes } from 'src/components/forms/forms'
+import { cloneDeep, set } from 'lodash'
-export type MasterChangeHandler = ({ key, value, isValid }: { key: string, value: unknown, isValid: boolean }) => void
+export type MasterChangeHandler = ({ key, value, isValid, remove }: { key: string, value: unknown, isValid: boolean, remove?: boolean }) => void
-export const generateFormTextField = (formData: Study, onChange: MasterChangeHandler, studyProperty: StringStudyProperty, validators: Array = []) => {
+export const generateStudyPropertyYesNoField = (formData: Study, setStudy: React.Dispatch>, studyProperty: BooleanStudyProperty) => {
+ return (
+ {
+ studyProperty.value = value
+ setStudyPropertyByKey(formData, setStudy, { isValid: true }, studyProperty)
+ }}
+ />
+ )
+}
+
+export const generateStudyPropertyFormTextField = (formData: Study, setStudy: React.Dispatch>, studyProperty: StringStudyProperty, validators: Array = []) => {
return (
{
studyProperty.value = input.value as string
- setStudyPropertyByKey(formData, onChange, input, studyProperty)
+ setStudyPropertyByKey(formData, setStudy, input, studyProperty)
+ }}
+ />
+ )
+}
+
+export const generateStudyInputFormTextField = (setStudy: React.Dispatch>, id: string, initialValue: string | undefined, title: string, placeholder: string, validators: Array = []) => {
+ return (
+ {
+ setStudy((val: Study) => {
+ const newForm = cloneDeep(val)
+ return set(newForm, input.key, input.value)
+ })
}}
/>
)
}
-export const generateFormDateField = (formData: Study, onChange: MasterChangeHandler, studyProperty: DateStudyProperty, validators: Array = [], style: unknown = {}) => {
+export const generateStudyPropertyFormDateField = (formData: Study, setStudy: React.Dispatch>, studyProperty: DateStudyProperty, validators: Array = [], style: unknown = {}) => {
return (
{
studyProperty.value = input.value as Date
- setStudyPropertyByKey(formData, onChange, input, studyProperty)
+ setStudyPropertyByKey(formData, setStudy, input, studyProperty)
}}
/>
)
}
-export const setStudyPropertyByKey = (formData: Study, onChange: MasterChangeHandler, input: { isValid: boolean }, propertyInstance: StudyProperty) => {
+export const setStudyPropertyByKey = (formData: Study, setStudy: React.Dispatch>, input: { isValid: boolean }, propertyInstance: StudyProperty) => {
if (!input.isValid) {
return
}
- formData.properties = formData.properties ?? []
- const filteredProperty = formData.properties.find(prop => prop.key === propertyInstance.key)
+ const studyToUpdate = cloneDeep(formData)
+ studyToUpdate.properties = studyToUpdate.properties ?? []
+ const filteredProperty = studyToUpdate.properties.find(prop => prop.key === propertyInstance.key)
if (filteredProperty) {
filteredProperty.value = propertyInstance.value
}
else {
- formData.properties.push(propertyInstance.toJSON() as StudyProperty)
+ studyToUpdate.properties.push(propertyInstance.toJSON() as StudyProperty)
+ }
+ setStudy(() => {
+ return studyToUpdate
+ })
+}
+
+export const removeStudyPropertiesByKeys = (study: Study, keys: Set) => {
+ if (!study?.properties || !Array.isArray(study.properties)) {
+ return study
+ }
+ else {
+ const arr: StudyProperty[] = study.properties
+ let i = 0
+ while (i < arr.length) {
+ if (keys.has(arr[i].key)) {
+ arr.splice(i, 1)
+ }
+ else {
+ ++i
+ }
+ }
}
- onChange({ key: 'properties', value: formData.properties, isValid: input.isValid })
}
-export const getStudyPropertyByKey = (formData: Study, key: string) => {
+export const getStudyPropertyValueByKey = (formData: Study, key: string): unknown => {
if (!formData?.properties) {
return undefined
}
diff --git a/src/pages/data_submission/v2/v2-models.ts b/src/pages/data_submission/v2/v2-models.ts
deleted file mode 100644
index 9267463b41..0000000000
--- a/src/pages/data_submission/v2/v2-models.ts
+++ /dev/null
@@ -1,258 +0,0 @@
-import { Dataset, FileStorageObject } from 'src/types/model'
-
-export type StudyPropertyType = 'Boolean' | 'String' | 'Number' | 'Date' | 'Json'
-
-export class StudyProperty {
- key: string
- studyPropertyId?: number
- studyId?: number
- type: StudyPropertyType
- value?: unknown
-
- constructor(key: string, type: StudyPropertyType, value?: unknown, studyId?: number, studyPropertyId?: number) {
- this.key = key
- this.studyId = studyId
- this.studyPropertyId = studyPropertyId
- this.type = type
- this.value = value
- }
-
- toJSON() {
- const obj = {
- key: this.key,
- value: this.value,
- studyId: this.studyId,
- studyPropertyId: this.studyPropertyId,
- }
- if (!obj.studyId) {
- delete obj.studyId
- }
- if (!obj.studyPropertyId) {
- delete obj.studyPropertyId
- }
- return obj
- }
-}
-
-export class StringStudyProperty extends StudyProperty {
- fieldTitle: string
- fieldPlaceholderText: string
- constructor(key: string, fieldTitle: string, fieldPlaceholderText: string, value?: unknown, studyId?: number, studyPropertyId?: number) {
- super(key, 'String', value, studyId, studyPropertyId)
- this.fieldPlaceholderText = fieldPlaceholderText
- this.fieldTitle = fieldTitle
- }
-}
-
-export class DateStudyProperty extends StudyProperty {
- fieldTitle: string
- fieldPlaceholderText: string
- constructor(key: string, fieldTitle: string, fieldPlaceholderText: string, value?: unknown, studyId?: number, studyPropertyId?: number) {
- super(key, 'Date', value, studyId, studyPropertyId)
- this.fieldPlaceholderText = fieldPlaceholderText
- this.fieldTitle = fieldTitle
- }
-}
-
-export class NihGrantContractNumber extends StudyProperty {
- constructor(value: string, studyId?: number, studyPropertyId?: number) {
- super('nihGrantContractNumber', 'String' as StudyPropertyType, value, studyId, studyPropertyId)
- }
-}
-
-export class SubmittingToAnvil extends StudyProperty {
- constructor(value: boolean, studyId?: number, studyPropertyId?: number) {
- super('submittingToAnvil', 'Boolean' as StudyPropertyType, value, studyId, studyPropertyId)
- }
-}
-
-export class AlternativeDataSharingPlanTargetPublicReleaseDate extends DateStudyProperty {
- constructor(value?: Date, studyId?: number, studyPropertyId?: number) {
- super('alternativeDataSharingPlanTargetPublicReleaseDate', 'Target Public Release Date', 'Please enter date (YYYY-MM-DD)', value, studyId, studyPropertyId)
- }
-}
-
-export class AlternativeDataSharingPlanFileName extends StudyProperty {
- constructor(value: string, studyId?: number, studyPropertyId?: number) {
- super('alternativeDataSharingPlanFileName', 'String' as StudyPropertyType, value, studyId, studyPropertyId)
- }
-}
-
-export class DbGaPStudyRegistrationName extends StringStudyProperty {
- constructor(value?: string, studyId?: number, studyPropertyId?: number) {
- super('dbGaPStudyRegistrationName', 'dbGaP Study Registration Name', 'Name', value, studyId, studyPropertyId)
- }
-}
-
-export class PiInstitution extends StudyProperty {
- constructor(value: number, studyId?: number, studyPropertyId?: number) {
- super('piInstitution', 'Number' as StudyPropertyType, value, studyId, studyPropertyId)
- }
-}
-
-export class DataCustodianEmail extends StudyProperty {
- constructor(value: string[], studyId?: number, studyPropertyId?: number) {
- super('dataCustodianEmail', 'Json' as StudyPropertyType, value, studyId, studyPropertyId)
- }
-}
-
-export class AlternativeDataSharingPlanTargetDeliveryDate extends DateStudyProperty {
- constructor(value?: Date, studyId?: number, studyPropertyId?: number) {
- super('alternativeDataSharingPlanTargetDeliveryDate', 'Target Delivery Date', 'Please enter date (YYYY-MM-DD)', value, studyId, studyPropertyId)
- }
-}
-
-export class PhenotypeIndication extends StringStudyProperty {
- constructor(value?: string, studyId?: number, studyPropertyId?: number) {
- super('phenotypeIndication', 'Phenotype/Indication Studied', 'Enter the "Phenotype/Indication studied"', value, studyId, studyPropertyId)
- }
-}
-
-export class AlternativeDataSharingPlanExplanation extends StudyProperty {
- constructor(value: string, studyId?: number, studyPropertyId?: number) {
- super('alternativeDataSharingPlanExplanation', 'String' as StudyPropertyType, value, studyId, studyPropertyId)
- }
-}
-
-export class AlternativeDataSharingPlanReasons extends StudyProperty {
- constructor(value: string[], studyId?: number, studyPropertyId?: number) {
- super('alternativeDataSharingPlanReasons', 'Json' as StudyPropertyType, value, studyId, studyPropertyId)
- }
-}
-
-export class Species extends StringStudyProperty {
- constructor(value?: string, studyId?: number, studyPropertyId?: number) {
- super('species', 'Species', 'Species', value, studyId, studyPropertyId)
- }
-}
-
-export class NihICsSupportingStudy extends StudyProperty {
- constructor(value: string[], studyId?: number, studyPropertyId?: number) {
- super('nihICsSupportingStudy', 'Json' as StudyPropertyType, value, studyId, studyPropertyId)
- }
-}
-
-export class AlternativeDataSharingPlanDataSubmitted extends StudyProperty {
- constructor(value: string, studyId?: number, studyPropertyId?: number) {
- super('alternativeDataSharingPlanDataSubmitted', 'String' as StudyPropertyType, value, studyId, studyPropertyId)
- }
-}
-
-export class AlternativeDataSharingPlanControlledOpenAccess extends StudyProperty {
- constructor(value: string, studyId?: number, studyPropertyId?: number) {
- super('alternativeDataSharingPlanControlledOpenAccess', 'String' as StudyPropertyType, value, studyId, studyPropertyId)
- }
-}
-
-export class NihInstitutionCenterSubmission extends StudyProperty {
- constructor(value: string, studyId?: number, studyPropertyId?: number) {
- super('nihInstitutionCenterSubmission', 'String' as StudyPropertyType, value, studyId, studyPropertyId)
- }
-}
-
-export class MultiCenterStudy extends StudyProperty {
- constructor(value: boolean, studyId?: number, studyPropertyId?: number) {
- super('multiCenterStudy', 'Boolean' as StudyPropertyType, value, studyId, studyPropertyId)
- }
-}
-
-export class AlternativeDataSharingPlan extends StudyProperty {
- constructor(value: boolean, studyId?: number, studyPropertyId?: number) {
- super('alternativeDataSharingPlan', 'Boolean' as StudyPropertyType, value, studyId, studyPropertyId)
- }
-}
-
-export class DbGaPPhsID extends StringStudyProperty {
- constructor(value?: string, studyId?: number, studyPropertyId?: number) {
- super('dbGaPPhsID', 'dbGaP phs ID', 'Enter phs ID', value, studyId, studyPropertyId)
- }
-}
-
-export class EmbargoReleaseDate extends DateStudyProperty {
- constructor(value?: Date, studyId?: number, studyPropertyId?: number) {
- super('embargoReleaseDate', 'Embargo Release Date', 'YYYY-MM-DD', value, studyId, studyPropertyId)
- }
-}
-
-export class StudyType extends StudyProperty {
- constructor(value: string, studyId?: number, studyPropertyId?: number) {
- super('studyType', 'String' as StudyPropertyType, value, studyId, studyPropertyId)
- }
-}
-
-export class SequencingCenter extends StringStudyProperty {
- constructor(value?: string, studyId?: number, studyPropertyId?: number) {
- super('sequencingCenter', 'Sequencing Center', 'Name', value, studyId, studyPropertyId)
- }
-}
-
-export class AlternativeDataSharingPlanDataReleased extends StudyProperty {
- constructor(value: boolean, studyId?: number, studyPropertyId?: number) {
- super('alternativeDataSharingPlanDataReleased', 'Boolean' as StudyPropertyType, value, studyId, studyPropertyId)
- }
-}
-
-export class ControlledAccessRequiredForGenomicSummaryResultsGSR extends StudyProperty {
- constructor(value: boolean, studyId?: number, studyPropertyId?: number) {
- super('controlledAccessRequiredForGenomicSummaryResultsGSR', 'Boolean' as StudyPropertyType, value, studyId, studyPropertyId)
- }
-}
-
-export class NihProgramOfficerName extends StudyProperty {
- constructor(value: string, studyId?: number, studyPropertyId?: number) {
- super('nihProgramOfficerName', 'String' as StudyPropertyType, value, studyId, studyPropertyId)
- }
-}
-
-export class NihAnvilUse extends StudyProperty {
- static readonly YES_NHGRI_YES_PHS_ID = 'I am NHGRI funded and I have a dbGaP PHS ID already'
- static readonly YES_NHGRI_NO_PHS_ID = 'I am NHGRI funded and I do not have a dbGaP PHS ID'
- static readonly NO_NHGRI_YES_ANVIL = 'I am not NHGRI funded but I am seeking to submit data to AnVIL'
- static readonly NO_NHGRI_NO_ANVIL = 'I am not NHGRI funded and do not plan to store data in AnVIL'
- static readonly NIH_ANVIL_USE_RADIOGROUP_OPTIONS = [
- { text: NihAnvilUse.YES_NHGRI_YES_PHS_ID, name: NihAnvilUse.YES_NHGRI_YES_PHS_ID },
- { text: NihAnvilUse.YES_NHGRI_NO_PHS_ID, name: NihAnvilUse.YES_NHGRI_NO_PHS_ID },
- { text: NihAnvilUse.NO_NHGRI_YES_ANVIL, name: NihAnvilUse.NO_NHGRI_YES_ANVIL },
- { text: NihAnvilUse.NO_NHGRI_NO_ANVIL, name: NihAnvilUse.NO_NHGRI_NO_ANVIL },
- ]
-
- constructor(value: string, studyId?: number, studyPropertyId?: number) {
- super('nihAnvilUse', 'String' as StudyPropertyType, value, studyId, studyPropertyId)
- }
-}
-
-export class NihGenomicProgramAdministratorName extends StudyProperty {
- constructor(value: string, studyId?: number, studyPropertyId?: number) {
- super('nihGenomicProgramAdministratorName', 'String' as StudyPropertyType, value, studyId, studyPropertyId)
- }
-}
-
-export class CollaboratingSites extends StudyProperty {
- constructor(value: string[], studyId?: number, studyPropertyId?: number) {
- super('collaboratingSites', 'Json' as StudyPropertyType, value, studyId, studyPropertyId)
- }
-}
-
-export class ControlledAccessRequiredForGenomicSummaryResultsGSRRequiredExplanation extends StudyProperty {
- constructor(value: string, studyId?: number, studyPropertyId?: number) {
- super('controlledAccessRequiredForGenomicSummaryResultsGSRRequiredExplanation', 'String' as StudyPropertyType, value, studyId, studyPropertyId)
- }
-}
-
-export interface Study {
- studyId?: number
- uuid?: string
- name?: string
- description?: string
- dataTypes?: string[]
- piName?: string
- publicVisibility?: boolean
- datasetIds?: number[]
- datasets?: Dataset[]
- properties?: StudyProperty[]
- alternativeDataSharingPlan?: FileStorageObject
- createDate?: string // Date?
- createUserId?: number
- updateDate?: string // Date?
- updateUserId?: number
-}
diff --git a/src/pages/data_submission/v2/v2-models.tsx b/src/pages/data_submission/v2/v2-models.tsx
new file mode 100644
index 0000000000..8318894329
--- /dev/null
+++ b/src/pages/data_submission/v2/v2-models.tsx
@@ -0,0 +1,342 @@
+import { Dataset, FileStorageObject } from 'src/types/model'
+import { StudyType } from 'src/components/forms/StudyType'
+import React from 'react'
+
+export type StudyPropertyType = 'Boolean' | 'String' | 'Number' | 'Date' | 'Json'
+
+export class StudyProperty {
+ key: string
+ studyPropertyId?: number
+ studyId?: number
+ type: StudyPropertyType
+ value?: unknown
+
+ constructor(key: string, type: StudyPropertyType, value?: unknown, studyId?: number, studyPropertyId?: number) {
+ this.key = key
+ this.studyId = studyId
+ this.studyPropertyId = studyPropertyId
+ this.type = type
+ this.value = value
+ }
+
+ toJSON() {
+ const obj = {
+ key: this.key,
+ value: this.value,
+ studyId: this.studyId,
+ studyPropertyId: this.studyPropertyId,
+ }
+ if (!obj.studyId) {
+ delete obj.studyId
+ }
+ if (!obj.studyPropertyId) {
+ delete obj.studyPropertyId
+ }
+ return obj
+ }
+}
+
+export class StringStudyProperty extends StudyProperty {
+ fieldTitle: string
+ fieldPlaceholderText: string
+ constructor(key: string, fieldTitle: string, fieldPlaceholderText: string, value?: unknown, studyId?: number, studyPropertyId?: number) {
+ super(key, 'String', value, studyId, studyPropertyId)
+ this.fieldPlaceholderText = fieldPlaceholderText
+ this.fieldTitle = fieldTitle
+ }
+}
+
+export class BooleanStudyProperty extends StudyProperty {
+ fieldTitle: string | React.JSX.Element
+ constructor(key: string, fieldTitle: string | React.JSX.Element, value?: boolean | undefined, studyId?: number, studyPropertyId?: number) {
+ super(key, 'Boolean', value, studyId, studyPropertyId)
+ this.fieldTitle = fieldTitle
+ }
+}
+
+export class DateStudyProperty extends StudyProperty {
+ fieldTitle: string
+ fieldPlaceholderText: string
+ constructor(key: string, fieldTitle: string, fieldPlaceholderText: string, value?: unknown, studyId?: number, studyPropertyId?: number) {
+ super(key, 'Date', value, studyId, studyPropertyId)
+ this.fieldPlaceholderText = fieldPlaceholderText
+ this.fieldTitle = fieldTitle
+ }
+}
+
+export class NihGrantContractNumber extends StringStudyProperty {
+ static readonly key = 'nihGrantContractNumber'
+ constructor(value?: string, studyId?: number, studyPropertyId?: number) {
+ super(NihGrantContractNumber.key, 'NIH Grant or Contract Number', 'Enter the Grant or Contract Number', value, studyId, studyPropertyId)
+ }
+}
+
+export class SubmittingToAnvil extends StudyProperty {
+ static readonly key = 'submittingToAnvil'
+ constructor(value: boolean, studyId?: number, studyPropertyId?: number) {
+ super(SubmittingToAnvil.key, 'Boolean' as StudyPropertyType, value, studyId, studyPropertyId)
+ }
+}
+
+export class AlternativeDataSharingPlanTargetPublicReleaseDate extends DateStudyProperty {
+ static readonly key = 'alternativeDataSharingPlanTargetPublicReleaseDate'
+ constructor(value?: Date, studyId?: number, studyPropertyId?: number) {
+ super(AlternativeDataSharingPlanTargetPublicReleaseDate.key, 'Target Public Release Date', 'Please enter date (YYYY-MM-DD)', value, studyId, studyPropertyId)
+ }
+}
+
+export class AlternativeDataSharingPlanFileName extends StudyProperty {
+ static readonly key = 'alternativeDataSharingPlanFileName'
+ constructor(value: string, studyId?: number, studyPropertyId?: number) {
+ super(AlternativeDataSharingPlanFileName.key, 'String' as StudyPropertyType, value, studyId, studyPropertyId)
+ }
+}
+
+export class DbGaPStudyRegistrationName extends StringStudyProperty {
+ static readonly key = 'dbGaPStudyRegistrationName'
+ constructor(value?: string, studyId?: number, studyPropertyId?: number) {
+ super(DbGaPStudyRegistrationName.key, 'dbGaP Study Registration Name', 'Name', value, studyId, studyPropertyId)
+ }
+}
+
+export class PiInstitution extends StudyProperty {
+ static readonly key = 'piInstitution'
+ static readonly fieldTitle = 'Principal Investigator Institution'
+ constructor(value: number, studyId?: number, studyPropertyId?: number) {
+ super(PiInstitution.key, 'Number' as StudyPropertyType, value, studyId, studyPropertyId)
+ }
+}
+
+export class DataCustodianEmail extends StudyProperty {
+ static readonly key = 'dataCustodianEmail'
+ constructor(value: string[], studyId?: number, studyPropertyId?: number) {
+ super(DataCustodianEmail.key, 'Json' as StudyPropertyType, value, studyId, studyPropertyId)
+ }
+}
+
+export class AlternativeDataSharingPlanTargetDeliveryDate extends DateStudyProperty {
+ static readonly key = 'alternativeDataSharingPlanTargetDeliveryDate'
+ constructor(value?: Date, studyId?: number, studyPropertyId?: number) {
+ super(AlternativeDataSharingPlanTargetDeliveryDate.key, 'Target Delivery Date', 'Please enter date (YYYY-MM-DD)', value, studyId, studyPropertyId)
+ }
+}
+
+export class PhenotypeIndication extends StringStudyProperty {
+ static readonly key = 'phenotypeIndication'
+ constructor(value?: string, studyId?: number, studyPropertyId?: number) {
+ super(PhenotypeIndication.key, 'Phenotype/Indication Studied', 'Enter the "Phenotype/Indication studied"', value, studyId, studyPropertyId)
+ }
+}
+
+export class AlternativeDataSharingPlanExplanation extends StringStudyProperty {
+ static readonly key = 'alternativeDataSharingPlanExplanation'
+ static readonly fieldTitle = 'Explanation for request'
+ static readonly fieldPlaceholderText = 'Enter the explanation for the request'
+ constructor(value?: string, studyId?: number, studyPropertyId?: number) {
+ super(AlternativeDataSharingPlanExplanation.key, AlternativeDataSharingPlanExplanation.fieldTitle, AlternativeDataSharingPlanExplanation.fieldPlaceholderText, value, studyId, studyPropertyId)
+ }
+}
+
+export class AlternativeDataSharingPlanReasons extends StudyProperty {
+ static readonly key = 'alternativeDataSharingPlanReasons'
+ static readonly VALUES = {
+ legalRestrictions: 'Legal Restrictions',
+ isInformedConsentProcessesInadequate: 'Informed consent processes are inadequate to support data for sharing for the following reasons:',
+ consentFormsUnavailable: 'The consent forms are unavailable or non-existent for samples collected after January 25, 2015',
+ consentProcessDidNotAddressFutureUseOrBroadSharing: 'The consent process did not specifically address future use or broad data sharing for samples collected after January 25, 2015',
+ consentProcessInadequatelyAddressesRisk: 'The consent process inadequately addresses risks related to future use or broad data sharing for samples collected after January 25, 2015',
+ consentProcessPrecludesFutureUseOrBroadSharing: 'The consent process specifically precludes future use or broad data sharing (including a statement that use of data will be limited to the original researchers)',
+ otherInformedConsentLimitationsOrConcerns: 'Other informed consent limitations or concerns',
+ otherReasonForRequest: 'Other',
+ }
+
+ constructor(value: string[], studyId?: number, studyPropertyId?: number) {
+ super('alternativeDataSharingPlanReasons', 'Json' as StudyPropertyType, value, studyId, studyPropertyId)
+ }
+}
+
+export class Species extends StringStudyProperty {
+ static readonly key = 'species'
+ constructor(value?: string, studyId?: number, studyPropertyId?: number) {
+ super(Species.key, 'Species', 'Species', value, studyId, studyPropertyId)
+ }
+}
+
+export class NihICsSupportingStudy extends StudyProperty {
+ static readonly key = 'nihICsSupportingStudy'
+ static readonly fieldTitle = 'NIH ICs Supporting the Study'
+ static readonly fieldPlaceholderText = 'Institute/Center Name'
+ constructor(value: string[], studyId?: number, studyPropertyId?: number) {
+ super(NihICsSupportingStudy.key, 'Json' as StudyPropertyType, value, studyId, studyPropertyId)
+ }
+}
+
+export class AlternativeDataSharingPlanDataSubmitted extends StudyProperty {
+ static readonly key = 'alternativeDataSharingPlanDataSubmitted'
+ static readonly fieldTitle = 'Data will be submitted:'
+ constructor(value?: string, studyId?: number, studyPropertyId?: number) {
+ super(AlternativeDataSharingPlanDataSubmitted.key, 'String' as StudyPropertyType, value, studyId, studyPropertyId)
+ }
+}
+
+export class AlternativeDataSharingPlanControlledOpenAccess extends StudyProperty {
+ static readonly key = 'alternativeDataSharingPlanControlledOpenAccess'
+ constructor(value: string, studyId?: number, studyPropertyId?: number) {
+ super(AlternativeDataSharingPlanControlledOpenAccess.key, 'String' as StudyPropertyType, value, studyId, studyPropertyId)
+ }
+}
+
+export class NihInstitutionCenterSubmission extends StudyProperty {
+ static readonly key = 'nihInstitutionCenterSubmission'
+ static readonly fieldTitle = 'NIH Institute/Center for Submission'
+ static readonly fieldPlaceholderText = 'Institute/Center Name'
+ constructor(value: string, studyId?: number, studyPropertyId?: number) {
+ super(NihInstitutionCenterSubmission.key, 'String' as StudyPropertyType, value, studyId, studyPropertyId)
+ }
+}
+
+export class MultiCenterStudy extends BooleanStudyProperty {
+ static readonly key = 'multiCenterStudy'
+ static readonly fieldTitle = 'Is this a multi-center study?'
+ constructor(value?: boolean, studyId?: number, studyPropertyId?: number) {
+ super(MultiCenterStudy.key, MultiCenterStudy.fieldTitle, value, studyId, studyPropertyId)
+ }
+}
+
+export class AlternativeDataSharingPlan extends BooleanStudyProperty {
+ static readonly key = 'alternativeDataSharingPlan'
+ static readonly fieldTitle = (
+
+ Are you requesting an Alternative Data Sharing Plan
+ {' '}
+
+ (info)
+
+ {' '}
+ for samples that cannot be shared through a public repository or database?
+
+ )
+
+ constructor(value?: boolean, studyId?: number, studyPropertyId?: number) {
+ super(AlternativeDataSharingPlan.key, AlternativeDataSharingPlan.fieldTitle, value, studyId, studyPropertyId)
+ }
+}
+
+export class DbGaPPhsID extends StringStudyProperty {
+ static readonly key = 'dbGaPPhsID'
+ constructor(value?: string, studyId?: number, studyPropertyId?: number) {
+ super(DbGaPPhsID.key, 'dbGaP phs ID', 'Enter phs ID', value, studyId, studyPropertyId)
+ }
+}
+
+export class EmbargoReleaseDate extends DateStudyProperty {
+ static readonly key = 'embargoReleaseDate'
+ constructor(value?: Date, studyId?: number, studyPropertyId?: number) {
+ super(EmbargoReleaseDate.key, 'Embargo Release Date', 'YYYY-MM-DD', value, studyId, studyPropertyId)
+ }
+}
+
+export class StudyTypeProperty extends StudyProperty {
+ static readonly key = 'studyType'
+ static readonly fieldTitle = 'Study Type'
+ static readonly fieldPlaceholderText = 'Select a Study Type'
+ static readonly STUDY_TYPE_OPTIONS = StudyType.NAME_VALUES
+
+ constructor(value: string, studyId?: number, studyPropertyId?: number) {
+ super(StudyTypeProperty.key, 'String' as StudyPropertyType, value, studyId, studyPropertyId)
+ }
+}
+
+export class SequencingCenter extends StringStudyProperty {
+ static readonly key = 'sequencingCenter'
+ constructor(value?: string, studyId?: number, studyPropertyId?: number) {
+ super(SequencingCenter.key, 'Sequencing Center', 'Name', value, studyId, studyPropertyId)
+ }
+}
+
+export class AlternativeDataSharingPlanDataReleased extends BooleanStudyProperty {
+ static readonly key = 'alternativeDataSharingPlanDataReleased'
+ static readonly fieldTitle = 'Data to be released will meet the timeframes specified in the NHGRI Guidance for Data Submission and Data Release'
+ constructor(value?: boolean, studyId?: number, studyPropertyId?: number) {
+ super(AlternativeDataSharingPlanDataReleased.key, AlternativeDataSharingPlanDataReleased.fieldTitle, value, studyId, studyPropertyId)
+ }
+}
+
+export class ControlledAccessRequiredForGenomicSummaryResultsGSR extends BooleanStudyProperty {
+ static readonly key = 'controlledAccessRequiredForGenomicSummaryResultsGSR'
+ static readonly fieldTitle = 'Is controlled access required for genomic summary results (GSR)?'
+ constructor(value?: boolean, studyId?: number, studyPropertyId?: number) {
+ super(ControlledAccessRequiredForGenomicSummaryResultsGSR.key, ControlledAccessRequiredForGenomicSummaryResultsGSR.fieldTitle, value, studyId, studyPropertyId)
+ }
+}
+
+export class NihProgramOfficerName extends StringStudyProperty {
+ static readonly key = 'nihProgramOfficerName'
+ constructor(value?: string, studyId?: number, studyPropertyId?: number) {
+ super(NihProgramOfficerName.key, 'NIH Program Officer Name', 'Enter the NIH Program Officer\'s Name', value, studyId, studyPropertyId)
+ }
+}
+
+export class NihAnvilUse extends StudyProperty {
+ static readonly key = 'nihAnvilUse'
+ static readonly YES_NHGRI_YES_PHS_ID = 'I am NHGRI funded and I have a dbGaP PHS ID already'
+ static readonly YES_NHGRI_NO_PHS_ID = 'I am NHGRI funded and I do not have a dbGaP PHS ID'
+ static readonly NO_NHGRI_YES_ANVIL = 'I am not NHGRI funded but I am seeking to submit data to AnVIL'
+ static readonly NO_NHGRI_NO_ANVIL = 'I am not NHGRI funded and do not plan to store data in AnVIL'
+ static readonly NIH_ANVIL_USE_RADIOGROUP_OPTIONS = [
+ { text: NihAnvilUse.YES_NHGRI_YES_PHS_ID, name: NihAnvilUse.YES_NHGRI_YES_PHS_ID },
+ { text: NihAnvilUse.YES_NHGRI_NO_PHS_ID, name: NihAnvilUse.YES_NHGRI_NO_PHS_ID },
+ { text: NihAnvilUse.NO_NHGRI_YES_ANVIL, name: NihAnvilUse.NO_NHGRI_YES_ANVIL },
+ { text: NihAnvilUse.NO_NHGRI_NO_ANVIL, name: NihAnvilUse.NO_NHGRI_NO_ANVIL },
+ ]
+
+ constructor(value?: string, studyId?: number, studyPropertyId?: number) {
+ super(NihAnvilUse.key, 'String' as StudyPropertyType, value, studyId, studyPropertyId)
+ }
+
+ static requiresNIHAdministrativeInformation(value: string | null | undefined): boolean {
+ if (!value) {
+ return false
+ }
+ return [NihAnvilUse.YES_NHGRI_YES_PHS_ID, NihAnvilUse.YES_NHGRI_NO_PHS_ID, NihAnvilUse.NO_NHGRI_YES_ANVIL].includes(value)
+ }
+}
+
+export class NihGenomicProgramAdministratorName extends StringStudyProperty {
+ static readonly key = 'nihGenomicProgramAdministratorName'
+ constructor(value?: string, studyId?: number, studyPropertyId?: number) {
+ super(NihGenomicProgramAdministratorName.key, 'NIH Genomic Program Administrator Name', 'Enter the NIH Genomic Program Administrator\'s name ', value, studyId, studyPropertyId)
+ }
+}
+
+export class CollaboratingSites extends StudyProperty {
+ static readonly key = 'collaboratingSites'
+ constructor(value: string[], studyId?: number, studyPropertyId?: number) {
+ super(CollaboratingSites.key, 'Json' as StudyPropertyType, value, studyId, studyPropertyId)
+ }
+}
+
+export class ControlledAccessRequiredForGenomicSummaryResultsGSRRequiredExplanation extends StringStudyProperty {
+ static readonly key = 'controlledAccessRequiredForGenomicSummaryResultsGSRRequiredExplanation'
+ constructor(value?: string, studyId?: number, studyPropertyId?: number) {
+ super(ControlledAccessRequiredForGenomicSummaryResultsGSRRequiredExplanation.key, 'If yes, explain why controlled access is needed for GSR.', 'Enter explanation here', value, studyId, studyPropertyId)
+ }
+}
+
+export interface Study {
+ studyId?: number
+ uuid?: string
+ name?: string
+ description?: string
+ dataTypes?: string[]
+ piName?: string
+ publicVisibility?: boolean
+ datasetIds?: number[]
+ datasets?: Dataset[]
+ properties?: StudyProperty[]
+ alternativeDataSharingPlan?: FileStorageObject
+ createDate?: string // Date?
+ createUserId?: number
+ updateDate?: string // Date?
+ updateUserId?: number
+}
diff --git a/src/pages/user_profile/AffiliationAndRoles.tsx b/src/pages/user_profile/AffiliationAndRoles.tsx
index c384af2dec..c394b4c91e 100644
--- a/src/pages/user_profile/AffiliationAndRoles.tsx
+++ b/src/pages/user_profile/AffiliationAndRoles.tsx
@@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react'
import { Institution as InstitutionAPI } from '../../libs/ajax/Institution'
import { Notifications } from '../../libs/utils'
-import { DuosUser, Institution } from '../../types/model'
+import { DuosUser, InstitutionInterface } from '../../types/model'
interface AffiliationAndRoleProps {
readonly user: DuosUser
@@ -9,7 +9,7 @@ interface AffiliationAndRoleProps {
export default function AffiliationAndRole(props: AffiliationAndRoleProps) {
const { user } = props
- const [institution, setInstitution] = useState()
+ const [institution, setInstitution] = useState()
const [roles, setRoles] = useState('')
useEffect(() => {
@@ -20,7 +20,7 @@ export default function AffiliationAndRole(props: AffiliationAndRoleProps) {
const allRoles = user?.roles?.map(role => role.name).join(', ')
setRoles(allRoles)
if (user?.institutionId) {
- const institution: Institution = await InstitutionAPI.getById(user.institutionId)
+ const institution: InstitutionInterface = await InstitutionAPI.getById(user.institutionId)
if (institution) {
setInstitution(institution)
}
diff --git a/src/routing/AppRoutes.tsx b/src/routing/AppRoutes.tsx
index a7b8b79f50..61f5c96942 100644
--- a/src/routing/AppRoutes.tsx
+++ b/src/routing/AppRoutes.tsx
@@ -101,8 +101,10 @@ const AppRoutes = (props: AppRoutesProps) => {
}>
} />
} />
- }>
- } />
+ }>
+ }>
+ } />
+
} />
diff --git a/src/types/model.ts b/src/types/model.ts
index eedc3bc38c..532ebbcae0 100644
--- a/src/types/model.ts
+++ b/src/types/model.ts
@@ -123,7 +123,7 @@ export interface LibraryCard {
export type OrganizationType = 'For-Profit' | 'Nonprofit'
-export interface Institution {
+export interface InstitutionInterface {
id: number
name: string
itDirectorName?: string