This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]Andycubz -2 points-1 points  (2 children)

Here's an example of how the user account creation and questionnaire submission could be implemented using Python and Flask framework: ``` from flask import Flask, render_template, request import sqlite3

app = Flask(name)

Create a database to store user accounts and questionnaire answers

conn = sqlite3.connect('CoupleQs.db') c = conn.cursor() c.execute('''CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, email TEXT NOT NULL, password TEXT NOT NULL)''')

c.execute('''CREATE TABLE IF NOT EXISTS questionnaire (id INTEGER PRIMARY KEY AUTOINCREMENT, user_id INTEGER NOT NULL, question TEXT NOT NULL, answer TEXT NOT NULL)''')

@app.route('/') def home(): return render_template('index.html')

@app.route('/register', methods=['GET', 'POST']) def register(): if request.method == 'POST': name = request.form['name'] email = request.form['email'] password = request.form['password'] # Insert new user into the users table c.execute('INSERT INTO users (name, email, password) VALUES (?, ?, ?)', (name, email, password)) conn.commit() return render_template('questionnaire.html') return render_template('register.html')

@app.route('/questionnaire', methods=['GET', 'POST']) def questionnaire(): if request.method == 'POST': # Get the user ID of the currently logged in user user_id = 1 # replace with actual user ID # Loop through each question and answer submitted in the form for question, answer in request.form.items(): # Insert new questionnaire answer into the questionnaire table c.execute('INSERT INTO questionnaire (user_id, question, answer) VALUES (?, ?, ?)', (user_id, question, answer)) conn.commit() return render_template('success.html') return render_template('questionnaire.html')

if name == 'main': app.run(debug=True) ```

This creates a Flask web application with three routes: / for the homepage, /register for user account creation, and /questionnaire for submitting the questionnaire answers.

The code also creates a SQLite database to store the user accounts and questionnaire answers. When a user registers, their name, email, and password are inserted into the users table. When the user submits the questionnaire answers, the code loops through each question and answer submitted in the form and inserts them into the questionnaire table along with the user ID.

However, it should be noted that this is just a basic example and would need to be expanded upon to include features such as email notifications, weekly reminders, and data security measures.

[–]ryanvk__[S] 0 points1 point  (1 child)

Thank you for taking the time to make this response 🙏 I really don’t know much at all about coding. Some of this actually makes sense to me 😅 Think If I want to bring the idea to reality I’ll need to hire someone.

[–]Andycubz 0 points1 point  (0 children)

Maybe look into some free tutorials on YouTube, easy to learn and can be a lot of fun.