Skip to content

Python project using IBGE API to rank names based on parameters and state data. Explore naming trends in Brazil with customizable ranking options.

License

Notifications You must be signed in to change notification settings

gregoryfiel/ranking-names-ibge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

IBGE Names Ranking System

This Python project implements a names ranking system using the IBGE API. It fetches and analyzes data to provide insights into the frequency of names in Brazil, supporting various parameters such as location, sex, and time periods.
Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. License
  6. Contact
  7. Acknowledgments

About The Project

Product Name Screen Shot

(back to top)

Built With

  • Python
  • Redis
  • Git

(back to top)

Getting Started

This project is designed to help you analyze and rank names using the IBGE API. The program utilizes multiprocessing, leveraging parallelism with the available CPU cores, to enhance performance during data retrieval. Additionally, by incorporating Redis as a caching mechanism, the system achieves an average speed improvement of up to 300%, making the ranking process more efficient and responsive.

Prerequisites

  • Python: You can download and install Python from Python's official website.
  • Redis (Optional): If you want to take advantage of caching for optimized performance, you can install Redis. You can download Redis from Redis's official website or use package managers like apt or brew:
 # Example for Debian-based systems
 sudo apt-get update
 sudo apt-get install redis-server
  • Requirements.txt
pip install -r requirements.txt

Installation

  1. Clone the repo
    git clone https://github.com/gregoryfiel/ranking-names-ibge.git
  2. Run the script:
    python main.py --nomes --localidade SP --sexo M --decada 1980

(back to top)

Usage

To use this names ranking system, follow these steps:

1. Prepare Input (Optional)

Create a file named nomes.json in the project directory and list the names you want to rank. If not provided, the script will use a default set of names for a general ranking:

["Joao", "Maria", "Carlos", "Ana"]

2. Run the script

If you prepared a list of names in nomes.json, you can use the follow command:

python main.py --nomes

If not, you can simply call

python main.py

(A basic list of names has already been provided for exploring the code.)

Advanced Options

Customize the ranking criteria with some flags according to your preferences:

python main.py --localidade SP --sexo M --decada 1980
  • Additional options can be used to refine the ranking:
    • --localidade: Filter by location (e.g., SP for São Paulo).
    • --sexo: Filter by sex (e.g., M for male).
    • --decada: Filter by decade (e.g., 1980).

Additional Settings

Adjust optional settings to suit your needs:

--retryTimeout 3 15
  • --retryTimeout: Set the number of retry attempts and the API request timeout in seconds (e.g., --retryTimeout 3 10 for 3 retries and a timeout of 10 seconds).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Gregory - @twitter_handle

Project Link: https://github.com/gregoryfiel/ranking-names-IBGE

(back to top)

Acknowledgments

  • Thanks to Ilegra for providing this opportunity to learn by doing.
  • Thanks to the IBGE API for providing valuable data.
  • Special mention to the Clean Code principles for code maintainability.

(back to top)

About

Python project using IBGE API to rank names based on parameters and state data. Explore naming trends in Brazil with customizable ranking options.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages