google-research / CVD-paper-mobile-camera-example

Apache License 2.0
33 stars 7 forks source link

Attachment for each ResourceInfo in a capture #68

Closed MJ1998 closed 9 months ago

MJ1998 commented 9 months ago

We were earlier assuming there will be exactly 1 resource per capture and directly trying to access using sensingEngine.listResourceInfoInCapture(captureId!!)[0] to store it in fhir resource.

However there are 2 things to take care of:-

  1. For some reason if no resource is captured, the list will be empty and trying to access[0] will give a null pointer exception
  2. There can be multiple resources that can be created per capture

So what we do is simply map the listOfResourceInfo to a List<DocumentRefernce. DocumentReferenceContentComponent> which stores an Attachment object. This list is added to the DocumentReference object and stored as a fhir resource.