CLI APPLICATION 2.0

Tiauna Paul
2 min readAug 10, 2020

1st Coding Project @ Flatiron School

There is no worse feeling than when you are faced with an empty text editor (VS Code for me…) with no folders or files and no idea as to how, when, what or why to start a new project. Going into this project, I was extremely nervous, but as I began to build and see how my code worked when it was ran, the nervousness quickly started to subside.

To start, I had to come up with a project idea. I’d read somewhere that a good way to tackle needing a CLI project idea is to think of a problem that needs solving. Given the current pandemic we are living in, I thought having a simple and quick way to retrieve statistical data on COVID-19 would be informative and relevant (for my fellow Georgians, this one is for you). During the planning stage, my goal was, that once my application was ran it would give the user options. The options would include displaying a list of Georgia counties and prompting the user to input one of the counties to retrieve COVID-19 cases reported, hospitalizations, deaths and case rate information for the county selected. Project confirmed and a plan on how to get started, it was time to find the data.

Presented with two options, scraping or going the API route, I had to locate an external source to retrieve the data I needed to complete my project. After giving up hope on ‘scraping’, I went with the more conventional and less complicated API or application programming interface. At first, I didn’t understand what an API truly meant and what it was used for, but I quickly learned that it is just an open data source accessible to the public. Utilizing the endpoint URL I discovered with a brief Google search, I was taken directly to the data I needed, and that’s when the fun began! (see snippet of my API class below)

class APIURL = "https://services1.arcgis.com/bqfNVPUK3HOnCFmA/arcgis/rest/services/Coronavirus_Cases_in_Georgia/FeatureServer/0/query?where=1%3D1&outFields=CountyName,NumberReportedCases,Deaths,CaseRate,Hospitalizations&returnGeometry=false&outSR=4326&f=json"def self.fetch_counties 
@all_counties = JSON.parse(HTTParty.get(URL).response.body) ["features"]
@all_counties.each do |c|
if c["attributes"]["CountyName"]
County.new(c["attributes"])
end
end

After an insane coding session of setting up files, building classes, and defining methods my project had finally come to life! I can’t wait to build my next application and see what else I can do.

This was by far the most challenging, yet fun thing I have ever done. I look forward to what is to come here at Flatiron School!

--

--