Project

General

Profile

Exporting Nationbuilder for CiviCRM » History » Version 1

Jon Goldberg, 11/29/2017 07:03 AM

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
~~~
25
26
### Contacts
27
28
`signups` table is the "civicrm_contact" equivalent
29
`signups.signup_type` is equivalent to Civi `contact_type`. 0 for Individual, 1 for Organization.
30
Households aren't a type of signup; they're in `households` and are connected to signups via `household_signups`.
31
32
### Email
33
34
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`.
35
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.
36
Email location types just aren't a thing in NB.
37
38
### Addresses
39
40
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.
41
42
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.
43
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.
44
45
Cool features of Nationbuilder:
46
* "User submitted" as a location type - better as a custom field IMO, but still cool
47
* Getting address data from Twitter etc.
48
* A field called "geocode accuracy" to indicate that an address isn't accurate enough
49
50
Sources: http://nationbuilder.com/edit_primary_address
51
52
### Contribution pages
53
54
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).
55
`donation_tracking_codes` maps to `civicrm_financial_type`.  See the "migrating website" section.
56
57
58
### Basic pages
59
Page info in `pages`, content in `basic_pages`.
60
61
### Social Capital
62
I haven't tested, but it seems very similar to the [CiviPoints](https://github.com/futurefirst/uk.org.futurefirst.networks.civipoints) extension.
63
64
### Events
65
66
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.
67
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.
68
In Nationbuilder, find events from the "Website" top nav, then find the "Calendar" page.  Events will be a subpage of that.
69
70
### Participants
71
72
Found in `event_rsvps`.
73
When in Nationbuilder viewing an event, you'll find the data on the "RSVPs" subtab.