Beispiel #1
0
 def update_spreadsheet_with_uuids(submission: Submission, template_mgr: TemplateManager, file_path):
     if not submission:
         return
     wb = IngestWorkbook.from_file(file_path, read_only=False)
     wb.add_entity_uuids(submission)
     wb.add_schemas_worksheet(template_mgr.get_schemas())
     return wb.save(file_path)
Beispiel #2
0
    def generate_json(self, file_path, is_update, project_uuid=None, update_project=False):
        ingest_workbook = IngestWorkbook.from_file(file_path)

        try:
            template_mgr = template_manager.build(ingest_workbook.get_schemas(), self.ingest_api)
        except Exception as e:
            raise SchemaRetrievalError(
                f'There was an error retrieving the schema information to process the spreadsheet. {str(e)}')

        workbook_importer = WorkbookImporter(template_mgr)
        spreadsheet_json, errors = workbook_importer.do_import(ingest_workbook, is_update, project_uuid, update_project)

        return spreadsheet_json, template_mgr, errors