Answers.Body: <p>It sounds like you want to look at the <a href="https://hq.palantetech.coop/projects/electoral-api/wiki/Wiki">Electoral API extension</a> and at <a href="https://wiki.civicrm.org/confluence/display/CRM/Using+CiviCRM+for+e-advocacy">Using CiviCRM for e-advocacy</a> more generally.</p>
  
  <p>The Electoral API extension is in beta - we have it in production for a few clients.  However, we haven't written support for any APIs except the New York Times and Sunlight Foundation, which are both US-centric sources.  Please feel free to extend it to work with UK-based sources!</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-25T11:57:23.963Z
Answers.Text: Hey Jon, thanks for your reply. Your extension looks very interesting, is the aim to be able to pull information from a variety of sources? I'd also been looking at the [CiviMapit](https://github.com/michaelmcandrew/civimapit) extension @michaelmcandrew developed a few years back. 
  Seems there's been [interest](https://wiki.civicrm.org/confluence/display/CRM/Email+MP+module) from MySociety folk in the past too, so partially trying to get an idea of what is out there.
Answers.UserDisplayName: Durruti
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-25T14:54:31.913Z
Answers.Text: @durruti Yes, the goal is to populate from a variety of sources.  As mentioned, two sources are supported currently - we'd love to see support for more.  Also, I submitted a patch for a new hook that will be in Civi 4.7.7 (CRM-18298) that lets you make API calls when geocoding.  This paves the way for real-time population of the data rather than via scheduled job.
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-23T04:27:52.690Z
Answers.LastActivityDate: 2016-04-23T04:27:52.690Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.Body: <p>It might be helpful to set out use cases describing what specifically you want to do with the data: this might tip the balance towards one approach or another.</p>
  
  <p>One approach would be to create a contact subtype for Constituency and then, as you suggest, create a contact for each constituency. As you say, relationships would then be one way to record which constituency someone is in but it makes for a slightly indirect link. You could instead set up a contact reference custom field to record someone's constituency. The field could be restricted to allow only contacts of subtype Constituency.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-25T11:16:19.477Z
Answers.Text: Thanks for your reply Dave. In terms of what I want to do. I created a contact subtype of MP (Member of Parliament), to which I was adding information about voting record, public surgeries, contact details etc. I wanted to display this to users, which I did through an postcode entry, which forwards people to their MP.
Answers.UserDisplayName: Durruti
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-25T11:37:51.593Z
Answers.Text: Essentially I'd like a way to ground users in their political context via constituency - so they can campaign more effectively. Alert them to debates happening within constituency Parties, focus lobbying around particular representives by enabling email to MPs but also promoting when MPs meet constituents, with tokens for these elements for CiviMail and off-line letter campaigns.
  
  So 'moon on a stick' essentially, but you did ask. I think the contact reference custom field sounds like a cleaner and more scalable way to do things?
Answers.UserDisplayName: Durruti
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-26T09:57:51.853Z
Answers.Text: There are pros and cons of contact reference fields vs relationships. See e.g. [Pulling in existing contact reference fields](https://forum.civicrm.org/index.php?topic=36196.0) re Webform CiviCRM. The Electoral API extension sounds interesting; it can be good to build on existing solutions that have been tested in battle by similar organisations.
Answers.UserDisplayName: davejenx
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-21T16:30:32.620Z
Answers.LastActivityDate: 2016-04-21T16:30:32.620Z
Answers.UserDisplayName: davejenx
Answers.Body: <p>You might want to have a look at this CiviCRM MaPit integration that I wrote for this purpose: <a href="https://civicrm.org/blog/michael-mcandrew/civicrm-mapit-integration" rel="nofollow">https://civicrm.org/blog/michael-mcandrew/civicrm-mapit-integration</a>.</p>
  
  <p>The demo no longer exists but the extension is simple and I know that it's still in use with an organisation using an up to date version of CiviCRM.</p>
  
  <p>For this implementation, we chose to store the constituency (and other similar) information in a custom field as it made searching, and building custom permissions easier.</p>
  
  <p>Also, <a href="https://civicrm.org/providers/Tech-To-The-People" rel="nofollow">https://civicrm.org/providers/Tech-To-The-People</a> do a fair amount of work connecting people to their representatives at an EU level and would likely have experiences to share that would be useful for you.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-27T12:07:39.370Z
Answers.Text: Great thanks Michael, I'll give that a try in the first instance and report back, as we lack the expertise in-house to adapt the Electoral API to a UK setting at this stage. Is it worth adding to the e-advocacy page?
Answers.UserDisplayName: Durruti
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-26T18:35:14.430Z
Answers.LastActivityDate: 2016-04-26T18:35:14.430Z
Answers.UserDisplayName: michaelmcandrew
Body: <p>I'm new to the forum, so let me know if I should ask elsewhere.
  We are a campaigning organisation and much of our campaigning is based on electoral consituency, but I'm not sure how best to capture this info.</p>
  
  <p>How many members we can mobilise in that area, who is the current political representative (MP here in the UK), contacts for the local political parties etc?</p>
  
  <p>I've been playing with the <a href="http://www.theyworkforyou.com/api/">They Work for You API</a> so I can get the constituency based on postcode, but I'm not sure what best to do with it. I'd considered setting the constituency as like an organisation level and the relavent relationships but there are a number of disadvantages to this. </p>
  
  <p>It occurred to me that many other organisations must be in the same boat and wondered if anyone had any experience to share? I'm using latest 4.7 Civi with Latest wordpress.
  Many thanks,</p>
  
Tags: <wordpress><custom-fields><extension>
Title: Best practice for dealing with electoral district / constituency?
ThreadText: # Best practice for dealing with electoral district / constituency?
  
  (Asked by: username_0 on 2016-04-21)
  
  I'm new to the forum, so let me know if I should ask elsewhere.
  We are a campaigning organisation and much of our campaigning is based on electoral consituency, but I'm not sure how best to capture this info.
  
  How many members we can mobilise in that area, who is the current political representative (MP here in the UK), contacts for the local political parties etc?
  
  I've been playing with the [They Work for You API](http://www.theyworkforyou.com/api/) so I can get the constituency based on postcode, but I'm not sure what best to do with it. I'd considered setting the constituency as like an organisation level and the relavent relationships but there are a number of disadvantages to this.
  
  It occurred to me that many other organisations must be in the same boat and wondered if anyone had any experience to share? I'm using latest 4.7 Civi with Latest wordpress.
  Many thanks,
  
  **Tags:** wordpress, custom-fields, extension
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2016-04-23. Score: 5
  
  It sounds like you want to look at the [Electoral API extension](https://hq.palantetech.coop/projects/electoral-api/wiki/Wiki) and at [Using CiviCRM for e-advocacy](https://wiki.civicrm.org/confluence/display/CRM/Using+CiviCRM+for+e-advocacy) more generally.
  
  The Electoral API extension is in beta - we have it in production for a few clients. However, we haven't written support for any APIs except the New York Times and Sunlight Foundation, which are both US-centric sources. Please feel free to extend it to work with UK-based sources!
  
  > **Comments:**
  > **username_0**: Hey Jon, thanks for your reply. Your extension looks very interesting, is the aim to be able to pull information from a variety of sources? I'd also been looking at the [CiviMapit](https://github.com/username_3/civimapit) extension @username_3 developed a few years back.  Seems there's been [interest](https://wiki.civicrm.org/confluence/display/CRM/Email+MP+module) from MySociety folk in the past too, so partially trying to get an idea of what is out there.  
  > **username_1**: @username_0 Yes, the goal is to populate from a variety of sources.  As mentioned, two sources are supported currently - we'd love to see support for more.  Also, I submitted a patch for a new hook that will be in Civi 4.7.7 (CRM-18298) that lets you make API calls when geocoding.  This paves the way for real-time population of the data rather than via scheduled job.  
  
  ---
  
  ### Answer by username_2 on 2016-04-21. Score: 4
  
  It might be helpful to set out use cases describing what specifically you want to do with the data: this might tip the balance towards one approach or another.
  
  One approach would be to create a contact subtype for Constituency and then, as you suggest, create a contact for each constituency. As you say, relationships would then be one way to record which constituency someone is in but it makes for a slightly indirect link. You could instead set up a contact reference custom field to record someone's constituency. The field could be restricted to allow only contacts of subtype Constituency.
  
  > **Comments:**
  > **username_0**: Thanks for your reply Dave. In terms of what I want to do. I created a contact subtype of MP (Member of Parliament), to which I was adding information about voting record, public surgeries, contact details etc. I wanted to display this to users, which I did through an postcode entry, which forwards people to their MP.  
  > **username_0**: Essentially I'd like a way to ground users in their political context via constituency - so they can campaign more effectively. Alert them to debates happening within constituency Parties, focus lobbying around particular representives by enabling email to MPs but also promoting when MPs meet constituents, with tokens for these elements for CiviMail and off-line letter campaigns.  So 'moon on a stick' essentially, but you did ask. I think the contact reference custom field sounds like a cleaner and more scalable way to do things?  
  > **username_2**: There are pros and cons of contact reference fields vs relationships. See e.g. [Pulling in existing contact reference fields](https://forum.civicrm.org/index.php?topic=36196.0) re Webform CiviCRM. The Electoral API extension sounds interesting; it can be good to build on existing solutions that have been tested in battle by similar organisations.  
  
  ---
  
  ### Answer by username_3 on 2016-04-26. Score: 1
  
  You might want to have a look at this CiviCRM MaPit integration that I wrote for this purpose: <https://civicrm.org/blog/michael-mcandrew/civicrm-mapit-integration>.
  
  The demo no longer exists but the extension is simple and I know that it's still in use with an organisation using an up to date version of CiviCRM.
  
  For this implementation, we chose to store the constituency (and other similar) information in a custom field as it made searching, and building custom permissions easier.
  
  Also, <https://civicrm.org/providers/username_1-To-The-People> do a fair amount of work connecting people to their representatives at an EU level and would likely have experiences to share that would be useful for you.
  
  > **Comments:**
  > **username_0**: Great thanks Michael, I'll give that a try in the first instance and report back, as we lack the expertise in-house to adapt the Electoral API to a UK setting at this stage. Is it worth adding to the e-advocacy page?  
  
  ---
  
  