Skip to content

DataPackage

Bases: BaseModel

Container for a collection of Technology objects and/or Source objects, with batch operations and loading utilities.

Attributes:

Methods:

  • from_json

    Load a DataPackage from a JSON file.

  • get_source_collection

    Get the SourceCollection associated with this DataPackage from the TechnologyCollection.

  • to_csv

    Export the Datapackage to CSV files.

  • to_json

    Export the Datapackage to JSON files.

sources class-attribute instance-attribute

sources: Annotated[SourceCollection | None, Field(description='List of Source objects.')] = None

technologies class-attribute instance-attribute

technologies: Annotated[TechnologyCollection | None, Field(description='List of Technology objects.')] = None

from_json classmethod

from_json(path_to_folder: Path | str) -> Self

Load a DataPackage from a JSON file.

Parameters:

  • path_to_folder (Path or str) –

    Path to the data package folder.

Returns:

get_source_collection

get_source_collection() -> None

Get the SourceCollection associated with this DataPackage from the TechnologyCollection.

Returns:

to_csv

to_csv(folder_path: Path) -> None

Export the Datapackage to CSV files.

The files are: - the 'technologies' attribute is exported to technologies.csv - the 'sources' attribute is exported to sources.csv

Parameters:

  • folder_path (Path) –

    The path to the folder where the CSV files are created

to_json

to_json(folder_path: Path) -> None

Export the Datapackage to JSON files.

The files are: - the 'technologies' attribute is exported to technologies.json, together with the corresponding data schema - the 'sources' attribute is exported to sources.json, together with the corresponding data schema

Parameters:

  • folder_path (Path) –

    The path to the folder where the JSON files are created