A comprehensive web-based survey application for conducting free will belief assessments, built with FastAPI and SQLite.
This application provides a modern, responsive web interface for conducting surveys related to free will beliefs. It includes:
- A dynamic HTML-based survey interface
- RESTful API backend for data collection
- Automatic data storage in both SQLite and CSV formats
- Real-time statistics calculation
- Cross-platform compatibility
- Prerequisites
- Installation
- Project Structure
- Configuration
- Usage
- API Documentation
- Data Storage
- Development
- Contributing
- License
- Python 3.8 or higher
- pip (Python package manager)
- Git (for version control)
- Clone the repository:
git clone https://github.com/yourusername/FreeWill-HTML.git
cd FreeWill-HTML- Create and activate a virtual environment (recommended):
python -m venv venv
source venv/bin/activate # On Windows, use: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Initialize the database:
python init_db.pyFreeWill-HTML/
├── main.py # FastAPI application server
├── init_db.py # Database initialization script
├── index.html # Main survey interface
├── requirements.txt # Python dependencies
├── data/ # Data directory (created on init)
│ ├── survey_responses.db # SQLite database
│ └── survey_responses.csv # CSV export of responses
└── README.md # This documentation
The application uses several configuration settings that can be modified:
- Database location:
data/survey_responses.db - CSV export location:
data/survey_responses.csv - Server host:
0.0.0.0(default) - Server port:
8000(default)
- Start the server:
python main.py- Access the application:
- Web interface:
http://localhost:8000 - API documentation:
http://localhost:8000/docs
Submit a new survey response.
Request body:
{
"responses": {
"question_id": integer_value,
...
},
"scores": {
"category": float_value,
...
},
"metadata": {
"key": value,
...
}
}Retrieve survey statistics.
Response:
{
"total_responses": integer,
"average_scores": {
"category": float,
...
},
"latest_response": timestamp
}The SQLite database (data/survey_responses.db) contains the following structure:
CREATE TABLE responses (
id INTEGER PRIMARY KEY AUTOINCREMENT,
timestamp TEXT NOT NULL,
responses TEXT NOT NULL,
scores TEXT NOT NULL,
metadata TEXT NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);The application automatically maintains a CSV export (data/survey_responses.csv) with the following columns:
- id
- timestamp
- response_* (question responses)
- score_* (category scores)
- metadata_* (additional information)
- Update the survey interface in
index.html - Ensure the question IDs match the expected format in the API
- Update any scoring calculations as needed
- Update the
SurveyDatamodel inmain.py - Modify the database schema in
init_db.py - Update the CSV export function in
main.py
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- User authentication system
- Advanced analytics dashboard
- Multiple survey templates
- Internationalization support
- Export to additional formats
- Implement user authentication
- Add database migrations
- Create admin interface
- Enhance data visualization
- Add API rate limiting
- Implement caching
- LMS (Learning Management Systems)
- Research platforms
- Data analysis tools
- External authentication providers
For more information or support, please open an issue on the GitHub repository.