Postcode-location-app 😎😎

This CLI program is built on the LARAVEL FRAMEWORK. The program process a zip file from a (http://parlvid.mysociety.org/os/), and unzip the file and pull the contents/ folder into the Storage > app > public > postcode directory. The Postcode directory contains 3 sub folders, and the application will seek to read the data in the Data > ONSPD_NOV_2022_UK.csv. The data is about 1.44GB in size with about 2.6 million rows.

Screenshot of database records

Repo Overview 🥳🥳

The repository contains source code on how to process the ONSPD_NOV_2022_UK.csv using Queues, ensure alot of server resources isn't used up while creating the records in the database. It also contains 2 endpoints to List and filter Postcode, and Get Nearby Postcodes.

Specifications in the clone include

  • The program unzip file from a remote location and create in storage directory.

  • Single CLI command to automate the read and write process and create record in the database
  • Contains 2 (Two) endpoints that list and filter postcodes and returns the nearest postcode using the longitude and latitude
  • Endpoint to list all postcodes

    Endpoint to return nearby postcodes

  • Writing of errors to logfile
  • Published Postman Collection with sample body and example responses
  • Published Postman collection

    Requirements 🔧🔧

  • Download PHP V7 and above.
  • Install Composer
  • Steps to run locally 🧑‍💻👩‍💻

  • Clone this repository:
  •  git clone https://github.com/LarrySul/postcode-location-app/ 
  • Install dependencies:
  •  composer install and setup your path by following .env.example provided 
  • Open the CLI in preferred editor and run the command:
  •  php artisan import-and-create:postcodes 

    Once the command is done you'll get a success message in the CLI 😜

    Screenshot of read write operation via the CLI

    Coding Style 🚀🚀

  • How is your code structured: The code is well structure to use a creational design pattern, inheritance, DRY Principle, typehint of parameter and return type to functional declarations and lot more.
  • Are tests available and how have they been set up : Yes, the project has a total of 4 test cases (2 Unit and 2 Feature).

  • Screenshot of test cases