Exporting Nationbuilder for CiviCRM » History » Version 2
Jon Goldberg, 01/16/2018 10:23 PM
1 | 1 | Jon Goldberg | # Exporting Nationbuilder for CiviCRM |
---|---|---|---|
2 | |||
3 | Nationbuilder notes: |
||
4 | Nationbuilder lets you download your data in Postgres 9 format. |
||
5 | **Settings menu » Database** |
||
6 | Click **Create Database Snapshot**, wait several minutes |
||
7 | |||
8 | ### Configuring Postgres on Ubuntu |
||
9 | |||
10 | ~~~ shell |
||
11 | sudo apt install postgresql postgresql-contrib |
||
12 | # Optional: Postres GUI |
||
13 | sudo apt install pgadmin3 |
||
14 | |||
15 | sudo -iu postgres |
||
16 | createuser --interactive nbuild |
||
17 | # superuser is "yes" |
||
18 | createdb nbuild |
||
19 | psql nbuild |
||
20 | ALTER USER nbuild WITH PASSWORD '1234'; |
||
21 | \q |
||
22 | psql -d nbuild -U nbuild -h 127.0.0.1 --password -c "CREATE SCHEMA nbuild_africans; CREATE SCHEMA shared_extensions; CREATE EXTENSION hstore WITH schema shared_extensions; CREATE EXTENSION dblink WITH schema shared_extensions; CREATE EXTENSION citext WITH schema shared_extensions; CREATE EXTENSION pg_trgm WITH schema shared_extensions;" |
||
23 | psql -c "CREATE SCHEMA nbuild_africans; CREATE SCHEMA shared_extensions; CREATE EXTENSION hstore WITH schema shared_extensions; CREATE EXTENSION dblink WITH schema shared_extensions; CREATE EXTENSION citext WITH schema shared_extensions; CREATE EXTENSION pg_trgm WITH schema shared_extensions;" |
||
24 | 2 | Jon Goldberg | # as your regular Unix user |
25 | pg_restore -d nbuild --password --format=c -U nbuild -h 127.0.0.1 --schema="nbuild_africans" --verbose --clean --no-acl --no-owner /path/to/backupfile |
||
26 | 1 | Jon Goldberg | ~~~ |
27 | |||
28 | ### Contacts |
||
29 | |||
30 | `signups` table is the "civicrm_contact" equivalent |
||
31 | `signups.signup_type` is equivalent to Civi `contact_type`. 0 for Individual, 1 for Organization. |
||
32 | Households aren't a type of signup; they're in `households` and are connected to signups via `household_signups`. |
||
33 | |||
34 | |||
35 | |||
36 | Email is stored in both `signups` and `email_addresses`. They appear to have the same data, though if it's possible to how more than 4 emails, you'll only find them in `signups`. |
||
37 | is_bad and is_invalid are both variations on "on hold" - `is_bad` is a manually set option to mark an email bad on a per-email basis. `is_invalid` is based on bounce processing. |
||
38 | Email location types just aren't a thing in NB. |
||
39 | |||
40 | ### Addresses |
||
41 | |||
42 | Postal addresses are in `signups`, but they're already normalized in `addresses`. While `addresses.signup_id` exists, it's a red herring. You use the following fields from signups to connect them: address_id, mailing_address_id, registered_address_id, work_address_id, billing_address_id, twitter_address_id(?), facebook_address_id, meetup_address_id, user_submitted_address_id, primary_address_id. |
||
43 | |||
44 | It would seem like this means that an address can have multiple location types, but that seems not to be the case. This makes mapping relatively easy. |
||
45 | As far as I can tell, there are addresses not attached to any record. This is an artifact of not being able to use foreign keys with their db structure. |
||
46 | |||
47 | Cool features of Nationbuilder: |
||
48 | * "User submitted" as a location type - better as a custom field IMO, but still cool |
||
49 | * Getting address data from Twitter etc. |
||
50 | * A field called "geocode accuracy" to indicate that an address isn't accurate enough |
||
51 | |||
52 | Sources: http://nationbuilder.com/edit_primary_address |
||
53 | |||
54 | ### Contribution pages |
||
55 | |||
56 | The equivalent table is `donation_pages`. Note that donation pages are embedded in regular pages, so you'll need to join to the `pages` table on page_id (and next_page_id, if you want thank-you values). |
||
57 | `donation_tracking_codes` maps to `civicrm_financial_type`. See the "migrating website" section. |
||
58 | |||
59 | |||
60 | ### Basic pages |
||
61 | Page info in `pages`, content in `basic_pages`. |
||
62 | |||
63 | ### Social Capital |
||
64 | I haven't tested, but it seems very similar to the [CiviPoints](https://github.com/futurefirst/uk.org.futurefirst.networks.civipoints) extension. |
||
65 | |||
66 | ### Events |
||
67 | |||
68 | Events are found in the `event_pages` table - there's also an `events` table, so maybe there's another type of event I'm not familiar with. |
||
69 | Times are in UTC; there's a time_zone field to indicate the offset. When Civi implements CRM-17618, the data structure will be comparable; until then, you must manually offset the date based on timezone. |
||
70 | In Nationbuilder, find events from the "Website" top nav, then find the "Calendar" page. Events will be a subpage of that. |
||
71 | |||
72 | ### Participants |
||
73 | |||
74 | Found in `event_rsvps`. |
||
75 | When in Nationbuilder viewing an event, you'll find the data on the "RSVPs" subtab. |