Package: scrubdash
scrubdashDashboard for organizing, visualizing, and analyzing images coming in from aScrubCam(s). The dashboard allows users to see the most recent image taken for each class on the home page, scroll through the history of each image taken for a certain label, and conduct preliminary data analysis using histograms. Users may also observe the labeled boxes of detected objects in each image by clicking on the image in the history page.How It WorksScrubDash utilizes multiprocessing to spawn two servers -- anasyncioserver and adashserver.Asyncio ServerTheasyncioserver uses theasynciolibrary to receive to receive images from a ScrubCam. Additional functionalities include creating the session folder to persistently save all images and metadata for the current ScrubCam session and sending an SMS and email notification to the recipient(s) listed in the config file when an image is received.Dash ServerThedashserver uses thedashlibrary to render the client-facing dashboard.Installation$ python3 -m pip install --index-url https://test.pypi.org/simple/ --no-deps scrubdashUsageThe core program in the project isscrubdash.pywhich spawns the two server processes. It accepts a YAML configuration file as a command line argument. There is an example config file in./cfgs/config.yaml.example.You can copy this example file and modify it to your specific purposes. See theConfig Filesection to see what config settings you should change.Note: If scrubdash was installed using PyPI, running thecreate-configconsole script in the terminal createsconfig.yaml.examplein your current directory.Usage:
    scrubdash [OPTIONS] <config_file>
    
Options:
    -h, --help          Output a usage message and exit
    -c, --continue      Continue the most recent sessionOnce ScrubDash is running, a ScrubCam can connect to it. If starting a new ScrubDash session (no-cflag), ScrubDash will render a "Waiting for a ScrubCam to connect..." message until a ScrubCam has successfully connected. If continuing a previous ScrubDash session, ScrubDash will automatically display ScrubCam device information from the previous session.Config FileThe following values should be changed in the example config file:ASYNCIO_SERVER_IP: this is the private IP of the device running theasyncioserver. This is the IP address the asyncio server receives images on. The range for private IP addresses is 10.x.x.x, 172.16.x.x-172.31.x.x, and 192.168.x.x, (x is a number from 0 to 255).RECORD_FOLDER: this is the absolute path specifying where to save the data for each ScrubCam session.ALERT_CLASSES: the list of classes ScrubDash should send an SMS and email notification for when observed in an image.SENDER: the email thatsmtplibuses to send the SMS and email notifications. NOTE: this email will not receive notifications unless also specified as a receiver inEMAIL_RECEIVERSorSMS_RECEIVERS.SENDER_PASSWORD: an unencripted plaintext string used to login to the email specified inSENDER.We recommend havingSENDERbe a throwaway email used soley as a proxy sender.EMAIL_RECEIVERS: a list of emails that will receive notifications when a class inALERT_CLASSESis observed.SMS_RECEIVERS: a list of dictionaries specifying the phone number and carrier for each recipient that will receive an SMS notification when a class inALERT_CLASSESis observed. Look at theSupported Phone Carrierssection below to see valid carriers.Supported Phone CarrriersAn SMS notification is only possible if a recipient's phone number is listed inSUPPORTED_CARRIERS. The spelling of the provider must beEXACTLYthe same as listed inSUPPORTED_CARRIERS.SUPPORTED_CARRIERS = [
    "verizon",
    "tmobile",
    "sprint",
    "at&t",
    "boost",
    "cricket",
    "uscellular",
]ExampleThe dashboard is accessible athttp://[ASYNCIO_SERVER_IP]:[DASH_SERVER_PORT]. If using the values in./cfgs/config.yaml.example, the dashboard is accessible athttp://11.168.121.90:8050$ scrubdash -c cfgs/config.yaml.example
[INFO] Server Started (scrubdash.asyncio_server.asyncio_server)
[INFO] Configuration finished (scrubdash.asyncio_server.asyncio_server)
Dash is running on http://0.0.0.0:8050/

[INFO] Dash is running on http://0.0.0.0:8050/
 (scrubdash.dash_server.app)
 * Serving Flask app 'scrubdash.dash_server.app' (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
[WARNING]  * Running on all addresses.
   WARNING: This is a development server. Do not use it in a production deployment. (werkzeug)
[INFO]  * Running on http://11.168.121.90:8050/ (Press CTRL+C to quit) (werkzeug)How To View Saved ImagesTo view saved images, go to the folder specified atRECORD_FOLDERin your config file.ScrubCam Host SessionsScrubDash creates a folder for each ScrubCam inRECORD_FOLDERand another folder is made inside the host folder each ScrubCam session..
├── RECORD_FOLDER
│   ├── ScrubCam1
│   │   ├── Session1
│   │   │   ├── imagelog.csv
│   │   │   ├── summary.yaml
│   │   │   ├── image1.jpeg
│   │   │   └── ...
│   │   ├── Session2
│   │   │   └── ...
│   │   └── ...
│   ├── ScrubCam2
│   │   ├── Session1
│   │   │   └── ...
│   │   └── ...
│   └── ...
.Notes:A new ScrubCam session folder is created by running ScrubCam without the-cflag.A ScrubCam host folder is created when a ScrubCam host connects to ScrubDash for the first time.Each ScrubCam session folder is timestamped to the creation time of the session (ie. when the ScrubCam connects to ScrubDash). This will be denoted assession_timestamp. It does not timestamp the folder to the time of the first image received. Every user session includes these three files:[session_timestamp]_imagelog.csv: a csv that records five metadata for each image received.path: the absolute path to the saved imagelabels: a list containing all the unique classes observed in the image in descending confidence order.lboxes: the absolute path to the csv that lists the lbox coordinates for each object observed in the image.timestamp: the unix timestamp representing the time the image was received by theasyncioserver. This is used to create figures to analyze image data.datetime: a datetime representation of the unix timestamp with the representation%Y-%m-%dT%Hh%Mm%Ss.%f(eg.2021-07-30 14:24:18). This is used to create figures to analyze image data.[session_timestamp]_summary.yaml: a yaml that records metadata for the user session. It copies everything listed in the config file and also includes:HOSTNAME: the name of the ScrubCam device.USER_SESSION: the absoluste path to the session folder.IMAGE_LOG: the absoluste path to the image log csv.FILTER_CLASSES: the list of classes the ScrubCam takes images of.HEARTBEAT_PATH: the absolute path to the heartbeat yaml.[session_timestamp]_heartbeat.yaml: a yaml that records the time of the most recent message received from the ScrubCam.