Skip to content

Commit

Permalink
Temporary fix for Yibei's schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Kanzer authored and Aaron Kanzer committed Feb 20, 2024
1 parent 2129a41 commit 11038f2
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 24 deletions.
27 changes: 27 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use Node.js version 12 as the base image
FROM node:12-alpine

# Set the working directory in the container
WORKDIR /app

# Install Python and build tools
RUN apk add --update --no-cache python2 g++ make

# Copy package.json and package-lock.json for installing dependencies
COPY package*.json ./

# Install project dependencies
RUN npm install

# Copy the rest of your app's source code from your host to your image filesystem.
COPY . .

# Vue CLI serves on port 8080 by default, expose that port
EXPOSE 8080

# Command to run the app using npm
CMD ["npm", "run", "serve"]

# to run locally:
# docker build -f Dockerfile.dev -t yourapp .
# docker run -v $(pwd):/app -p 8080:8080 --rm yourapp
5 changes: 4 additions & 1 deletion src/components/InputSelector/InputSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
:constraints="valueConstraints"
:selected_language="selected_language"
:reprotermsUrl="reprotermsUrl"
:init="init" v-on:valueChanged="sendData"/>
:init="init"
v-on:valueChanged="sendData"
/>
</div>

<div v-else-if="inputType === 'audioCheck'">
Expand Down Expand Up @@ -341,6 +343,7 @@ export default {
this.$emit('dontKnow');
},
sendData(val) {
console.log(val)
if (val instanceof Date) {
this.$emit('valueChanged', val.getFullYear());
} else this.$emit('valueChanged', val);
Expand Down
15 changes: 6 additions & 9 deletions src/components/Inputs/WebRadio/Radio.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
>
<b-form-radio
v-for="opt in options"
:value="opt.value"
:value="opt.text"
:key="opt.value"
class="mb-3"
>
Expand Down Expand Up @@ -96,7 +96,7 @@ export default {
}
return {
text, // ESLint object-shorthand
value: v['http://schema.repronim.org/value'][0]['@value'],
value: v['http://schema.repronim.org/value'][0]['@value'] ? v['http://schema.repronim.org/value'][0]['@value'] : text,
image: v['http://schema.org/image'] ? v['http://schema.org/image'][0]['@value'] : null,
};
});
Expand Down Expand Up @@ -154,13 +154,10 @@ export default {
e.preventDefault();
this.$emit('valueChanged', this.checkboxSelected);
},
sendData(val) {
this.$emit('valueChanged', val);
},
onSelectImage(d) {
this.selected = d.id;
this.sendData(d.id);
},
sendData() {
console.log(`${this.selected} Aaron`)
this.$emit('valueChanged', this.selected);
}
},
};
Expand Down
6 changes: 4 additions & 2 deletions src/components/Survey/Survey.vue
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,12 @@
},
setResponse(val, index, mp_progress=100) {
const itemUrl = this.context[index]['@id'];
console.log(itemUrl)
let exportVal = val;
let usedList = [];
let isAboutUrl = itemUrl;
if (val.constructor === Object && !val.hasOwnProperty('unitCode')) { // to find sub-activities; condition might need to be changed
console.log(`${val} Aaaaaa`)
if (val?.constructor === Object && !val?.hasOwnProperty('unitCode')) { // to find sub-activities; condition might need to be changed
const sectionItemKey = Object.keys(val)[0];
const sectionItemValue = Object.values(val)[0];
exportVal = sectionItemValue;
Expand Down Expand Up @@ -320,7 +322,7 @@
this.$emit('saveScores', this.srcUrl, this.scores);
}
}
this.updateProgress(mp_progress);
this.updateProgress();
},
setScore(scoreObj, index) {
this.$emit('saveScores', this.context[index]['@id'], scoreObj);
Expand Down
4 changes: 2 additions & 2 deletions src/components/SurveyItem/SurveyItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<!-- https://codepen.io/vikttor_/pen/jeqoPN?page=1& -->
<div class="contextItem align-self-center center w-100">
<transition name="fade" mode="out-in">
<!-- // Aaron-->
<InputSelector v-if="status === 'ready' && ui !== 'multipart' && ui !== 'section'"
:inputType="ui"
:readOnly="widgetType"
Expand Down Expand Up @@ -181,7 +182,7 @@
ui() {
/* eslint-disable */
if (this.data['@type'] && this.data['@type'][0] === "http://schema.repronim.org/Activity") {
return 'section';
console.log(this.data)
}
else if (this.data['http://schema.repronim.org/inputType']) {
return this.data['http://schema.repronim.org/inputType'][0]['@value'];
Expand Down Expand Up @@ -374,7 +375,6 @@
},
clearMPResponses() {
this.mp_responses = {};
this.mp_progress = 0;
this.$emit('setData', {}, this.index);
},
setMPProgress(progress) {
Expand Down
30 changes: 20 additions & 10 deletions src/config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
// module.exports = {
// githubSrc: 'https://raw.githubusercontent.com/ReproNim/demo-protocol/master/DemoProtocol/DemoProtocol_schema',
// startButton: {
// "en": 'Join',
// "es": 'Participar'
// },
// assetsPublicPath: '/reproschema-ui/',
// backendServer: null,
// consent: true,
// showHelp: true,
// contact: '[email protected]',
// emailSubject: 'Help with Covid19 study'
// };

// Yibei's config
module.exports = {
githubSrc: 'https://raw.githubusercontent.com/ReproNim/demo-protocol/master/DemoProtocol/DemoProtocol_schema',
startButton: {
"en": 'Join',
"es": 'Participar'
},
/* eslint-disable */
githubSrc: 'https://raw.githubusercontent.com/repronim/nimh-minimal/main/nimh_minimal/nimh_minimal_schema',
banner: 'NIMH data collection',
startButton: 'Start',
assetsPublicPath: '/reproschema-ui/',
backendServer: null,
consent: true,
showHelp: true,
contact: '[email protected]',
emailSubject: 'Help with Covid19 study'
backendServer: null
};

0 comments on commit 11038f2

Please sign in to comment.