FindEntity

Find all entities that satisfy the specified constraints.

Parameters

Details

If the with_class is skipped, entities of any class that satisfy the constraints will be returned.

At least one of results or _ref must be specified. If neither is specified, the command is render useless, and will return an error.

If constraints is skipped, all entities with the given class are returned.

If only one ref parameter is used in the is_connected_to array, the resulting objects obtained after traversing the given connection can be associated with their source objects by specifying the parameter group_by_source as true. The parameter is ignored if is_connected_to is absent. It is set to false by default.

Examples

Find an entity of class “Visit” where its “start_year” property is on or after 1990, and retrieve other properties of the visit:

[ {
    "FindEntity": {
        "with_class": "Visit",
        "constraints" : {
            "start_year": [ ">=", 1990 ],
        },
        "results": {
            "list": ["start_year", "end_year", "billing_id"]
        }
    }
} ]

Find the entities of the class “Visit” where its “start_year” property is on or after 1990 that are associated with a “Patient” with a “unique_id” equal to 4325, and retrieve other properties of the visit:

[ {
    "FindEntity": {
        "with_class": "Patient",
        "_ref": 1,
        "unique": true,     // Make sure we only find a single patient.
        "constraints" {
            "unique_id": ["==", 4325]
        }
        // There is no need to specify a "results",
        // because we just use a reference to the found entity
    }
}, {
    "FindEntity": {
        "with_class": "Visit",
        "constraints" : {
            "start_year": [ ">=", 1990 ],
        },
        "is_connected_to": {
            "ref": 1,
            "direction": "in",
            "connection_class": "PatientMadeVisit",
        },
        "results": {
            "list": ["start_year", "end_year", "billing_id"]
        }
    }
} ]