Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Website: Dedicated page for all survey answers #928

Merged
merged 5 commits into from
Dec 28, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions shared/locales/en/website-responses.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"select-survey": "Select survey",
"multiple-answers": "multiple answers",
"responses-since": "Survey responses since {{sinceDate}}",
"title": "Survey Responses",
"answers": "answers",
"data-points": "data points",
"onboarding": {
"title": "Onboarding Survey",
"description": "Filled out once before recipient is joining the program"
},
"checkin": {
"title": "Check-in Survey",
"description": "Filled out every 6 months while recipient is in the program"
},
"offboarding": {
"title": "Offboarding Survey",
"description": "Filled out once when recipient is finishing the program"
},
"offboarded-checkin": {
"title": "Follow-up Survey",
"description": "Filled out every 6 months after recipient left the program"
}
}
4 changes: 3 additions & 1 deletion shared/locales/en/website-survey.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
"questions": {
"yesNoChoices": {
"yes": "Yes",
"no": "No"
"no": "No",
"true": "Yes",
"false": "No"
},
"livingLocationTitleV1": "Where do you live?",
"livingLocationChoices": {
Expand Down
4 changes: 3 additions & 1 deletion shared/locales/it/website-survey.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
"questions": {
"yesNoChoices": {
"yes": "Yes",
"no": "No"
"no": "No",
"true": "Yes",
"false": "No"
},
"livingLocationTitleV1": "Where do you live?",
"livingLocationChoices": {
Expand Down
4 changes: 3 additions & 1 deletion shared/locales/kri/website-survey.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
"questions": {
"yesNoChoices": {
"yes": "Yɛs",
"no": "Nɔ"
"no": "Nɔ",
"true": "Yɛs",
"false": "Nɔ"
},
"livingLocationTitleV1": "Usay yu tap?",
"livingLocationChoices": {
Expand Down
271 changes: 271 additions & 0 deletions shared/src/types/question.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,271 @@
export interface Question {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! Thanks for improving the types here.

type: QuestionInputType;
name: string;
choices: any[];
choicesTranslationKey?: string;
translationKey: string;
descriptionTranslationKey?: string;
}
Gavriil-Tzortzakis marked this conversation as resolved.
Show resolved Hide resolved

export enum QuestionInputType {
RADIO_GROUP = 'radiogroup',
COMMENT = 'comment',
CHECKBOX = 'checkbox',
RANKING = 'ranking',
}

export const MARITAL_STATUS: Question = {
type: QuestionInputType.RADIO_GROUP,
name: 'maritalStatusV1',
choices: ['married', 'widowed', 'divorced', 'separated', 'neverMarried'],
choicesTranslationKey: 'survey.questions.maritalStatusChoices',
translationKey: 'survey.questions.maritalStatusTitleV1',
};

export const LIVING_LOCATION: Question = {
type: QuestionInputType.RADIO_GROUP,
name: 'livingLocationV1',
choices: [
'westernAreaUrbanFreetown',
'westernAreaRural',
'easternProvince',
'northernProvince',
'southernProvince',
'northWestProvince',
],
translationKey: 'survey.questions.livingLocationTitleV1',
choicesTranslationKey: 'survey.questions.livingLocationChoices',
};

export const BOOLEAN_CHOICES = { choices: [true, false], choicesTranslationKey: 'survey.questions.yesNoChoices' };

export const HAS_DEPENDENTS: Question = {
type: QuestionInputType.RADIO_GROUP,
name: 'hasDependentsV1',
...BOOLEAN_CHOICES,
translationKey: 'survey.questions.hasDependentsTitleV1',
descriptionTranslationKey: 'survey.questions.hasDependentsDescV1',
};

export const NOT_EMPLOYED: Question = {
type: QuestionInputType.RADIO_GROUP,
name: 'notEmployedV1',
...BOOLEAN_CHOICES,
translationKey: 'survey.questions.notEmployedTitleV1',
};

export const NUMBER_OF_DEPENDENTS: Question = {
type: QuestionInputType.RADIO_GROUP,
name: 'nrDependentsV1',
choices: ['1-2', '3-4', '5-7', '8-10', '10-'],
translationKey: 'survey.questions.nrDependentsTitleV1',
choicesTranslationKey: 'survey.questions.nrDependentsChoices',
};

export const SCHOOL_ATTENDANCE: Question = {
type: QuestionInputType.RADIO_GROUP,
name: 'schoolAttendanceV1',
...BOOLEAN_CHOICES,
translationKey: 'survey.questions.attendingSchoolV1',
};

export const EMPLOYMENT_STATUS: Question = {
type: QuestionInputType.RADIO_GROUP,
name: 'employmentStatusV1',
choices: ['employed', 'selfEmployed', 'notEmployed', 'retired'],
translationKey: 'survey.questions.employmentStatusTitleV1',
choicesTranslationKey: 'survey.questions.employmentStatusChoices',
};
export const DISABILITY: Question = {
type: QuestionInputType.RADIO_GROUP,
name: 'disabilityV1',
...BOOLEAN_CHOICES,
translationKey: 'survey.questions.disabilityTitleV1',
};

export const SKIPPING_MEALS: Question = {
type: QuestionInputType.RADIO_GROUP,
name: 'skippingMealsV1',
...BOOLEAN_CHOICES,
translationKey: 'survey.questions.skippingMealsTitleV1',
};

export const SKIPPING_MEALS_LAST_WEEK: Question = {
type: QuestionInputType.RADIO_GROUP,
name: 'skippingMealsLastWeekV1',
...BOOLEAN_CHOICES,
translationKey: 'survey.questions.skippingMealsLastWeekTitleV1',
};

export const SKIPPING_MEALS_LAST_WEEK_3_MEALS: Question = {
type: QuestionInputType.RADIO_GROUP,
name: 'skippingMealsLastWeek3MealsV1',
...BOOLEAN_CHOICES,
translationKey: 'survey.questions.skippingMealsLastWeek3MealsTitleV1',
};

export const UNEXPECTED_EXPENSES_COVERED: Question = {
type: QuestionInputType.RADIO_GROUP,
name: 'unexpectedExpensesCoveredV1',
...BOOLEAN_CHOICES,
translationKey: 'survey.questions.unexpectedExpensesCoveredTitleV1',
};
export const SAVINGS: Question = {
type: QuestionInputType.RADIO_GROUP,
name: 'savingsV1',
...BOOLEAN_CHOICES,
translationKey: 'survey.questions.savingsTitleV1',
};

export const DEBT_PERSONAL: Question = {
type: QuestionInputType.RADIO_GROUP,
name: 'debtPersonalV1',
...BOOLEAN_CHOICES,
translationKey: 'survey.questions.debtPersonalTitleV1',
};

export const DEBT_PERSONAL_REPAY: Question = {
type: QuestionInputType.RADIO_GROUP,
name: 'debtPersonalRepayV1',
...BOOLEAN_CHOICES,
translationKey: 'survey.questions.debtPersonalRepayTitleV1',
};

export const DEBT_HOUSEHOLD: Question = {
type: QuestionInputType.RADIO_GROUP,
name: 'debtHouseholdV1',
...BOOLEAN_CHOICES,
translationKey: 'survey.questions.debtHouseholdTitleV1',
};
export const DEBT_HOUSEHOLD_WHO_REPAYS: Question = {
type: QuestionInputType.RADIO_GROUP,
name: 'debtHouseholdWhoRepaysV1',
...BOOLEAN_CHOICES,
translationKey: 'survey.questions.debtHouseholdWhoRepaysTitleV1',
};
export const OTHER_SUPPORT: Question = {
type: QuestionInputType.RADIO_GROUP,
name: 'otherSupportV1',
...BOOLEAN_CHOICES,
translationKey: 'survey.questions.otherSupportTitleV1',
};

export const PLANNED_ACHIEVEMENT: Question = {
type: QuestionInputType.COMMENT,
name: 'plannedAchievementV1',
translationKey: 'survey.questions.plannedAchievementTitleV1',
choices: [],
};

export const SPENDING: Question = {
type: QuestionInputType.CHECKBOX,
name: 'spendingV1',
choices: ['education', 'food', 'housing', 'healthCare', 'mobility', 'saving', 'investment'],
translationKey: 'survey.questions.spendingTitleV1',
choicesTranslationKey: 'survey.questions.spendingChoices',
};

export const PLANNED_ACHIEVEMENT_REMAINING: Question = {
type: QuestionInputType.COMMENT,
name: 'plannedAchievementRemainingV1',
translationKey: 'survey.questions.plannedAchievementRemainingTitleV1',
choices: [],
};

export const IMPACT_FINANCIAL_INDEPENDENCE: Question = {
type: QuestionInputType.RADIO_GROUP,
name: 'impactFinancialIndependenceV1',
...BOOLEAN_CHOICES,
translationKey: 'survey.questions.financialIndependenceTitleV1',
};

export const IMPACT_LIFE_GENERAL: Question = {
type: QuestionInputType.COMMENT,
name: 'impactLifeGeneralV1',
translationKey: 'survey.questions.impactLifeGeneralTitleV1',
choices: [],
};

export const ACHIEVEMENTS_ACHIEVED: Question = {
type: QuestionInputType.RADIO_GROUP,
name: 'achievementsAchievedV1',
...BOOLEAN_CHOICES,
translationKey: 'survey.questions.achievementsAchievedTitleV1',
};

export const ACHIEVEMENTS_NOT_ACHIEVED: Question = {
type: QuestionInputType.COMMENT,
name: 'achievementsNotAchievedCommentV1',
choices: [],
translationKey: 'survey.questions.achievementsNotAchievedCommentTitleV1',
};

export const HAPPIER: Question = {
type: QuestionInputType.RADIO_GROUP,
name: 'happierV1',
...BOOLEAN_CHOICES,
translationKey: 'survey.questions.happierTitleV1',
};

export const HAPPIER_COMMENT: Question = {
type: QuestionInputType.COMMENT,
name: 'happierCommentV1',
translationKey: 'survey.questions.happierCommentTitleV1',
choices: [],
};
export const NOT_HAPPIER_COMMENT: Question = {
type: QuestionInputType.COMMENT,
translationKey: 'survey.questions.notHappierCommentTitleV1',
name: 'notHappierCommentV1',
choices: [],
};

export const LONG_ENOUGH: Question = {
type: QuestionInputType.RADIO_GROUP,
name: 'longEnough',
translationKey: 'survey.questions.longEnoughTitleV1',
...BOOLEAN_CHOICES,
};

export const RANKING: Question = {
type: QuestionInputType.RANKING,
name: 'spendingRankedV1',
choices: [],
translationKey: 'survey.questions.spendingRankingTitleV1',
descriptionTranslationKey: 'survey.questions.spendingRankingDescV1',
};
Gavriil-Tzortzakis marked this conversation as resolved.
Show resolved Hide resolved

const ALL_QUESTIONS = [
MARITAL_STATUS,
LIVING_LOCATION,
HAS_DEPENDENTS,
NUMBER_OF_DEPENDENTS,
SCHOOL_ATTENDANCE,
EMPLOYMENT_STATUS,
DISABILITY,
SKIPPING_MEALS,
SKIPPING_MEALS_LAST_WEEK,
SKIPPING_MEALS_LAST_WEEK_3_MEALS,
UNEXPECTED_EXPENSES_COVERED,
SAVINGS,
DEBT_PERSONAL,
DEBT_PERSONAL_REPAY,
DEBT_HOUSEHOLD,
DEBT_HOUSEHOLD_WHO_REPAYS,
OTHER_SUPPORT,
PLANNED_ACHIEVEMENT,
SPENDING,
PLANNED_ACHIEVEMENT_REMAINING,
IMPACT_FINANCIAL_INDEPENDENCE,
IMPACT_LIFE_GENERAL,
ACHIEVEMENTS_ACHIEVED,
ACHIEVEMENTS_NOT_ACHIEVED,
HAPPIER,
HAPPIER_COMMENT,
NOT_HAPPIER_COMMENT,
LONG_ENOUGH,
RANKING,
NOT_EMPLOYED,
];

export const QUESTIONS_DICTIONARY: Map<string, Question> = new Map(ALL_QUESTIONS.map((obj) => [obj.name, obj]));
Loading
Loading