Skip to content

Instantly share code, notes, and snippets.

"""An example Ignition SCADA Gateway tag change event script that sends a simple JSON message to a flask
server when the production line starts and stops. The server runs alongside a tkinter window that
will shrink to a small semi-transparent button when the line starts running. The computer this runs
on was there for a reason, so obscuring the existing software was not an option. If there is an
unsaved defect record active in the window, it will pop back up when they stop so that they can update
it when finished.
When this was set up we hadn't gotten the WebDev module yet, so when the operator creates a new defect
record, by pushing the button, the available tag data is read directly from the Postgres/Timescale
database with the tag history using the psycopg2 library.
"""Example flask endpoint for receiving http requests from Ignition (or whatever).
Based on https://github.com/HelloMorrisMoss/mahlo_popup
Python version == 3.8.4
Flask==2.0.2
Flask-RESTful==0.3.9
"""
from flask import Flask
from flask_restful import reqparse, Resource, Api
@HelloMorrisMoss
HelloMorrisMoss / list_in_column.py
Last active July 5, 2022 17:36
Una columna con una lista a columnas booleanas
import pandas as pd
ejemplo_datos = {'id': (123, 456, 789),
'list_column': ['Animation, Comedy, Family', 'Action, Drama', 'Documentary, Nature']}
df = pd.DataFrame.from_dict(ejemplo_datos)
df.set_index('id', inplace=True)
# crear un conjunto de todos los géneros
@HelloMorrisMoss
HelloMorrisMoss / checking_ignition_edits.ipynb
Created May 24, 2022 13:59
Check when code files were edited for an Ignition SCADA gateway.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.