FHIR Chat · Android FHIR SDK Structured Data Capture Library · implementers

Stream: implementers

Topic: Android FHIR SDK Structured Data Capture Library


view this post on Zulip Brian Reinhold (Mar 08 2022 at 21:46):

Anyone familiar with this library Android FHIR SDK Structured Data Capture Library

[https://github.com/google/android-fhir/wiki/Structured-Data-Capture-Library]

project

https://github.com/google/android-fhir/

It is a questionnaire renderer written in Kotlin for Android. I am trying to use it. Documentation is very thin at this stage. I have made some progress (I am using Java) but nothing too exciting. Just tried to render a simple Questionnaire, I get something on the screen but nothing after that.

view this post on Zulip Jose Costa Teixeira (Mar 09 2022 at 00:04):

https://wiki.digitalsquare.io/images/0/0c/Digital_Square_FHIR_Webinar_-_Android_FHIR_SDK.pdf

view this post on Zulip Jose Costa Teixeira (Mar 09 2022 at 00:05):

Here's a sample app: https://github.com/openhie/FoodAllergy-webinar/tree/master/android

view this post on Zulip Tilo Christ (Mar 09 2022 at 11:28):

@Jing Tang might be able to provide you with more insights.

view this post on Zulip Brian Reinhold (Mar 09 2022 at 13:53):

@Jose Costa Teixeira @Jing Tang I have been able to get a questionnaire to render but have been unable to get the response. One problem is that I don't know kotlin and I am doing it Java. The code for getting the questionnaire to render in Java was very different than that for kotlin. The documentation is too thin for me to get anything but null pointers when I try and retrieve the response. For example, this critical value QUESTIONNAIRE_FRAGMENT_TAG is undefined in my project. I've looked at the sample apps and they are not helpful as they only do the setup of the questionnaire which I eventually hacked out in Java.

This code in the onCreate() will cause the questionnaire (hard coded String) to render. However, I am unable to get the response in my Button's onClickListner() which I tap when I am done answering the questions.

        bundle = new Bundle();
        bundle.putString(QuestionnaireFragment.EXTRA_QUESTIONNAIRE_JSON_STRING, questionnaireOzair);
        questionnaireFragment = new QuestionnaireFragment();
        getSupportFragmentManager().
                beginTransaction()
                .setReorderingAllowed(true)
                .add(R.id.fragment_container_view, QuestionnaireFragment.class, bundle)
                .commit();

I know it's quite different than the kotlin example given in the Wiki.

view this post on Zulip Jose Costa Teixeira (Mar 09 2022 at 13:54):

@Jing Tang

view this post on Zulip Brian Reinhold (Mar 09 2022 at 14:43):

I got something like this to work:

Create the fragment

    private void createQuestionnaireFragment()
    {
        bundle = new Bundle();
        bundle.putString(QuestionnaireFragment.EXTRA_QUESTIONNAIRE_JSON_STRING, questionnaireOzair);
        questionnaireFragment = new QuestionnaireFragment();
        questionnaireFragment.setArguments(bundle);
        getSupportFragmentManager().
                beginTransaction()
                .setReorderingAllowed(true).add(R.id.fragment_container_view, questionnaireFragment)
                .commit();
    }

get the response

    public View.OnClickListener onButtonClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Log.i(TAG, "Done Questionnaire pressed by user");
            IParser serializer = FhirContext.forR4().newJsonParser();
            serializer.setPrettyPrint(true);
            String questStr = serializer.encodeResourceToString(questionnaireFragment.getQuestionnaireResponse());
            Log.i(TAG, questStr);
        }
    };

The difficulty I was having previously was getting the questionnaireFragment for retrieval. I was trying to get it after the rendering was done and it did not seem to exist.

I still need a lot of help here - so much is done under the hood I have no idea what is going on so it's just a matter of following very specific recipes.

view this post on Zulip Brian Reinhold (Mar 09 2022 at 22:14):

@Jing Tang I have a very simple implementation that renders a Q and gives a QR. It's size, however, is huge. Something like 40 MB in debug and 34 MB in release. Is that due to the HAPI FHIR library?

However, what I would like to do it to be able to 'exit out' of the rendering process when a certain extension is read and then return to finish. Is that something possible to do?

view this post on Zulip Jose Costa Teixeira (Mar 10 2022 at 04:37):

@Fred Hersch may also be able to help

view this post on Zulip Fred Hersch (Mar 10 2022 at 12:01):

Jose Costa Teixeira said:

Fred Hersch may also be able to help

Thanks @Jose Costa Teixeira . Hi @Brian Reinhold. Sorry to hear you are having such difficulty. Definitely keen to learn from this experience and see how we can address the documentation gap (which we are aware of!). Were you able to follow the example in the Digital Square webinar. Can you just lay out what you are trying to achieve and I'll see if there is a good example in the code base we can point you to. It may be easier to set up a call.

view this post on Zulip Shashi K (Mar 10 2022 at 13:01):

Created profiles for resources but need help with creation of transaction bundle and testing . Any tool available to do that.

view this post on Zulip Jing Tang (Mar 10 2022 at 18:36):

Brian Reinhold said:

I still need a lot of help here - so much is done under the hood I have no idea what is going on so it's just a matter of following very specific recipes.

Hey Brian - Glad you got this to work! What other help do you need?

view this post on Zulip Jing Tang (Mar 10 2022 at 18:38):

Brian Reinhold said:

Jing Tang I have a very simple implementation that renders a Q and gives a QR. It's size, however, is huge. Something like 40 MB in debug and 34 MB in release. Is that due to the HAPI FHIR library?

However, what I would like to do it to be able to 'exit out' of the rendering process when a certain extension is read and then return to finish. Is that something possible to do?

The sizes bloat is caused by some ML libraries in the QR code reader. I think we'll try to move that out of this library - but in the mean time you can also try to use progard to exclude it...

I don't really understand what you mean by exiting out. Can you give an example?

view this post on Zulip Brian Reinhold (Mar 11 2022 at 13:16):

@Jing Tang I tried using the default proguard but it did not build.

THat aside, what I mean by 'exit' is to take over rendering under a certain condition. What I am doing is trying to specify how a user can get a question that requires the user to take a measurement with a communicating device. The user does so and the data communicated by the device is auto populated into the response. At the moment we are defining a new extension called 'real time' that tells the renderer that data is going to be generated. The extension will carry codes that tell the render what information from the device to capture. Of course this requires an implementation that is capable of communicating with the device and decoding the data from it.

Clearly no renderer is capable of that.

So I am wondering if there is a way to do it. It is nice to NOT have to write all that GUI code to display the questions and handle user responses!


Last updated: Apr 12 2022 at 19:14 UTC