Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,427 members, 7,819,554 topics. Date: Monday, 06 May 2024 at 06:03 PM

API For Name Of Places In Nigeria Organized Into States,lgas,locations & Streets - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / API For Name Of Places In Nigeria Organized Into States,lgas,locations & Streets (770 Views)

Public API For Nairaland / Recommend Good Vtu API For Me (2) (3) (4)

(1) (Reply) (Go Down)

API For Name Of Places In Nigeria Organized Into States,lgas,locations & Streets by belovedsamex(m): 2:10pm On Jun 22, 2023


GPS-naija is a RESTful API that serves names of places in Nigeria organized into States, Local Government Area, Locations (major landmarks) and Streets. It was an application I created as my portfolio project at the end of my foundations in Software Engineering Program at ALX.
I worked alone on the project, and it took me roughly 8 days to start and finish the project, including testing and deployment.

This API is created for developers who build location-dependent applications in Nigeria such as ecommerce applications, hospitality management apps or any application that require user address. I wanted to focus on creating a data source that organizes data with the way they're related to one another.

In 2020, I worked with a team to create an ecommerce web application for a client. My role was to gather and prepare data that will be used to populate the database tables. Having to manually collate names of places sourced from different sources and organise them into States, LGAs, Locations and Streets was a daunting task that no programmer would want to do. This was what inspired me to create this app.

Due to my interest in backend development, I used python, flask and sqlalchemy to implement the project. These enabled me to create a backend application with a database, and an interphase for communicating with the front end, a perfect prototype for any student to experiment with some features of backend development. Otherwise, I could implement same with Javascript and filestorage system without the need to integrate a backend. Gunicorn is another technology used during deployment to handle seamless running of the Flask application.

/states/<state_name>
route is a feature that enables a client to get data for any particular State by simply providing the name of the state in the url.

One major challenge I encountered which I'd like to share happened during deployment. The server repeatedly ran into error while trying to execute a command to install my app dependencies from requirements.txt file. I checked the error log, It says that "it could not find a version of the Flask module that satisfies a requirement or no matching for distribution found" . I was confused at this point because during development, I simply installed flask and other modules by running the command "pip install <module name>" and the module gets installed without issue. Then I examined the log again, I noticed that it listed some versions of the Flask module that is available for the installer. I compared them to the version listed in my requirements.txt file and saw that the latter was higher. I also noticed that the server runs python 3.7 instead of 3.10+ which I had used during development. However, I didn't know how to install the right version of python on the server. I decided to take this approach:
I created a bash file. Inside it, I wrote bash scripts to install all my dependencies with pip without specifying a version. I made the file executable and then uploaded it to my project root folder. Rather than typing "pip install -r requirements.txt" I typed "./<bash file name>" a command to execute the bash file. I restarted the deployment again and this time everything went smoothly and my app was live.

Undertaking this project has made me build confidence in the ability to create a production-grade flask application. We built different apps during our foundations, but building this project where I have the sole decision on what should and what should not has helped me advance my technical mastery.
Also, I went back to think through the challenge that I shared above after the deployment, and I thought that next time I would take an easier approach to deployment. That approach is removing the version of all the modules in the requirements.txt file, leaving only the module name. Doing this would let the installer install the packages with versions compatible with the existing python version.

My name is Samuel Nnadozie. My strongest technical strength is the ability to debug an error in a source code.

For more information about the API and how to use it, please visit any of the following links:

Project Landing Page: https://gps-naija.onrender.com

Github Repository: https://github.com/zinando/gps-naija

3 Likes

Re: API For Name Of Places In Nigeria Organized Into States,lgas,locations & Streets by belovedsamex(m): 2:36pm On Jun 22, 2023
There is an opportunity for interested persons to contribute to the project. The area of opportunity lies in providing more names of places. So far, the project database has a complete names of STATES AND THEIR CAPITALS, ALL LGAs in Nigeria. But names of Locations (major landmarks) and Streets within each LGA have not been exhausted. In fact, if you query our data, you might realize that the name of your current location is not yet listed, or perhaps names of some streets that you know have not been listed. You could contribute to this project by sending me a mail with the names of the places you want me to add to our database. You will be listed on our landing page and also our Github repository as a contributor to this project.

The format for sending your email is as follows:
If you want to send me names of locations that you know, you will present your data in the format below:
state: e.g Lagos
LGA: e.g Ikeja
Locations: location 1, location 2, location 3 .....location n.

If you want to send me names of Streets that you know, you will present your data in the format below:
state: e.g Lagos
LGA: e.g Alimosho
Locations: e.g Ikotun
Streets: e.g. Street 1, Street 2, Street 3, .... Street n

Send your message to zinando2000@gmail.com
Include a link to your social handle we could reference when acknowledging your contribution.
Re: API For Name Of Places In Nigeria Organized Into States,lgas,locations & Streets by bedfordng(m): 4:43pm On Jun 22, 2023
I must say you've done well. Maybe with time when you get more contributions, the data will add up.

Anyway, I will recommend you look at Django framework. with its batteries included and robust features, it will make development swift for you.

1 Like

Re: API For Name Of Places In Nigeria Organized Into States,lgas,locations & Streets by KrazyDave16(m): 4:50pm On Jun 22, 2023
bedfordng:
I must say you've done well. Maybe with time when you get more contributions, the data will add up.

Anyway, I will recommend you look at Django framework. with its batteries included and robust features, it will make development swift for you.
Django is nice and all, but for this situation and knowing ALX, using flask is way better as you got more control over packages used.

1 Like

Re: API For Name Of Places In Nigeria Organized Into States,lgas,locations & Streets by KrazyDave16(m): 5:06pm On Jun 22, 2023
belovedsamex:
There is an opportunity for interested persons to contribute to the project.
Not bad fam, I'll check it out and see if I can make a PR or mail you data based on my current location if I don't have time.

Plus I might build a rust-based version of your API too.
Currently on the ALX program (deferred for now, real life stuff).

P.s. - next time you're building anything with Python, try to use a virtual environment

1 Like

Re: API For Name Of Places In Nigeria Organized Into States,lgas,locations & Streets by belovedsamex(m): 1:09pm On Jun 23, 2023
bedfordng:
I must say you've done well. Maybe with time when you get more contributions, the data will add up.

Anyway, I will recommend you look at Django framework. with its batteries included and robust features, it will make development swift for you.

Thanks. I really appreciate this
Re: API For Name Of Places In Nigeria Organized Into States,lgas,locations & Streets by belovedsamex(m): 1:13pm On Jun 23, 2023
KrazyDave16:

Not bad fam, I'll check it out and see if I can make a PR or mail you data based on my current location if I don't have time.

That would be nice, I will be looking out for your mail. Thanks
Re: API For Name Of Places In Nigeria Organized Into States,lgas,locations & Streets by belovedsamex(m): 1:14pm On Jun 23, 2023
KrazyDave16:

Plus I might build a rust-based version of your API too.

Very cool bro.
May ask if you will be doing that for your Portfolio project with ALX or you just want to do it ?

If the latter is the case, may i ask that you do that under a new branch in my repository, i would love the collabo.

Thanks.
Re: API For Name Of Places In Nigeria Organized Into States,lgas,locations & Streets by belovedsamex(m): 1:22pm On Jun 23, 2023
KrazyDave16:

P.s. - next time you're building anything with Python, try to use a virtual environment

I actually do, and i also developed the app with a VE. However, as this is my first time doing deployment unaided, i didnt quite figure out in time how to incorporate that with deployment as i was rushing to beat time. But i have learnt something from that.
Re: API For Name Of Places In Nigeria Organized Into States,lgas,locations & Streets by KrazyDave16(m): 5:58am On Jun 24, 2023
belovedsamex:


Very cool bro.
May ask if you will be doing that for your Portfolio project with ALX or you just want to do it ?

If the latter is the case, may i ask that you do that under a new branch in my repository, i would love the collabo.

Thanks.
Nope, mine is an inventory system of sorts based on my workplace. Been observing how things are done here and collecting the necessary data I'll need.
Wrote some helper functions, but nothing solid yet.
Re: API For Name Of Places In Nigeria Organized Into States,lgas,locations & Streets by KrazyDave16(m): 5:58am On Jun 24, 2023
belovedsamex:


I actually do, and i also developed the app with a VE. However, as this is my first time doing deployment unaided, i didnt quite figure out in time how to incorporate that with deployment as i was rushing to beat time. But i have learnt something from that.
Understandable
Re: API For Name Of Places In Nigeria Organized Into States,lgas,locations & Streets by atesunate16(m): 10:39pm On Jun 24, 2023
belovedsamex:
There is an opportunity for interested persons to contribute to the project. The area of opportunity lies in providing more names of places. So far, the project database has a complete names of STATES AND THEIR CAPITALS, ALL LGAs in Nigeria. But names of Locations (major landmarks) and Streets within each LGA have not been exhausted. In fact, if you query our data, you might realize that the name of your current location is not yet listed, or perhaps names of some streets that you know have not been listed. You could contribute to this project by sending me a mail with the names of the places you want me to add to our database. You will be listed on our landing page and also our Github repository as a contributor to this project.

The format for sending your email is as follows:
If you want to send me names of locations that you know, you will present your data in the format below:
state: e.g Lagos
LGA: e.g Ikeja
Locations: location 1, location 2, location 3 .....location n.

If you want to send me names of Streets that you know, you will present your data in the format below:
state: e.g Lagos
LGA: e.g Alimosho
Locations: e.g Ikotun
Streets: e.g. Street 1, Street 2, Street 3, .... Street n

Send your message to zinando2000@gmail.com
Include a link to your social handle we could reference when acknowledging your contribution.

Great project boss

Is there a way we can contribute directly into the project on github without you going through the stress of manual adding up. You accept pull request verify the addition then pull together.

It will be seamless, real time for both contributors like us and you

4 Likes

Re: API For Name Of Places In Nigeria Organized Into States,lgas,locations & Streets by Obere4u: 9:06am On Jun 25, 2023
atesunate16:


Great project boss

Is there a way we can contribute directly into the project on github without you going through the stress of manual adding up. You accept pull request verify the addition then pull together.

It will be seamless, real time for both contributors like us and you

Waiting for this
Re: API For Name Of Places In Nigeria Organized Into States,lgas,locations & Streets by belovedsamex(m): 10:39am On Jun 25, 2023
atesunate16:

Is there a way we can contribute directly into the project on github without you going through the stress of manual adding up. You accept pull request verify the addition then pull together.

Normally, this is the ideal thing to do.
But i have tried to avoid this because the area I needed contribution for now is to populate the database with more names (Streets and locations). This is an information anybody could share without having programming background, and yes I want want everybody interested to send in data. So I didn't want to go into telling interested parties to do "pull request blah blah blah" so those who have no idea won't get discouraged.

But to answer your question, yes... There is a way you could contribute by making a pull request and I will explain that below.
Re: API For Name Of Places In Nigeria Organized Into States,lgas,locations & Streets by 3exe3: 10:44am On Jun 25, 2023
What's the difference with street and location
Re: API For Name Of Places In Nigeria Organized Into States,lgas,locations & Streets by belovedsamex(m): 11:50am On Jun 25, 2023
belovedsamex:


If your contribution is about populating the database with more names, then you will be glad to know that I also created the API to accept two other request methods: PUT and POST.
With POST request, you can add more names to the database; and with PUT request, you can modify any database record.
Both your put request and your post request must have request body containing the data to be processed by the API. The format for these data is shared below:

N.B: i expect that only Locations and Street names are to be supplied by contributors, as we already have the complete names of States and LGAs.

For POST request:
1. To add Locations in a given LGA:

data = [{
"name":name of State,
"capital": capital of the State,
"lgas": [{
"name": name of LGA,
"locations": [location1, location2, location3...]
}]
} ]
..................


You can fork or clone the repository on your local machine, do all your additions to the database, then send me a pull request.

Also, if your contribution has to do with addition of more features to the API, for example including some demographic data for each location such as population figures, landmass etc, you could go ahead and implement the new features, and I will be glad to review them and merge them into the main branch if the new feature scores high from my assessment.

Thanks.
Re: API For Name Of Places In Nigeria Organized Into States,lgas,locations & Streets by belovedsamex(m): 11:55am On Jun 25, 2023
3exe3:
What's the difference with street and location

Location is the name of the major landmark where the street is located.
For example:
Abaranje is a street in Ikotun,
Ikotun is a location in Alimosho,
Alimosho is a LGA in Lagos,
Lagos is a State in Nigeria.
Re: API For Name Of Places In Nigeria Organized Into States,lgas,locations & Streets by Davidcorny: 12:02pm On Jun 25, 2023
You can use open street view and Google maps to fetch more data for your project. Not a backend guy but I'll hopefully learn enough to help with due time.

1 Like

Re: API For Name Of Places In Nigeria Organized Into States,lgas,locations & Streets by belovedsamex(m): 12:12pm On Jun 25, 2023
Davidcorny:
You can use open street view and Google maps to fetch more data for your project. Not a backend guy but I'll hopefully learn enough to help with due time.

True though..

But I've got this issue with Google. Some of the street names you fine on open street view are not known to the residents. E.g where I live here in ibadan, the street name given to my street on Google open street view isn't what we call it.

So I don't usually rely on it. But it sure provides a lot info in terms of location names.

(1) (Reply)

What Advice Would You Give To Someone Who Wants to Start Learning JAVA / Hospital Management System Needed / Can Smbdy Help Me, B/w Ccna And Oracle. Which Do I Go For?

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 60
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.