There will be a short maintenance break on Wed 27.10. at 12:00. Estimated time 30 minutes.

Commit cb7fa276 authored by Ossi Laine's avatar Ossi Laine
Browse files

Reformat project structure

parent 5bc65185
File deleted
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from config import Config
engine = create_engine(Config.SQLALCHEMY_DATABASE_URI, convert_unicode=True)
db_session = scoped_session(sessionmaker(autocommit=False,
autoflush=False,
bind=engine))
Base = declarative_base()
Base.query = db_session.query_property()
def init_db():
import app.models
Base.metadata.create_all(bind=engine)
...@@ -35,11 +35,8 @@ from app.forms import ( ...@@ -35,11 +35,8 @@ from app.forms import (
) )
from app.utils import get_mean_from_slider_answers, map_answers_to_questions, \ from app.utils import get_mean_from_slider_answers, map_answers_to_questions, \
generate_csv generate_csv
from app.embody_plot import get_coordinates
import embody_plot
# Stimuli upload folder setting
#APP_ROOT = os.path.dirname(os.path.abspath(__file__))
experiment_blueprint = Blueprint("experiment", __name__, experiment_blueprint = Blueprint("experiment", __name__,
template_folder='templates', template_folder='templates',
...@@ -1051,7 +1048,7 @@ def start_create_embody(): ...@@ -1051,7 +1048,7 @@ def start_create_embody():
def create_embody(meta): def create_embody(meta):
page = meta["page"] page = meta["page"]
embody = meta["embody"] embody = meta["embody"]
img_path = embody_plot.get_coordinates(page, embody) img_path = get_coordinates(page, embody)
app.logger.info(img_path) app.logger.info(img_path)
emit('end', {'path': img_path}) emit('end', {'path': img_path})
......
[python: app/**.py]
[jinja2: app/templates/**.html]
extensions=jinja2.ext.autoescape,jinja2.ext.with_
CREATE TABLE background_question (
idbackground_question INTEGER NOT NULL,
background_question VARCHAR(120),
experiment_idexperiment INTEGER,
PRIMARY KEY (idbackground_question)
);
CREATE TABLE experiment (
idexperiment INTEGER NOT NULL,
name VARCHAR(120),
instruction VARCHAR(120),
directoryname VARCHAR(120),
language VARCHAR(120),
status VARCHAR(120),
randomization VARCHAR(120),
PRIMARY KEY (idexperiment)
);
CREATE TABLE trial_randomization (
idtrial_randomization INTEGER NOT NULL,
page_idpage INTEGER,
randomized_idpage INTEGER,
answer_set_idanswer_set INTEGER,
experiment_idexperiment INTEGER,
PRIMARY KEY (idtrial_randomization)
);
CREATE TABLE user (
id INTEGER NOT NULL,
username VARCHAR(64),
email VARCHAR(120),
password_hash VARCHAR(128),
PRIMARY KEY (id)
);
CREATE TABLE answer_set (
idanswer_set INTEGER NOT NULL,
experiment_idexperiment INTEGER,
session VARCHAR(120),
agreement VARCHAR(120),
answer_counter INTEGER,
PRIMARY KEY (idanswer_set),
FOREIGN KEY(experiment_idexperiment) REFERENCES experiment (idexperiment)
);
CREATE TABLE background_question_option (
idbackground_question_option INTEGER NOT NULL,
background_question_idbackground_question INTEGER,
option VARCHAR(120),
PRIMARY KEY (idbackground_question_option),
FOREIGN KEY(background_question_idbackground_question) REFERENCES background_question (idbackground_question)
);
CREATE TABLE page (
idpage INTEGER NOT NULL,
experiment_idexperiment INTEGER,
type VARCHAR(120),
text VARCHAR(120),
media VARCHAR(120),
PRIMARY KEY (idpage),
FOREIGN KEY(experiment_idexperiment) REFERENCES experiment (idexperiment)
);
CREATE TABLE question (
idquestion INTEGER NOT NULL,
experiment_idexperiment INTEGER,
question VARCHAR(120),
`left` VARCHAR(120),
`right` VARCHAR(120),
PRIMARY KEY (idquestion),
FOREIGN KEY(experiment_idexperiment) REFERENCES experiment (idexperiment)
);
CREATE TABLE answer (
idanswer INTEGER NOT NULL,
question_idquestion INTEGER,
answer_set_idanswer_set INTEGER,
answer VARCHAR(120),
page_idpage INTEGER,
PRIMARY KEY (idanswer),
FOREIGN KEY(answer_set_idanswer_set) REFERENCES answer_set (idanswer_set),
FOREIGN KEY(page_idpage) REFERENCES page (idpage),
FOREIGN KEY(question_idquestion) REFERENCES question (idquestion)
);
CREATE TABLE background_question_answer (
idbackground_question_answer INTEGER NOT NULL,
answer_set_idanswer_set INTEGER,
answer VARCHAR(120),
background_question_idbackground_question INTEGER,
PRIMARY KEY (idbackground_question_answer),
FOREIGN KEY(answer_set_idanswer_set) REFERENCES answer_set (idanswer_set),
FOREIGN KEY(background_question_idbackground_question) REFERENCES background_question (idbackground_question)
);
CREATE UNIQUE INDEX ix_experiment_directoryname ON experiment (directoryname);
CREATE INDEX ix_experiment_instruction ON experiment (instruction);
CREATE INDEX ix_experiment_name ON experiment (name);
CREATE UNIQUE INDEX ix_user_email ON user (email);
CREATE UNIQUE INDEX ix_user_username ON user (username);
CREATE INDEX ix_page_media ON page (media);
CREATE INDEX ix_page_text ON page (text);
CREATE INDEX ix_page_type ON page (type);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment