| 29 | == Individual Routines == |
| 30 | === BSDX07 (Make appointment) === |
| 31 | Workflow: |
| 32 | * Lock node by patient ID |
| 33 | * Check if appointment can be stored in PIMS if applicable (i.e. if this is a linked resource) |
| 34 | * File data into ^BSDXAPPT - on failure, nothing to rollback |
| 35 | * File word processing field - no error checking is done here (easy to detect by end users if they lose data) |
| 36 | * If applicable, uncancel existing appointment in file 2 (rollback: delete everything) |
| 37 | * OR Add a new appointment to file 2 (rollback: delete everything) |
| 38 | * Add the appointment time to file 44 appointment subfile (rollback: delete everything) |
| 39 | * Add the patient to the file 44 patient subsubfile under the appointment subfile. (rollback: delete everything) |
| 40 | * Update availablities (global sets only) |
| 41 | * Call event driver |
| 42 | |
| 43 | Rollback strategy: Difficult because of all the different possible failure points. Delete all appointments from all files. |
| 44 | |
| 45 | M Error handling: Delete all appointments where possible. |
| 46 | |
| 47 | Limitations of Rollback: |
| 48 | If the patient has a previous appointment in 2 and an error happens in storing the new appointments, the old appointment is deleted. From $$UNMAKE^BSDXAPI: |
| 49 | {{{ |
| 50 | ; TODO: If Patient Appointment previously existed as cancelled, it's removed. |
| 51 | ; How can I tell if one previously existed when data is in an intermediate |
| 52 | ; State? Can I restore it if the other file failed? Restoration can cause |
| 53 | ; another error. If I restore the global, there will be cross-references |
| 54 | ; missing (ASDCN specifically). |
| 55 | }}} |
| 56 | === BSDX08 (Cancel appointment) === |
| 57 | Workflow: |
| 58 | * Lock appointment |
| 59 | * Check if appointment can be cancelled in PIMS |
| 60 | * Add cancellation data in ^BSDXAPPT (rollback: none needed on failure) |
| 61 | * Cancel appointment in 2 (rollback: remove cancellation data) |
| 62 | * Delete appointment in 44 (no error detection as Fileman is not expected to fail) |
| 63 | * Update availabilities (Global sets only) |
| 64 | * Call event driver (point of no return) |
| 65 | |
| 66 | Rollback strategy: it's easier than BSDX07 because there is only one point at which we can fail after we put data into the system. Rollback removes cancellation data from ^BSDXAPPT. |
| 67 | |
| 68 | M Error Handling: Same as rollback. |
| 69 | |
| 70 | Limitations of Rollback: If an M error occurs in the event driver, I do not uncancel in file 2 and restore the entry in file 44. |
| 71 | == Unit Test Routines == |
| 72 | |
| 73 | == Other Enhancements == |
| 74 | |
| 75 | == TODO == |