Skip to content

Commit

Permalink
Welsh ethnicity update (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
berroar authored Mar 16, 2020
1 parent 8553510 commit 52ab58f
Show file tree
Hide file tree
Showing 10 changed files with 353 additions and 285 deletions.
4 changes: 2 additions & 2 deletions source/jsonnet/england-wales/census_household.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ function(region_code, census_month_year_date) {
ethnic_group(region_code),
ethnic_group_white(region_code),
ethnic_group_mixed,
ethnic_group_asian,
ethnic_group_black,
ethnic_group_asian(region_code),
ethnic_group_black(region_code),
ethnic_group_other,
religion(region_code),
] + understandWelshBlock(region_code) + [
Expand Down
4 changes: 2 additions & 2 deletions source/jsonnet/england-wales/census_individual.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ function(region_code, census_month_year_date) {
ethnic_group(region_code),
ethnic_group_white(region_code),
ethnic_group_mixed,
ethnic_group_asian,
ethnic_group_black,
ethnic_group_asian(region_code),
ethnic_group_black(region_code),
ethnic_group_other,
religion(region_code),
] + understandWelshBlock(region_code) + [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,60 @@ local proxyTitle = {
local englandDescription = 'Includes British, Northern Irish, Irish, Gypsy, Irish Traveller, Roma or any other White background';
local walesDescription = 'Includes Welsh, British, Northern Irish, Irish, Gypsy, Irish Traveller, Roma or any other White background';

local englandAsianEthnicityLabel = 'Asian or Asian British';
local walesAsianEthnicityLabel = 'Asian, Asian Welsh or Asian British';

local englandBlackEthnicityLabel = 'Black, Black British, Caribbean or African';
local walesBlackEthnicityLabel = 'Black, Black Welsh, Black British, Caribbean or African';

local englandAsianEthnicityRoutingRule = {
block: 'asian-ethnic-group',
when: [
{
id: 'ethnic-group-answer',
condition: 'equals any',
values: [englandAsianEthnicityLabel],
},
],
};

local walesAsianEthnicityRoutingRule = {
block: 'asian-ethnic-group',
when: [
{
id: 'ethnic-group-answer',
condition: 'equals any',
values: [walesAsianEthnicityLabel],
},
],
};

local englandBlackEthnicityRoutingRule = {
block: 'black-ethnic-group',
when: [
{
id: 'ethnic-group-answer',
condition: 'equals any',
values: [englandBlackEthnicityLabel],
},
],
};

local walesBlackEthnicityRoutingRule = {
block: 'black-ethnic-group',
when: [
{
id: 'ethnic-group-answer',
condition: 'equals any',
values: [walesBlackEthnicityLabel],
},
],
};

local question(title, region_code) = (
local regionDescription = if region_code == 'GB-WLS' then walesDescription else englandDescription;
local asianEthnicityLabel = if region_code == 'GB-WLS' then walesAsianEthnicityLabel else englandAsianEthnicityLabel;
local blackEthnicityLabel = if region_code == 'GB-WLS' then walesBlackEthnicityLabel else englandBlackEthnicityLabel;
{
id: 'ethnic-group-question',
title: title,
Expand Down Expand Up @@ -47,13 +99,13 @@ local question(title, region_code) = (
description: 'Includes White and Black Caribbean, White and Black African, White and Asian or any other Mixed or Multiple background',
},
{
label: 'Asian or Asian British',
value: 'Asian or Asian British',
label: asianEthnicityLabel,
value: asianEthnicityLabel,
description: 'Includes Indian, Pakistani, Bangladeshi, Chinese or any other Asian background',
},
{
label: 'Black, Black British, Caribbean or African',
value: 'Black, Black British, Caribbean or African',
label: blackEthnicityLabel,
value: blackEthnicityLabel,
description: 'Includes Black British, Caribbean, African or any other Black background',
},
{
Expand All @@ -68,84 +120,70 @@ local question(title, region_code) = (
}
);

function(region_code) {
type: 'Question',
id: 'ethnic-group',
question_variants: [
{
question: question(nonProxyTitle, region_code),
when: [rules.isNotProxy],
},
{
question: question(proxyTitle, region_code),
when: [rules.isProxy],
},
],
routing_rules: [
{
goto: {
block: 'white-ethnic-group',
when: [
{
id: 'ethnic-group-answer',
condition: 'equals',
value: 'White',
},
],
function(region_code) (
local asianEthnicityRoutingRule = if region_code == 'GB-WLS' then walesAsianEthnicityRoutingRule else englandAsianEthnicityRoutingRule;
local blackEthnicityRoutingRule = if region_code == 'GB-WLS' then walesBlackEthnicityRoutingRule else englandBlackEthnicityRoutingRule;
{
type: 'Question',
id: 'ethnic-group',
question_variants: [
{
question: question(nonProxyTitle, region_code),
when: [rules.isNotProxy],
},
},
{
goto: {
block: 'mixed-ethnic-group',
when: [
{
id: 'ethnic-group-answer',
condition: 'equals',
value: 'Mixed or Multiple ethnic groups',
},
],
{
question: question(proxyTitle, region_code),
when: [rules.isProxy],
},
},
{
goto: {
block: 'asian-ethnic-group',
when: [
{
id: 'ethnic-group-answer',
condition: 'equals',
value: 'Asian or Asian British',
},
],
],
routing_rules: [
{
goto: {
block: 'white-ethnic-group',
when: [
{
id: 'ethnic-group-answer',
condition: 'equals',
value: 'White',
},
],
},
},
},
{
goto: {
block: 'black-ethnic-group',
when: [
{
id: 'ethnic-group-answer',
condition: 'equals',
value: 'Black, Black British, Caribbean or African',
},
],
{
goto: {
block: 'mixed-ethnic-group',
when: [
{
id: 'ethnic-group-answer',
condition: 'equals',
value: 'Mixed or Multiple ethnic groups',
},
],
},
},
},
{
goto: {
block: 'other-ethnic-group',
when: [
{
id: 'ethnic-group-answer',
condition: 'equals',
value: 'Other ethnic group',
},
],
{
goto: asianEthnicityRoutingRule,
},
},
{
goto: {
block: 'religion',
{
goto: blackEthnicityRoutingRule,
},
},
],
}
{
goto: {
block: 'other-ethnic-group',
when: [
{
id: 'ethnic-group-answer',
condition: 'equals',
value: 'Other ethnic group',
},
],
},
},
{
goto: {
block: 'religion',
},
},
],
}
)
Original file line number Diff line number Diff line change
@@ -1,79 +1,89 @@
local placeholders = import '../../../lib/placeholders.libsonnet';
local rules = import 'rules.libsonnet';

local question(title) = {
id: 'asian-ethnic-group-question',
title: title,
type: 'General',
answers: [
{
guidance: {
show_guidance: 'Why your answer is important',
hide_guidance: 'Why your answer is important',
contents: [
local question(englandTitle, walesTitle, region_code) = (
local title = if region_code == 'GB-WLS' then walesTitle else englandTitle;
{
id: 'asian-ethnic-group-question',
title: title,
type: 'General',
answers: [
{
guidance: {
show_guidance: 'Why your answer is important',
hide_guidance: 'Why your answer is important',
contents: [
{
description: 'Your answer will help to support equality and fairness in your community. Councils and government use information on ethnic group to make sure they',
list: [
'provide services and share funding fairly',
'understand and represent everyone’s interests',
],
},
],
},
id: 'asian-ethnic-group-answer',
mandatory: false,
options: [
{
label: 'Indian',
value: 'Indian',
},
{
label: 'Pakistani',
value: 'Pakistani',
},
{
description: 'Your answer will help to support equality and fairness in your community. Councils and government use information on ethnic group to make sure they',
list: [
'provide services and share funding fairly',
'understand and represent everyone’s interests',
],
label: 'Bangladeshi',
value: 'Bangladeshi',
},
{
label: 'Chinese',
value: 'Chinese',
},
{
label: 'Any other Asian background',
value: 'Any other Asian background',
description: 'Select to enter answer',
detail_answer: {
id: 'asian-ethnic-group-answer-other',
type: 'TextField',
mandatory: false,
label: 'Enter Asian background',
},
},
],
type: 'Radio',
},
id: 'asian-ethnic-group-answer',
mandatory: false,
options: [
{
label: 'Indian',
value: 'Indian',
},
{
label: 'Pakistani',
value: 'Pakistani',
},
{
label: 'Bangladeshi',
value: 'Bangladeshi',
},
{
label: 'Chinese',
value: 'Chinese',
},
{
label: 'Any other Asian background',
value: 'Any other Asian background',
description: 'Select to enter answer',
detail_answer: {
id: 'asian-ethnic-group-answer-other',
type: 'TextField',
mandatory: false,
label: 'Enter Asian background',
},
},
],
type: 'Radio',
},
],
};
],
}
);

local nonProxyTitle = 'Which one best describes your Asian or Asian British ethnic group or background?';
local proxyTitle = {
local nonProxyEnglandTitle = 'Which one best describes your Asian or Asian British ethnic group or background?';
local proxyEnglandTitle = {
text: 'Which one best describes <em>{person_name_possessive}</em> Asian or Asian British ethnic group or background?',
placeholders: [
placeholders.personNamePossessive,
],
};
local nonProxyWalesTitle = 'Which one best describes your Asian, Asian Welsh or Asian British ethnic group or background?';
local proxyWalesTitle = {
text: 'Which one best describes <em>{person_name_possessive}</em> Asian, Asian Welsh or Asian British ethnic group or background?',
placeholders: [
placeholders.personNamePossessive,
],
};

{
function(region_code) {
type: 'Question',
id: 'asian-ethnic-group',
question_variants: [
{
question: question(nonProxyTitle),
question: question(nonProxyEnglandTitle, nonProxyWalesTitle, region_code),
when: [rules.isNotProxy],
},
{
question: question(proxyTitle),
question: question(proxyEnglandTitle, proxyWalesTitle, region_code),
when: [rules.isProxy],
},
],
Expand Down
Loading

0 comments on commit 52ab58f

Please sign in to comment.