diff --git a/.gitignore b/.gitignore index 034d6d179..af9a27ff1 100644 --- a/.gitignore +++ b/.gitignore @@ -139,4 +139,4 @@ dmypy.json *.code-workspace .vs/PythonSettings.json .vs/slnx.sqlite -.vs/TherapyNow/v16/.suo +.vs/PeerSupport/v16/.suo diff --git a/README.md b/README.md index 1c912c76b..a3d0079fe 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -![text](https://github.com/IanSteenstra/TherapyNow/blob/master/frontend/src/images/logo-hori.jpg) +![text](https://github.com/IanSteenstra/PeerSupport/blob/master/frontend/src/images/logo-hori.jpg) -# TherapyNow +# PeerSupport ## Summary -TherapyNow is an anonymous peer-support web application that provides easy access for college students to get the help they need in a safe and reliable manner. +PeerSupport is an anonymous peer-support web application that provides easy access for college students to get the help they need in a safe and reliable manner. ## Run Codebase @@ -18,7 +18,7 @@ TherapyNow is an anonymous peer-support web application that provides easy acces ## Issue Running Codebase / Servers Not Working 1. In another terminal while the servers are still running, enter `docker ps` -1. Find the Container ID for the therapynow_django server (ex: db54a724e9a4) +1. Find the Container ID for the peersupport_django server (ex: db54a724e9a4) 1. Run `docker exec -it bash` 1. `python manage.py migrate` diff --git a/archive/research/preprocessing/personality_quiz_preprocessing.py b/archive/research/preprocessing/personality_quiz_preprocessing.py index e4b71fcce..b4a50389a 100644 --- a/archive/research/preprocessing/personality_quiz_preprocessing.py +++ b/archive/research/preprocessing/personality_quiz_preprocessing.py @@ -8,4 +8,4 @@ df[cat_columns] = df[cat_columns].apply(lambda x: x.cat.codes) -df.to_csv(r'C:\Users\steeni\Documents\Github\TherapyNow\research\training\processed_personality_quiz_responses.csv') +df.to_csv(r'C:\Users\steeni\Documents\Github\PeerSupport\research\training\processed_personality_quiz_responses.csv') diff --git a/archive/research/suicidal_ideation_detection.ipynb b/archive/research/suicidal_ideation_detection.ipynb index dc75f37c9..6aa0383ba 100644 --- a/archive/research/suicidal_ideation_detection.ipynb +++ b/archive/research/suicidal_ideation_detection.ipynb @@ -12,20 +12,12 @@ }, { "cell_type": "code", - "execution_count": 92, + "execution_count": 12, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "C:\\Users\\steen\\Anaconda3\\lib\\site-packages\\sklearn\\externals\\joblib\\__init__.py:15: DeprecationWarning: sklearn.externals.joblib is deprecated in 0.21 and will be removed in 0.23. Please import this functionality directly from joblib, which can be installed with: pip install joblib. If this warning is raised when loading pickled models, you may need to re-serialize those models with scikit-learn 0.21+.\n", - " warnings.warn(msg, category=DeprecationWarning)\n" - ] - } - ], + "outputs": [], "source": [ "import pandas as pd\n", + "import joblib\n", "import numpy as np\n", "from textblob import TextBlob as tb\n", "import nltk\n", @@ -38,21 +30,13 @@ "from sklearn.metrics import accuracy_score, confusion_matrix, classification_report, r2_score\n", "from nltk.corpus import wordnet as wn\n", "from sklearn import preprocessing\n", - "import matplotlib.pyplot as plt\n", - "import seaborn as sns\n", + "# import matplotlib.pyplot as plt\n", + "# import seaborn as sns\n", "from sklearn.model_selection import GridSearchCV\n", "import pickle\n", - "from sklearn.externals import joblib\n", "from gensim.models import FastText" ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Data Preprocessing" - ] - }, { "cell_type": "code", "execution_count": 3, @@ -63,7 +47,7 @@ "source": [ "data = pd.DataFrame(columns=('text', 'suicidal_ideation'))\n", "for i in range(10):\n", - " data = pd.concat([data, pd.read_csv('annotated_data'+str(i)+'.csv')], sort=False)" + " data = pd.concat([data, pd.read_csv('suicidal-ideation-datasets/annotated_data'+str(i)+'.csv')], sort=False)" ] }, { @@ -743,9 +727,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.4" + "version": "3.7.7-final" } }, "nbformat": 4, "nbformat_minor": 2 -} +} \ No newline at end of file diff --git a/backend/Dockerfile b/backend/Dockerfile index ee5a07b98..b290f830e 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -2,18 +2,18 @@ FROM python:3.7.7 RUN apt-get update \ && apt-get install -y --no-install-recommends \ - postgresql-client \ + postgresql-client \ && rm -rf /var/lib/apt/lists/* ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 -WORKDIR /therapynow/backend +WORKDIR /peersupport/backend RUN pip install --upgrade pip -COPY requirements.txt /therapynow/backend +COPY requirements.txt /peersupport/backend RUN pip install -r requirements.txt -COPY . /therapynow/backend/ +COPY . /peersupport/backend/ EXPOSE 8000 CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"] \ No newline at end of file diff --git a/backend/NLP-models/suicidal-ideation.py b/backend/NLP-models/suicidal-ideation.py index 4084abc2e..1b7fcc733 100644 --- a/backend/NLP-models/suicidal-ideation.py +++ b/backend/NLP-models/suicidal-ideation.py @@ -1,9 +1,45 @@ import pandas as pd import numpy as np +from sklearn.feature_extraction.text import TfidfVectorizer +from sklearn import preprocessing +import re +import joblib +import os + class SuicidalIdeationModel: - def __init__(self, content): - self.content = content - + def __init__(self, text): + dir_path = os.path.dirname(os.path.realpath(__file__)) + + self.text = text + self.model = joblib.load(dir_path + '\\suicidal_classifier.pkl') + def predict(self): - return len(self.content) \ No newline at end of file + dir_path = os.path.dirname(os.path.realpath(__file__)) + + data = pd.DataFrame(columns=('text', 'suicidal_ideation')) + for i in range(10): + data = pd.concat( + [data, pd.read_csv(dir_path + '\\datasets\\annotated_data'+str(i)+'.csv')], sort=False) + + X = data['text'] + X = X.apply(lambda text: re.sub(r"http\S+", "", text).lower()) + + text = pd.DataFrame({'text': [self.text]}) + + print(text) + # tfidf = TfidfVectorizer(analyzer='word', ngram_range=(1, 2)) + # features = pd.DataFrame(tfidf.fit_transform([self.text]).toarray()) + # print(features) + # features = features.values + # min_max_scaler = preprocessing.MinMaxScaler() + # features_scaled = min_max_scaler.fit_transform(features) + # features = pd.DataFrame(features_scaled) + # prediction = self.model.predict(features) + # return prediction + + +if __name__ == '__main__': + content = 'I want to die' + s = SuicidalIdeationModel(content) + print(s.predict()) diff --git a/backend/TherapyNow/__init__.py b/backend/PeerSupport/__init__.py similarity index 100% rename from backend/TherapyNow/__init__.py rename to backend/PeerSupport/__init__.py diff --git a/backend/TherapyNow/asgi.py b/backend/PeerSupport/asgi.py similarity index 77% rename from backend/TherapyNow/asgi.py rename to backend/PeerSupport/asgi.py index 3fe5e94c3..eb1566356 100644 --- a/backend/TherapyNow/asgi.py +++ b/backend/PeerSupport/asgi.py @@ -1,5 +1,5 @@ """ -ASGI config for TherapyNow project. +ASGI config for PeerSupport project. It exposes the ASGI callable as a module-level variable named ``application``. @@ -12,6 +12,6 @@ from django.core.asgi import get_asgi_application from channels.routing import get_default_application -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'TherapyNow.settings') +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'PeerSupport.settings') django.setup() application = get_default_application() diff --git a/backend/TherapyNow/routing.py b/backend/PeerSupport/routing.py similarity index 100% rename from backend/TherapyNow/routing.py rename to backend/PeerSupport/routing.py diff --git a/backend/TherapyNow/settings.py b/backend/PeerSupport/settings.py similarity index 97% rename from backend/TherapyNow/settings.py rename to backend/PeerSupport/settings.py index a3bc1447e..63be740e0 100644 --- a/backend/TherapyNow/settings.py +++ b/backend/PeerSupport/settings.py @@ -1,5 +1,5 @@ """ -Django settings for TherapyNow project. +Django settings for PeerSupport project. Generated by 'django-admin startproject' using Django 3.0.2. @@ -44,7 +44,7 @@ 'chat', 'message', 'events', - 'Profile', + 'profile', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', @@ -79,7 +79,7 @@ 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] -ROOT_URLCONF = 'TherapyNow.urls' +ROOT_URLCONF = 'PeerSupport.urls' TEMPLATES_ROOT = os.path.join(BASE_DIR, "templates") TEMPLATES = [ { @@ -97,7 +97,7 @@ }, ] -ASGI_APPLICATION = 'TherapyNow.routing.application' +ASGI_APPLICATION = 'PeerSupport.routing.application' CHANNEL_LAYERS = { 'default': { diff --git a/backend/TherapyNow/urls.py b/backend/PeerSupport/urls.py similarity index 96% rename from backend/TherapyNow/urls.py rename to backend/PeerSupport/urls.py index 83566661d..4ff0e0894 100644 --- a/backend/TherapyNow/urls.py +++ b/backend/PeerSupport/urls.py @@ -3,7 +3,7 @@ from rest_framework import routers from allauth.account.views import ConfirmEmailView from rest_framework.authtoken.views import obtain_auth_token -from Profile.views import null_view, getUserEmail, complete_view, ProfileViewSet, PreStudyQuizViewSet, PostStudyQuizViewSet, WeekPostStudyQuizViewSet, UserQuizViewSet, CounselorQuizViewSet, ResearchQuizViewSet, get_chats, get_friends, validate_user_group +from profile.views import null_view, getUserEmail, complete_view, ProfileViewSet, PreStudyQuizViewSet, PostStudyQuizViewSet, WeekPostStudyQuizViewSet, UserQuizViewSet, CounselorQuizViewSet, ResearchQuizViewSet, get_chats, get_friends, validate_user_group from events.views import EventViewSet from chat.views import ChatViewSet from message.views import MessageFlagViewSet diff --git a/backend/TherapyNow/wsgi.py b/backend/PeerSupport/wsgi.py similarity index 72% rename from backend/TherapyNow/wsgi.py rename to backend/PeerSupport/wsgi.py index 0dffc1b36..8462ccf40 100644 --- a/backend/TherapyNow/wsgi.py +++ b/backend/PeerSupport/wsgi.py @@ -1,5 +1,5 @@ """ -WSGI config for TherapyNow project. +WSGI config for PeerSupport project. It exposes the WSGI callable as a module-level variable named ``application``. @@ -11,6 +11,6 @@ from django.core.wsgi import get_wsgi_application -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'TherapyNow.settings') +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'PeerSupport.settings') application = get_wsgi_application() diff --git a/backend/Profile/__init__.py b/backend/Profile/__init__.py index 5be182491..09cda9b90 100644 --- a/backend/Profile/__init__.py +++ b/backend/Profile/__init__.py @@ -1 +1 @@ -default_app_config = 'Profile.apps.ProfileConfig' \ No newline at end of file +default_app_config = 'profile.apps.ProfileConfig' diff --git a/backend/Profile/apps.py b/backend/Profile/apps.py index 5c18d18f9..428518f00 100644 --- a/backend/Profile/apps.py +++ b/backend/Profile/apps.py @@ -2,7 +2,7 @@ class ProfileConfig(AppConfig): - name = 'Profile' + name = 'profile' - def ready(self): - import Profile.signals + def ready(self): + import profile.signals diff --git a/backend/Profile/migrations/0001_initial.py b/backend/Profile/migrations/0001_initial.py index 0725e3995..586ef15be 100644 --- a/backend/Profile/migrations/0001_initial.py +++ b/backend/Profile/migrations/0001_initial.py @@ -1,5 +1,6 @@ -# Generated by Django 3.0.7 on 2020-07-24 05:35 +# Generated by Django 3.0.7 on 2020-08-17 22:26 +from django.conf import settings from django.db import migrations, models import django.db.models.deletion import multiselectfield.db.fields @@ -10,43 +11,24 @@ class Migration(migrations.Migration): initial = True dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('chat', '0001_initial'), ] operations = [ migrations.CreateModel( - name='Counselor', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('username', models.CharField(default='', max_length=120)), - ('email', models.EmailField(max_length=255)), - ('created', models.DateTimeField()), - ('gender', models.CharField(blank=True, choices=[('Male', 'Male'), ('Female', 'Female'), ('Non Binary', 'Non Binary'), ('Transgender', 'Transgender'), ('Gender Fluid', 'Gender Fluid'), ('Prefer not to answer', 'Prefer not to answer')], max_length=30, null=True)), - ('ethnic_origin', multiselectfield.db.fields.MultiSelectField(choices=[('White', 'White'), ('Black or Afican American', 'Black or Afican American'), ('Native American or American Indian', 'Native American or American Indian'), ('Hispanic or Latino', 'Hispanic or Latino'), ('Asian / Pacific Islander', 'Asian / Pacific Islander'), ('Midddle Eastern', 'Middle Eastern'), ('South Asian', 'South Asian'), ('Other', 'Other')], max_length=143)), - ], - ), - migrations.CreateModel( - name='CounselorQuiz', + name='Profile', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('a1', models.FloatField(null=True)), - ('a2', models.FloatField(null=True)), - ('a3', models.FloatField(null=True)), - ('a4', models.FloatField(null=True)), - ('a5', models.FloatField(null=True)), - ('a6', models.FloatField(null=True)), - ('a7', models.FloatField(null=True)), - ('a8', models.FloatField(null=True)), - ('a9', models.FloatField(null=True)), - ('a10', models.FloatField(null=True)), - ('created', models.DateTimeField(null=True)), + ('alias', models.CharField(blank=True, max_length=20, null=True)), + ('best_matches', models.ManyToManyField(blank=True, related_name='matches', to='profile.Profile')), + ('chat_rooms', models.ManyToManyField(blank=True, related_name='chat_rooms', to='chat.Chat')), + ('friends', models.ManyToManyField(blank=True, to='profile.Profile')), + ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL)), ], - options={ - 'verbose_name': 'Counselor Quiz', - 'verbose_name_plural': 'Counselor Quizzes', - }, ), migrations.CreateModel( - name='PostStudyQuiz', + name='WeekPostStudyQuiz', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('q1', models.IntegerField(default=3)), @@ -69,11 +51,60 @@ class Migration(migrations.Migration): ('q18', models.IntegerField(default=3)), ('q19', models.IntegerField(default=3)), ('q20', models.IntegerField(default=3)), + ('q21', models.IntegerField(default=3)), ('created', models.DateTimeField(null=True)), + ('profile', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='profile.Profile')), ], options={ - 'verbose_name': 'PostStudy Quiz', - 'verbose_name_plural': 'PostStudy Quizzes', + 'verbose_name': 'WeekPostStudy Quiz', + 'verbose_name_plural': 'WeekPostStudy Quizzes', + }, + ), + migrations.CreateModel( + name='UserQuiz', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('happiness', models.IntegerField(null=True)), + ('hometown', models.IntegerField(null=True)), + ('receiving_giving', models.IntegerField(null=True)), + ('religion', models.IntegerField(null=True)), + ('relation_to_others', models.IntegerField(null=True)), + ('government_assistance', models.IntegerField(null=True)), + ('local_community', models.IntegerField(null=True)), + ('immediate_family', models.IntegerField(null=True)), + ('fulfilling_work', models.IntegerField(null=True)), + ('leader_social_circle', models.IntegerField(null=True)), + ('created', models.DateTimeField(null=True)), + ('profile', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='profile.Profile')), + ], + options={ + 'verbose_name': 'User Quiz', + 'verbose_name_plural': 'User Quizzes', + }, + ), + migrations.CreateModel( + name='ResearchQuiz', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('gender', models.CharField(max_length=100)), + ('race', models.CharField(max_length=100)), + ('exp', models.CharField(max_length=100)), + ('methods', models.CharField(max_length=100)), + ('age', models.CharField(max_length=100)), + ('specializations', models.CharField(max_length=100)), + ('goTo', models.CharField(max_length=100)), + ('understands', models.CharField(max_length=100)), + ('anon', models.CharField(max_length=100)), + ('compatible', models.CharField(max_length=100)), + ('sameProbs', models.CharField(max_length=100)), + ('support', models.CharField(max_length=100)), + ('contact', models.CharField(max_length=100)), + ('created', models.DateTimeField(auto_now_add=True)), + ('profile', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='profile.Profile')), + ], + options={ + 'verbose_name': 'Research Quiz', + 'verbose_name_plural': 'Research Quizzes', }, ), migrations.CreateModel( @@ -102,6 +133,7 @@ class Migration(migrations.Migration): ('q20', models.IntegerField(default=3)), ('q21', models.IntegerField(default=3)), ('created', models.DateTimeField(null=True)), + ('profile', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='profile.Profile')), ], options={ 'verbose_name': 'PreStudy Quiz', @@ -109,15 +141,7 @@ class Migration(migrations.Migration): }, ), migrations.CreateModel( - name='Profile', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('alias', models.CharField(blank=True, max_length=20, null=True)), - ('best_matches', models.ManyToManyField(blank=True, related_name='matches', to='Profile.Profile')), - ], - ), - migrations.CreateModel( - name='WeekPostStudyQuiz', + name='PostStudyQuiz', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('q1', models.IntegerField(default=3)), @@ -140,60 +164,46 @@ class Migration(migrations.Migration): ('q18', models.IntegerField(default=3)), ('q19', models.IntegerField(default=3)), ('q20', models.IntegerField(default=3)), - ('q21', models.IntegerField(default=3)), ('created', models.DateTimeField(null=True)), - ('profile', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='Profile.Profile')), + ('profile', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='profile.Profile')), ], options={ - 'verbose_name': 'WeekPostStudy Quiz', - 'verbose_name_plural': 'WeekPostStudy Quizzes', + 'verbose_name': 'PostStudy Quiz', + 'verbose_name_plural': 'PostStudy Quizzes', }, ), migrations.CreateModel( - name='UserQuiz', + name='CounselorQuiz', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('happiness', models.IntegerField(null=True)), - ('hometown', models.IntegerField(null=True)), - ('receiving_giving', models.IntegerField(null=True)), - ('religion', models.IntegerField(null=True)), - ('relation_to_others', models.IntegerField(null=True)), - ('government_assistance', models.IntegerField(null=True)), - ('local_community', models.IntegerField(null=True)), - ('immediate_family', models.IntegerField(null=True)), - ('fulfilling_work', models.IntegerField(null=True)), - ('leader_social_circle', models.IntegerField(null=True)), + ('a1', models.FloatField(null=True)), + ('a2', models.FloatField(null=True)), + ('a3', models.FloatField(null=True)), + ('a4', models.FloatField(null=True)), + ('a5', models.FloatField(null=True)), + ('a6', models.FloatField(null=True)), + ('a7', models.FloatField(null=True)), + ('a8', models.FloatField(null=True)), + ('a9', models.FloatField(null=True)), + ('a10', models.FloatField(null=True)), ('created', models.DateTimeField(null=True)), - ('profile', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='Profile.Profile')), + ('profile', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='profile.Profile')), ], options={ - 'verbose_name': 'User Quiz', - 'verbose_name_plural': 'User Quizzes', + 'verbose_name': 'Counselor Quiz', + 'verbose_name_plural': 'Counselor Quizzes', }, ), migrations.CreateModel( - name='ResearchQuiz', + name='Counselor', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('gender', models.CharField(max_length=100)), - ('race', models.CharField(max_length=100)), - ('exp', models.CharField(max_length=100)), - ('methods', models.CharField(max_length=100)), - ('age', models.CharField(max_length=100)), - ('specializations', models.CharField(max_length=100)), - ('goTo', models.CharField(max_length=100)), - ('understands', models.CharField(max_length=100)), - ('anon', models.CharField(max_length=100)), - ('compatible', models.CharField(max_length=100)), - ('sameProbs', models.CharField(max_length=100)), - ('support', models.CharField(max_length=100)), - ('contact', models.CharField(max_length=100)), - ('created', models.DateTimeField(auto_now_add=True)), - ('profile', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='Profile.Profile')), + ('username', models.CharField(default='', max_length=120)), + ('email', models.EmailField(max_length=255)), + ('created', models.DateTimeField()), + ('gender', models.CharField(blank=True, choices=[('Male', 'Male'), ('Female', 'Female'), ('Non Binary', 'Non Binary'), ('Transgender', 'Transgender'), ('Gender Fluid', 'Gender Fluid'), ('Prefer not to answer', 'Prefer not to answer')], max_length=30, null=True)), + ('ethnic_origin', multiselectfield.db.fields.MultiSelectField(choices=[('White', 'White'), ('Black or Afican American', 'Black or Afican American'), ('Native American or American Indian', 'Native American or American Indian'), ('Hispanic or Latino', 'Hispanic or Latino'), ('Asian / Pacific Islander', 'Asian / Pacific Islander'), ('Midddle Eastern', 'Middle Eastern'), ('South Asian', 'South Asian'), ('Other', 'Other')], max_length=143)), + ('profile', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='profile.Profile')), ], - options={ - 'verbose_name': 'Research Quiz', - 'verbose_name_plural': 'Research Quizzes', - }, ), ] diff --git a/backend/Profile/migrations/0002_auto_20200724_0535.py b/backend/Profile/migrations/0002_auto_20200724_0535.py deleted file mode 100644 index cfbadb006..000000000 --- a/backend/Profile/migrations/0002_auto_20200724_0535.py +++ /dev/null @@ -1,54 +0,0 @@ -# Generated by Django 3.0.7 on 2020-07-24 05:35 - -from django.conf import settings -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('chat', '0001_initial'), - ('Profile', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='profile', - name='chat_rooms', - field=models.ManyToManyField(blank=True, related_name='chat_rooms', to='chat.Chat'), - ), - migrations.AddField( - model_name='profile', - name='friends', - field=models.ManyToManyField(blank=True, to='Profile.Profile'), - ), - migrations.AddField( - model_name='profile', - name='user', - field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL), - ), - migrations.AddField( - model_name='prestudyquiz', - name='profile', - field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='Profile.Profile'), - ), - migrations.AddField( - model_name='poststudyquiz', - name='profile', - field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='Profile.Profile'), - ), - migrations.AddField( - model_name='counselorquiz', - name='profile', - field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='Profile.Profile'), - ), - migrations.AddField( - model_name='counselor', - name='profile', - field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='Profile.Profile'), - ), - ] diff --git a/backend/Profile/signals.py b/backend/Profile/signals.py index c85981922..37e6e92c2 100644 --- a/backend/Profile/signals.py +++ b/backend/Profile/signals.py @@ -3,7 +3,7 @@ from django.dispatch import receiver from rest_framework.authtoken.models import Token -from Profile.models import Profile, UserQuiz, CounselorQuiz +from profile.models import Profile, UserQuiz, CounselorQuiz @receiver(post_save, sender=User) diff --git a/backend/chat/consumers.py b/backend/chat/consumers.py index 4a4e75cec..0f8bb036c 100644 --- a/backend/chat/consumers.py +++ b/backend/chat/consumers.py @@ -1,7 +1,7 @@ from asgiref.sync import async_to_sync from channels.generic.websocket import WebsocketConsumer from .views import get_current_chat, get_messages -from Profile.views import get_user_profile +from profile.views import get_user_profile from message.models import Message import json diff --git a/backend/chat/migrations/0001_initial.py b/backend/chat/migrations/0001_initial.py index a3227123d..d2269cb99 100644 --- a/backend/chat/migrations/0001_initial.py +++ b/backend/chat/migrations/0001_initial.py @@ -1,7 +1,6 @@ -# Generated by Django 3.0.7 on 2020-07-24 05:35 +# Generated by Django 3.0.7 on 2020-08-17 22:26 from django.db import migrations, models -import django.db.models.deletion class Migration(migrations.Migration): @@ -9,9 +8,6 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('message', '0001_initial'), - ('events', '0001_initial'), - ('Profile', '0001_initial'), ] operations = [ @@ -19,9 +15,6 @@ class Migration(migrations.Migration): name='Chat', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('event', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='event', to='events.Event')), - ('messages', models.ManyToManyField(blank=True, to='message.Message')), - ('participants', models.ManyToManyField(blank=True, related_name='participants', to='Profile.Profile')), ], ), ] diff --git a/backend/chat/migrations/0002_auto_20200817_2226.py b/backend/chat/migrations/0002_auto_20200817_2226.py new file mode 100644 index 000000000..d74a5ea8a --- /dev/null +++ b/backend/chat/migrations/0002_auto_20200817_2226.py @@ -0,0 +1,34 @@ +# Generated by Django 3.0.7 on 2020-08-17 22:26 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('message', '0001_initial'), + ('events', '0001_initial'), + ('profile', '0001_initial'), + ('chat', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='chat', + name='event', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='event', to='events.Event'), + ), + migrations.AddField( + model_name='chat', + name='messages', + field=models.ManyToManyField(blank=True, to='message.Message'), + ), + migrations.AddField( + model_name='chat', + name='participants', + field=models.ManyToManyField(blank=True, related_name='participants', to='profile.Profile'), + ), + ] diff --git a/backend/chat/models.py b/backend/chat/models.py index 71cc3aea7..bb0053595 100644 --- a/backend/chat/models.py +++ b/backend/chat/models.py @@ -1,5 +1,5 @@ from django.db import models -from Profile.models import Profile +from profile.models import Profile from events.models import Event from django.core.exceptions import ObjectDoesNotExist from message.models import Message diff --git a/backend/chat/serializers.py b/backend/chat/serializers.py index 5fb9ff4e1..0172a4fc2 100644 --- a/backend/chat/serializers.py +++ b/backend/chat/serializers.py @@ -1,8 +1,8 @@ from rest_framework import serializers from django.contrib.auth import get_user_model from .models import Chat -from Profile.models import Profile -from Profile.serializers import ProfileSerializer +from profile.models import Profile +from profile.serializers import ProfileSerializer User = get_user_model() diff --git a/backend/events/migrations/0001_initial.py b/backend/events/migrations/0001_initial.py index e063729c6..2705a9698 100644 --- a/backend/events/migrations/0001_initial.py +++ b/backend/events/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.0.7 on 2020-07-24 05:35 +# Generated by Django 3.0.7 on 2020-08-17 22:26 from django.db import migrations, models import django.utils.timezone @@ -9,7 +9,7 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('Profile', '0001_initial'), + ('profile', '0001_initial'), ] operations = [ @@ -22,7 +22,7 @@ class Migration(migrations.Migration): ('end_time', models.DateTimeField(default=django.utils.timezone.now, help_text='Ending Time', verbose_name='Ending Time')), ('description', models.TextField(blank=True, help_text='Description', null=True, verbose_name='Description')), ('created', models.DateTimeField(auto_now_add=True)), - ('users', models.ManyToManyField(blank=True, related_name='Users', to='Profile.Profile')), + ('users', models.ManyToManyField(blank=True, related_name='Users', to='profile.Profile')), ], options={ 'verbose_name': 'Event', diff --git a/backend/events/models.py b/backend/events/models.py index 6ea7099ae..a9757e0a7 100644 --- a/backend/events/models.py +++ b/backend/events/models.py @@ -7,11 +7,13 @@ from django.core.exceptions import ValidationError from django.urls import reverse from django.utils.translation import gettext as _ -from Profile.models import Profile +from profile.models import Profile -# Essentially an object that references the Django Models and creates an event that is used for +# Essentially an object that references the Django Models and creates an event that is used for # holding information regarding a scheduled therapy event # Django Model: https://docs.djangoproject.com/en/3.0/topics/db/models/ + + class Event(models.Model): name = models.CharField( u'Name of Event', max_length=200, help_text=u'Name of Event', null=False, blank=False) diff --git a/backend/manage.py b/backend/manage.py index efc19721c..7ed00d43a 100644 --- a/backend/manage.py +++ b/backend/manage.py @@ -5,7 +5,7 @@ def main(): - os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'TherapyNow.settings') + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'PeerSupport.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: diff --git a/backend/message/migrations/0001_initial.py b/backend/message/migrations/0001_initial.py index 09990e35e..950c6915b 100644 --- a/backend/message/migrations/0001_initial.py +++ b/backend/message/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.0.7 on 2020-07-24 05:35 +# Generated by Django 3.0.7 on 2020-08-17 22:26 from django.db import migrations, models import django.db.models.deletion @@ -9,26 +9,27 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('Profile', '0001_initial'), + ('profile', '0001_initial'), ] operations = [ migrations.CreateModel( - name='Message', + name='MessageFlag', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('flag_type', models.CharField(choices=[('Suicidal', 'Suicidal Ideation'), ('Violent', 'Potential Violence'), ('Harassment', 'Harassment')], max_length=32)), ('content', models.TextField()), - ('timestamp', models.DateTimeField(auto_now_add=True)), - ('sender', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='sender', to='Profile.Profile')), + ('created', models.DateTimeField(auto_now_add=True)), + ('flagged_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='receiver', to='profile.Profile')), ], ), migrations.CreateModel( - name='MessageFlag', + name='Message', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('flag', models.CharField(choices=[('Suicidal', 'Suicidal Ideation'), ('Violent', 'Potential Violence'), ('Harassment', 'Harassment')], max_length=32)), - ('message', models.ManyToManyField(related_name='message', to='message.Message')), - ('receiver', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='receiver', to='Profile.Profile')), + ('content', models.TextField()), + ('timestamp', models.DateTimeField(auto_now_add=True)), + ('sender', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='sender', to='profile.Profile')), ], ), ] diff --git a/backend/message/migrations/0002_auto_20200812_1959.py b/backend/message/migrations/0002_auto_20200812_1959.py deleted file mode 100644 index 1147c6fed..000000000 --- a/backend/message/migrations/0002_auto_20200812_1959.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.0.7 on 2020-08-12 19:59 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('message', '0001_initial'), - ] - - operations = [ - migrations.RenameField( - model_name='messageflag', - old_name='receiver', - new_name='flagged_user', - ), - ] diff --git a/backend/message/migrations/0003_auto_20200812_2030.py b/backend/message/migrations/0003_auto_20200812_2030.py deleted file mode 100644 index 01533f9cf..000000000 --- a/backend/message/migrations/0003_auto_20200812_2030.py +++ /dev/null @@ -1,27 +0,0 @@ -# Generated by Django 3.0.7 on 2020-08-12 20:30 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('message', '0002_auto_20200812_1959'), - ] - - operations = [ - migrations.RenameField( - model_name='messageflag', - old_name='flag', - new_name='flag_type', - ), - migrations.RemoveField( - model_name='messageflag', - name='message', - ), - migrations.AddField( - model_name='messageflag', - name='content', - field=models.TextField(default=''), - ), - ] diff --git a/backend/message/migrations/0004_auto_20200812_2050.py b/backend/message/migrations/0004_auto_20200812_2050.py deleted file mode 100644 index 34739232a..000000000 --- a/backend/message/migrations/0004_auto_20200812_2050.py +++ /dev/null @@ -1,25 +0,0 @@ -# Generated by Django 3.0.7 on 2020-08-12 20:50 - -from django.db import migrations, models -import django.utils.timezone - - -class Migration(migrations.Migration): - - dependencies = [ - ('message', '0003_auto_20200812_2030'), - ] - - operations = [ - migrations.AddField( - model_name='messageflag', - name='timestamp', - field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), - preserve_default=False, - ), - migrations.AlterField( - model_name='messageflag', - name='content', - field=models.TextField(), - ), - ] diff --git a/backend/message/migrations/0005_auto_20200814_1623.py b/backend/message/migrations/0005_auto_20200814_1623.py deleted file mode 100644 index a787aa877..000000000 --- a/backend/message/migrations/0005_auto_20200814_1623.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.0.7 on 2020-08-14 16:23 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('message', '0004_auto_20200812_2050'), - ] - - operations = [ - migrations.RenameField( - model_name='messageflag', - old_name='timestamp', - new_name='created', - ), - ] diff --git a/backend/message/models.py b/backend/message/models.py index cda40dac7..5e98aca04 100644 --- a/backend/message/models.py +++ b/backend/message/models.py @@ -1,5 +1,5 @@ from django.db import models -from Profile.models import Profile +from profile.models import Profile class Message(models.Model): diff --git a/backend/message/views.py b/backend/message/views.py index 830bbe33f..7ad903904 100644 --- a/backend/message/views.py +++ b/backend/message/views.py @@ -4,7 +4,7 @@ from rest_framework import viewsets from rest_framework.response import Response from rest_framework.permissions import IsAdminUser, AllowAny -from Profile.models import Profile +from profile.models import Profile from chat.models import Chat from .models import Message, MessageFlag from .serializers import MessageFlagSerializer diff --git a/backend/requirements.txt b/backend/requirements.txt index 7684c0ac8..64050fbb8 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -11,4 +11,5 @@ django-allauth==0.42.0 django-cors-headers==3.3.0 django-rest-auth==0.9.5 psycopg2==2.8.5 -channels-redis==2.4.2 \ No newline at end of file +channels-redis==2.4.2 +joblib==0.16.0 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 261d55659..db8b86332 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: '3' +version: "3" services: postgres: @@ -17,21 +17,21 @@ services: build: ./backend command: ["python", "manage.py", "runserver", "0.0.0.0:8000"] volumes: - - ./backend:/therapynow/backend + - ./backend:/peersupport/backend ports: - "8000:8000" - depends_on: + depends_on: - postgres - redis react: build: ./frontend command: ["npm", "start"] volumes: - - ./frontend:/therapynow/frontend - - node-modules:/therapynow/frontend/node_modules + - ./frontend:/peersupport/frontend + - node-modules:/peersupport/frontend/node_modules ports: - "3000:3000" stdin_open: true volumes: - node-modules: \ No newline at end of file + node-modules: diff --git a/frontend/Dockerfile b/frontend/Dockerfile index cfedeab74..aaf3b8479 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,8 +1,8 @@ FROM node -WORKDIR /therapynow/frontend +WORKDIR /peersupport/frontend ENV CHOKIDAR_USEPOLLING 1 -COPY package.json /therapynow/frontend +COPY package.json /peersupport/frontend RUN npm install diff --git a/frontend/public/manifest.json b/frontend/public/manifest.json index 401be4596..a55331cd6 100644 --- a/frontend/public/manifest.json +++ b/frontend/public/manifest.json @@ -1,6 +1,6 @@ { - "short_name": "TherapyNow", - "name": "TherapyNow", + "short_name": "PeerSupport", + "name": "PeerSupport", "icons": [ { "src": "favicon.ico", diff --git a/frontend/src/containers/HomePage.js b/frontend/src/containers/HomePage.js index d4956ddb1..b30645507 100644 --- a/frontend/src/containers/HomePage.js +++ b/frontend/src/containers/HomePage.js @@ -5,9 +5,9 @@ class HomeLayout extends React.Component { render() { return (
- TherapyNow Logo + PeerSupport Logo

- TherapyNow is an anonymous peer-support web application that provides + PeerSupport is an anonymous peer-support web application that provides easy access for college students to get the help they need in a safe and reliable manner.

diff --git a/frontend/src/containers/Layout.js b/frontend/src/containers/Layout.js index 6f819a508..bc11ca770 100644 --- a/frontend/src/containers/Layout.js +++ b/frontend/src/containers/Layout.js @@ -96,7 +96,7 @@ class CustomLayout extends React.Component { textAlign: "center", }} > - TherapyNow 2020 | Contact: Ian Steenstra - steenstra.ian@gmail.com + PeerSupport 2020 | Contact: Ian Steenstra - steenstra.ian@gmail.com ); diff --git a/frontend/src/images/logo-hori.jpg b/frontend/src/images/logo-hori.jpg index 9ba62f68b..0088e7b05 100644 Binary files a/frontend/src/images/logo-hori.jpg and b/frontend/src/images/logo-hori.jpg differ diff --git a/frontend/src/images/logo-vert.jpg b/frontend/src/images/logo-vert.jpg index e0ac0267c..9c602a5a0 100644 Binary files a/frontend/src/images/logo-vert.jpg and b/frontend/src/images/logo-vert.jpg differ