opensrp / fhircore

FHIR Core / OpenSRP 2 is a Kotlin application for delivering offline-capable, mobile-first healthcare project implementations from local community to national and international scale using FHIR and WHO Smart Guidelines on Android.
https://smartregister.org
Apache License 2.0
50 stars 39 forks source link

Tag resources with meta tags from Linkage resource #3311

Closed ellykits closed 2 weeks ago

ellykits commented 3 weeks ago

IMPORTANT: Where possible all PRs must be linked to a Github issue

Fixes #3291

Engineer Checklist

Code Reviewer Checklist

codecov[bot] commented 3 weeks ago

Codecov Report

Attention: Patch coverage is 0% with 45 lines in your changes missing coverage. Please review.

Project coverage is 28.3%. Comparing base (ac82739) to head (99f7bef). Report is 86 commits behind head on main.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/opensrp/fhircore/pull/3311/graphs/tree.svg?width=650&height=150&src=pr&token=IJUTHZUGGH&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensrp)](https://app.codecov.io/gh/opensrp/fhircore/pull/3311?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensrp) ```diff @@ Coverage Diff @@ ## main #3311 +/- ## ========================================= - Coverage 29.6% 28.3% -1.4% - Complexity 658 719 +61 ========================================= Files 239 266 +27 Lines 11204 12617 +1413 Branches 1948 2228 +280 ========================================= + Hits 3323 3575 +252 - Misses 7447 8572 +1125 - Partials 434 470 +36 ``` | [Flag](https://app.codecov.io/gh/opensrp/fhircore/pull/3311/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensrp) | Coverage Δ | | |---|---|---| | [engine](https://app.codecov.io/gh/opensrp/fhircore/pull/3311/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensrp) | `64.8% <ø> (-1.4%)` | :arrow_down: | | [geowidget](https://app.codecov.io/gh/opensrp/fhircore/pull/3311/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensrp) | `18.7% <ø> (-28.5%)` | :arrow_down: | | [quest](https://app.codecov.io/gh/opensrp/fhircore/pull/3311/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensrp) | `5.1% <0.0%> (-0.3%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensrp#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/opensrp/fhircore/pull/3311?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensrp) | Coverage Δ | | |---|---|---| | [...e/quest/ui/questionnaire/QuestionnaireViewModel.kt](https://app.codecov.io/gh/opensrp/fhircore/pull/3311?src=pr&el=tree&filepath=android%2Fquest%2Fsrc%2Fmain%2Fjava%2Forg%2Fsmartregister%2Ffhircore%2Fquest%2Fui%2Fquestionnaire%2FQuestionnaireViewModel.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensrp#diff-YW5kcm9pZC9xdWVzdC9zcmMvbWFpbi9qYXZhL29yZy9zbWFydHJlZ2lzdGVyL2ZoaXJjb3JlL3F1ZXN0L3VpL3F1ZXN0aW9ubmFpcmUvUXVlc3Rpb25uYWlyZVZpZXdNb2RlbC5rdA==) | `3.0% <0.0%> (-0.6%)` | :arrow_down: | ... and [10 files with indirect coverage changes](https://app.codecov.io/gh/opensrp/fhircore/pull/3311/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensrp)
dubdabasoduba commented 3 weeks ago

Configs

Screenshot 2024-06-06 at 15 09 16

pld commented 2 weeks ago

@dubdabasoduba how's this looking now?

ellykits commented 2 weeks ago

I reproduced the bug will be pushing the fix in a few @dubdabasoduba

ellykits commented 2 weeks ago

Issue resolved. @dubdabasoduba Re-test.

dubdabasoduba commented 2 weeks ago

@ellykits REL tags are now added but we seem to have multiple tags

{
  "resourceType": "Observation",
  "id": "3669902a-55fa-4751-8a42-bab836ce2b5b",
  "meta": {
    "lastUpdated": "2024-06-11T20:43:58.698+03:00",
    "tag": [
      {
        "system" : "https://smartregister.org/related-entity-location-tag-id",
        "code"   : "20bef46f-b5f2-490f-beca-d9fa6205be06"                    ,
        "display": "Related Entity Location"
      },
      {
        "system" : "https://smartregister.org/related-entity-location-tag-id",
        "code"   : "20bef46f-b5f2-490f-beca-d9fa6205be06"                    ,
        "display": "Related Entity Location"
      },
      {
        "system" : "https://smartregister.org/related-entity-location-tag-id",
        "display": "Related Entity Location"
      },
      {
        "system" : "https://smartregister.org/care-team-tag-id",
        "code"   : "4ddd4157-921b-4c65-820c-161b6e845011"      ,
        "display": "Practitioner CareTeam"
      },
      {
        "system" : "https://smartregister.org/location-tag-id",
        "code"   : "f15ff8ab-9475-4356-8363-7f518fdd66ce"     ,
        "display": "Practitioner Location"
      },
      {
        "system" : "https://smartregister.org/organisation-tag-id",
        "code"   : "d0882d3a-f35a-43cf-9d43-2ea9f9793e24"         ,
        "display": "Practitioner Organization"
      },
      {
        "system" : "https://smartregister.org/practitioner-tag-id",
        "code"   : "ab929110-6918-4d0b-8961-13cce4d5c76b"         ,
        "display": "Practitioner"
      },
      {
        "system" : "https://smartregister.org/app-version",
        "code"   : "2.0.0-eusm"                           ,
        "display": "Application Version"
      }
    ]
  },
  "identifier": [
    {"use": "usual", "value": "b5550f3b-c32a-4b9f-b112-48ad6c4b1ec7"}
  ],
  "status": "final",
  "category": [
    {
      "coding": [
        {
          "system" : "http://smartregister.org/",
          "code"   : "PRODCHECK"                ,
          "display": "Product Check"
        }
      ],
      "text": "Product Check"
    }
  ],
  "code": {
    "coding": [
      {
        "system" : "http://snomed.info/sct",
        "code"   : "issue_details"         ,
        "display": "Issue Details"
      }
    ],
    "text": "Issue Details"
  },
  "subject": {"reference": "Group/e44e26d0-1f7a-41d6-aa57-99c5712ddd66"},
  "encounter": {"reference": "Encounter/e0c25150-c01f-44f8-a6ef-faed8a6e3ec6"},
  "effectivePeriod": {
    "start": "2024-06-11T20:43:58+03:00",
    "end"  : "2024-06-11T20:43:58+03:00"
  }
}
ellykits commented 2 weeks ago

Nice catch @dubdabasoduba. Issue resolved.

dubdabasoduba commented 2 weeks ago

@ellykits I tested this again. I think we missed and edge case

{"resourceType":"Encounter","id":"ded607e4-805e-46d7-94c3-f1e68e006d3d","meta":{"lastUpdated":"2024-06-12T15:41:44.409+03:00","tag":[{"system":"https://smartregister.org/care-team-tag-id","code":"4ddd4157-921b-4c65-820c-161b6e845011","display":"Practitioner CareTeam"},{"system":"https://smartregister.org/location-tag-id","code":"f15ff8ab-9475-4356-8363-7f518fdd66ce","display":"Practitioner Location"},{"system":"https://smartregister.org/organisation-tag-id","code":"d0882d3a-f35a-43cf-9d43-2ea9f9793e24","display":"Practitioner Organization"},{"system":"https://smartregister.org/practitioner-tag-id","code":"ab929110-6918-4d0b-8961-13cce4d5c76b","display":"Practitioner"},{"system":"https://smartregister.org/app-version","code":"2.0.0-eusm","display":"Application Version"}]},"identifier":[{"use":"usual","value":"65339deb-9558-4530-bf85-7bca9d7c3703"}],"status":"finished","class":{"system":"http://terminology.hl7.org/CodeSystem/v3-ActCode","code":"OBSENC"},"type":[{"coding":[{"system":"http://smartregister.org/","code":"CNBEN","display":"Consult Beneficiaries Visit"}],"text":"Consult Beneficiaries Visit"}],"priority":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v3-ActPriority","code":"EL","display":"elective"}],"text":"elective"},"participant":[{"individual":{"reference":"Practitioner/ab929110-6918-4d0b-8961-13cce4d5c76b"}}],"period":{"start":"2024-06-12T15:41:44+03:00","end":"2024-06-12T15:41:44+03:00"},"reasonCode":[{"coding":[{"system":"https://smartregister.org/","code":"CNBEN","display":"Consult Beneficiaries Visit"}],"text":"Consult Beneficiaries Visit"}],"location":[{"location":{"reference":"Location/5c70635b-286d-4a65-8275-3169554b7ee8"},"status":"active"}],"serviceProvider":{"reference":"Organization/d0882d3a-f35a-43cf-9d43-2ea9f9793e24"},"partOf":{"reference":"Encounter/8b44e438-3179-4f01-96b8-6a9821e7e19d"}}

In the case where the LIST resource is not available but the resourceIdentifier and resourceType point to a location we should also add the REL as the location ID found on the resourceIdentifier

This will cater for actions performed directly for the location. The LIST resource will only be available for locations with other items assigned to them

Consult benficiaries

dubdabasoduba commented 2 weeks ago

@ellykits works like a charm