<commit_before>from flask import Blueprint, render_template, abort, request, redirect, url_for, g
from flask.ext.login import LoginManager, current_user, login_user, logout_user, login_required
from bs4 import BeautifulSoup
import urllib.request
from wtforms import Form, IntegerField, TextField, PasswordField, validators, SelectField
from app import db
from app.mod_index.models import MedicineUser, Medicine

from app.mod_index.forms import RegistrationForm

mod_index = Blueprint("index", __name__, url_prefix="/", template_folder="templates")

# Home Page - list of medications
@mod_index.route("/")
@login_required
def index():
    medications = Medicine.query.all()

    return render_template('meds.html', data=medications)


# Page for each medication, for registering meds to your own list
@mod_index.route('Med/<medication>', methods=['GET', 'POST'])
@login_required
def med(medication):
    gotMed = Medicine.query.filter_by(shortname=medication).first()

    if gotMed is None:
        return abort(404)

    form = RegistrationForm(request.form)

    if request.method == 'POST':
        print("Valid Med")
        newMed = MedicineUser(g.user.id, medication, form.amount.data, form.intake.data, form.notes.data)<commit_msg>adads<commit_after>from flask import Blueprint, render_template, abort, request, redirect, url_for, g
from flask.ext.login import LoginManager, current_user, login_user, logout_user, login_required
from bs4 import BeautifulSoup
import urllib.request
from wtforms import Form, IntegerField, TextField, PasswordField, validators, SelectField
from app import db
from app.mod_index.models import MedicineUser, Medicine

from app.mod_index.forms import RegistrationForm

mod_index = Blueprint("index", __name__, url_prefix="/", template_folder="templates")

# Home Page - list of medications
@mod_index.route("/")
@login_required
def index():
    medications = Medicine.query.all()

    return render_template('meds.html', data=medications)


# Page for each medication, for registering meds to your own list
@mod_index.route('Med/<medication>', methods=['GET', 'POST'])
@login_required
def med(medication):
    gotMed = Medicine.query.filter_by(shortname=medication).first()

    if gotMed is None:
        return abort(404)

    form = RegistrationForm(request.form)

    if request.method == 'POST':
        print("Valid Med")
        newMed = MedicineUser(g.user.id, gotMed.id, form.amount.data, form.intake.data, form.notes.data)
{'fraction_non_alphanumeric': 0.10660721524118362, 'fraction_numerical': 0.0032428050263477908, 'mean_word_length': 5.232323232323233, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '508367', 'n_tokens_mistral': 739, 'n_tokens_neox': 711, 'n_words': 205}