def do_sample_import(self, event): cname = self.corename core = datastore.cores.get(cname) if core is None: core = Core(cname) datastore.cores[cname] = core for item in self.rows: # TODO -- need to update existing samples if they exist, not # add new ones! s = Sample('input', item) core.add(s) all = Sample('input', {'depth': 'all'}) source = self.corepage.source_name # TODO: should only put metada in mdata if it will not be used for # calculations anywhere if source: all['input']['Provenance'] = source core.mdata.atts['Provenance'] = (mData.CorePubAtt('input', 'Provenance', source)) latlng = self.corepage.latlng all['input']['Latitude'] = latlng[0] all['input']['Longitude'] = latlng[1] guid = self.corepage.core_guid if guid: all['input']['Core GUID'] = guid core.mdata.atts['Core GUID'] = (mData.CoreAttribute('input', 'Core GUID', guid, 'guid')) core.mdata.atts['Geography'] = (mData.CoreGeoAtt('input', 'Geography', latlng, "")) core.add(all) core.loaded = True
def do_sample_import(self, event): cname = self.corename core = datastore.cores.get(cname) if core is None: core = Core(cname) datastore.cores[cname] = core for item in self.rows: # TODO -- need to update existing samples if they exist, not # add new ones! s = Sample("input", item) core.add(s) all = Sample("input", {"depth": "all"}) source = self.corepage.source_name # TODO: should only put metada in mdata if it will not be used for # calculations anywhere if source: all["input"]["Provenance"] = source core.mdata.atts["Provenance"] = mData.CorePubAtt("input", "Provenance", source) latlng = self.corepage.latlng all["input"]["Latitude"] = latlng[0] all["input"]["Longitude"] = latlng[1] guid = self.corepage.core_guid if guid: all["input"]["Core GUID"] = guid core.mdata.atts["Core GUID"] = mData.CoreAttribute("input", "Core GUID", guid, "guid") core.mdata.atts["Geography"] = mData.CoreGeoAtt("input", "Geography", latlng, "") core.add(all) core.loaded = True