Differences between EHRBase and Better platform

Hi, I have been evaluating both EHRBase and Better Platform and I have discovered some different behaviors when executing aql queries.

I expected the same query to return the same result in both systems (provided they contain the same data), but this is not the case. I am not sure which implementation is correct.

Difference 1

In EHRBase, you can filter on object_id and get the latest composition matching that id. In Better, the same query yields an empty result. To get the same result in better, you need to filter on the complete versioned_object_uid, or use a LIKE statement (eg. WHERE c/uid/value LIKE ‘GUID_HERE*’).

Which implementation is correct? I can understand the reasoning behind the way Better does it, since technically the object_id is not necessarily unique. But at the same time, API Overview allows fetching compositions using just the object_id in other API:s.

Difference 2

EHRBase requires the use of at-codes in the select statement, better does not. Which one is according to the specification?

SELECT
    c/archetype_details/template_id/value, c/content[openEHR-EHR-OBSERVATION.laboratory_test_result.v1,'Mikroskopisk analys av bröstvÀvnad']/data[at0001]/events[at0002]/data[at0003]/items[openEHR-EHR-CLUSTER.anatomical_pathology_exam.v0,'Patologisk anatomisk diagnos, PAD'] AS morf,
    c/content[openEHR-EHR-OBSERVATION.laboratory_test_result.v1,'Mikroskopisk analys av bröstvÀvnad']/data[at0001]/events[at0002]/data[at0003]/items[openEHR-EHR-CLUSTER.anatomical_pathology_exam.v0,'Patologisk anatomisk diagnos, PAD']/items AS morf_items,
    c/content[openEHR-EHR-OBSERVATION.laboratory_test_result.v1,'Mikroskopisk analys av bröstvÀvnad']/data[at0001]/events[at0002]/data[at0003]/items[openEHR-EHR-CLUSTER.anatomical_pathology_exam.v0,'Patologisk anatomisk diagnos, PAD']/items[at0005]/items/value/value AS morf_itemsAT_items,
    c/content[openEHR-EHR-OBSERVATION.laboratory_test_result.v1,'Mikroskopisk analys av bröstvÀvnad']/data[at0001]/events[at0002]/data[at0003]/items[openEHR-EHR-CLUSTER.anatomical_pathology_exam.v0,'Patologisk anatomisk diagnos, PAD']/items[at0005]/items[at0023,'Tumörtyper']/value/value AS morf_itemsAT_itemsAT
    FROM EHR e CONTAINS COMPOSITION c WHERE c/archetype_details/template_id/value = 'breast_pathology_result_report_inlined.v1' limit 1

Note how EHRBase returns null for the columns without [at????]

EHRBase

  "rows": [
    [
      "breast_pathology_result_report_inlined.v1",
      {
        "name": {
          "value": "Patologisk anatomisk diagnos, PAD",
          "_type": "DV_TEXT"
        },
        "archetype_node_id": "openEHR-EHR-CLUSTER.anatomical_pathology_exam.v0",
        "_type": "CLUSTER",
        "items": [
          {
            "name": {
              "value": "*Anatomical pathology finding (en)",
              "_type": "DV_TEXT"
            },
            "archetype_node_id": "at0005",
            "_type": "CLUSTER",
            "items": [
              {
                "name": {
                  "value": "Tumörtyper",
                  "_type": "DV_TEXT"
                },
                "value": {
                  "_type": "DV_CODED_TEXT",
                  "value": "Infiltrating duct carcinoma (morphologic abnormality)",
                  "defining_code": {
                    "_type": "CODE_PHRASE",
                    "code_string": "82711006",
                    "terminology_id": {
                      "_type": "TERMINOLOGY_ID",
                      "value": "http://snomed.info/id/"
                    }
                  }
                },
                "_type": "ELEMENT",
                "archetype_node_id": "at0023"
              }
            ]
          }
        ]
      },
      null,
      null,
      "Infiltrating duct carcinoma (morphologic abnormality)"
    ]

Better

 "rows": [
        [
            "breast_pathology_result_report_inlined.v1",
            {
                "_type": "CLUSTER",
                "name": {
                    "_type": "DV_TEXT",
                    "value": "Patologisk anatomisk diagnos, PAD"
                },
                "archetype_details": {
                    "_type": "ARCHETYPED",
                    "archetype_id": {
                        "_type": "ARCHETYPE_ID",
                        "value": "openEHR-EHR-CLUSTER.anatomical_pathology_exam.v0"
                    },
                    "rm_version": "1.1.0"
                },
                "archetype_node_id": "openEHR-EHR-CLUSTER.anatomical_pathology_exam.v0",
                "items": [
                    {
                        "_type": "CLUSTER",
                        "name": {
                            "_type": "DV_TEXT",
                            "value": "*Anatomical pathology finding (en)"
                        },
                        "archetype_node_id": "at0005",
                        "items": [
                            {
                                "_type": "ELEMENT",
                                "name": {
                                    "_type": "DV_TEXT",
                                    "value": "Tumörtyper"
                                },
                                "archetype_node_id": "at0023",
                                "value": {
                                    "_type": "DV_CODED_TEXT",
                                    "value": "Infiltrating duct carcinoma",
                                    "defining_code": {
                                        "_type": "CODE_PHRASE",
                                        "terminology_id": {
                                            "_type": "TERMINOLOGY_ID",
                                            "value": "http://snomed.info/id/"
                                        },
                                        "code_string": "82711006"
                                    }
                                }
                            }
                        ]
                    }
                ]
            },
            {
                "_type": "CLUSTER",
                "name": {
                    "_type": "DV_TEXT",
                    "value": "*Anatomical pathology finding (en)"
                },
                "archetype_node_id": "at0005",
                "items": [
                    {
                        "_type": "ELEMENT",
                        "name": {
                            "_type": "DV_TEXT",
                            "value": "Tumörtyper"
                        },
                        "archetype_node_id": "at0023",
                        "value": {
                            "_type": "DV_CODED_TEXT",
                            "value": "Infiltrating duct carcinoma",
                            "defining_code": {
                                "_type": "CODE_PHRASE",
                                "terminology_id": {
                                    "_type": "TERMINOLOGY_ID",
                                    "value": "http://snomed.info/id/"
                                },
                                "code_string": "82711006"
                            }
                        }
                    }
                ]
            },
            "Infiltrating duct carcinoma",
            "Infiltrating duct carcinoma"
        ]
    ]
3 Likes