Skip to content

Commit

Permalink
Merge pull request #1291 from Sage-Bionetworks/develop-pass-se-and-sg…
Browse files Browse the repository at this point in the history
…-to-updatedb-FDS-1043

Update store/synapse.updateDB to take sg and se
  • Loading branch information
mialy-defelice authored Oct 10, 2023
2 parents b971284 + 463cb54 commit 606372e
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions schematic/store/synapse.py
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ def getProjectManifests(self, projectId: str) -> List[str]:

return manifests

def upload_project_manifests_to_synapse(self, projectId: str) -> List[str]:
def upload_project_manifests_to_synapse(self, sg: SchemaGenerator, projectId: str) -> List[str]:
"""Upload all metadata manifest files across all datasets in a specified project as tables in Synapse.
Returns: String of all the manifest_table_ids of all the manifests that have been loaded.
Expand All @@ -822,7 +822,7 @@ def upload_project_manifests_to_synapse(self, projectId: str) -> List[str]:
manifest_name = manifest_info["properties"]["name"]
manifest_path = manifest_info["path"]
manifest_df = load_df(manifest_path)
manifest_table_id = uploadDB(manifest, datasetId, datasetName)
manifest_table_id = uploadDB(sg=sg, manifest=manifest, datasetId=datasetId, table_name=datasetName)
manifest_loaded.append(datasetName)
return manifest_loaded

Expand Down Expand Up @@ -952,7 +952,7 @@ def get_table_info(self, datasetId: str = None, projectId: str = None) -> List[s

@missing_entity_handler
def uploadDB(self,
sg: SchemaGenerator,
sg: SchemaGenerator,
manifest: pd.DataFrame,
datasetId: str,
table_name: str,
Expand All @@ -964,7 +964,7 @@ def uploadDB(self,
Method to upload a database to an asset store. In synapse, this will upload a metadata table
Args:
se: schemaExplorer object
sg: schemaGenerator object
manifest: pd.Df manifest to upload
datasetId: synID of the dataset for the manifest
table_name: name of the table to be uploaded
Expand All @@ -981,7 +981,7 @@ def uploadDB(self,
"""


col_schema, table_manifest = self.formatDB(sg, manifest, useSchemaLabel)
col_schema, table_manifest = self.formatDB(sg=sg, manifest=manifest, useSchemaLabel=useSchemaLabel)

manifest_table_id = self.buildDB(datasetId, table_name, col_schema, table_manifest, table_manipulation, sg, restrict,)

Expand All @@ -992,7 +992,7 @@ def formatDB(self, sg, manifest, useSchemaLabel):
Method to format a manifest appropriatly for upload as table
Args:
se: schemaExplorer object
sg: schemaGenerator object
manifest: pd.Df manifest to upload
useSchemaLabel: bool whether to use schemaLabel (True) or display label (False)
Expand Down Expand Up @@ -1499,13 +1499,13 @@ def upload_manifest_as_table(
"""
# Upload manifest as a table, get the ID and updated manifest.
manifest_synapse_table_id, manifest, table_manifest = self.uploadDB(
schemaGenerator,
manifest,
datasetId,
table_name,
restrict,
useSchemaLabel,
table_manipulation)
sg=schemaGenerator,
manifest=manifest,
datasetId=datasetId,
table_name=table_name,
restrict=restrict,
useSchemaLabel=useSchemaLabel,
table_manipulation=table_manipulation)

manifest = self.add_annotations_to_entities_files(se, schemaGenerator, manifest, manifest_record_type, datasetId, hideBlanks, manifest_synapse_table_id)
# Load manifest to synapse as a CSV File
Expand All @@ -1518,13 +1518,13 @@ def upload_manifest_as_table(

# Update manifest Synapse table with new entity id column.
manifest_synapse_table_id, manifest, table_manifest = self.uploadDB(
schemaGenerator,
manifest,
datasetId,
table_name,
restrict,
sg=schemaGenerator,
manifest=manifest,
datasetId=datasetId,
table_name=table_name,
restrict=restrict,
useSchemaLabel=useSchemaLabel,
table_manipulation='update',)
table_manipulation='update')

# Set annotations for the table manifest
manifest_annotations = self.format_manifest_annotations(manifest, manifest_synapse_table_id)
Expand Down Expand Up @@ -1605,13 +1605,13 @@ def upload_manifest_combo(
manifest_synapse_file_id (str): SynID of manifest csv uploaded to synapse.
"""
manifest_synapse_table_id, manifest, table_manifest = self.uploadDB(
se,
manifest,
datasetId,
table_name,
restrict,
sg=schemaGenerator,
manifest=manifest,
datasetId=datasetId,
table_name=table_name,
restrict=restrict,
useSchemaLabel=useSchemaLabel,
table_manipulation=table_manipulation,)
table_manipulation=table_manipulation)

manifest = self.add_annotations_to_entities_files(se, schemaGenerator, manifest, manifest_record_type, datasetId, hideBlanks, manifest_synapse_table_id)

Expand All @@ -1625,13 +1625,13 @@ def upload_manifest_combo(

# Update manifest Synapse table with new entity id column.
manifest_synapse_table_id, manifest, table_manifest = self.uploadDB(
se,
manifest,
datasetId,
table_name,
restrict,
sg=schemaGenerator,
manifest=manifest,
datasetId=datasetId,
table_name=table_name,
restrict=restrict,
useSchemaLabel=useSchemaLabel,
table_manipulation='update',)
table_manipulation='update')

# Set annotations for the table manifest
manifest_annotations = self.format_manifest_annotations(manifest, manifest_synapse_table_id)
Expand Down

0 comments on commit 606372e

Please sign in to comment.