Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

create style.css, major overhall of site image and created some graphs

  • Loading branch information...
commit 72db02c8d97e0eb4891dd51bc0677d676550e7f8 1 parent 5638f9c
@drewverlee authored
View
4 petalapp/db_temp.py
@@ -6,8 +6,8 @@
'''
#{name: [[baseline, thrid quarter],...}
-{
-"MetroWest (LM/FR)": [
+hospitals ={
+"MetroWest": [
[0, 10, 8, 6, 8, 10, 8, 8, 2, 10, 2, 4, 10, 4, 0,10],
[10, 10, 10, 6, 8, 8, 2, 5, 2, 0, 10, 6, 10, 4, 4,10]
],
View
25 petalapp/db_temp_s3_mover.py
@@ -0,0 +1,25 @@
+'''
+File: db_temp_s3_mover.py
+Date: 2012-11-15
+Author: Drew Verlee
+Description: just to help with temp move
+
+'''
+#TODO: rename this! its not a db...
+
+from db_temp import hospitals
+from tools import upload_s3
+
+def unpack_temp():
+ for hospital_name,mega_data in hospitals.items():
+ for i, data in enumerate(mega_data):
+ if i == 0:
+ title_ext = "Baseline"
+ which_quarter = ""
+ else:
+ title_ext = "Quarter"
+ which_quarter = str(i + 2)
+ upload_s3(title_ext+which_quarter+hospital_name,(
+ title_ext, which_quarter, hospital_name, data))
+
+unpack_temp()
View
22 petalapp/graph.py
@@ -12,21 +12,30 @@
from random import randrange as rr
from math import pi
-def plotpolar(num):
+#TODO: do something num and data..and this default
+def plotpolar(data=[], num=None):
labels =["Standard Form", "Mkt & Edu Material", "Record Availability",
"Family Centerdness", "PC Networking","Education & Training", "Team Funding",
"Coverage", "PC for expired pts", "Hospital PC Screening",
"PC Follow UP", "Post Discharge Services", "Bereavement Contacts",
"Certification", "Team Wellness", "Care Coordination" ]
- fig = figure(figsize=(12,12))
+ fig = figure(figsize=(10,10))
ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True)
deg = [360/len(labels) * x for x in range(1,len(labels)+1)]
theta = [i*pi/180 for i in deg] # convert to radians
#FIXME when possible reflect user input, atm random # of graph bars
- radii = [rr(0,11) for x in range(len(labels)-1)]
- radii.append(num)
+ # random..
+ if not data:
+ radii = [rr(0,11) for x in range(len(labels)-1)]
+ radii.append(num)
+ else:
+ title_ext = data[0]
+ which_quarter = data[1]
+ hospital_name = data[2]
+ radii = data[3]
+
#TODO creates graph bars
bars = ax.bar(theta,radii, width=0.35, bottom=0.0, align='center')
for r,bar in zip(radii, bars):
@@ -36,12 +45,15 @@ def plotpolar(num):
#degree labels
ax.set_thetagrids(deg,labels, frac= 1, fontsize=14, verticalalignment = 'top',weight ="bold", color = "blue",clip_on =True)
#title
- ax.set_title("----PCI----", fontsize=30, weight="bold")
+ ax.set_title(title_ext + " " + which_quarter + " " + hospital_name , fontsize=30, weight="bold")
canvas=FigureCanvas(fig)
#String.IO, i believe allows us to treat our object as if it were a file.
png_output = StringIO.StringIO()
canvas.print_png(png_output)
+
+
+ #how to return it to simple in views
return png_output
View
BIN  petalapp/static/flower.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  petalapp/static/flower2.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  petalapp/static/flower3.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  petalapp/static/flower325.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  petalapp/static/flower350.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  petalapp/static/flower380.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
19 petalapp/static/style.css
@@ -0,0 +1,19 @@
+body { font-family: sans-serif; background: #eee; }
+a, h1, h2 { color: #377BA8; }
+h1, h2 { font-family: 'Georgia', serif; margin: 0; }
+h1 { border-bottom: 2px solid #eee; }
+h2 { font-size: 1.2em; }
+
+.page { margin: 2em auto; width: 35em; border: 5px solid #ccc;
+ padding: 0.8em; background: white; }
+.entries { list-style: none; margin: 0; padding: 0; }
+.entries li { margin: 1.2em 1.4em; }
+.entries li h2 { margin-right: -1em; }
+.add-entry { font-size: 0.9em; border-bottom: 1px solid #ccc; }
+.add-entry dl { font-weight: bold; }
+.metanav { text-align: right; font-size: 1.2em; padding: 0.3em;
+ margin-bottom: 1em; background: #fafafa; }
+.flash { background: #CEE5F5; padding: 0.5em;
+ border: 1px solid #AACBE2; }
+.error { background: #F0D6D6; padding: 0.5em; }
+.nav li {display:inline;}
View
15 petalapp/templates/MetroWest.html
@@ -1,3 +1,12 @@
-{ % extends "hospital.html" %}
- <h1>show me</h1>
-{ % endblock %}
+{% extends "base.html" %}
+{% block content %}
+
+<div class ="nav">
+ <ul>
+ <li><img src="https://s3.amazonaws.com/petalbucket/charts/BaselineMetroWest"
+ alt = "chart fail" /></li>
+ <li><img src="https://s3.amazonaws.com/petalbucket/charts/Quarter3MetroWest"
+ alt = "chart fail" /></li>
+ </ul>
+</div>
+{% endblock %}
View
34 petalapp/templates/base.html
@@ -1,18 +1,20 @@
<!doctype html>
-<html>
- <head>
- <meta http-equiv="content-type" content="text/html; charset=utf-8" />
- <title>Petal </title>
- </head>
- <body>
- <a href="/login">/login</a>
- <a href="/">/index</a>
- <a href="/map">/map</a>
- <!-- confusing nameing, possible fix-->
- <a href="/show_charts">/make_charts</a>
- <a href="/awsgraph">/awsgraph</a>
- <a href="/dbshow">/dbshow</a>
- <a href="/hospitals">/hospitals</a>
+<!-- TODO: fix the spaceing! -->
+<title>Petal </title>
+<link rel=stylesheet type=text/css href="{{ url_for('static', filename='style.css') }}">
+<div class =page>
+ <h1>Petal</h1>
+ <div class=metanav>
+ <h1>Hospitals</h1>
+ <!--<a href="/login">login</a>
+ <a href="/">index</a>
+ <a href="/map">map</a>
+ <a href="/show_charts">make_charts</a>
+ <a href="/awsgraph">awsgraph</a>
+ <a href="/dbshow">dbshow</a> -->
+ <h2><li><a href="{{ url_for('MetroWest') }}">MetroWest</a></li><h2>
+ <!-- <img src ="{{ url_for('static', filename='flower350.jpg') }}" alt="flower" usemap="#logos"> -->
+ </div>
+</div>
{% block content %}{% endblock %}
- </body>
-</html>
+
View
6 petalapp/templates/hospitals.html
@@ -1,6 +0,0 @@
-{% extends "base.html" %}
-{% block content %}
- <h1>Hospitals around the United States</h1>
- <a href="MetroWest (LM/FR)">MetroWest (LM/FR)</a>
- <a href="St.Vince">St.Vince</a>
-{% endblock %}
View
2  petalapp/templates/index.html
@@ -1,4 +1,4 @@
{% extends "base.html" %}
{% block content %}
-<h1>WELCOME TO PETAL</h1>
+
{% endblock %}
View
7 petalapp/tools.py
@@ -11,14 +11,14 @@
from graph import plotpolar
-#TODO separate out functions, add try except
-def upload_s3(destination_filename,file_name=plotpolar(num).getvalue(),
- acl="public-read"):
+#TODO separate out functions, add try except
+def upload_s3(destination_filename, data, acl="public-read"):
"""upload_s3 uploads a string to s3"""
conn = boto.connect_s3(app.config["AWS_ACCESS_KEY_ID"],
app.config["AWS_SECRET_ACCESS_KEY"])
b = conn.get_bucket(app.config["S3_BUCKET"])
+ file_name=plotpolar(data).getvalue()
sml = b.new_key("/".join([app.config["S3_UPLOAD_DIRECTORY"],destination_filename]))
sml.set_contents_from_string(file_name)
@@ -36,4 +36,3 @@ def download_s3():
return k
-def upload_s3_chart
View
13 petalapp/views.py
@@ -4,7 +4,7 @@
#from tools import upload_s3_chart, download_s3_chart
#python path points to petalapp?
from graph import plotpolar
-
+import db_temp
#TODO add comments, doctrings?
#TODO change main to base/welcome
@@ -43,11 +43,11 @@ def simple():
assert (num >= 0 and num <= 10)
except:
num = 10
- response=make_response(plotpolar(num).getvalue())
+ data = []
+ response=make_response(plotpolar(data, num).getvalue())
response.headers['Content-Type'] = 'image/png'
return response
-
@app.route("/awsgraph", methods =['GET','POST'])
def aws():
return render_template("awsgraph.html")
@@ -57,10 +57,9 @@ def dbindex():
mydata = str(models.Hospital.query.all())
return render_template("dbshow.html",data=mydata)
+@app.route("/MetroWest")
+def MetroWest():
+ return render_template("MetroWest.html")
-@app.route("/hospitals")
-def hospitals():
- return render_template("hospitals.html")
-
Please sign in to comment.
Something went wrong with that request. Please try again.