-
Notifications
You must be signed in to change notification settings - Fork 4
Demographic Changes
Josh Worden edited this page Apr 4, 2018
·
1 revision
Process for making demographic question changes
- Create new demographic questions AND pull integrations
- Sync demos
docker exec radix_radix_1 php app/console app:integration:question-pull
- Update forms to use the new demographic questions instead of old ones.
- Update
input-answer
andidentity-answer
collections with new demographic ids - Remove old demo questions (set
deleted: true
)
// FHC Magazine Demo conversion example
const map = {
questions: [
{ old: ObjectId("5a81d17e2ef21d7de92acdc0"), new: ObjectId("5ac4eb1238ab46f561eaaf0d") },
{ old: ObjectId("5a81d27974265bb4c8e0a840"), new: ObjectId("5ac4ebbb68deea3744b965e8") },
{ old: ObjectId("5a81d46e74265bb4c8e3a0a2"), new: ObjectId("5ac4ebe458ab46a30ce918b9") },
{ old: ObjectId("5a81d4ba74265bb4c8e4057b"), new: ObjectId("5ac4ec0668deeabf45b965eb") },
],
answers: [
{ old: ObjectId("5a81d596ecb82ba61f0041a7"), new: ObjectId("5ac4fc8c1870b525008b4567") },
{ old: ObjectId("5a81d596ecb82ba61f0041a8"), new: ObjectId("5ac4fc8c1870b525008b4568") },
{ old: ObjectId("5a81d596ecb82ba61f0041a9"), new: ObjectId("5ac4fc8c1870b525008b4569") },
{ old: ObjectId("5a81d596ecb82ba61f0041aa"), new: ObjectId("5ac4fc8c1870b525008b456a") },
{ old: ObjectId("5a81d597ecb82ba61f0041ab"), new: ObjectId("5ac4fc8c1870b525008b456b") },
{ old: ObjectId("5a81d597ecb82ba61f0041ac"), new: ObjectId("5ac4fc8c1870b525008b456c") },
{ old: ObjectId("5a81d597ecb82ba61f0041ad"), new: ObjectId("5ac4fc8c1870b525008b456d") },
{ old: ObjectId("5a81d597ecb82ba61f0041ae"), new: ObjectId("5ac4fc8d1870b525008b456e") },
{ old: ObjectId("5a81d598ecb82ba61f0041af"), new: ObjectId("5ac4fc8d1870b525008b456f") },
{ old: ObjectId("5a81d598ecb82ba61f0041b0"), new: ObjectId("5ac4fc8d1870b525008b4570") },
{ old: ObjectId("5a81d598ecb82ba61f0041b1"), new: ObjectId("5ac4fc8d1870b525008b4571") },
{ old: ObjectId("5a81d598ecb82ba61f0041b2"), new: ObjectId("5ac4fc8e1870b525008b4572") },
{ old: ObjectId("5a81d598ecb82ba61f0041b3"), new: ObjectId("5ac4fc8e1870b525008b4573") },
{ old: ObjectId("5a81d598ecb82ba61f0041b4"), new: ObjectId("5ac4fc8e1870b525008b4574") },
{ old: ObjectId("5a81d598ecb82ba61f0041b5"), new: ObjectId("5ac4fc8e1870b525008b4575") },
{ old: ObjectId("5a81d598ecb82ba61f0041b6"), new: ObjectId("5ac4fc8e1870b525008b4576") },
{ old: ObjectId("5a81d598ecb82ba61f0041b7"), new: ObjectId("5ac4fc8e1870b525008b4577") },
{ old: ObjectId("5a81d598ecb82ba61f0041b8"), new: ObjectId("5ac4fc8e1870b525008b4578") },
{ old: ObjectId("5a81d599ecb82ba61f0041b9"), new: ObjectId("5ac4fc8f1870b525008b4579") },
{ old: ObjectId("5a81d599ecb82ba61f0041ba"), new: ObjectId("5ac4fc8f1870b525008b457a") },
{ old: ObjectId("5a81d599ecb82ba61f0041bb"), new: ObjectId("5ac4fc8f1870b525008b457b") },
{ old: ObjectId("5a81d599ecb82ba61f0041bc"), new: ObjectId("5ac4fc8f1870b525008b457c") },
{ old: ObjectId("5a81d599ecb82ba61f0041bd"), new: ObjectId("5ac4fc901870b525008b457d") },
{ old: ObjectId("5a81d59aecb82ba61f0041be"), new: ObjectId("5ac4fc901870b525008b457e") },
{ old: ObjectId("5a81d59aecb82ba61f0041bf"), new: ObjectId("5ac4fc901870b525008b457f") },
{ old: ObjectId("5a81d59aecb82ba61f0041c0"), new: ObjectId("5ac4fc901870b525008b4580") },
{ old: ObjectId("5a81d59aecb82ba61f0041c1"), new: ObjectId("5ac4fc901870b525008b4581") },
{ old: ObjectId("5a81d59aecb82ba61f0041c2"), new: ObjectId("5ac4fc901870b525008b4582") },
{ old: ObjectId("5a81d59aecb82ba61f0041c3"), new: ObjectId("5ac4fc911870b525008b4583") },
{ old: ObjectId("5a81d59becb82ba61f0041c4"), new: ObjectId("5ac4fc911870b525008b4584") },
{ old: ObjectId("5a81d59becb82ba61f0041c5"), new: ObjectId("5ac4fc911870b525008b4585") },
{ old: ObjectId("5a81d59becb82ba61f0041c6"), new: ObjectId("5ac4fc911870b525008b4586") },
{ old: ObjectId("5a81d59becb82ba61f0041c7"), new: ObjectId("5ac4fc921870b525008b4587") },
{ old: ObjectId("5a81d59becb82ba61f0041c8"), new: ObjectId("5ac4fc921870b525008b4588") },
{ old: ObjectId("5a81d59becb82ba61f0041c9"), new: ObjectId("5ac4fc921870b525008b4589") },
{ old: ObjectId("5a81d59becb82ba61f0041ca"), new: ObjectId("5ac4fc921870b525008b458a") },
{ old: ObjectId("5a81d59becb82ba61f0041cb"), new: ObjectId("5ac4fc921870b525008b458b") },
]
};
map.questions.forEach((doc) => {
const question = doc.old;
db.getCollection('form-field').update({ question }, { $set: { question: doc.new } }, { multi: true });
db.getCollection('input-answer').update({ question }, { $set: { question: doc.new } }, { multi: true });
db.getCollection('identity-answer').update({ question }, { $set: { question: doc.new } }, { multi: true });
db.getCollection('question').update({ _id: question }, { $set: { deleted: true } });
})
map.answers.forEach((doc) => {
const value = doc.old;
db.getCollection('input-answer').update({ value }, { $set: { value: doc.new } }, { multi: true });
db.getCollection('identity-answer').update({ value }, { $set: { value: doc.new } }, { multi: true });
db.getCollection('question-choice').update({ _id: value }, { $set: { deleted: true } });
})