Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add location mapping widget #800

Closed
f-odhiambo opened this issue Sep 28, 2021 · 44 comments · Fixed by #2341
Closed

Add location mapping widget #800

f-odhiambo opened this issue Sep 28, 2021 · 44 comments · Fixed by #2341
Assignees
Labels
good first issue Good for newcomers type:enhancement New feature or request

Comments

@f-odhiambo
Copy link
Collaborator

f-odhiambo commented Sep 28, 2021

Is your feature request related to a problem? Please describe.
Add a location widget that allows you to submit the location with GPS coordinates and location details as FHIR Location resources
Describe the solution you'd like

  1. ANC Usecase
    In the ANC use case, add a location of a facility or a family residence or village during a family registration/enrollment Encounter that will in turn reference a Patient plus a Practioner. Tagged via Encounter.location This should submit a location payload tagged to a patient while enrolling ANC Clients or registering a family and its householder members
  2. Covax Usecase
    In the Covax demo app, allow a user to submit the location details of where the Vaccination is being done

The Widget should be able to trigger the GPS to collect Latitude and Longitude coordinates for a precise location

Sample location payload for an Immunization facility

{
  "resourceType": "Location",
  "status": "active",
  "name": "Arundel mobile clinic",
  "description": "Vaccination Site",
  "mode": "instance",
  "address": {
    "city": "Nairobi",
    "state": "MD",
    "country": "USA"
  },
  "physicalType": {
    "coding": [ {
      "system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
      "code": "bu",
      "display": "Vaccination Center"
    } ]
  },
  "position": {
    "longitude": 42.256500,
    "latitude": -83.694710
  }
}

Describe alternatives you've considered
N/A

Additional context
Sample location payload for an Immunization facility

{
  "resourceType": "Location",
  "status": "active",
  "name": "Arundel mobile clinic",
  "description": "Vaccination Site",
  "mode": "instance",
  "address": {
    "city": "Nairobi",
    "state": "MD",
    "country": "USA"
  },
  "physicalType": {
    "coding": [ {
      "system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
      "code": "bu",
      "display": "Vaccination Center"
    } ]
  },
  "position": {
    "longitude": 42.256500,
    "latitude": -83.694710
  }
}

Sample location payload for a Household location/home

{
  "resourceType": "Location",
  "status": "active",
  "name": "Kasera Village",
  "description": "The home village location",
  "mode": "instance",
  "address": {
    "city": "Nairobi",
    "state": "Kenya",
    "country": "Kenya"
  },
  "physicalType": {
    "coding": [ {
      "system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
      "code": "bu",
      "display": "Kasera Village"
    } ]
  },
  "position": {
    "longitude": 42.256500,
    "latitude": -83.694710
  }
}

Sample ANC mock
Screen Shot 2021-09-07 at 11 14 23 AM

NB. The accompanying details of the Location (address, display name) can be collected via a questionnaire and appended to the Questionnaire response before extraction and saving/posting/sync as a location resource

@jingtang10
Copy link
Collaborator

What would the questionnaire response look like? It should be a response item to a single questionnaire item?

@f-odhiambo
Copy link
Collaborator Author

@jingtang10 There is an R5 ballot on the use of geolocation https://build.fhir.org/extension-geolocation.html. Added a zullip chat on this https://chat.fhir.org/#narrow/stream/179166-implementers/topic/Location.20mapping.20widget Will keep reviewing and try and draft a suitable QuestionnaireResponse

@f-odhiambo
Copy link
Collaborator Author

f-odhiambo commented Oct 12, 2021

There is an R4 extension for GeoLocation http://hl7.org/fhir/extension-geolocation.html. Which could be used to append the location details directly to the Patient Resource or just used separately as in a Questionnaire to get location details. I think the QR can take the following form

{
  "resourceType": "QuestionnaireResponse",
  "status": "completed",
  "subject": {
    "reference": "Patient/969",
    "display": "Test Patient"
  },
  "authored": "2013-06-18T00:00:00+01:00",
  "author": {
    "reference": "Practitioner/970"
  },
  "source": {
    "reference": "Practitioner/970"
  },
  "item": [
    {
      "linkId": "1",
      "text": "General questions",
      "item": [
        {
          "linkId": "1.1",
          "text": "What is your Country of birth?",
          "answer": [
            {
              "valueString": "The Netherlands"
            }
          ]
        },
        {
          "linkId": "1.2",
          "text": "What is your City or State of birth?",
          "answer": [
            {
              "valueString": "Amsterdam"
            }
          ]
        },
        {
          "linkId": "1.3",
          "text": "What is your Village of birth?",
          "answer": [
            {
              "valueString": "Kraule"
            }
          ]
        }
      ]
    },
    {
      "linkId": "2",
      "text": "Location Details",
      "item": [
        {
          "linkId": "2.1",
          "text": "Latitude",
          "answer": [
            {
              "valueString": "52.3676"
            }
          ]
        },
        {
          "linkId": "2.2",
          "text": "Longitude",
          "answer": [
            {
              "valueString": "4.9041"
            }
          ]
        }
      ]
    }
  ]
}


@puranjayK
Copy link

Hi @f-odhiambo, I would like to work on this issue
Could you please assign it to me

@f-odhiambo
Copy link
Collaborator Author

f-odhiambo commented Dec 19, 2021

Hi @f-odhiambo, I would like to work on this issue Could you please assign it to me

Kindly tag me to the PR or leave a comment once a PR has been raised for this

@puranjayK
Copy link

@f-odhiambo @jingtang10 could you please help me with the questionnaire of the Location widget.

@f-odhiambo
Copy link
Collaborator Author

f-odhiambo commented Dec 24, 2021

@f-odhiambo @jingtang10 could you please help me with the questionnaire of the Location widget.

Here you go http://turn-fhir.smartregister.org/fhir/Questionnaire/1922. You can add the widget to this questionnaire

@f-odhiambo
Copy link
Collaborator Author

Hey, @puranjayK Any progress update on this ? Perhaps we can link up on this sometime this week if available for more details. Let me know

@f-odhiambo
Copy link
Collaborator Author

@puranjayK Any progress update on this?

@puranjayK
Copy link

@puranjayK Any progress update on this?

Sorry I couldnt work on this, as the covid situation got worse in my country.
I am having issues on how to make this widget and how the questionnaire is to be used

@f-odhiambo f-odhiambo changed the title Add location widget Add location mapping widget Jan 26, 2022
@PallaviGanorkar
Copy link
Contributor

@jingtang10 @Tarun-Bhardwaj As discussed need to hold this issue for more requirement details.

@f-odhiambo
Copy link
Collaborator Author

HI @PallaviGanorkar , Are you going to be picking this issue ?

@MnCSSJ4x
Copy link

Hello I am new to contribution and would like to contribute to this issue if no one is on it.

@f-odhiambo
Copy link
Collaborator Author

Hi @MnCSSJ4x,Thanks for this , how can we connect to have a brief on this issue, can we ?
CC @FikriMilano

@MnCSSJ4x
Copy link

MnCSSJ4x commented Feb 18, 2022

we can connect via mail : xxxxx
or if there is a slack channel please share an invite

@MnCSSJ4x
Copy link

MnCSSJ4x commented Mar 2, 2022

@FikriMilano I was planning to follow the sample format mentioned until and unless there is some limitation

@FikriMilano
Copy link
Collaborator

Alright, sounds good for me.
Thanks for the feedback @MnCSSJ4x

@f-odhiambo
Copy link
Collaborator Author

Hi @MnCSSJ4x , how is the progress here ?
CC @FikriMilano

@MnCSSJ4x
Copy link

MnCSSJ4x commented Mar 8, 2022

@f-odhiambo
I am having my semester exams this week. Will definitely address the coding part of the solution next week
@FikriMilano can you provide me how you set up the environment locally to test ?

@FikriMilano
Copy link
Collaborator

@MnCSSJ4x you can just simply fork the repo, build the project then try to run the demo apps

@f-odhiambo
Copy link
Collaborator Author

@MnCSSJ4x Any progress made on this ticket?

@f-odhiambo
Copy link
Collaborator Author

@Tarun-Bhardwaj I think we can close this issue as it had been implemented on FHIR Core opensrp/fhircore#1536

@fredhersch
Copy link
Collaborator

Thanks @f-odhiambo - would it be worth merging this back into the SDK? @jingtang10

@f-odhiambo
Copy link
Collaborator Author

Thanks @f-odhiambo - would it be worth merging this back into the SDK? @jingtang10

We can have a discussion on this , happy to elaborate more on the solution we took

@Tarun-Bhardwaj Tarun-Bhardwaj moved this from Backlog to Complete in Android FHIR SDK Sep 12, 2022
@Tarun-Bhardwaj Tarun-Bhardwaj moved this to Backlog in Android FHIR SDK Sep 16, 2022
@Tarun-Bhardwaj Tarun-Bhardwaj moved this from Backlog to Complete in Android FHIR SDK Sep 21, 2022
@dubdabasoduba
Copy link
Collaborator

@ageryck I think you can re-open this ticket for the GPS picker work.

@f-odhiambo f-odhiambo reopened this Nov 7, 2023
@github-project-automation github-project-automation bot moved this from Complete to New in Android FHIR SDK Nov 7, 2023
@ageryck
Copy link

ageryck commented Nov 9, 2023

@jingtang10 this can be re-assigned since the implementation in the attached PR was something different

@LZRS
Copy link
Collaborator

LZRS commented Nov 29, 2023

@f-odhiambo @f-odhiambo I had a suggestion of maybe using a normal Questionnaire item of type string with a custom extension to render the widget

 {
          "linkId": "Location widget",
          "type": "string",
          "text": "Record GPS Location",
          "required": true,
          "extension": [
            {
              "url": "https://github.com/google/android-fhir/StructureDefinition/questionnaire-itemControl",
              "valueCodeableConcept": {
                "coding": [
                  {
                    "system": "https://github.com/google/android-fhir/questionnaire-item-control",
                    "code": "location-widget"
                  }
                ]
              }
            }
          ]
        }

and to render, instead of having it as single "record gps location", maybe have it render similar to the datepicker populating the textview with comma-separated latitude, longitude, altitude. This way we would probably still be able to use the already implemented utilities for example, adding extensions for help, attachment, translations and also show validation error incase field is required

sample

cc: @ageryck @FikriMilano @dubdabasoduba

@LZRS
Copy link
Collaborator

LZRS commented Dec 15, 2023

After reviewing the above implementation idea, we felt it may have had deficiencies of may be not being able to separate between latitude and longitude in consistent way. And so, with the help of the fhir org team, we had another idea that would be viable, to use a Questionnaire item of type group. The Questionnaire item would have a custom extension to represent location-widget and also have child items of type string with custom extensions to specify latitude, longitude and altitude - these would be used in the ui to render and populate the coordinates.

Essentially, it would look like

 {
          "linkId": "location-widget",
          "type": "group",
          "extension": [
            {
              "url": "https://github.com/google/android-fhir/StructureDefinition/questionnaire-itemControl",
              "valueCodeableConcept": {
                "coding": [
                  {
                    "system": "https://github.com/google/android-fhir/questionnaire-item-control",
                    "code": "location-widget"
                  }
                ]
              }
            }
          ],
        "item": [
          {
            "linkId": "latitude",
            "type": "string",
            "required": true,
            "readOnly": true,
            "extension": [
              {
                "url": "gps-coordinate",
                "value": "latitude"
              }
            ]
          },
          {
            "linkId": "longitude",
            "type": "string",
            "required": true,
            "readOnly": true,
            "extension": [
              {
                "url": "gps-coordinate",
                "value": "longitude"
              }
            ]
          }
        ]
        }

@jingtang10 would love to hear what you think

cc @f-odhiambo @ageryck

@jingtang10
Copy link
Collaborator

I think defining custom widgets (together with custom extensions) in the SDC library is a great approach. This is fine.

The important thing is documentation and making sure people using your questionnaires are aware of the extensions you define otherwise your questionnaire will not be usable.

Be good to share this with the fhir chat community as well, especially to get grahame and lloyd's opinion.

@dubdabasoduba
Copy link
Collaborator

After reviewing the above implementation idea, we felt it may have had deficiencies of may be not being able to separate between latitude and longitude in consistent way. And so, with the help of the fhir org team, we had another idea that would be viable, to use a Questionnaire item of type group. The Questionnaire item would have a custom extension to represent location-widget and also have child items of type string with custom extensions to specify latitude, longitude and altitude - these would be used in the ui to render and populate the coordinates.

Essentially, it would look like

 {
          "linkId": "location-widget",
          "type": "group",
          "extension": [
            {
              "url": "https://github.com/google/android-fhir/StructureDefinition/questionnaire-itemControl",
              "valueCodeableConcept": {
                "coding": [
                  {
                    "system": "https://github.com/google/android-fhir/questionnaire-item-control",
                    "code": "location-widget"
                  }
                ]
              }
            }
          ],
        "item": [
          {
            "linkId": "latitude",
            "type": "string",
            "required": true,
            "readOnly": true,
            "extension": [
              {
                "url": "gps-coordinate",
                "value": "latitude"
              }
            ]
          },
          {
            "linkId": "longitude",
            "type": "string",
            "required": true,
            "readOnly": true,
            "extension": [
              {
                "url": "gps-coordinate",
                "value": "longitude"
              }
            ]
          }
        ]
        }

@jingtang10 would love to hear what you think

cc @f-odhiambo @ageryck

@LZRS how does this look on the QR? Do you mind sharing a sample?

@LZRS
Copy link
Collaborator

LZRS commented Dec 18, 2023

After reviewing the above implementation idea, we felt it may have had deficiencies of may be not being able to separate between latitude and longitude in consistent way. And so, with the help of the fhir org team, we had another idea that would be viable, to use a Questionnaire item of type group. The Questionnaire item would have a custom extension to represent location-widget and also have child items of type string with custom extensions to specify latitude, longitude and altitude - these would be used in the ui to render and populate the coordinates.
Essentially, it would look like

 {
          "linkId": "location-widget",
          "type": "group",
          "extension": [
            {
              "url": "https://github.com/google/android-fhir/StructureDefinition/questionnaire-itemControl",
              "valueCodeableConcept": {
                "coding": [
                  {
                    "system": "https://github.com/google/android-fhir/questionnaire-item-control",
                    "code": "location-widget"
                  }
                ]
              }
            }
          ],
        "item": [
          {
            "linkId": "latitude",
            "type": "string",
            "required": true,
            "readOnly": true,
            "extension": [
              {
                "url": "gps-coordinate",
                "value": "latitude"
              }
            ]
          },
          {
            "linkId": "longitude",
            "type": "string",
            "required": true,
            "readOnly": true,
            "extension": [
              {
                "url": "gps-coordinate",
                "value": "longitude"
              }
            ]
          }
        ]
        }

@jingtang10 would love to hear what you think
cc @f-odhiambo @ageryck

@LZRS how does this look on the QR? Do you mind sharing a sample?

The QuestionnaireResponse would probably look like this

{
  "linkId": "location-widget",
  "item": [
    {
      "linkId": "latitude",
      "answer": [
        {
          "valueString": "41.40338"
        }
      ]
    },
    {
      "linkId": "longitude",
      "answer": [
        {
          "valueString": "2.17403"
        }
      ]
    }
  ]
}

@github-project-automation github-project-automation bot moved this from New to Complete in Android FHIR SDK Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers type:enhancement New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.