Code Monkey home page Code Monkey logo

physics-is-beautiful's Introduction

Physics is Beautiful

Installation

Requires Python 3.5, recommended to run in a virtual environment (virtualenv, consider using virtualenvwrapper to manage your virtual environments)

  • install requirements:
pip install -r requirements.txt

Requires PostgreSQL

  • install PostgreSQL:
brew install postgresql
  • create a db named pib: ex:
createdb pib
  • connect to pib database with postgres user and create EXTENSION
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
  • install npm:
brew install node
  • get packages (from root directory):
npm install

To run locally

  • Create a .env file in the root directory that contains just:
DJANGO_SETTINGS_MODULE=pib.local_settings
  • Build the front-end
npm run dev
  • Activate your virtual environment

  • Setup the db:

./manage.py migrate
  • Create an admin account by running /manage.py createsuperuser

  • Run:

./manage.py runserver
  • You should find the site running on http://localhost:8000

  • To login to the admin account go to http://localhost:8000/admin

  • pib will look for a default curriculum named Default Curriculum, so in the admin create a curriculum titled Default Curriculum

  • Then create a unit, module, lesson, and question, then navigate to /curriculum/ to see what you created!

Structure

Django apps:

  • pib contains the project settings.
  • curricula is the main app that produces the page at /curriculum/. The files apis.py and urls_api.py utilize the Django REST Framework to make an API for the models

Models

The model hierarchy is:

  • Curriculum (to test out the app make a curriculum called “Default Curriculum”)
  • Unit
  • Module
  • Lesson
  • Question

Deployment

www.physicsisbeautiful.com and dev.physicsisbeautiful.com are hosted on Elastic Beanstalk.

To Setup:

brew install awscli
brew install awsebcli
  • run aws configure
  • run eb init (you'll need the access id/key
  • on git develop branch run eb use pib-dev
  • on git master branch run eb use pib-prod

To Deploy:

  • eb deploy It will deploy to the proper environment depending on what branch you are on.

Launching the Dev Environment

To save money, the dev environment will not always be up. To launch the dev environment, from the develop branch, run the following command:

eb create --branch_default --cfg pib-dev --timeout 40

Follow the directions, and use "pib-dev" instead of the default "physicsisbeautiful-dev".

This will take several minutes to run. If the command fails, you can try to run, eb deploy from the develop branch. Otherwise you may need to go on the aws console (Elastic Beanstalk) and rebuild the environment. The only other piece is that if you change the dns from pib-dev.us-east-1.elasticbeanstalk.com then you will need to go to the Google Domains and modify the DNS for dev.physicsisbeautiful.com to point at the new URL of the new dev environment.

Run eb deploy once the environment is up to get the latest version of dev running in the environment.

Development

  • We respect the rules set out by pep8 with the exception of a 100 character line limit.
  • We use the flake8 python script for linting.

physics-is-beautiful's People

Contributors

87hiran avatar atereshkin avatar lennylip avatar nch0w avatar nizebulous avatar nscozzaro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

physics-is-beautiful's Issues

Add more graphical keys for vector free-response problem type

Right now there is only xhat and yhat for the vector free-response problem type, and we want to add the numbers 1, 2, 3, 4, and a + and - button.
We got feedback that it's not very user friendly because the user has to go back and forth between their keyboard and the graphical xhat yhat buttons.

ShortUUIDField can be not unique

Now users can create curricula, so we will get many values in ShortUUIDField fields. But the value of this field can be not unique

First step: In all ShortUUIDField in curricula models, we must set unique=True.
Second step: to exclude DATABASE "UNIQUE constraint failed" we need to create a field validation process before model object save.

Scoreboard behavior

The scoreboard is based on the UserReaction model now.

So we got two issues:

  1. The scoreboard works based on material. E.g. if we will create two materials with the game based on the same Material problem type, we will get separate scoreboard lists for each material (independent from Material problem type). I think it is normal behavior.
  2. The Scoreboard may contain the current user more than once in the list. Suggestion: use last_reaction flag to filter responses from unique user (not implemented yet).

Content+lessons list

Current list of content we need to build:

  • Basic math
  • Unit conversion
  • Graphs
  • Triangles

Relevant comments from Reddit:
mouettefluo: Usually, platforms like that are based too much on calculus. Something to be made outside of the app, on a classic calculator and then you enter the answer in the little box. Doing that is actually less convenient and slower than solving the problem entirely on paper. It's an error often seen, using the app as a substitution with no added value instead of making the best with what the technology has to offer.
What I liked about your app is how it's quick and effective. It's based on concept and not much on calculus. In other word, much more on comprehension than application.
For the vectors, I liked how there was no given origin and there was some freedom given to the student. That's also something important to favorise motivation in learning (it's a proven thing, but my references are books in french, so no link)(can also be found in gameplay theory)
That being said, what content would I want to find on your platform?

  • Units. Yes, the boring conversion, but mostly identification of the actual quantity itself. Student have a hard time differentiate Force/Energy or Speed/Acceleration. Concept wise and unit wise, Force/Energy/Work in particular.

  • Math. Please basic maths. Fraction with variables(simplification of). Finding x with a simple isolation (2-x=7) or (2x/3 -7=4) or (x/4-2=x/5). Distribution, two equation two variables, etc.

  • Graph: what is the particule doing here ? Going back ? Positive or negative speed? Acceleration ?
    For a given situation, in which direction would you draw whatever vector.

  • Triangles. Deducing the value of an angle. Decomposition of vectors. Finding the x component of __.

  • More difficult but eh, I can dream : from a text, extrapolating the correct equation.

My students have been drilled with this in highschool. They didn't saw the actual importance of it so it was not in their priority to memorize it correctly. They just need a little quick refresher. A quick refresher I can't offer myself because I don't have time to grade the catch up homework I would give them. One or two students by semester ok, but not 25 of them (my classes are around 90 heads). To them, catch up work is boring and takes time over the new stuff.
My personal criteria to recommend an app/website to a student - Not something too childish (like making a character and win points to buy virtual clothes/gear) - It has to go to the point (minimalism in the theory presented) - Nothing more boring or less efficient than doing it on paper - Has to enable the user to be autonomous in his progress
For sure, I'll propose your app to struggling student this fall and would return any feedback if I hear some.
Also, I really agree with the others suggesting that you should add a note regarding the xyz vectors and the unit vectors ijk.
I teach college students (17-20 years old). One third of my students struggle a lot with notation and graph interpretation, but also with basic maths (fractions, finding x, trigonometry). Since they are behind, they have to catch up by themselves outside of the school. I want to give them material to help. That's something I need and never found anything interesting. Often is too much geared toward children and, at their age, they would feel ashamed to browse and train on such websites/app.
I think the simplicity and type of gameplay you have would be very popular for the highschool level and but also my slower students in college. I really hope you plan on including a basic math game :)

Replace UserReaction.reaction_start_on datetime with backend version

To simplify UserReaction.reaction_start_on and reacted_on are getting from frontend. Is not secure because the user can send any values.

Suggesting solution: user request material -> create UserReaction with reaction_start_on (datetime.now()) and hash (uuid) fields on the server side -> send requested material with user_reaction_hash field -> after an answer user send response with user_reaction_hash field -> backend update reacted_on with user_reaction_hash (uuid) and save reacted_on datetime on the server side.

Priority: low.

Create errors templates

Django error views page_not_found, server_error, permission_denied and bad_request. By default, they use these templates if they can find them, respectively: 404.html, 500.html, 403.html, and 400.html. We need to add these templates to /templates/ root dir.

Django session clearing mechanism

We need to clean old data with the expired date from django_session table. Django session may contain session_data field with too much size value (~2Gb per year for current count visitors).

Create vendors.js chunk

We need to create vendors.js chunk to reduce sizes of js bundles. Now, each bundle contain react+react-redux+react-bootstrap.
So we need to cut these packages from each bundle and place it to single vendors.js.

Add unit conversion game

We want to add a game where the task is to convert something like 0.001 cm, or 2 weeks, or 1 foot 4 inches to SI units. To do this, we'll have a grid with drop-down boxes or math-entry boxes. Details to be decided.

Last pulls issues

  1. the extra closing span tag

https://github.com/nscozzaro/physics-is-beautiful/blob/117405d73eaa64bc2e5aae5ae86effde142f699f/blog/templates/blog/navbar.html#L70

  1. /templates/blog/navbar.html, /templates/navbar.html and templates/allauth/account/base.html almost identical. We have to use a DRY principle.

  2. [DOM] Found 2 elements with non-unique id #id_remember: (More info: https://goo.gl/9p2vKq) <input type=​"checkbox" class=​"form-check" name=​"remember" id=​"id_remember">

(Sign Up / Sign in page)

  1. https://github.com/nscozzaro/physics-is-beautiful/blob/master/blog/templates/blog/wordpairs.html#L4

Block name must use the function naming rules: lowercase with words separated by underscores as necessary to improve readability.

  1. https://github.com/nscozzaro/physics-is-beautiful/blob/master/blog/templates/blog/wordpairs.html#L7 css needs to move to /static/blog/style.css

  2. https://github.com/nscozzaro/physics-is-beautiful/blob/master/blog/views.py
    all def (functions) also must use the function naming rules: lowercase with words separated by underscores. See pep8 for details.

  3. I think we must avoid using id="navTopOfScreen" camel case in ids also. We need to convert all values of tags attributes to a uniform style. I suggest using BEM methodology http://getbem.com/introduction/ , but we can use own style (e.g. lowercase with words separated by hyphens or underscores).

Build tool to allow teacher (or anyone) to create a customized curriculum and customized lessons

This is a long-term goal.
Teachers want to assign certain practice to their students. Different teachers may teach the material in a different order, or may want to add/tweak/customize lessons. We need to have tools so that teachers can create a custom curriculum from the content that we have, and assign it to students.

Reddit:
Mark_Eichenlaub
Thanks! The use case I can see is having students work through a part of this tutorial, but if I can't jump directly to the part I want students to work on, there's no way I would assign it. Also, if I want to look at the Newton's laws part, for example, it's annoying to have to go through all the preliminaries just to see if I like the material.

Automatically update wsgi.conf

(instead of $ cp /home/ec2-user/conf-save/wsgi.conf /etc/httpd/conf.d/wsgi.conf && apachectl restart)

This should be the new wsgi.conf.

LoadModule wsgi_module modules/mod_wsgi.so
WSGIPythonHome /opt/python/run/baselinenv
WSGISocketPrefix run/wsgi
WSGIRestrictEmbedded On

<VirtualHost *:80>

Alias /media/ /opt/python/current/app/media/
<Directory /opt/python/current/app/media/>
Order allow,deny
Allow from all
</Directory>

Alias /static/ /opt/python/current/app/collectedstatic/
<Directory /opt/python/current/app/collectedstatic/>
Order allow,deny
Allow from all
</Directory>

Header always unset X-Frame-Options

WSGIScriptAlias / /opt/python/current/app/pib/wsgi.py


<Directory /opt/python/current/app/>
  Require all granted
</Directory>

WSGIDaemonProcess wsgi processes=1 threads=15 display-name=%{GROUP} \
  python-path=/opt/python/current/app:/opt/python/run/venv/lib64/python3.4/site-packages:/opt/python/run/venv/lib/python3.4/site-packages user=wsgi group=wsgi \
  home=/opt/python/current/app
WSGIProcessGroup wsgi
</VirtualHost>

LogFormat "%h (%{X-Forwarded-For}i) %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

Twice loading material from API

  1. SPA loads material from API by UUID that contained in browser URL to determine material problem type UUID
  2. Material problem type UUID is sending to code sandbox eval app (into iframe)
  3. Codesanbox component loads material again to use JSON DATA / Codesanbox game do not use JSON DATA right now (but it can in the future I think).

So we have an issue here:

  • twice loading the material from API (from the same URL)

And question:

  • Is the game will have JSON data as in the component?

update.

After we check the user's answer - we will get the Next material UUID (with User Reaction response) - then we send this material UUID to the parent browser window from iframe (a sandbox code). Then we change a URL (set UUID) in the web browser window and send this UUID to the current Sandbox component. Current (prev for next material) component loads Material from API. The current component has its own Material problem type UUID. So If this "Material problem type UUID" != "Material problem type UUID from next material UUID" - current component will be reloaded (iframe with new component), otherwise, only JSON data will be reloaded inside the component.

I think, for clarity, we need some graphics for this process.

Editor server 500 error

  1. Go to /editor/
  2. Select Curriculum studio tab
  3. Select "Default Curriculum by Physics Is Beautiful"
  4. Reselect None - start from scratch
  5. Click "Create curriculum"
    got 500 server error

Multiple choice text button color on incorrect answer

When you click an incorrect multiple-choice text button, all buttons go disabled but they don't change color (clicked wrong answer should turn red, correct answer should turn green). It looks like the code is similar to the image multiple choice which is working, so I'm not sure why the multiple choice text code isn't working

Animate null vector checkbox to highlight it's being checked

When a user just clicks and releases on the grid, it automatically checks the null vector checkbox. This has been reported to be hard to notice for some users, so an animation that draws attention to the fact that it's getting checked could solve this issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.