diff --git a/src/cli/main.py b/src/cli/main.py index 800ba9a..4e29829 100644 --- a/src/cli/main.py +++ b/src/cli/main.py @@ -66,7 +66,8 @@ ) OPTION_CLONE_DIRECTORY = click.option( - "--duplicate_directory","-d", + "--duplicate_directory", + "-d", type=bool, is_flag=True, default=False, @@ -183,7 +184,7 @@ def print_lab( bag_crate: Optional[bool], collect_all: Optional[bool], gpg_binary: Optional[Path], - duplicate_directory: Optional[Path] + duplicate_directory: Optional[bool], ) -> None: """ Create an RO-Crate based on a Print Lab metadata file diff --git a/src/ingestion_targets/print_lab_genomics/extractor.py b/src/ingestion_targets/print_lab_genomics/extractor.py index 409eaab..d224338 100644 --- a/src/ingestion_targets/print_lab_genomics/extractor.py +++ b/src/ingestion_targets/print_lab_genomics/extractor.py @@ -22,10 +22,10 @@ import src.ingestion_targets.print_lab_genomics.consts as profile_consts from src.cli.mytardisconfig import SchemaConfig from src.ingestion_targets.print_lab_genomics.print_crate_dataclasses import ( + ExtractionDataset, MedicalCondition, Participant, SampleExperiment, - ExtractionDataset ) from src.metadata_extraction.metadata_extraction import ( MetadataHanlder, @@ -63,12 +63,6 @@ def __init__( self.metadata_handler = MetadataHanlder(self.api_agent, namespaces) self.collect_all = collect_all - # - # def _contruct_sensitive_dict( - # self, sensitive_feild_names: list[str] - # ) -> dict[str, Callable[[str], str]]: - # return {field_name: field_name for field_name in sensitive_feild_names} - def datasheet_to_dataframe( self, input_data_source: Any, sheet_name: str ) -> pd.DataFrame: @@ -289,7 +283,7 @@ def parse_dataset(row: pd.Series) -> ExtractionDataset: additional_properties={}, schema_type="Dataset", acls=None, - copy_unlisted=row["Crate Children"] + copy_unlisted=row["Crate Children"], ) return new_dataset diff --git a/src/ingestion_targets/print_lab_genomics/print_crate_builder.py b/src/ingestion_targets/print_lab_genomics/print_crate_builder.py index 4642eca..3ab0142 100644 --- a/src/ingestion_targets/print_lab_genomics/print_crate_builder.py +++ b/src/ingestion_targets/print_lab_genomics/print_crate_builder.py @@ -6,8 +6,8 @@ from mytardis_rocrate_builder.rocrate_builder import ROBuilder from mytardis_rocrate_builder.rocrate_dataclasses.rocrate_dataclasses import ( + Dataset, Experiment, - Dataset ) from rocrate.model.contextentity import ContextEntity from rocrate.model.encryptedcontextentity import ( # pylint: disable=import-error, no-name-in-module @@ -16,10 +16,10 @@ from slugify import slugify from src.ingestion_targets.print_lab_genomics.print_crate_dataclasses import ( + ExtractionDataset, MedicalCondition, Participant, SampleExperiment, - ExtractionDataset ) logger = logging.getLogger(__name__) @@ -143,8 +143,6 @@ def add_experiment(self, experiment: Experiment) -> ContextEntity: Args: experiment (Experiment): The experiment to be added to the crate """ - # Note that this is being created as a data catalog object as there are no better - # fits if not isinstance(experiment, SampleExperiment): return super().add_experiment(experiment) properties: Dict[str, str | list[str] | dict[str, Any]] = { @@ -183,7 +181,6 @@ def add_experiment(self, experiment: Experiment) -> ContextEntity: ) return self._add_identifiers(experiment, experiment_obj) - def add_dataset(self, dataset: Dataset) -> ContextEntity: """Add a dataset to the RO-Crate accounting for if unlisted cildren should be added @@ -193,9 +190,12 @@ def add_dataset(self, dataset: Dataset) -> ContextEntity: # Note that this is being created as a data catalog object as there are no better # fits datset_entity = super().add_dataset(dataset) - if not isinstance(dataset, ExtractionDataset): + if not isinstance(dataset, ExtractionDataset): return datset_entity if dataset.copy_unlisted: - datset_entity.source = self.crate.source / dataset.directory if self.crate.source else dataset.directory + datset_entity.source = ( + self.crate.source / dataset.directory + if self.crate.source + else dataset.directory + ) return datset_entity - diff --git a/src/ingestion_targets/print_lab_genomics/print_crate_dataclasses.py b/src/ingestion_targets/print_lab_genomics/print_crate_dataclasses.py index af1ea71..423f8f4 100644 --- a/src/ingestion_targets/print_lab_genomics/print_crate_dataclasses.py +++ b/src/ingestion_targets/print_lab_genomics/print_crate_dataclasses.py @@ -67,7 +67,7 @@ class SampleExperiment( schema_type = "DataCatalog" @dataclass -class ExtractionDataset(Dataset): # type: ignore +class ExtractionDataset(Dataset): """Dataset information for extraction of a dataset that may need to copy unlisted""" copy_unlisted : bool