Query Batch Production Records

  • Retrieves batch production record data.

  • Required security permission - READ.

  • HTTP methods supported: GET, POST.

Description

The query batch production records endpoint allows Batch Production Record (BRP) querying. The queries use a syntax similar to the MongoDB query language such as the $lte and $gte comparison operators.

Parameters

Name Type Optional Description

query

string

no

Batch production record query. Has to be a Base64 encoded JSON document.

return_sub_documents

boolean

yes

Indicates subdocuments should constructed recursively and included in the response, by default true. This can be switched-off if only the top-level fields are required.

limit

integer

yes

Limits the number of results in the response, ignored by default.

skip

integer

yes

Specifies the first number of results to skip, ignored by default.

timeout

integer

yes

Time limit in milliseconds for processing the query, by default 10000 milliseconds.

insights

boolean

yes

Indicates application insights should be included in the response, by default false.

Examples

The Batch Production Record find() function is called by requiring the isa88.db.find library. Read more about the lua logic behind the query batch production records endpoint here.

Querying Event type documents

This example demonstrates how to find documents of type Event whose TimeStamp is within a range of the specified time.

HTTP POST

Request body
{
    "query": {
        "Event": {
            "TimeStamp": {
                "$lte": {
                    "$date": "2019-07-19T16:30:00.0Z"
                },
                "$gte": {
                    "$date": "2019-07-18T12:00:00.0Z"
                }
            }
        }
    }
}
Response body
{
    "data": {
        "batch_production_record_data": [
            {
                "Events": [
                    {
                        "EntryID": "9a0a8330-a953-11e9-b77c-6c2b59d68f72",
                        "EquipmentID": {
                            "#": "/XI Pharma/Köln/Human Drugs/WSC/WSC-1"
                        },
                        "EventSubType": {
                            "#": 20
                        },
                        "EventType": {
                            "#": 3
                        },
                        "ObjectType": {
                            "#": 1
                        },
                        "TimeStamp": 1563451210155,
                        "Value": {
                            "#": 3
                        }
                    },
                    {
                        "EntryID": "9a0a8331-a953-11e9-b77c-6c2b59d68f72",
                        "EquipmentID": {
                            "#": "/XI Pharma/Köln/Human Drugs/WSC/WSC-1"
                        },
                        "EventSubType": {
                            "#": 20
                        },
                        "EventType": {
                            "#": 3
                        },
                        "ObjectType": {
                            "#": 1
                        },
                        "PreviousValue": {
                            "#": 3
                        },
                        "TimeStamp": 1563451215156,
                        "Value": {
                            "#": 17
                        }
                    }
                ],
                "ID": "E41D3DC9-B4E0-4572-AE8A-ABAA5BD7D71A"
            },
            {
                "Events": [
                    {
                        "EntryID": "9410a107-a953-11e9-b77c-6c2b59d68f72",
                        "EquipmentID": {
                            "#": "/XI Pharma/Köln/Human Drugs/WSC/WSC-1"
                        },
                        "EventSubType": {
                            "#": 20
                        },
                        "EventType": {
                            "#": 3
                        },
                        "ObjectType": {
                            "#": 1
                        },
                        "TimeStamp": 1563451200155,
                        "Value": {
                            "#": 3
                        }
                    },
                    {
                        "EntryID": "9410a108-a953-11e9-b77c-6c2b59d68f72",
                        "EquipmentID": {
                            "#": "/XI Pharma/Köln/Human Drugs/WSC/WSC-1"
                        },
                        "EventSubType": {
                            "#": 20
                        },
                        "EventType": {
                            "#": 3
                        },
                        "ObjectType": {
                            "#": 1
                        },
                        "PreviousValue": {
                            "#": 3
                        },
                        "TimeStamp": 1563451205156,
                        "Value": {
                            "#": 17
                        }
                    }
                ],
                "ID": "A7811B7E-EA29-4F42-8643-3CEE941799D1"
            }
        ]
    }
}

Querying multiple types of documents at once

This example demonstrates that user can also specify conditions on multiple document types at once. In that case, the full 'Batch Production Record' documents which match the criterion are returned regardless of the type of documents specified.

HTTP POST

Request URL
  • /api/v2/querybatchproductionrecords

Request body
{
    "query": [
        {
            "BatchProductionRecord": {
                "EquipmentID": "/XI Pharma/Köln/Human Drugs/WSC/WSC-1"
            }
        },
        {
            "Event": {
                "TimeStamp": {
                    "$lte": {
                        "$date": "2019-07-18T12:30:00.0Z"
                    },
                    "$gte": {
                        "$date": "2019-07-18T12:00:00.0Z"
                    }
                }
            }
        }
    ]
}
Response body

Note, due to the size of the response, the example displayed below is reduced.

{
    "data": {
        "batch_production_record_data": [
            {
                "BatchProductionRecords": [
                    {
                        "BatchID": [
                            {
                                "#": "14"
                            }
                        ],
                        "ControlRecipes": [
                            {
                                ...
                            }
                        ],
                        "CreationDate": 1563451215327,
                        "DataSets": [
                            {
                               ...
                            }
                        ],
                        "EntryID": "9a0a832f-a953-11e9-b77c-6c2b59d68f72",
                        "EquipmentID": [
                            {
                                "#": "/XI Pharma/Köln/Human Drugs/WSC/WSC-1"
                            }
                        ],
                        "Events": [
                            {
                                ...
                            },
                            {
                                ...
                            }
                        ],
                        "ID": "E41D3DC9-B4E0-4572-AE8A-ABAA5BD7D71A",
                        "ObjectType": {
                            "#": 21
                        },
                        "TimeStamp": 1563451215327
                    }
                ],
                "ID": "E41D3DC9-B4E0-4572-AE8A-ABAA5BD7D71A"
            },
            {
                "BatchProductionRecords": [
                    {
                        "BatchID": [
                            {
                                "#": "13"
                            }
                        ],
                        "ControlRecipes": [
                            {
                                ...
                            }
                        ],
                        "CreationDate": 1563451205301,
                        "DataSets": [
                            {
                                ...
                            },
                            {
                                ...
                            }
                        ],
                        "EntryID": "9410a106-a953-11e9-b77c-6c2b59d68f72",
                        "EquipmentID": [
                            {
                                "#": "/XI Pharma/Köln/Human Drugs/WSC/WSC-1"
                            }
                        ],
                        "Events": [
                            {
                              ...
                            },
                            {
                              ...
                            }
                        ],
                        "ID": "A7811B7E-EA29-4F42-8643-3CEE941799D1",
                        "ObjectType": {
                            "#": 21
                        },
                        "TimeStamp": 1563451205301
                    }
                ],
                "ID": "A7811B7E-EA29-4F42-8643-3CEE941799D1"
            }
        ]
    }
}