def create()

in src/lookoutequipment/dataset.py [0:0]


    def create(self):
        """
        Creates a Lookout for Equipment dataset

        Returns:
            string:
                Response of the create dataset API
        """
        # Checks if the dataset already exists:
        list_datasets_response = self.client.list_datasets(
            DatasetNameBeginsWith=self._dataset_name
        )

        dataset_exists = False
        for dataset_summary in list_datasets_response['DatasetSummaries']:
            if dataset_summary['DatasetName'] == self._dataset_name:
                dataset_exists = True
                break
    
        # If the dataset exists we just returns that message:
        if dataset_exists:
            print((f'Dataset "{self._dataset_name}" already exists and can be '
                    'used to ingest data or train a model.'))
    
        # Otherwise, we create it:
        else:
            print(f'Dataset "{self._dataset_name}" does not exist, creating it...\n')
    
            try:
                create_dataset_response = self.client.create_dataset(
                    DatasetName=self._dataset_name,
                    DatasetSchema={
                        'InlineDataSchema': self._dataset_schema
                    }
                )
                
                return create_dataset_response

            except Exception as e:
                print(e)