Help with CSV Import

I am getting ready to import my cattle herd into farmOS. I visited https://farmos.org/guide/import/ and watched the video. My question is on column header names. Is this fixed/limited to what is listed on the Animal import page and in the template file (Name, Archived, Description, Parent IDs, Parent names, Nicknames, Date of birth, Species/breed, Sex, Castrated, Tag ID, Tag type, Tag location)?
In the video, it was stated that unused columns could be deleted, so I wasn’t sure how fixed of a format the import process used or if it simply created whatever is specified in the CSV file. Wondering if I can add more Tag ID’s, Tag type’s and Tag locations to each animal? e.g. ideally, I would be able to specify ear tag, bangs tag and EID tag for each animal in the CSV file for import. Thank you for any help/clarification provided.

1 Like

Hi @ctomayer - good questions.

My question is on column header names. Is this fixed/limited to what is listed on the Animal import page and in the template file (Name, Archived, Description, Parent IDs, Parent names, Nicknames, Date of birth, Species/breed, Sex, Castrated, Tag ID, Tag type, Tag location)?

Yes, ONLY the columns in the template will be accepted.

Wondering if I can add more Tag ID’s, Tag type’s and Tag locations to each animal? e.g. ideally, I would be able to specify ear tag, bangs tag and EID tag for each animal in the CSV file for import. Thank you for any help/clarification provided.

Unfortunately, this won’t work. The CSV importer only includes columns for a single ID right now. I know there are a lot of folks who have more than one ID, though, so this would be a good feature request to open up.

Is it feasible for you to import one ID tag and then fill in the other one manually on each animal? Or - perhaps use the “Name” for one ID and the ID Tag for another? Just ideas… not sure if that would make sense for you.

The CSV importers in general are pretty limited in what they can do. The other more capable option is to use the farmOS.py Python library to write a script that reads your CSV and pushes records to farmOS over the API. But this is certainly more involved, requires knowing Python, etc.

I’m definitely interested in exploring more options for CSV import in general. FWIW, we are currently using the Feeds module: https://drupal.org/project/feeds - which is pretty flexible in some ways, but inflexible in others.