mysociety/popit-api — pull request #38 by hecticjeff (2014-03-04 19:05:19+00:00)
Title: Coalitions

Add support for modelling coalitions using a `member` property on memberships which acts as a polymorphic reference to a person OR an organization. This allows person results to list the parties they're in as well as the coalitions that those parties have been part of.

Here's an example of a person with an organization (party) membership, where that organization (party) has memberships in other organizations (coalitions). Some data has been omitted for clarity.

```json
{
"id": "popit.eduskunta/person/109",
"name": "Jörn Donner",
"memberships": [
{
"contact_details": [],
"links": [],
"organization_id": "popit.eduskunta/party/r",
"end_date": "1995-03-23",
"member": {
"id": "popit.eduskunta/person/109",
"@type": "Person"
},
"start_date": "1987-03-21",
"id": "53149b89009bb25938d57114"
},
{
"contact_details": [],
"links": [],
"organization_id": "popit.eduskunta/government/72",
"member": {
"id": "popit.eduskunta/party/r",
"@type": "Organization"
},
"id": "53149b86009bb25938d57103"
},
{
"contact_details": [],
"links": [],
"organization_id": "popit.eduskunta/government/71",
"member": {
"id": "popit.eduskunta/party/r",
"@type": "Organization"
},
"id": "53149b87009bb25938d57108"
},
{
"contact_details": [],
"links": [],
"organization_id": "popit.eduskunta/government/70",
"member": {
"id": "popit.eduskunta/party/r",
"@type": "Organization"
},
"id": "53149b88009bb25938d5710c"
},
{
"contact_details": [],
"links": [],
"organization_id": "popit.eduskunta/government/69",
"member": {
"id": "popit.eduskunta/party/r",
"@type": "Organization"
},
"id": "53149b89009bb25938d57110"
}
]
}
```

Closes https://github.com/mysociety/popit/issues/324