allensdk.api.cloud_cache.manifest module¶
- class allensdk.api.cloud_cache.manifest.Manifest(cache_dir: str | Path, json_input, use_static_project_dir: bool = False)[source]¶
Bases:
object
A class for loading and manipulating the online manifest.json associated with a dataset release
Each Manifest instance should represent the data for 1 and only 1 manifest.json file.
- Parameters:
- cache_dir: str or pathlib.Path
The path to the directory where local copies of files will be stored
- json_input:
A ‘’.read()’’-supporting file-like object containing a JSON document to be deserialized (i.e. same as the first argument to json.load)
- use_static_project_dir: bool
When determining what the local path of a remote resource (data or metadata file) should be, the Manifest class will typically create a versioned project subdirectory under the user provided cache_dir (e.g. f”{cache_dir}/{project_name}-{manifest_version}”) to allow the possibility of multiple manifest (and data) versions to be used. In certain cases, like when using a project’s s3 bucket directly as the cache_dir, the project directory name needs to be static (e.g. f”{cache_dir}/{project_name}”). When set to True, the Manifest class will use a static project directory to determine local paths for remote resources. Defaults to False.
- data_file_attributes(file_id) CacheFileAttributes [source]¶
Return the CacheFileAttributes associated with a data file
- Parameters:
- file_id:
The identifier of the data file whose attributes are to be returned. Must be a key in self._data[‘data_files’]
- Raises:
- RuntimeError
If you try to run this method when self._data is None (meaning you haven’t yet loaded a manifest.json file)
- ValueError
If the file_id is not a valid option
- property file_id_column¶
The column in the metadata files used to uniquely identify data files
- property file_id_values¶
List of valid file_id values
- metadata_file_attributes(metadata_file_name: str) CacheFileAttributes [source]¶
Return the CacheFileAttributes associated with a metadata file
- Parameters:
- metadata_file_name: str
Name of the metadata file. Must be in self.metadata_file_names
- Raises:
- RuntimeError
If you try to run this method when self._data is None (meaning you haven’t yet loaded a manifest.json)
- ValueError
If the metadata_file_name is not a valid option
- property metadata_file_names¶
List of metadata file names associated with this dataset
- property project_name¶
The name of the project whose data and metadata files this manifest tracks.
- property version¶
The version of the dataset currently loaded