Skip to content

Commit bf3d242

Browse files
committed
Update readme
1 parent 9382eee commit bf3d242

File tree

1 file changed

+46
-17
lines changed

1 file changed

+46
-17
lines changed

README.md

+46-17
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,72 @@
11
# mysoc-validator
22

3-
A set of pydantic based validators for common mySociety democracy formats.
3+
A set of pydantic-based validators and classes for common mySociety democracy formats.
44

5-
The long term goal is to consolidate different scripts behind a common validation system.
5+
Currently supports:
66

7-
## Transcripts
8-
9-
Python validator and handler for 'publicwhip' style transcript format.
7+
- Popolo database
8+
- Transcript format
9+
- Interests format
1010

11-
Haven't ensured it can do round trips yet - but can read and write. Needs tests.
11+
XML based formats are tested to round-trip with themselves, but not to be string identical with the original source.
1212

13-
```python
14-
from mysoc_validator import Transcript
15-
16-
transcript = Transcript.from_path(<path to xml file>)
17-
```
13+
To use as a cli validator :
1814

1915
```bash
16+
python -m mysoc_validator validate --path <path-to-people.json> --type popolo
2017
python -m mysoc_validator validate --path <path-to-transcript.xml> --type transcript
18+
python -m mysoc_validator validate --path <path-to-interests.xml> --type interests
19+
2120
```
2221

2322
## Popolo
2423

25-
A pydantic based validator for main mysociety people.json file (which mostly follows the popolo standard with a few extra bits).
24+
A pydantic based validator for main mySociety people.json file (which mostly follows the popolo standard with a few extra bits).
2625

2726
Validates:
2827

2928
- Basic structure
3029
- Unique IDs and ID Patterns
3130
- Foreign key relationships between objects.
3231

33-
It also has support for looking up from name or indentifer to person (see tests), and new ID generation for membership.
32+
It also has support for looking up from name or identifying to person, and new ID generation for membership.
33+
34+
### Using name or ID lookup
35+
36+
After first use, there is some caching behind the scenes to speed this up.
3437

3538
```python
3639
from mysoc_validator import Popolo
37-
40+
from mysoc_validator.models.popolo import Chamber, IdentifierScheme
41+
from datetime import date
3842
popolo = Popolo.from_path(<path to people.json>)
43+
44+
keir_starmer_parl_id = popolo.persons.from_identifier(4514, scheme=IdentifierScheme.MNIS)
45+
keir_starmer_name = popolo.persons.from_name(
46+
"keir starmer", chamber_id=Chamber.COMMONS, date=date.fromisoformat("2022-07-31")
47+
)
48+
49+
keir_starmer_parl_id.id == keir_starmer_name.id
50+
```
51+
52+
53+
## Transcripts
54+
55+
Python validator and handler for 'publicwhip' style transcript format.
56+
57+
```python
58+
from mysoc_validator import Transcript
59+
60+
transcript = Transcript.from_path(<path to xml file>)
61+
```
62+
63+
## Register of Interests
64+
65+
Python validator and handler for 'publicwhip' style interests format.
66+
67+
```python
68+
from mysoc_validator import Registry
69+
70+
interests = Registry.from_path(<path to xml file>)
3971
```
4072

41-
```bash
42-
python -m mysoc_validator validate --path <path-to-people.json> --type popolo
43-
```

0 commit comments

Comments
 (0)