************************************** PYTHI : PYthon-based Time Harmonizer and Integrator**************************************
PYTHI (pronounced pith-thee) is a bottle-backed time aggregator. Its goal is to make possible all the functionality of GLITCH without relying on reference tables or CGI scripts. Operating under the wonderful WSGI protocols, PYTHI is faster and more flexible than GLITCH (rip: 2014). It provides a simple http
based API that can be nested into the GLITCH [GET]
syntax, or it can be called independently to respond to arbitrary HTTP requests by displaying html output. PYTHI can be used for MS001, MS043 and testing is being conducted on MS005 and HT004.
PYTHI is written in Python, (v. 2.7.10) and under the hood it needs the Bottle and Pymssql libraries.
- Supports
[GET]
request syntax used by Perl CGI scripts and "Cold Fusion" - Formatted, simple output can be easily copied into a .csv
- Does not need reference tables
- Authorization to the SQL-server using read-only authentication
- Open-Source and easy to read and work with
- Fails by throwing boolean falses to prevent bad data escaping
- Supports Python 2.7, which is commonly used by scientists
- Linux, Mac OS X ... and Windows?
- Documentation
- Octocat is the best.
Emulate a local host environment within the firewall.
- download ngrok
- start an ngrok "emulation server"
- point the server to port 8080:
- copy that funky http:// ngrok.io address
Start the application from the command line
- use the standard 2.7 version of python
$ python glitch_bottle.py
Point your web browser / cmd line to your desired endpoint:
- ngrok
- local host without ngrok
- if you are using the cold fusion api:
What follows is a detailed documentation. It covers the command syntax, advanced usage, and also features additional examples.
map_glitch_2.py |
---|
Using god's gift to SQL, the information_schema structure, we execute this: |
|
that's right, it's all the column names you'll ever need to do all the harmonization and aggregation. Subsequently, we "try" all of the four methods of combining Probe, Probe_code, Date, and Date_Time to get the appropriate information, like this: |
|
This information is returned so that Glitching may occur. |
=========== |
pyGLITCH_backend.py |
Discussion of the back-end integration here
glitch_bottle.py |
---|
The glitch interface is a simple set of accordion menus that look into the database and find the appropriate tables and probes. |
|
|
|
|
You can see here how we drop down from MS001 to get a list of tables: |
|
|
|
|
And how our clicked on table is automatically used to populate the form. Fill in the date and time range you want as YYYY-mm-dd HH:MM:SS. |
|
|
|
|
Click Submit Me at the bottom to submit the form and advance to the list of probes. Your submission went through if the button turns red. |
|
|
|
|
You can also choose a probe, and now your probe will populate the form. |
|
|
|
|
Type in a number of minutes that you want to GLITCH for. If you get a 500 error on the next page, you probably made a selection that was "out of range". I have not built in range checks. However, the server is persistent, so you can always go back and try again. |
Click Submit Me at the bottom to submit the form and advance to the list of probes. Your submission went through if the button turns red. |
|
|
|
|
Finally your data is returned as a nice looking comma separated html list. |
|
|
|
|
If you want to take shortcuts: |
|
|
======= |
License |
Please see LICENSE.