Skip to content

Commit 355d58f

Browse files
Merge pull request #382 from RSE-Sheffield/feat/separate-demographics
Add 3 separate sets of demographics questions
2 parents 2eb21fe + 6b61fab commit 355d58f

20 files changed

+583
-159
lines changed

SORT/settings.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,12 +259,19 @@ def cast_to_boolean(obj: Any) -> bool:
259259
},
260260
}
261261

262+
# Survey content configuration files
262263
SURVEY_TEMPLATE_DIR = BASE_DIR / "data/survey_config"
263264
SURVEY_TEMPLATES = {
264265
"Nurses": "sort_only_config_nurses.json",
265266
"Midwives": "sort_only_config_midwives.json",
266267
"NMAHPs": "sort_only_config_nmahps.json",
267268
}
269+
DEMOGRAPHY_TEMPLATES = {
270+
"Nurses": "demography_only_config_nurses.json",
271+
"Midwives": "demography_only_config_midwives.json",
272+
"NMAHPs": "demography_only_config_nmahps.json",
273+
}
274+
CONSENT_TEMPLATE = "consent_only_config.json"
268275

269276
# Crispy enables Bootstrap styling on Django forms
270277
# https://django-crispy-forms.readthedocs.io/en/latest/install.html

SORT/test/test_case/view.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ def login_superuser(self):
4242
)
4343

4444
def get(
45-
self,
46-
view_name: str,
47-
expected_status_code: int = HTTPStatus.OK,
48-
login: bool = True,
49-
**kwargs
45+
self,
46+
view_name: str,
47+
expected_status_code: int = HTTPStatus.OK,
48+
login: bool = True,
49+
**kwargs
5050
):
5151
"""
5252
Helper method to make a GET request to one of the views in this app.
@@ -63,12 +63,12 @@ def get(
6363
return response
6464

6565
def post(
66-
self,
67-
view_name: str,
68-
expected_status_code: int = HTTPStatus.OK,
69-
login: bool = True,
70-
data: dict = None,
71-
**kwargs
66+
self,
67+
view_name: str,
68+
expected_status_code: int = HTTPStatus.OK,
69+
login: bool = True,
70+
data: dict = None,
71+
**kwargs
7272
):
7373
"""
7474
Helper method to make a POST request to one of the views in this app.
@@ -83,7 +83,8 @@ def post(
8383
if login:
8484
self.login()
8585
response = self.client.post(
86-
django.urls.reverse(view_name, kwargs=kwargs), data=data
86+
path=django.urls.reverse(view_name, kwargs=kwargs),
87+
data=data,
8788
)
8889
self.assertEqual(response.status_code, expected_status_code)
8990
return response
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
{
2+
"sections": [
3+
{
4+
"title": "Demographic",
5+
"type": "demographic",
6+
"description": "Please fill in your demographic information",
7+
"fields": [
8+
{
9+
"type": "text",
10+
"label": "What is your age?",
11+
"required": true,
12+
"sublabels": [],
13+
"options": [],
14+
"enforceValueConstraints": false,
15+
"maxNumChar": 500,
16+
"minNumValue": 0,
17+
"maxNumValue": 100,
18+
"textType": "INTEGER_TEXT",
19+
"disabled": false,
20+
"readOnly": true
21+
},
22+
{
23+
"type": "radio",
24+
"label": "What is your gender?",
25+
"description": "",
26+
"required": true,
27+
"sublabels": [],
28+
"options": [
29+
"Male",
30+
"Female",
31+
"Non-binary",
32+
"Prefer not to say"
33+
],
34+
"disabled": false,
35+
"readOnly": true
36+
},
37+
{
38+
"type": "text",
39+
"label": "How long have you been working in your current organisation? (Number of years)",
40+
"required": true,
41+
"sublabels": [],
42+
"options": [],
43+
"enforceValueConstraints": false,
44+
"maxNumChar": 500,
45+
"minNumValue": 0,
46+
"maxNumValue": 100,
47+
"textType": "INTEGER_TEXT",
48+
"disabled": false,
49+
"readOnly": true
50+
},
51+
{
52+
"type": "radio",
53+
"label": "What is your current pay band?",
54+
"required": true,
55+
"sublabels": [],
56+
"options": [
57+
"Band 2",
58+
"Band 3",
59+
"Band 4",
60+
"Band 5",
61+
"Band 6",
62+
"Band 7",
63+
"Band 8a",
64+
"Band 8b",
65+
"Band 8c",
66+
"Band 8d",
67+
"Band 9"
68+
],
69+
"disabled": false,
70+
"readOnly": true
71+
},
72+
{
73+
"type": "radio",
74+
"label": "What is your profession?",
75+
"required": true,
76+
"sublabels": [],
77+
"options": [
78+
"Registered Midwife",
79+
"Community Midwife",
80+
"Hospital Midwife",
81+
"Specialist Midwife",
82+
"Senior Midwife",
83+
"Lead/Manager Midwife",
84+
"Consultant Midwife",
85+
"Research Midwife",
86+
"Maternity Support Worker",
87+
"Midwifery Educator",
88+
"Other"
89+
],
90+
"disabled": false,
91+
"readOnly": true
92+
},
93+
{
94+
"description": "",
95+
"disabled": false,
96+
"enforceValueConstraints": false,
97+
"label": "What is your job title?",
98+
"maxNumChar": 500,
99+
"maxNumValue": 100,
100+
"minNumValue": 0,
101+
"options": [
102+
],
103+
"required": true,
104+
"sublabels": [
105+
],
106+
"textType": "PLAIN_TEXT",
107+
"type": "text",
108+
"readOnly": true
109+
},
110+
{
111+
"type": "radio",
112+
"label": "What is your highest level of qualification?",
113+
"required": true,
114+
"sublabels": [],
115+
"options": [
116+
"No qualification",
117+
"Diploma",
118+
"Degree",
119+
"Masters",
120+
"PhD/Doctorate",
121+
"Other"
122+
],
123+
"disabled": false,
124+
"readOnly": true
125+
},
126+
{
127+
"description": "",
128+
"disabled": false,
129+
"enforceValueConstraints": true,
130+
"label": "How many years have you been qualified?",
131+
"maxNumChar": 500,
132+
"maxNumValue": 100,
133+
"minNumValue": 0,
134+
"options": [],
135+
"required": true,
136+
"sublabels": [],
137+
"textType": "INTEGER_TEXT",
138+
"type": "text",
139+
"readOnly": true
140+
},
141+
{
142+
"type": "radio",
143+
"label": "What is your ethnicity?",
144+
"required": true,
145+
"sublabels": [],
146+
"options": [
147+
"Asian British - Bangladeshi",
148+
"Asian British - Indian",
149+
"Asian British - Pakistani",
150+
"Asian - Chinese",
151+
"Asian - other",
152+
"Black British - African",
153+
"Black British - Caribbean",
154+
"Black British - other",
155+
"Mixed - Black African and White",
156+
"Mixed - Black Asian and White",
157+
"Mixed - Caribbean and White",
158+
"Mixed - other",
159+
"White - British",
160+
"White - Irish",
161+
"White - Romany",
162+
"Other"
163+
],
164+
"disabled": false,
165+
"readOnly": true
166+
}
167+
]
168+
}
169+
]
170+
}

data/survey_config/demography_only_config.json renamed to data/survey_config/demography_only_config_nmahps.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"fields": [
88
{
99
"type": "text",
10-
"label": "What is your age",
10+
"label": "What is your age?",
1111
"required": true,
1212
"sublabels": [],
1313
"options": [],
@@ -21,7 +21,7 @@
2121
},
2222
{
2323
"type": "radio",
24-
"label": "Your Gender",
24+
"label": "What is your gender?",
2525
"description": "",
2626
"required": true,
2727
"sublabels": [],
@@ -71,7 +71,7 @@
7171
},
7272
{
7373
"type": "radio",
74-
"label": "Please describe your current role",
74+
"label": "What is your profession?",
7575
"required": true,
7676
"sublabels": [],
7777
"options": [
@@ -100,7 +100,7 @@
100100
"description": "",
101101
"disabled": false,
102102
"enforceValueConstraints": false,
103-
"label": "Please provide your job title",
103+
"label": "What is your job title?",
104104
"maxNumChar": 500,
105105
"maxNumValue": 100,
106106
"minNumValue": 0,
@@ -115,14 +115,16 @@
115115
},
116116
{
117117
"type": "radio",
118-
"label": "Please indicate your highest qualification",
118+
"label": "What is your highest level of qualification?",
119119
"required": true,
120120
"sublabels": [],
121121
"options": [
122+
"No qualification",
122123
"Diploma",
123124
"Degree",
124125
"Masters",
125-
"PhD/Doctorate"
126+
"PhD/Doctorate",
127+
"Other"
126128
],
127129
"disabled": false,
128130
"readOnly": true
@@ -131,7 +133,7 @@
131133
"description": "",
132134
"disabled": false,
133135
"enforceValueConstraints": true,
134-
"label": "How many years have you been qualified",
136+
"label": "How many years have you been qualified?",
135137
"maxNumChar": 500,
136138
"maxNumValue": 100,
137139
"minNumValue": 0,

0 commit comments

Comments
 (0)