Skip to content

Decode, the sustainability chrome-extension/website's backend

Notifications You must be signed in to change notification settings

jaysqvl/decode-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

👖🌱 Decode Backend (🥈 at SustainHacks 2022)

Contributors: Jay Esquivel Jr, Shawn Esquivel

Welcome to the backend powering DECODE, the chrome extension that which helps you make greener decisions on apparel products.

More details: https://devpost.com/software/decode-z8ecsg

Front-end Code: https://github.com/shawnesquivel/decode

Decode's Demo Gif

How it works

1. Signalled by opening the front-end (clicking on the extension)
2. Processes an HTTP request of the webpage
3. Web-scrapes the current product page's data
4. Classifies and interprets the material data on the page
5. Returns the applicable/identifiable material data in JSON-readable format for auto-fill
6. Api request signalled by the extension submit button, 
7. Form information is passed via the URL call using a specific format
8. Back-end does the calculations and returns the calculations

Challenges

While the planning and set-up portion of our project went smooth, coding for completion given the time alotted was the teams biggest challenge. It wasn't until we had to figure out how to merge the front-end and back-end together that we ran into concerns over our extensions security and final functionality as the two pieces were working as intended separately.

Accomplishments

This was both of our first times working on a hybrid website/chrome extension product and we were both able to have a taste of completely brand new roles in our development journeys. Any opportunity I get to add a new tool to my toolkit is an exciting experience.

Instructions

  1. See requirements.txt for the required modules/versions and install them

  2. Open a terminal in the root directory

  3. Run the command 'python server.py'

  4. Now, on a browser, we can test the following.

a) To test product URL web-scraping, paste: localhost/webscrape?url={insert url of below here}

Example Items:

Example Jsonified Web-scraped Data: { brand: "SHEIN" cloth_type: "pants" materials: [ "Cotton: 62%", "Polyester: 37%", "Viscose 1%" ] num_washes: 200 weight_grams: 890 }

To test the product sustainability calculator, paste: http://localhost:80/submit?brand=$Nike&cloth_type=$Jacket&materialone=$Polyester&materialtwo=$Cotton&num_washes=$125&weight=$800

localhost/submit$brand=Nike&cloth_type=jacket& Example Jsonified Calculations: { sustainability_rating: 100 fabric_quality: 67 num_washes: 125 }

About

Decode, the sustainability chrome-extension/website's backend

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages