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

Return a FHIR Bundle with Auto and Potential matches as entries #137

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

mherman22
Copy link

@mherman22 mherman22 commented May 30, 2024

The following fhir bundle is the target where the first entry is an auto match and the subsequent entries are potential matches:

{
  "resourceType": "Bundle",
  "id": "26419249-18b3-45de-b10e-dca0b2e72b",
  "meta": {
    "lastUpdated": "2016-03-18T03:28:49Z"
  },
  "type": "searchset",
  "total": 2,
  "entry": [
    {
      "fullUrl": "http://server/path/Patient/example",
      "resource": {
        "resourceType": "Patient",
        "id": "example",
        "gender": "male",
        "name": [
          {
            "family": "Jeannette",
            "given": [
              "Ricky"
            ]
          }
        ],
        "telecom": [
          {
            "system": "phone",
            "value": "+256788232241"
          }
        ],
        "birthDate": "1996-12-12",
        "search": {
          "extension": [
            {
              "url": "http://hl7.org/fhir/StructureDefinition/match-grade",
              "valueCode": "certain"
            }
          ],
          "mode": "match",
          "score": 0.9
        }
      }
    },
    {
      "fullUrl": "http://server/path/Patient/292",
      "resource": {
        "resourceType": "Patient",
        "id": "292",
        "gender": "male",
        "name": [
          {
            "family": "Jeannetti",
            "given": [
              "Rickie"
            ]
          }
        ],
        "telecom": [
          {
            "system": "phone",
            "value": "+256788232241"
          }
        ],
        "birthDate": "1996-12-12",
        "search": {
          "extension": [
            {
              "url": "http://hl7.org/fhir/StructureDefinition/match-grade",
              "valueCode": "possible"
            }
          ],
          "mode": "match",
          "score": 0.2
        }
      }
    }
  ]
}

@mherman22 mherman22 marked this pull request as ready for review May 31, 2024 11:27
@mherman22
Copy link
Author

cc: @reagan-meant

Copy link
Contributor

@reagan-meant reagan-meant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good already. I feel we should include the payload that was sent aswell to the payload

const system = {system: 'phone'};
const url = {url: 'http://hl7.org/fhir/StructureDefinition/match-grade'};

function createPatientEntry(patient, matchGrade, score) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mherman22 instead of adding individual fields that we have. Could you query the fhir server using the uuid per patient and just add the returned patient (just modify and add the score to this)

server/lib/routes/match.js Outdated Show resolved Hide resolved
server/lib/routes/match.js Outdated Show resolved Hide resolved
generateScoreMatrix({ patient: patientJson, level: 'childMatches', type: 'parent' }, async () => {
try {
const combinedBundle = await transformToFhirObject();
return res.status(200).json(combinedBundle);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the response returned when the endpoint is hit:

{
  "resourceType": "Bundle",
  "id": "4c22a89a-b348-44be-ab64-89d251cdbf83",
  "meta": {
    "lastUpdated": "2024-06-02T07:55:03.315Z"
  },
  "type": "searchset",
  "total": 1,
  "entry": [
    {
      "resourceType": "Patient",
      "id": "d80d5917-2b6a-4bc8-ac6f-7d385598386d",
      "meta": {
        "versionId": "2",
        "lastUpdated": "2024-06-02T07:54:14.635+00:00",
        "source": "#7Y7HDptxTWazjafL",
        "profile": [
          "http://b-techbw.github.io/bw-lab-ig/StructureDefinition/bw-patient"
        ],
        "tag": [
          {
            "system": "http://openclientregistry.org/fhir/clientid",
            "code": "postman",
            "display": "Postman Testing"
          },
          {
            "system": "http://openclientregistry.org/fhir/matchIssues",
            "code": "potentialMatches",
            "display": "Potential Matches"
          }
        ]
      },
      "text": {
        "status": "generated",
        "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><div class=\"hapiHeaderText\">Aviva Wakelam <b>MATEI </b></div><table class=\"hapiPropertyTable\"><tbody><tr><td>Identifier</td><td>201-01-1235</td></tr><tr><td>Date of birth</td><td><span>15 October 1977</span></td></tr></tbody></table></div>"
      },
      "extension": [
        {
          "url": "patient_status",
          "valueString": "Décédé"
        },
        {
          "url": "patient_status_date",
          "valueDate": "2024-01-01"
        },
        {
          "url": "patient_date_enrollement",
          "valueDate": "2023-12-01"
        },
        {
          "url": "patient_date_Initiation_ARV",
          "valueDate": "2023-12-01"
        }
      ],
      "identifier": [
        {
          "use": "official",
          "system": "https://openmrs.org/UPI",
          "value": "201-01-1235"
        },
        {
          "use": "official",
          "system": "http://openelis-global.org/pat_nationalId"
        },
        {
          "extension": [
            {
              "url": "http://fhir.openmrs.org/ext/patient/identifier#location",
              "valueReference": {
                "reference": "Location/0a2c0967-2a56-41c9-9ad5-0bd959861b42",
                "type": "Location",
                "display": "openmrs-location"
              }
            }
          ],
          "use": "usual",
          "type": {
            "text": "OpenMRS UUID"
          },
          "system": "http://clientregistry.org/openmrs",
          "value": "aeafdcda-d157-44ca-9ac6-e890e0fa3cde"
        }
      ],
      "name": [
        {
          "use": "official",
          "family": "Matei",
          "given": [
            "Aviva",
            "Wakelam"
          ]
        }
      ],
      "telecom": [
        {
          "system": "phone",
          "use": "mobile"
        },
        {
          "system": "phone",
          "use": "home"
        }
      ],
      "gender": "male",
      "birthDate": "1977-10-15",
      "deceasedBoolean": false,
      "link": [
        {
          "other": {
            "reference": "Patient/3c4a97cc-63cd-49e4-ad0d-dc4a29438dc5"
          },
          "type": "refer"
        }
      ],
      "search": {
        "extension": [
          {
            "url": "http://hl7.org/fhir/StructureDefinition/match-grade",
            "valueCode": "potential"
          }
        ],
        "score": 0.2
      }
    }
  ]
}

@mherman22 mherman22 requested a review from reagan-meant June 2, 2024 08:00
@mherman22 mherman22 changed the title Attempt to transform the match results into a FHIR Object Return a FHIR Bundle with Auto and Potential matches as entries Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants