Skip to content

data api client design

emanuel-schmid edited this page Jan 17, 2022 · 20 revisions

Discussion of the data-api client requirements and implementation

Motivation

The data-api client, climada.util.api_client.Client is meant for

  • providing a generic python interface to the public CLIMADA data api
  • creating climada Python objects, such as Exposures, Hazard or ImpactFunc, from dataset files of the CLIMADA data api in a comfortable, easy to use way.

The implemented methods are supposed to be as natural as possible and hiding away boilerplate code that downloads files, reads and converts content into CLIMADA objects. Additionally they should take care of caching files on the local filesystem in order to save resources of the api server.

Classes

DataTypeEssentials

DataType

Methods

list_data_type_infos

returns: a list of DataTypeEssentials objects

arguments:

  • data type group (exposures, hazard, impact_func)

purpose: show what kind of datasets are available from climada.ethz.ch

considerations: used to be get_datatypes

get_data_type_info

returns: a DataTypeInfo object

arguments:

  • data type name

purpose: give additional information about a particular data type, its description and the properties (mandatory and optional) of datasets from this type.

considerations: why another method and not just including the additional information in list_data_type_infos:
(depending on the implementation and the number of datasets) collecting properties can be time consuming and providing unwanted information may be annoying, especially when it takes a long time to get the answer.

list_dataset_infos

returns:

arguments:

purpose:

considerations:

get_dataset_info

returns:

arguments:

purpose:

considerations:

get_hazard

returns:

arguments:

purpose:

considerations:

get_exposures

returns:

arguments:

purpose:

considerations:

Clone this wiki locally