Skip to content

Commit

Permalink
[DCJ-58] Update DAR application to indicate all required DAAs (#2579)
Browse files Browse the repository at this point in the history
  • Loading branch information
aarohinadkarni authored May 23, 2024
1 parent f06fdba commit 86c46b0
Show file tree
Hide file tree
Showing 4 changed files with 147 additions and 9 deletions.
88 changes: 88 additions & 0 deletions src/pages/dar_application/DataAccessAgreements.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import React, { useEffect, useState } from 'react';
import {isNil} from 'lodash/fp';
import { Notifications } from '../../libs/utils';
import { DAA } from '../../libs/ajax/DAA';
import RequiredDAAs from './RequiredDAAs';

import './dar_application.css';

export default function DataAccessAgreements(props) {

const {
save,
attest,
darCode,
isAttested,
cancelAttest,
datasets
} = props;
const [daas, setDaas] = useState([]);

useEffect(() => {
const init = async () => {
try {
const daaList = await DAA.getDaas();
setDaas(daaList);
} catch (error) {
Notifications.showError({
text: 'Error: Unable to retrieve DAAs from server',
});
}
};
init();
}, []);

const DAADownload = (id, fileName) => {
return (
<div className="flex flex-row" style={{ justifyContent: 'flex-start' }}>
<div>
<a target="_blank" rel="noreferrer" onClick={() => DAA.getDaaFileById(id, fileName)} className="button button-white" style={{ marginRight: '2rem' }}>
<span className="glyphicon glyphicon-download"></span>
{' '}
{fileName}
</a>
</div>
</div>
);
};

return (
<div className="dar-step-card">
<h2>Data Access Agreements (DAA)</h2>

<div className="form-group">
<h3>DUOS Code of Conduct</h3>

<p className="data-use-paragraph">
Failure to abide by any term within this Code of Conduct may result in revocation of approved access to datasets obtained through these repositories. Investigators who are approved to access data agree to:
</p>

<ol className="data-use-list">
<li>Use datasets solely in connection with the research project described in the approved Data Access Request for each dataset;</li>
<li>Make no attempt to identify or contact individual participants or groups from whom data were collected, or generate information that could allow participants’ identities to be readily ascertained, without appropriate approvals from the submitting institution;</li>
<li>Maintain the confidentiality of the data and not distribute them to any entity or individual beyond those specified in the approved Data Access Request;</li>
<li>Adhere to the security best practices for controlled-access data subject to the genomic data sharing policy/policies listed below and ensure that only approved users can gain access to data files;</li>
<li>Acknowledge the Intellectual property terms as specified in the Data Access Agreements and data use certification;</li>
<li>Provide appropriate acknowledgement in any dissemination of research findings including the investigator(s) who generated the data, the funding source, accession numbers of the dataset, and the data repository from which the data were accessed; and,</li>
<li>Report any inadvertent data release, break of data security, or other data management incidents in accordance with the terms specified in the Data Use Agreements below and data use certification.</li>
</ol>
</div>

<RequiredDAAs datasets={datasets} daas={daas} daaDownload={DAADownload}/>

<div className="flex flex-row" style={{ justifyContent: 'around', paddingTop: '4rem' }}>
<div className="flex flex-row" style={{ justifyContent: 'flex-start' }}>
{isNil(darCode) && <a id="btn_attest" onClick={attest} className="button button-blue" disabled={isAttested} style={{ marginRight: '2rem' }}>
Attest
</a>}
{isNil(darCode) && <a id="btn_saveDar" onClick={save} className="button button-white" disabled={isAttested}>
Save
</a>}
</div>
{isNil(darCode) && isAttested && <a id="btn_cancelAttest" onClick={cancelAttest} style={{ float: 'right' }} className="button button-white">
Cancel
</a>}
</div>
</div>
);
}
28 changes: 20 additions & 8 deletions src/pages/dar_application/DataAccessRequestApplication.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import { useEffect, useState, useCallback } from 'react';
import ResearcherInfo from './ResearcherInfo';
import DataAccessAgreements from './DataAccessAgreements';
import DataUseAgreements from './DataUseAgreements';
import DataAccessRequest from './DataAccessRequest';
import ResearchPurposeStatement from './ResearchPurposeStatement';
Expand All @@ -22,6 +23,7 @@ import { assign, cloneDeep, get, head, isEmpty, isNil, isString, keys, map } fro
import './DataAccessRequestApplication.css';
import Tabs from '@mui/material/Tabs';
import Tab from '@mui/material/Tab';
import { checkEnv, envGroups } from '../../utils/EnvironmentUtils';

import {
validateDARFormData
Expand Down Expand Up @@ -193,7 +195,7 @@ const DataAccessRequestApplication = (props) => {
setDatasets(datasets);
});
if (!props.readOnlyMode) {
const updatedTabs = [...ApplicationTabs, { name: 'Data Use Agreement' }];
const updatedTabs = checkEnv(envGroups.DEV) ? [...ApplicationTabs, { name: 'Data Access Agreements (DAA)' }] : [...ApplicationTabs, { name: 'Data Use Agreement' }];
setApplicationTabs(updatedTabs);
}
}, [formData.datasetIds, props.readOnlyMode]);
Expand Down Expand Up @@ -606,13 +608,23 @@ const DataAccessRequestApplication = (props) => {

{!props.readOnlyMode ?
<div className='step-container'>
<DataUseAgreements
darCode={formData.darCode}
cancelAttest={() => setIsAttested(false)}
isAttested={isAttested}
attest={attemptSubmit}
save={() => setShowDialogSave(true)}
/>
{checkEnv(envGroups.DEV) ?
<DataAccessAgreements
datasets={datasets}
darCode={formData.darCode}
cancelAttest={() => setIsAttested(false)}
isAttested={isAttested}
attest={attemptSubmit}
save={() => setShowDialogSave(true)}
/> :
<DataUseAgreements
darCode={formData.darCode}
cancelAttest={() => setIsAttested(false)}
isAttested={isAttested}
attest={attemptSubmit}
save={() => setShowDialogSave(true)}
/>
}
</div> : <div />}

{isAttested &&
Expand Down
2 changes: 1 addition & 1 deletion src/pages/dar_application/DataUseAgreements.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ export default function DataUseAgreements(props) {
</div>
</div>
);
}
}
38 changes: 38 additions & 0 deletions src/pages/dar_application/RequiredDAAs.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import React from 'react';

export default function RequiredDAAs(props) {
const { datasets, daas, daaDownload } = props;
const fileNames = new Set();
const daaDivs = datasets.map((dataset) => {
const datasetDacId = dataset.dacId;
if (!datasetDacId) {
return <div key={dataset.id}></div>;
}
const daa = daas.find((daa) => daa.dacs.some((d) => d.dacId === datasetDacId));
const id = daa.daaId;
const fileName = daa.file.fileName.split('.')[0];
if (fileNames.has(fileName)) {
return <div key={id-dataset.name}></div>;
}
fileNames.add(fileName);
return (
<div key={id}>
{daaDownload(id, fileName)}
</div>
);
});
if (fileNames.size === 0) {
return (
<div></div>
);
} else {
return (
<div>
<h3>By submitting this data access request and in accordance with your Institution’s issuance of Library Cards to you for the agreement(s) below.</h3>
<div className="flex flex-row" style={{ justifyContent: 'flex-start' }}>
{daaDivs}
</div>
</div>
);
}
}

0 comments on commit 86c46b0

Please sign in to comment.