Skip to content

Commit

Permalink
Merge pull request #25 from susom/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
Jordan-M-Schultz authored Feb 20, 2025
2 parents 582227a + 9caf7d4 commit 8af7d28
Show file tree
Hide file tree
Showing 10 changed files with 318 additions and 335 deletions.
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,18 @@ The Rover project aims to prototype a survey configuration in REDCap to assess i
2. Develop a Universal Dashboard via an external module, represented by this repository.

### Configuration Notes:
- Each child project should have all variables in the parent intake and mutable intake forms.
- Each child project is required to have an additional field `univ_last_update` present in the mutable intake form to house the last updated timestamp
- This timestamp field will reflect `survey completion time` of the universal intake (mutable survey)
- **Editing this record from the parent project outside of survey view will not update this time to children projects**
- Each child project should have all variables in the parent intake and mutable intake forms.
- Child form names have to match parent form names exactly - they will otherwise fail to copy over due to the "_complete" variables being based on the survey name.
- Name mismatches will result in data not being copied from parent to child

### Requirements:
1. The Mutable survey in the parent project must have an additional variable `last_editing_user`
2. Each child project must have an additional variable `universal_id` within the immutable intake survey
3. Each child project must have an additional variable `dashboard_submission_user` within their first survey (own)
4. Each child project is required to have an additional field `univ_last_update` present in the mutable intake form to house the last updated timestamp
- This timestamp field will reflect `survey completion time` of the universal intake (mutable survey)
- **Editing this record from the parent project outside of survey view will not update this time to children projects**

### Default naming:
- Immutable survey (1) : `Intake`
- Mutable survey (2) : `Mutable Intake`
2 changes: 2 additions & 0 deletions classes/Child.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ public function saveParentData($universalId, $currentChildRecordId)
{
$childId = $this->getChildProjectId();
$parentData = $this->prepareChildRecord($universalId);
$ts = $this->getParentSurveyTimestamp($universalId);

if(!empty($parentData['universal_id'])){
$parentData['universal_id'] = $parentData['record_id'];
$parentData['record_id'] = $universalId;
}

$parentData['univ_last_update'] = $ts;
$parentData[$this->getPrimaryField()] = $currentChildRecordId;
$res = REDCap::saveData($childId, 'json', json_encode([$parentData]), 'normal');

Expand Down
12 changes: 0 additions & 12 deletions dashboard-ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,3 @@ Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

### Requirements:
1. The Mutable survey in the parent project must have an additional variable `last_editing_user`
2. Child form names have to match parent form names exactly - they will otherwise fail to copy over due to the "_complete" variables being based on the survey name.
- Name mismatches will result in data not being copied from parent to child
3. Child instruments must have every variable present in the parent intake surveys (mutable, and immutable)
4. Each child project must have an additional variable `universal_id` within the immutable intake survey
5. Each child project must have an additional variable `dashboard_submission_user` within their first survey (own)

### Default naming:
- Immutable survey (1) : `Intake`
- Mutable survey (2) : `Mutable Intake`
176 changes: 0 additions & 176 deletions dashboard-ui/dist/assets/index-Bhspmtt5.js

This file was deleted.

181 changes: 181 additions & 0 deletions dashboard-ui/dist/assets/index-BpK8JLyA.js

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions dashboard-ui/src/components/AppHeader/appHeader.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Group, Image } from '@mantine/core';
import {Group, Image, Text} from '@mantine/core';

export function AppHeader() {
return (
Expand All @@ -11,7 +11,16 @@ export function AppHeader() {
fit="contain"
alt="stanford_image"
/>
<p>Prototype</p>
<div style={{
display: 'flex',
flexDirection: 'column',
alignItems: 'flex-end',
justifyContent: 'center', // Ensures content stays centered within header height
height: '100%' // Inherit parent's height
}}>
<p style={{ margin: 0 }}>Prototype</p>
<Text c="dimmed" size="sm">Logged in as: {globalUsername}</Text>
</div>
</Group>

);
Expand Down
1 change: 0 additions & 1 deletion dashboard-ui/src/components/TableMenu/TableMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export function TableMenu({rowData, toggleSuccess, toggleError}){
const [reason, setReason] = useState('')
const [radioValue, setRadioValue] = useState(null)
function onSuccess(response) {
console.log('Success:', response);
close()
toggleSuccess(response)
}
Expand Down
21 changes: 12 additions & 9 deletions dashboard-ui/src/views/ChildContent/childContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export function ChildContent({childInfo, immutableParentInfo, mutableParentInfo}
<Button
size="xs"
color="green"
variant="light"
component="a"
href={data.survey_url}
rightSection={<IconExternalLink size={20} />}
Expand Down Expand Up @@ -186,15 +187,17 @@ export function ChildContent({childInfo, immutableParentInfo, mutableParentInfo}
>Confirm</Button>
</div>
</Modal>
<LoadingOverlay visible={loading} loaderProps={{ type: 'dots', size:"md" }} overlayProps={{ blur: 2 }} />
{renderRequestButton()}
<Modal style={{maxHeight: '80vh', overflow: 'hidden'}} size="80%" opened={childOpened} onClose={childClose} title="Child Intake Submission">
{childOpened && renderChildModal()}
</Modal>
<RequestTable
columns={['Child ID', 'Request Submission', 'Submission Timestamp', 'Submitted By','Survey Link']}
body={body}
/>
<div style={{ position: 'relative' }}>
<LoadingOverlay visible={loading} loaderProps={{ type: 'dots', size:"md" }} overlayProps={{ blur: 2 }} />
{renderRequestButton()}
<Modal style={{maxHeight: '80vh', overflow: 'hidden'}} size="80%" opened={childOpened} onClose={childClose} title="Child Intake Submission">
{childOpened && renderChildModal()}
</Modal>
<RequestTable
columns={['Child ID', 'Request Submission', 'Submission Timestamp', 'Submitted By','Survey Link']}
body={body}
/>
</div>
</div>

)
Expand Down
1 change: 0 additions & 1 deletion dashboard-ui/src/views/Dashboard/dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ export function Dashboard() {
}

const toggleActiveCallback = (res) => {
console.log('inside callback', res)
setIntakes((prevIntakes) => {
return prevIntakes.map((item) => {
if (item.intake_id === res?.data?.record_id) {
Expand Down
Loading

0 comments on commit 8af7d28

Please sign in to comment.