-
Notifications
You must be signed in to change notification settings - Fork 45
API
The DataViva API is very closely related to the database structure. The URL path strucuture mirrors both the rais YBIO and secex YBPW tables.
The basic structure for making all of the API calls is very similar across the various datasets. The variables are laid as follows:
http://dataviva.info/DATASET/YEAR/LOCATION/FILTER_1/FILTER_2/
Dataset | LOCATION | FILTER 1 | FILTER 2 |
---|---|---|---|
SECEX | bra | hs | wld |
RAIS | bra | cnae | cbo |
HEDU | bra | university | course_hedu |
SC | bra | school (show|all) | course_sc |
SECEX (Exports and Imports)
http://dataviva.info/secex/YEAR/LOCATION/PRODUCT/DESTINATION/
RAIS (Employment and Wages)
http://dataviva.info/rais/YEAR/LOCATION/INDUSTRY/OCCUPATION/
HEDU (Higher Education)
http://dataviva.info/hedu/YEAR/LOCATION/UNIVERSITY/COURSE_HEDU/
SC (School Census)
http://dataviva.info/sc/YEAR/LOCATION/show|all/COURSE_SC/
show, all
Qualifier | Usage | Example | Description |
---|---|---|---|
_ |
Joining multiple attributes. | 4mg_4sp |
Get data values for locations containing either Minas Gerais or Sāo Paulo. |
show.depth |
Limit results to specified attribute depth. | show.5 |
Only return data for attributes whose length is 5 characters. |
attr.show.depth |
Limit results to specified attribute depth within the specified attribute. | 4mg.show.9 |
Only return data for attributes whose length is 9 characters (i.e. municipalities) within the state of Minas Gerais. |
Year | Location | Industry | Occupation |
---|---|---|---|
year | bra_id | show | all |
Example: Industries in Minas Gerais (2012)
Year | Location | Industry | Occupation |
---|---|---|---|
2012 | 4mg | show | all |
http://dataviva.info/rais/2012/4mg/show.6/all/
Year | Location | Industry | Occupation |
---|---|---|---|
year | bra_id | show | cbo_id |
Example: Industries in Minas Gerais that employ Biologists (2012)
Year | Location | Industry | Occupation |
---|---|---|---|
2012 | 4mg | show | 2211 |
http://dataviva.info/rais/2012/4mg/show.6/2211/
Year | Location | Industry | Occupation |
---|---|---|---|
year | bra_id | all | show |
Example: Occupations in Minas Gerais (2012)
Year | Location | Industry | Occupation |
---|---|---|---|
2012 | 4mg | all | show |
http://dataviva.info/rais/2012/4mg/all/show.4/
Year | Location | Industry | Occupation |
---|---|---|---|
year | bra_id | cnae_id | show |
Example: Occupations in Minas Gerais employed in the Arts and Entertainment Industry (2012)
Year | Location | Industry | Occupation |
---|---|---|---|
2012 | 4mg | r90019 | show |
http://dataviva.info/rais/2012/4mg/r90019/show.4/
Year | Location | Industry | Occupation |
---|---|---|---|
year | show | all | all |
Example: Industrial Activity in Minas Gerais by Municipality (2012)
Year | Location | Industry | Occupation |
---|---|---|---|
2012 | 4mg.show.9 | all | all |
http://dataviva.info/rais/2012/4mg.show.9/all/all/
Year | Location | Industry | Occupation |
---|---|---|---|
year | show | all | all |
Example: Industrial Activity in Minas Gerais by Municipality (2012)
Year | Location | Industry | Occupation |
---|---|---|---|
2012 | 4mg.show.9 | all | all |
http://dataviva.info/rais/2012/4mg.show.9/all/all/
Year | Location | Industry | Occupation |
---|---|---|---|
year | show | cnae_id | all |
Example: Municipalities in Minas Gerais that have the Arts and Entertainment Industry (2012)
Year | Location | Industry | Occupation |
---|---|---|---|
2012 | 4mg.show.9 | r90019 | all |
http://dataviva.info/rais/2012/4mg.show.9/r90019/all/
Year | Location | Industry | Occupation |
---|---|---|---|
year | show | all | cbo_id |
Example: Municipalities in Minas Gerais that employ Biologists (2012)
Year | Location | Industry | Occupation |
---|---|---|---|
2012 | 4mg.show.9 | all | 2211 |
http://dataviva.info/rais/2012/4mg.show.9/all/2211/
Year | Location | Industry | Occupation |
---|---|---|---|
year | show | cnae_id | cbo_id |
Example: Municipalities in Minas Gerais that employ Biologists in the Arts and Entertainment Industry (2012)
Year | Location | Industry | Occupation |
---|---|---|---|
2012 | 4mg.show.9 | r90019 | 2211 |
http://dataviva.info/rais/2012/4mg.show.9/r90019/2211/
Year | Location | Product | Trade Partner |
---|---|---|---|
year | bra_id | show | all |
Example: Exports of Minas Gerais (2012)
Year | Location | Product | Trade Partner |
---|---|---|---|
2012 | 4mg | show | all |
http://dataviva.info/rais/2012/4mg/show.6/all/
Year | Location | Product | Trade Partner |
---|---|---|---|
year | bra_id | show | wld_id |
Example: Exports of Minas Gerais to China (2012)
Year | Location | Product | Trade Partner |
---|---|---|---|
2012 | 4mg | show | aschn |
http://dataviva.info/rais/2012/4mg/show.6/aschn/
Year | Location | Product | Trade Partner |
---|---|---|---|
year | bra_id | all | show |
Example: Export Destinations of Minas Gerais (2012)
Year | Location | Product | Trade Partner |
---|---|---|---|
2012 | 4mg | all | show |
http://dataviva.info/rais/2012/4mg/all/show.5/
Year | Location | Product | Trade Partner |
---|---|---|---|
year | bra_id | hs_id | show |
Example: Export Destinations of Cars from Minas Gerais (2012)
Year | Location | Product | Trade Partner |
---|---|---|---|
2012 | 4mg | 178703 | show |
http://dataviva.info/rais/2012/4mg/178703/show.5/
Year | Location | Product | Trade Partner |
---|---|---|---|
year | show | all | all |
Example: Export Destinations of Cars from Minas Gerais (2012)
Year | Location | Product | Trade Partner |
---|---|---|---|
2012 | 4mg.show.9 | all | all |
http://dataviva.info/rais/2012/4mg.show.9/all/all/
Year | Location | Product | Trade Partner |
---|---|---|---|
year | show | hs_id | all |
Example: Municipalities in Minas Gerais that export Cars (2012)
Year | Location | Product | Trade Partner |
---|---|---|---|
2012 | 4mg.show.9 | 178703 | all |
http://dataviva.info/rais/2012/4mg.show.9/178703/all/
Year | Location | Product | Trade Partner |
---|---|---|---|
year | show | all | wld_id |
Example: Municipalities in Minas Gerais that export to China (2012)
Year | Location | Product | Trade Partner |
---|---|---|---|
2012 | 4mg.show.9 | all | aschn |
http://dataviva.info/rais/2012/4mg.show.9/all/aschn/
Year | Location | Product | Trade Partner |
---|---|---|---|
year | show | hs_id | wld_id |
Example: Municipalities in Minas Gerais that export Cars to China (201
Year | Location | Product | Trade Partner |
---|---|---|---|
2012 | 4mg.show.9 | 178703 | aschn |
http://dataviva.info/rais/2012/4mg.show.9/178703/aschn/
Year | Location | University | Course |
---|---|---|---|
year | bra_id | show | all |
Example: Universities in Minas Gerais (2012)
Year | Location | University | Course |
---|---|---|---|
2012 | 4mg | show | all |
http://dataviva.info/hedu/2012/4mg/show/all/
Year | Location | University | Course |
---|---|---|---|
year | bra_id | university_id | show |
Example: Courses (Majors) taught at UFMG (Universidade de Minas Gerais) in 2012
Year | Location | University | Course |
---|---|---|---|
2012 | 4mg | 00575 | show |
http://dataviva.info/hedu/2012/4mg/00575/show/
Year | Location | University | Course |
---|---|---|---|
year | bra_id | show | course_hedu_id |
Example: Universities in Minas Gerais that teach Computer Science (2012)
Year | Location | University | Course |
---|---|---|---|
2012 | 4mg | show | 481C01 |
http://dataviva.info/hedu/2012/4mg/show/481C01/
Year | Location | School | Course |
---|---|---|---|
year | bra_id | show | all |
Example: Courses in Minas Gerais (2012)
Year | Location | School | Course |
---|---|---|---|
2012 | 4mg | all | show |
http://dataviva.info/sc/2012/4mg/all/show/
To reduce redundancy in the data queries (shown above), only the IDs of the entities are returned. Thus, the user may be interested in building a lookup dictionary of meta data for any attributes returned by their data query. The Attr API includes the ability to look up individual records (e.g. What is the name for the HS product with the ID 010101?), a filtered set of records (e.g. what are all of the 2 digit HS products?) or all of them. The sample data call structure is shown below:
http://dataviva.info/attrs/ATTR_TYPE/ID:OPTIONAL/
ATTR_TYPE:
bra
Depths:
1 Digit | 3 Digit | 5 Digit | 7 Digit | 9 Digit |
---|---|---|---|---|
Regions | States | Meso Regions | Micro Regions | Municipalities |
Example: Municipalities in Minas Gerais
Attr Type | ID |
---|---|
bra | 4mg.show.9 |
http://dataviva.info/attrs/bra/4mg.show.9/
Example: All of the States in Brazil
Attr Type | ID |
---|---|
bra | show.2 |
http://dataviva.info/attrs/bra/show.2/
ATTR_TYPE:
cnae
Depths:
1 Digit | 3 Digit | 5 Digit |
---|---|---|
Sector | Division | Class |
Example: Classes in the Wholesale and Retail Sector
Attr Type | ID |
---|---|
cnae | a.show.6 |
http://dataviva.info/attrs/cnae/a.show.6/
Example: All Divisions
Attr Type | ID |
---|---|
cnae | show.3 |
http://dataviva.info/attrs/cnae/show.3/
ATTR_TYPE:
cbo
Depths:
1 Digit | 4 Digit |
---|---|
Main Group | Family |
Example: Families in the Skilled Workers Main Group
Attr Type | ID |
---|---|
cbo | 3.show.4 |
http://dataviva.info/attrs/cbo/3.show.4/
Example: All Occupations at All Levels of Nesting
Attr Type | ID |
---|---|
cbo |
http://dataviva.info/attrs/cbo/
ATTR_TYPE:
hs
Depths:
2 Digit | 6 Digit |
---|---|
Section | Position |
Example: HS Positions in the Mineral Products Section
Attr Type | ID |
---|---|
hs | 05.show.6 |
http://dataviva.info/attrs/hs/05.show.6/
Example: All Sections
Attr Type | ID |
---|---|
hs | show.2 |
http://dataviva.info/attrs/hs/show.2/
ATTR_TYPE:
wld
Depths:
2 Digit | 5 Digit |
---|---|
Continent | Country |
Example: Countries in South America
Attr Type | ID |
---|---|
wld | sa.show.5 |
http://dataviva.info/attrs/wld/sa.show.5/
Example: All Countries
Attr Type | ID |
---|---|
wld | show.5 |
http://dataviva.info/attrs/wld/show.5/
ATTR_TYPE:
university
Depths:
5 Digit |
---|
University |
Example: All Universities
Attr Type |
---|
university |
http://dataviva.info/attrs/university/
ATTR_TYPE:
course_hedu
Depths:
2 Digit | 6 Digit |
---|---|
Field | Major |
Example: Majors in Humanities
Attr Type | ID |
---|---|
course_hedu | 22.show.6 |
http://dataviva.info/attrs/course_hedu/22.show.6/
Example: All Majors
Attr Type | ID |
---|---|
course_hedu | show.6 |
http://dataviva.info/attrs/course_hedu/show.6/
ATTR_TYPE:
course_sc
Depths:
2 Digit | 6 Digit |
---|---|
Field | Course |
Example: Courses in Business and Management
Attr Type | ID |
---|---|
course_sc | 04.show.6 |
http://dataviva.info/attrs/course_sc/04.show.6/
Example: All Courses
Attr Type | ID |
---|---|
course_sc | show.6 |
http://dataviva.info/attrs/course_sc/show.6/