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.

  1. Add the following import:
    from streamsx.topology import schema
  2. 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 JSON.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.
  3. 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.
  4. In the Log Viewer, examine the output of the simulator with job name
  5. Notice the different values for codeuom (unit of measure), and, of course, value. The simulator generates many different kinds of readings with varying values.
  6. 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.