hdx.data.resource_view
Resource view class containing all logic for creating, checking, and updating resource views.
ResourceView Objects
class ResourceView(HDXObject)
ResourceView class containing all logic for creating, checking, and updating resource views.
Arguments:
initial_data
Optional[Dict] - Initial resource view metadata dictionary. Defaults to None.configuration
Optional[Configuration] - HDX configuration. Defaults to global configuration.
actions
@staticmethod
def actions() -> Dict[str, str]
Dictionary of actions that can be performed on object
Returns:
Dict[str, str]: Dictionary of actions that can be performed on object
update_from_yaml
def update_from_yaml(path: str = join(
"config", "hdx_resource_view_static.yaml")) -> None
Update resource view metadata with static metadata from YAML file
Arguments:
path
Optional[str] - Path to YAML resource view metadata. Defaults to config/hdx_resource_view_static.yaml.
Returns:
None
update_from_json
def update_from_json(path: str = join(
"config", "hdx_resource_view_static.json")) -> None
Update resource view metadata with static metadata from JSON file
Arguments:
path
Optional[str] - Path to JSON dataset metadata. Defaults to config/hdx_resource_view_static.json.
Returns:
None
read_from_hdx
@classmethod
def read_from_hdx(cls,
identifier: str,
configuration: Optional[Configuration] = None
) -> Optional["ResourceView"]
Reads the resource view given by identifier from HDX and returns ResourceView object
Arguments:
identifier
str - Identifier of resource viewconfiguration
Optional[Configuration] - HDX configuration. Defaults to global configuration.
Returns:
Optional[ResourceView]
- ResourceView object if successful read, None if not
get_all_for_resource
@staticmethod
def get_all_for_resource(
identifier: str,
configuration: Optional[Configuration] = None) -> List["ResourceView"]
Read all resource views for a resource given by identifier from HDX and returns list of ResourceView objects
Arguments:
identifier
str - Identifier of resourceconfiguration
Optional[Configuration] - HDX configuration. Defaults to global configuration.
Returns:
List[ResourceView]
- List of ResourceView objects
check_required_fields
def check_required_fields(ignore_fields: ListTuple[str] = tuple()) -> None
Check that metadata for resource view is complete. The parameter ignore_fields should be set if required to any fields that should be ignored for the particular operation.
Arguments:
ignore_fields
ListTuple[str] - Fields to ignore. Default is tuple().
Returns:
None
update_in_hdx
def update_in_hdx(**kwargs: Any) -> None
Check if resource view exists in HDX and if so, update resource view
Returns:
None
create_in_hdx
def create_in_hdx(**kwargs: Any) -> None
Check if resource view exists in HDX and if so, update it, otherwise create resource view
Returns:
None
delete_from_hdx
def delete_from_hdx() -> None
Deletes a resource view from HDX.
Returns:
None
copy
def copy(resource_view: Union["ResourceView", Dict, str]) -> None
Copies all fields except id, resource_id and package_id from another resource view.
Arguments:
resource_view
Union[ResourceView,Dict,str] - Either a resource view id or resource view metadata either from a ResourceView object or a dictionary
Returns:
None