GoDataX Community Members

For now, this section features real-world data projects and insightful articles from founder. In the future, it will become a platform for publishing contributions from members.

Practical Python Challenge for You

Postal Code Practice

I once received this as a challenge for an opportunity at a major telecom company in Portugal. In fact, it was my first project in Portugal. I found the idea interesting and decided to build and share the real-world job market challenge with you.

Objective

A practical exercise that involves enriching geolocation data for a local database. The goal is for students to develop a complete solution to supplement the municipality and district information of Portugal, which will be provided through an API by passing a list of postal codes as input parameters.

Input Data:

A CSV file will be provided containing a list of postal codes (CP7). Access it here download

Task:

Using research tools, websites with postal code information, or publicly available APIs, you should find the corresponding municipality and district information for each postal code.

Process:

Develop a script or program that automates this search and data enrichment. Complement the postal code present in the CSV with the municipality and district information.

Data Storage:

The final result should be saved in a table within a database.

Minimum Table Structure:

  • postal_code (string or varchar)
  • municipality (string or varchar)
  • district (string or varchar)

Bonus Challenge: Data Query API

Develop an API service to access the table created in the base challenge. Allow direct queries to the enriched data through the API.

Tip: Use the service api.duminio.com

Requirements:

Endpoints:

  • GET /postal_codes: Returns all records.
  • GET /postal_codes/{postal_code}: Returns the record corresponding to the provided postal code.

Response Format:

JSON containing the postal code, municipality, and district information.

Suggested Tools

  • Programming Language: Python
  • Database: MySQL, PostgreSQL, SQLite, MariaDB, Oracle, others

Submission

Upload the developed code to GitHub, create an account for yourself, and share the project link.

Send the enriched CSV file to delivery@godatax.com

Solution

The solution is published on my github at the link git solution project

Send the enriched CSV file to delivery@godatax.com