wsular / urbanova-aqnet-rpi-node-school

This repository contains code and notes related to the sensor packages developed for WSU Urbanova Air Quality Network (aqnet). This particular repository is for sensors that are used as part of the Ramboll project at schools in the Spokane School District.
0 stars 1 forks source link

Add Sensor Parameters to script #3

Closed vonw closed 5 years ago

vonw commented 5 years ago

Sensor information: name = 'WSU Indoor Air Quality Node #1' type = 'WSU Indoor Air Quality Node' description = 'Indoor air quality sensor package built at Washington State University's Laboratory for Atmospheric Research. Sensors include PMS5003 (particulate matter) and BME280 (TPU).' contact = 'Von P. Walden, Washington State University, v.walden@wsu.edu'

timeInterval = 120 # Number of seconds

vonw commented 5 years ago

I'm currently using a csv file to input sensor parameters into this script. I would still like to figure out how to properly format a JSON file for this. Hopefully this will also help me determine how to include sensor parameters in the data file as well.

vonw commented 5 years ago

@matthewRoetcisoender It looks like if you include metadata along with the actual data in a Python dictionary, and then read it into a Pandas DataFrame, Pandas just copies the metadata into every row. In other words, "name" is copied into every existing row of data. This is fine. It's a bit wasteful in terms of memory storage, but it won't hamper what we need to do with our data.

vonw commented 5 years ago

@matthewRoetcisoender So I guess we just need to figure out how to include the metadata into the JSON file that we're saving locally on the RPi.

matthewRoetcisoender commented 5 years ago

Screen Shot 2019-07-17 at 3 22 09 PM

matthewRoetcisoender commented 5 years ago

Here's what it looks like now. I can change the "type" and "description to not be in a list, I just had it like that so it matched the format of the other data and looked a little better. (The "name" and "time interval I kept as a string and int because they are used in the code and need to stay as that data type).

matthewRoetcisoender commented 5 years ago

Screen Shot 2019-07-17 at 3 28 45 PM

And then here is what I did to make the original JSON file (using the commented out section) and then read it in as the sensorParameters.

vonw commented 5 years ago

1) So the code above creates a Python dictionary, correct? (If so, then it's trivial to use the "name" and "timeInterval" parameters in the script.)

2) Can I see the code that you used to create the JSON file that contains BOTH the data and the sensor parameters? I still don't understand how you did this, unless you did it manually. So how will we code this into our Python script?

matthewRoetcisoender commented 5 years ago

Screen Shot 2019-07-18 at 3 53 39 PM

Is this what you're asking for?

vonw commented 5 years ago

Yes!

So just to double-check... the data variables have more than one value, correct?

matthewRoetcisoender commented 5 years ago

Correct, this is the method that resulted in the screenshot above. And then the same was done for the cloud packets as well (adding the meta data but still just sending one data value at a time though)

vonw commented 5 years ago

Great.

Now we just need to decide on what metadata we want to insert. Excellent job!

I will leave this Issue open until we decide on metadata variables to include.

vonw commented 5 years ago

Let's go with these for sensor parameters. We can always change things later, if needed. Please create a file for each sensor. Also when we deploy these, I think it would be good to add a parameter called "clarityOutdoorNode", which will include the ID for the particular Clarity Node that the indoor nodes are deployed with. So put this on your "deployment ToDo list"!!!

{ "name": "WSU_LAR_Indoor_Air_Quality_Node", "ID": 1, "type": "WSU LAR Indoor Air Quality Node", "description": "Indoor air quality sensor package (node) built at Washington State University's Laboratory for Atmospheric Research. Sensors include PMS5003 (particulate matter) and BME280 (TPU).", "contact": "Von P. Walden, Washington State University, v.walden@wsu.edu", "timeInterval": 120 }

timeInterval = 120 # Number of seconds

matthewRoetcisoender commented 5 years ago

sounds good!

vonw commented 5 years ago

I'm closing this issue. Thanks!