Skip to content

Commit d89121f

Browse files
committed
Initial commit
1 parent 9b5845d commit d89121f

19 files changed

+1026469
-32
lines changed

.devcontainer/devcontainer.json

+14-9
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,18 @@
33
"build": {
44
"dockerfile": "../Dockerfile"
55
},
6-
"extensions": [
7-
"ms-vscode.test-adapter-converter",
8-
"bungcip.better-toml",
9-
"ms-python.python",
10-
"ms-python.vscode-pylance",
11-
"ms-azuretools.vscode-docker",
12-
"valentjn.vscode-ltex",
13-
"mhutchie.git-graph"
14-
]
6+
"customizations": {
7+
"vscode": {
8+
"extensions": [
9+
"ms-vscode.test-adapter-converter",
10+
"bungcip.better-toml",
11+
"ms-python.python",
12+
"ms-python.vscode-pylance",
13+
"ms-azuretools.vscode-docker",
14+
"valentjn.vscode-ltex",
15+
"mhutchie.git-graph",
16+
"charliermarsh.ruff"
17+
]
18+
}
19+
}
1520
}

.vscode/settings.json

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
{
2-
"python.linting.pylintEnabled": true,
32
"python.defaultInterpreterPath": "/usr/local/bin/python",
43
"python.terminal.activateEnvironment": false,
5-
"python.formatting.provider": "black",
64
"python.analysis.typeCheckingMode": "strict",
75
"editor.formatOnSave": true,
86
"editor.codeActionsOnSave": {
9-
"source.organizeImports": true
7+
"source.organizeImports": "explicit"
108
},
119
"git.pullTags": false,
1210
"ltex.language": "en-GB",
@@ -27,11 +25,6 @@
2725
"**/templates/**/*": "django-txt",
2826
"**/requirements{/**,*}.{txt,in}": "pip-requirements"
2927
},
30-
"python.linting.pylintArgs": [
31-
"--max-line-length=88",
32-
"--disable=C0103,E1101,E1123,W0102",
33-
],
34-
"jupyter.jupyterServerType": "local",
3528
"[markdown]": {
3629
"editor.quickSuggestions": {
3730
"comments": "on",

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.10-bullseye
1+
FROM python:3.9-bullseye
22

33
ENV DEBIAN_FRONTEND noninteractive
44
COPY pyproject.toml poetry.loc[k] /
@@ -8,4 +8,4 @@ RUN curl -sSL https://install.python-poetry.org | python - && \
88
poetry config virtualenvs.create false && \
99
poetry self add poetry-bumpversion && \
1010
poetry install && \
11-
echo "/workspaces/mysoc-popolo/src/" > /usr/local/lib/python3.10/site-packages/mysoc_popolo.pth
11+
echo "/workspaces/mysoc-popolo/src/" > /usr/local/lib/python3.9/site-packages/mysoc_popolo.pth

README.md

+101-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,102 @@
1-
# mysoc-popolo
1+
# mysoc-validator
22

3-
null
3+
A set of pydantic based validators for common mySociety democracy formats.
4+
5+
The long term goal is to consolidate different scripts behind a common validation system.
6+
7+
## Transcripts
8+
9+
Python validator and handler for 'publicwhip' style transcript format.
10+
11+
Haven't ensured it can do round trips yet - but can read and write. Needs tests.
12+
13+
```python
14+
from mysoc_validator import DailyRecord
15+
16+
transcript = DailyRecord.from_path(<path to xml file>)
17+
```
18+
19+
```bash
20+
python -m validate_transcript <path-to-transcript.xml>
21+
```
22+
23+
## Popolo
24+
25+
A pydantic based validator for main mysociety people.json file (which mostly follows the popolo standard with a few extra bits).
26+
27+
Validates:
28+
29+
- Basic structure
30+
- Unique IDs and ID Patterns
31+
- Foreign key relationships between objects.
32+
33+
It also has support for looking up from name or indentifer to person (see tests), and new ID generation for membership.
34+
35+
```python
36+
from mysoc_validator import Popolo
37+
38+
popolo = Popolo.from_path(<path to people.json>)
39+
```
40+
41+
```bash
42+
python -m validate_popolo <path-to-people.json>
43+
```
44+
45+
### People.json
46+
47+
The currently committed people.json is not the authoriative one - currently has some tweaks to pass validation.
48+
49+
In the long run - do not store this in this repo, fetch the live one before running tests.
50+
51+
curl -o data/people.json https://raw.githubusercontent.com/mysociety/parlparse/master/members/people.json
52+
53+
Changes needed to parlparse version:
54+
55+
- Add chambers
56+
- replace additional_names and additional__name with additional_name
57+
- (not implimented yet) - role for all new constituencies and remove optional in the validator.
58+
59+
```json
60+
{
61+
"classification": "chamber",
62+
"id": "house-of-commons",
63+
"identifiers": [],
64+
"name": "House of Commons"
65+
},
66+
{
67+
"classification": "chamber",
68+
"id": "house-of-lords",
69+
"identifiers": [],
70+
"name": "House of Lords"
71+
},
72+
{
73+
"classification": "chamber",
74+
"id": "scottish-parliament",
75+
"identifiers": [],
76+
"name": "Scottish Parliament"
77+
},
78+
{
79+
"classification": "chamber",
80+
"id": "welsh-parliament",
81+
"identifiers": [],
82+
"name": "Senedd"
83+
},
84+
{
85+
"classification": "chamber",
86+
"id": "northern-ireland-assembly",
87+
"identifiers": [],
88+
"name": "Northern Ireland Assembly"
89+
},
90+
{
91+
"classification": "chamber",
92+
"id": "crown",
93+
"identifiers": [],
94+
"name": "Crown"
95+
},
96+
{
97+
"classification": "metro",
98+
"id": "london-assembly",
99+
"identifiers": [],
100+
"name": "London Assembly"
101+
},
102+
```

0 commit comments

Comments
 (0)