Code Monkey home page Code Monkey logo

pslab-webapp's Introduction

PSLab Webapp

This repository holds the code for the PSLab Webapp to enable students to access the Pocket Science Lab (PSLab) open hardware platform and other equipment through the Internet.

Build Status Mailing List Gitter Twitter Follow

The goal of the PSLab Webapp is to create a virtual lab that can give students remote access to Pocket Science Labs and other equipment in laboratories via the internet without having to be physically present near the equipment. PSLab is a tiny pocket science lab that provides an array of equipment for doing science and engineering experiments. It can function like an oscilloscope, waveform generator, frequency counter, programmable voltage and current source and also as a data logger. Our website is at https://pslab.io

Buy

Communication

Development Goals of PSLab Webapp Virtual Lab

A virtual lab interface can give students remote access to equipment in laboratories via the internet without having to be physically present near the equipment. The idea is that lab experiments can be made accessible to a larger audience which may not have the resources to set up the experiment at their place. Another use-case scenario is that the experiment setup must be placed at a specific location which may not be habitable. The capabilities of the Pocket Science Lab can be increased significantly by setting up a framework that allows remote data acquisition and control. It can then be deployed in various test and measurement scenarios such as an interactive environment monitoring station.

Deployments

Introductory blog posts

Structure

Backend

The virtual lab will be hosted using Python-Flask, which is a BSD Licensed microframework for Python based on Werkzeug and Jinja 2 . It will use sqlalchemy to interface with databases containing user credentials and data. At present, postgresql will be used.

The repository has been integrated with Heroku, and modifications to the master branch are automatically deployed to pslab-stage.herokuapp.com after the CI build passes

Frontend

The frontend code resides in a subdirectory called frontend . It is Designed with EmberJS , and a production build is automatically deployed to pslab-remote.surge.sh by the CI if the build is successful.

Installing dependencies

Setting up PSLab is really easy. The steps are:

  1. Ensure you have the following dependencies to setup PSLab:
  • Python3/2
  • Git
  • Nodejs
  1. Clone the pslab-webapp repositary via git.
 git clone https://github.com/fossasia/pslab-webapp.git && cd pslab-webapp/
  1. Install all Python packages in requirements.txt
pip install -r requirements.txt
  1. Install the frontend dependcies as well
cd frontend/
npm install

Running the app locally

gunicorn app:app This launches the API server on default port 8000

cd frontend ember -s environment='development' this launches the the emberjs webapp on port 4200

navigate to localhost:4200 in your web browser

Implemented features

  • backend

    • homepage hook
    • SignUp hook
    • SignUp database updation procedure
    • SignIn hook
    • SignIn database verification
    • User script page hook
    • Store, Edit, View, Delete user submitted code snippets
    • Execute a function string
    • Execute a code snippet
    • Create object oriented apps
  • New Frontend based on EmberJS

    • Home Page
    • Navbar with bootstrap styling
    • sign-up page
    • sign-in page
    • user-home.html. Feature to Create and Store code snippets. Execute function strings
    • Create/Edit/Delete/Execute Python scripts. Embedded ace-js code editor.
    • Display object oriented applications
    • Plot data with the integrated JQplot library

Old resources

This project was moved from another repository, and in order to browse the various issues and PRs, the following links may help

pslab-webapp's People

Contributors

jithinbp avatar kurianbenoy avatar mariobehling avatar niranjan94 avatar pipe-runner avatar vikum94 avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pslab-webapp's Issues

User engagement while waiting for backend to boot up

  • Heroku reaps free dynos after 30 minutes of inactivity
  • A request made to an inactive dyno takes 10 seconds, and this can be confusing to users who may think that the frontend app has frozen.
  • A message/countdown timer can be shown when the app is opened indicating that the backend is waking up

Create application initializer to configure backend URL for ajax calls

  • the --proxy option during development redirects all AJAX calls to a specified URL, but the build command does not have such an option.
  • There exist adapters to set the host parameter for JSONadapter, RESTAdapter etc, but these do not affect jquery.post, getJSON etc.
  • a workaround is necessary for setting the base URL for all AJAX calls in the final build

Enable Sign Up functionality in the EmberJS frontend

  • Submit user credentials
  • Act according to the response by either showing the error message, or redirecting to the home page
  • ember server must be launched with the --proxy option in order to let it access the API server . e.g. ember s --proxy http://127.0.0.1:8000 for accessing the python-flask app.

Implement Backend method to fetch a script by its ID

When the user clicks on the edit button against any of his/her scripts, an AJAX call will be made to the server along with the unique ID of that script.
The server should search the database for this script, and respond accordingly so that the frontend can popup the code editor with the relevant contents.

Backend functionality for storing user created scripts

@viveksb007 @asitava1998 @CloudyPadmal In the last PR , I embedded ace.js text editor on a page that allowed users to write their own Python code.

Now the question is how to store these.
Should they go into a database along with the Primary key user-email and a unique id for searchability,
or
Should they be stored as text files in a directory.

Which begs the larger question ... if users are allowed to upload experiment results/screenshots as the app evolves, where is such data typically stored?

Add underscore.js dependency

  • Will be required for array manipulations and other mathematical functions
  • First use will be to convert separat xdata and ydata to xy pairs.

Apply consistent naming "remote lab"

The name virtual lab is already use by another project. The question here is anyways, if virtual lab would be the correct name. The goal of the project is to enable citizen scientists and students access to lab equipment that is not "virtual" but actually physically exists. This lab equipment is stationed remotely from the user. Therefore "remote lab" or something similar is probably a more correct naming.

Compile a dictionary of inline docstrings from sciencelab instance

return a comprehensive list of functions, their arguments and their docstrings

  • {'status':true/false,
    'doc_list':[
    • { args:list of arguments, name:name of the function , doc_string : inline documentation if any },
    • {function 2},
    • {function 3},
      ....
      ]

}

  • These docstrings will be passed over to the webapp's user-home page via its model, and will eventually be used for autocompletion, inline help tooltips etc

Structure code output from codeEvaluator as a JSON object

  • At present, the return value of the codeEvaluator only includes any data printed to the console.
  • It is not flexible enough to deal with other forms of output such as plots, or OOP constructs
  • Converting the output of the codeEvaluator into a JSON object with each row/section representing the output at various points of the execution process can simplify creation of a more flexible output
  • For example, If a plot is to be inserted, the relevant row can specify the HTML as well as the relevant JS snippet that must be injected in order to set it up.

Second plot in user script replaces the first if name is not specified

how to reproduce the bug

import numpy as np
x=np.linspace(0,2*np.pi,30)
plt = plot(x, np.sin(x))
plt2 = plot(x, np.sin(x))

right way

import numpy as np
x=np.linspace(0,2*np.pi,30)
plt = plot(x, np.sin(x))
plt2 = plot(x, np.sin(x),name = 'newplotid')

default name is myPlot . However, the toUnique method is not being invoked , and hence the same name is used for all plots.

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.