|
1 |
| -# mysoc-popolo |
| 1 | +# mysoc-validator |
2 | 2 |
|
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