openfarmcc / OpenFarm

A free and open database for farming and gardening knowledge. You can grow anything!
https://OpenFarm.cc
MIT License
1.55k stars 239 forks source link

Import moar Crops #359

Open roryaronson opened 9 years ago

roryaronson commented 9 years ago

I compiled an insane list of 96k Crop scientific names and associated common names.

Spreadhseet CSV

A few situations to look out for during import:

simonv3 commented 9 years ago

@rickcarlino I'm not sure what the status is of the XML spreadsheet import. Did you ever get that working? Would it be relatively easy to parse this with that?

RickCarlino commented 9 years ago

Oh cool. The last XML file we had (wish I could remember the name) was actually less useful than its size would imply. A lot of the data was just cruft that didn't apply to OpenFarm. For example, it had base64 encoding images inside of the XML. I will take a look at this after I finish looking at these search bugs on staging.

simonv3 commented 9 years ago

Rick did this!

roryaronson commented 9 years ago

I don't think this list was ever imported. Looking at rails admin, we only have ~12k crops in the production database.

sigu commented 6 years ago

@roryaronson , what is the way forward in this?, @simonv3 any thoughts?

simonv3 commented 6 years ago

The way I would go about doing this is trying to import the crops from the links Rory put in the header and then writing a rake job to import them to the local db. Once that works (and existing crops don't get overwritten or ignored) we can try running it on staging.

sigu commented 6 years ago

The data we have has two columns, I am not sure which fields they represent. How should we treat them? screenshot-2017-10-16 96071 crops - scientific and common names csv

anyangocynthia commented 6 years ago

closed by mistake 🙈

roryaronson commented 6 years ago

The first column is the binomial name of the crop. The second column is for comma-separated common names, of which there may be none available, one, or many.

For example, for this crop, the binomial name is Solanum lycopersicum, while the common names include Tomato and Tomate.

sigu commented 6 years ago

According to the validations, name is required for successful saving of the crop. @roryaronson also kindly have a look at my open PR and give feedback

roryaronson commented 6 years ago

@sigu I suppose we could only import crops with at least one common name, and use that value as the OpenFarm Crop Name.

I'm not sure it would be a good idea to import crops and use the binomial name as the OpenFarm Crop Name. Just because that might be confusing. But, it is also probably true that a lot of crops don't have a common name because they aren't very common! In which case, it does make sense to import them and use the binomial name as the OpenFarm Crop Name. Plus, I think it is more important to have more information to start which can slowly be edited, rather than no information and hope it gets added at some point.

So, I guess it makes sense to import everything. If there are any common names, use the first one as the OpenFarm Crop Name. If there are no common names, use the binomial name as the OpenFarm Crop Name. Does that make sense?

In regards to your PR, I'm not a software developer myself so I can't help there 😬

sigu commented 6 years ago

Just to summarise my understanding

Clarification

roryaronson commented 6 years ago

@sigu I think you understand correctly. Let me just clarify:

The "fields" I'm referring to being the ones I see on the crop edit pages, like this one. I'm not exactly sure what those correspond to in the db properties.

Clarification: Both files are the same, just in different formats (excel and CSV)

sigu commented 6 years ago

Then its done now 😄 , and approved