3. Subscribe to the simulator
Now that the patient simulator is running, you can subscribe to its data and use it in your own application.
In this step, continue to develop your application in the coding cell under the Lab 2 > Filter Data and Subscribe section.
- Add the following import:
from streamsx.topology import schema
- In your notebook, replace your Observations source with a subscribe call to the patient simulator. The topic to subscribe to is ingest-beaconand the data type is
patientData = topo.subscribe(‘ingest-beacon’, schema.CommonSchema.Json)
From now on, you will be subscribing to the patient data simulator rather than using the Observations function. (You can omit it from your code if you want.) Make sure the simulator is running before you submit any subsequent applications.
- Submit your application to the Bluemix Streaming Analytics service and run the cell.There should now be two jobs running in your Streams Console: one for the simulator and one for your application.
- In the Log Viewer, examine the output of the simulator with job name
- Notice the different values for code, uom (unit of measure), and, of course, value. The simulator generates many different kinds of readings with varying values.
- View the other job running on your Streams Console. This is your application. If you view the Console Log, you’ll notice that only tuples of heart rate type (code=8867-4) are getting through. This shows that your filter is working.
Now that you have a more realistic application that is complete with diverse tuples of data and a filter function, you’ll transform the tuples that you are analyzing.