References
summary | ||
private |
F ensureDataIds(param: *) Ensure dataId prop is present on the object, otherwise load dataId from store The dataId prop is added permanently to the object, so that we don't have to reload it again and again. |
|
public |
F findAssessmentById(id: String): Object Find an assessment by its ID. |
|
public |
F findAssessmentBySlug(slug: String): Object Find an assessment by its slug. |
|
public |
F findAssessmentForRegionById(region: Object, assessmentId: string): Object Find a specific assessment by ID and include the observation for the given region. |
|
public |
F findGoalForRegionById(region: Object, goalId: string): Object Find a specific goal by assessment ID and include the observation for the given region. |
|
public |
F findIndicatorById(id: String): Object Find an indicator by its ID. |
|
public |
F findIndicatorBySlug(slug: String): Object Find an indicator by its slug. |
|
public |
F findIndicatorForRegionById(region: Object, indicatorId: string): Object Find a specific indicator by ID and include the observation for the given region. |
|
public |
F findIndicatorForRegionBySlug(region: Object, indicatorSlug: string): Object Find a specific indicator by slug and include the observation for the given region. |
|
public |
F findLnobAssessment(): Object Get the leave-no-one-behind assessment. |
|
public |
F findLnobAssessmentForRegion(region: Object): Object Get the leave-no-one-behind assessment, including the observation for the given region. |
|
public |
F findObservationByRegionAndAssessment(region: Object, assessment: Object): Object Find the observation for the given region and assessment. |
|
public |
Get the overall SDG Index assessment. |
|
public |
F findOverallAssessmentForRegion(region: Object): Object Get the overall SDG Index assessment, including the observation for the given region. |
|
public |
F findRegionById(id: String): Object Find a region by its ID. |
|
public |
F findRegionBySlug(slug: String): Object Find a region by its slug. |
|
public |
F findRegionWithAssessmentById(assessment: Object, regionId: string): Object Find a specific region by ID and include the observation for the given assessment. |
|
public |
Get the spillover index assessment. |
|
public |
F findSpilloverAssessmentForRegion(region: Object): Object Get the spillover index assessment, including the observation for the given region. |
|
public |
F findTimeseriesByRegionAndAssessment(region: Object, assessment: Object): Array Find the timeseries for a specific region and assessment. |
|
public |
F findTimeseriesByRegionAndIndicator(region: Object, indicator: Object): Array Find the timeseries for a specific region and indicator. |
|
public |
F getAssessments(): Array Get all assessments from the store. |
|
public |
Get all goal assessments from the store. |
|
public |
F getGoalsForRegion(region: Object): Array Get all goal assessments from the store, each including the respective observation for the given region. |
|
public |
F getIndicators(): Array Get all indicators from the store. |
|
public |
F getIndicatorsByGoal(goal: Object): Array Get all indicators for the given goal from the store. |
|
public |
F getIndicatorsByLnobDimension(dimension: Object): Array Get all indicators for the given lnob dimension from the store. |
|
public |
F getIndicatorsForRegion(region: Object): Array Get all indicators from the store, each including the respective observation for the given region. |
|
public |
F getIndicatorsForRegionByGoal(region: Object, goal: Object): Array Get all indicators for the given goal from the store, each including the respective observation for the given region. |
|
public |
F getIndicatorsForRegionByLnobDimension(region: Object, dimension: Object): Array Get all indicators for the given lnob dimension from the store, each including the respective observation for the given region. |
|
public |
F getLnobDimensions(): Array Get all LNOB assessments from the store. |
|
public |
F getLnobDimensionsForRegion(region: Object): Array Get all lnob assessments from the store, each including the respective observation for the given region. |
|
public |
F getRegions(): Array Get all regions from the store. |
|
public |
F getRegionsByType(type: String): Array Get all regions from the store of a given type. |
|
public |
F getRegionsWithAssessment(assessment: Object): Array Get all regions from the store, each including the respective observation for the given assessment. |
|
public |
F getRegionsWithTimeseries(assessment: Object): Array Get all regions from the store, each including the respective timeseries values for the given assessment. |
|
public |
F getTrendIndicators(): Array Get all trend indicators from the store. |
|
public |
F isDataLoaded(options: Object): boolean Check if all datasets have already been loaded into the store. |
|
public |
Loads data (assessments, regions, observations, ...) into store. |
|
private |
F loadDataset(dataset: Object): Promise Load a single dataset into the store. |
|
public |
F useDataStore(options: Object): DataStoreStatus Use any @sdgindex/data functions in a React component. |
|
public |
V store: {} |
|
public |
The status of the store. |
assessments
summary | ||
public |
F isGlobalOnly(assessment: Object): bool Check whether the given assessment is a global-only indicator (used only to assess non-OECD countries). |
|
public |
Check if the given assessment is a goal. |
|
public |
F isIndicator(assessment: Object): bool Check if the given assessment is an indicator. |
|
public |
F isLnobAssessment(assessment: Object): bool Check if the given assessment is the leave-no-one-behind performance. |
|
public |
F isLnobDimension(assessment: Object): bool Check if the given assessment is a LNOB dimension. |
|
public |
F isOecdOnly(assessment: Object): bool Check whether the given assessment is an OECD-only indicator (used only to assess OECD countries). |
|
public |
F isOverallAssessment(assessment: Object): bool Check if the given assessment is the overall SDG Index performance. |
|
public |
F isRelevantIndicatorForRegion(assessment: Object, region: Object): bool Check whether the given assessment is a relevant indicator for the region. |
|
public |
F isSpilloverAssessment(assessment: Object): bool Check if the given assessment is the overall spillover index performance. |
|
public |
F isTrendIndicator(assessment: Object): bool Check if the given assessment is a trend indicator. |
observations
summary | ||
public |
Get the numeric rank for the given observation. |
|
public |
F getRankAsText(observation: Object, fallback: string): String Get the text rank for a given observation. |
|
public |
Get the rating for a given observation (green, yellow, orange, etc...). |
|
public |
Get the numeric score for the given observation. |
|
public |
F getScoreAsText(observation: Object, precision: number, fallback: string): String Get the text score for a given observation, with the given level of decimal precision. |
|
public |
Get the trend (e.g., "↑", "➚", etc...) for the given observation. |
|
public |
Get the numeric, raw value for the given observation. |
|
public |
F getValueAsText(observation: Object, precision: number, fallback: string): String Get the text raw value for a given observation, with the given level of decimal precision. |
|
public |
Get the numeric year for the given observation. |
|
public |
F getYearAsText(observation: Object, fallback: string): String Get the text year for a given observation. |
|
public |
Check if the given observation is imputed. |
parse
summary | ||
private |
F addAssessment(assessment: Object): Object Add an assessment to the store. |
|
public |
Add a goal to the store. |
|
public |
Add all goals to the store. |
|
public |
F addIndicator(indicator: Object): Object Add an indicator to the store |
|
public |
F addLnobAssessment(params: Object): Object Add the spillover assessment to the store |
|
public |
F addLnobDimension(params: Object): Object Add a LNOB to the store. |
|
public |
F addLnobDimensions(options: Object): Object[] Add all lnobs to the store. |
|
public |
F addObservation(observation: Object): Object Add an observation to the store |
|
public |
F addOverallAssessment(params: Object): Object Add the overall assessment to the store |
|
public |
Add a region to the store |
|
public |
F addSpilloverAssessment(params: Object): Object Add the spillover assessment to the store |
|
public |
F addTimeseries(timeseries: Object): Object Add timeseries to the store. |
|
public |
F convertScoreToColor(colorScore: number): string Convert score to rating color. |
|
public |
F excelToJson(param: Object): Array Convert a sheet in an Excel file into JSON format. |
|
public |
F getIndicatorUnit(label: string): string | null Extract the unit from an indicator label. |
|
public |
F getLabelWithoutUnit(label: string): string Remove the unit from the indicator label. |
|
public |
F roundNumber(number: string | number, precision: number): number Round a number to a given level of precision. |
|
public |
F writeStoreToJson() Write the store to a series of human-readable and minified JSON files. |
regions
sdgs
summary | ||
public |
Get the color for an SDG with the given number. |
|
public |
Get the label/title for an SDG with the given number. |
|
public |
F getLnobDimension(dimNumber: number): Object Get the label & description for a LNOB dimension with the given number. |
|
public |
Get the label and the color for an SDG with the given number. |
timeseries
summary | ||
public |
F getFirstYear(timeseries: Object): number Get the first year where the timeseries has a non-null value. |
|
public |
F getLastYear(timeseries: Object): number Get the last year where the timeseries has a non-null value. |
|
public |
F getTimeseriesValue(timeseries: Object, year: Number): number Get timeseries value for the given year. |
|
public |
F hasTimeseries(timeseries: Object): bool Check if the given object has timeseries values. |
utilities
summary | ||
private |
F decodeObject(array: Array, encoding: Array): Object Decode the given array back into an object structure, based on the provided encoding. |
|
private |
F determineObjectEncoding(objects: Array): Array Determine object encoding by counting the number of times each property/key appears in the objects. |
|
private |
F encodeObject(object: Object, encoding: Array): Array Convert the given object into array, which requires less space and is faster to load. |