Skip to content

Internals: Data utils

SourcePrefix

source

SourcePrefix()

Represents a source using a file-like prefix. WB:// means the id points to a World Bank id, etc.

Args

  • str (type) : Inherits from str, just a glorified prefix string.

Returns

  • SourcePrefix : A prefixed string class

Methods:

.WB

source

.WB(
   cls
)

Adds the World Bank Prefix to the object

Returns

  • Self : A SourcePrefix instance with Prefix set to WB://

.GDIM

source

.GDIM(
   cls
)

Adds the World Bank's GDIM Prefix to the object

Returns

  • Self : A SourcePrefix instance with Prefix set to GDIM://

.matmul

source

.__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

source

.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

source

.eval(
   cls
)

Evaluates the SourcePrefix to yield the entire identifier <prefix><route> or <ID>://<route>

Returns

  • str : the full identifier

.prefix

source

.prefix(
   cls
)

A simple getter to retrieve the underlying prefix.

Returns

  • str : the prefix used by the class

.from_pair

source

.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

source

.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

source

.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

source

.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

source

.route(
   cls
)

Simple getter for the route value

Returns

  • str : The route from prefix

DataSource

source

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

source

.as_gdim(
   cls
)

.as_wb

source

.as_wb(
   cls
)

.is_wb

source

.is_wb(
   cls
)

.is_gdim

source

.is_gdim(
   cls
)

.from_identifier

source

.from_identifier(
   full_name: str
)

.fetch

source

.fetch(
   cls
)

.str

source

.__str__(
   cls
)

Dimensions

source

Dimensions()

A class regrouping all different statistics and dimensions across which a country should be ranked.


Wages

source

Wages()

Statistics pertaining to wages

Args

  • Enum (type) : Types of statistics

Immigration

source

Immigration()

Statistics pertaining to immigration or population

Args

  • Enum (type) : Types of statistics

Business

source

Business()

Statistics pertaining to ease of doing business

Args

  • Enum (type) : Types of statistics

Education

source

Education()

Statistics pertaining to education

Args

  • Enum (type) : Types of statistics

MobilityMetrics

source

MobilityMetrics()

All the social mobility metrics from the World Bank's GDIM database.

Args

  • Enum (type) : Types of metrics (rank / yos / category)

Labor

source

Labor()

Statistics pertaining to labour and labour quality

Args

  • Enum (type) : Types of statistics