Deserialize the path object in IdentifierPath

Our problem lies in the structure of the IdentifiedPath class. Within this class we have two options to handle the needed aql path (path and root). We send aql as json according to AqlQuery from openEHR.SDK.
We like to know, what an identifiedPath object must look like in json?
Because the linked path object cant be deserialized and the root object need to be unique:

ping @vidi42 @birger.haarbrandt

@ramueSVA what is the reason behind sending AQL queries as JSON structure? Ideally you would use the AqlQuery#render method.

@vidi42 Within our project, we have implemented a frontend that sends AQLQuery as REST requests in JSON format to a Java-based backend that uses the openEHR.SDK.
We use the render method in the backend but we need to deserialize the query.

@ramueSVA could you share the AQL in JSON format?

Json:

{
    "select": {
        "statement": [
            {
                "_type": "SelectExpression",
                "columnExpression": {
                    "_type": "IdentifiedPath",
                    "root": {
                        "_type": "Containment",
                        "identifier": "o2/data[at0001]/events[at0002]/data[at0003]/items[at0.10]/value/magnitude"
                    }
                }
            }
        ]
    },
    "from": {
        "_type": "Containment",
        "type": "EHR",
        "identifier": "e",
        "contains": {
            "_type": "Containment",
            "type": "COMPOSITION",
            "identifier": "c1",
            "predicates": "[openEHR-EHR-COMPOSITION.registereintrag.v1]",
            "contains": {
                "_type": "Containment",
                "type": "OBSERVATION",
                "identifier": "o2",
                "predicates": "[openEHR-EHR-OBSERVATION.age-num.v0]"
            }
        }
    },
    "where": {
        "_type": "LogicalOperator",
        "symbol": "AND",
        "values": [
            {
                "_type": "ComparisonOperator",
                "statement": {
                    "_type": "IdentifiedPath",
                    "root": {
                        "_type": "Containment",
                        "identifier": "o2/data[at0001]/events[at0002]/data[at0003]/items[at0.10]/value/magnitude"
                    }
                },
                "symbol": "GT",
                "value": {
                    "_type": "Double",
                    "value": 18
                }
            }
        ]
    }
}
1 Like

@ramueSVA one suggestion for your original question would be to use the AQLQueryParser on one of the query you would like to transform to JSON, obtain the AQLQuery object and then serialize it into JSON to see what an IdentifiedPath would look like.

However, the AQLQuery object was not meat to be used as DTO, and you might encounter limitation there. If it’s possible to send directly the AQL query to the backend and parse it there for any adaptation you might need to to do it, that would be the preferred way.

1 Like