75 lines
2.6 KiB
JavaScript
75 lines
2.6 KiB
JavaScript
import allergyasthma from './allergy-asthma-form.js';
|
|
import antiaging from './anti-aging-form.js';
|
|
import cardiology from './cardiology-form.js';
|
|
import dermatology from './dermatology-form.js';
|
|
import dnarepair from './dna-repair-form.js';
|
|
import doctorintakerequest from './doctor-intake-request-form.js';
|
|
import sleepquality from './sleep-quality.js';
|
|
import hairgrowth from './hair-growth-form.js';
|
|
import medicalhistory from './medical-history-form.js';
|
|
import musclegrowth from './muscle-growth-form.js';
|
|
import neurology from './neurology-form.js';
|
|
import oncology from './oncology-form.js';
|
|
import sexualwellness from './sexual-wellness-form.js';
|
|
import urology from './urology-form.js';
|
|
import weightloss from './weight-loss-form.js';
|
|
import guthealth from './gut-health-form.js';
|
|
import anxiety from './anxiety-form.js';
|
|
import injuryrepair from './injury-repair-form.js';
|
|
import menopause from './menopause-form.js';
|
|
|
|
function questionsMapping(data){
|
|
const step = data.steps
|
|
const schema = data.schema
|
|
const questions = []
|
|
for(let pageNo in step){
|
|
const page = step[pageNo]
|
|
let questionHeading = ""
|
|
// let question = page.elements[2]
|
|
for(let i = 0; i < page.elements.length; i++){
|
|
const element = schema[page.elements[i]]
|
|
if(!element)
|
|
continue;
|
|
if(element.type == "static" ) {
|
|
|
|
questionHeading += element.content+" "
|
|
continue;
|
|
}
|
|
let questionObj = {
|
|
pageNo: pageNo,
|
|
label: i < 3 ? questionHeading: "",
|
|
question: i < 3 ? questionHeading: "",
|
|
// subHeading: schema[subHeading].content,
|
|
key: page.elements[i],
|
|
question_key: page.elements[i],
|
|
type: 'exact_match'
|
|
}
|
|
questions.push(questionObj)
|
|
}
|
|
}
|
|
return questions
|
|
}
|
|
export default [
|
|
...questionsMapping(cardiology),
|
|
...questionsMapping(oncology),
|
|
...questionsMapping(dermatology),
|
|
...questionsMapping(medicalhistory),
|
|
...questionsMapping(urology),
|
|
...questionsMapping(doctorintakerequest),
|
|
...questionsMapping(allergyasthma),
|
|
...questionsMapping(weightloss),
|
|
...questionsMapping(musclegrowth),
|
|
...questionsMapping(sexualwellness),
|
|
...questionsMapping(hairgrowth),
|
|
...questionsMapping(antiaging),
|
|
...questionsMapping(dnarepair),
|
|
...questionsMapping(sleepquality),
|
|
...questionsMapping(guthealth),
|
|
...questionsMapping(anxiety),
|
|
...questionsMapping(injuryrepair),
|
|
...questionsMapping(menopause),
|
|
|
|
]
|
|
|
|
console.log(JSON.stringify(questionsExport))
|