Example #1
0
def display(request, kid_id):
    kid = get_object_or_404(Kid, id=kid_id)
    data = graph.importData("/tmp/wtageinf.xls")
    
    #print >>sys.stderr, np.shape(data['age'])
    #print >>sys.stderr, np.shape(data['b'][0,:])
    
    for p in np.arange(9):
        if p == 0 or p == 4 or p == 8:
            plot_options = 'b-'
        else:
            plot_options = 'b--'
            
        plt.plot(data['age'], data['b'][p][:], plot_options)
    
    for m in kid.measurement_set.all():
        
        alive = m.taken - kid.born
        years = (((alive.total_seconds()/60)/60)/24)/365

        plt.plot(years, m.weight, 'ro')


    #print >>sys.stderr, '{0}/k{1}.png'.format(settings.MEDIA_ROOT, kid_id)
    plt.savefig('{0}/k{1}.png'.format(settings.MEDIA_ROOT, kid_id))
    
    return render(request, 'track/display.html', {'kid': kid})    
Example #2
0
def update(request):
    os.chdir('/tmp/')
    subprocess.call(['wget', 'http://www.cdc.gov/growthcharts/data/zscore/wtageinf.xls'])  
    
    data = graph.importData("/tmp/wtageinf.xls")