Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import Addition :: Importing data with one to many relationships #59

Open
SteadyCadence opened this issue Jun 8, 2017 · 3 comments
Open

Comments

@SteadyCadence
Copy link
Contributor

For importing, many to one relationships it is recommended to use the xlsx format.

File with many locations to one party:
test_one_to_many.xlsx

You need to add your locations to the locations tab, parties to the parties tab and then define the join between them in the relationships tab. If the entities don't have ids you'll need to assign them. IDs get dropped anyway on import. They are just used for the join during the import

@dpalomino
Copy link
Contributor

@bethschechter, maybe we should document this in the online documentation.

@bethschechter
Copy link
Contributor

@dpalomino yes! Happy to do it.

I do have a question, maybe for @SteadyCadence: Where would a spreadsheet like this come from? Would someone have to create it themselves? Is it an export of an existing project? I want to make sure we document how to get to a spreadsheet like this one as well as how to use it.

If it's not an easy answer to write, lmk when is a good time to pick your brain.

Thanks!
Beth

@dpalomino
Copy link
Contributor

Hey @bethschechter

Picking up this, as I know @SteadyCadence is REALLY busy.

So typically importing data via xlsx files is used for "cloning" projects, so moving data from one Cadasta project to another Cadasta project, because it has to follow the "Cadasta format" used when downloading a project. That's having the "locations", "parties" and "relationships" tabs.

If you take a look to one of them, for instance this simple sample file:
demo-project-1.xlsx

You see that there is an "id" column in "locations" and "parties" tab. This id links locations with parties, and the mapping table is in the "relationships" tab (party_id, spatial_unit_id columns).

One workaround to import data not having a 1-1 relationship between locations and parties is to make up the ids (should be unique in the file) for both parties and locations, and then do the corresponding mapping table.

Probably this is a bit complicated for most of our users, maybe we can just added as an "Advanced Import Tip", or something like that.

If you think a live demonstration would help ping me and we can do a quick test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants