geekmdtravis / fluent-cerner-js

MIT License
1 stars 4 forks source link

Implement support for PowerPlans via the DiscernObjectFactory:POWERORDERS COM object #69

Closed geekmdtravis closed 10 months ago

geekmdtravis commented 1 year ago

Task List

Power plans can be placed using this COM object and should be supported in the library.

POWERORDERS

geekmdtravis commented 1 year ago

@dl2github - We'll definitely need to explore implementation options before starting. Specifically comparing the functionality of MPAGE_EVENTS:ORDERS and DiscernObjectFactor:ORDERS to determine which function to use, when, and how to modify the return types, plus how many functions might be needed (e.g. submitOrders and submitPowerPlan or just submitOrders).

dl2github commented 1 year ago

@geekmdtravis Reviewed & added consolidated documentation below for MPAGES_EVENT - Orders, DiscernObjectFactory - Orders, and DiscernObjectFactory - PowerOrders.

MPAGES_EVENT - ORDERS https://wiki.cerner.com/display/public/MPDEVWIKI/MPAGES_EVENT+-+ORDERS

Parameters:

person ID - the person ID of the patient to display the MOEW for

encounter ID - the encounter ID of the patient to display the MOEW for

order list - a list (sets) of orders that will have action taken upon them

order action - many order actions are available:
    - activate order
    - cancel/discontinue order
    - cancel/reorder order
    - clear order
    - convert to inpatient order
    - convert non-prescription to prescription order
    - modify order
    - new order
    - renew non-prescription order
    - renew prescription order
    - repeat order
    - resume order
    - suspender order

* each order action should be associated with:
    - order id (if an existing order)
    - synonym ID (if a new order)
    - order origination (normal, prescription, or satellite)
    - order sentence id (if a new order)
    - nomenclature id (if new order), optional
    - sign time interaction flag (boolean)

customization flags (defines the style of the MOEW that opens)

tab list (customization data for the MOEW tabs), containing: the tab (2 for order list, 3 for medication list) and display flags (default = 127)

default display (default MOEW view to be displayed)

silent sign flag (boolean)



Discern Object Factory - PowerOrders https://wiki.cerner.com/display/public/MPDEVWIKI/POWERORDERS

Methods:

CreateMOEW

    Creates the MOEW handle, must be called before any of these other methods can be called.

    Parameters
        person ID = patient person ID
        encounter ID = patient encounter ID
        customize flag
            1 = allows sign later
            2 = actionable MOEW
            4 = read-only MOEW
            8 = allow Power Plan order entry
            16 = view documentation in plan
            32 = allow only inpatient & ambulatory venue ordering
            64 = not used
            128 = show MOEW banner bar
            256 = perform action on only documented medications
            512 = hide medication reconciliation controls
            1024 = disables edit-on-line mode
            2048 = hides demographics banner
            4096 = turns on prescription indicator on default filter
            8192 = don't auto invoke order search
            16384 = enable regimens

        dwTabFlag 
            2 = customizes order list
            3 = customizes medication list

        dwTabDisplayOptionsFlag
            1 = show order navigator tree control
            2 = show diagnoses/problem control
            4 = show related results control
            8 = show order search (required if adding orders)
            16 = show order profile
            32 = show order scratchpad (required if adding orders)
            64 = show order detail control (required if taking action on an order)
            128 = view plan entry only
            256 = view formulary list details

DestroyMOEW

    Destroys the MOEW. Must always be called when done with the MOEW handle.

    Parameters
        IMOEWHandle = handle to modal window

InvokeCancelDCAction

    Cancel/discontinues an order.

    Parameters
        IMOEWHandle = handle to modal window
        dOrderId = order ID
        cancelDCDateTimeBstr = the time for the cancel/DC to take effect
        dCancelDCReasonCd = the code value from the cancel/DC reason codeset

    Return
        BOOL = true if successful, false otherwise

InvokeRenewAction

    Renews a prescription or historical order.

    Parameters
        IMOEWHandle = handle to modal window
        dOrderId = order ID
        IDuration = value for duration of order
        dDurationUnitCD = the code value for the duration unit (use codeset 54)
        IDispenseDuration = the value for the dispense duration order detail
        dDispenseDurationUnitCd = the codevalue for dispense duration unit (use codeset 54)
        INbrRefills = the value for number of refills
        dDispenseQty = the value for the dispense quantity
        dDispenseQtyUnitCd = the code value for dispense quantity unit (use codset 54)
        bApplyDefaultRouting = if true, applies default routing to the new order

    Return
        BOOL = true if successful, false otherwise

InvokeCompleteAction

    Completes an action on a specified order.

    Parameters
        IMOEWHandle = handle to modal window
        dOrderId = order ID

    Return
        BOOL = true if successful, false otherwise

GetDefaultRoutingDisplay

    Returns the name of the default prescription routing for a given patient/encounter.

    Parameters
        IMOEWHandle = handle to modal window

GetAvailableOrderActions

    Returns a bitmask of the available actions that can be taken on the provided order.

    Parameters
        IMOEWHandle = handle to modal window
        dOrderId = the order ID to obtain available actions on

    Return
        DWORD = bitmask, for comparison of:
            CancelDCAvail = 1
            ModifyAvail = 2
            ActivateAvail = 4
            CosignAvail = 8
            ReviewAvail = 16
            RepeatAvail = 32
            PrepAvail = 64
            CommentsAvail = 128
            IngredAvail = 256
            SuspendAvail = 512
            ResumeAvail = 1024
            RenewAvail = 2048
            ReferenceAvail = 4096
            InfoAvail = 8192
            RemoveAvail = 16384
            CompleteAvail = 32768
            MedRequestAvail = 65536
            RescheduleAvail = 131072
            TransferCancelAvail = 262144
            VoidAvail = 524288
            ClearAvail = 1048576
            ReorderAvail = 2097152
            GiveWithAvail = 4194304
            UnLinkAvail = 8388608
            TCRewriteAvail = 16777216
            RenewRxAvail = 33554432
            ConvertInpatientAvail = 67108864
            ConvertRxAvail = 134217728
            AllActions = MAXDWORD

SignOrders

    Attempts to silent sign the scratchpad order(s). If not able to, the modal window will be displayed.

    Parameters
        IMOEWHandle = handle to modal window

DisplayMOEW

    Displays the MOEW.

    Parameters
        IMOEWHandle = handle to modal window

GetXMLOrdersMOEW

    Retrieves the XML information pertaining to the order information signed during the *previous* MOEW invocation. 

    Parameters
        IMOEWHandle = handle to modal window

GetConsolidatedRoutingOptions

    Returns a list of of prescription routing options.

    Parameters
        IMOEWHandle = handle to modal window
        catalogCdsBstr = a list of catalog codes to load the routing options for (passed as semicolin-delimited string)

    Return
        String = JSON string representing consolidated list of routing options

InvokeRenewActionWithRouting

    Renews a historical order on a prescription or historical order (with specified routing).

    Parameters
        IMOEWHandle = handle to modal window
        dOrderId = order ID
        IDuration = value for duration of order
        dDurationUnitCD = the code value for the duration unit (use codeset 54)
        IDispenseDuration = the value for the dispense duration order detail
        dDispenseDurationUnitCd = the codevalue for dispense duration unit (use codeset 54)
        INbrRefills = the value for number of refills
        dDispenseQty = the value for the dispense quantity
        dDispenseQtyUnitCd = the code value for dispense quantity unit (use codset 54)
        dRouteMeaningId = the meaning ID for routing field (options returned from `GetConsolidatedRoutingList`)
        dOeFieldValue = the value specific to the above parameter
        oeFieldDisplayValueBstr = the routing field display value specific to the given dRouteMeaningId (returned from `GetConsolidatedRoutingList`)

    Return
        BOOL = true if successful, false otherwise

AddPowerPlanMOEW

    Creates a `Powerplan` object from a pathway catalog ID (or from a customized plan favorite ID).

    Parameters
        IMOEWHandle = handle to modal window
        dPathwayCatalogId = the pathway catalog id for the PowerPlan to be created from
        dPersonalizedPlanId = the customized plan id of the PowerPlan to be created from

    Return
        BOOL = true if successful, false otherwise

InvokeResolveActionMOEW

    Takes a resolve action on an incomplete inpatient medication order.

    Parameters
        IMOEWHandle = handle to modal window
        dOrderId = order ID

    Return
        BOOL = true if successful, false otherwise

AddPowerPlanWithDetails

    Creates a `Powerplan` object with additional details, such as diagnosis.

    Parameters
        IMOEWHandle = handle to modal window
        planDetailsXMLBstr = XML string containing the plan IDs, diagnoses, and other specifics

    Return
        BOOL = true if successful, false otherwise



Discern Object Factory - Orders https://wiki.cerner.com/display/public/MPDEVWIKI/ORDERS

Methods that launch win32 order components

LaunchOrdersMode
    invokes the launching of specific order components

    eMode 
        0: includes view order list, view all lists, actionable MOEW, and allows power plan orders
        1: includes view medication list, view all lists, and actionable MOEW
        2: includes view order reconciliaton list, view list profiles & details, view rubber band list, view search, and view scratchpad

    bDisplaySearchWind
        0: view list profile
        1: view list search

PersonId
    the person ID of the patient

EncntrId
    the encounter ID of the patient

defaultVenue
    default venue when doing a new order during mediciation reconciliation

reconciliationMode
    0 = reconciliation unknown
    1 = admission
    2 = transfer
    3 = discharge
    4 = short term leave
    5 = short term return
geekmdtravis commented 1 year ago

This is great @dl2github! I think another useful way of breaking this down would be a comparison table. For example:

Function MPAGES_EVENT DiscernObjectFactory
Repeat (copy) Order -
New Order

Etc.

I believe we'll eventually need to support both order pathways, but I believe it's likely to be best to have an API that abstracts away some of the more tedious facets of the native Discern functions and COM Objects and simply provides functionality. In that case, we'll have to choose between MPAGES_EVENT:ORDERS and DiscernObjectFactor:POWERORDERS to perform certain tasks.

dl2github commented 1 year ago

@geekmdtravis Great call, thank you! Updated format below:

Order Actions MPAGES_EVENT DiscernObjectFactory
Add Diagnoses to Order
Add Powerplan Orders
Activate Order
Cancel/Discontinue Order ;
Cancel/Reorder Order
Cancel/Transfer Order
Clear Order
Complete Order
Convert to Inpatient Order
Convert to Prescription Order
Copy Order
Cosign Order
Give With Order
Modify Order
New Order
Obtain Order Comments
Obtain Order Ingredients
Obtain Order Reference & Information
Renew Non-Prescription Order
Renew Prescription Order
Reschedule Order
Resolve or Remove Order
Resume Order
Retrieve XML Order Information
Suspend Order
Unlink Order
Void Order
geekmdtravis commented 1 year ago

@dl2github - added comments. Also, some of these actions appear in the available order actions return, but don't actually seem to have an implementation. So, I think we need to prune this list and/or direct some question to UCern.

Actions MPAGES_EVENT DiscernObjectFactory Comments
Add Diagnoses to Order Can add diagnoses with orders in MPAGES_EVENT, and DOF adds to to orders that are already placed. So, these effectively do two separate things.
Add Powerplan Orders
Activate Order
Cancel/Discontinue Order
Cancel/Reorder Order
Cancel/Transfer Order What does this do?
Clear Order
Complete Order Is this for a proposed order?
Convert to Inpatient Order
Convert to Prescription Order What does this do?
Copy Order Very important functionality!
Cosign Order How does this differ from complete?
Give With Order What does this do?
Modify Order Does this actually work?
New Order Very important functionality.
Obtain Order Comments Cool utility!
Obtain Order Ingredients Cool utility!
Obtain Order Reference & Information What does this do?
Renew Non-Prescription Order How does this differ from Rx orders?
Renew Prescription Order How does this differ from non-Rx orders?
Reschedule Order What does this do?
Resolve or Remove Order From scratchpad?
Resume Order
Retrieve XML Order Information Guessing this is similar to the MPAGES_EVENT return value, but need to check.
Suspend Order
Unlink Order What does this do?
Void Order How does this differ from cancel/discontinue?
GetConsolidatedRouting How would we actually route orders to a pharmacy?
GetDefaultRoutingDisplay How would we actually route orders to a pharmacy?
geekmdtravis commented 1 year ago

@dl2github - I think we need to create a more direct mapping of actions between the two pathways to order management. Please see the example below.

Action MPAGES_EVENT DiscernObjectFactory Comments
Copy and reorder REPEAT
Cancel and discontinue CANCEL DC InvokeCancelDCAction
Renew RENEW InvokeRenewAction May not work in our implementation PowerChart, need to test
dl2github commented 1 year ago

@geekmdtravis Agreed, great idea! Updated table below:

Action MPAGES_EVENT DiscernObjectFactory Comments
Activate order ACTIVATE
Add Diagnosis to Order Can use ORDER AddDiagnosisToOrder MPAGES_EVENT may only be capable of adding a diagnosis to a new order
Add Power Plan AddPowerPlanMOEW or AddPowerPlanWithDetails
Cancel and discontinue CANCEL DC InvokeCancelDCAction
Clear CLEAR
Complete Order InvokeCompleteAction
Convert to Inpatient CONVERT_INPAT
Convert to Prescription CONVERT_RX
Copy and reorder REPEAT
Create/Display MOEW Can use ORDER CreateMOEW & DisplayMOEW Submitting an "empty" order in MPAGES_EVENT will display a MOEW. If using DiscernObjectFactory, will also need to call DestroyMOEW when done.
Get Available Order Actions GetAvailableOrderActions Currently investigating how many of these can actually be used
Get Consolidated Routing Options GetConsolidatedRoutingOptions
Get Default Routing Display GetDefaultRoutingDisplay
Get Scratchpad Orders GetScratchPadOrders
Get MOEW XML Orders GetXMLOrdersMOEW
Modify MODIFY
New Order ORDER AddNewOrder(s)ToScratchPad
Remove Order From Scratchpad RemoveOrderFromScratchPad Can modify order array in MPAGES_EVENT to determine what appears in scratchpad
Renew Non-prescription RENEW InvokeRenewAction May not work in our implementation of PowerChart, need to test
Renew Prescription RENEW_RX InvokeRenewAction May not work in our implementation of PowerChart, need to test
Resolve Order InvokeResolveActionMOEW
Resume Suspended Order RESUME
See If Scratchpad is Empty IsScratchPadEmptyMOEW Can check order array length in MPAGES_EVENT for comparable functionality
Silent Sign Can use ORDER SignOrders
Suspend Order SUSPEND
geekmdtravis commented 1 year ago

@dl2github - This looks great, thanks. Looking things over, I'm getting the impression we can still use MPAGES_EVENT for placing/modifying/cancelling orders without any real loss of functionality when compared to DiscernObjectFactory. The auxillary/utility functions in DiscernObjectFactory are likely all still useful though. How do you feel about that?

With respect to Power Orders, it seems we only have one real choice with the DiscernObjectFactory, but I don't see the need to wrap more than one underlying Cerner method. I think the AddPowerPlanWithDetails is the only one that needs to be wrapped.

So, perhaps:

  1. Implement a Power Plan tool by wrapping AddPowerPlanWithDetails.
  2. Implement tools for auxillary functions, e.g. GetXMLOrdersMOEW.
  3. Review the current submitOrdersAsync tooling which uses MPAGES_EVENT to see if we need to make any changes.
dl2github commented 1 year ago

@geekmdtravis I completely agree. I think that, while there are some minor functions unique to DiscernObjectFactory, the use cases seem to be fairly limited other than Power Plans. I think adding Power Plans to fluent-cerner-js makes the most sense for now. I imagine it will still take some trial/error to see how it works with standalone orders -- DiscernObjectFactory Power Plan additions and standalone orders may not be compatible with simultaneous use of MPAGE_EVENT orders, but I'll look into that further, as well. Thank you!

geekmdtravis commented 1 year ago

@dl2github - Perfect. Then, if you can pick it up, let's have you lead the development of an async function that creates Power Plans, plus any requisite accessory functions, types, etc. Please keep me involved with API design.

geekmdtravis commented 1 year ago

@dl2github - an important note if you haven't picked up on it already. To properly implement the DiscernObjectFactory in the TypeScript environment, you'll need to update the global type definitiondeclared insrc/index.ts`.

dl2github commented 1 year ago

@dl2github - an important note if you haven't picked up on it already. To properly implement the DiscernObjectFactory in the TypeScript environment, you'll need to update the global type definitiondeclared insrc/index.ts`.

Perfect, thank you!

geekmdtravis commented 10 months ago

Merged into dev.