Class WorldBankReader
java.lang.Object
org.episteme.core.io.AbstractResourceReader<Country>
org.episteme.social.politics.loaders.WorldBankReader
- All Implemented Interfaces:
ResourceIO<Country>, ResourceReader<Country>
Reader for World Bank Data.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClears the cached regions, forcing a reload on next access.fetchIndicatorData(String countryCode, String indicator) Fetches indicator data for a country from World Bank API.fetchIndicators(List<String> countryCodes, List<String> indicators) Fetches multiple indicators for multiple countries in parallel.Returns the category for grouping.Returns a short description of this resource handler.doublestatic WorldBankReaderReturns a long description of this resource handler.protected MiniCatalog<Country> getName()Returns the display name of this resource handler.Returns the base path where this resource is located.Returns the type of resource.String[]Returns the supported versions of the format this reader/writer handles.protected CountryloadFromSource(String id) Methods inherited from class AbstractResourceReader
getSampleDataPath, isUsingFallback, load, loadAll, loadFromFallback, loadFromInputStream, setCacheEnabledMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ResourceIO
getExpectedResourceFiles, getSupportedExtensions, isFileBased, isOutputMethods inherited from interface ResourceReader
isInput
-
Constructor Details
-
WorldBankReader
public WorldBankReader() -
WorldBankReader
-
-
Method Details
-
getInstance
-
getGlobalGDP
public double getGlobalGDP() -
getCategory
Description copied from interface:ResourceIOReturns the category for grouping. MUST be implemented with I18N support.- Returns:
- the category name
-
getDescription
Description copied from interface:ResourceIOReturns a short description of this resource handler. MUST be implemented with I18N support.- Returns:
- the description
-
getLongDescription
Description copied from interface:ResourceIOReturns a long description of this resource handler. MUST be implemented with I18N support.- Returns:
- the long description
-
getResourcePath
Description copied from interface:ResourceIOReturns the base path where this resource is located. -
getResourceType
Description copied from interface:ResourceIOReturns the type of resource. -
getSupportedVersions
Description copied from interface:ResourceIOReturns the supported versions of the format this reader/writer handles.Each implementation MUST override this method to declare which versions of the underlying format are supported. The returned array should contain version strings in the format's standard notation (e.g., "3.0", "2.1", "Level 3 Version 2").
Examples:
- MathML: {"3.0", "2.0"}
- SBML: {"Level 3 Version 2", "Level 3 Version 1", "Level 2 Version 5"}
- PhyloXML: {"1.10", "1.00"}
- Returns:
- array of supported version strings, never null (empty array if version-agnostic)
-
loadFromSource
- Specified by:
loadFromSourcein classAbstractResourceReader<Country>- Throws:
Exception
-
loadAllFromSource
- Overrides:
loadAllFromSourcein classAbstractResourceReader<Country>- Throws:
Exception
-
getMiniCatalog
- Overrides:
getMiniCatalogin classAbstractResourceReader<Country>
-
fetchIndicatorData
public CompletableFuture<Map<String,Double>> fetchIndicatorData(String countryCode, String indicator) Fetches indicator data for a country from World Bank API. Common indicators: - NY.GDP.MKTP.CD: GDP (current US$) - SP.POP.TOTL: Population, total - SP.DYN.LE00.IN: Life expectancy at birth - EN.ATM.CO2E.PC: CO2 emissions (metric tons per capita)- Parameters:
countryCode- ISO 3-letter country code (e.g., "USA", "FRA")indicator- World Bank indicator code- Returns:
- Map of year -> value
-
fetchIndicators
public Map<String, Map<String,Double>> fetchIndicators(List<String> countryCodes, List<String> indicators) Fetches multiple indicators for multiple countries in parallel.- Parameters:
countryCodes- List of ISO3 country codesindicators- List of World Bank indicator codes (e.g., SP.POP.TOTL)- Returns:
- Map of Country Code -> (Indicator Code -> Value)
-
clearCache
public void clearCache()Clears the cached regions, forcing a reload on next access.- Overrides:
clearCachein classAbstractResourceReader<Country>
-
getName
Description copied from interface:ResourceIOReturns the display name of this resource handler. MUST be implemented with I18N support.- Returns:
- the display name
-