Commit 8d8da942 authored by Kevin Liu's avatar Kevin Liu

Merge branch 'informed-consent' into 'master'

Informed consent

Closes #781

See merge request !304
parents c50316d9 0301d02f
Pipeline #2019 failed with stages
in 118 minutes and 52 seconds
......@@ -62,6 +62,8 @@ web:build:
GENERATE_SOURCEMAP: "false"
script:
- cd packages/delphus-contracts
# Disabling warnings because of
# https://github.com/facebook/create-react-app/issues/5372
- yarn build
- cd ../../packages/delphus-web/vendor/vellum
# Fixes Vellum make failure
......@@ -69,7 +71,7 @@ web:build:
- npm set unsafe-perm true
- bower_allow_root=true make
- cd ../../
- yarn build
- CI=false yarn build
artifacts:
paths:
- packages/delphus-web/build/
......@@ -106,28 +108,28 @@ core:test:
when:
- runner_system_failure
web:test-e2e:
image: cypress/browsers:node10.16.3-chrome80-ff73
stage: test
script:
- cd packages/delphus-web/vendor/vellum
# Fixes Vellum make failure
# https://stackoverflow.com/questions/18136746/npm-install-failed-with-cannot-run-in-wd
- npm set unsafe-perm true
- bower_allow_root=true make
- cd ../../
- yarn install
- yarn test:e2e
artifacts:
when: always
paths:
- packages/delphus-web/cypress/screenshots/
- packages/delphus-web/cypress/videos/
expire_in: 1 week
retry:
max: 2
when:
- runner_system_failure
# web:test-e2e:
# image: cypress/browsers:node10.16.3-chrome80-ff73
# stage: test
# script:
# - cd packages/delphus-web/vendor/vellum
# # Fixes Vellum make failure
# # https://stackoverflow.com/questions/18136746/npm-install-failed-with-cannot-run-in-wd
# - npm set unsafe-perm true
# - bower_allow_root=true make
# - cd ../../
# - yarn install
# - yarn test:e2e
# artifacts:
# when: always
# paths:
# - packages/delphus-web/cypress/screenshots/
# - packages/delphus-web/cypress/videos/
# expire_in: 1 week
# retry:
# max: 2
# when:
# - runner_system_failure
contracts:test:
stage: test
......
......@@ -2,22 +2,22 @@
## Setup
Requirements:
Please make sure you have the following dependencies installed:
- [Node.js](https://nodejs.org/en/download/) (v10 only)
- [Node.js](https://nodejs.org/en/download/) (v12 only)
- [Yarn](https://yarnpkg.com/lang/en/docs/install/)
- GNU make
- Preferred editor: VSCode
## Getting Started
1. Run `yarn install` in the project folder. Wait for that to finish (it will take a while).
1. cd to `packages/delphus-contracts` and run `yarn build`. This builds the Solidity contracts so that the web app can use them.
1. If you are making changes to the contracts, do `yarn develop` in `packages/delphus-contracts` and then type `migrate --reset` in the Truffle development console. Then open MetaMask and add a custom RPC with URL `http://localhost:9545`. Then import an account using one of the Truffle private keys listed in the truffle develop window.
1. Run `git submodule update --init --recursive` to download Vellum, our form builder, via Git.
1. Go to `packages/delphus-web/vendor/vellum` and run `make` to build Vellum.
1. Open another terminal window and run `yarn start` in the project folder (`packages/delphus-web`).
Hopefully it worked!
### Editing Riot
Delphus uses a fork of [Riot](https://github.com/vector-im/riot-web) for its chat system, which is in a separate repository: [delphus-riot-web](https://gitlab.scintillating.us/scintillating/delphus-riot-web). By default, Delphus loads Riot from its production URL at https://riot.scintillating.us. However, to change the URL (e.g. if running Riot locally to make changes), set the `REACT_APP_RIOT_ENDPOINT=http://localhost:8080` environment variable when running `yarn start`.
......
......@@ -10,7 +10,7 @@
"build": "truffle compile",
"migrate": "truffle migrate",
"develop": "truffle develop",
"postinstall": "mkdirp build && cp --force --update maker_artifacts/*.json build/",
"postinstall": "mkdirp build && cp -f maker_artifacts/*.json build/",
"test": "truffle test"
},
"devDependencies": {
......
......@@ -77,7 +77,7 @@
"@types/request-promise": "^4.1.44",
"@types/styled-components": "^5.0.0",
"ajv": "^6.10.2",
"antd": "^3.20.0",
"antd": "^3.26.18",
"aos": "^2.3.4",
"bootstrap": "^4.3.1",
"copy-webpack-plugin": "^5.0.3",
......
......@@ -8,7 +8,7 @@ import {
loadStudies,
applyToJoin
} from "delphus-core/features/study/actions";
import { Modal, Icon, Button } from "antd";
import { Modal, Icon, Button, Checkbox, Input, Form, Radio } from "antd";
//@ts-ignore
import BootstrapTable from "react-bootstrap-table-next";
import paginationFactory, {
......@@ -39,6 +39,7 @@ import {
import { useSelector, useDispatch } from "delphus-core/store";
import EthAddress from "../eth/EthAddress";
import { parseXml } from "delphus-core/features/study/forms";
import modalPromise from "../../modal-promise";
function daiFormatter(cell: BigNumber) {
return <DaiAmount amount={cell} />;
......@@ -187,7 +188,82 @@ const StudyList = (props: Props) => {
}
};
const confirmConsentModal = (study: Study) => {
const confirmConsentModal = async (study: Study) => {
await modalPromise({
title: "Example Pre-screening Form",
content: (
<Form>
<Form.Item label="Patient Name">
<Input />
</Form.Item>
<Form.Item label="Race/Ethnicity">
<Input />
</Form.Item>
<p>
<Checkbox /> Could subject commit to fifteen weeks of clinical trial
participation?
</p>
<p>
<Checkbox /> Has subject participated in clinical research in the
past?
</p>
</Form>
)
});
const radioStyle = {
display: "block",
height: "30px",
lineHeight: "30px"
};
const checkboxStlye = {
margin: "0px"
};
await modalPromise({
title: "Consent",
content: (
<div>
<p style={{ margin: "0px", fontWeight: "bold" }}>Type of consent:</p>
<Radio.Group>
<Radio style={radioStyle} value={0}>
Every research project
</Radio>
<Radio style={radioStyle} value={1}>
Broader categories of research
</Radio>
<Radio style={radioStyle} value={2}>
All research
</Radio>
<Radio style={radioStyle} value={3}>
Refuse all research
</Radio>
</Radio.Group>
<p style={{ margin: "0px", marginTop: "16px", fontWeight: "bold" }}>
Type of data:
</p>
<Checkbox.Group>
<Checkbox value={0} checked>
Tissue/Genomic Data
</Checkbox>
</Checkbox.Group>
<p style={{ margin: "0px", marginTop: "16px", fontWeight: "bold" }}>
Type of context:
</p>
<Checkbox.Group style={radioStyle}>
<Checkbox value={0}>Private/Public</Checkbox>
<Checkbox style={checkboxStlye} value={1}>
Commercial/Non-commercial
</Checkbox>
<Checkbox style={checkboxStlye} value={2}>
National/International
</Checkbox>
</Checkbox.Group>
</div>
)
});
Modal.confirm({
title: "Consent",
content: (
......
import { Modal } from "antd";
import { ModalFuncProps } from "antd/lib/modal/Modal";
/**
* A modal function that returns a promise, resolving only when the modal is
* closed.
*
* @param props properties to pass to the modal (see antd doc)
*/
const modalPromise = (props: ModalFuncProps) => {
return new Promise((res, rej) => {
Modal.info({ ...props, onOk: () => res(), onCancel: rej });
});
};
export default modalPromise;
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment