diff --git a/ SMPPIR-API Specification.yaml b/ SMPPIR-API Specification.yaml deleted file mode 100644 index a79e649100bfa66cc0c7613a45bed5f1430818d8..0000000000000000000000000000000000000000 --- a/ SMPPIR-API Specification.yaml +++ /dev/null @@ -1,2973 +0,0 @@ -# Specification of SMPPIR API using OpenAPI 3.0 -# For the specification of OpenAPI 3.0, please refer to: https://swagger.io/docs/specification/about/ -openapi: "3.0.0" -info: - version: 1.0.0 - title: SMPPIR - API - description: 'This API provides access to quotas data based in [INEP - Census of higher education](http://portal.inep.gov.br/web/guest/microdados), [PNAD - People information](http://www.ibge.gov.br/home/estatistica/pesquisas/pesquisa_resultados.php?id_pesquisa=40), [FIES](http://www.fnde.gov.br/dadosabertos/dataset/fundo-de-financiamento-estudantil-fies), [PROUNI](http://dadosabertos.mec.gov.br/prouni)' - -servers: - - url: http://seppirdev.c3sl.ufpr.br:4000/api/v1 - -tags: - - name: INEP - description: "Contains queries made with data from the INEP database listed above. This section's concern is the undergraduation students" - externalDocs: - url: http://portal.inep.gov.br/web/guest/microdados - - name: FIES - description: "Contains queries made with data from the FIES database listed above. This section's concern is the loan for undergraduation students" - externalDocs: - url: http://www.fnde.gov.br/dadosabertos/dataset/fundo-de-financiamento-estudantil-fies - - name: PNAD - description: "Contains queries made with data from the PNAD database listed above. This section's concern is the educational level of the population between 18 and 24 years old" - externalDocs: - url: http://www.ibge.gov.br/home/estatistica/pesquisas/pesquisa_resultados.php?id_pesquisa=40 - - name: PROUNI - description: "Contains queries made with data from the PROUNI database listed above. This section's concern is the federal scholarship" - externalDocs: - url: http://www.ibge.gov.br/home/estatistica/pesquisas/pesquisa_resultados.php?id_pesquisa=40 -# - name: IBGE - Census -# description: "Contains queries made with data from IBGE Census" -# externalDocs: -#url: https://ww2.ibge.gov.br/home/estatistica/populacao/censo2010/resultados_gerais_amostra/resultados_gerais_amostra_tab_uf_microdados.shtm - - name: CadÚnico - description: "Contains queries made with data from CadÚnico" - externalDocs: - url: https://aplicacoes.mds.gov.br/sagi/portal/index.php?grupo=212 - - name: EXTRA - description: "Contains data from auxiliary extra routes" - externalDocs: - url: https://ww2.ibge.gov.br/home/estatistica/populacao/censo2010/resultados_gerais_amostra/resultados_gerais_amostra_tab_uf_microdados.shtm - -paths: - /admission: - get: - summary: Return the number of quotasholder that entered in a federal institution. This route uses the INEP database listed above - tags: - - INEP - parameters: - - name: dims - in: query - description: Group data using a metric parameter - allowReserved: true - required: false - explode: false - style: form - example: shift,gender,ethnic - schema: - type: array - items: - type: string - enum: - - shift - - gender - - ethnic - - course - - institution - - institution_cod - - year - - min_year - - max_year - - cod_offer_location - - name_offer_location - - name: filter - in: query - description: Filter data - allowReserved: true - required: false - explode: false - style: form - example: shift:["Integral","Noturno"],gender:"Feminino" - schema: - type: array - items: - type: object - properties: - shift: - type: array - items: - type: string - gender: - type: array - items: - type: string - ethnic: - type: array - items: - type: string - course: - type: array - items: - type: string - institution: - type: array - items: - type: string - institution_code: - type: array - items: - type: integer - year: - type: array - items: - type: integer - min_year: - type: integer - max_year: - type: integer - cod_offer_location: - type: array - items: - type: integer - name_offer_location: - type: array - items: - type: string - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/BasicInepReturn' - '404': - description: no data found - /evader: - get: - summary: Return the number of quotasholder that had been studying in a federal institution and drop out. This route uses the INEP database listed above - tags: - - INEP - parameters: - - name: dims - in: query - description: Group data using a metric parameter - allowReserved: true - required: false - explode: false - style: form - example: shift,gender,ethnic - schema: - type: array - items: - type: string - enum: - - shift - - gender - - ethnic - - course - - institution - - institution_cod - - year - - min_year - - max_year - - cod_offer_location - - name_offer_location - - region - - uf - - name: filter - in: query - description: Filter data - allowReserved: true - required: false - explode: false - style: form - example: shift:["Integral","Noturno"],gender:"Feminino" - schema: - type: array - items: - type: object - properties: - shift: - type: array - items: - type: string - gender: - type: array - items: - type: string - ethnic: - type: array - items: - type: string - course: - type: array - items: - type: string - institution: - type: array - items: - type: string - institution_code: - type: array - items: - type: integer - year: - type: array - items: - type: integer - min_year: - type: integer - max_year: - type: integer - cod_offer_location: - type: array - items: - type: integer - name_offer_location: - type: array - items: - type: string - region: - type: array - items: - type: string - uf: - type: array - items: - type: string - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/BasicInepReturnWithLocationInfo' - '404': - description: no data found - /extracurricular_activities: - get: - summary: Return the number of quotasholder that studie in a federal institution and do any type of extracurricular activity (Intership, Teacher's Assistant, etc.). This route uses the INEP database listed above - tags: - - INEP - parameters: - - name: dims - in: query - description: Group data using a metric parameter - allowReserved: true - required: false - explode: false - style: form - example: shift,gender,ethnic - schema: - type: array - items: - type: string - enum: - - shift - - gender - - ethnic - - course - - institution - - institution_cod - - year - - min_year - - max_year - - cod_offer_location - - name_offer_location - - name: filter - in: query - description: Filter data - allowReserved: true - required: false - explode: false - style: form - example: shift:["Integral","Noturno"],gender:"Feminino" - schema: - type: array - items: - type: object - properties: - shift: - type: array - items: - type: string - gender: - type: array - items: - type: string - ethnic: - type: array - items: - type: string - course: - type: array - items: - type: string - institution: - type: array - items: - type: string - institution_code: - type: array - items: - type: integer - year: - type: array - items: - type: integer - min_year: - type: integer - max_year: - type: integer - cod_offer_location: - type: array - items: - type: integer - name_offer_location: - type: array - items: - type: string - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/BasicInepReturn' - '404': - description: no data found - /fies: - get: - summary: Return the number of students that got a loan from FIES. This route uses the FIES database listed above - tags: - - FIES - parameters: - - name: dims - in: query - description: Group data using a metric parameter - allowReserved: true - required: false - explode: false - style: form - example: gender,ethnic - schema: - type: array - items: - type: string - enum: - - gender - - ethnic - - course - - institution - - institution_cod - - offer_location - - loan - - loan_type - - uf - - region - - year - - min_year - - max_year - - name: filter - in: query - description: Filter data - allowReserved: true - required: false - explode: false - style: form - example: gender:"Feminino",ethnic:["Branco","Pardo"] - schema: - type: array - items: - type: object - properties: - gender: - type: array - items: - type: string - enum: ['Masculino', 'Feminino'] - ethnic: - type: array - items: - type: string - enum: ['Amarelo', 'Branco', 'Negro', 'Pardo', 'Índio'] - course: - type: array - items: - type: string - institution: - type: array - items: - type: string - institution_cod: - type: array - items: - type: integer - offer_location: - type: array - items: - type: string - loan: - type: array - items: - type: integer - enum: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100 ] - loan_type: - type: array - items: - type: string - enum: ["F", "N", "S"] - year: - type: array - items: - type: integer - min_year: - type: integer - max_year: - type: integer - region: - type: array - items: - type: string - enum: [ 'Norte', 'Nordeste', 'Centro-Oeste', 'Sul', 'Sudeste' ] - uf: - type: array - items: - type: string - enum: [ 'AC', 'AL', 'AP', 'AM', 'BA', 'CE', 'DF', 'ES', 'GO', 'MA', 'MT', 'MS', 'MG', 'PA', 'PB', 'PR', 'PE', 'PI', 'RJ', 'RN', 'RS', 'RO', 'RR', 'SC', 'SP', 'SE', 'TO' ] - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/FiesReturn' - '404': - description: no data found - /graduate: - get: - summary: Return the number of quotasholder that had been studying in a federal institution and finished their studies - tags: - - INEP - parameters: - - name: dims - in: query - description: Group data using a metric parameter - allowReserved: true - required: false - explode: false - style: form - example: shift,gender,ethnic - schema: - type: array - items: - type: string - enum: - - shift - - gender - - ethnic - - course - - institution - - institution_cod - - year - - min_year - - max_year - - cod_offer_location - - name_offer_location - - region - - uf - - name: filter - in: query - description: Filter data - allowReserved: true - required: false - explode: false - style: form - example: shift:["Integral","Noturno"],gender:"Feminino" - schema: - type: array - items: - type: object - properties: - shift: - type: array - items: - type: string - gender: - type: array - items: - type: string - ethnic: - type: array - items: - type: string - course: - type: array - items: - type: string - institution: - type: array - items: - type: string - institution_code: - type: array - items: - type: integer - year: - type: array - items: - type: integer - min_year: - type: integer - max_year: - type: integer - cod_offer_location: - type: array - items: - type: integer - name_offer_location: - type: array - items: - type: string - region: - type: array - items: - type: string - uf: - type: array - items: - type: string - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/BasicInepReturnWithLocationInfo' - '404': - description: no data found - - /course: - get: - summary: Return the available courses made available by the IFES(Instituto Federal de Educação Superior). This route uses the INEP database listed above - tags: - - INEP - parameters: - - name: dims - in: query - description: Group data using a metric parameter - allowReserved: true - required: false - explode: false - style: form - example: year,uf - schema: - type: array - items: - type: string - enum: - - year - - min_year - - max_year - - uf - - name: filter - in: query - description: Filter data - allowReserved: true - required: false - explode: false - style: form - example: year:"2015", uf:"PR" - schema: - type: array - items: - type: object - properties: - year: - type: number - min_year: - type: number - max_year: - type: number - uf: - type: string - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/course' - '404': - description: no data found - - /courseFIES: - get: - summary: Return the available courses made available by the IFES(Instituto Federal de Educação Superior). This route uses the FIES database listed above - tags: - - FIES - parameters: - - name: dims - in: query - description: Group data using a metric parameter - allowReserved: true - required: false - explode: false - style: form - example: year,uf - schema: - type: array - items: - type: string - enum: - - year - - min_year - - max_year - - name: filter - in: query - description: Filter data - allowReserved: true - required: false - explode: false - style: form - example: year:"2015" - schema: - type: array - items: - type: object - properties: - year: - type: number - min_year: - type: number - max_year: - type: number - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/coursePROUNI' - '404': - description: no data found - - /coursePROUNI: - get: - summary: Return the available courses made available by the IFES(Instituto Federal de Educação Superior). This route uses the PROUNI database listed above - tags: - - PROUNI - parameters: - - name: dims - in: query - description: Group data using a metric parameter - allowReserved: true - required: false - explode: false - style: form - example: year,uf - schema: - type: array - items: - type: string - enum: - - year - - min_year - - max_year - - name: filter - in: query - description: Filter data - allowReserved: true - required: false - explode: false - style: form - example: year:"2015" - schema: - type: array - items: - type: object - properties: - year: - type: number - min_year: - type: number - max_year: - type: number - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/courseFIES' - '404': - description: no data found - - /institution: - get: - summary: Return the exiting IFES(Instituto Federal de Educação Superior) that are public. This route uses the INEP database listed above - tags: - - INEP - parameters: - - name: dims - in: query - description: Group data using a metric parameter - allowReserved: true - required: false - explode: false - style: form - example: year,uf - schema: - type: array - items: - type: string - enum: - - year - - min_year - - max_year - - uf - - name: filter - in: query - description: Filter data - allowReserved: true - required: false - explode: false - style: form - example: year:"2015", uf:"PR" - schema: - type: array - items: - type: object - properties: - year: - type: number - min_year: - type: number - max_year: - type: number - uf: - type: string - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/institution' - '404': - description: no data found - - /institutionFIES: - get: - summary: Return the exiting IFES(Instituto Federal de Educação Superior) that are public. This route uses the FIES database listed above - tags: - - FIES - parameters: - - name: dims - in: query - description: Group data using a metric parameter - allowReserved: true - required: false - explode: false - style: form - example: year,uf - schema: - type: array - items: - type: string - enum: - - year - - min_year - - max_year - - name: filter - in: query - description: Filter data - allowReserved: true - required: false - explode: false - style: form - example: year:"2015" - schema: - type: array - items: - type: object - properties: - year: - type: number - min_year: - type: number - max_year: - type: number - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/institutionFIES' - '404': - description: no data found - - /institutionPROUNI: - get: - summary: Return the exiting IFES(Instituto Federal de Educação Superior) that are public. This route uses the PROUNI database listed above - tags: - - PROUNI - parameters: - - name: dims - in: query - description: Group data using a metric parameter - allowReserved: true - required: false - explode: false - style: form - example: year,uf - schema: - type: array - items: - type: string - enum: - - year - - min_year - - max_year - - name: filter - in: query - description: Filter data - allowReserved: true - required: false - explode: false - style: form - example: year:"2015" - schema: - type: array - items: - type: object - properties: - year: - type: number - min_year: - type: number - max_year: - type: number - - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/institutionPROUNI' - '404': - description: no data found - - /ibge_code: - get: - summary: Return the name and code of a city as well as the code for the state the city is in. This route uses the IBGE database listed above. - tags: - - EXTRA - parameters: - - name: dims - in: query - description: Group data using a metric parameter - allowReserved: true - required: false - explode: false - style: form - example: year,uf - schema: - type: array - items: - type: string - enum: - - city_name - - city_code - - state - - name: filter - in: query - description: Filter data - allowReserved: true - required: false - explode: false - style: form - example: city_name:"Curitiba", state:"17" - schema: - type: array - items: - type: object - properties: - city_name: - type: string - city_code: - type: number - state: - type: number - - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/ibge_code' - '404': - description: no data found - - /institutionPrivate: - get: - summary: Return the existing IFES(Instituto Federal de Educação Superior) that are private. This route uses the INEP database listed above - tags: - - INEP - parameters: - - name: dims - in: query - description: Group data using a metric parameter - allowReserved: true - required: false - explode: false - style: form - example: year,uf - schema: - type: array - items: - type: string - enum: - - year - - min_year - - max_year - - name: filter - in: query - description: Filter data - allowReserved: true - required: false - explode: false - style: form - example: year:"2015" - schema: - type: array - items: - type: object - properties: - year: - type: number - min_year: - type: number - max_year: - type: number - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/institutionPrivate' - '404': - description: no data found - - /vacancy: - get: - summary: Return the number of quotasholder spots that are open to students in a federal institution - tags: - - INEP - parameters: - - name: dims - in: query - description: Group data using a metric parameter - allowReserved: true - required: false - explode: false - style: form - example: shift,gender,ethnic - schema: - type: array - items: - type: string - enum: - - region - - uf - - cod_ies - - campus - - course - - shift - - name_ies - - year - - min_year - - max_year - - name: filter - in: query - description: Filter data - allowReserved: true - required: false - explode: false - style: form - example: shift:["Integral","Noturno"],gender:"Feminino" - schema: - type: array - items: - type: object - properties: - shift: - type: array - items: - type: string - gender: - type: array - items: - type: string - ethnic: - type: array - items: - type: string - course: - type: array - items: - type: string - institution: - type: array - items: - type: string - institution_code: - type: array - items: - type: integer - year: - type: array - items: - type: integer - min_year: - type: integer - max_year: - type: integer - cod_offer_location: - type: array - items: - type: integer - name_offer_location: - type: array - items: - type: string - region: - type: array - items: - type: string - uf: - type: array - items: - type: string - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/vacancy' - '404': - description: no data found - - /pnad: - get: - summary: Return the number of people obtained by IBGE in the PNAD research. This route uses the PNAD database listed above - tags: - - PNAD - parameters: - - name: dims - in: query - description: Group data using a metric parameter - allowReserved: true - required: false - explode: false - style: form - example: level_of_education,type_of_school - schema: - type: array - items: - type: string - enum: - - ethnic - - type_of_school - - type_of_public_school - - level_of_education - - uf - - region - - year - - min_year - - max_year - - name: filter - in: query - description: Filter data - allowReserved: true - required: false - explode: false - style: form - example: level_of_education:["2","6"],type_of_school:"4" - schema: - type: array - items: - type: object - properties: - ethnic: - type: "array" - items: - type: "string" - enum: ['0', '2', '4', '6', '8', '9'] - type_of_school: - type: "array" - items: - type: "string" - enum: ['2', '4'] - type_of_public_school: - type: "array" - items: - type: "string" - enum: ['2','4','6'] - level_of_education: - type: "array" - items: - type: "string" - enum: ['1','2','3','4','5','6','10','11'] - uf: - type: "array" - items: - type: "string" - enum: ["AC", "AL", "AP", "AM", "BA", "CE", "DF", "ES", "GO", "MA", "MT", "MS", "MG", "PA", "PB", "PR", "PE", "PI", "RJ", "RN", "RS", "RO", "RR", "SC", "SP", "SE", "TO"] - region: - type: "array" - items: - type: "string" - enum: ['Norte', 'Nordeste', 'Centro-Oeste', 'Sul', 'Sudeste'] - year: - type: "array" - items: - type: "integer" - min_year: - type: "integer" - max_year: - type: "integer" - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/PnadReturn' - '404': - description: no data found - /prouni: - get: - summary: Return the number of people that received a scholarship from PROUNI. This route uses the PROUNI database listed above - tags: - - PROUNI - parameters: - - name: dims - in: query - description: Group data using a metric parameter - allowReserved: true - required: false - explode: false - style: form - example: shift,gender - schema: - type: array - items: - type: string - enum: - - shift - - gender - - ethnic - - course - - institution - - scholarship - - uf - - region - - year - - min_year - - max_year - - name: filter - in: query - description: Filter data - allowReserved: true - required: false - explode: false - style: form - example: shift:["Integral","Curso a distância"],gender:"Feminino" - schema: - type: array - items: - type: object - properties: - shift: - type: "string" - enum: ["Curso a distância", "Integral", "Matutino", "Noturno", "Vespertino"] - gender: - type: "string" - enum: ["Masculino", "Feminino"] - ethnic: - type: "string" - enum: ["Amarela", "Branca", "Indígena", "Não Informada", "Parda", "Preta"] - course: - type: "string" - institution: - type: "string" - scholarship: - type: "string" - enum: ["BOLSA INTEGRAL", "BOLSA PARCIAL 50%"] - uf: - type: "array" - items: - type: "string" - enum: ["AC", "AL", "AP", "AM", "BA", "CE", "DF", "ES", "GO", "MA", "MT", "MS", "MG", "PA", "PB", "PR", "PE", "PI", "RJ", "RN", "RS", "RO", "RR", "SC", "SP", "SE", "TO"] - region: - type: "array" - items: - type: "string" - enum: ['Norte', 'Nordeste', 'Centro-Oeste', 'Sul', 'Sudeste'] - year: - type: "array" - items: - type: "integer" - min_year: - type: "integer" - max_year: - type: "integer" - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/ProuniReturn' - '404': - description: no data found - /social_support: - get: - summary: Return the number of quotasholder that had been studying in a federal institution and had some sort of social support - tags: - - INEP - parameters: - - name: dims - in: query - description: Group data using a metric parameter - allowReserved: true - required: false - explode: false - style: form - example: shift,gender,ethnic - schema: - type: array - items: - type: string - enum: - - shift - - gender - - ethnic - - course - - institution - - institution_cod - - food_support - - support - - work_support - - courseware_support - - housing_support - - transport_support - - year - - min_year - - max_year - - cod_offer_location - - name_offer_location - - name: filter - in: query - description: Filter data - allowReserved: true - required: false - explode: false - style: form - example: shift:["Integral","Noturno"],gender:"Feminino" - schema: - type: array - items: - type: object - properties: - shift: - type: array - items: - type: string - gender: - type: array - items: - type: string - ethnic: - type: array - items: - type: string - course: - type: array - items: - type: string - institution: - type: array - items: - type: string - institution_code: - type: array - items: - type: integer - food_support: - type: array - items: - type: string - support: - type: array - items: - type: string - work_support: - type: array - items: - type: string - courseware_support: - type: array - items: - type: string - housing_support: - type: array - items: - type: string - transport_support: - type: array - items: - type: string - year: - type: array - items: - type: integer - min_year: - type: integer - max_year: - type: integer - cod_offer_location: - type: array - items: - type: integer - name_offer_location: - type: array - items: - type: string - - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/SocialSupportReturn' - '404': - description: no data found - /student_loans: - get: - summary: Return the number of quotasholder that had been studying in a federal institution and contracted some sort of loan - tags: - - INEP - parameters: - - name: dims - in: query - description: Group data using a metric parameter - allowReserved: true - required: false - explode: false - style: form - example: shift,gender,ethnic - schema: - type: array - items: - type: string - enum: - - cod_offer_location - - name_offer_location - - shift - - gender - - ethnic - - course - - institution - - institution_cod - - refund_fies - - refund_state - - refund_city - - refund_edu_inst - - refund_org - - refund_others - - no_refund_prouni_integral - - no_refund_prouni_partial - - no_refund_state - - no_refund_city - - no_refund_edu_inst - - no_refund_org - - no_refund_others - - year - - min_year - - max_year - - name: filter - in: query - description: Filter data - allowReserved: true - required: false - explode: false - style: form - example: shift:["Integral","Noturno"],gender:"Feminino" - schema: - type: array - items: - type: object - properties: - shift: - type: array - items: - type: string - gender: - type: array - items: - type: string - ethnic: - type: array - items: - type: string - course: - type: array - items: - type: string - institution: - type: array - items: - type: string - institution_code: - type: array - items: - type: integer - refund_fies: - type: array - items: - type: string - refund_state: - type: array - items: - type: string - refund_city: - type: array - items: - type: string - refund_edu_inst: - type: array - items: - type: string - refund_org: - type: array - items: - type: string - refund_others: - type: array - items: - type: string - no_refund_prouni_integral: - type: array - items: - type: string - no_refund_prouni_partial: - type: array - items: - type: string - no_refund_state: - type: array - items: - type: string - no_refund_city: - type: array - items: - type: string - no_refund_edu_inst: - type: array - items: - type: string - no_refund_org: - type: array - items: - type: string - no_refund_others: - type: array - items: - type: string - year: - type: array - items: - type: integer - min_year: - type: integer - max_year: - type: integer - cod_offer_location: - type: array - items: - type: integer - name_offer_location: - type: array - items: - type: string - region: - type: array - items: - type: string - uf: - type: array - items: - type: string - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/InepLoanReturn' - '404': - description: no data found - -# /ibge_census: -# get: -# summary: Return the number of people obtained by IBGE in the last census. This route uses the IBGE data listed above -# tags: -# - IBGE - Census -# parameters: -# - name: dims -# in: query -# description: Group data using a metric parameter -# allowReserved: true -# required: false -# explode: false -# style: form -# example: ethnic,gender -# schema: -# type: array -# items: -# type: string -# enum: -# - ethnic -# - gender -# - religion -# - income_range -# - age -# - age_greater_than -# - age_lesser_than -# - highest_education -# - school_daycare -# - work_status -# - education_level -# - ocupation_position_and_category -# - home_status -# - work_condition -# - mensal_home_income_range -# - relation_homeowner -# - name: filter -# in: query -# description: Filter data -# allowReserved: true -# required: false -# explode: false -# style: form -# example: ethnic:["2","6"],gender:"1" -# schema: -# type: array -# items: -# type: object -# properties: -# ethnic: -# type: "array" -# items: -# type: "string" -# enum: ['1', '2', '3', '4', '5', '9'] -# gender: -# type: "array" -# items: -# type: "string" -# enum: ['1', '2'] -# religion: -# type: "array" -# items: -# type: "string" -# enum: ['0', '1', '2', '110', '111', '112', '120', '130', '140', '149', '199', '210', '219', '220', '221', '222', '223', '224', '225', '229', '230', '231', '232', '239', '240', '241', '242', '243', '244', '245', '249', '250', '251', '259', '260', '261', '262', '269', '270', '279', '280', '289', '300', '310', '311', '312', '319', '320', '329', '330', '339', '340', '349', '350', '359', '360', '369', '370', '379', '380', '389', '390', '399', '400', '401', '409', '420', '429', '430', '439', '440', '449', '450', '451', '452', '453', '454', '455', '460', '469', '470', '479', '480', '489', '490', '492', '499', '510', '519', '520', '529', '530', '590', '599', '610', '619', '620', '629', '630', '639', '640', '641', '649', '710', '711', '719', '740', '741', '749', '750', '751', '752', '753', '754', '755', '759', '760', '761', '762', '763', '764', '765', '766', '790', '791', '792', '793', '799', '810', '811', '819', '820', '821', '829', '830', '831', '832', '834', '839', '850', '890', '891', '892', '893', '894', '895', '896', '990', '999', ] -# income_range: -# type: "array" -# items: -# type: "number" -# age: -# type: "array" -# items: -# type: "integer" -# age_greater_than: -# type: "array" -# items: -# type: "integer" -# age_lesser_than: -# type: "array" -# items: -# type: "integer" -# highest_education: -# type: "array" -# items: -# type: "string" -# enum: [null, '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14'] -# school_daycare: -# type: "array" -# items: -# type: "string" -# enum: ['1', '2','3', '4'] -# work_status: -# type: "array" -# items: -# type: "string" -# enum: [null, '1', '2'] -# education_level: -# type: "array" -# items: -# type: "string" -# enum: ['1', '2', '3', '4', '5'] -# ocupation_position_and_category: -# type: "array" -# items: -# type: "string" -# enum: ['1', '2'] -# home_status: -# type: "array" -# items: -# type: "string" -# enum: ['1', '2'] -# work_condition: -# type: "array" -# items: -# type: "string" -# enum: [null, '1', '2'] -# mensal_home_income_range: -# type: "array" -# items: -# type: "number" -# relation_homeowner: -# type: "array" -# items: -# type: "string" -# enum: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20'] -# -# responses: -# '200': -# description: successful operation -# content: -# application/json: -# schema: -# $ref: '#/components/schemas/IBGECensusReturn' -# '404': -# description: no data found - -# /cad_unico: -# get: -# summary: Return the number of people and families from that belongs to 'terreiro communities' obtained by CadÚnico. This route uses the IBGE data listed above -# tags: -# - CadÚnico -# parameters: -# - name: dims -# in: query -# description: Group data using a metric parameter -# allowReserved: true -# required: false -# explode: false -# style: form -# example: year,home_type -# schema: -# type: array -# items: -# type: string -# enum: -# - year -# - per_capita_income -# - home_type -# - home_location -# - education_families -# - education_families_level -# - education_families_conclude -# - name: filter -# in: query -# description: Filter data -# allowReserved: true -# required: false -# explode: false -# style: form -# example: ethnic:["2","6"],gender:"1" -# schema: -# type: array -# items: -# type: object -# properties: -# year: -# type: "array" -# items: -# type: "string" -# enum: ['2012', '2013', '2014', '2015', '2016'] -# per_capita_income: -# type: "array" -# items: -# type: "string" -# home_type: -# type: "array" -# items: -# type: "string" -# enum: [null, '1','2','3'] -# home_location: -# type: 'array' -# items: -# type: "number" -# education_families_conclude: -# type: "array" -# items: -# type: "string" -# enum: [null, '1', '2'] -# education_families: -# type: 'array' -# items: -# type: "string" -# enum: [null, '1','2','3','4','5','6','7','8','9','10','11','12','13','14','15'] -# education_families_level: -# type: 'array' -# items: -# type: "string" -# enum: [null,'1','2','3','4','5','6','7','8','9','10'] - -# responses: -# '200': -# description: successful operation -# content: -# application/json: -# schema: -# $ref: '#/components/schemas/CadUnicoReturn' -# '404': -# description: no data found - - /african_culture: - get: - summary: Return the type of house and location of the houses that belongs to 'terreiro communities' obtained by CadÚnico. This route uses the IBGE data listed above - tags: - - CadÚnico - parameters: - - name: dims - in: query - description: Group data using a metric parameter - allowReserved: true - required: false - explode: false - style: form - example: year,home_type - schema: - type: array - items: - type: string - enum: - - year - - cod_local_home - - home_type - - home_location - - name: filter - in: query - description: Filter data - allowReserved: true - required: false - explode: false - style: form - example: ethnic:["2","6"],gender:"1" - schema: - type: array - items: - type: object - properties: - year: - type: "array" - items: - type: "string" - enum: ['2012', '2013', '2014', '2015', '2016','2017'] - cod_local_home: - type: "array" - items: - type: "string" - enum: ['1','2'] - home_type: - type: "array" - items: - type: "string" - enum: ['1','2','3'] - home_location: - type: "array" - items: - type: "string" - enum: ['1301902','1303809', '1304237','1500107','1502806','1503705','1503903','1504604','1504901','1505205'] - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/AfricanCulture' - '404': - description: no data found - - /african_rights: - get: - summary: Return the education level and number of families that belongs to 'terreiro communities' obtained by CadÚnico. This route uses the IBGE data listed above - tags: - - CadÚnico - parameters: - - name: dims - in: query - description: Group data using a metric parameter - allowReserved: true - required: false - explode: false - style: form - example: year,home_type - schema: - type: array - items: - type: string - enum: - - year - - education_families_conclude - - education_families_level - - education_families - - name: filter - in: query - description: Filter data - allowReserved: true - required: false - explode: false - style: form - example: ethnic:["2","6"],gender:"1" - schema: - type: array - items: - type: object - properties: - year: - type: "array" - items: - type: "string" - enum: ['2012', '2013', '2014', '2015', '2016','2017'] - education_families_conclude: - type: "array" - items: - type: "string" - enum: ['1','2','null'] - education_families_level: - type: "array" - items: - type: "string" - enum: ['1','2','3','4','5','6','7','8','9','null'] - education_families: - type: "array" - items: - type: "string" - enum: ['3','4','5','6','7','8','9','12','13','null'] - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/AfricanRights' - '404': - description: no data found - - /african_sustentability: - get: - summary: Return the average per capita income from families that belongs to 'terreiro communities' obtained by CadÚnico. This route uses the IBGE data listed above - tags: - - CadÚnico - parameters: - - name: dims - in: query - description: Group data using a metric parameter - allowReserved: true - required: false - explode: false - style: form - example: year,home_type - schema: - type: array - items: - type: string - enum: - - year - - family_type - - per_capita_income - - - name: filter - in: query - description: Filter data - allowReserved: true - required: false - explode: false - style: form - example: ethnic:["2","6"],gender:"1" - schema: - type: array - items: - type: object - properties: - year: - type: "array" - items: - type: "string" - enum: ['2012', '2013', '2014', '2015', '2016','2017'] - vlr_renda_media_fam: - type: "array" - items: - type: "number" - minimum: 0 - maximum: 3000 - - - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/AfricanSustentability' - '404': - description: no data found - - /eixo_2: - get: - summary: Return the infraestructure and life quality information about quilombola families obtained by CadÚnico. This route uses the CadUnico data listed above - tags: - - CadÚnico - parameters: - - name: dims - in: query - description: Group data using a metric parameter - allowReserved: true - required: false - explode: false - style: form - example: year,home_type - schema: - type: array - items: - type: string - enum: - - year - - family_type - - cod_local_home - - cod_home_lighting - - cod_home_trash_destiny - - cod_home_watter_supply - - cod_sanitary_dump - - home_type - - home_location - - uf - - region - - name: filter - in: query - description: Filter data - allowReserved: true - required: false - explode: false - style: form - example: ethnic:["2","6"],gender:"1" - schema: - type: array - items: - type: object - properties: - year: - type: "array" - items: - type: "string" - enum: ['2012', '2013', '2014', '2015', '2016','2017'] - family_type: - type: "array" - items: - type: "string" - enum: ['201','202','203','204','205','301','302','303','304','305','306','101','0','null'] - cod_local_home: - type: "array" - items: - type: "string" - enum: ['1','2,','NA','null'] - cod_home_lighting: - type: "array" - items: - type: "string" - enum: ['1','2','3','4','5','6','NA','null'] - cod_home_trash_destiny: - type: "array" - items: - type: "string" - enum: ['1','2','3','4','5','6','null','NA'] - cod_home_watter_supply: - type: "array" - items: - type: "string" - enum: ['1','2','3','4','null','NA'] - home_type: - type: "array" - items: - type: "string" - enum: ['1', '2', '3', 'null'] - uf: - type: "array" - items: - type: "string" - enum: ['RS', 'BA', 'PA', 'PR', 'GO', 'MA', 'AL','SE', 'MG', 'PE', 'PI','RN', 'ES', 'PB', 'CE', 'SP', 'SC', 'MS', 'MT', 'AM', 'AP', 'RO', 'TO', 'RJ', 'AC','DF','RR'] - region: - type: "array" - items: - type: "string" - enum: ['norte','nordeste','sul','centro-oeste','sudeste'] - cod_escoa_sanitario_domic_fam: - type: "array" - items: - type: "string" - enum: ['1','2','3','4','5','6','null','NA'] - - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/Eixo2' - '404': - description: no data found - - /eixo_3: - get: - summary: Return the local development and productive inclusion about quilombola families obtained by CadÚnico. This route uses the CadUnico data listed above - tags: - - CadÚnico - parameters: - - name: dims - in: query - description: Group data using a metric parameter - allowReserved: true - required: false - explode: false - style: form - example: year,home_type - schema: - type: array - items: - type: string - enum: - - year - - family_type - - cod_home_bolsa_familia - - cod_agriculture_job - - per_capita_income - - home_location - - uf - - region - - name: filter - in: query - description: Filter data - allowReserved: true - required: false - explode: false - style: form - example: ethnic:["2","6"],gender:"1" - schema: - type: array - items: - type: object - properties: - year: - type: "array" - items: - type: "string" - enum: ['2012', '2013', '2014', '2015', '2016','2017'] - family_type: - type: "array" - items: - type: "string" - enum: ['201','202','203','204','205','301','302','303','304','305','306','101','0','null'] - cod_home_bolsa_familia: - type: "array" - items: - type: "string" - enum: ['0','1','null'] - cod_agriculture_job: - type: "array" - items: - type: "string" - enum: ['0','1','null','NA'] - per_capita_income: - type: "array" - items: - type: "string" - minimum: 0 - maximum: 2800 - home_location: - type: "array" - items: - type: "string" - minimum: 1100015 - maximum: 5300108 - uf: - type: "array" - items: - type: "string" - enum: ['RS', 'BA', 'PA', 'PR', 'GO', 'MA', 'AL','SE', 'MG', 'PE', 'PI','RN', 'ES', 'PB', 'CE', 'SP', 'SC', 'MS', 'MT', 'AM', 'AP', 'RO', 'TO', 'RJ', 'AC','DF','RR'] - region: - type: "array" - items: - type: "string" - enum: ['norte','nordeste','sul','centro-oeste','sudeste'] - - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/Eixo3' - '404': - description: no data found - - /eixo_4: - get: - summary: Return the rights and citizenship information about quilombola families obtained by CadÚnico. This route uses the CadUnico data listed above - tags: - - CadÚnico - parameters: - - name: dims - in: query - description: Group data using a metric parameter - allowReserved: true - required: false - explode: false - style: form - example: year,home_type - schema: - type: array - items: - type: string - enum: - - year - - cod_local_home - - age - - education_families_conclude - - education_families_level - - education_families - - uf - - region - - gender - - name: filter - in: query - description: Filter data - allowReserved: true - required: false - explode: false - style: form - example: ethnic:["2","6"],gender:"1" - schema: - type: array - items: - type: object - properties: - year: - type: "array" - items: - type: "string" - enum: ['2012', '2013', '2014', '2015', '2016','2017'] - age: - type: "array" - items: - type: "string" - minimum: 0 - maximum: 128 - education_families_conclude: - type: "array" - items: - type: "string" - enum: ['1','2','null'] - education_families_level: - type: "array" - items: - type: "string" - enum: ['1','1','3','4','5','6','7','8','9','10'] - education_families: - type: "array" - items: - type: "string" - enum: ['1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','null'] - uf: - type: "array" - items: - type: "string" - enum: ['RS', 'BA', 'PA', 'PR', 'GO', 'MA', 'AL','SE', 'MG', 'PE', 'PI','RN', 'ES', 'PB', 'CE', 'SP', 'SC', 'MS', 'MT', 'AM', 'AP', 'RO', 'TO', 'RJ', 'AC','DF','RR'] - region: - type: "array" - items: - type: "string" - enum: ['norte','nordeste','sul','centro-oeste','sudeste'] - gender: - type: "array" - items: - type: "string" - enum: ['1','2','null'] - - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/Eixo4' - '404': - description: no data found - - /quilombola_metrics: - get: - summary: Return the useful metrics for quilombola families obtained by CadÚnico, like the maximum, minimum and average income they have, per year. This route uses the CadUnico data listed above - tags: - - CadÚnico - parameters: - - name: dims - in: query - description: Group data using a metric parameter - allowReserved: true - required: false - explode: false - style: form - example: year,home_type - schema: - type: array - items: - type: string - enum: - - year - - - name: filter - in: query - description: Filter data - allowReserved: true - required: false - explode: false - style: form - example: year:"2016" - schema: - type: array - items: - type: object - properties: - year: - type: "array" - items: - type: "string" - enum: ['2012', '2013', '2014', '2015', '2016','2017'] - - - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/metrics' - '404': - description: no data found - -components: - schemas: - - Eixo2: - type: object - required: ['total'] - description: | - This model represents the return possibilities in quilombola_eixo_2 queries - properties: - total: - type: "number" - ano_pesquisa: - type: "number" - ind_parc_mds_fam: - type: "number" - cod_local_domic_fam: - type: "number" - cod_iluminacao_domic_fam: - type: "number" - cod_destino_lixo_domic_fam: - type: "number" - cod_abaste_agua_domic_fam: - type: "number" - cod_especie_domic_fam: - type: "number" - uf: - type: "string" - region: - type: "string" - cod_escoa_sanitario_domic_fam: - type: "number" - Eixo3: - type: object - required: ['total'] - description: | - This model represents the return possibilities in quilombola_eixo_3 queries - properties: - total: - type: "number" - ano_pesquisa: - type: "number" - ind_parc_mds_fam: - type: "number" - marc_pbf: - type: "number" - ind_familia_quilombola_fam: - type: "number" - cod_agricultura_trab_memb: - type: "number" - vlr_renda_media_fam: - type: "number" - cd_ibge: - type: "number" - uf: - type: "string" - region: - type: "string" - cod_escoa_sanitario_domic_fam: - type: "number" - - Eixo4: - type: object - required: ['total'] - description: | - This model represents the return possibilities in quilombola_eixo_3 queries - properties: - total: - type: "number" - ano_pesquisa: - type: "number" - idade: - type: "number" - cod_concluiu_frequentou_memb: - type: "string" - cod_ano_serie_frequentou_memb: - type: "string" - cod_curso_frequentou_pessoa_memb: - type: "string" - uf: - type: "string" - region: - type: "string" - genero: - type: "string" - - metrics: - type: object - required: ['total'] - description: | - This model represents the return possibilities in quilombola_metrics queries - properties: - ano_pesquisa: - type: "number" - - AfricanSustentability: - type: object - required: ['total'] - description: | - This model represents the return possibilities in african_rights queries - properties: - total: - type: "number" - ano_pesquisa: - type: "number" - vlr_renda_media_fam: - type: "number" - - - AfricanRights: - type: object - required: ['total'] - description: | - This model represents the return possibilities in african_rights queries - properties: - total: - type: "number" - ano_pesquisa: - type: "number" - cod_concluiu_frequentou_memb: - type: "string" - cod_ano_serie_frequentou_memb: - type: "string" - cod_curso_frequentou_pessoa_memb: - type: "string" - - AfricanCulture: - type: object - required: ['total'] - description: | - This model represents the return possibilities in african_culture queries - properties: - total: - type: "number" - ano_pesquisa: - type: "number" - cod_local_domic_fam: - type: "string" - cod_especie_domic_fam: - type: "string" - cd_ibge: - type: "string" - -# CadUnicoReturn: -# type: object -# required: ['total'] -# description: | -# This model represents the return possibilities in CadUnico queries -# properties: -# total: -# type: "number" -# ano_pesquisa: -# type: "number" -# vlr_renda_media_fam: -# type: "number" -# cod_especie_domic_fam: -# type: "string" -# cd_ibge: -# type: "string" -# cod_concluiu_frequentou_memb: -# type: "string" -# cod_ano_serie_frequentou_memb: -# type: "string" -# cod_curso_frequentou_pessoa_memb: -# type: "string" - - course: - type: object - required: ['total'] - description: | - This model represents the return possibilities in course queries - properties: - total: - type: "number" - year: - type: "number" - uf: - type: "string" - courseFIES: - type: object - required: ['total'] - description: | - This model represents the return possibilities in courseFIES queries - properties: - total: - type: "number" - year: - type: "number" - uf: - type: "string" - coursePROUNI: - type: object - required: ['total'] - description: | - This model represents the return possibilities in course queries - properties: - total: - type: "number" - year: - type: "number" - uf: - type: "string" - institution: - type: object - required: ['total'] - description: | - This model represents the return possibilities in institution queries - properties: - total: - type: "number" - year: - type: "number" - uf: - type: "string" - - institutionFIES: - type: object - required: ['total'] - description: | - This model represents the return possibilities in institutionFIES queries - properties: - total: - type: "number" - year: - type: "number" - - institutionPROUNI: - type: object - required: ['total'] - description: | - This model represents the return possibilities in institutionPROUNI queries - properties: - total: - type: "number" - year: - type: "number" - - - institutionPrivate: - type: object - required: ['total'] - description: | - This model represents the return possibilities in institution queries - properties: - total: - type: "number" - year: - type: "number" - uf: - type: "string" - - ibge_code: - type: object - required: ['total'] - description: | - This model represents the return possibilities in ibge_code queries - properties: - no_cidade: - type: "string" - co_cidade: - type: "number" - sgl_estado: - type: "string" - -# IBGECensusReturn: -# type: object -# required: ['total'] -# description: | -# This model represents the return possibilities in IBGE Census queries -# properties: -# total: -# type: "number" -# co_cor_raca: -# type: "string" -## co_sexo: -# type: "string" -# co_religiao: -# type: "string" -# nu_sal_min_todos_trabalhos: -# type: "number" -# nu_idade_calculada_anos: -# type: "number" -# co_curso_mais_elevado_freq: -# type: "string" - # co_freq_escola_creche: -# type: "string" -# co_condicao_atividade_semana_ref: -# type: "string" -# co_nivel_instrucao: -# type: "string" -# co_posicao_na_ocupacao_e_categoria_do_emprego: -# type: "string" -# co_situacao_dom: -# type: "string" -# co_condicao_ocupacao_semana_ref: -# type: "string" -# vl_rendimneto_mensal_domicilio_sal_min_per_capita: -# type: "number" -# co_relacao_responsavel_dom: -# type: "string" - - BasicInepReturn: - type: object - required: ['result'] - description: | - This model represents the return possibilities in INEP queries when location information is not needed. - Note that there will always exists the total and no_ano_pesquisa keys. - All the other keys are optional and appear if the dims paramter is used. - properties: - result: - type: array - items: - type: object - required: ['total', 'no_ano_pesquisa'] - properties: - total: - type: "number" - no_ano_pesquisa: - type: "integer" - format: "int32" - ds_turno_aluno: - type: "string" - enum: ['Integral', 'Matutino', 'Noturno', 'Não aplicável', 'Vespertino'] - ds_sexo_aluno: - type: "string" - enum: ['Masculino', 'Feminino'] - ds_cor_raca_aluno: - type: "string" - enum: ['Aluno não quis declarar cor/raça', 'Amarela', 'Branca', 'Indígena', 'Parda', 'Preta'] - no_curso: - type: "string" - no_ies: - type: "string" - co_ies: - type: "integer" - co_local_oferta: - type: "integer" - no_local_oferta: - type: "string" - BasicInepReturnWithLocationInfo: - type: object - required: ['result'] - description: | - This model represents the return possibilities in INEP queries when location information is needed. - Note that there will always exists the total and no_ano_pesquisa keys. - All the other keys are optional and appear if the dims paramter is used. - properties: - result: - type: array - items: - type: object - required: ['total', 'no_ano_pesquisa'] - properties: - total: - type: "number" - no_ano_pesquisa: - type: "integer" - format: "int32" - ds_turno_aluno: - type: "string" - enum: ['Integral', 'Matutino', 'Noturno', 'Não aplicável', 'Vespertino'] - ds_sexo_aluno: - type: "string" - enum: ['Masculino', 'Feminino'] - ds_cor_raca_aluno: - type: "string" - enum: ['Aluno não quis declarar cor/raça', 'Amarela', 'Branca', 'Indígena', 'Parda', 'Preta'] - no_curso: - type: "string" - no_ies: - type: "string" - co_ies: - type: "integer" - co_local_oferta: - type: "integer" - no_local_oferta: - type: "string" - region: - type: "string" - enum: ['Norte', 'Nordeste', 'Centro-Oeste', 'Sul', 'Sudeste'] - uf: - type: "string" - enum: ["AC", "AL", "AP", "AM", "BA", "CE", "DF", "ES", "GO", "MA", "MT", "MS", "MG", "PA", "PB", "PR", "PE", "PI", "RJ", "RN", "RS", "RO", "RR", "SC", "SP", "SE", "TO"] - - vacancy: - type: object - required: ['total'] - description: | - This model represents the return possibilities in vacancy queries - properties: - total: - type: "number" - uf: - type: "string" - region: - type: "string" - year: - type: "number" - cod_ies: - type: "integer" - campus: - type: "string" - curso: - type: "string" - turno: - type: "string" - nome_ies: - type: "string" - cod_especie_domic_fam: - type: "number" - total_vagas_ampla_concorrencia_nao_pcd: - type: "number" - total_vagas_ampla_concorrencia_pcd: - type: "number" - total_vagas_cotas_renda_baixa_ppi_nao_pcd: - type: "number" - total_vagas_cotas_renda_baixa_ppi_pcd: - type: "number" - total_vagas_cotas_renda_baixa_outros_nao_pcd: - type: "number" - total_vagas_cotas_renda_baixa_outros_pcd: - type: "number" - total_vagas_cotas_renda_alta_ppi_nao_pcd: - type: "number" - total_vagas_cotas_renda_alta_ppi_pcd: - type: "number" - total_vagas_cotas_renda_alta_outros_nao_pcd: - type: "number" - total_vagas_cotas_renda_alta_outros_pcd: - type: "number" - total_total_pcd: - type: "number" - - - - FiesReturn: - type: object - required: ['result'] - description: | - This model represents the return possibilities in FIES queries. - Note that there will always exists the total and nu_ano keys. - All the other keys are optional and appear if the dims paramter is used. - properties: - result: - type: array - items: - type: object - required: ['total', 'nu_ano'] - properties: - total: - type: "number" - nu_ano: - type: "integer" - format: "int32" - ds_sexo: - type: "string" - enum: ['Masculino', 'Feminino'] - ds_raca_cor: - type: "string" - enum: ['Amarelo','Branco','Negro','Pardo','Índio'] - ds_curso: - type: "string" - no_ies: - type: "string" - co_ies: - type: "integer" - no_campus: - type: "string" - nu_percent_solicitado_financ: - type: integer - enum: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100 ] - tp_fianca: - type: "string" - enum: ["F", "N", "S"] - description: | - Meanings of each letter: - - F - Fundo de Garantia de Operações de Crédito Educativo – FGEDUC - - N - Normal/Convencional - - S - Solidária - region: - type: "string" - enum: ['Norte', 'Nordeste', 'Centro-Oeste', 'Sul', 'Sudeste'] - uf: - type: "string" - enum: ["AC", "AL", "AP", "AM", "BA", "CE", "DF", "ES", "GO", "MA", "MT", "MS", "MG", "PA", "PB", "PR", "PE", "PI", "RJ", "RN", "RS", "RO", "RR", "SC", "SP", "SE", "TO"] - PnadReturn: - type: object - required: ['result'] - description: | - This model represents the return possibilities in PNAD queries. - Note that there will always exists the total and nu_ano_referencia keys. - All the other keys are optional and appear if the dims paramter is used. - properties: - result: - type: array - items: - type: object - required: ['total', 'nu_ano_referencia'] - properties: - total: - type: "number" - nu_ano_referencia: - type: "integer" - format: "int32" - co_cor_raca: - type: "string" - enum: ['0', '2', '4', '6', '8', '9'] - co_rede_ensino: - type: "string" - enum: ['2', '4'] - co_area_rede_publica_ensino: - type: "string" - enum: ['2','4','6'] - co_curso: - type: "string" - enum: ['1','2','3','4','5','6','10','11'] - uf: - type: "string" - enum: ["AC", "AL", "AP", "AM", "BA", "CE", "DF", "ES", "GO", "MA", "MT", "MS", "MG", "PA", "PB", "PR", "PE", "PI", "RJ", "RN", "RS", "RO", "RR", "SC", "SP", "SE", "TO"] - region: - type: "string" - enum: ['Norte', 'Nordeste', 'Centro-Oeste', 'Sul', 'Sudeste'] - ProuniReturn: - type: object - required: ['result'] - description: | - This model represents the return possibilities in PROUNI queries. - Note that there will always exists the total and ano_concessao_bolsa keys. - All the other keys are optional and appear if the dims paramter is used. - properties: - result: - type: array - items: - type: object - required: ['total', 'ano_concessao_bolsa'] - properties: - total: - type: "number" - ano_concessao_bolsa: - type: "integer" - format: "int32" - nome_turno_curso_bolsa: - # shift - type: "string" - enum: ['Curso a distância', 'Integral', 'Matutino', 'Noturno', 'Vespertino'] - sexo_beneficiario_bolsa: - # gender - type: "string" - enum: ["Masculino", "Feminino"] - raca_beneficiario_bolsa: - # ethnic - type: "string" - enum: ['Amarela', 'Branca', 'Indígena', 'Não Informada', 'Parda', 'Preta'] - nome_curso_bolsa: - # course - type: "string" - nome_ies_bolsa: - # institution - type: "string" - tipo_bolsa: - # scholarship - type: "string" - enum: ["BOLSA INTEGRAL", "BOLSA PARCIAL 50%"] - sigla_uf_beneficiario_bolsa: - # uf - type: "string" - enum: ["AC", "AL", "AP", "AM", "BA", "CE", "DF", "ES", "GO", "MA", "MT", "MS", "MG", "PA", "PB", "PR", "PE", "PI", "RJ", "RN", "RS", "RO", "RR", "SC", "SP", "SE", "TO"] - regiao_beneficiario_bolsa: - # region - type: "string" - enum: ['Norte', 'Nordeste', 'Centro-Oeste', 'Sul', 'Sudeste'] - SocialSupportReturn: - type: object - required: ['result'] - description: | - This model represents the return possibilities in INEP queries when location information is not needed. - Note that there will always exists the total and no_ano_pesquisa keys. - All the other keys are optional and appear if the dims paramter is used. - properties: - result: - type: array - items: - type: object - required: ['total', 'no_ano_pesquisa'] - properties: - total: - type: "number" - no_ano_pesquisa: - type: "integer" - format: "int32" - ds_turno_aluno: - type: "string" - enum: ['Integral', 'Matutino', 'Noturno', 'Não aplicável', 'Vespertino'] - ds_sexo_aluno: - type: "string" - enum: ['Masculino', 'Feminino'] - ds_cor_raca_aluno: - type: "string" - enum: ['Aluno não quis declarar cor/raça', 'Amarela', 'Branca', 'Indígena', 'Parda', 'Preta'] - no_curso: - type: "string" - no_ies: - type: "string" - co_ies: - type: "integer" - co_local_oferta: - type: "integer" - no_local_oferta: - type: "string" - in_apoio_alimentacao: - type: "string" - enum: ["0", "1"] - in_apoio_bolsa_pemanencia: - type: "string" - enum: ["0", "1"] - in_apoio_bolsa_trabalho: - type: "string" - enum: ["0", "1"] - in_apoio_material_didatico: - type: "string" - enum: ["0", "1"] - in_apoio_moradia: - type: "string" - enum: ["0", "1"] - in_apoio_transporte: - type: "string" - enum: ["0", "1"] - InepLoanReturn: - type: object - required: ['result'] - description: | - This model represents the return possibilities in INEP queries when location information is not needed. - Note that there will always exists the total and no_ano_pesquisa keys. - All the other keys are optional and appear if the dims paramter is used. - properties: - result: - type: array - items: - type: object - required: ['total', 'no_ano_pesquisa'] - properties: - total: - type: "number" - no_ano_pesquisa: - type: "integer" - format: "int32" - ds_turno_aluno: - type: "string" - enum: ['Integral', 'Matutino', 'Noturno', 'Não aplicável', 'Vespertino'] - ds_sexo_aluno: - type: "string" - enum: ['Masculino', 'Feminino'] - ds_cor_raca_aluno: - type: "string" - enum: ['Aluno não quis declarar cor/raça', 'Amarela', 'Branca', 'Indígena', 'Parda', 'Preta'] - no_curso: - type: "string" - no_ies: - type: "string" - co_ies: - type: "integer" - refund_fies: - type: "string" - enum: ["0", "1"] - refund_state: - type: "string" - enum: ["0", "1"] - refund_city: - type: "string" - enum: ["0", "1"] - refund_edu_inst: - type: "string" - enum: ["0", "1"] - refund_org: - type: "string" - enum: ["0", "1"] - refund_others: - type: "string" - enum: ["0", "1"] - no_refund_prouni_integral: - type: "string" - enum: ["0", "1"] - no_refund_prouni_partial: - type: "string" - enum: ["0", "1"] - no_refund_state: - type: "string" - enum: ["0", "1"] - no_refund_city: - type: "string" - enum: ["0", "1"] - no_refund_edu_inst: - type: "string" - enum: ["0", "1"] - no_refund_org: - type: "string" - enum: ["0", "1"] - no_refund_others: - type: "string" - enum: ["0", "1"] - co_local_oferta: - type: "integer" - no_local_oferta: - type: "string" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 8574cf989b6988b633b48dc1c45bdfb3006b7f88..f0c33152c1d7f488e9edf494128aba44d6f42ef1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ -FROM node:9.5.0-stretch +FROM node:dubnium-stretch -RUN apt-get -y update -qq && apt-get install -y -qq apt-utils +RUN apt-get -y update && apt-get install -y apt-utils -RUN npm install --global gulp gulp-cli babel babel-cli babel-core babel-register mocha gulp-mocha gulp-eslint istanbul +RUN npm install --global gulp gulp-cli babel babel-cli babel-core babel-register mocha gulp-mocha gulp-eslint istanbul --force RUN mkdir API @@ -12,7 +12,11 @@ WORKDIR ./API RUN npm install -RUN gulp build +RUN npm un -g gulp + +RUN npm i -g gulp@3.9.0 + +RUN gulp build EXPOSE 4000 @@ -20,4 +24,4 @@ CMD gulp # sudo docker build --tag api-smppir . -# sudo docker run --rm -p 4000:4000 --net="host" --name api-smppir api-smppir \ No newline at end of file +# sudo docker run --rm -p 4000:4000 --net="host" --name api-smppir api-smppir diff --git a/src/libs/middlewares/reqQueryFields.js b/src/libs/middlewares/reqQueryFields.js index 424ef59b7137cb87a43871943aac95018e6f790e..34fdd0ba2c4e9409a9e8c13d669e3d956bf073cf 100644 --- a/src/libs/middlewares/reqQueryFields.js +++ b/src/libs/middlewares/reqQueryFields.js @@ -28,6 +28,7 @@ function parseWhereValue(type, value) { if(type === 'integer') return parseInt(value, 10); if(type === 'double') return parseFloat(value); if(type === 'string') return value; + if(type === 'like_string') return "%"+value+"%"; if(type === 'boolean') { if(value === null || typeof value === 'boolean') { return value; diff --git a/src/libs/routes/SMPPIR/admission.js b/src/libs/routes/SMPPIR/admission.js index 80245eb274aa0e164455fbbc3e09a63dec7b4160..65bfea2adfec9224ff054984eb183f3b2e0ccfcf 100644 --- a/src/libs/routes/SMPPIR/admission.js +++ b/src/libs/routes/SMPPIR/admission.js @@ -142,6 +142,28 @@ rqf.addField({ type: 'integer', field: 'ano_censo', }, +}) +.addValue({ + name: 'region', + table: 'admission_ag', + tableField: 'nome_regiao_ies', + resultField: 'region', + where: { + relation: '=', + type: 'string', + field: 'nome_regiao_ies', + }, +}) +.addValue({ + name: 'uf', + table: 'admission_ag', + tableField: 'sigla_uf_ies', + resultField: 'uf', + where: { + relation: '=', + type: 'string', + field: 'sigla_uf_ies', + }, }); admissionApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => { diff --git a/src/libs/routes/SMPPIR/african_culture.js b/src/libs/routes/SMPPIR/african_culture.js index 749971d9d9e7fb755bd00da978988c9f96787682..f9d03364970f71967560b8cd038418fea70c8659 100644 --- a/src/libs/routes/SMPPIR/african_culture.js +++ b/src/libs/routes/SMPPIR/african_culture.js @@ -133,7 +133,8 @@ rqf.addField({ cad_unico.get('/', rqf.parse(), rqf.build(), (req, res, next) => { console.log(req.sql.toString()); - req.sql.field('SUM(total) AS Total') + // Use COUNT to get Family and SUM to get people, as the indicator needs families, COUNT is being used. + req.sql.field('COUNT(total) AS Total') .from('african_culture_ag'); next(); }, query, response('cad_unico')); diff --git a/src/libs/routes/SMPPIR/african_sustentability.js b/src/libs/routes/SMPPIR/african_sustentability.js index 6ea5f7be7192118645c5e7bdffe4dbedc79637ae..3613755936bd0df6eb0df1f7d55a1539b812f16d 100644 --- a/src/libs/routes/SMPPIR/african_sustentability.js +++ b/src/libs/routes/SMPPIR/african_sustentability.js @@ -109,7 +109,8 @@ rqf.addField({ cad_unico.get('/', rqf.parse(), rqf.build(), (req, res, next) => { console.log(req.sql.toString()); - req.sql.field('SUM(total) AS Total') + // Use COUNT to get Family and SUM to get people, as the indicator needs families, COUNT is being used. + req.sql.field('COUNT(total) AS Total') .from('african_sustentability_ag'); next(); }, query, response('cad_unico')); diff --git a/src/libs/routes/SMPPIR/ciganos_culture.js b/src/libs/routes/SMPPIR/ciganos_culture.js index f368aa0fc6c90ae4ac41a085e8371d2575beae9f..e346b9961d78686cb857c2d4543da24bfd1811b1 100644 --- a/src/libs/routes/SMPPIR/ciganos_culture.js +++ b/src/libs/routes/SMPPIR/ciganos_culture.js @@ -133,7 +133,8 @@ rqf.addField({ cad_unico.get('/', rqf.parse(), rqf.build(), (req, res, next) => { console.log(req.sql.toString()); - req.sql.field('SUM(total) AS Total') + // Use COUNT to get Family and SUM to get people, as the indicator needs families, COUNT is being used. + req.sql.field('COUNT(total) AS Total') .from('ciganos_culture_ag'); next(); }, query, response('cad_unico')); diff --git a/src/libs/routes/SMPPIR/ciganos_sustentability.js b/src/libs/routes/SMPPIR/ciganos_sustentability.js index 89b28cf7f9b0b77c363999afb0a69419c8603f6d..3b14ffac434ee664fbe276421029f5b837e20c9f 100644 --- a/src/libs/routes/SMPPIR/ciganos_sustentability.js +++ b/src/libs/routes/SMPPIR/ciganos_sustentability.js @@ -109,7 +109,8 @@ rqf.addField({ cad_unico.get('/', rqf.parse(), rqf.build(), (req, res, next) => { console.log(req.sql.toString()); - req.sql.field('SUM(total) AS Total') + // Use COUNT to get Family and SUM to get people, as the indicator needs families, COUNT is being used. + req.sql.field('COUNT(total) AS Total') .from('ciganos_sustentability_ag'); next(); }, query, response('cad_unico')); diff --git a/src/libs/routes/SMPPIR/education.js b/src/libs/routes/SMPPIR/education.js new file mode 100644 index 0000000000000000000000000000000000000000..812f0eda72be80a4c4cdcf63895073a20ee384bb --- /dev/null +++ b/src/libs/routes/SMPPIR/education.js @@ -0,0 +1,139 @@ +/* +Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre +Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR + +This file is part of SMPPIR-Node. + +SMPPIR-Node is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +SMPPIR-Node is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with SMPPIR-Node. If not, see <https://www.gnu.org/licenses/>. +*/ + + + +const express = require('express'); + +const educationApp = express.Router(); + +const libs = `${process.cwd()}/libs`; + +const squel = require('squel'); + +const query = require(`${libs}/middlewares/query`).query; + +const response = require(`${libs}/middlewares/response`); + +const ReqQueryFields = require(`${libs}/middlewares/reqQueryFields`); + +const rqf = new ReqQueryFields(); +rqf.addField({ + name: 'filter', + field: false, + where: true, +}).addField({ + name: 'dims', + field: true, + where: false, +}) + +.addValue({ + name: 'ethnic', + table: 'education_ag', + tableField: 'cor_raca_aluno', + resultField: 'ds_cor_raca_aluno', + where: { + relation: '=', + type: 'string', + field: 'cor_raca_aluno', + }, +}).addValue({ + name: 'year', + table: 'education_ag', + tableField: 'ano_censo', + resultField: 'year', + where: { + relation: '=', + type: 'integer', + field: 'ano_censo', + }, +}).addValue({ + name: 'min_year', + table: 'education_ag', + tableField: 'ano_censo', + resultField: 'year', + where: { + relation: '>=', + type: 'integer', + field: 'ano_censo', + }, +}).addValue({ + name: 'max_year', + table: 'v_ag', + tableField: 'ano_censo', + resultField: 'year', + where: { + relation: '<=', + type: 'integer', + field: 'ano_censo', + }, +}).addValue({ + name: 'region', + table: 'education_ag', + tableField: 'nome_regiao_ies', + resultField: 'region', + where: { + relation: '=', + type: 'string', + field: 'nome_regiao_ies', + }, +}).addValue({ + name: 'uf', + table: 'education_ag', + tableField: 'sigla_uf_ies', + resultField: 'uf', + where: { + relation: '=', + type: 'string', + field: 'sigla_uf_ies', + }, +}).addValue({ + name: 'quotas', + table: 'education_ag', + tableField: 'reserva_vagas', + resultField: 'cod_reserva_vagas', + where: { + relation: '=', + type: 'string', + field: 'reserva_vagas', + }, +}).addValue({ + name: 'admission', + table: 'education_ag', + tableField: 'ingressante', + resultField: 'cod_ingressantes', + where: { + relation: '=', + type: 'string', + field: 'ingressante', + }, +}); + +educationApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => { + req.sql.field('education_ag.ano_censo as no_ano_pesquisa') + .field('SUM(total) AS total') + .from('education_ag') + .group('education_ag.ano_censo') + .order('education_ag.ano_censo'); + next(); +}, query, response('education')); + +module.exports = educationApp; diff --git a/src/libs/routes/SMPPIR/eixo_2_count.js b/src/libs/routes/SMPPIR/eixo_2_count.js new file mode 100644 index 0000000000000000000000000000000000000000..0faa353928155606a56a1e96aa002ef618d4f029 --- /dev/null +++ b/src/libs/routes/SMPPIR/eixo_2_count.js @@ -0,0 +1,205 @@ +/* +Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre +Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR + +This file is part of SMPPIR-Node. + +SMPPIR-Node is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +SMPPIR-Node is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with SMPPIR-Node. If not, see <https://www.gnu.org/licenses/>. +*/ + + + +const express = require('express'); + +const cad_unico = express.Router(); + +const libs = `${process.cwd()}/libs`; + +const squel = require('squel'); + +const query = require(`${libs}/middlewares/query`).query; + +const response = require(`${libs}/middlewares/response`); + +const ReqQueryFields = require(`${libs}/middlewares/reqQueryFields`); + +const rqf = new ReqQueryFields(); + +rqf.addField({ + name: 'filter', + field: false, + where: true, +}).addField({ + name: 'dims', + field: true, + where: false, +}) +.addValue({ + name: 'year', + table: 'quilombola_eixo_2_ag', + tableField: 'ano_censo', + resultField: 'ano_pesquisa', + where: { + relation: '=', + type: 'integer', + field: 'ano_censo', + }, +}) + +.addValue({ + name: 'family_type', + table: 'quilombola_eixo_2_ag', + tableField: 'ind_tipo_familia', + resultField: 'ind_parc_mds_fam', + where: { + relation: '=', + type: 'string', + field: 'ind_tipo_familia', + }, +}) + +.addValue({ + name:'cod_local_home', + table:'quilombola_eixo_2_ag', + tableField:'cod_local_domicilio', + resultField:'cod_local_domic_fam', + where: { + relation:'=', + type:'string', + field:'cod_local_domicilio', + }, +}) + +.addValue({ + name:'cod_home_lighting', + table:'quilombola_eixo_2_ag', + tableField:'cod_iluminacao_domicilio', + resultField:'cod_iluminacao_domic_fam', + where: { + relation:'=', + type:'string', + field:'cod_iluminacao_domicilio', + }, +}) + +.addValue({ + name:'cod_home_trash_destiny', + table:'quilombola_eixo_2_ag', + tableField:'cod_destino_lixo_domicilio', + resultField:'cod_destino_lixo_domic_fam', + where: { + relation:'=', + type:'string', + field:'cod_destino_lixo_domicilio', + }, +}) + +.addValue({ + name:'cod_home_watter_supply', + table:'quilombola_eixo_2_ag', + tableField:'cod_abastecimento_agua_domicilio', + resultField:'cod_abaste_agua_domic_fam', + where: { + relation:'=', + type:'string', + field:'cod_abastecimento_agua_domicilio', + }, +}) + + +// .addValue({ +// name:'quilombola_family', +// table:'quilombola_eixo_2_ag', +// tableField:'ind_familia_quilombola', +// resultField:'ind_familia_quilombola_fam', +// where: { +// relation:'=', +// type:'string', +// field:'ind_familia_quilombola', +// }, +// }) + + + +.addValue({ + name: 'home_type', + table: 'quilombola_eixo_2_ag', + tableField: 'cod_especie_domicilio', + resultField: 'cod_especie_domic_fam', + where: { + relation: '=', + type: 'string', + field: 'cod_especie_domicilio', + }, +}) + +// .addValue({ +// name: 'home_location', +// table: 'quilombola_eixo_2_ag', +// tableField: 'codigo_ibge', +// resultField: 'cd_ibge', +// where: { +// relation: '=', +// type: 'string', +// field: 'codigo_ibge', +// }, +// }) + + +.addValue({ + name: 'uf', + table: 'quilombola_eixo_2_ag', + tableField: 'sigla_estado', + resultField: 'uf', + where: { + relation: '=', + type: 'string', + field: 'sigla_estado', + }, +}) +.addValue({ + name: 'region', + table: 'quilombola_eixo_2_ag', + tableField : 'nome_regiao', + resultField: 'region', + where: { + relation: '=', + type: 'string', + field: 'nome_regiao', + }, +}) + +.addValue({ + name:'cod_sanitary_dump', + table:'quilombola_eixo_2_ag', + tableField:'cod_escoa_sanitario_domicilio', + resultField:'cod_escoa_sanitario_domic_fam', + where: { + relation:'=', + type:'string', + field:'cod_escoa_sanitario_domic_fam', + }, +}) + +; + + +cad_unico.get('/', rqf.parse(), rqf.build(), (req, res, next) => { + console.log(req.sql.toString()); + req.sql.field('count(distinct id_familia) AS Total') + .from('quilombola_eixo_2_ag'); + next(); +}, query, response('cad_unico')); + +module.exports = cad_unico; diff --git a/src/libs/routes/SMPPIR/eixo_3.js b/src/libs/routes/SMPPIR/eixo_3.js index 626290ed7def14b4afc7a985d7bd4a228f867fcd..7a3472d2ef9c898aebe691d5ccf8ac92d6be4c32 100644 --- a/src/libs/routes/SMPPIR/eixo_3.js +++ b/src/libs/routes/SMPPIR/eixo_3.js @@ -131,6 +131,18 @@ rqf.addField({ }, }) +.addValue({ + name:'cod_local_home', + table:'quilombola_eixo_3_ag', + tableField:'cod_local_domicilio', + resultField:'cod_local_domic_fam', + where: { + relation:'=', + type:'string', + field:'cod_local_domicilio', + }, +}) + .addValue({ name: 'uf', table: 'quilombola_eixo_3_ag', @@ -159,7 +171,7 @@ rqf.addField({ cad_unico_count.get('/', rqf.parse(), rqf.build(), (req, res, next) => { console.log(req.sql.toString()); - req.sql.field('SUM(total) AS Total') + req.sql.field('COUNT(distinct id_familia) AS Total') .from('quilombola_eixo_3_ag'); next(); }, query, response('cad_unico')); diff --git a/src/libs/routes/SMPPIR/eixo_3_count.js b/src/libs/routes/SMPPIR/eixo_3_count.js new file mode 100644 index 0000000000000000000000000000000000000000..fde80c8ccf22cc4a3cad5d9b352023ded8c64446 --- /dev/null +++ b/src/libs/routes/SMPPIR/eixo_3_count.js @@ -0,0 +1,167 @@ +/* +Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre +Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR + +This file is part of SMPPIR-Node. + +SMPPIR-Node is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +SMPPIR-Node is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with SMPPIR-Node. If not, see <https://www.gnu.org/licenses/>. +*/ + + + +const express = require('express'); + +const cad_unico_count = express.Router(); + +const libs = `${process.cwd()}/libs`; + +const squel = require('squel'); + +const query = require(`${libs}/middlewares/query`).query; + +const response = require(`${libs}/middlewares/response`); + +const ReqQueryFields = require(`${libs}/middlewares/reqQueryFields`); + +const rqf = new ReqQueryFields(); + +rqf.addField({ + name: 'filter', + field: false, + where: true, +}).addField({ + name: 'dims', + field: true, + where: false, +}) +.addValue({ + name: 'year', + table: 'quilombola_eixo_3_ag', + tableField: 'ano_censo', + resultField: 'ano_pesquisa', + where: { + relation: '=', + type: 'integer', + field: 'ano_censo', + }, +}) + +.addValue({ + name: 'family_type', + table: 'quilombola_eixo_3_ag', + tableField: 'ind_tipo_familia', + resultField: 'ind_parc_mds_fam', + where: { + relation: '=', + type: 'string', + field: 'ind_tipo_familia', + }, +}) + + +.addValue({ + name:'cod_home_bolsa_familia', + table:'quilombola_eixo_3_ag', + tableField:'marca_programa_bolsa_familia', + resultField:'marc_pbf', + where: { + relation:'=', + type:'string', + field:'marca_programa_bolsa_familia', + }, +}) + +// .addValue({ +// name:'quilombola_family', +// table:'quilombola_eixo_3_ag', +// tableField:'ind_familia_quilombola', +// resultField:'ind_familia_quilombola_fam', +// where: { +// relation:'=', +// type:'string', +// field:'ind_familia_quilombola', +// }, +// }) + +.addValue({ + name:'cod_agriculture_job', + table:'quilombola_eixo_3_ag', + tableField:'atividade_extrativista', + resultField:'cod_agricultura_trab_memb', + where: { + relation:'=', + type:'string', + field:'atividade_extrativista', + }, +}) + + +.addValue({ + name: 'per_capita_income', + table: 'quilombola_eixo_3_ag', + tableField: 'renda_media', + resultField: 'vlr_renda_media_fam', + where: { + relation: '=', + type: 'float', + field: 'renda_media', + }, +}) + +.addValue({ + name: 'home_location', + table: 'quilombola_eixo_3_ag', + tableField: 'codigo_ibge', + resultField: 'cd_ibge', + where: { + relation: '=', + type: 'string', + field: 'codigo_ibge', + }, +}) + +.addValue({ + name: 'uf', + table: 'quilombola_eixo_3_ag', + tableField: 'sigla_estado', + resultField: 'uf', + where: { + relation: '=', + type: 'string', + field: 'sigla_estado', + }, +}) +.addValue({ + name: 'region', + table: 'quilombola_eixo_3_ag', + tableField : 'nome_regiao', + resultField: 'region', + where: { + relation: '=', + type: 'string', + field: 'nome_regiao', + }, +}) + +; + + +cad_unico_count.get('/', rqf.parse(), rqf.build(), (req, res, next) => { + console.log(req.sql.toString()); + req.sql.field('count(distinct id_familia) AS Total') + .from('quilombola_eixo_3_ag'); + next(); +}, query, response('cad_unico')); + +module.exports = cad_unico_count; diff --git a/src/libs/routes/SMPPIR/eixo_4_count.js b/src/libs/routes/SMPPIR/eixo_4_count.js new file mode 100644 index 0000000000000000000000000000000000000000..e66a8fa15c95f62928281845375b47fb5053cd4d --- /dev/null +++ b/src/libs/routes/SMPPIR/eixo_4_count.js @@ -0,0 +1,177 @@ +/* +Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre +Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR + +This file is part of SMPPIR-Node. + +SMPPIR-Node is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +SMPPIR-Node is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with SMPPIR-Node. If not, see <https://www.gnu.org/licenses/>. +*/ + + + +const express = require('express'); + +const cad_unico = express.Router(); + +const libs = `${process.cwd()}/libs`; + +const squel = require('squel'); + +const query = require(`${libs}/middlewares/query`).query; + +const response = require(`${libs}/middlewares/response`); + +const ReqQueryFields = require(`${libs}/middlewares/reqQueryFields`); + +const rqf = new ReqQueryFields(); + +rqf.addField({ + name: 'filter', + field: false, + where: true, +}).addField({ + name: 'dims', + field: true, + where: false, +}) +.addValue({ + name: 'year', + table: 'quilombola_eixo_4_ag', + tableField: 'ano_censo', + resultField: 'ano_pesquisa', + where: { + relation: '=', + type: 'integer', + field: 'ano_censo', + }, +}) + +// .addValue({ +// name:'cod_local_home', +// table:'quilombola_eixo_4_ag', +// tableField:'cod_local_domicilio', +// resultField:'cod_local_domic_fam', +// where: { +// relation:'=', +// type:'string', +// field:'cod_local_domicilio', +// }, +// }) + +// .addValue({ +// name:'quilombola_family', +// table:'quilombola_eixo_4_ag', +// tableField:'ind_familia_quilombola', +// resultField:'ind_familia_quilombola_fam', +// where: { +// relation:'=', +// type:'string', +// field:'ind_familia_quilombola', +// }, +// }) + +.addValue({ + name:'age', + table:'quilombola_eixo_4_ag', + tableField:'idade', + resultField:'idade', + where: { + relation:'=', + type:'string', + field:'idade', + }, +}) + + +.addValue({ + name: 'education_families_conclude', + table: 'quilombola_eixo_4_ag', + tableField: 'concluiu_frequentou', + resultField: 'cod_concluiu_frequentou_memb', + where: { + relation: '=', + type: 'string', + field: 'concluiu_frequentou', + }, +}) +.addValue({ + name: 'education_families_level', + table: 'quilombola_eixo_4_ag', + tableField: 'ano_serie_frequentou', + resultField: 'cod_ano_serie_frequentou_memb', + where: { + relation: '=', + type: 'string', + field: 'ano_serie_frequentou', + }, +}) +.addValue({ + name: 'education_families', + table: 'quilombola_eixo_4_ag', + tableField: 'curso_frequentou', + resultField: 'cod_curso_frequentou_pessoa_memb', + where: { + relation: '=', + type: 'string', + field: 'curso_frequentou', + }, +}) +.addValue({ + name: 'uf', + table: 'quilombola_eixo_4_ag', + tableField: 'sigla_estado', + resultField: 'uf', + where: { + relation: '=', + type: 'string', + field: 'sigla_estado', + }, +}) + +.addValue({ + name: 'region', + table: 'quilombola_eixo_4_ag', + tableField : 'nome_regiao', + resultField: 'region', + where: { + relation: '=', + type: 'string', + field: 'nome_regiao', + }, +}) + +.addValue({ + name:'gender', + table:'quilombola_eixo_4_ag', + tableField:'genero', + resultField:'genero', + where: { + relation:'=', + type:'string', + field:'genero', + }, +}) + + +; + + +cad_unico.get('/', rqf.parse(), rqf.build(), (req, res, next) => { + console.log(req.sql.toString()); + req.sql.field('COUNT(distinct id_familia) AS Total') + .from('quilombola_eixo_4_ag'); + next(); +}, query, response('cad_unico')); + +module.exports = cad_unico; diff --git a/src/libs/routes/SMPPIR/indigenas_development.js b/src/libs/routes/SMPPIR/indigenas_development.js new file mode 100644 index 0000000000000000000000000000000000000000..70bd03d6d81b9304b67b9cea9c8dc3e732c78bea --- /dev/null +++ b/src/libs/routes/SMPPIR/indigenas_development.js @@ -0,0 +1,135 @@ +'use strict'; + +/* +Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre +Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR + +This file is part of SMPPIR-Node. + +SMPPIR-Node is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +SMPPIR-Node is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with SMPPIR-Node. If not, see <https://www.gnu.org/licenses/>. +*/ + +var express = require('express'); + +var cad_unico_count = express.Router(); + +var libs = process.cwd() + '/libs'; + +var squel = require('squel'); + +var query = require(libs + '/middlewares/query').query; + +var response = require(libs + '/middlewares/response'); + +var ReqQueryFields = require(libs + '/middlewares/reqQueryFields'); + +var rqf = new ReqQueryFields(); + +rqf.addField({ + name: 'filter', + field: false, + where: true +}).addField({ + name: 'dims', + field: true, + where: false +}).addValue({ + name: 'year', + table: 'indigenas_development_ag', + tableField: 'ano_censo', + resultField: 'ano_pesquisa', + where: { + relation: '=', + type: 'integer', + field: 'ano_censo' + } +}).addValue({ + name: 'family_type', + table: 'indigenas_development_ag', + tableField: 'ind_tipo_familia', + resultField: 'ind_parc_mds_fam', + where: { + relation: '=', + type: 'string', + field: 'ind_tipo_familia' + } +}).addValue({ + name: 'cod_home_bolsa_familia', + table: 'indigenas_development_ag', + tableField: 'marca_programa_bolsa_familia', + resultField: 'marc_pbf', + where: { + relation: '=', + type: 'string', + field: 'marca_programa_bolsa_familia' + } +}).addValue({ + name: 'cod_agriculture_job', + table: 'indigenas_development_ag', + tableField: 'atividade_extrativista', + resultField: 'cod_agricultura_trab_memb', + where: { + relation: '=', + type: 'string', + field: 'atividade_extrativista' + } +}).addValue({ + name: 'per_capita_income', + table: 'indigenas_development_ag', + tableField: 'renda_media', + resultField: 'vlr_renda_media_fam', + where: { + relation: '=', + type: 'float', + field: 'renda_media' + } +}).addValue({ + name: 'home_location', + table: 'indigenas_development_ag', + tableField: 'codigo_ibge', + resultField: 'cd_ibge', + where: { + relation: '=', + type: 'string', + field: 'codigo_ibge' + } +}).addValue({ + name: 'uf', + table: 'indigenas_development_ag', + tableField: 'sigla_estado', + resultField: 'uf', + where: { + relation: '=', + type: 'string', + field: 'sigla_estado' + } +}).addValue({ + name: 'region', + table: 'indigenas_development_ag', + tableField: 'nome_regiao', + resultField: 'region', + where: { + relation: '=', + type: 'string', + field: 'nome_regiao' + } +}); + +cad_unico_count.get('/', rqf.parse(), rqf.build(), function (req, res, next) { + console.log(req.sql.toString()); + req.sql.field('COUNT(distinct id_familia) AS Total').from('indigenas_development_ag'); + next(); +}, query, response('cad_unico')); + +module.exports = cad_unico_count; \ No newline at end of file diff --git a/src/libs/routes/SMPPIR/indigenas_enrollment.js b/src/libs/routes/SMPPIR/indigenas_enrollment.js new file mode 100644 index 0000000000000000000000000000000000000000..4570ff207bd3ccfe38af1a2c8761578e98fd83a9 --- /dev/null +++ b/src/libs/routes/SMPPIR/indigenas_enrollment.js @@ -0,0 +1,155 @@ +'use strict'; + +/* +Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre +Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR + +This file is part of SMPPIR-Node. + +SMPPIR-Node is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +SMPPIR-Node is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with SMPPIR-Node. If not, see <https://www.gnu.org/licenses/>. +*/ + +var express = require('express'); + +var indigenasEnrollmentApp = express.Router(); + +var libs = process.cwd() + '/libs'; + +var squel = require('squel'); + +var query = require(libs + '/middlewares/query').query; + +var response = require(libs + '/middlewares/response'); + +var ReqQueryFields = require(libs + '/middlewares/reqQueryFields'); + +var rqf = new ReqQueryFields(); + +rqf.addField({ + name: 'filter', + field: false, + where: true +}).addField({ + name: 'dims', + field: true, + where: false +}).addValue({ + name: 'year', + table: 'indigenas_schools_ag', + tableField: 'ano_censo', + resultField: 'ano_censo', + where: { + relation: '=', + type: 'integer', + field: 'ano_censo' + } +}).addValue({ + name: 'localizacao_diferenciada', + table: 'indigenas_schools_ag', + tableField: 'localizacao_diferenciada_id', + resultField: 'cod_localizacao_diferenciada', + where: { + relation: '=', + type: 'integer', + field: 'localizacao_diferenciada_id' + } +}).addValue({ + name: 'agua', + table: 'indigenas_schools_ag', + tableField: 'agua_rede_publica', + resultField: 'abastecimento_agua_rede_publica', + where: { + relation: '=', + type: 'string', + field: 'agua_rede_publica' + } +}).addValue({ + name: 'energia', + table: 'indigenas_schools_ag', + tableField: 'energia_rede_publica', + resultField: 'abastecimento_energia_rede_publica', + where: { + relation: '=', + type: 'string', + field: 'energia_rede_publica' + } +}).addValue({ + name: 'esgoto', + table: 'indigenas_schools_ag', + tableField: 'esgoto_rede_publica', + resultField: 'esgotamento_snaitario_rede_publica', + where: { + relation: '=', + type: 'string', + field: 'esgoto_rede_publica' + } +}).addValue({ + name: 'lixo', + table: 'indigenas_schools_ag', + tableField: 'lixo_coleta_periodica', + resultField: 'coleta_lixo_periodica', + where: { + relation: '=', + type: 'string', + field: 'lixo_coleta_periodica' + } +}).addValue({ + name: 'uf', + table: 'indigenas_schools_ag', + tableField: 'sigla', + resultField: 'sigla_uf', + where: { + relation: '=', + type: 'string', + field: 'sigla' + } +}).addValue({ + name: 'id', + table: 'indigenas_schools_ag', + tableField: 'id', + resultField: 'escola_id', + where: { + relation: '=', + type: 'string', + field: 'id' + } +}).addValue({ + name: 'etapa_ensino', + table: 'indigenas_schools_ag', + tableField: 'etapa_ensino', + resultField: 'etapa_ensino', + where: { + relation: '=', + type: 'string', + field: 'etapa_ensino' + } +}).addValue({ + name: 'modalidade_ensino', + table: 'indigenas_schools_ag', + tableField: 'modalidade_ensino', + resultField: 'modalidade_ensino', + where: { + relation: '=', + type: 'integer', + field: 'modalidade_ensino' + } +}); + +indigenasEnrollmentApp.get('/', rqf.parse(), rqf.build(), function (req, res, next) { + console.log(req.sql.toString()); + req.sql.field('SUM(total) AS Total').from('indigenas_schools_ag'); + next(); +}, query, response('indigenas_mat')); + +module.exports = indigenasEnrollmentApp; \ No newline at end of file diff --git a/src/libs/routes/SMPPIR/indigenas_infrastructure.js b/src/libs/routes/SMPPIR/indigenas_infrastructure.js new file mode 100644 index 0000000000000000000000000000000000000000..470d436663e1e1bb088517d9ed7bc82563821e74 --- /dev/null +++ b/src/libs/routes/SMPPIR/indigenas_infrastructure.js @@ -0,0 +1,155 @@ +'use strict'; + +/* +Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre +Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR + +This file is part of SMPPIR-Node. + +SMPPIR-Node is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +SMPPIR-Node is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with SMPPIR-Node. If not, see <https://www.gnu.org/licenses/>. +*/ + +var express = require('express'); + +var cad_unico = express.Router(); + +var libs = process.cwd() + '/libs'; + +var squel = require('squel'); + +var query = require(libs + '/middlewares/query').query; + +var response = require(libs + '/middlewares/response'); + +var ReqQueryFields = require(libs + '/middlewares/reqQueryFields'); + +var rqf = new ReqQueryFields(); + +rqf.addField({ + name: 'filter', + field: false, + where: true +}).addField({ + name: 'dims', + field: true, + where: false +}).addValue({ + name: 'year', + table: 'indigenas_infrastructure_ag', + tableField: 'ano_censo', + resultField: 'ano_pesquisa', + where: { + relation: '=', + type: 'integer', + field: 'ano_censo' + } +}).addValue({ + name: 'family_type', + table: 'indigenas_infrastructure_ag', + tableField: 'ind_tipo_familia', + resultField: 'ind_parc_mds_fam', + where: { + relation: '=', + type: 'string', + field: 'ind_tipo_familia' + } +}).addValue({ + name: 'cod_local_home', + table: 'indigenas_infrastructure_ag', + tableField: 'cod_local_domicilio', + resultField: 'cod_local_domic_fam', + where: { + relation: '=', + type: 'string', + field: 'cod_local_domicilio' + } +}).addValue({ + name: 'cod_home_lighting', + table: 'indigenas_infrastructure_ag', + tableField: 'cod_iluminacao_domicilio', + resultField: 'cod_iluminacao_domic_fam', + where: { + relation: '=', + type: 'string', + field: 'cod_iluminacao_domicilio' + } +}).addValue({ + name: 'cod_home_trash_destiny', + table: 'indigenas_infrastructure_ag', + tableField: 'cod_destino_lixo_domicilio', + resultField: 'cod_destino_lixo_domic_fam', + where: { + relation: '=', + type: 'string', + field: 'cod_destino_lixo_domicilio' + } +}).addValue({ + name: 'cod_home_watter_supply', + table: 'indigenas_infrastructure_ag', + tableField: 'cod_abastecimento_agua_domicilio', + resultField: 'cod_abaste_agua_domic_fam', + where: { + relation: '=', + type: 'string', + field: 'cod_abastecimento_agua_domicilio' + } +}).addValue({ + name: 'home_type', + table: 'indigenas_infrastructure_ag', + tableField: 'cod_especie_domicilio', + resultField: 'cod_especie_domic_fam', + where: { + relation: '=', + type: 'string', + field: 'cod_especie_domicilio' + } +}).addValue({ + name: 'uf', + table: 'indigenas_infrastructure_ag', + tableField: 'sigla_estado', + resultField: 'uf', + where: { + relation: '=', + type: 'string', + field: 'sigla_estado' + } +}).addValue({ + name: 'region', + table: 'indigenas_infrastructure_ag', + tableField: 'nome_regiao', + resultField: 'region', + where: { + relation: '=', + type: 'string', + field: 'nome_regiao' + } +}).addValue({ + name: 'cod_sanitary_dump', + table: 'indigenas_infrastructure_ag', + tableField: 'cod_escoa_sanitario_domicilio', + resultField: 'cod_escoa_sanitario_domic_fam', + where: { + relation: '=', + type: 'string', + field: 'cod_escoa_sanitario_domic_fam' + } +}); + +cad_unico.get('/', rqf.parse(), rqf.build(), function (req, res, next) { + console.log(req.sql.toString()); + req.sql.field('SUM(total) AS Total').from('indigenas_infrastructure_ag'); + next(); +}, query, response('cad_unico')); + +module.exports = cad_unico; \ No newline at end of file diff --git a/src/libs/routes/SMPPIR/indigenas_rights.js b/src/libs/routes/SMPPIR/indigenas_rights.js new file mode 100644 index 0000000000000000000000000000000000000000..478b05f48b16bab3315ec80ef4d0b1ed08bbd19b --- /dev/null +++ b/src/libs/routes/SMPPIR/indigenas_rights.js @@ -0,0 +1,135 @@ +'use strict'; + +/* +Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre +Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR + +This file is part of SMPPIR-Node. + +SMPPIR-Node is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +SMPPIR-Node is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with SMPPIR-Node. If not, see <https://www.gnu.org/licenses/>. +*/ + +var express = require('express'); + +var cad_unico = express.Router(); + +var libs = process.cwd() + '/libs'; + +var squel = require('squel'); + +var query = require(libs + '/middlewares/query').query; + +var response = require(libs + '/middlewares/response'); + +var ReqQueryFields = require(libs + '/middlewares/reqQueryFields'); + +var rqf = new ReqQueryFields(); + +rqf.addField({ + name: 'filter', + field: false, + where: true +}).addField({ + name: 'dims', + field: true, + where: false +}).addValue({ + name: 'year', + table: 'indigenas_rights_ag', + tableField: 'ano_censo', + resultField: 'ano_pesquisa', + where: { + relation: '=', + type: 'integer', + field: 'ano_censo' + } +}).addValue({ + name: 'age', + table: 'indigenas_rights_ag', + tableField: 'idade', + resultField: 'idade', + where: { + relation: '=', + type: 'string', + field: 'idade' + } +}).addValue({ + name: 'education_families_conclude', + table: 'indigenas_rights_ag', + tableField: 'concluiu_frequentou', + resultField: 'cod_concluiu_frequentou_memb', + where: { + relation: '=', + type: 'string', + field: 'concluiu_frequentou' + } +}).addValue({ + name: 'education_families_level', + table: 'indigenas_rights_ag', + tableField: 'ano_serie_frequentou', + resultField: 'cod_ano_serie_frequentou_memb', + where: { + relation: '=', + type: 'string', + field: 'ano_serie_frequentou' + } +}).addValue({ + name: 'education_families', + table: 'indigenas_rights_ag', + tableField: 'curso_frequentou', + resultField: 'cod_curso_frequentou_pessoa_memb', + where: { + relation: '=', + type: 'string', + field: 'curso_frequentou' + } +}).addValue({ + name: 'uf', + table: 'indigenas_rights_ag', + tableField: 'sigla_estado', + resultField: 'uf', + where: { + relation: '=', + type: 'string', + field: 'sigla_estado' + } +}).addValue({ + name: 'region', + table: 'indigenas_rights_ag', + tableField: 'nome_regiao', + resultField: 'region', + where: { + relation: '=', + type: 'string', + field: 'nome_regiao' + } +}).addValue({ + name: 'gender', + table: 'indigenas_rights_ag', + tableField: 'genero', + resultField: 'genero', + where: { + relation: '=', + type: 'string', + field: 'genero' + } +}); + +cad_unico.get('/', rqf.parse(), rqf.build(), function (req, res, next) { + console.log(req.sql.toString()); + req.sql.field('SUM(total) AS Total').from('indigenas_rights_ag'); + next(); +}, query, response('cad_unico')); + +module.exports = cad_unico; \ No newline at end of file diff --git a/src/libs/routes/SMPPIR/indigenas_schools.js b/src/libs/routes/SMPPIR/indigenas_schools.js new file mode 100644 index 0000000000000000000000000000000000000000..51257142e7b34bada5c052c859fcb4b4c6f18ca8 --- /dev/null +++ b/src/libs/routes/SMPPIR/indigenas_schools.js @@ -0,0 +1,145 @@ +'use strict'; + +/* +Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre +Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR + +This file is part of SMPPIR-Node. + +SMPPIR-Node is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +SMPPIR-Node is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with SMPPIR-Node. If not, see <https://www.gnu.org/licenses/>. +*/ + +var express = require('express'); + +var indigenasSchoolsApp = express.Router(); + +var libs = process.cwd() + '/libs'; + +var squel = require('squel'); + +var query = require(libs + '/middlewares/query').query; + +var response = require(libs + '/middlewares/response'); + +var ReqQueryFields = require(libs + '/middlewares/reqQueryFields'); + +var rqf = new ReqQueryFields(); + +rqf.addField({ + name: 'filter', + field: false, + where: true +}).addField({ + name: 'dims', + field: true, + where: false +}).addValue({ + name: 'year', + table: 'indigenas_schools_ag', + tableField: 'ano_censo', + resultField: 'ano_censo', + where: { + relation: '=', + type: 'integer', + field: 'ano_censo' + } +}).addValue({ + name: 'localizacao_diferenciada', + table: 'indigenas_schools_ag', + tableField: 'localizacao_diferenciada_id', + resultField: 'cod_localizacao_diferenciada', + where: { + relation: '=', + type: 'integer', + field: 'localizacao_diferenciada_id' + } +}).addValue({ + name: 'agua', + table: 'indigenas_schools_ag', + tableField: 'agua_rede_publica', + resultField: 'abastecimento_agua_rede_publica', + where: { + relation: '=', + type: 'string', + field: 'agua_rede_publica' + } +}).addValue({ + name: 'energia', + table: 'indigenas_schools_ag', + tableField: 'energia_rede_publica', + resultField: 'abastecimento_energia_rede_publica', + where: { + relation: '=', + type: 'string', + field: 'energia_rede_publica' + } +}).addValue({ + name: 'esgoto', + table: 'indigenas_schools_ag', + tableField: 'esgoto_rede_publica', + resultField: 'esgotamento_snaitario_rede_publica', + where: { + relation: '=', + type: 'string', + field: 'esgoto_rede_publica' + } +}).addValue({ + name: 'lixo', + table: 'indigenas_schools_ag', + tableField: 'lixo_coleta_periodica', + resultField: 'coleta_lixo_periodica', + where: { + relation: '=', + type: 'string', + field: 'lixo_coleta_periodica' + } +}).addValue({ + name: 'uf', + table: 'indigenas_schools_ag', + tableField: 'sigla', + resultField: 'sigla_uf', + where: { + relation: '=', + type: 'string', + field: 'sigla' + } +}).addValue({ + name: 'id', + table: 'indigenas_schools_ag', + tableField: 'id', + resultField: 'escola_id', + where: { + relation: '=', + type: 'string', + field: 'id' + } +}).addValue({ + name: 'etapa_ensino', + table: 'indigenas_schools_ag', + tableField: 'etapa_ensino', + resultField: 'etapa_ensino', + where: { + relation: '=', + type: 'string', + field: 'etapa_ensino' + } +}); + +indigenasSchoolsApp.get('/', rqf.parse(), rqf.build(), function (req, res, next) { + console.log(req.sql.toString()); + req.sql.field('COUNT(distinct id) AS Total').from('indigenas_schools_ag'); + next(); +}, query, response('indigenas_esc')); + +module.exports = indigenasSchoolsApp; \ No newline at end of file diff --git a/src/libs/routes/SMPPIR/indigenas_territorial.js b/src/libs/routes/SMPPIR/indigenas_territorial.js new file mode 100644 index 0000000000000000000000000000000000000000..e5274dbf89fd62a0c08c2200d7f23580ff611a02 --- /dev/null +++ b/src/libs/routes/SMPPIR/indigenas_territorial.js @@ -0,0 +1,145 @@ +'use strict'; + +/* +Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre +Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR + +This file is part of SMPPIR-Node. + +SMPPIR-Node is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +SMPPIR-Node is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with SMPPIR-Node. If not, see <https://www.gnu.org/licenses/>. +*/ + +var express = require('express'); + +var indigenasTerritorialApp = express.Router(); + +var libs = process.cwd() + '/libs'; + +var squel = require('squel'); + +var query = require(libs + '/middlewares/query').query; + +var response = require(libs + '/middlewares/response'); + +var ReqQueryFields = require(libs + '/middlewares/reqQueryFields'); + +var rqf = new ReqQueryFields(); + +rqf.addField({ + name: 'filter', + field: false, + where: true +}).addField({ + name: 'dims', + field: true, + where: false +}).addValue({ + name: 'year', + table: 'indigenas_territorial_ag', + tableField: 'ano', + resultField: 'ano_divulgacao', + where: { + relation: '=', + type: 'integer', + field: 'ano' + } +}).addValue({ + name: 'local_name', + table: 'indigenas_territorial_ag', + tableField: 'nome_terra', + resultField: 'nome_terra_indigena', + where: { + relation: '=', + type: 'string', + field: 'nome_terra' + } +}).addValue({ + name: 'ethnic_name', + table: 'indigenas_territorial_ag', + tableField: 'nome_etnia', + resultField: 'etnia_indigena', + where: { + relation: '=', + type: 'string', + field: 'nome_etnia' + } +}).addValue({ + name: 'uf', + table: 'indigenas_territorial_ag', + tableField: 'sigla_uf', + resultField: 'unidade_federativa', + where: { + relation: 'LIKE', + type: 'like_string', + field: 'sigla_uf' + } +}).addValue({ + name: 'area', + table: 'indigenas_territorial_ag', + tableField: 'tamanho_superficie', + resultField: 'superficie(ha)', + where: { + relation: '=', + type: 'string', + field: 'tamanho_superficie' + } +}).addValue({ + name: 'process_stage', + table: 'indigenas_territorial_ag', + tableField: 'fase_procedimento', + resultField: 'fase_do_procedimento', + where: { + relation: '=', + type: 'string', + field: 'fase_procedimento' + } +}).addValue({ + name: 'modality', + table: 'indigenas_territorial_ag', + tableField: 'tipo_modalidade', + resultField: 'tipo_modalidade', + where: { + relation: '=', + type: 'string', + field: 'tipo_modalidade' + } +}).addValue({ + name: 'county', + table: 'indigenas_territorial_ag', + tableField: 'nome_municipio', + resultField: 'nome_municipio', + where: { + relation: '=', + type: 'string', + field: 'nome_municipio' + } +}).addValue({ + name: 'region', + table: 'indigenas_territorial_ag', + tableField: 'regiao', + resultField: 'nome_regiao', + where: { + relation: 'LIKE', + type: 'like_string', + field: 'regiao' + } +}); + +indigenasTerritorialApp.get('/', rqf.parse(), rqf.build(), function (req, res, next) { + console.log(req.sql.toString()); + req.sql.field('COUNT(*) AS Total').from('indigenas_territorial_ag'); + next(); +}, query, response('terras_ind')); + +module.exports = indigenasTerritorialApp; \ No newline at end of file diff --git a/src/libs/routes/SMPPIR/institution.js b/src/libs/routes/SMPPIR/institution.js index 2222548ff05816906a61a0940593ffc2bf3d4005..ae7bc0a8e0726bc0c8a173181650576c03ff4299 100644 --- a/src/libs/routes/SMPPIR/institution.js +++ b/src/libs/routes/SMPPIR/institution.js @@ -101,9 +101,11 @@ rqf.addField({ institution.get('/', rqf.parse(), rqf.build(), (req, res, next) => { req.sql.field('nome_ies AS no_ies') + .field('sigla_ies AS sgl_ies') .field('cod_ies AS co_ies') .from('institution_ag') .group('nome_ies') + .group('sigla_ies') .group('cod_ies') .order('nome_ies'); next(); diff --git a/src/libs/routes/SMPPIR/quilombola_enrollment.js b/src/libs/routes/SMPPIR/quilombola_enrollment.js new file mode 100644 index 0000000000000000000000000000000000000000..a41bab05117ffbadc085b61c7ded7bd031579585 --- /dev/null +++ b/src/libs/routes/SMPPIR/quilombola_enrollment.js @@ -0,0 +1,145 @@ +'use strict'; + +/* +Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre +Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR + +This file is part of SMPPIR-Node. + +SMPPIR-Node is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +SMPPIR-Node is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with SMPPIR-Node. If not, see <https://www.gnu.org/licenses/>. +*/ + +var express = require('express'); + +var quilombolaEnrollmentApp = express.Router(); + +var libs = process.cwd() + '/libs'; + +var squel = require('squel'); + +var query = require(libs + '/middlewares/query').query; + +var response = require(libs + '/middlewares/response'); + +var ReqQueryFields = require(libs + '/middlewares/reqQueryFields'); + +var rqf = new ReqQueryFields(); + +rqf.addField({ + name: 'filter', + field: false, + where: true +}).addField({ + name: 'dims', + field: true, + where: false +}).addValue({ + name: 'year', + table: 'quilombola_schools_ag', + tableField: 'ano_censo', + resultField: 'ano_censo', + where: { + relation: '=', + type: 'integer', + field: 'ano_censo' + } +}).addValue({ + name: 'localizacao_diferenciada', + table: 'quilombola_schools_ag', + tableField: 'localizacao_diferenciada_id', + resultField: 'cod_localizacao_diferenciada', + where: { + relation: '=', + type: 'integer', + field: 'localizacao_diferenciada_id' + } +}).addValue({ + name: 'agua', + table: 'quilombola_schools_ag', + tableField: 'agua_rede_publica', + resultField: 'abastecimento_agua_rede_publica', + where: { + relation: '=', + type: 'string', + field: 'agua_rede_publica' + } +}).addValue({ + name: 'energia', + table: 'quilombola_schools_ag', + tableField: 'energia_rede_publica', + resultField: 'abastecimento_energia_rede_publica', + where: { + relation: '=', + type: 'string', + field: 'energia_rede_publica' + } +}).addValue({ + name: 'esgoto', + table: 'quilombola_schools_ag', + tableField: 'esgoto_rede_publica', + resultField: 'esgotamento_snaitario_rede_publica', + where: { + relation: '=', + type: 'string', + field: 'esgoto_rede_publica' + } +}).addValue({ + name: 'lixo', + table: 'quilombola_schools_ag', + tableField: 'lixo_coleta_periodica', + resultField: 'coleta_lixo_periodica', + where: { + relation: '=', + type: 'string', + field: 'lixo_coleta_periodica' + } +}).addValue({ + name: 'uf', + table: 'quilombola_schools_ag', + tableField: 'sigla', + resultField: 'sigla_uf', + where: { + relation: '=', + type: 'string', + field: 'sigla' + } +}).addValue({ + name: 'id', + table: 'quilombola_schools_ag', + tableField: 'id', + resultField: 'escola_id', + where: { + relation: '=', + type: 'string', + field: 'id' + } +}).addValue({ + name: 'etapa_ensino', + table: 'quilombola_schools_ag', + tableField: 'etapa_ensino', + resultField: 'etapa_ensino', + where: { + relation: '=', + type: 'string', + field: 'etapa_ensino' + } +}); + +quilombolaEnrollmentApp.get('/', rqf.parse(), rqf.build(), function (req, res, next) { + console.log(req.sql.toString()); + req.sql.field('SUM(total) AS Total').from('quilombola_schools_ag'); + next(); +}, query, response('quilombola_mat')); + +module.exports = quilombolaEnrollmentApp; \ No newline at end of file diff --git a/src/libs/routes/SMPPIR/quilombola_schools.js b/src/libs/routes/SMPPIR/quilombola_schools.js new file mode 100644 index 0000000000000000000000000000000000000000..386653578e318cfa96a4de3e3d4359add32f28d5 --- /dev/null +++ b/src/libs/routes/SMPPIR/quilombola_schools.js @@ -0,0 +1,145 @@ +'use strict'; + +/* +Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre +Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR + +This file is part of SMPPIR-Node. + +SMPPIR-Node is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +SMPPIR-Node is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with SMPPIR-Node. If not, see <https://www.gnu.org/licenses/>. +*/ + +var express = require('express'); + +var quilombolaSchoolsApp = express.Router(); + +var libs = process.cwd() + '/libs'; + +var squel = require('squel'); + +var query = require(libs + '/middlewares/query').query; + +var response = require(libs + '/middlewares/response'); + +var ReqQueryFields = require(libs + '/middlewares/reqQueryFields'); + +var rqf = new ReqQueryFields(); + +rqf.addField({ + name: 'filter', + field: false, + where: true +}).addField({ + name: 'dims', + field: true, + where: false +}).addValue({ + name: 'year', + table: 'quilombola_schools_ag', + tableField: 'ano_censo', + resultField: 'ano_censo', + where: { + relation: '=', + type: 'integer', + field: 'ano_censo' + } +}).addValue({ + name: 'localizacao_diferenciada', + table: 'quilombola_schools_ag', + tableField: 'localizacao_diferenciada_id', + resultField: 'cod_localizacao_diferenciada', + where: { + relation: '=', + type: 'integer', + field: 'localizacao_diferenciada_id' + } +}).addValue({ + name: 'agua', + table: 'quilombola_schools_ag', + tableField: 'agua_rede_publica', + resultField: 'abastecimento_agua_rede_publica', + where: { + relation: '=', + type: 'string', + field: 'agua_rede_publica' + } +}).addValue({ + name: 'energia', + table: 'quilombola_schools_ag', + tableField: 'energia_rede_publica', + resultField: 'abastecimento_energia_rede_publica', + where: { + relation: '=', + type: 'string', + field: 'energia_rede_publica' + } +}).addValue({ + name: 'esgoto', + table: 'quilombola_schools_ag', + tableField: 'esgoto_rede_publica', + resultField: 'esgotamento_snaitario_rede_publica', + where: { + relation: '=', + type: 'string', + field: 'esgoto_rede_publica' + } +}).addValue({ + name: 'lixo', + table: 'quilombola_schools_ag', + tableField: 'lixo_coleta_periodica', + resultField: 'coleta_lixo_periodica', + where: { + relation: '=', + type: 'string', + field: 'lixo_coleta_periodica' + } +}).addValue({ + name: 'uf', + table: 'quilombola_schools_ag', + tableField: 'sigla', + resultField: 'sigla_uf', + where: { + relation: '=', + type: 'string', + field: 'sigla' + } +}).addValue({ + name: 'id', + table: 'quilombola_schools_ag', + tableField: 'id', + resultField: 'escola_id', + where: { + relation: '=', + type: 'string', + field: 'id' + } +}).addValue({ + name: 'etapa_ensino', + table: 'quilombola_schools_ag', + tableField: 'etapa_ensino', + resultField: 'etapa_ensino', + where: { + relation: '=', + type: 'string', + field: 'etapa_ensino' + } +}); + +quilombolaSchoolsApp.get('/', rqf.parse(), rqf.build(), function (req, res, next) { + console.log(req.sql.toString()); + req.sql.field('COUNT(distinct id) AS Total').from('quilombola_schools_ag'); + next(); +}, query, response('quilombola_esc')); + +module.exports = quilombolaSchoolsApp; \ No newline at end of file diff --git a/src/libs/routes/SMPPIR/social_support.js b/src/libs/routes/SMPPIR/social_support.js index 4a5752646203a012d2c2fc92fb7b0190a2c3835b..6d55304f039b2d643ba57e2fd256dfa4ab72ae8b 100644 --- a/src/libs/routes/SMPPIR/social_support.js +++ b/src/libs/routes/SMPPIR/social_support.js @@ -177,6 +177,17 @@ rqf.addField({ field: 'apoio_transporte', }, }) +.addValue({ + name: 'quota', + table: 'social_support_ag', + tableField: 'reserva_vagas', + resultField: 'reserva_vagas', + where: { + relation: '=', + type: 'string', + field: 'reserva_vagas', + }, +}) .addValue({ name: 'year', table: 'social_support_ag', @@ -209,6 +220,28 @@ rqf.addField({ type: 'integer', field: 'ano_censo', }, +}) +.addValue({ + name: 'region', + table: 'social_support_ag', + tableField: 'nome_regiao_ies', + resultField: 'region', + where: { + relation: '=', + type: 'string', + field: 'nome_regiao_ies', + }, +}) +.addValue({ + name: 'uf', + table: 'social_support_ag', + tableField: 'sigla_uf_ies', + resultField: 'uf', + where: { + relation: '=', + type: 'string', + field: 'sigla_uf_ies', + }, }); social_supportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => { diff --git a/src/libs/routes/SMPPIR/taxa_homicidios.js b/src/libs/routes/SMPPIR/taxa_homicidios.js index 258ccdf28800e1200e2d8298a480ef22212622fd..f1c4d93a8bee3e755bea567e9bfe66eb32b15070 100644 --- a/src/libs/routes/SMPPIR/taxa_homicidios.js +++ b/src/libs/routes/SMPPIR/taxa_homicidios.js @@ -78,6 +78,30 @@ rqf.addField({ field: 'raca_cor', }, }) + +.addValue({ + name: 'min_idade', + table: 'taxa_homicidios', + tableField: 'idade_obito_anos', + resultField: 'idade', + where: { + relation: '>=', + type: 'integer', + field: 'idade_obito_anos', + }, +}) +.addValue({ + name: 'max_idade', + table: 'taxa_homicidios', + tableField: 'idade_obito_anos', + resultField: 'idade', + where: { + relation: '<=', + type: 'integer', + field: 'idade_obito_anos', + }, +}) + router.get('/', rqf.parse(), rqf.build(), (req, res, next) => { console.log(req.sql.toString()); req.sql.field( diff --git a/src/libs/routes/SMPPIR/traditional_families.js b/src/libs/routes/SMPPIR/traditional_families.js new file mode 100644 index 0000000000000000000000000000000000000000..67704975f626667c436f2940f769356f2e2e31e2 --- /dev/null +++ b/src/libs/routes/SMPPIR/traditional_families.js @@ -0,0 +1,130 @@ +/* +Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre +Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR + +This file is part of SMPPIR-Node. + +SMPPIR-Node is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +SMPPIR-Node is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with SMPPIR-Node. If not, see <https://www.gnu.org/licenses/>. +*/ + + + +const express = require('express'); + +const cad_unico = express.Router(); + +const libs = `${process.cwd()}/libs`; + +const squel = require('squel'); + +const query = require(`${libs}/middlewares/query`).query; + +const response = require(`${libs}/middlewares/response`); + +const ReqQueryFields = require(`${libs}/middlewares/reqQueryFields`); + +const rqf = new ReqQueryFields(); + +rqf.addField({ + name: 'filter', + field: false, + where: true, +}).addField({ + name: 'dims', + field: true, + where: false, +}) +.addValue({ + name: 'year', + table: 'traditional_families_ag', + tableField: 'ano_censo', + resultField: 'ano_pesquisa', + where: { + relation: '=', + type: 'integer', + field: 'ano_censo', + }, +}) + +.addValue({ + name: 'family_type', + table: 'traditional_families_ag', + tableField: 'ind_tipo_familia', + resultField: 'ind_parc_mds_fam', + where: { + relation: '=', + type: 'string', + field: 'ind_tipo_familia', + }, +}) + +.addValue({ + name: 'per_capita_income', + table: 'traditional_families_ag', + tableField: 'renda_media', + resultField: 'vlr_renda_media_fam', + where: { + relation: '=', + type: 'float', + field: 'renda_media', + }, +}) + +.addValue({ + name: 'home_type', + table: 'traditional_families_ag', + tableField: 'cod_especie_domicilio', + resultField: 'cod_especie_domic_fam', + where: { + relation: '=', + type: 'string', + field: 'cod_especie_domicilio', + }, +}) + +.addValue({ + name: 'uf', + table: 'traditional_families_ag', + tableField: 'sigla_estado', + resultField: 'uf', + where: { + relation: '=', + type: 'string', + field: 'sigla_estado', + }, +}) +.addValue({ + name: 'region', + table: 'traditional_families_ag', + tableField : 'nome_regiao', + resultField: 'region', + where: { + relation: '=', + type: 'string', + field: 'nome_regiao', + }, +}) + +; + + +cad_unico.get('/', rqf.parse(), rqf.build(), (req, res, next) => { + console.log(req.sql.toString()); + // Use COUNT to get Family and SUM to get people, as the indicator needs families, COUNT is being used. + req.sql.field('COUNT(DISTINCT id_familia) AS Total') + .from('traditional_families_ag'); + next(); +}, query, response('cad_unico')); + +module.exports = cad_unico; diff --git a/src/libs/routes/SMPPIR/traditional_families_people.js b/src/libs/routes/SMPPIR/traditional_families_people.js new file mode 100644 index 0000000000000000000000000000000000000000..17549dd8a1311c788b7fa187bbe2bf857f323342 --- /dev/null +++ b/src/libs/routes/SMPPIR/traditional_families_people.js @@ -0,0 +1,118 @@ +/* +Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre +Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR + +This file is part of SMPPIR-Node. + +SMPPIR-Node is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +SMPPIR-Node is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with SMPPIR-Node. If not, see <https://www.gnu.org/licenses/>. +*/ + + + +const express = require('express'); + +const cad_unico = express.Router(); + +const libs = `${process.cwd()}/libs`; + +const squel = require('squel'); + +const query = require(`${libs}/middlewares/query`).query; + +const response = require(`${libs}/middlewares/response`); + +const ReqQueryFields = require(`${libs}/middlewares/reqQueryFields`); + +const rqf = new ReqQueryFields(); + +rqf.addField({ + name: 'filter', + field: false, + where: true, +}).addField({ + name: 'dims', + field: true, + where: false, +}) +.addValue({ + name: 'year', + table: 'traditional_families_ag', + tableField: 'ano_censo', + resultField: 'ano_pesquisa', + where: { + relation: '=', + type: 'integer', + field: 'ano_censo', + }, +}) + +.addValue({ + name: 'education_families', + table: 'traditional_families_ag', + tableField: 'curso_frequentou', + resultField: 'cod_curso_frequentou_pessoa_memb', + where: { + relation: '=', + type: 'string', + field: 'curso_frequentou', + }, +}) + +.addValue({ + name: 'family_type', + table: 'traditional_families_ag', + tableField: 'ind_tipo_familia', + resultField: 'ind_parc_mds_fam', + where: { + relation: '=', + type: 'string', + field: 'ind_tipo_familia', + }, +}) + +.addValue({ + name: 'uf', + table: 'traditional_families_ag', + tableField: 'sigla_estado', + resultField: 'uf', + where: { + relation: '=', + type: 'string', + field: 'sigla_estado', + }, +}) +.addValue({ + name: 'region', + table: 'traditional_families_ag', + tableField : 'nome_regiao', + resultField: 'region', + where: { + relation: '=', + type: 'string', + field: 'nome_regiao', + }, +}) + +; + + +cad_unico.get('/', rqf.parse(), rqf.build(), (req, res, next) => { + console.log(req.sql.toString()); + // Use COUNT to get Family and SUM to get people, as the indicator needs families, COUNT is being used. + req.sql.field('SUM(total) AS Total') + .from('traditional_families_ag'); + next(); +}, query, response('cad_unico')); + +module.exports = cad_unico; diff --git a/src/libs/routes/api.js b/src/libs/routes/api.js index 27f59dd7a499a69445157c15814a95a7ffe4fd38..a08e0a42815f659772f1d78c08b6d587090964b7 100644 --- a/src/libs/routes/api.js +++ b/src/libs/routes/api.js @@ -74,6 +74,12 @@ const eixo_3 = require(`${libs}/routes/SMPPIR/eixo_3`) const eixo_4 = require(`${libs}/routes/SMPPIR/eixo_4`) +const eixo_2_count = require(`${libs}/routes/SMPPIR/eixo_2_count`) + +const eixo_3_count = require(`${libs}/routes/SMPPIR/eixo_3_count`) + +const eixo_4_count = require(`${libs}/routes/SMPPIR/eixo_4_count`) + const african_rights = require(`${libs}/routes/SMPPIR/african_rights`) const african_culture = require(`${libs}/routes/SMPPIR/african_culture`) @@ -94,8 +100,14 @@ const youth_education = require(`${libs}/routes/SMPPIR/youth_education`) const sim = require(`${libs}/routes/SMPPIR/sim`) +const education = require(`${libs}/routes/SMPPIR/education`) + const taxa_homicidios = require(`${libs}/routes/SMPPIR/taxa_homicidios`) +const traditional_families = require(`${libs}/routes/SMPPIR/traditional_families`) + +const traditional_families_people = require(`${libs}/routes/SMPPIR/traditional_families_people`) + const universityEnrollment = require(`${libs}/routes/universityEnrollment`); const courseCount = require(`${libs}/routes/courseCount`); @@ -104,6 +116,22 @@ const university = require(`${libs}/routes/university`); const universityTeacher = require(`${libs}/routes/universityTeacher`); +const indigenas_infrastructure = require(`${libs}/routes/SMPPIR/indigenas_infrastructure`); + +const indigenas_development = require(`${libs}/routes/SMPPIR/indigenas_development`); + +const indigenas_rights = require(`${libs}/routes/SMPPIR/indigenas_rights`); + +const indigenas_territorial = require(`${libs}/routes/SMPPIR/indigenas_territorial`); + +const indigenas_schools = require(`${libs}/routes/SMPPIR/indigenas_schools`); + +const indigenas_enrollment = require(`${libs}/routes/SMPPIR/indigenas_enrollment`); + +const quilombola_schools = require(`${libs}/routes/SMPPIR/quilombola_schools`); + +const quilombola_enrollment = require(`${libs}/routes/SMPPIR/quilombola_enrollment`); + api.get('/', (req, res) => { res.json({ msg: 'SMPPIR API is running' }); }); @@ -133,6 +161,9 @@ api.use('/vacancy', vacancies); api.use('/eixo_2', eixo_2); api.use('/eixo_3', eixo_3); api.use('/eixo_4', eixo_4); +api.use('/eixo_2_count', eixo_2_count); +api.use('/eixo_3_count', eixo_3_count); +api.use('/eixo_4_count', eixo_4_count); api.use('/african_rights', african_rights); api.use('/african_culture', african_culture); api.use('/african_sustentability', african_sustentability); @@ -143,6 +174,17 @@ api.use('/ciganos_sustentability', ciganos_sustentability); api.use('/youth_jobs', youth_jobs) api.use('/youth_education', youth_education) api.use('/sim', sim) +api.use('/education', education) api.use('/taxa_homicidios', taxa_homicidios) +api.use('/traditional_families', traditional_families) +api.use('/traditional_families_people', traditional_families_people) +api.use('/indigenas_infrastructure', indigenas_infrastructure) +api.use('/indigenas_development', indigenas_development) +api.use('/indigenas_rights', indigenas_rights) +api.use('/indigenas_territorial', indigenas_territorial) +api.use('/indigenas_schools', indigenas_schools) +api.use('/indigenas_enrollment', indigenas_enrollment) +api.use('/quilombola_schools', quilombola_schools) +api.use('/quilombola_enrollment', quilombola_enrollment) module.exports = api;