Skip to content
Italo Daldegan de Oliveira edited this page Jul 16, 2018 · 31 revisions

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/

Reserved Words

show, all

Qualifiers

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.

Industries in Location

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/

Industries in Location that Employ Occupation

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/

Occupations in Location

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/

Occupations in Location Employed in an Industry

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/

Industrial Activity in a Location

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/

Industrial Activity in a Location

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/

Locations with a Specified Industrial Activity

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/

Locations that Employ a Specified Occupation

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/

Locations that Employ a Specified Occupation in a Specified Industry

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/

Exports of Location

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/

Exports of Location to Trade Partner

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/

Export Destinations of Location

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/

Export Destinations of Product from a Location

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/

Exports of Location Showing Locations

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/

Exports of Product by Locations

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/

Locations that Export to Destination

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/

Locations that Export Product to Destination

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/

Universities in Location

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/

Courses (majors) Taught at a University

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/

Universities in a Location That Have a Course (Major)

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/

Courses in Location

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/

Brazilian Locations (states, meso regions, planning regions and municipalities)

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/

Industries (CNAE)

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/

Occupations (CBO)

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/

Products (HS)

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/

Countries (WLD)

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/

Universities (UNIVERSITY)

ATTR_TYPE:

university

Depths:

5 Digit
University

Example: All Universities

Attr Type
university
http://dataviva.info/attrs/university/

Majors (COURSE_HEDU)

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/

Basic Courses (COURSE_SC)

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/