/v1/info/variable-group
Get basic information about a variable group.
This API returns basic information of a variable group, given the variable group’s DCID. The information provided includes the display name, a list of child variables with their information, a list of child variable groups with their information and the number of descendent variables.
Variable group is used in the statistical variable hierarchy UI widget as shown in Statistical Variable Explorer.
For querying multiple variables groups, see the bulk version of this endpoint.
Request
GET Request
https://api.datacommons.org/v1/info/variable-group/{VARIABLE_GROUP_DCID}?key={your_api_key}
Path Parameters
Name | Description |
---|---|
VARIABLE_GROUP_DCID |
DCID of the variable group to query information for. |
Query Parameters
Name | Type | Description |
---|---|---|
key |
string | Your API key. See the page on authentication for a demo key, as well as instructions on how to get your own key. |
constrained_entities |
Repeated string | DCIDs of entities to filter by. If provided, the results will be filtered to only include the queried variable group’s descendent variables that have data for the queried entities. |
Response
The response looks like:
{
"node": "dcid",
"info": {
"absoluteName": "variable group name",
"childStatVars": [
{
"id": "variable_id",
"displayName": "variable_name",
"searchNames": [
"search name"
],
"definition": "variable_definition",
"hasData": true
},
...
],
"childStatVarGroups": [
{
"id": "child_variable_group_id",
"specializedEntity": "property name",
"displayName": "variable_name",
"descendentStatVarCount": 20
},
...
],
"descendentStatVarCount": 100,
"parentStatVarGroups": [
"parent_group_id"
]
}
}
Response fields
Name | Type | Description |
---|---|---|
node | string | DCID of the variable group queried. |
info | object | Information about the variable group queried. Includes child variables and variable group information, number of descendent variables and all the parent variable groups. |
Examples
Example 1: Get information on a single variable group
Get basic information about the variable group of female population (DCID:
dc/g/Person_Gender-Female
).
Request:
$ curl --request GET --url \
'https://api.datacommons.org/v1/info/variable-group/dc/g/Person_Gender-Female?key=AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI'
Response:
{
"node": "dc/g/Person_Gender-Female",
"info": {
"absoluteName": "Person With Gender = Female",
"childStatVars": [
{
"id": "LifeExpectancy_Person_Female",
"displayName": "Life expectancy at birth, female (years)",
"searchNames": [
"Life Expectancy of Person With Gender is Female"
],
"definition": "mp=lifeExpectancy,pt=Person,gender=Female",
"hasData": true
},
...
],
"childStatVarGroups": [
{
"id": "dc/g/Person_ActivityDuration_Gender-Female",
"specializedEntity": "Activity Duration",
"displayName": "Person With Activity Duration, Gender = Female",
"descendentStatVarCount": 101
},
...
],
"descendentStatVarCount": 8949,
"parentStatVarGroups": [
"dc/g/Person_Gender"
]
}
}
Page last updated: November 27, 2024 • Send feedback about this page