by posone2375
Cancer Type Directory
import logging
import os
from gunicorn.app.base import BaseApplication
from app_init import create_initialized_flask_app
from flask import request, jsonify
from werkzeug.utils import secure_filename
# Setup logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
# Flask app creation should be done by create_initialized_flask_app to avoid circular dependency problems.
app = create_initialized_flask_app()
# Image validation constants
ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'webp'}
MAX_FILE_SIZE = 5 * 1024 * 1024 # 5MB
MIN_DIMENSIONS = (800, 600)
MAX_DIMENSIONS = (4000, 3000)
def allowed_file(filename):
return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
def validate_image_dimensions(file_path):
Created: | Last Updated:
Here's a step-by-step guide for using the Cancer Type Directory template:
Introduction
The Cancer Type Directory template provides a comprehensive web application for searching and displaying information about various cancer types. It includes features such as a searchable directory, detailed cancer information pages, and the latest research findings for each cancer type.
Getting Started
To begin using this template:
- Click the "Start with this Template" button in the Lazy Builder interface.
Test the Application
After starting with the template:
- Click the "Test" button in the Lazy Builder interface.
- Wait for the application to deploy and launch the Lazy CLI.
Using the Cancer Type Directory
Once the application is deployed, you can access and use it as follows:
- Open the provided server link in your web browser.
- On the home page, you'll see a search bar and a grid of cancer types.
- Use the search bar to find specific cancer types by name or description.
- Click on a cancer type card to view detailed information about that specific cancer.
- On the cancer details page, you can navigate through different tabs:
- Overview: General information about the cancer type
- Treatment: Treatment options and success rates
- Clinical Trials: Information about ongoing clinical trials
- Resources: Additional resources for patients and caregivers
- Latest Research: Recent research findings and novel approaches
Customizing the Directory
To customize the Cancer Type Directory for your specific needs:
-
Update the cancer types and their information in the database. You can do this by modifying the SQL migration files in the
migrations
folder, particularly002_populate_cancer_types.sql
and004_add_treatment_and_images.sql
. -
To add or update images for cancer types, use the
/api/upload-image
endpoint. You can implement a frontend interface for this or use API testing tools. The endpoint accepts image files and validates them before storing. -
Customize the appearance by modifying the
styles.css
file in thestatic/css
directory. -
Adjust the layout and content of the pages by editing the HTML templates in the project root directory (
home.html
andcancer_details.html
). -
Modify the research fetching logic in
research_fetcher.py
if you want to change how the latest research is retrieved and processed.
Remember to redeploy your application after making any changes to see them reflected in the live version.
By following these steps, you'll have a fully functional Cancer Type Directory that provides valuable information to users about various cancer types, their treatments, and the latest research findings.
Here are 5 key business benefits for this Cancer Type Directory template:
Template Benefits
-
Public Health Education: Provides a centralized, accessible resource for the general public to learn about various cancer types, their symptoms, and treatments, potentially improving early detection and health outcomes.
-
Research Dissemination: Offers a platform for summarizing and sharing the latest cancer research findings, helping bridge the gap between academic studies and public understanding.
-
Patient Support: Serves as a valuable tool for patients and their families to access reliable information about specific cancer types, treatment options, and clinical trials, empowering them to make informed decisions.
-
Healthcare Professional Resource: Acts as a quick reference guide for healthcare professionals, especially those in general practice, to stay updated on various cancer types and emerging treatment approaches.
-
Fundraising and Awareness: Can be used by cancer research organizations and charities to showcase their work, raise awareness about different cancer types, and potentially support fundraising efforts by demonstrating the need for ongoing research and support.