def DELETE(self, dataset_id): """ Delete observations (i.e. the dataset) with hash *dataset_id* from mongo """ dataset = Dataset.find_one(dataset_id) result = None if dataset: Dataset.delete(dataset_id) Observation.delete(dataset) result = {SUCCESS: 'deleted dataset: %s' % dataset_id} return dump_or_error(result, 'id not found')
def POST(self, url=None, csv_file=None): """ If *url* is provided read data from URL *url*. If *csv_file* is provided read data from *csv_file*. Otherwise return an error message. """ result = None if url: result = create_dataset_from_url(url) if csv_file: result = create_dataset_from_csv(csv_file) return dump_or_error(result, 'url or csv_file required')