Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
flexible import of csv exports #127
From @mfrasca on December 17, 2015 13:10
Copied from original issue: Bauble/bauble.classic#222
Ross @RoDuth, this is the reason why I often repeat that a group of gardens should adopt Bauble and temporarily hire a programmer.
From @RoDuth on December 18, 2015 6:48
I agree, it would be ideal to have a group of gardens. Not sure I am of much use in that regard, we have shared material with several gardens in the past but not repeatedly from any particular garden and I think they are all settled on the systems they use anyway.
I will see what I receive from ANBG and get it to you soon hopefully. I might see if I can get another example from one of the gardens that uses BGRecorder also. (Assuming then can provide it)
taken from an email to @RoDuth, replying on producing json stuff...
you read in a record,
you make sure it's in dictionary form, not just an array, (if you're reading csv files, there's an option for it in the standard csv library reader)
you will need a format string for:
for each format string, you populate its fields with the fields from the dictionary (the record you read),
you accumulate the strings into sets, one set per type as listed above, and you are using sets so you are automatically saved from duplicates,
then you save the strings into a single json file, in the order of the list above. (you will need a leading
ghini should be able to read it, or you edit it by hand and you correct the script.
possibly (I'm guessing, building it now, you may check), these could be the format strings for family, genus, species:
you feed all of them with the same dictionary, in which I would make sure I have 'species' as the binomial name, and 'species_epithet' as the species epithet. then species_author, genus_author, location, is_species_hybrid, is_genus_hybrid, and I guess you can figure out the rest. the accession needs refer to the complete species binomial name.
as said: 'untested', it's just an idea.
it might be cleaner to work differently, using the json standard library module, but this sounds to me very simple and you do not need really work with json, it's just python strings.
I'm noting it here so we all have these notes and can work on it. flexibility can come later.
added a commit
Aug 4, 2016
one more request, this time from Colombia. so let's just do this and see where we end.
if all goes well, the header is (each field prefixed with P-plant, S-species, A-Accession, or multiple letters if I'm not so sure):
if not all goes well (maybe 10% of the cases), the binomial name may contain: