{"id":21525925,"url":"https://github.com/markmatney/uwnet-web-interface","last_synced_at":"2025-03-17T18:21:28.473Z","repository":{"id":36034882,"uuid":"40331534","full_name":"markmatney/UWNet-web-interface","owner":"markmatney","description":"Web interface for underwater net experiment.","archived":false,"fork":false,"pushed_at":"2015-10-01T19:51:44.000Z","size":2544,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-24T05:29:36.126Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/markmatney.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-06T23:33:52.000Z","updated_at":"2015-08-06T23:41:15.000Z","dependencies_parsed_at":"2022-08-26T02:51:06.659Z","dependency_job_id":null,"html_url":"https://github.com/markmatney/UWNet-web-interface","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markmatney%2FUWNet-web-interface","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markmatney%2FUWNet-web-interface/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markmatney%2FUWNet-web-interface/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markmatney%2FUWNet-web-interface/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markmatney","download_url":"https://codeload.github.com/markmatney/UWNet-web-interface/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244085009,"owners_count":20395523,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-24T01:39:21.386Z","updated_at":"2025-03-17T18:21:28.452Z","avatar_url":"https://github.com/markmatney.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"WaterCom\n\n********************************************************************************\n\t0 - Contents\n********************************************************************************\n\n1 - COMPONENTS: the files that make up this system\n\n\tI.\tindex.html\n\tII.\tsubmit.php\n\tIII.\tuw.py\n\tIV.\tcreate.sql\n\tV.\tauto_generate_plots.py\n\n2 - SETUP: instructions for setup on Ubuntu 14.04\n\n3 - TODO: to-do list\n\n\tI.\tBugs\n\tII.\tFeatures\n\n********************************************************************************\n\t1 - COMPONENTS\n********************************************************************************\n\nI. index.html - web interface\n\n\tThis is a form that takes input values from the user, to be used in an\n\texperiment:\n\n\t1. transmission power: max, min, step\n\t2. blocks/packet: max, min, step\n\t3. transmission mode: max, min, step\n\t4. number of trials (repetitions)\n\t5. test data: local file to transfer\n\t6. email address of user\n\n\tTransmission power, blocks/packet, and transmission mode will define the\n\trange of values to test, and the script will transmit the test data\n\tunder every possible set of parameters, for the number of repetitions\n\tspecified. Test data is a user-specified local file that is uploaded to\n\tour server.\n\n\t[!] TODO: implement sending of results via email back to users\n\n\t[!] TODO: may want to have user accounts or portals, instead of emailing\n\tresults. A simple way to do this would be to give users a key when they\n\tsubmit a job, and have a form on index.html where they can enter this\n\tkey to see results of their experiments.\n\n\t[!] TODO: add CSS/Javascript for nicer user interface\n\nII. submit.php - form validation and job enqueueing\n\n\tThis script validates the form input, sanitizes SQL, and submits a job\n\tto the input queue on the server.\n\n\t[!] TODO:\t$ cat -n submit.php | grep TODO\n\nIII. uw.py - the main test script\n\n\tThe test script is a Python file that is adopted from the RUN_CHINFO.SH\n\tand SUB_PKT.SH shell scripts. On a schedule, it will retrieve recently\n\tenqueued experiments (rows in InputQueue that were submitted since the\n\tlast batch of experiments was run) from the database, run the test\n\tscript on the fields of each row, and store results in the database\n\t(Results table).\n\n\tDuring each experiment, a logfile is kept with information about the\n\tsuccess or failure of each packet transmission; whether or not data was\n\tmutated or lost in transmission; number of bytes transmitted with each\n\tpacket; current values of trial number, transmission power, mode, and\n\tblocks/packet.\n\n\t[!] TODO:\t$ cat -n uw.py | grep TODO\n\n\nIV. create.sql - initialize the database\n\n\n\tThe database (called 'UWNet') will store the parameters that users\n\tsubmit with the form, and the results of the tests. There are two\n\ttables. The InputQueue table will store each form submission. The\n\tResults table will store the total delay time, number of lost packets,\n\tand number of retransmissions made during each transmission of the test\n\tdata.\n\n\ta. InputQueue\n\n\t+----+------+------+------+------+------+------+------+------+------+--/\n\t| id | mpwr | lpwr | ppwr | mbkn | lbkn | pbkn | mmod | lmod | pmod |  \n\t+----+------+------+------+------+------+------+------+------+------+--/\n\n\t/--+------+----------+-------+---------------+------------+--/\n\t   | rptt | testData | email | dateSubmitted | exitStatus |\n\t/--+------+----------+-------+---------------+------------+--/\n\n\t/--+---------------+-----------+----------------+\n\t   | dateCompleted | emailSent | plotsGenerated |\n\t/--+---------------+-----------+----------------+\n\n\tid\t\tprimary key\n\n\tmpwr/lpwr/ppwr\tmax, min, step power\n\n\tmbkn/lbkn/pbkn  max, min, step blocks per packet\n\n\tmmod/lmod/pmod  max, min, step transmission mode\n\n\trptt\t\tnumber of times to repeat each experiment\n\n\t\t\t[!] TODO: May want to store the previous ten numerical\n\t\t\tparameters in JSON\n\n\ttestData\tuploaded file (path on our server)\n\n\temail\t\temail to send test results to\n\n\tdateSubmitted\tdate and time of form submission\n\n\texitStatus\tthe exit status of the test script, e.g. if it ran each\n\t\t\texperiment correctly\n\n\t\t\t[!] TODO: specify exit status codes in uw.py\n\n\tdateCompleted\tdate and time of experiment completion\n\n\temailSent\tTRUE if results have been sent to the email specified in\n\t\t\tthe queue table, FALSE otherwise \n\n\tplotsGenerated\tTRUE if the plots for this experiment have been\n\t\t\tgenerated, FALSE otherwise\n\n\t\t\t[!] TODO: may no longer need plotsGenerated if/when\n\t\t\tinteractive user portal comes\n\n\n\t\tb. Results\n\n\t+--------------+------------+---------+\n\t| experimentId | parameters | results |\n\t+--------------+------------+---------+\n\n\texperimentId\tforeign key for id in InputQueue, there will be a row\n\t\t\tfor each combination of parameters, for each trial\n\n\tparameters\tJSON string representing the input parameters\n\n\t\t\t{ \"pwr\": $TRANSMISSION_POWER,\n\t\t\t  \"bkn\": $BLOCKS_PER_PACKET,\n\t\t\t  \"mod\": $TRANSMISSION_MODE }\n\n\tresults\t\tJSON string representing the experimental results for\n\t\t\tall trials using a particular parameter combination,\n\t\t\tkeyed by the trial number.\n\n\t\t\t{ \"0\": { \"delay\": $DELAY_TIME,\n\t\t\t         \"loss\":  $PACKET_LOSS_COUNT,\n\t\t\t         \"retx\":  $PACKET_RETX_COUNT },\n\t                  \"1\": ...\n\t                }\n\n\t\t\t[!] TODO: calculate bit loss rate (derived from block\n\t\t\tloss rate)\n\n\nV. auto_generate_plots.py - data plotting\n\n\n\tIn order for users to see the results of their test, we will generate\n\tplots of the data and other summaries/analysis, and send the results to\n\tthem via the email provided when they submitted the form.\n\n\tCurrently, the script checks the database to see which experiments have\n\tnot been plotted already, generates wireframe plots for them, and saves\n\timages of the plots in the 'plots' folder.\n\n\tIt is important to note that this only works when the web form is\n\tsubmitted as follows:\n\n\t        mpwr == lpwr\n\t        ppwr == { any positive integer }\n\t        mmod == 5\n\t        lmod == 1\n\t        pmod == 1\n\t        mbkn == 16\n\t        lbkn == 1\n\t        pbkn == 1\n\t\n\tThe next maintainer(s) must fix this plotting script to plot arbitrary\n\tdata sets.\n\n\n********************************************************************************\n\t2 - SETUP\n********************************************************************************\n\n\nWaterCom Setup Guide for Ubuntu 14.04 (other OSes may require some tweaks)\n\n1. Ensure that your machine has the following software packages installed:\n\n\tApache/2.4.7\n\tmysql Ver 14.14 Distrib 5.5.44, \n\tPHP 5.5.9-1ubuntu4.11 (cli) \n\tPython 2.7.6\n\tpip 7.1.2 (Python package manager)\n\n...and these Python modules:\n\n\tmatplotlib\n\tmpl_toolkits.mplot3d\n\tmysql.connector\n\tnumpy\n\tpylab\n\tscipy\n\tserial\n\n2. Move the folder 'UWNet-web-interface' inside the public web folder; on\nUbuntu, this is '/var/www/html'. Then:\n\n\t$ cd /var/www/html/UWNet-web-interface\n\n3. Create the MySQL database with:\n\n\t$ mysql -u [username] -h [localhost] -p[pass] \u003c create.sql\n\n4. To access the form, point a web browser to 'localhost/UWNet-web-interface'.\nEnter the values requested and choose a file to upload.\n\n5. With the AquaSeNT modems powered on, connect them to your machine via USB.\nTo run the submitted experiments:\n\n\t$ python uw.py\n\n6. To plot results:\n\n\t$ python auto_generate_plots.py\n\n[!] NOTE: CREATING WIREFRAME PLOTS IS ONLY POSSIBLE WHEN THE FORM IS SUBMITTED\nWITH VALUES:\n\n\tmpwr == lpwr\n\tppwr == { any positive integer }\n\tmmod == 5\n\tlmod == 1\n\tpmod == 1\n\tmbkn == 16\n\tlbkn == 1\n\tpbkn == 1\n\trptt == 1\n\nTHE MAINTAINER OF THIS CODE NEEDS TO FIX auto_generate_plots.py !!!\n\n********************************************************************************\n\t3 - TODO\n********************************************************************************\n\nI. Bugs\n\nIn each file I have noted any TODOs that should be done. To find these:\n\n\t$ cat -n [FILE] | grep TODO\n\nOtherwise, here are known problems:\n\n\t1. The plotting script auto_generate_plots.py only generates correct\n\twireframe plots when the form is submitted with certain values; i.e.:\n\n\tmpwr == lpwr\n\tppwr == { any positive integer }\n\tmmod == 5\n\tlmod == 1\n\tpmod == 1\n\tmbkn == 16\n\tlbkn == 1\n\tpbkn == 1\n\trptt == 1\n\n\tIt is not known if it will succeed with any other values, and needs to\n\tbe thoroughly tested. The maintainer(s) will have to fix the plotting\n\tscript by removing hard-coded values, and figure out how to do wireframe\n\tplotting the correct way. Generating scatter plots is easier, and the\n\tcode exists in the script already (commented out).\n\n\t2. The main test script does not do error reporting very well. There\n\tshould be an error code system that reports to the database if anything\n\twent wrong during the execution of an experiment (e.g. database\n\tconnection error). Need to decide what is worth reporting. Make sure\n\tthis comes up in the error logs too!\n\n\t3. This guide does not address hosting on a live server. It has only\n\tbeen hosted locally so far.\n\nII. Features\n\nHere are some ideas for where to go from here:\n\n\t1. Decide how to deliver results to user. Can either have user accounts\n\twhich they setup on the main page, or can give them a key upon form\n\tsubmission, which they can use to log on and view results for that\n\texperiment. Or, can simply generate plot files and email to them.\n\n\t2. Setup job scheduling for the python scripts. This is simple:\n\n\t\t$ man crontab\n\n\t3. Add CSS styling and/or JavaScript to build a nicer or easier-to-use\n\tfront-end.\n\n\t4. Improve user experience. Maybe want to do form validation on the\n\tfront-end in additioon to back-end, or fill the form with default values \n\tinitially. Give better feedback when user enters invalid form data\n\t(change submit.php).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkmatney%2Fuwnet-web-interface","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkmatney%2Fuwnet-web-interface","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkmatney%2Fuwnet-web-interface/lists"}