You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With next iteration of the development process, I’ve discovered things that can be improved.
Right now we are assembly any CRUD tables using crud_assembly functions from the adminui-crud.js. We cannot edit this function so when we need to add filtering by the patient_id we need to override hook retrieveRecordSummary , copy/paste whole code what is make re-render of the DataTable when data is retrieved and add only 5 new lines:
if (context.selectedPatient ) {
if (context.selectedPatient.id !== record.patient_id) {
return true; // SKIP BY FILTER
}
}
For save hook situation are the same: if patient are selected we must add «patient_id» automatically so what we can do:
We are override save hook inside of adminui-button and put thee new lines. Whole code with save process must be copy/pasted from the adminui-crud.js:
if (_this.context.selectedPatient) {
params.patient_id = _this.context.selectedPatient.id;
}
You can see this on www/pt-wc-q/js/extended/events.js file what is sended to PR
But this way looks very bad: each CRUD what placed inside of the exists platform: vitals, events, medications, adverse_events need be extended with this copy/paste code.
Every time we are calling QEWD.reply to send queries inside of JSDB.
My suggestion is to provide callback wrapper based on middleware patterns for preprocess data. On architecture basics that will look like:
[Server] <-> [QEWD.reply <-> filters chain callbacks with data processing <-> reply promise resolve ] -> Send filtered and processed data outside to hooks
Middleware QEWD response can be attached in app.js like we attach context things now. That will provide to us solution that can extend behaviour of data communications without changing lot files. Only by one function.
The text was updated successfully, but these errors were encountered:
With next iteration of the development process, I’ve discovered things that can be improved.
Right now we are assembly any CRUD tables using crud_assembly functions from the adminui-crud.js. We cannot edit this function so when we need to add filtering by the patient_id we need to override hook retrieveRecordSummary , copy/paste whole code what is make re-render of the DataTable when data is retrieved and add only 5 new lines:
For save hook situation are the same: if patient are selected we must add «patient_id» automatically so what we can do:
We are override save hook inside of adminui-button and put thee new lines. Whole code with save process must be copy/pasted from the adminui-crud.js:
You can see this on www/pt-wc-q/js/extended/events.js file what is sended to PR
But this way looks very bad: each CRUD what placed inside of the exists platform: vitals, events, medications, adverse_events need be extended with this copy/paste code.
Every time we are calling QEWD.reply to send queries inside of JSDB.
My suggestion is to provide callback wrapper based on middleware patterns for preprocess data. On architecture basics that will look like:
[Server] <-> [QEWD.reply <-> filters chain callbacks with data processing <-> reply promise resolve ] -> Send filtered and processed data outside to hooks
Middleware QEWD response can be attached in app.js like we attach context things now. That will provide to us solution that can extend behaviour of data communications without changing lot files. Only by one function.
The text was updated successfully, but these errors were encountered: