docassemble.InterviewStats 0.5.3__tar.gz → 0.6.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {docassemble_interviewstats-0.5.3/docassemble.InterviewStats.egg-info → docassemble_interviewstats-0.6.0}/PKG-INFO +2 -15
- {docassemble_interviewstats-0.5.3 → docassemble_interviewstats-0.6.0}/README.md +1 -11
- docassemble_interviewstats-0.6.0/docassemble/InterviewStats/__init__.py +1 -0
- {docassemble_interviewstats-0.5.3 → docassemble_interviewstats-0.6.0}/docassemble/InterviewStats/data/questions/data_report.yml +13 -6
- {docassemble_interviewstats-0.5.3 → docassemble_interviewstats-0.6.0}/docassemble/InterviewStats/data/questions/stats.yml +53 -130
- {docassemble_interviewstats-0.5.3 → docassemble_interviewstats-0.6.0}/docassemble/InterviewStats/data/questions/subscribe.yml +1 -0
- {docassemble_interviewstats-0.5.3 → docassemble_interviewstats-0.6.0}/docassemble/InterviewStats/data/questions/test_create_snapshot_data.yml +11 -3
- {docassemble_interviewstats-0.5.3 → docassemble_interviewstats-0.6.0}/docassemble/InterviewStats/data/questions/test_survey_data_generator.yml +4 -0
- {docassemble_interviewstats-0.5.3 → docassemble_interviewstats-0.6.0}/docassemble/InterviewStats/data/static/sortable.js +1 -31
- docassemble_interviewstats-0.6.0/docassemble/InterviewStats/data_report.py +179 -0
- docassemble_interviewstats-0.6.0/docassemble/InterviewStats/generate_test_data.py +52 -0
- {docassemble_interviewstats-0.5.3 → docassemble_interviewstats-0.6.0}/docassemble/InterviewStats/snapshot_statistics.py +85 -48
- docassemble_interviewstats-0.6.0/docassemble/InterviewStats/test_generate_data.py +9 -0
- {docassemble_interviewstats-0.5.3 → docassemble_interviewstats-0.6.0/docassemble.InterviewStats.egg-info}/PKG-INFO +2 -15
- {docassemble_interviewstats-0.5.3 → docassemble_interviewstats-0.6.0}/docassemble.InterviewStats.egg-info/SOURCES.txt +1 -2
- docassemble_interviewstats-0.6.0/docassemble.InterviewStats.egg-info/requires.txt +3 -0
- {docassemble_interviewstats-0.5.3 → docassemble_interviewstats-0.6.0}/docassemble.InterviewStats.egg-info/top_level.txt +0 -1
- {docassemble_interviewstats-0.5.3 → docassemble_interviewstats-0.6.0}/pyproject.toml +2 -15
- docassemble_interviewstats-0.5.3/docassemble/InterviewStats/__init__.py +0 -1
- docassemble_interviewstats-0.5.3/docassemble/InterviewStats/cache_geography.py +0 -89
- docassemble_interviewstats-0.5.3/docassemble/InterviewStats/data_report.py +0 -149
- docassemble_interviewstats-0.5.3/docassemble/InterviewStats/generate_test_data.py +0 -34
- docassemble_interviewstats-0.5.3/docassemble/InterviewStats/snapshot_geography.py +0 -243
- docassemble_interviewstats-0.5.3/docassemble.InterviewStats.egg-info/requires.txt +0 -6
- {docassemble_interviewstats-0.5.3 → docassemble_interviewstats-0.6.0}/LICENSE +0 -0
- {docassemble_interviewstats-0.5.3 → docassemble_interviewstats-0.6.0}/MANIFEST.in +0 -0
- {docassemble_interviewstats-0.5.3 → docassemble_interviewstats-0.6.0}/docassemble/InterviewStats/data/sources/README.md +0 -0
- {docassemble_interviewstats-0.5.3 → docassemble_interviewstats-0.6.0}/docassemble/InterviewStats/data/static/README.md +0 -0
- {docassemble_interviewstats-0.5.3 → docassemble_interviewstats-0.6.0}/docassemble/InterviewStats/data/static/styles.css +0 -0
- {docassemble_interviewstats-0.5.3 → docassemble_interviewstats-0.6.0}/docassemble/InterviewStats/data/static/summary.css +0 -0
- {docassemble_interviewstats-0.5.3 → docassemble_interviewstats-0.6.0}/docassemble/InterviewStats/data/templates/README.md +0 -0
- {docassemble_interviewstats-0.5.3 → docassemble_interviewstats-0.6.0}/docassemble.InterviewStats.egg-info/dependency_links.txt +0 -0
- {docassemble_interviewstats-0.5.3 → docassemble_interviewstats-0.6.0}/setup.cfg +0 -0
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: docassemble.InterviewStats
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
4
4
|
Summary: A docassemble interview to view statistics from other saved interview responses.
|
|
5
5
|
Author-email: Suffolk Legal Innovation and Technology Lab <litlab@suffolk.edu>
|
|
6
6
|
License-Expression: MIT
|
|
7
7
|
Project-URL: GitHub, https://github.com/SuffolkLITLab/docassemble-InterviewStats
|
|
8
8
|
Description-Content-Type: text/markdown
|
|
9
9
|
License-File: LICENSE
|
|
10
|
-
Requires-Dist: bokeh>=2.4.2
|
|
11
|
-
Requires-Dist: cenpy>=1.0.0.post4
|
|
12
|
-
Requires-Dist: geopandas>=0.9.0
|
|
13
10
|
Requires-Dist: numpy>=1.0.4
|
|
14
11
|
Requires-Dist: pandas>=1.4.2
|
|
15
12
|
Requires-Dist: requests>=2.27.1
|
|
@@ -59,20 +56,10 @@ visiting this url:
|
|
|
59
56
|
They will be directed immediately to download an XlSX file containing the
|
|
60
57
|
statistics.
|
|
61
58
|
|
|
62
|
-
##
|
|
63
|
-
|
|
64
|
-

|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
## Roadmap
|
|
68
|
-
|
|
69
|
-
Currently, we can show simple grouping over all the data points in the interview stats. However, the
|
|
70
|
-
special visualization are only shown on based on the `zip` attribute. We're working to expand the
|
|
71
|
-
features available here in conjunction with our [EFiling Integration](https://github.com/SuffolkLITLab/EfileProxyServer).
|
|
59
|
+
## Contributing
|
|
72
60
|
|
|
73
61
|
If you have specific feature requests, feel free to open an issue or make a PR!
|
|
74
62
|
|
|
75
|
-
|
|
76
63
|
## Authors
|
|
77
64
|
|
|
78
65
|
* Quinten Steenhuis
|
|
@@ -42,20 +42,10 @@ visiting this url:
|
|
|
42
42
|
They will be directed immediately to download an XlSX file containing the
|
|
43
43
|
statistics.
|
|
44
44
|
|
|
45
|
-
##
|
|
46
|
-
|
|
47
|
-

|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
## Roadmap
|
|
51
|
-
|
|
52
|
-
Currently, we can show simple grouping over all the data points in the interview stats. However, the
|
|
53
|
-
special visualization are only shown on based on the `zip` attribute. We're working to expand the
|
|
54
|
-
features available here in conjunction with our [EFiling Integration](https://github.com/SuffolkLITLab/EfileProxyServer).
|
|
45
|
+
## Contributing
|
|
55
46
|
|
|
56
47
|
If you have specific feature requests, feel free to open an issue or make a PR!
|
|
57
48
|
|
|
58
|
-
|
|
59
49
|
## Authors
|
|
60
50
|
|
|
61
51
|
* Quinten Steenhuis
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.6.0"
|
|
@@ -37,6 +37,7 @@ code: |
|
|
|
37
37
|
# Question screens
|
|
38
38
|
#--------------------------------------------------------------------------
|
|
39
39
|
---
|
|
40
|
+
id: data-reporting
|
|
40
41
|
question: |
|
|
41
42
|
Data Reporting
|
|
42
43
|
subquestion: |
|
|
@@ -55,6 +56,7 @@ fields:
|
|
|
55
56
|
code: |
|
|
56
57
|
[{interview.get('filename'): interview.get('title')} for interview in interview_menu()] or get_filenames()
|
|
57
58
|
---
|
|
59
|
+
id: quick-summary-screen
|
|
58
60
|
question: |
|
|
59
61
|
Quick Summary for ${ interview_title }
|
|
60
62
|
subquestion: |
|
|
@@ -65,10 +67,8 @@ subquestion: |
|
|
|
65
67
|
% if summary_stats[0] > 10000:
|
|
66
68
|
You have a lot of sessions; some operations might take a long time.
|
|
67
69
|
% endif
|
|
68
|
-
---
|
|
69
|
-
Do you want to filter your data records by date?
|
|
70
70
|
fields:
|
|
71
|
-
-
|
|
71
|
+
- Do you want to filter your data records by date?: filter_date
|
|
72
72
|
datatype: yesnoradio
|
|
73
73
|
default: False
|
|
74
74
|
required: False
|
|
@@ -117,15 +117,17 @@ subquestion: |
|
|
|
117
117
|
The following fields are from single-valued questions, except those whose answer lack statistic value, such as user-typed answer or numeric input.
|
|
118
118
|
|
|
119
119
|
Select a field to see its table:<br>
|
|
120
|
-
% for
|
|
121
|
-
[${
|
|
120
|
+
% for col_single in col_headings_single:
|
|
121
|
+
[${col_single}](${ url_action('show_filtered_data_single', filter_by = col_single) })
|
|
122
122
|
% endfor
|
|
123
123
|
% endif
|
|
124
124
|
|
|
125
125
|
#### All questions (excluding text/area/number fields)
|
|
126
|
-
|
|
126
|
+
|
|
127
|
+
Click this link to see [all the question tables on one screen](${ url_action('display_filtered_data_all') }).
|
|
127
128
|
|
|
128
129
|
#### Download an excel file:
|
|
130
|
+
|
|
129
131
|
To extract complete data including text/area/numeric fields, make an excel file:<br>
|
|
130
132
|
[:file-excel: Make Excel Download](${ url_ask('generate_excel') })
|
|
131
133
|
---
|
|
@@ -201,6 +203,7 @@ code: |
|
|
|
201
203
|
no_reportable_data
|
|
202
204
|
---
|
|
203
205
|
event: no_interview_stats
|
|
206
|
+
id: interview-has-no-data
|
|
204
207
|
question: Interview has no data!
|
|
205
208
|
subquestion: |
|
|
206
209
|
The interview you selected is <br>
|
|
@@ -211,6 +214,7 @@ buttons:
|
|
|
211
214
|
- Restart: restart
|
|
212
215
|
---
|
|
213
216
|
event: no_reportable_data
|
|
217
|
+
id: interview-has-no-reportable-data
|
|
214
218
|
question: Interview has no reportable data, you should use Stats
|
|
215
219
|
subquestion: |
|
|
216
220
|
The interview you selected is <br>
|
|
@@ -244,6 +248,7 @@ code: |
|
|
|
244
248
|
no_filtered_stats
|
|
245
249
|
---
|
|
246
250
|
event: no_filtered_stats
|
|
251
|
+
id: no-records-in-this-period
|
|
247
252
|
question: No records in this period
|
|
248
253
|
subquestion: |
|
|
249
254
|
% if date_op == 'between':
|
|
@@ -359,6 +364,7 @@ code: |
|
|
|
359
364
|
show_excel_download
|
|
360
365
|
---
|
|
361
366
|
event: show_excel_download
|
|
367
|
+
id: show-excel-download
|
|
362
368
|
question: |
|
|
363
369
|
Excel Download
|
|
364
370
|
subquestion: |
|
|
@@ -390,6 +396,7 @@ subquestion: |
|
|
|
390
396
|
reload: True
|
|
391
397
|
---
|
|
392
398
|
event: show_failed_screen
|
|
399
|
+
id: failed-screen
|
|
393
400
|
question: |
|
|
394
401
|
Sorry, something went wrong
|
|
395
402
|
subquestion: |
|
|
@@ -22,7 +22,6 @@ default screen parts:
|
|
|
22
22
|
---
|
|
23
23
|
modules:
|
|
24
24
|
- .snapshot_statistics
|
|
25
|
-
# - .snapshot_geography
|
|
26
25
|
---
|
|
27
26
|
objects:
|
|
28
27
|
- xlsx_output: DAFile.using(filename="stats.xlsx")
|
|
@@ -64,6 +63,7 @@ code: |
|
|
|
64
63
|
generate_excel = True
|
|
65
64
|
---
|
|
66
65
|
event: show_excel_download
|
|
66
|
+
id: show-excel-download
|
|
67
67
|
question: |
|
|
68
68
|
Excel Download
|
|
69
69
|
subquestion: |
|
|
@@ -125,6 +125,7 @@ subquestion: |
|
|
|
125
125
|
reload: True
|
|
126
126
|
---
|
|
127
127
|
event: show_failed_screen
|
|
128
|
+
id: failed-screen
|
|
128
129
|
question: |
|
|
129
130
|
Sorry, something went wrong
|
|
130
131
|
subquestion: |
|
|
@@ -140,9 +141,10 @@ code: |
|
|
|
140
141
|
background_response()
|
|
141
142
|
---
|
|
142
143
|
code: |
|
|
143
|
-
summary_stats = get_summary_stats(filename)
|
|
144
|
+
summary_stats = get_summary_stats(filename, date_from=stats_date_from if filter_by_date else None, date_to=stats_date_to if filter_by_date else None)
|
|
144
145
|
---
|
|
145
146
|
reconsider: summary_stats
|
|
147
|
+
id: summary-data-screen
|
|
146
148
|
question: |
|
|
147
149
|
Summary data for ${ interview_title }
|
|
148
150
|
subquestion: |
|
|
@@ -155,11 +157,6 @@ subquestion: |
|
|
|
155
157
|
take a long time.
|
|
156
158
|
% endif
|
|
157
159
|
continue button field: simple_data
|
|
158
|
-
# ---
|
|
159
|
-
# code: |
|
|
160
|
-
# geo_layout = make_usage_map(formatted_data)
|
|
161
|
-
# map_script, map_div, map_inline = get_embedable_usage_map(geo_layout)
|
|
162
|
-
# del geo_layout
|
|
163
160
|
---
|
|
164
161
|
# question: Interview Statistics
|
|
165
162
|
# subquestion: |
|
|
@@ -179,9 +176,9 @@ continue button field: simple_data
|
|
|
179
176
|
code: |
|
|
180
177
|
overall_stats = get_overall_stats()
|
|
181
178
|
summary_by_filename = get_summary_stats_by_filename()
|
|
182
|
-
session_overall_stats = get_session_overall_stats()
|
|
183
179
|
session_summary_by_filename = get_session_summary_stats_by_filename()
|
|
184
180
|
---
|
|
181
|
+
id: what-interview-do-you-want-to-view-statistics-for
|
|
185
182
|
question: |
|
|
186
183
|
What interview do you want to view statistics for?
|
|
187
184
|
under: |
|
|
@@ -199,20 +196,8 @@ under: |
|
|
|
199
196
|
on your server and interviews.
|
|
200
197
|
|
|
201
198
|
Total sessions with saved statistics across all interviews: ${ overall_stats[0] }
|
|
202
|
-
|
|
203
|
-
<div class="stats-tabs">
|
|
204
|
-
<ul class="nav nav-tabs" id="stats-tabs">
|
|
205
|
-
<li class="nav-item">
|
|
206
|
-
<a href="#" class="nav-link active" id="snapshots-tab">Snapshots</a>
|
|
207
|
-
</li>
|
|
208
|
-
<li class="nav-item">
|
|
209
|
-
<a href="#" class="nav-link" id="sessions-tab">All sessions</a>
|
|
210
|
-
</li>
|
|
211
|
-
</ul>
|
|
212
|
-
</div>
|
|
213
199
|
|
|
214
200
|
% if summary_by_filename:
|
|
215
|
-
<div id="snapshots-panel">
|
|
216
201
|
<div style="margin-bottom:0.5rem">
|
|
217
202
|
<a href="${ url_ask('generate_summary_excel') }" class="btn btn-link">
|
|
218
203
|
<i class="fa fa-file-excel" aria-hidden="true"></i>
|
|
@@ -246,19 +231,39 @@ under: |
|
|
|
246
231
|
% endfor
|
|
247
232
|
</tbody>
|
|
248
233
|
</table>
|
|
249
|
-
</div>
|
|
250
|
-
|
|
251
|
-
|
|
252
234
|
% endif
|
|
235
|
+
|
|
236
|
+
<p><a href="${ url_ask('session_data_screen') }">View all sessions by interview title</a></p>
|
|
237
|
+
fields:
|
|
238
|
+
- Filename: filename
|
|
239
|
+
datatype: combobox
|
|
240
|
+
code: |
|
|
241
|
+
get_combined_filename_list()
|
|
242
|
+
- Filter by date range?: filter_by_date
|
|
243
|
+
datatype: yesno
|
|
244
|
+
default: False
|
|
245
|
+
- From date: stats_date_from
|
|
246
|
+
datatype: date
|
|
247
|
+
show if: filter_by_date
|
|
248
|
+
- To date: stats_date_to
|
|
249
|
+
datatype: date
|
|
250
|
+
show if: filter_by_date
|
|
251
|
+
---
|
|
252
|
+
code: |
|
|
253
|
+
session_summary_by_filename = get_session_summary_stats_by_filename()
|
|
254
|
+
---
|
|
255
|
+
event: session_data_screen
|
|
256
|
+
id: session-data-screen
|
|
257
|
+
question: |
|
|
258
|
+
All sessions by interview title
|
|
259
|
+
subquestion: |
|
|
253
260
|
% if session_summary_by_filename:
|
|
254
|
-
<div id="sessions-panel" style="display:none;">
|
|
255
261
|
<div style="margin-bottom:0.5rem">
|
|
256
262
|
<a href="${ url_ask('generate_sessions_excel') }" class="btn btn-link">
|
|
257
263
|
<i class="fa fa-file-excel" aria-hidden="true"></i>
|
|
258
264
|
Download session summary
|
|
259
265
|
</a>
|
|
260
266
|
</div>
|
|
261
|
-
<h2 class="h4">All sessions by interview title</h2>
|
|
262
267
|
<table id="sessions-table" class="table table-striped table-bordered sortable">
|
|
263
268
|
<thead>
|
|
264
269
|
<tr>
|
|
@@ -277,26 +282,24 @@ under: |
|
|
|
277
282
|
<td>${ row.get('count_30d', 0) }</td>
|
|
278
283
|
<td>${ row.get('count_90d', 0) }</td>
|
|
279
284
|
<td>${ row.get('count_365d', 0) }</td>
|
|
280
|
-
|
|
281
|
-
|
|
285
|
+
<td>${ row.get('count_all', 0) }</td>
|
|
286
|
+
<td>${ format_date(row.get('max_all'), format='MM/dd/yyyy') if row.get('max_all') else '' }</td>
|
|
282
287
|
</tr>
|
|
283
288
|
% endfor
|
|
284
289
|
</tbody>
|
|
285
290
|
</table>
|
|
286
|
-
|
|
291
|
+
% else:
|
|
292
|
+
No session data found.
|
|
287
293
|
% endif
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
datatype: combobox
|
|
291
|
-
code: |
|
|
292
|
-
get_combined_filename_list()
|
|
294
|
+
|
|
295
|
+
[Back to summary](${ url_ask('filename') })
|
|
293
296
|
---
|
|
294
297
|
code: |
|
|
295
298
|
if filename is not None:
|
|
296
299
|
if 'data/questions' in filename or 'playground' in filename:
|
|
297
|
-
stats = get_stats(filename)
|
|
300
|
+
stats = get_stats(filename, date_from=stats_date_from if filter_by_date else None, date_to=stats_date_to if filter_by_date else None)
|
|
298
301
|
else:
|
|
299
|
-
stats = get_stats(filename.replace(':',':data/questions/'))
|
|
302
|
+
stats = get_stats(filename.replace(':',':data/questions/'), date_from=stats_date_from if filter_by_date else None, date_to=stats_date_to if filter_by_date else None)
|
|
300
303
|
else:
|
|
301
304
|
no_interview_stats
|
|
302
305
|
---
|
|
@@ -309,6 +312,7 @@ code: |
|
|
|
309
312
|
if stats and 'title' in stats[0].keys():
|
|
310
313
|
interview_title = stats[0]['title']
|
|
311
314
|
---
|
|
315
|
+
id: there-are-no-interviews-to-look-for-data-in
|
|
312
316
|
event: no_interview_stats
|
|
313
317
|
question: There are no interviews to look for data in!
|
|
314
318
|
subquestion: |
|
|
@@ -335,116 +339,35 @@ code: |
|
|
|
335
339
|
formatted_data = pd.DataFrame(stats)
|
|
336
340
|
stats_size = formatted_data.shape[0]
|
|
337
341
|
---
|
|
338
|
-
# mandatory: True
|
|
339
|
-
id: view_data
|
|
340
|
-
question: |
|
|
341
|
-
Stats for ${interview_title}
|
|
342
|
-
subquestion: |
|
|
343
|
-
Total submissions: ${ len(stats) }
|
|
344
|
-
|
|
345
|
-
% if len(stats):
|
|
346
|
-
Group by:
|
|
347
|
-
% for col in groupable_columns:
|
|
348
|
-
[${col}](${ url_action('show_grouped_data', group_by = col ) }) |
|
|
349
|
-
% endfor
|
|
350
|
-
|
|
351
|
-
[:file-excel: Make Excel Download](${ url_ask('generate_excel') })
|
|
352
|
-
% endif
|
|
353
|
-
# under: |
|
|
354
|
-
# ${ map_div }
|
|
355
|
-
fields:
|
|
356
|
-
- Filter State: filter_state
|
|
357
|
-
datatype: yesno
|
|
358
|
-
disable if:
|
|
359
|
-
code: |
|
|
360
|
-
'state' not in formatted_data.columns or not possible_states
|
|
361
|
-
- Find States that: state_op
|
|
362
|
-
datatype: dropdown
|
|
363
|
-
show if: filter_state
|
|
364
|
-
code: |
|
|
365
|
-
[{'eq': "equal"},
|
|
366
|
-
{'ne': "don't equal"}]
|
|
367
|
-
- this state: state_to_filter
|
|
368
|
-
datatype: dropdown
|
|
369
|
-
show if: filter_state
|
|
370
|
-
code: |
|
|
371
|
-
possible_states
|
|
372
|
-
- Filter by Date: filter_date
|
|
373
|
-
datatype: yesno
|
|
374
|
-
disable if:
|
|
375
|
-
code: |
|
|
376
|
-
'modtime' not in formatted_data.columns
|
|
377
|
-
- Find submissions that are: date_op
|
|
378
|
-
datatype: dropdown
|
|
379
|
-
show if: filter_date
|
|
380
|
-
code: |
|
|
381
|
-
[{'gt': 'after'},
|
|
382
|
-
{'lt': 'before'},
|
|
383
|
-
{'eq': 'the same day as'}]
|
|
384
|
-
- this date: date_to_filter
|
|
385
|
-
datatype: date
|
|
386
|
-
show if: filter_date
|
|
387
|
-
# script: |
|
|
388
|
-
# ${ map_script}
|
|
389
|
-
continue button field: start_filter
|
|
390
|
-
continue button label: Filter
|
|
391
|
-
#help: |
|
|
392
|
-
# ${ formatted_data.to_html() }
|
|
393
|
-
# ---
|
|
394
|
-
# mandatory: True
|
|
395
|
-
# event: viewed_filtered
|
|
396
|
-
# depends on: filt_map_script, filt_map_div
|
|
397
|
-
# need: filt_map_script, filt_map_div
|
|
398
|
-
# id: view_filtered_data
|
|
399
|
-
# question: |
|
|
400
|
-
# Filtered: ${ filter_description }
|
|
401
|
-
# under: |
|
|
402
|
-
# ${ filt_map_div }
|
|
403
|
-
# script: |
|
|
404
|
-
# ${ filt_map_script }
|
|
405
|
-
# back button: True
|
|
406
|
-
---
|
|
407
342
|
event: show_grouped_data
|
|
408
343
|
code: |
|
|
409
344
|
my_col = action_argument('group_by')
|
|
410
345
|
force_ask('display_grouped_data')
|
|
411
346
|
---
|
|
347
|
+
id: stats-for
|
|
412
348
|
question: |
|
|
413
349
|
Stats for ${interview_title}
|
|
414
350
|
subquestion: |
|
|
415
351
|
Total submissions: ${ len(stats) }
|
|
416
352
|
|
|
353
|
+
% if len(stats):
|
|
417
354
|
Group by:
|
|
418
355
|
% for col in groupable_columns:
|
|
419
356
|
[${col}](${ url_action('show_grouped_data', group_by = col) })
|
|
420
357
|
% endfor
|
|
421
358
|
|
|
422
|
-
|
|
359
|
+
<%
|
|
360
|
+
grouped = formatted_data.groupby(by=my_col).count()
|
|
361
|
+
grouped = grouped.sort_values(grouped.columns[0], ascending=False)
|
|
362
|
+
total_groups = len(grouped)
|
|
363
|
+
%>
|
|
364
|
+
% if total_groups > 50:
|
|
365
|
+
Showing the top 50 of ${ total_groups } groups by count. Download the Excel file below for the full breakdown.
|
|
366
|
+
% endif
|
|
367
|
+
${ grouped.head(50).to_html(classes=('table','table-striped')) }
|
|
423
368
|
|
|
424
369
|
[:file-excel: Download](${ url_ask('generate_excel') })
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
# ${ map_script }
|
|
370
|
+
% else:
|
|
371
|
+
No records found for this date range. Try a wider range or clear the date filter.
|
|
372
|
+
% endif
|
|
429
373
|
event: display_grouped_data
|
|
430
|
-
# ---
|
|
431
|
-
# need: start_filter
|
|
432
|
-
# depends on: state_op, state_to_filter
|
|
433
|
-
# code: |
|
|
434
|
-
# filter_list = []
|
|
435
|
-
# readable = {'state': 'State', 'modtime': 'Date',
|
|
436
|
-
# 'eq': 'is', 'ne': 'is not', 'lt': '<', 'gt': '>'}
|
|
437
|
-
# if defined('filter_state') and filter_state:
|
|
438
|
-
# filter_list.append(('state', state_op, state_to_filter))
|
|
439
|
-
# if defined('filter_date') and filter_date:
|
|
440
|
-
# date_to_filter = date_to_filter.replace(tzinfo=None)
|
|
441
|
-
# filter_list.append(('modtime', date_op, date_to_filter))
|
|
442
|
-
|
|
443
|
-
# filter_description = ' and '.join(
|
|
444
|
-
# ['{} {} {}'.format(readable[elem[0]], readable[elem[1]], elem[2])
|
|
445
|
-
# for elem in filter_list])
|
|
446
|
-
# filters = get_filters_from_strings(filter_list)
|
|
447
|
-
# # filt_geo_layout = make_usage_map(formatted_data, geo_col='zip',
|
|
448
|
-
# # time_col='modtime', filters=filters)
|
|
449
|
-
# # filt_map_script, filt_map_div, _ = get_embedable_usage_map(filt_geo_layout)
|
|
450
|
-
# # del filt_geo_layout
|
|
@@ -72,6 +72,7 @@ code: |
|
|
|
72
72
|
formatted_data = pd.DataFrame(stats)
|
|
73
73
|
---
|
|
74
74
|
event: no_interview_stats
|
|
75
|
+
id: there-are-no-interviews-to-look-for-data-in
|
|
75
76
|
question: There are no interviews to look for data in!
|
|
76
77
|
subquestion: |
|
|
77
78
|
There aren't any interviews that we can look for data in. There should be at least one interview
|
|
@@ -20,12 +20,16 @@ code: |
|
|
|
20
20
|
if what_to_do == 'generate':
|
|
21
21
|
number_of_data_points
|
|
22
22
|
# Edit your data here
|
|
23
|
-
ma_zips = ['
|
|
24
|
-
|
|
23
|
+
ma_zips = list(set([f'{random.randint(75001, 79999):05}' for _ in range(300)])) \
|
|
24
|
+
+ list(set([f'{random.randint(1001,2799):05}' for _ in range(300)]))
|
|
25
|
+
import datetime
|
|
26
|
+
datetimes = [datetime.datetime.now(datetime.timezone.utc).replace(tzinfo=None) - datetime.timedelta(days=i) for i in range(30)]
|
|
25
27
|
def my_generator():
|
|
26
28
|
for _ in range(number_of_data_points):
|
|
27
29
|
yield {'zip': random.choice(ma_zips), 'state': 'MA'}
|
|
28
|
-
|
|
30
|
+
def modtime_generator():
|
|
31
|
+
return random.choice(datetimes)
|
|
32
|
+
write_random_user(my_generator(), modtime_generator=modtime_generator)
|
|
29
33
|
elif what_to_do == 'delete':
|
|
30
34
|
which_to_delete
|
|
31
35
|
delete_data_from_interview(which_to_delete)
|
|
@@ -36,6 +40,7 @@ code: |
|
|
|
36
40
|
users[0].name.last = 'Brown'
|
|
37
41
|
users[0].address
|
|
38
42
|
---
|
|
43
|
+
id: snapshot-generator
|
|
39
44
|
question: |
|
|
40
45
|
Snapshot Generator
|
|
41
46
|
subquestion: |
|
|
@@ -49,6 +54,7 @@ fields:
|
|
|
49
54
|
- Generate: generate
|
|
50
55
|
- Delete: delete
|
|
51
56
|
---
|
|
57
|
+
id: how-many-data-points-do-you-want-to-generate
|
|
52
58
|
question: |
|
|
53
59
|
How many data points do you want to generate?
|
|
54
60
|
fields:
|
|
@@ -58,6 +64,7 @@ fields:
|
|
|
58
64
|
min: 1
|
|
59
65
|
max: 400000
|
|
60
66
|
---
|
|
67
|
+
id: what-interview-do-you-want-to-delete-all-statistics-from
|
|
61
68
|
question: |
|
|
62
69
|
What interview do you want to delete all statistics from?
|
|
63
70
|
fields:
|
|
@@ -73,6 +80,7 @@ validation code: |
|
|
|
73
80
|
if which_to_delete_confirm != which_to_delete:
|
|
74
81
|
validation_error("Are you sure you are deleting the right one?")
|
|
75
82
|
---
|
|
83
|
+
id: snapshot-ending-screen
|
|
76
84
|
event: ending_screen
|
|
77
85
|
question: |
|
|
78
86
|
% if what_to_do == 'generate':
|
|
@@ -29,6 +29,7 @@ code: |
|
|
|
29
29
|
# Question screens
|
|
30
30
|
#--------------------------------------------------------------------------
|
|
31
31
|
---
|
|
32
|
+
id: survey data generator
|
|
32
33
|
question: |
|
|
33
34
|
Survey Data Generator
|
|
34
35
|
subquestion: |
|
|
@@ -42,6 +43,7 @@ fields:
|
|
|
42
43
|
- Generate: generate
|
|
43
44
|
- Delete: delete
|
|
44
45
|
---
|
|
46
|
+
id: how-many-data-points-do-you-want-to-generate
|
|
45
47
|
question: |
|
|
46
48
|
How many data points do you want to generate?
|
|
47
49
|
fields:
|
|
@@ -52,6 +54,7 @@ fields:
|
|
|
52
54
|
min: 1
|
|
53
55
|
max: 4000
|
|
54
56
|
---
|
|
57
|
+
id: which-survey-interviews-do-you-want-to-delete?
|
|
55
58
|
question: |
|
|
56
59
|
Which survey interviews do you want to delete?
|
|
57
60
|
fields:
|
|
@@ -67,6 +70,7 @@ validation code: |
|
|
|
67
70
|
if which_to_delete_confirm != which_to_delete:
|
|
68
71
|
validation_error("Are you sure you are deleting the right one?")
|
|
69
72
|
---
|
|
73
|
+
id: ending-screen
|
|
70
74
|
event: ending_screen
|
|
71
75
|
question: |
|
|
72
76
|
% if what_to_do == 'generate':
|
|
@@ -49,38 +49,8 @@
|
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
function setupTabs(){
|
|
54
|
-
var snapTab = document.getElementById('snapshots-tab');
|
|
55
|
-
var sessTab = document.getElementById('sessions-tab');
|
|
56
|
-
var snapPanel = document.getElementById('snapshots-panel');
|
|
57
|
-
var sessPanel = document.getElementById('sessions-panel');
|
|
58
|
-
if(!snapTab || !sessTab || !snapPanel || !sessPanel) return;
|
|
59
|
-
if(!snapTab._daTabAttached){
|
|
60
|
-
snapTab._daTabAttached = true;
|
|
61
|
-
snapTab.addEventListener('click', function(e){
|
|
62
|
-
e.preventDefault();
|
|
63
|
-
snapTab.classList.add('active');
|
|
64
|
-
sessTab.classList.remove('active');
|
|
65
|
-
snapPanel.style.display = '';
|
|
66
|
-
sessPanel.style.display = 'none';
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
if(!sessTab._daTabAttached){
|
|
70
|
-
sessTab._daTabAttached = true;
|
|
71
|
-
sessTab.addEventListener('click', function(e){
|
|
72
|
-
e.preventDefault();
|
|
73
|
-
sessTab.classList.add('active');
|
|
74
|
-
snapTab.classList.remove('active');
|
|
75
|
-
sessPanel.style.display = '';
|
|
76
|
-
snapPanel.style.display = 'none';
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
52
|
$(document).on('daPageLoad', function(){
|
|
82
53
|
var tables = document.querySelectorAll('table.sortable');
|
|
83
54
|
Array.prototype.forEach.call(tables, makeSortable);
|
|
84
|
-
setupTabs();
|
|
85
55
|
});
|
|
86
|
-
})();
|
|
56
|
+
})();
|