Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple routes - helper functions to group PurpleAir sensors #55

Open
tbec opened this issue Aug 31, 2021 · 0 comments
Open

multiple routes - helper functions to group PurpleAir sensors #55

tbec opened this issue Aug 31, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request regions-support Specific to Ross's regions-support branch

Comments

@tbec
Copy link
Contributor

tbec commented Aug 31, 2021

PurpleAir has who separate sensors in a single housing: "parent" and "child". The child sensor just has PM2.5, while the parent sensor has PM2.5 + other sensors. Tom is adding a column to the BigQuery table called PurpleAirParent. For child sensors, the value is the DeviceID of the parent sensor. The value is NULL for parent sensors.

We'll want some helper functions to combine PurpleAir parent/child sensors. Kerry suggested to use this formula to combine PM2.5 measurements from the two sensors:

# Threshold needs to be adjusted, but somewhere in 30% is probably good
avg = average(parent[PM2.5], child[PM2.5])
if parent[PM2.5] <= 5 and child[PM2.5] <= 5:
    return avg
else if abs(parent[PM2.5] - child[PM2.5]) / avg < THRESHOLD:
    return avg
else:
    return NULL

We should probably just return the parent sensor with this altered PM2.5 value, maybe a field denoting the the child sensor as well:

{
    "Sensor ID": "PP1200",
    "Secondary ID": "PP1201"
}
@tbec tbec added enhancement New feature or request regions-support Specific to Ross's regions-support branch labels Aug 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request regions-support Specific to Ross's regions-support branch
Projects
None yet
Development

No branches or pull requests

2 participants