(self, input, input_batch_id, file_name)
| 50 | return result |
| 51 | |
| 52 | def extract_metadata_from_batch(self, input, input_batch_id, file_name): |
| 53 | input_batch = InputBatch.get_by_id(self.session, id = input_batch_id) |
| 54 | pre_labels = input_batch.pre_labeled_data |
| 55 | if pre_labels is None: |
| 56 | return input |
| 57 | uuid = None |
| 58 | file_data = None |
| 59 | if self.request: |
| 60 | uuid = self.request.form.get('uuid') |
| 61 | file_data = pre_labels.get(uuid) |
| 62 | if file_data is None: |
| 63 | # Try finding the pre_labels with the file_name as a backup |
| 64 | file_data = pre_labels.get(file_name) |
| 65 | if file_data is None: |
| 66 | logger.warning(f"Input: {input.id} File {file_name} has no pre_labeled data associated") |
| 67 | return |
| 68 | |
| 69 | if file_data.get('file_metadata'): |
| 70 | file_metadata = file_data.get('file_metadata') |
| 71 | input.file_metadata = file_metadata |
| 72 | |
| 73 | return input |
| 74 | |
| 75 | def extract_instance_list_from_batch(self, input, input_batch_id, file_name): |
| 76 | if input_batch_id is None: |
no test coverage detected