Flatiron School Final Project Day 10 — All the Things are Working!

Amos Shin
3 min readMay 7, 2019

--

It works! It works! It works!

After spending the better half of the morning converting my API from XML to JSON, I finally got my project working! Here’s how it works. The camera checks to see if a cup comes into the frame. When it does, it takes a picture. As soon as the picture is taken, it’s saved onto my local storage with the name of the file being the date (YYYYMMDD) and time (HHMMSS). Once it saves, the file is automatically uploaded to AWS. Then the image is deleted from my local storage (so I don’t have a folder with 30,000 images). That’s it for the camera. Next we move onto AWS. When a file is uploaded to AWS, the object’s permission is set to be public. Then my AWS API gets updates with the new image information. That’s it for AWS. From there, the backend of my web app gets the AWS API and converts it to JSON. Then the new API is hosted via a Post class. Then the frontend of my web app (React) fetches the API and pulls the necessary information. Since my AWS image is public, the url will always stay the same, except for the name of the image file. I parse the url into an image tag while adding the new image file name to the end of the url. That in turn renders the new image onto my web app.

Languages and Resources

Python to script all the functions (camera start, camera capture, image save, image upload, image remove)
Google Cloud Vision API for object detection
Amazon Web Services S3 for cloud storage
s3cmd to communicate with AWS S3 via Python
Amazon API Gateway to create custom API for S3 bucket
Ruby on Rails for web app backend and parsing XML API to JSON
React.js for web app frontend and rendering captured

So this has been one hell of a learning experience. I’ve learned to implement other’s API’s, create and implement my own API, script automated tasks via Python (a language I was unfamiliar with), and build a web app, all in 10 short days. Paeq still isn’t finished, as I’ll be finishing up my web app side, but the major functionality is all finished. It felt like every single step of the way, I came across major roadblocks preventing me from progressing. At times, I honestly felt like giving up and questioning whether I would be able to complete my project. However, I pushed harder to find the answers, relying on all the resources I had at my disposal, and thanks to helpful suggestions and the wonders of Stack Overflow, I was able to get it done. So without further adieu, here’s Paeq!

Todo for tomorrow

I would like to add some more functionality to my web app. I might add a user sign up/log in feature as well as commenting functionality. I don’t think my app really calls for those functions to be available, but it’s still something nice to add nonetheless. I also have to update my about section, as it’s pretty lacking at the moment.

See Day 9 — Time to API this Apple Pie

--

--