Project

General

Profile

Exporting Nationbuilder for CiviCRM » History » Version 4

Jon Goldberg, 11/09/2020 07:39 PM

1 4 Jon Goldberg
{{last_updated_at}} by {{last_updated_by}}
2
3 1 Jon Goldberg
# Exporting Nationbuilder for CiviCRM
4
5
Nationbuilder notes:
6
Nationbuilder lets you download your data in Postgres 9 format.
7
**Settings menu » Database**
8
Click **Create Database Snapshot**, wait several minutes
9
10
### Configuring Postgres on Ubuntu
11
12
~~~ shell
13
sudo apt install postgresql postgresql-contrib
14
# Optional: Postres GUI
15
sudo apt install pgadmin3
16
17
sudo -iu postgres
18
createuser --interactive nbuild
19
# superuser is "yes"
20
createdb nbuild
21
psql nbuild
22
ALTER USER nbuild WITH PASSWORD '1234';
23
\q
24
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;"
25
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;"
26 2 Jon Goldberg
# as your regular Unix user
27
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
28 1 Jon Goldberg
~~~
29
30 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.
31
32 1 Jon Goldberg
### Contacts
33
34
`signups` table is the "civicrm_contact" equivalent
35
`signups.signup_type` is equivalent to Civi `contact_type`. 0 for Individual, 1 for Organization.
36
Households aren't a type of signup; they're in `households` and are connected to signups via `household_signups`.
37
38
### Email
39
40
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`.
41
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.
42
Email location types just aren't a thing in NB.
43
44
### Addresses
45
46
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.
47
48
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.
49
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.
50
51
Cool features of Nationbuilder:
52
* "User submitted" as a location type - better as a custom field IMO, but still cool
53
* Getting address data from Twitter etc.
54
* A field called "geocode accuracy" to indicate that an address isn't accurate enough
55
56
Sources: http://nationbuilder.com/edit_primary_address
57
58
### Contribution pages
59
60
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).
61
`donation_tracking_codes` maps to `civicrm_financial_type`.  See the "migrating website" section.
62
63
64
### Basic pages
65
Page info in `pages`, content in `basic_pages`.
66
67
### Social Capital
68
I haven't tested, but it seems very similar to the [CiviPoints](https://github.com/futurefirst/uk.org.futurefirst.networks.civipoints) extension.
69
70
### Events
71
72
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.
73
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.
74
In Nationbuilder, find events from the "Website" top nav, then find the "Calendar" page.  Events will be a subpage of that.
75
76
### Participants
77
78
Found in `event_rsvps`.
79
When in Nationbuilder viewing an event, you'll find the data on the "RSVPs" subtab.