Add function 'get_workbook_from_submission_list' to hca_ingest.downloader.workbook.WorkbookDownloader:
def get_workbook_from_submission_list(self, submission_uuid_list: list) -> Workbook:
submission_entities_list = [self.data_collector.collect_data_by_submission_uuid(submission_uuid) for submission_uuid in submission_uuid_list]
submission_entities = {id: entity for submission_entities_dict in submission_entities_list for id, entity in submission_entities_dict.items()}
entities_with_content = [entity for entity in submission_entities.values() if entity.content]
schema_urls = set([entity.schema for entity in entities_with_content])
schemas = {schema.url: self.schema_collector._SchemaCollector__get_schema_from_cache(schema.url) for schema in schema_urls}
flattened_json = self.flattener.flatten(entities_with_content, schemas)
return self.downloader.create_workbook(flattened_json)
NOTE: I had to change this function slightly to account for different schema versions of the same type (e.g. sequence file 9.2 vs 9.4) in the submissions. THIS NEEDS MORE TESTING
change the ingest_exporter.exporter.terra.spreadsheet.SpreadsheetExporter object, function export_spreadsheet, to call this function:
def export_spreadsheet(self, project_uuid: str, submission_uuid: str):
self.logger.info("Gathering submissions related to project")
project = self.ingest.api.get_project_by_uuid(project_uuid)
submissions = list(self.ingest.api.get_related_entities('submissionEnvelopes', project, 'submissionEnvelopes'))
submission_uuids = [submission['uuid']['uuid'] for submission in submissions]
self.logger.info("Generating Spreadsheet")
workbook = self.downloader.get_workbook_from_submission_list(submission_uuids)
Changes needed:
Add function 'get_workbook_from_submission_list' to
hca_ingest.downloader.workbook.WorkbookDownloader
:NOTE: I had to change this function slightly to account for different schema versions of the same type (e.g. sequence file 9.2 vs 9.4) in the submissions. THIS NEEDS MORE TESTING
change the
ingest_exporter.exporter.terra.spreadsheet.SpreadsheetExporter
object, functionexport_spreadsheet
, to call this function: