mvote 0.1.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.
- mvote-0.1.0/LICENSE +202 -0
- mvote-0.1.0/NOTICE +14 -0
- mvote-0.1.0/PKG-INFO +76 -0
- mvote-0.1.0/README.md +54 -0
- mvote-0.1.0/mvote/__init__.py +3 -0
- mvote-0.1.0/mvote/board.py +63 -0
- mvote-0.1.0/mvote/cli.py +125 -0
- mvote-0.1.0/mvote/config.py +105 -0
- mvote-0.1.0/mvote/firebase_store.py +116 -0
- mvote-0.1.0/mvote.egg-info/PKG-INFO +76 -0
- mvote-0.1.0/mvote.egg-info/SOURCES.txt +19 -0
- mvote-0.1.0/mvote.egg-info/dependency_links.txt +1 -0
- mvote-0.1.0/mvote.egg-info/entry_points.txt +2 -0
- mvote-0.1.0/mvote.egg-info/requires.txt +7 -0
- mvote-0.1.0/mvote.egg-info/top_level.txt +1 -0
- mvote-0.1.0/pyproject.toml +39 -0
- mvote-0.1.0/setup.cfg +4 -0
- mvote-0.1.0/tests/test_board.py +38 -0
- mvote-0.1.0/tests/test_cli.py +111 -0
- mvote-0.1.0/tests/test_config.py +84 -0
- mvote-0.1.0/tests/test_firebase_store.py +139 -0
mvote-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
202
|
+
|
mvote-0.1.0/NOTICE
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
mVote
|
|
2
|
+
Copyright 2026 The Johns Hopkins University
|
|
3
|
+
|
|
4
|
+
Developed by Valentín Quiroz de la Sierra and Marissa Ledesma for MalverdeSoftware.
|
|
5
|
+
|
|
6
|
+
This work was supported by the National Institute on Drug Abuse of the
|
|
7
|
+
National Institutes of Health under Award Number K99DA066943. The content is
|
|
8
|
+
solely the responsibility of the authors and does not necessarily represent
|
|
9
|
+
the official views of the National Institutes of Health.
|
|
10
|
+
|
|
11
|
+
Cite as: de la Sierra, V. Q., & Ledesma, M. (2026). mVote
|
|
12
|
+
[Computer software]. MalverdeSoftware. https://github.com/MalverdeSoftware/mvote
|
|
13
|
+
|
|
14
|
+
This product includes third-party software; see THIRD_PARTY_NOTICES.md.
|
mvote-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mvote
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: CLI for creating and configuring mVote participatory sticky-note voting sessions
|
|
5
|
+
Author: Valentín Quiroz de la Sierra, Marissa Ledesma
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Keywords: cbpr,participatory-research,dot-voting,research-tools
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Intended Audience :: Science/Research
|
|
10
|
+
Classifier: Topic :: Scientific/Engineering
|
|
11
|
+
Requires-Python: >=3.9
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
License-File: NOTICE
|
|
15
|
+
Requires-Dist: qrcode[pil]>=7.4
|
|
16
|
+
Requires-Dist: click>=8.1
|
|
17
|
+
Requires-Dist: firebase-admin>=6.5
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
20
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# mvote (command line tool)
|
|
24
|
+
|
|
25
|
+
A Python command line tool that creates mVote voting sessions ("boards") from a CSV or JSON file of items.
|
|
26
|
+
|
|
27
|
+
## Install for development
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
cd cli
|
|
31
|
+
pip install -e ".[dev]"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
mvote create --config ../examples/chks_example.json --title "Week 3"
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
This prints the board definition as JSON, or writes it to a file with `--out`. It doesn't touch any backend.
|
|
41
|
+
|
|
42
|
+
### Publish a session to Firebase
|
|
43
|
+
|
|
44
|
+
Add `--publish` to also write the board to Firestore and print a link and QR code you can share:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
mvote create --config ../examples/chks_example.json --title "Week 3" --publish
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Publishing sets every vote count to zero, so the tool won't publish over a board that already exists. Choose another `--board-id`, or add `--overwrite` if you mean to replace the board and start its counts again.
|
|
51
|
+
|
|
52
|
+
This needs a Firebase project with **Firestore** turned on. Sign the tool in with a service account key. In the Firebase console, go to Project settings, then Service accounts, then Generate new private key. Then set `GOOGLE_APPLICATION_CREDENTIALS` to the downloaded JSON file. **Never commit this file to the repo.**
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/serviceAccountKey.json
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The link uses a placeholder domain until you tell the tool where the web app lives. Pass `--base-url` or set `MVOTE_WEBAPP_URL`. Use `--qr-out path.png` to save the QR code as an image instead of printing it.
|
|
59
|
+
|
|
60
|
+
After participants have voted in the web app, pull the results:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
mvote results --board-id <id> --out results.csv
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Tests
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pytest
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Releases
|
|
73
|
+
|
|
74
|
+
Releases follow [SPEC-distribution](https://github.com/MalverdeSoftware/malverdesoftware/blob/main/docs/specs/SPEC-distribution.md). Until the public flip, `.github/workflows/cli-release.yml` is a dry run. It builds the sdist and wheel, runs `twine check --strict` and `scripts/check-cli-release.py`, installs the wheel, and keeps the files as a workflow artifact. Nothing goes to PyPI.
|
|
75
|
+
|
|
76
|
+
`cli/LICENSE` and `cli/NOTICE` are copies of the root files, so that both the wheel and installs from GitHub include them. After you edit either root file, run `python scripts/check-cli-release.py --fix`; the check fails while the copies differ. Release tags take the form `v<version>` and must match `version` in `pyproject.toml`.
|
mvote-0.1.0/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# mvote (command line tool)
|
|
2
|
+
|
|
3
|
+
A Python command line tool that creates mVote voting sessions ("boards") from a CSV or JSON file of items.
|
|
4
|
+
|
|
5
|
+
## Install for development
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
cd cli
|
|
9
|
+
pip install -e ".[dev]"
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
mvote create --config ../examples/chks_example.json --title "Week 3"
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
This prints the board definition as JSON, or writes it to a file with `--out`. It doesn't touch any backend.
|
|
19
|
+
|
|
20
|
+
### Publish a session to Firebase
|
|
21
|
+
|
|
22
|
+
Add `--publish` to also write the board to Firestore and print a link and QR code you can share:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
mvote create --config ../examples/chks_example.json --title "Week 3" --publish
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Publishing sets every vote count to zero, so the tool won't publish over a board that already exists. Choose another `--board-id`, or add `--overwrite` if you mean to replace the board and start its counts again.
|
|
29
|
+
|
|
30
|
+
This needs a Firebase project with **Firestore** turned on. Sign the tool in with a service account key. In the Firebase console, go to Project settings, then Service accounts, then Generate new private key. Then set `GOOGLE_APPLICATION_CREDENTIALS` to the downloaded JSON file. **Never commit this file to the repo.**
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/serviceAccountKey.json
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The link uses a placeholder domain until you tell the tool where the web app lives. Pass `--base-url` or set `MVOTE_WEBAPP_URL`. Use `--qr-out path.png` to save the QR code as an image instead of printing it.
|
|
37
|
+
|
|
38
|
+
After participants have voted in the web app, pull the results:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
mvote results --board-id <id> --out results.csv
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Tests
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pytest
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Releases
|
|
51
|
+
|
|
52
|
+
Releases follow [SPEC-distribution](https://github.com/MalverdeSoftware/malverdesoftware/blob/main/docs/specs/SPEC-distribution.md). Until the public flip, `.github/workflows/cli-release.yml` is a dry run. It builds the sdist and wheel, runs `twine check --strict` and `scripts/check-cli-release.py`, installs the wheel, and keeps the files as a workflow artifact. Nothing goes to PyPI.
|
|
53
|
+
|
|
54
|
+
`cli/LICENSE` and `cli/NOTICE` are copies of the root files, so that both the wheel and installs from GitHub include them. After you edit either root file, run `python scripts/check-cli-release.py --fix`; the check fails while the copies differ. Release tags take the form `v<version>` and must match `version` in `pyproject.toml`.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"""Create and export mVote voting sessions ("boards").
|
|
2
|
+
|
|
3
|
+
This module does not depend on any backend. :func:`create_board` returns a
|
|
4
|
+
:class:`Board`, and a backend-specific writer (``firebase_store``) saves it.
|
|
5
|
+
Keeping this backend-agnostic is what lets someone deploy mVote without
|
|
6
|
+
being locked into Firebase specifically.
|
|
7
|
+
"""
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import uuid
|
|
11
|
+
from dataclasses import asdict, dataclass, field
|
|
12
|
+
from datetime import datetime, timezone
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
from typing import Any
|
|
15
|
+
|
|
16
|
+
from .config import Item, load_items
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@dataclass
|
|
20
|
+
class Board:
|
|
21
|
+
board_id: str
|
|
22
|
+
title: str
|
|
23
|
+
items: list[Item]
|
|
24
|
+
created_at: str
|
|
25
|
+
metadata: dict[str, Any] = field(default_factory=dict)
|
|
26
|
+
|
|
27
|
+
def to_dict(self) -> dict:
|
|
28
|
+
return asdict(self)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def create_board(config_path: str | Path, title: str, board_id: str | None = None) -> Board:
|
|
32
|
+
"""Build a new :class:`Board` from an item config file.
|
|
33
|
+
|
|
34
|
+
Does not persist anything — callers (CLI, backend adapter) are
|
|
35
|
+
responsible for writing the board to a store and generating the
|
|
36
|
+
link/QR code from ``board_id``.
|
|
37
|
+
"""
|
|
38
|
+
items = load_items(config_path)
|
|
39
|
+
return Board(
|
|
40
|
+
board_id=board_id or uuid.uuid4().hex[:8],
|
|
41
|
+
title=title,
|
|
42
|
+
items=items,
|
|
43
|
+
created_at=datetime.now(timezone.utc).isoformat(),
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def export_results(board: Board, vote_counts: dict[str, int]) -> list[dict]:
|
|
48
|
+
"""Produce a tidy, analysis-ready export of vote results.
|
|
49
|
+
|
|
50
|
+
Returns one row per item: ``board_id``, ``board_title``, ``item_id``,
|
|
51
|
+
``label``, ``vote_count`` — the structured-data export that is mVote's
|
|
52
|
+
core differentiator versus workshop-oriented dot-voting tools.
|
|
53
|
+
"""
|
|
54
|
+
return [
|
|
55
|
+
{
|
|
56
|
+
"board_id": board.board_id,
|
|
57
|
+
"board_title": board.title,
|
|
58
|
+
"item_id": item.id,
|
|
59
|
+
"label": item.label,
|
|
60
|
+
"vote_count": vote_counts.get(item.id, 0),
|
|
61
|
+
}
|
|
62
|
+
for item in board.items
|
|
63
|
+
]
|
mvote-0.1.0/mvote/cli.py
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"""Command-line interface for creating mVote voting sessions."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import csv
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
import sys
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
import click
|
|
11
|
+
|
|
12
|
+
from . import firebase_store
|
|
13
|
+
from .board import create_board
|
|
14
|
+
from .config import ConfigError
|
|
15
|
+
|
|
16
|
+
DEFAULT_BASE_URL_ENV = "MVOTE_WEBAPP_URL"
|
|
17
|
+
PLACEHOLDER_BASE_URL = "https://mvote.example/vote"
|
|
18
|
+
RESULT_FIELDS = ["board_id", "board_title", "item_id", "label", "vote_count"]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@click.group()
|
|
22
|
+
@click.version_option()
|
|
23
|
+
def main():
|
|
24
|
+
"""mVote: create participatory sticky-note voting sessions."""
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@main.command("create")
|
|
28
|
+
@click.option("--config", "config_path", required=True, type=click.Path(exists=True),
|
|
29
|
+
help="Path to a CSV or JSON item config file.")
|
|
30
|
+
@click.option("--title", required=True, help="Title for this session (e.g. 'Week 3').")
|
|
31
|
+
@click.option("--board-id", default=None, help="Optional fixed board id; random if omitted.")
|
|
32
|
+
@click.option("--out", "out_path", default=None, type=click.Path(),
|
|
33
|
+
help="Write the board definition (JSON) to this path instead of stdout.")
|
|
34
|
+
@click.option("--publish/--no-publish", default=False,
|
|
35
|
+
help="Also write the board to Firebase and print a shareable link + QR code.")
|
|
36
|
+
@click.option("--overwrite", is_flag=True, default=False,
|
|
37
|
+
help="With --publish, replace a board that already has this id. Its vote counts "
|
|
38
|
+
"return to zero; dots participants already spent stay spent.")
|
|
39
|
+
@click.option("--base-url", default=None,
|
|
40
|
+
help=f"Webapp base URL for the shareable link (or set {DEFAULT_BASE_URL_ENV}). "
|
|
41
|
+
"Only used with --publish.")
|
|
42
|
+
@click.option("--qr-out", "qr_out_path", default=None, type=click.Path(),
|
|
43
|
+
help="Save the shareable link's QR code as a PNG to this path (only with --publish; "
|
|
44
|
+
"prints an ASCII QR code to the terminal if omitted).")
|
|
45
|
+
def create(config_path: str, title: str, board_id: str | None, out_path: str | None,
|
|
46
|
+
publish: bool, overwrite: bool, base_url: str | None, qr_out_path: str | None):
|
|
47
|
+
"""Create a new board from an item config file.
|
|
48
|
+
|
|
49
|
+
With --publish, also writes the board to Firestore (see cli/README.md
|
|
50
|
+
for the required GOOGLE_APPLICATION_CREDENTIALS setup) and prints a
|
|
51
|
+
shareable participant link and QR code.
|
|
52
|
+
"""
|
|
53
|
+
try:
|
|
54
|
+
board = create_board(config_path, title=title, board_id=board_id)
|
|
55
|
+
except ConfigError as e:
|
|
56
|
+
click.echo(f"Config error: {e}", err=True)
|
|
57
|
+
sys.exit(1)
|
|
58
|
+
|
|
59
|
+
payload = board.to_dict()
|
|
60
|
+
text = json.dumps(payload, indent=2, default=str)
|
|
61
|
+
|
|
62
|
+
if out_path:
|
|
63
|
+
Path(out_path).write_text(text, encoding="utf-8")
|
|
64
|
+
click.echo(f"Board '{board.board_id}' written to {out_path}")
|
|
65
|
+
else:
|
|
66
|
+
click.echo(text)
|
|
67
|
+
|
|
68
|
+
if publish:
|
|
69
|
+
try:
|
|
70
|
+
firebase_store.save_board(board, overwrite=overwrite)
|
|
71
|
+
except firebase_store.BoardExistsError as e:
|
|
72
|
+
click.echo(str(e), err=True)
|
|
73
|
+
sys.exit(1)
|
|
74
|
+
click.echo(f"Board '{board.board_id}' published to Firestore.")
|
|
75
|
+
|
|
76
|
+
resolved_base_url = base_url or os.environ.get(DEFAULT_BASE_URL_ENV)
|
|
77
|
+
if not resolved_base_url:
|
|
78
|
+
resolved_base_url = PLACEHOLDER_BASE_URL
|
|
79
|
+
click.echo(
|
|
80
|
+
f"Note: no webapp URL configured (--base-url or {DEFAULT_BASE_URL_ENV}); "
|
|
81
|
+
"using a placeholder until the webapp is deployed.",
|
|
82
|
+
err=True,
|
|
83
|
+
)
|
|
84
|
+
link = f"{resolved_base_url.rstrip('/')}/{board.board_id}"
|
|
85
|
+
click.echo(f"Participant link: {link}")
|
|
86
|
+
|
|
87
|
+
import qrcode
|
|
88
|
+
|
|
89
|
+
if qr_out_path:
|
|
90
|
+
qrcode.make(link).save(qr_out_path)
|
|
91
|
+
click.echo(f"QR code written to {qr_out_path}")
|
|
92
|
+
else:
|
|
93
|
+
qr = qrcode.QRCode()
|
|
94
|
+
qr.add_data(link)
|
|
95
|
+
qr.print_ascii()
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
@main.command("results")
|
|
99
|
+
@click.option("--board-id", required=True, help="Id of a board previously created with --publish.")
|
|
100
|
+
@click.option("--out", "out_path", default=None, type=click.Path(),
|
|
101
|
+
help="Write results as CSV to this path instead of stdout.")
|
|
102
|
+
def results(board_id: str, out_path: str | None):
|
|
103
|
+
"""Fetch live vote counts for a published board and export tidy results."""
|
|
104
|
+
try:
|
|
105
|
+
rows = firebase_store.export_board_results(board_id)
|
|
106
|
+
except ValueError as e:
|
|
107
|
+
click.echo(str(e), err=True)
|
|
108
|
+
sys.exit(1)
|
|
109
|
+
|
|
110
|
+
if out_path:
|
|
111
|
+
with open(out_path, "w", newline="", encoding="utf-8") as f:
|
|
112
|
+
_write_results(f, rows)
|
|
113
|
+
click.echo(f"Results for board '{board_id}' written to {out_path}")
|
|
114
|
+
else:
|
|
115
|
+
_write_results(sys.stdout, rows)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def _write_results(stream, rows: list[dict]) -> None:
|
|
119
|
+
writer = csv.DictWriter(stream, fieldnames=RESULT_FIELDS)
|
|
120
|
+
writer.writeheader()
|
|
121
|
+
writer.writerows(rows)
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
if __name__ == "__main__":
|
|
125
|
+
main()
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"""Load and validate item configs (CSV or JSON) for a mVote session.
|
|
2
|
+
|
|
3
|
+
An item config defines the sticky notes participants will vote on. Each item
|
|
4
|
+
needs at minimum an ``id`` and a ``label``; a ``description`` is optional.
|
|
5
|
+
|
|
6
|
+
JSON format::
|
|
7
|
+
|
|
8
|
+
[
|
|
9
|
+
{"id": "var_001", "label": "Depressive symptoms", "description": "..."},
|
|
10
|
+
{"id": "var_002", "label": "Sleep quality"}
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
CSV format (header row required)::
|
|
14
|
+
|
|
15
|
+
id,label,description
|
|
16
|
+
var_001,Depressive symptoms,...
|
|
17
|
+
var_002,Sleep quality,
|
|
18
|
+
"""
|
|
19
|
+
from __future__ import annotations
|
|
20
|
+
|
|
21
|
+
import csv
|
|
22
|
+
import json
|
|
23
|
+
from dataclasses import dataclass
|
|
24
|
+
from pathlib import Path
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
REQUIRED_FIELDS = ("id", "label")
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class ConfigError(ValueError):
|
|
31
|
+
"""Raised when an item config file is missing required fields or is malformed."""
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@dataclass(frozen=True)
|
|
35
|
+
class Item:
|
|
36
|
+
id: str
|
|
37
|
+
label: str
|
|
38
|
+
description: str = ""
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def load_items(path: str | Path) -> list[Item]:
|
|
42
|
+
"""Load a list of :class:`Item` from a CSV or JSON file.
|
|
43
|
+
|
|
44
|
+
Raises:
|
|
45
|
+
ConfigError: if the file is malformed, has duplicate ids, or is
|
|
46
|
+
missing required fields.
|
|
47
|
+
FileNotFoundError: if ``path`` does not exist.
|
|
48
|
+
"""
|
|
49
|
+
path = Path(path)
|
|
50
|
+
if not path.exists():
|
|
51
|
+
raise FileNotFoundError(f"Config file not found: {path}")
|
|
52
|
+
|
|
53
|
+
if path.suffix.lower() == ".json":
|
|
54
|
+
raw_items = _load_json(path)
|
|
55
|
+
elif path.suffix.lower() == ".csv":
|
|
56
|
+
raw_items = _load_csv(path)
|
|
57
|
+
else:
|
|
58
|
+
raise ConfigError(
|
|
59
|
+
f"Unsupported config file type '{path.suffix}'. Use .csv or .json."
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
items = []
|
|
63
|
+
seen_ids = set()
|
|
64
|
+
for i, raw in enumerate(raw_items):
|
|
65
|
+
if not isinstance(raw, dict):
|
|
66
|
+
raise ConfigError(f"Item at index {i} must be an object with id and label.")
|
|
67
|
+
missing = [f for f in REQUIRED_FIELDS if not raw.get(f)]
|
|
68
|
+
if missing:
|
|
69
|
+
raise ConfigError(
|
|
70
|
+
f"Item at index {i} is missing required field(s): {missing}"
|
|
71
|
+
)
|
|
72
|
+
# Compared as text, the way ids are stored: 1 and "1" are the same id.
|
|
73
|
+
item_id = str(raw["id"])
|
|
74
|
+
if item_id in seen_ids:
|
|
75
|
+
raise ConfigError(f"Duplicate item id found: '{item_id}'")
|
|
76
|
+
seen_ids.add(item_id)
|
|
77
|
+
items.append(
|
|
78
|
+
Item(
|
|
79
|
+
id=item_id,
|
|
80
|
+
label=str(raw["label"]),
|
|
81
|
+
description=str(raw.get("description", "") or ""),
|
|
82
|
+
)
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
if not items:
|
|
86
|
+
raise ConfigError("Config file contains no items.")
|
|
87
|
+
|
|
88
|
+
return items
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def _load_json(path: Path) -> list[dict]:
|
|
92
|
+
with path.open("r", encoding="utf-8") as f:
|
|
93
|
+
try:
|
|
94
|
+
data = json.load(f)
|
|
95
|
+
except json.JSONDecodeError as e:
|
|
96
|
+
raise ConfigError(f"Config file is not valid JSON: {e}") from e
|
|
97
|
+
if not isinstance(data, list):
|
|
98
|
+
raise ConfigError("JSON config must be a list of item objects.")
|
|
99
|
+
return data
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def _load_csv(path: Path) -> list[dict]:
|
|
103
|
+
with path.open("r", encoding="utf-8", newline="") as f:
|
|
104
|
+
reader = csv.DictReader(f)
|
|
105
|
+
return list(reader)
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"""Firestore-backed persistence for mVote boards and votes.
|
|
2
|
+
|
|
3
|
+
This is the one Firebase-specific module in the project — board.py stays
|
|
4
|
+
backend-agnostic on purpose (see its docstring). Swapping to a different
|
|
5
|
+
backend later means reimplementing the functions here, not touching board.py.
|
|
6
|
+
|
|
7
|
+
Every function accepts an optional ``db`` (a Firestore client, or anything
|
|
8
|
+
duck-typing its ``collection()``/``document()`` interface) so callers —
|
|
9
|
+
tests included — can inject a fake instead of hitting real Firebase.
|
|
10
|
+
"""
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
import os
|
|
14
|
+
from typing import Any
|
|
15
|
+
|
|
16
|
+
from .board import Board, export_results
|
|
17
|
+
from .config import Item
|
|
18
|
+
|
|
19
|
+
BOARDS_COLLECTION = "boards"
|
|
20
|
+
VOTES_SUBCOLLECTION = "votes"
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def get_client() -> Any:
|
|
24
|
+
"""Return a Firestore client, initializing the Firebase app if needed.
|
|
25
|
+
|
|
26
|
+
Credentials come from the ``GOOGLE_APPLICATION_CREDENTIALS`` environment
|
|
27
|
+
variable (a service-account JSON key path) via Firebase's standard
|
|
28
|
+
Application Default Credentials flow — see cli/README.md for setup.
|
|
29
|
+
"""
|
|
30
|
+
import firebase_admin
|
|
31
|
+
from firebase_admin import credentials, firestore
|
|
32
|
+
|
|
33
|
+
if not firebase_admin._apps:
|
|
34
|
+
cred_path = os.environ.get("GOOGLE_APPLICATION_CREDENTIALS")
|
|
35
|
+
if cred_path:
|
|
36
|
+
firebase_admin.initialize_app(credentials.Certificate(cred_path))
|
|
37
|
+
else:
|
|
38
|
+
firebase_admin.initialize_app()
|
|
39
|
+
return firestore.client()
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class BoardExistsError(ValueError):
|
|
43
|
+
"""Raised when publishing would replace a board that is already there."""
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def save_board(board: Board, db: Any = None, overwrite: bool = False) -> None:
|
|
47
|
+
"""Write a board and its zero-initialized vote counts to Firestore.
|
|
48
|
+
|
|
49
|
+
Publishing sets every count to zero, so a board that already exists is
|
|
50
|
+
left alone unless ``overwrite`` is true.
|
|
51
|
+
|
|
52
|
+
Raises:
|
|
53
|
+
BoardExistsError: if the board exists and ``overwrite`` is false.
|
|
54
|
+
"""
|
|
55
|
+
db = db or get_client()
|
|
56
|
+
board_ref = db.collection(BOARDS_COLLECTION).document(board.board_id)
|
|
57
|
+
if not overwrite and board_ref.get().exists:
|
|
58
|
+
raise BoardExistsError(
|
|
59
|
+
f"Board '{board.board_id}' already exists. Publishing again would reset its "
|
|
60
|
+
"votes to zero. Choose another --board-id, or pass --overwrite to replace it."
|
|
61
|
+
)
|
|
62
|
+
board_ref.set(
|
|
63
|
+
{
|
|
64
|
+
"title": board.title,
|
|
65
|
+
"created_at": board.created_at,
|
|
66
|
+
"metadata": board.metadata,
|
|
67
|
+
"items": [
|
|
68
|
+
{"id": item.id, "label": item.label, "description": item.description}
|
|
69
|
+
for item in board.items
|
|
70
|
+
],
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
votes_ref = board_ref.collection(VOTES_SUBCOLLECTION)
|
|
74
|
+
for item in board.items:
|
|
75
|
+
votes_ref.document(item.id).set({"count": 0})
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def load_board(board_id: str, db: Any = None) -> Board:
|
|
79
|
+
"""Fetch a previously-saved board definition from Firestore.
|
|
80
|
+
|
|
81
|
+
Raises:
|
|
82
|
+
ValueError: if no board with this id exists.
|
|
83
|
+
"""
|
|
84
|
+
db = db or get_client()
|
|
85
|
+
snapshot = db.collection(BOARDS_COLLECTION).document(board_id).get()
|
|
86
|
+
if not snapshot.exists:
|
|
87
|
+
raise ValueError(f"Board '{board_id}' not found.")
|
|
88
|
+
data = snapshot.to_dict()
|
|
89
|
+
items = [
|
|
90
|
+
Item(id=i["id"], label=i["label"], description=i.get("description", ""))
|
|
91
|
+
for i in data["items"]
|
|
92
|
+
]
|
|
93
|
+
return Board(
|
|
94
|
+
board_id=board_id,
|
|
95
|
+
title=data["title"],
|
|
96
|
+
items=items,
|
|
97
|
+
created_at=data["created_at"],
|
|
98
|
+
metadata=data.get("metadata", {}),
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def fetch_vote_counts(board_id: str, db: Any = None) -> dict[str, int]:
|
|
103
|
+
"""Read current per-item vote counts for a board from Firestore."""
|
|
104
|
+
db = db or get_client()
|
|
105
|
+
votes_ref = db.collection(BOARDS_COLLECTION).document(board_id).collection(
|
|
106
|
+
VOTES_SUBCOLLECTION
|
|
107
|
+
)
|
|
108
|
+
return {doc.id: (doc.to_dict() or {}).get("count", 0) for doc in votes_ref.stream()}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def export_board_results(board_id: str, db: Any = None) -> list[dict]:
|
|
112
|
+
"""Load a board and its live vote counts, and produce the tidy export rows."""
|
|
113
|
+
db = db or get_client()
|
|
114
|
+
board = load_board(board_id, db=db)
|
|
115
|
+
vote_counts = fetch_vote_counts(board_id, db=db)
|
|
116
|
+
return export_results(board, vote_counts)
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mvote
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: CLI for creating and configuring mVote participatory sticky-note voting sessions
|
|
5
|
+
Author: Valentín Quiroz de la Sierra, Marissa Ledesma
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Keywords: cbpr,participatory-research,dot-voting,research-tools
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Intended Audience :: Science/Research
|
|
10
|
+
Classifier: Topic :: Scientific/Engineering
|
|
11
|
+
Requires-Python: >=3.9
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
License-File: NOTICE
|
|
15
|
+
Requires-Dist: qrcode[pil]>=7.4
|
|
16
|
+
Requires-Dist: click>=8.1
|
|
17
|
+
Requires-Dist: firebase-admin>=6.5
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
20
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# mvote (command line tool)
|
|
24
|
+
|
|
25
|
+
A Python command line tool that creates mVote voting sessions ("boards") from a CSV or JSON file of items.
|
|
26
|
+
|
|
27
|
+
## Install for development
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
cd cli
|
|
31
|
+
pip install -e ".[dev]"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
mvote create --config ../examples/chks_example.json --title "Week 3"
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
This prints the board definition as JSON, or writes it to a file with `--out`. It doesn't touch any backend.
|
|
41
|
+
|
|
42
|
+
### Publish a session to Firebase
|
|
43
|
+
|
|
44
|
+
Add `--publish` to also write the board to Firestore and print a link and QR code you can share:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
mvote create --config ../examples/chks_example.json --title "Week 3" --publish
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Publishing sets every vote count to zero, so the tool won't publish over a board that already exists. Choose another `--board-id`, or add `--overwrite` if you mean to replace the board and start its counts again.
|
|
51
|
+
|
|
52
|
+
This needs a Firebase project with **Firestore** turned on. Sign the tool in with a service account key. In the Firebase console, go to Project settings, then Service accounts, then Generate new private key. Then set `GOOGLE_APPLICATION_CREDENTIALS` to the downloaded JSON file. **Never commit this file to the repo.**
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/serviceAccountKey.json
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The link uses a placeholder domain until you tell the tool where the web app lives. Pass `--base-url` or set `MVOTE_WEBAPP_URL`. Use `--qr-out path.png` to save the QR code as an image instead of printing it.
|
|
59
|
+
|
|
60
|
+
After participants have voted in the web app, pull the results:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
mvote results --board-id <id> --out results.csv
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Tests
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pytest
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Releases
|
|
73
|
+
|
|
74
|
+
Releases follow [SPEC-distribution](https://github.com/MalverdeSoftware/malverdesoftware/blob/main/docs/specs/SPEC-distribution.md). Until the public flip, `.github/workflows/cli-release.yml` is a dry run. It builds the sdist and wheel, runs `twine check --strict` and `scripts/check-cli-release.py`, installs the wheel, and keeps the files as a workflow artifact. Nothing goes to PyPI.
|
|
75
|
+
|
|
76
|
+
`cli/LICENSE` and `cli/NOTICE` are copies of the root files, so that both the wheel and installs from GitHub include them. After you edit either root file, run `python scripts/check-cli-release.py --fix`; the check fails while the copies differ. Release tags take the form `v<version>` and must match `version` in `pyproject.toml`.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
NOTICE
|
|
3
|
+
README.md
|
|
4
|
+
pyproject.toml
|
|
5
|
+
mvote/__init__.py
|
|
6
|
+
mvote/board.py
|
|
7
|
+
mvote/cli.py
|
|
8
|
+
mvote/config.py
|
|
9
|
+
mvote/firebase_store.py
|
|
10
|
+
mvote.egg-info/PKG-INFO
|
|
11
|
+
mvote.egg-info/SOURCES.txt
|
|
12
|
+
mvote.egg-info/dependency_links.txt
|
|
13
|
+
mvote.egg-info/entry_points.txt
|
|
14
|
+
mvote.egg-info/requires.txt
|
|
15
|
+
mvote.egg-info/top_level.txt
|
|
16
|
+
tests/test_board.py
|
|
17
|
+
tests/test_cli.py
|
|
18
|
+
tests/test_config.py
|
|
19
|
+
tests/test_firebase_store.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
mvote
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "mvote"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "CLI for creating and configuring mVote participatory sticky-note voting sessions"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "Apache-2.0"
|
|
11
|
+
license-files = ["LICENSE", "NOTICE"]
|
|
12
|
+
requires-python = ">=3.9"
|
|
13
|
+
authors = [
|
|
14
|
+
{ name = "Valentín Quiroz de la Sierra" },
|
|
15
|
+
{ name = "Marissa Ledesma" },
|
|
16
|
+
]
|
|
17
|
+
keywords = ["cbpr", "participatory-research", "dot-voting", "research-tools"]
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Intended Audience :: Science/Research",
|
|
21
|
+
"Topic :: Scientific/Engineering",
|
|
22
|
+
]
|
|
23
|
+
dependencies = [
|
|
24
|
+
"qrcode[pil]>=7.4",
|
|
25
|
+
"click>=8.1",
|
|
26
|
+
"firebase-admin>=6.5",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.optional-dependencies]
|
|
30
|
+
dev = [
|
|
31
|
+
"pytest>=7.0",
|
|
32
|
+
"pytest-cov",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[project.scripts]
|
|
36
|
+
mvote = "mvote.cli:main"
|
|
37
|
+
|
|
38
|
+
[tool.setuptools.packages.find]
|
|
39
|
+
include = ["mvote*"]
|
mvote-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import json
|
|
2
|
+
|
|
3
|
+
from mvote.board import create_board, export_results
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def _write_config(tmp_path):
|
|
7
|
+
p = tmp_path / "items.json"
|
|
8
|
+
p.write_text(json.dumps([
|
|
9
|
+
{"id": "v1", "label": "Sleep quality"},
|
|
10
|
+
{"id": "v2", "label": "Mood"},
|
|
11
|
+
]))
|
|
12
|
+
return p
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def test_create_board(tmp_path):
|
|
16
|
+
config = _write_config(tmp_path)
|
|
17
|
+
board = create_board(config, title="Test Session")
|
|
18
|
+
assert board.title == "Test Session"
|
|
19
|
+
assert len(board.items) == 2
|
|
20
|
+
assert board.board_id # non-empty
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def test_create_board_fixed_id(tmp_path):
|
|
24
|
+
config = _write_config(tmp_path)
|
|
25
|
+
board = create_board(config, title="Test Session", board_id="fixed123")
|
|
26
|
+
assert board.board_id == "fixed123"
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def test_export_results(tmp_path):
|
|
30
|
+
config = _write_config(tmp_path)
|
|
31
|
+
board = create_board(config, title="Test Session", board_id="b1")
|
|
32
|
+
rows = export_results(board, vote_counts={"v1": 5})
|
|
33
|
+
assert rows == [
|
|
34
|
+
{"board_id": "b1", "board_title": "Test Session", "item_id": "v1",
|
|
35
|
+
"label": "Sleep quality", "vote_count": 5},
|
|
36
|
+
{"board_id": "b1", "board_title": "Test Session", "item_id": "v2",
|
|
37
|
+
"label": "Mood", "vote_count": 0},
|
|
38
|
+
]
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import json
|
|
2
|
+
|
|
3
|
+
from click.testing import CliRunner
|
|
4
|
+
|
|
5
|
+
from mvote.cli import main
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def _write_config(tmp_path):
|
|
9
|
+
p = tmp_path / "items.json"
|
|
10
|
+
p.write_text(json.dumps([{"id": "v1", "label": "Sleep quality"}]))
|
|
11
|
+
return p
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def test_create_without_publish_does_not_touch_firebase(tmp_path, monkeypatch):
|
|
15
|
+
calls = []
|
|
16
|
+
monkeypatch.setattr(
|
|
17
|
+
"mvote.cli.firebase_store.save_board",
|
|
18
|
+
lambda board, db=None, overwrite=False: calls.append(board),
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
result = CliRunner().invoke(main, [
|
|
22
|
+
"create", "--config", str(_write_config(tmp_path)), "--title", "T",
|
|
23
|
+
])
|
|
24
|
+
|
|
25
|
+
assert result.exit_code == 0
|
|
26
|
+
assert calls == []
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def test_create_with_publish_writes_board_and_prints_link(tmp_path, monkeypatch):
|
|
30
|
+
calls = []
|
|
31
|
+
monkeypatch.setattr(
|
|
32
|
+
"mvote.cli.firebase_store.save_board",
|
|
33
|
+
lambda board, db=None, overwrite=False: calls.append(board),
|
|
34
|
+
)
|
|
35
|
+
monkeypatch.delenv("MVOTE_WEBAPP_URL", raising=False)
|
|
36
|
+
|
|
37
|
+
result = CliRunner().invoke(main, [
|
|
38
|
+
"create", "--config", str(_write_config(tmp_path)), "--title", "T",
|
|
39
|
+
"--board-id", "b1", "--publish", "--base-url", "https://example.com/vote",
|
|
40
|
+
])
|
|
41
|
+
|
|
42
|
+
assert result.exit_code == 0, result.output
|
|
43
|
+
assert len(calls) == 1
|
|
44
|
+
assert calls[0].board_id == "b1"
|
|
45
|
+
assert "Participant link: https://example.com/vote/b1" in result.output
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def test_create_with_publish_uses_placeholder_url_when_unset(tmp_path, monkeypatch):
|
|
49
|
+
monkeypatch.setattr("mvote.cli.firebase_store.save_board", lambda board, db=None, overwrite=False: None)
|
|
50
|
+
monkeypatch.delenv("MVOTE_WEBAPP_URL", raising=False)
|
|
51
|
+
|
|
52
|
+
result = CliRunner().invoke(main, [
|
|
53
|
+
"create", "--config", str(_write_config(tmp_path)), "--title", "T",
|
|
54
|
+
"--board-id", "b1", "--publish",
|
|
55
|
+
])
|
|
56
|
+
|
|
57
|
+
assert result.exit_code == 0, result.output
|
|
58
|
+
assert "mvote.example/vote/b1" in result.output
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def test_create_with_publish_refuses_an_existing_board(tmp_path, monkeypatch):
|
|
62
|
+
from mvote.firebase_store import BoardExistsError
|
|
63
|
+
|
|
64
|
+
seen = []
|
|
65
|
+
|
|
66
|
+
def save(board, db=None, overwrite=False):
|
|
67
|
+
seen.append(overwrite)
|
|
68
|
+
if not overwrite:
|
|
69
|
+
raise BoardExistsError("Board 'b1' already exists.")
|
|
70
|
+
|
|
71
|
+
monkeypatch.setattr("mvote.cli.firebase_store.save_board", save)
|
|
72
|
+
args = ["create", "--config", str(_write_config(tmp_path)), "--title", "T",
|
|
73
|
+
"--board-id", "b1", "--publish", "--base-url", "https://example.com/vote"]
|
|
74
|
+
|
|
75
|
+
refused = CliRunner().invoke(main, args)
|
|
76
|
+
assert refused.exit_code == 1
|
|
77
|
+
assert "already exists" in refused.output
|
|
78
|
+
assert "Participant link" not in refused.output
|
|
79
|
+
|
|
80
|
+
replaced = CliRunner().invoke(main, args + ["--overwrite"])
|
|
81
|
+
assert replaced.exit_code == 0, replaced.output
|
|
82
|
+
assert seen == [False, True]
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def test_results_writes_csv(monkeypatch):
|
|
86
|
+
rows = [
|
|
87
|
+
{"board_id": "b1", "board_title": "T", "item_id": "v1",
|
|
88
|
+
"label": "Sleep quality", "vote_count": 4},
|
|
89
|
+
]
|
|
90
|
+
monkeypatch.setattr(
|
|
91
|
+
"mvote.cli.firebase_store.export_board_results",
|
|
92
|
+
lambda board_id, db=None: rows,
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
result = CliRunner().invoke(main, ["results", "--board-id", "b1"])
|
|
96
|
+
|
|
97
|
+
assert result.exit_code == 0, result.output
|
|
98
|
+
assert "v1" in result.output
|
|
99
|
+
assert "4" in result.output
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def test_results_missing_board_exits_nonzero(monkeypatch):
|
|
103
|
+
def raise_not_found(board_id, db=None):
|
|
104
|
+
raise ValueError(f"Board '{board_id}' not found.")
|
|
105
|
+
|
|
106
|
+
monkeypatch.setattr("mvote.cli.firebase_store.export_board_results", raise_not_found)
|
|
107
|
+
|
|
108
|
+
result = CliRunner().invoke(main, ["results", "--board-id", "nope"])
|
|
109
|
+
|
|
110
|
+
assert result.exit_code == 1
|
|
111
|
+
assert "not found" in result.output
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import pytest
|
|
3
|
+
|
|
4
|
+
from mvote.config import ConfigError, load_items
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def test_load_json_items(tmp_path):
|
|
8
|
+
p = tmp_path / "items.json"
|
|
9
|
+
p.write_text(json.dumps([
|
|
10
|
+
{"id": "v1", "label": "Sleep quality"},
|
|
11
|
+
{"id": "v2", "label": "Mood", "description": "self-reported mood"},
|
|
12
|
+
]))
|
|
13
|
+
items = load_items(p)
|
|
14
|
+
assert len(items) == 2
|
|
15
|
+
assert items[0].id == "v1"
|
|
16
|
+
assert items[1].description == "self-reported mood"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def test_load_csv_items(tmp_path):
|
|
20
|
+
p = tmp_path / "items.csv"
|
|
21
|
+
p.write_text("id,label,description\nv1,Sleep quality,\nv2,Mood,self-reported mood\n")
|
|
22
|
+
items = load_items(p)
|
|
23
|
+
assert len(items) == 2
|
|
24
|
+
assert items[1].label == "Mood"
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def test_missing_required_field(tmp_path):
|
|
28
|
+
p = tmp_path / "items.json"
|
|
29
|
+
p.write_text(json.dumps([{"id": "v1"}]))
|
|
30
|
+
with pytest.raises(ConfigError):
|
|
31
|
+
load_items(p)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def test_duplicate_ids(tmp_path):
|
|
35
|
+
p = tmp_path / "items.json"
|
|
36
|
+
p.write_text(json.dumps([
|
|
37
|
+
{"id": "v1", "label": "A"},
|
|
38
|
+
{"id": "v1", "label": "B"},
|
|
39
|
+
]))
|
|
40
|
+
with pytest.raises(ConfigError):
|
|
41
|
+
load_items(p)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def test_empty_config(tmp_path):
|
|
45
|
+
p = tmp_path / "items.json"
|
|
46
|
+
p.write_text(json.dumps([]))
|
|
47
|
+
with pytest.raises(ConfigError):
|
|
48
|
+
load_items(p)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def test_unsupported_extension(tmp_path):
|
|
52
|
+
p = tmp_path / "items.txt"
|
|
53
|
+
p.write_text("not a config")
|
|
54
|
+
with pytest.raises(ConfigError):
|
|
55
|
+
load_items(p)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def test_missing_file(tmp_path):
|
|
59
|
+
with pytest.raises(FileNotFoundError):
|
|
60
|
+
load_items(tmp_path / "does_not_exist.json")
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def test_ids_that_differ_only_by_type_are_duplicates(tmp_path):
|
|
64
|
+
p = tmp_path / "items.json"
|
|
65
|
+
p.write_text(json.dumps([
|
|
66
|
+
{"id": 1, "label": "A"},
|
|
67
|
+
{"id": "1", "label": "B"},
|
|
68
|
+
]))
|
|
69
|
+
with pytest.raises(ConfigError, match="Duplicate"):
|
|
70
|
+
load_items(p)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def test_item_that_is_not_an_object(tmp_path):
|
|
74
|
+
p = tmp_path / "items.json"
|
|
75
|
+
p.write_text(json.dumps(["Sleep quality", "Mood"]))
|
|
76
|
+
with pytest.raises(ConfigError, match="index 0"):
|
|
77
|
+
load_items(p)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def test_invalid_json(tmp_path):
|
|
81
|
+
p = tmp_path / "items.json"
|
|
82
|
+
p.write_text("[{'id': 'v1'}")
|
|
83
|
+
with pytest.raises(ConfigError, match="not valid JSON"):
|
|
84
|
+
load_items(p)
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import json
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
from mvote import firebase_store
|
|
6
|
+
from mvote.board import create_board
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class FakeSnapshot:
|
|
10
|
+
def __init__(self, doc_id, data):
|
|
11
|
+
self.id = doc_id
|
|
12
|
+
self._data = data
|
|
13
|
+
|
|
14
|
+
@property
|
|
15
|
+
def exists(self):
|
|
16
|
+
return self._data is not None
|
|
17
|
+
|
|
18
|
+
def to_dict(self):
|
|
19
|
+
return self._data
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class FakeDocumentRef:
|
|
23
|
+
def __init__(self, store, path):
|
|
24
|
+
self._store = store
|
|
25
|
+
self._path = path
|
|
26
|
+
|
|
27
|
+
def set(self, data):
|
|
28
|
+
self._store[self._path] = dict(data)
|
|
29
|
+
|
|
30
|
+
def get(self):
|
|
31
|
+
return FakeSnapshot(self._path[-1], self._store.get(self._path))
|
|
32
|
+
|
|
33
|
+
def collection(self, name):
|
|
34
|
+
return FakeCollectionRef(self._store, self._path + (name,))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class FakeCollectionRef:
|
|
38
|
+
def __init__(self, store, path):
|
|
39
|
+
self._store = store
|
|
40
|
+
self._path = path
|
|
41
|
+
|
|
42
|
+
def document(self, doc_id):
|
|
43
|
+
return FakeDocumentRef(self._store, self._path + (doc_id,))
|
|
44
|
+
|
|
45
|
+
def stream(self):
|
|
46
|
+
depth = len(self._path) + 1
|
|
47
|
+
return [
|
|
48
|
+
FakeSnapshot(path[-1], data)
|
|
49
|
+
for path, data in self._store.items()
|
|
50
|
+
if len(path) == depth and path[: len(self._path)] == self._path
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class FakeFirestoreClient:
|
|
55
|
+
"""Minimal in-memory stand-in for a Firestore client, keyed by path tuples."""
|
|
56
|
+
|
|
57
|
+
def __init__(self):
|
|
58
|
+
self._store = {}
|
|
59
|
+
|
|
60
|
+
def collection(self, name):
|
|
61
|
+
return FakeCollectionRef(self._store, (name,))
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def _write_config(tmp_path):
|
|
65
|
+
p = tmp_path / "items.json"
|
|
66
|
+
p.write_text(json.dumps([
|
|
67
|
+
{"id": "v1", "label": "Sleep quality"},
|
|
68
|
+
{"id": "v2", "label": "Mood", "description": "Overall mood rating"},
|
|
69
|
+
]))
|
|
70
|
+
return p
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def test_save_and_load_board_round_trips(tmp_path):
|
|
74
|
+
db = FakeFirestoreClient()
|
|
75
|
+
board = create_board(_write_config(tmp_path), title="Week 3", board_id="b1")
|
|
76
|
+
|
|
77
|
+
firebase_store.save_board(board, db=db)
|
|
78
|
+
loaded = firebase_store.load_board("b1", db=db)
|
|
79
|
+
|
|
80
|
+
assert loaded.board_id == board.board_id
|
|
81
|
+
assert loaded.title == board.title
|
|
82
|
+
assert loaded.created_at == board.created_at
|
|
83
|
+
assert loaded.items == board.items
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def test_save_board_initializes_zero_vote_counts(tmp_path):
|
|
87
|
+
db = FakeFirestoreClient()
|
|
88
|
+
board = create_board(_write_config(tmp_path), title="Week 3", board_id="b1")
|
|
89
|
+
|
|
90
|
+
firebase_store.save_board(board, db=db)
|
|
91
|
+
|
|
92
|
+
assert firebase_store.fetch_vote_counts("b1", db=db) == {"v1": 0, "v2": 0}
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def test_save_board_leaves_an_existing_board_and_its_votes_alone(tmp_path):
|
|
96
|
+
db = FakeFirestoreClient()
|
|
97
|
+
board = create_board(_write_config(tmp_path), title="T", board_id="b1")
|
|
98
|
+
firebase_store.save_board(board, db=db)
|
|
99
|
+
votes = db.collection("boards").document("b1").collection("votes")
|
|
100
|
+
votes.document(board.items[0].id).set({"count": 5})
|
|
101
|
+
|
|
102
|
+
with pytest.raises(firebase_store.BoardExistsError):
|
|
103
|
+
firebase_store.save_board(board, db=db)
|
|
104
|
+
assert firebase_store.fetch_vote_counts("b1", db=db)[board.items[0].id] == 5
|
|
105
|
+
|
|
106
|
+
firebase_store.save_board(board, db=db, overwrite=True)
|
|
107
|
+
assert firebase_store.fetch_vote_counts("b1", db=db)[board.items[0].id] == 0
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def test_fetch_vote_counts_reflects_updates(tmp_path):
|
|
111
|
+
db = FakeFirestoreClient()
|
|
112
|
+
board = create_board(_write_config(tmp_path), title="Week 3", board_id="b1")
|
|
113
|
+
firebase_store.save_board(board, db=db)
|
|
114
|
+
|
|
115
|
+
db.collection("boards").document("b1").collection("votes").document("v1").set({"count": 5})
|
|
116
|
+
|
|
117
|
+
assert firebase_store.fetch_vote_counts("b1", db=db) == {"v1": 5, "v2": 0}
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def test_load_board_missing_raises():
|
|
121
|
+
db = FakeFirestoreClient()
|
|
122
|
+
with pytest.raises(ValueError, match="not found"):
|
|
123
|
+
firebase_store.load_board("nope", db=db)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def test_export_board_results(tmp_path):
|
|
127
|
+
db = FakeFirestoreClient()
|
|
128
|
+
board = create_board(_write_config(tmp_path), title="Week 3", board_id="b1")
|
|
129
|
+
firebase_store.save_board(board, db=db)
|
|
130
|
+
db.collection("boards").document("b1").collection("votes").document("v1").set({"count": 3})
|
|
131
|
+
|
|
132
|
+
rows = firebase_store.export_board_results("b1", db=db)
|
|
133
|
+
|
|
134
|
+
assert rows == [
|
|
135
|
+
{"board_id": "b1", "board_title": "Week 3", "item_id": "v1",
|
|
136
|
+
"label": "Sleep quality", "vote_count": 3},
|
|
137
|
+
{"board_id": "b1", "board_title": "Week 3", "item_id": "v2",
|
|
138
|
+
"label": "Mood", "vote_count": 0},
|
|
139
|
+
]
|