Project

General

Profile

Exporting Nationbuilder for CiviCRM » History » Version 3

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