FindEntity
Find all entities that satisfy the specified constraints.
Parameters
-
[optional] _ref: Reference to be used within the transaction.
-
[optional] unique: Indicates whether a single object is expected to satisfy the constraints.
-
[optional] constraints
-
[optional] is_connected_to
-
[optional] is_endpoint_of
-
[optional] group_by_source
-
[optional] results
-
[optional] batch
-
[optional] sort
-
[optional] limit
-
[optional] offset
-
[optional] uniqueids: indicates whether unique ids will be returned as part of the response (Default: false).
-
[optional] with_class: Name of entity class.
-
[optional] per_group: Apply sorting, offset, and limit independently within each source group. Requires group_by_source when enabled.
Details
If with_class is omitted, entities of any class that satisfy the constraints are eligible.
Specify results, _ref, or "uniqueids": true. The command returns an error if none is specified.
If constraints is omitted, no property filter is applied. Class and relationship restrictions still apply, as do offset and limit. Use text search expressions inside constraints for fuzzy or full-text matching, and an explicit sort expression for relevance ordering.
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 August 7, 2016, and retrieve other properties of the visit:
[{
"FindEntity": {
"with_class": "Visit",
"constraints": [
"$start_year",
">=",
{
"to_date": "Sun Aug 7 10:59:24 PDT 2016"
}
],
"results": {
"list": ["start_year", "billing_id"]
}
}
}]
Successful response:
[{
"FindEntity": {
"status": 0,
"returned": 1,
"entities": [{
"start_year": {
"_date": "2017-08-07T10:59:24-07:00"
},
"billing_id": 123
}]
}
}]
Find the entities of the class “Visit” where its “start_year” property is on or after August 6, 2016 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,
"constraints": ["$unique_id", "==", 4325]
}
}, {
"FindEntity": {
"with_class": "Visit",
"constraints": [
"$start_year",
">=",
{
"to_date": "Sat Aug 6 10:59:24 PDT 2016"
}
],
"is_connected_to": {
"ref": 1,
"direction": "in",
"connection_class": "PatientMadeVisit"
},
"results": {
"list": ["start_year", "end_year", "billing_id"]
}
}
}]
Successful response:
[{
"FindEntity": {
"returned": 0,
"status": 0
}
}, {
"FindEntity": {
"returned": 0,
"status": 0
}
}]