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] 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.
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": [
">=",
{
"_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 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,
"constraints": {
"unique_id": ["==", 4325]
}
}
}, {
"FindEntity": {
"with_class": "Visit",
"constraints": {
"start_year": [
">=",
{
"_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
}
}]