Able to read sample data for 7 days and send to html file.

This commit is contained in:
Karthik Pullela
2018-01-20 23:25:43 -08:00
parent 7f64177c3c
commit 40369ab1f7
142 changed files with 398 additions and 7 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 937 KiB

+165
View File
@@ -0,0 +1,165 @@
{
"bucket": [
{
"startTimeMillis": "1515909198911",
"endTimeMillis": "1515995598911",
"dataset": [
{
"dataSourceId": "derived:com.google.step_count.delta:com.google.android.gms:aggregated",
"point": [
{
"startTimeNanos": "1515915688421000000",
"originDataSourceId": "derived:com.google.step_count.cumulative:com.google.android.gms:samsung:SAMSUNG-SM-J327A:f70f7ad15285587:soft_step_counter",
"endTimeNanos": "1515994617428000000",
"value": [
{
"mapVal": [],
"intVal": 4140
}
],
"dataTypeName": "com.google.step_count.delta"
}
]
}
]
},
{
"startTimeMillis": "1515995598911",
"endTimeMillis": "1516081998911",
"dataset": [
{
"dataSourceId": "derived:com.google.step_count.delta:com.google.android.gms:aggregated",
"point": [
{
"startTimeNanos": "1515995775226967426",
"originDataSourceId": "derived:com.google.step_count.cumulative:com.google.android.gms:samsung:SAMSUNG-SM-J327A:f70f7ad15285587:soft_step_counter",
"endTimeNanos": "1516077452860997579",
"value": [
{
"mapVal": [],
"intVal": 5412
}
],
"dataTypeName": "com.google.step_count.delta"
}
]
}
]
},
{
"startTimeMillis": "1516081998911",
"endTimeMillis": "1516168398911",
"dataset": [
{
"dataSourceId": "derived:com.google.step_count.delta:com.google.android.gms:aggregated",
"point": [
{
"startTimeNanos": "1516119006439973641",
"originDataSourceId": "derived:com.google.step_count.cumulative:com.google.android.gms:samsung:SAMSUNG-SM-J327A:f70f7ad15285587:soft_step_counter",
"endTimeNanos": "1516167518351915656",
"value": [
{
"mapVal": [],
"intVal": 6825
}
],
"dataTypeName": "com.google.step_count.delta"
}
]
}
]
},
{
"startTimeMillis": "1516168398911",
"endTimeMillis": "1516254798911",
"dataset": [
{
"dataSourceId": "derived:com.google.step_count.delta:com.google.android.gms:aggregated",
"point": [
{
"startTimeNanos": "1516208511838003657",
"originDataSourceId": "derived:com.google.step_count.cumulative:com.google.android.gms:samsung:SAMSUNG-SM-J327A:f70f7ad15285587:soft_step_counter",
"endTimeNanos": "1516248714524000464",
"value": [
{
"mapVal": [],
"intVal": 10887
}
],
"dataTypeName": "com.google.step_count.delta"
}
]
}
]
},
{
"startTimeMillis": "1516254798911",
"endTimeMillis": "1516341198911",
"dataset": [
{
"dataSourceId": "derived:com.google.step_count.delta:com.google.android.gms:aggregated",
"point": [
{
"startTimeNanos": "1516291511303066257",
"originDataSourceId": "derived:com.google.step_count.cumulative:com.google.android.gms:samsung:SAMSUNG-SM-J327A:f70f7ad15285587:soft_step_counter",
"endTimeNanos": "1516336212893022002",
"value": [
{
"mapVal": [],
"intVal": 8771
}
],
"dataTypeName": "com.google.step_count.delta"
}
]
}
]
},
{
"startTimeMillis": "1516341198911",
"endTimeMillis": "1516427598911",
"dataset": [
{
"dataSourceId": "derived:com.google.step_count.delta:com.google.android.gms:aggregated",
"point": [
{
"startTimeNanos": "1516383728488990926",
"originDataSourceId": "derived:com.google.step_count.cumulative:com.google.android.gms:samsung:SAMSUNG-SM-J327A:f70f7ad15285587:soft_step_counter",
"endTimeNanos": "1516414438267918925",
"value": [
{
"mapVal": [],
"intVal": 5062
}
],
"dataTypeName": "com.google.step_count.delta"
}
]
}
]
},
{
"startTimeMillis": "1516427598911",
"endTimeMillis": "1516513998911",
"dataset": [
{
"dataSourceId": "derived:com.google.step_count.delta:com.google.android.gms:aggregated",
"point": [
{
"startTimeNanos": "1516460952729000000",
"originDataSourceId": "derived:com.google.step_count.cumulative:com.google.android.gms:samsung:SAMSUNG-SM-J327A:f70f7ad15285587:soft_step_counter",
"endTimeNanos": "1516498195733000000",
"value": [
{
"mapVal": [],
"intVal": 1884
}
],
"dataTypeName": "com.google.step_count.delta"
}
]
}
]
}
]
}
+100
View File
@@ -0,0 +1,100 @@
html {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
position: relative;
}
title {
color: blue;
}
body {
margin: 0;
padding: 0;
position: absolute;
height: 100%;
width: 100%;
/*background-image: url(pics/indexbg.jpg);*/
background-repeat: no-repeat;
background-size: cover;
}
div.input {
margin: 0;
position: absolute;
padding: 0;
width: 100%;
height: 500px;
}
p.title {
margin: 0;
padding: 0;
height: 100px;
width: 70%;
text-align: center;
position: absolute;
top: 12%;
left: 50%;
margin-right: -50%;
transform: translate(-50%, -50%);
font-family: 'Open Sans Condensed', sans-serif;
font-size: 150px;
color: papayawhip;
}
font.title {
margin: 0;
padding-top: 5px;
height: 100px;
width: 70%;
text-align: center;
position: absolute;
top: 212%;
left: 50%;
margin-right: -50%;
transform: translate(-50%, -50%);
font-family: 'Courier New';
font-size: 20px;
color: yellow;
}
p.inputs {
color: dimgray;
margin: 0;
padding: 5px;
border-radius: 8px;
background-color: papayawhip;
height: 110px;
width: 100%;
text-align: center;
position: fixed;
top: 70%;
left: 50%;
margin-right: -50%;
transform: translate(-50%, -50%);
font-family: 'Open Sans Condensed', sans-serif;
box-shadow: 3px 3px 2px #888888;
vertical-align: middle;
line-height: 50px;
font-size: 40px;
}
button {
margin: 0;
font-family: 'Open Sans Condensed', sans-serif;
font-size: 20px;
background-color: darkblue;
color: white;
height: 35px;
width: 150px;
padding: 0 5px 0 5px;
border: none;
box-shadow: 3px 3px 2px #888888;
}
button:hover {
font-size: 19px;
-moz-box-shadow: inset 0 0 10px #000000;
-webkit-box-shadow: inset 0 0 10px #000000;
box-shadow: inset 0 0 10px #000000;
cursor: pointer;
}

Before

Width:  |  Height:  |  Size: 2.0 MiB

After

Width:  |  Height:  |  Size: 2.0 MiB

+34 -2
View File
@@ -1,13 +1,45 @@
<html>
<!DOCTYPE html> <!DOCTYPE html>
<html>
<html> <html>
<head> <head>
{% load static %}
<link rel="shortcut icon" href="pics/Airplane.ico" />
<title>Flex</title> <title>Flex</title>
<link rel="stylesheet" type="text/css" href="{% static '/home/main.css' %}">
<script type="text/javascript" src="jquery-3.1.1.min.js"></script>
<link rel="stylesheet" type="text/css" href="{% static '/home/main.css' %}">
<link href="https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300" rel="stylesheet">
</head> </head>
<body> <body>
<h1>FLEX - health</h1> <h1>FLEX - health</h1>
<br><br> <br><br>
{{ r.text }}
<div class="input">
<p class="title">Reflex
<font color="yellow" class="title">Accomplishing goals in a better way</font>
</p>
{% if request.user.is_authenticated %}
<p class="inputs"> Welcome, {{ request.user.username }}
<br>
<a href="{% url 'logout' %}"><button id="begin">End Process</button></a>
<br>
</p>
{% else %}
<p class="inputs">Welcome to Reflex Fitness!
<br>
<a href="{% url 'signin' %}"><button id="begin">Begin Process</button></a>
<br>
</p>
{% endif %}
</div>
{{ r }}
<script type="text/javascript" src="{% static '/home/indexJs.js' %}"></script>
</body> </body>
</html> </html>
</html> </html>
+37
View File
@@ -0,0 +1,37 @@
<!Doctype html>
<html>
<head>
<link rel="shortcut icon" href="pics/Airplane.ico" />
<title>Seat-X</title>
<script type="text/javascript" src="jquery-3.1.1.min.js"></script>
<link rel="stylesheet" type="text/css" href="main.css">
<link href="https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300" rel="stylesheet">
</head>
<body>
<div class="input">
<p class="title">Reflex
<font color="yellow" class="title">Accomplishing goals in a better way</font>
</p>
<p class="inputs">Welcome to Relfex Fitness!
<br>
<a href="planePage.html"><button id="begin">Begin Process</button></a>
<br>
</p>
</div>
<script type="text/javascript" src="indexJs.js"></script>
</body>
</html>
+23
View File
@@ -0,0 +1,23 @@
$(document).ready(function() {
$('body').css('display','none');
$(document).ready(function() {
$('body').fadeIn(1000);
$('a').on('click',function(event){
var thetarget = this.getAttribute('target')
if (thetarget != "_blank"){
var thehref = this.getAttribute('href')
event.preventDefault();
$('body').fadeOut(function(){
//alert(thehref)
window.location = thehref
});
}
});
});
setTimeout(function(){
$('body').fadeIn();
},1000)
});
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

@@ -0,0 +1,6 @@
{% block content %}
<p>Logged out!</p>
<button><a href="{% url 'home'%}">Home</a></button><br>
<button><a href="{% url 'signin'%}">Sign-in</a></button>
{% endblock %}
+1
View File
@@ -5,4 +5,5 @@ from . import views
appname = 'home' appname = 'home'
urlpatterns = [ urlpatterns = [
path('', views.home, name='home'), path('', views.home, name='home'),
path('signin', views.user_login, name='signin'),
] ]
+29 -3
View File
@@ -1,8 +1,34 @@
from django.shortcuts import render from django.shortcuts import render, redirect
from django.http import HttpResponse, HttpRequest from django.http import HttpResponse, HttpRequest
from django.contrib.auth import login, authenticate
import requests import requests
import os
import json
# Create your views here. # Create your views here.
def home(request): def home(request):
r = requests.get('https://www.google.com') module_dir = os.path.dirname(__file__) # get current directory
return render(request, 'home/home.html', {'r':r}) file_path = os.path.join(module_dir, 'static/home/fit.json')
#json_file_name = '../../static/home/fit.json'
raw_data = open(file_path, 'rt')
my_data = json.load(raw_data)
raw_data.close()
walk_data = []
i = 0
while i < len(my_data['bucket']):
walk_data.append(my_data['bucket'][i]['dataset'][0]['point'][0]['value'][0]['intVal'])
i = i+1
#my_data['bucket'][0]['dataset'][0]['point'][0]['value'][0]['intVal']
return render(request, 'home/home.html', {'r':walk_data})
def user_login(request):
username = 'devam'
password = 'devamdevam'
auth_user = authenticate(request, username=username, password=password)
if auth_user is not None:
login(request, auth_user)
return redirect('home') # -----------
else:
return HttpResponse("Unable to log in. User not found. <br>Please check superuser for more details.")
return HttpResponse("It's not supposed to come till here.")

Some files were not shown because too many files have changed in this diff Show More