A Quiet Sense of Accomplishment - First GAE Application Using Bottle.py

Now We Have Working Code On GAE! 

I'm going to bed slightly later than expected tonight, but with a quiet sense of accomplishment.

As of about 30 minutes ago, I just uploaded and started a barebones version of my first Google App Engine app - a lemonade stand revenue calculator (editorial update: was originally website revenue calculator, had a more creative idea this morning). Enter some assumptions about your lemonade stand and it will predict how much money per hour you should be making. I'm using bottle.py as the framework behind the site and the application is a comic twist on my website revenue estimator (the original Non-GAE implementation is here, underlying business research is here).

Why I'm Interested In This...

My day job is in Analytics, where my team and I spend a lot of time coming up with "the formula" behind a business process. Once we have "the formula", we have three challenges:

  • Make it simple enough for non-analyst to use
  • Track formula predictions and decisions made (accept / reject our recommendations)
  • Ensure the formula is protected from malicious use (loss to competitor, internal circumvention)

Historically, analytics has always retreated "to our mountain top" to mine insights from data. Our ideas would then be shared with senior management, who would frequently broadcast them to their subordinates. Net result: everyone knows everything (fail goal #3), we track nothing everything is ad-hoc (fail #2), and we struggled with the first challenge.

The irony is that we're only talking about a formula: something that can be implemented in a handful of lines of Python!

Thus my interest in Python microframeworks. Bottle is a microframework that simplifies the task of setting up a basic web service. In simple terms, you define URL routes (http://mysite.com/path/variable) for a specific request; these are mapped to a python function (passing information from the request) which creates an appropriate response. Many microframeworks are very AJAX friendly (very easy to return data as JSON), opening the door to building simple web applications.

So... if I can code the formula in Python, I can deliver it as a webservice (or simple AJAX application). This protects the formula and will make the formula's implementation easier to use and supervise. One little bonus for bottle and GAE - they have a Google App Engine Adapter. This made the process a snap. Oh...and GAE has a free plan for smaller applications (see them for details). Which makes it attractive to students and hobbyist developers.

I've got a lot of polishing to do (particularly on the web design piece). Interestingly enough, the calculator framework has been relatively easy to edit - I was able to flip the application's entire purpose over lunch (from a website profit estimator into the lemonade stand version). It's just a form and a formula - very easy to edit!




Leave comments

authimage
  • I was happy to discover your blog!
    Is your revenue prediction app backed by a real formula?
    What 'revenue model' should I choose for Adsense based website?
    Thanks!

    • Patrick
  • I'll answer the question but would like to keep this blog focused on Python (and in this case, GAE / bottle.py). Feel free to leave me a comment or drop me an email on my other blog for business questions.

    That being said, since you had to pass a Python question to post, I will provide a serious answer:
    - Yes, there's a real formula behind the calculator; I saw a need for some original research in this space and assembled my own study.
    From a technical perspective, I wanted to test using Python to build a microsite that could deliver the insights from the formula without revealing it's detail. As I commented above, this is a particularly useful Python application for an analyst - it neatly solves the three challenges I struggle with in my regular job.
    - The answer to your second question is "it depends"; you should balance revenue $$$ with cost and level of effort required to implement the program. I will say that I've found AdSense is a terrific deal vs. similar programs; it is also a great way for a new webmaster to "get started" since they have really made the process very easy for a non-marketing person to use.

    • numbercruncher
  • BTW - the formula is pretty high level; my original goal was to understand order of magnitude level differences vs. small nuances. One of the really big things I learned from the study was the range of variation in results...

    • numbercruncher

Copyright(c) 2017 - PythonBlogs.com
By using this website, you signify your acceptance of Terms and Conditions and Privacy Policy
All rights reserved