Wikirate platform helps users to find and research answers to specific questions (metrics) about companies.
Each answer is described by a metric, company, value, year, and source.
This example assumes you have configured your Wikirate REST client. Instructions on how to configure a client can be
found in examples/Configuration.md.
The get_answers method supports multiple ways to identify the entity whose answers you want to retrieve:
- by
metric_nameandmetric_designer - by a generic
identifier(numeric ID or card name)
Additional request options are passed via the params hash.
get_answers(
metric_name: nil,
metric_designer: nil,
identifier: nil,
params: {}
)- limit: default value 20, the maximum number of entries to return. If the value exceeds the maximum, then the maximum value will be used.
- offset: default value 0, the (zero-based) offset of the first item in the collection to return
filter params:
-
year: returns all metric answers of the defined year
-
verification: returns all metric answers of the defined verification status. Allowed parameter values:
- 'flagged'
- 'unverified': Unverified - added by community
- 'community_verified': Verified by community
- 'steward_verified': Verified by steward
- 'current_user': Verified by current user
-
value: returns all metric answers with the defined value
-
value_from: returns all metric answers where their value is greater or equal to the defined value
-
value_to: returns all metric answers where their value is less or equal to the defined value
-
status: returns all metric answers of the defined status. Allowed parameter values:
- 'exists': Researched - All
- 'known': Researched with a known value
- 'unknown': Research with an unknown value
- 'none': Not researched
- 'all': Researched and Not researched
-
source: returns all metric answers that cite the defined source
-
updated: returns all metric answers that updated on the defined period. Allowed parameter values:
- 'today'
- 'week': current week
- 'month': current month
-
dataset: returns all metric answers that belong to the define dataset. All available wikirate datasets can be found here.
-
company: returns all metric answers of the defined company given its identifier.
-
company_keyword: returns all metric answers of companies that contain in their name the given string
-
metric: returns all metric answers of the defined metric given its identifier.
-
metric_keyword: returns all metric answers of metrics that contain in their name the given string
-
company_category: returns all metric answers of companies that belong to a given company category. Available company categories. Allowed parameter values:
- 'F': Financial
- 'H': Health And Education
- 'I': Infrastructure
- 'M': Manufacturing
- 'R': Raw Material Producer
- 'S': Science And Technology
- 'W': Wholesale And Retail
- 'O': Other
-
topic_framework: returns all metric answers that have been tagged with the given topic framework. All wikirate topic frameworks can be found here.
-
topic: returns all metric answers that have been tagged with the given topic. All wikirate topic frameworks can be found here.
-
company_group: returns all metric answers of companies that belong to a given company group. All wikirate company groups can be found here.
-
country: returns metric answers of companies with headquarters on the given input country. All available wikirate country options can be found here.
In the example below, we are looking for community verified answers of companies with Direct greenhouse gas (GHG) emissions (Scope 1) greater or equal to 1M CO2 tonnes in 2021.
answers = client.get_answers(
metric_name: 'Direct greenhouse gas (GHG) emissions (Scope 1), GRI 305-1-a (formerly G4-EN15-a)',
metric_designer: 'Global Reporting Initiative',
params: {
'year' => 2021,
'value_from' => 1_000_000,
'verification' => 'community_verified'
}
)
puts answersIn the example below, we are looking for the latest available data on Direct greenhouse gas (GHG) emissions (Scope 1) of companies located in the United Kingdom
answers = client.get_answers(metric_name: 'Direct greenhouse gas (GHG) emissions (Scope 1), GRI 305-1-a (formerly G4-EN15-a)',
metric_designer: 'Global Reporting Initiative',
params: { 'year' => 'latest',
'country' => 'United Kingdom' })
puts answersInstead of specifying metric_name and metric_designer, you can directly pass a
metric identifier (numeric ID or card name).
In the example below, we are looking for community verified answers of companies with Direct greenhouse gas (GHG) emissions (Scope 1) greater or equal to 1M CO2 tonnes in 2021.
answers = client.get_answers(identifier: 826615, params: { 'year' => 2021,
'value_from' => 1000000,
'verification' => 'community_verified' })
puts answersIn the example below, we are looking for the latest available data on Direct greenhouse gas (GHG) emissions (Scope 1) of companies located in the United Kingdom
answers = client.get_answers(identifier:, params: { 'year' => 'latest',
'country' => 'United Kingdom' })
puts answers