pub struct WorldBankClient { /* private fields */ }Expand description
Client for World Bank Open Data API
Provides access to:
- Global development indicators
- Country statistics
- Economic and social data
- Climate and environment metrics
§Example
ⓘ
use ruvector_data_framework::WorldBankClient;
let client = WorldBankClient::new();
let countries = client.get_countries().await?;
let indicators = client.get_indicators("economy").await?;
let data = client.get_indicator_data("NY.GDP.MKTP.CD", "USA", "2015:2020").await?;Implementations§
Source§impl WorldBankClient
impl WorldBankClient
Sourcepub fn with_config(embedding_dim: usize, use_mock: bool) -> Result<Self>
pub fn with_config(embedding_dim: usize, use_mock: bool) -> Result<Self>
Create a new World Bank client with custom configuration
Sourcepub async fn get_countries(&self) -> Result<Vec<SemanticVector>>
pub async fn get_countries(&self) -> Result<Vec<SemanticVector>>
Get list of countries
Sourcepub async fn get_indicators(&self, topic: &str) -> Result<Vec<SemanticVector>>
pub async fn get_indicators(&self, topic: &str) -> Result<Vec<SemanticVector>>
Get indicators by topic
Sourcepub async fn get_indicator(
&self,
country: &str,
indicator: &str,
) -> Result<Vec<SemanticVector>>
pub async fn get_indicator( &self, country: &str, indicator: &str, ) -> Result<Vec<SemanticVector>>
Get indicator data for a country (compatibility method)
§Arguments
country- Country code (e.g., “USA”, “CHN”) or “all”indicator- Indicator code (e.g., “NY.GDP.MKTP.CD”)
This method fetches the last 10 years of data by default
Sourcepub async fn get_indicator_data(
&self,
indicator: &str,
country: &str,
date_range: &str,
) -> Result<Vec<SemanticVector>>
pub async fn get_indicator_data( &self, indicator: &str, country: &str, date_range: &str, ) -> Result<Vec<SemanticVector>>
Get indicator data for a country with custom date range
§Arguments
indicator- Indicator code (e.g., “NY.GDP.MKTP.CD”)country- Country code (e.g., “USA”, “CHN”) or “all”date_range- Date range (e.g., “2015:2020”, “2020”)
Sourcepub async fn search_indicators(
&self,
query: &str,
) -> Result<Vec<SemanticVector>>
pub async fn search_indicators( &self, query: &str, ) -> Result<Vec<SemanticVector>>
Search for indicators
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WorldBankClient
impl !RefUnwindSafe for WorldBankClient
impl Send for WorldBankClient
impl Sync for WorldBankClient
impl Unpin for WorldBankClient
impl !UnwindSafe for WorldBankClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more