Works for now
This commit is contained in:
10
app.py
10
app.py
@@ -1,4 +1,4 @@
|
||||
# app.py (updated)
|
||||
# app.py (final version)
|
||||
from flask import Flask, render_template, request, redirect, url_for, session, flash
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from datetime import datetime
|
||||
@@ -37,8 +37,6 @@ with app.app_context():
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
if 'user_id' in session:
|
||||
return redirect(url_for('dashboard'))
|
||||
return render_template('index.html')
|
||||
|
||||
@app.route('/register', methods=['GET', 'POST'])
|
||||
@@ -180,15 +178,13 @@ def delete_record(record_id):
|
||||
|
||||
@app.route('/predict_diseases', methods=['POST'])
|
||||
def predict_diseases():
|
||||
if 'user_id' not in session:
|
||||
return redirect(url_for('login'))
|
||||
|
||||
# Make this endpoint publicly accessible
|
||||
current_disease = request.form['current_disease'].strip()
|
||||
|
||||
# In a real application, this would process the data and generate predictions
|
||||
# For demonstration, we'll just simulate the result based on some common patterns
|
||||
|
||||
# Get all health records to analyze correlations
|
||||
# Get all health records to analyze correlations (no user session required)
|
||||
all_records = HealthRecord.query.all()
|
||||
|
||||
# Simple correlation analysis (would be more complex in reality)
|
||||
|
||||
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
<!-- templates/base.html (updated) -->
|
||||
<!-- templates/base.html (final version - completely fixed) -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@@ -391,7 +391,7 @@
|
||||
<div class="user-section">
|
||||
<div class="user-info">
|
||||
<h3>{{ session.username }}</h3>
|
||||
<p>Member since {{ user.created_at.strftime('%b %Y') if 'user' in locals() and user else '' }}</p>
|
||||
<p>Member since {{ user.created_at.strftime('%b %Y') if user and user.created_at else '' }}</p>
|
||||
</div>
|
||||
<a href="{{ url_for('logout') }}" class="btn btn-outline-light">Logout</a>
|
||||
</div>
|
||||
|
||||
@@ -3,40 +3,37 @@
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-md-6 mx-auto text-center">
|
||||
<h2>Welcome to Health History Tracker</h2>
|
||||
<p class="lead">Track and manage your health records with our secure platform.</p>
|
||||
<div class="mt-4">
|
||||
{% if session.user_id %}
|
||||
<a href="{{ url_for('dashboard') }}" class="btn btn-primary btn-lg me-2">Go to Dashboard</a>
|
||||
<a href="{{ url_for('logout') }}" class="btn btn-outline-secondary btn-lg">Logout</a>
|
||||
{% else %}
|
||||
<a href="{{ url_for('login') }}" class="btn btn-primary btn-lg me-2">Login</a>
|
||||
<a href="{{ url_for('register') }}" class="btn btn-outline-primary btn-lg">Register</a>
|
||||
{% endif %}
|
||||
<div class="col-md-8 mx-auto text-center">
|
||||
<h2>Health Disease Prediction Engine</h2>
|
||||
<p class="lead">Enter your current illness and get statistical recommendations based on health records from all users</p>
|
||||
|
||||
<div class="card mt-5">
|
||||
<div class="card-body">
|
||||
<form id="search-form" method="POST" action="{{ url_for('predict_diseases') }}">
|
||||
<div class="mb-4">
|
||||
<label for="current-disease" class="form-label">Enter Your Current Illness</label>
|
||||
<input type="text" class="form-control form-control-lg" id="current-disease" name="current_disease"
|
||||
placeholder="e.g., Headache, Fever, Chest Pain..." required>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary btn-lg w-100">
|
||||
<i class="fas fa-search"></i> Find Related Diseases
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Disease Prediction Section -->
|
||||
<div class="row mt-5">
|
||||
<div class="col-md-8 mx-auto">
|
||||
<div class="card">
|
||||
|
||||
<div class="card mt-5">
|
||||
<div class="card-header">
|
||||
<h3><i class="fas fa-search"></i> Disease Prediction Engine</h3>
|
||||
<h4><i class="fas fa-info-circle"></i> How It Works</h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p class="text-muted">Enter your current illness to get statistical recommendations based on all registered users' health records.</p>
|
||||
|
||||
<form id="search-form" method="POST" action="{{ url_for('predict_diseases') }}" class="mt-3">
|
||||
<div class="input-group mb-3">
|
||||
<input type="text" class="form-control" id="current-disease" name="current_disease"
|
||||
placeholder="e.g., Headache, Fever, Chest Pain..." required>
|
||||
<button class="btn btn-primary" type="submit">
|
||||
<i class="fas fa-search"></i> Find Related Diseases
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<p>This tool analyzes statistical patterns from all registered users' health records to provide insights into related conditions.</p>
|
||||
<ul class="text-start">
|
||||
<li>Enter your current illness in the search box above</li>
|
||||
<li>View statistically significant related conditions</li>
|
||||
<li>Understand common co-occurrences with your symptoms</li>
|
||||
<li>This is for informational purposes only - not medical advice</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-md-8 mx-auto">
|
||||
<div class="col-md-10 mx-auto">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3><i class="fas fa-search"></i> Disease Prediction Results</h3>
|
||||
@@ -82,8 +82,8 @@
|
||||
<a href="{{ url_for('index') }}" class="btn btn-primary">
|
||||
<i class="fas fa-search"></i> Search Another Illness
|
||||
</a>
|
||||
<a href="{{ url_for('dashboard') }}" class="btn btn-outline-secondary">
|
||||
<i class="fas fa-home"></i> Back to Dashboard
|
||||
<a href="{{ url_for('login') }}" class="btn btn-outline-secondary">
|
||||
<i class="fas fa-user"></i> Login to Track Your Health Records
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user