Internals: Data utils
SourcePrefix
SourcePrefix()
Represents a source using a file-like prefix. WB://
Args
- str (type) : Inherits from
str
, just a glorified prefix string.
Returns
- SourcePrefix : A prefixed string class
Methods:
.WB
.WB(
cls
)
Adds the World Bank Prefix to the object
Returns
- Self : A
SourcePrefix
instance with Prefix set toWB://
.GDIM
.GDIM(
cls
)
Adds the World Bank's GDIM Prefix to the object
Returns
- Self : A
SourcePrefix
instance with Prefix set toGDIM://
.matmul
.__matmul__(
cls, route: str
)
Equivalent of at
, bases the route at the previously set prefix value.
Args
- route (str) : A route / id that points to a subset within the prefix
Returns
- Self : A
SourcePrefix
instance with Prefix & route set.
.at
.at(
cls, route: str
)
Equivalent of Self @ route
, bases the route at the previously set prefix value.
Args
- route (str) : A route / id that points to a subset within the prefix
Returns
- Self : A
SourcePrefix
instance with Prefix & route set.
.eval
.eval(
cls
)
Evaluates the SourcePrefix to yield the entire identifier <prefix><route>
or <ID>://<route>
Returns
- str : the full identifier
.prefix
.prefix(
cls
)
A simple getter to retrieve the underlying prefix.
Returns
- str : the prefix used by the class
.from_pair
.from_pair(
prefix: str, route: str
)
Creates immediately the built object from the prefix
& source
pair
Args
- prefix (str) : prefix as string, case insensitive.
- route (str) : route to be used from the prefix.
Returns
- Self : A
SourcePrefix
instance with Prefix & route set.
.eval_pair
.eval_pair(
prefix: str, route: str
)
Creates and immediately evaluates the built object from the prefix
& source
pair
Args
- prefix (str) : prefix as string, case insensitive.
- route (str) : route to be used from the prefix.
Returns
- str : A full identifier in string form
<ID>://<route>
.normalize
.normalize(
cls, full_name: str
)
Sets the route from a full identifier
Args
- full_name (str) : A full identifier in string form
<ID>://<route>
Returns
- Self : A
SourcePrefix
instance with Prefix & route set.
.from_identifier
.from_identifier(
cls, full_name: str
)
End to end setter from full identifier.
Args
- full_name (str) : A full identifier in string form
<ID>://<route>
Returns
- Self : A
SourcePrefix
instance with Prefix & route set.
.route
.route(
cls
)
Simple getter for the route
value
Returns
- str : The route from prefix
DataSource
DataSource()
Represents a data source, as identified by a SourcePrefix
.
The DataSource
is able to check and fetch remote data based on the prefixes.
Methods:
.as_gdim
.as_gdim(
cls
)
.as_wb
.as_wb(
cls
)
.is_wb
.is_wb(
cls
)
.is_gdim
.is_gdim(
cls
)
.from_identifier
.from_identifier(
full_name: str
)
.fetch
.fetch(
cls
)
.str
.__str__(
cls
)
Dimensions
Dimensions()
A class regrouping all different statistics and dimensions across which a country should be ranked.
Wages
Wages()
Statistics pertaining to wages
Args
- Enum (type) : Types of statistics
Immigration
Immigration()
Statistics pertaining to immigration or population
Args
- Enum (type) : Types of statistics
Business
Business()
Statistics pertaining to ease of doing business
Args
- Enum (type) : Types of statistics
Education
Education()
Statistics pertaining to education
Args
- Enum (type) : Types of statistics
MobilityMetrics
MobilityMetrics()
All the social mobility metrics from the World Bank's GDIM database.
Args
- Enum (type) : Types of metrics (rank / yos / category)
Labor
Labor()
Statistics pertaining to labour and labour quality
Args
- Enum (type) : Types of statistics