def add_observations(self, json_data): """Update `dataset` with new `data`.""" record = self.record update_id = uuid.uuid4().hex self.add_pending_update(update_id) new_data = json.loads(json_data) calculator = Calculator(self) new_dframe_raw = calculator.dframe_from_update( new_data, self.schema.labels_to_slugs) calculator._check_update_is_valid(new_dframe_raw) call_async(calculator.calculate_updates, calculator, new_data, new_dframe_raw=new_dframe_raw, update_id=update_id)
def add_observations(self, new_data): """Update `dataset` with `new_data`.""" update_id = uuid.uuid4().hex self.add_pending_update(update_id) new_data = to_list(new_data) calculator = Calculator(self) new_dframe_raw = calculator.dframe_from_update( new_data, self.schema.labels_to_slugs) calculator._check_update_is_valid(new_dframe_raw) calculator.dataset.clear_cache() call_async(calculator.calculate_updates, calculator, new_data, new_dframe_raw=new_dframe_raw, update_id=update_id)
def add_observations(self, new_data): """Update `dataset` with `new_data`.""" record = self.record update_id = uuid.uuid4().hex self.add_pending_update(update_id) if not isinstance(new_data, list): new_data = [new_data] calculator = Calculator(self) new_dframe_raw = calculator.dframe_from_update( new_data, self.schema.labels_to_slugs) calculator._check_update_is_valid(new_dframe_raw) call_async(calculator.calculate_updates, calculator, new_data, new_dframe_raw=new_dframe_raw, update_id=update_id)