Coder Social home page Coder Social logo

barbaracalderon / dou-rest-api Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 7.74 MB

The "Diário Oficial da União" (DOU) Web Restful API developed in the thesis for the bachelor's degree in Information Systems at UFSC. This is a mock API project, as it focuses on a limited dataset spanning of three days.

Home Page: https://dou-rest-api.onrender.com/

Python 59.71% CSS 3.92% HTML 35.36% Shell 0.13% Mako 0.87%
diario-oficial-da-uniao dou flask-api flask-application flask-rest-api flask-sqlalchemy python rest-api web-restful-api api flask

dou-rest-api's Introduction

English/Português.

Diário Oficial da União Web Restful API

https://dou-rest-api.onrender.com

The DOU Web Restful API landing page

About

Welcome to the repository that hosts the API and its landing page for the project Diário Oficial da União (DOU) Web Restful API.

This API was developed as part of the Undergraduate Thesis (TCC) in Information Systems at the Federal University of Santa Catarina (UFSC). The project was implemented in the semester 2023.2 and supervised by Prof. José Eduardo De Lucca.

PS: Unlike the version in the thesis, this API version adopts JSON Web Tokens (JWT) as an authentication and authorization mechanism.

Project Overview

The Diário Oficial da União (DOU) serves as an official communication medium of the Brazilian state to its nationals and interested parties, established in 1862. Traditionally printed by the National Press, the DOU underwent a transformation in 2017, becoming fully digitized and accessible only online.

This work focuses on a case study capturing data from DOUs between 2020-2022. The project provides accessibility through a Web Restful API using the Swagger framework for documentation. Due to technical limitations and the use of free resources, this pilot project could not meet the two-year temporality. Thus, the temporal scope was reduced to 3 days of data: September 1, 4, and 5, year 2023, serving as an initial proof of concept to demonstrate not only the functionality but also the potential of the project and its scalability.

For this project, a data model was developed to extract information about signers of documents in a DOU article, the type of its publication (dispatch, ordinance, etc.), main category (ministry, secretariat, etc.), publication date, and more.

Research Objectives

Project

The research proposal aimed to demonstrate the possibility of making open data accessible to researchers and interested parties for large-scale data analysis. Key features of the API include:

  • Capture of 3 day DOU data
  • Accessibility through a Web Restful API
  • Documentation using the Swagger framework
  • Querying the database for data analysis
  • Search functionality based on temporal criteria, category, type of matter, number of "article," and signers.

Information and Contact

Techs Used

  • Python
  • Javascript
  • CSS
  • HTML
  • Flask
  • Flask Smorest
  • Flask Migrate
  • Flask JWT Extended
  • SQLAlchemy
  • Marshmallow
  • GUnicorn
  • Psycopg2
  • PostgreSQL
  • Passlib

The project was mainly developed in Python. The landing page, its structure and style, was done in HTML and CSS. Some Javascript was used to add the changing languages functionality.

The API was created with Flask, a micro web framework for Python that provides essentials for building web applications. The Smorest extension of Flask adds a support building Restful APIs because it provides additional features for creating a well-structured and documented API using the OpenAPI standard.

The Migrate extension of Flask handled the database migrations using SQLAlchemy and it simplified the process of updating database schemas as the project evolved. The Flask-JWT-Extended extension for JSON Web Tokens (JWT) allowed the protection of routes and resources by verifying JWTs, with a mechanism for user authentication and authorization.

SQLAlchemy was also used as it is an SQL toolkit and Object-Relational-Mapping (ORM) library for Python. It provided a set of high-level API for interacting with relational databases allowing the work with Python objects. Marshmallow was used to convert complex data types, such as objects, to and from JSON.

Psycopg2 is a PostgreSQL adapter for Python as it enables Python applications to interact with PostgreSQL databases. Passlib is a password hashing library for Python. The server used was GUnicorn (Green Unicorn) because it's a lightweight, production-ready WSGI server for running Python web applications on Render, commonly used to serve Flask applications in production environment.

These libraries are commonly used together in Flask applications to build web APIs with secure authentication, interact with databases, handle migrations, and serialize/deserialize data.

Deploy

  • Render
  • ElephantSQL
  • Start.sh
  • Requirements.txt
  • WSGI.py

The project deployment was carried out on the Render platform, using a free account as a "Web Service." In addition to configuring environment variables, the requirements.txt file was created, serving as a build command, and the start.sh script was developed, serving as a start command.

The database is hosted on the ElephantSQL platform, also on a free account with limited space. This platform provides cloud-based PostgreSQL database hosting services.

Finally, WSGI (Web Server Gateway Interface) was employed for communication between the web server and the Python application.

Getting Started

To explore the API and its documentation, visit Diário Oficial da União Web Restful API Documentation.

Feel free to explore, contribute, and utilize the Diário Oficial da União Web Restful API for your research and data analysis needs.

dou-rest-api's People

Contributors

barbaracalderon avatar

Stargazers

 avatar Rafael de Almeida avatar Julia Fernanda Werlang avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.