Movement assessment depending on weather conditions and domestic info
External factors such as the weather might have a greater influence on your movement behaviour as you might think. Other domestic factors such as the number of people present in the house, or the activity from your smart object can also influence your whereabouts inside, and outside the house. To research this context, it requires data input from different sources, which later can be combined to make out of. In this use case we combine data from IoT sensors in the home, movement trackers such as Garmin wearables, and finally a weather data coming from API.
A good example of this use can be a study wherein a researcher is interested in how physical activity (for this study measured in the distance a participant walks in a day) in and outside of the the house might be affected by the weather conditions. For this study it is important to know the location of the participants and how he/she situates themself in and outside of the house. This GPS data be tracked by a wearable and stored in Data Foundry. Next to this, a selection weather data can be retrieved via an external, open-source API (such as OpenWeatherMap API for Python), and can then be stored in a local dataset.
Click here for the information about the basic setup
Use the OOCSI network to add, retrieve, update and delete data items for the Entity dataset. This is option is available from a wide variety of platforms and technologies. A list with possible options is provided under the tab OOCSI API.
Change the following things in the example code to your own preferences. Based upon Arduino/ESP, these include:
// connect to OOCSI network oocsi.connect(...); // Replace CHANNEL by the channel that you provided above oocsi.newMessage("CHANNEL"); // Copy paste your device id (head over to manage resources devices → and copy paste it into ‘DEVICE’) oocsi.addString("device_id", "DEVICE"); // Optional server marker oocsi.addString("activity", "EVENT or ACTIVITY"); // Here you can provide actual data to be stored in the dataset oocsi.addFloat("airquality", 0.67); oocsi.addBool("doorclosed", false); // Send the data oocsi.sendMessage();
Repeat this step for every code that is part of one the prototypes.
If all participants have given their consent for the study through the invitation email, the participants in the resources screen will turn green and be active.
Get GPX file from your participants that recorded GPS data and upload it to Data Foundry by using the upload button in the Movement dataset.
Use the OOCSI network to add, retrieve, update and delete data items for the Entity dataset. This option is available from a wide variety of platforms and technologies. A list with possible options is provided under the tab OOCSI API.
This use case uses an API and therefore it is important to install the request module. You can easily install the request module by inserting the following in the command line
pip install request
Connect to the OOCSI API by setting up channel namer: go to the second tab in the configuration screen To create a channel, you need to provide the service name. Enter a unique channel name and click on save. Copy paste the example code into your existing Python code and add, retrieve, update or delete a data item in the dataset. You can also do this with other platforms. Simply click on the example code of each different platform. Here is the example used for Python
Change the following things in the example code to your own preferences. Based upon Python, these include:
Next to your other dependencies, you have to import the request model in your script. Paste the following at the top of your script
Get your data from the weather API; a possible way to do this is:
request = requests.get('INSERT API TOKEN HERE')
Select which data you want to use for Data Foundry
Depending on how the weather data is formatted, you can parse the data, e.g. JSON data into an object in Python, which you can later use to send to Data Foundry. For on how to import JSON data via an API key in Python see: https://www.pluralsight.com/guides/importing-data-from-json-resource-with-python
Further steps for this include:
Go to the Data Tool and select the IoT and Media dataset of this project , and the columns of that dataset that you want to visualize, or export. Click on proceed to continue. Fill in the x and y axis You have the options to filter the data or annotate on it. Annotation might be helpful to discover new relations between for example your IoT and weather dataset. Change the color of each data column to your own preference Use sampling where needed When you are happy with the result, export the dataset by the export button, or save the visualization as an image by clicking on button with 3 dots.
For more information on the data export tool, click here.