Beispiel #1
0
def layout():
    # load data for display
    orders_history_data = chart_utils.get_loaded_data("VW_ORDERS_HISTORY_FULL", "DATASET")
    remove_cols = ['BRANCH', 'COLUMN_MAPPING', 'COLUMN_PARAMETERS']
    type_arr = chart_utils.get_options(orders_history_data, "TYPE")
    physician_arr = chart_utils.get_options(orders_history_data, "PHYSICIAN")
    patient_arr = chart_utils.get_options(orders_history_data, "TYPE")
    remove_cols = ['BRANCH', 'PAYOR', 'INTERNAL_REFERRAL_SOURCE',]
    max_date = datetime.now()
    pending_df = orders_history_data.loc[
        orders_history_data["DATA_SOURCE_ARRAY"].str.contains(r'ORDERSPENDINGMDS', na=True)]
    history_df = orders_history_data.loc[
        orders_history_data["DATA_SOURCE_ARRAY"].str.contains(r'ORDERSHISTORY', na=True)]
    tbs_df = orders_history_data.loc[
        orders_history_data["DATA_SOURCE_ARRAY"].str.contains(r'ORDERSTOBESENT', na=True)]

    children = html.Div(
        [
            ddk.Row(
                [
                    ddk.DataCard(
                        id='orders_tobe_sent_count',
                        value=tbs_df.shape[0],
                        label = 'To Be Sent'
                    ),
                    ddk.DataCard(
                        id='orders_pending_mds_count',
                        value=pending_df.shape[0] ,
                        label='Pending MD Signature'
                    ),
                    ddk.DataCard(
                        id='orders_history_count',
                        value=history_df.shape[0] ,
                        label='Total Orders'
                    ),
                ]
            ),
            ddk.Row(
                [
                    ddk.ControlCard(
                        [
                            html.Details(
                                [
                                    html.Summary("About this app"),
                                    html.P(
                                        """Select attributes to fine tune graphs and tables."""
                                    ),
                                ]
                            ),
                            ddk.ControlItem(
                                dcc.Dropdown(

                                    options=type_arr,
                                    multi=True,
                                    placeholder="Select Type",
                                    id="orders-type-selector"
                                    # value=["Not Yet Started", "Saved"],
                                )
                            ),
                            ddk.ControlItem(
                                dcc.Dropdown(
                                    options=physician_arr,
                                    multi=True,
                                    placeholder="Select Physician",
                                    id="orders-physician-selector"
                                    # value=["Not Yet Started", "Saved"],
                                )
                            ),
                            ddk.ControlItem(
                                dcc.Dropdown(
                                    options=patient_arr,
                                    multi=True,
                                    placeholder="Select Patient",
                                    id="orders-patient-selector"
                                    # value=["Not Yet Started", "Saved"],
                                )
                            ),
                            ddk.ControlItem(
                                dcc.DatePickerRange(
                                    id="orders-date-picker",
                                    min_date_allowed=pd.to_datetime(
                                        orders_history_data["ORDER_DATE"].min()
                                    ),
                                    max_date_allowed=max_date,
                                    initial_visible_month=max_date,
                                    start_date=max_date - timedelta(days=700),
                                    end_date=max_date,
                                ),
                            ),
                            ddk.ControlItem(
                                html.Button(
                                    id="orders-select-all-rows",
                                    children="Select all matching records",
                                    style={"margin": "auto"},
                                    n_clicks=0,
                                )
                            ),
                        ],
                        width=25,
                        style={"overflow": "scroll"},
                    ),
                    ddk.Card(
                        width=75,
                        children=[
                            ddk.CardHeader(
                                children=[
                                    html.Div(
                                        "Combined Orders View", style={"float": "left"},
                                    ),

                                ]
                            ),
                            ddk.Block(
                                ddk.DataTable(
                                    columns=[
                                        {"name": i.replace("_", " ").title(), "id": i}
                                        for i in orders_history_data.columns if (i not in remove_cols)
                                    ],
                                    data=orders_history_data.sort_values(by="PHYSICIAN").to_dict("records"),
                                    filter_action="native",
                                    page_action="native",
                                    page_size=50,
                                    row_selectable="multi",
                                    id="orders-history-data-table",
                                    style_cell={'fontSize': 12, 'font-family': 'sans-serif'},
                                    style_table = {'overflowX': 'auto'},
                                ),
                                style={"overflow": "scroll"}
                            ),
                        ]
                    ),
                ]

            ),

        ]
    )
    return children
Beispiel #2
0
                style_cell={
                    'fontSize': 12,
                    'font-family': 'sans-serif'
                },
                style_table={'overflowX': 'auto'},
            ),
                      style={"overflow": "scroll"}),
        ]),
    ])
    return children


if __name__ == "__main__":
    redis_instance = redis.StrictRedis.from_url(
        os.environ.get("REDIS_URL", "redis://127.0.0.1:6379"))
    arrfreport = chart_utils.get_loaded_data("AR_ROLL_FORWARD_REPORT",
                                             "DATASET")
    vw_bc_rap = chart_utils.get_loaded_data("VW_BILLINGCENTER_RAP", "DATASET")
    vw_bc_fin = chart_utils.get_loaded_data("VW_BILLINGCENTER_FINAL",
                                            "DATASET")
    ub_billing_per = chart_utils.get_loaded_data("UNBILLED_BILLING_PERIODS",
                                                 "DATASET")
    unbilled_rev = chart_utils.get_loaded_data("UNBILLED_REVENUE", "DATASET")
    unbilled_man_claims = chart_utils.get_loaded_data(
        "UNBILLED_MANAGED_CLAIMS", "DATASET")
    billing_batch_rep = chart_utils.get_loaded_data("BILLING_BATCH_REPORT",
                                                    "DATASET")

    patient_status_arr = chart_utils.get_options(arrfreport, "PATIENT_STATUS")
    # discipline_arr = chart_utils.get_options(authorizations_data, "DISCIPLINE")
    # auth_type_arr = chart_utils.get_options(authorizations_data, "AUTHORIZATION_TYPE")
    payor_arr = chart_utils.get_options(arrfreport, "PAYOR")
def submit_request(
    n_clicks,
    new_assignee,
    new_status,
    new_comment,
    selected_patient,
    selected_task,
    selected_date,
):
    """
    Interprets rows input and performs an action on the database by manipulating
    the existing rows and attaching a new status, new assignee, and new comment.
    """
    if n_clicks:
        if not new_assignee and new_status:
            return dcc.Markdown("*INVALID: No inputs provided.*")
        elif not new_assignee:
            return dcc.Markdown("*INVALID: Input a new assignee.*")
        elif not new_status:
            return dcc.Markdown("*INVALID: Input a new status.*")

        if selected_patient:
            data = chart_utils.get_loaded_data(
                "SCHEDULEREPORTS_VISITSBYSTATUS", "DATASET")
            selected_rows = data.loc[
                (data["PATIENT"] == selected_patient)
                & (data["SCHEDULED_DATE"] == selected_date)
                & (data["TASK"] == selected_task)].to_dict("records")
        else:
            # The selected rows to perform an operation on are loaded in as retask-cords from Redis.
            selected_rows = json.loads(
                redis_instance.hget("selected_rows", "DATASET"))

        #print(selected_rows)
        username = dash_enterprise_auth.get_username()
        userdata = dash_enterprise_auth.get_user_data()

        object_name = "SCHEDULEREPORTS_VISITSBYSTATUS"
        # register the object - This automatically updates if object exists, else inserts
        #
        object_data = {
            'object_name':
            object_name,
            'description':
            'Contains information about patients visits status and associated tasks',
            'schema_name':
            'hnts',
            'table_name':
            'schedulereports_visitsbystatus',
            'business_key_cols': [
                "BRANCH", "PAYOR", "MRN", "PATIENT", "SCHEDULED_DATE", "TASK",
                "ASSIGNED_TO", "STATUS"
            ]
        }
        ai_rows = []
        for record in selected_rows:
            curr_record = {}
            curr_record['data'] = record
            curr_record['assignee'] = new_assignee
            curr_record['status_code'] = 'ASSIGNED'
            curr_record['comments'] = new_comment
            curr_record[
                'reported_by'] = username if username else 'Eduardo Guimbarda'
            ai_rows.append(curr_record)

        chart_utils.update_data(object_data, ai_rows)

        return dcc.Markdown("*Action successfully completed.*")
Beispiel #4
0
def layout():
    # load data for display
    episodicdata = chart_utils.get_loaded_data("AXXESS_API.RAW.MEDICARE_MCRADV_VISITPLANNING_NOAUTH", "DATASET")
    pervisitdata = chart_utils.get_loaded_data("AXXESS_API.RAW.MANAGEDCARE_VISITPLANNING_NOAUTH", "DATASET")
    currentepisodic = chart_utils.get_loaded_data("AXXESS_API.RAW.VW_MEDICARE_MCRADV_VISITPLANNING_CURRENT_EPISODES","DATASET")
    lupa_riskdata = chart_utils.get_loaded_data("AXXESS_API.RAW.VW_MEDICARE_MCRADV_LUPA_RISK", "DATASET")

   

    #reorder the columns

    '''
    new_order = ['INS_CODE',
                 'INITIAL_TIMELY_FILING',
                 'MRN',
                 'PATIENT',
                 'PATIENT_STATUS',
                 'DATE_OF_BIRTH',
                 'EPISODE_START_DATE',
                 'EPISODE_END_DATE',
                 'PHYSICIAN_NAME',
                 'PHYSICIAN_PHONE',
                 'PHYSICIAN_FACSIMILE',
                 'ORDERS_DETAILS',
                 'CONSOLIDATED_COMMENTS',
                 'COLOR',
                 'USER_UPDATE_DATE',
                 'NEW_COMMENTS',
                 'EPISODE_UNEARNED_AMOUNT',
                 'EPISODE_EARNED_AMOUNT',
                 'EPISODE_BILLED_AMOUNT',
                 'EPISODE_ADJUSTMENTS'
                 ]
    '''



    gl_mrn_arr = chart_utils.get_options(episodicdata, "MRN")
    gl_ins_code_arr = chart_utils.get_options(episodicdata, "INS_CODE")
    gl_patient_arr = chart_utils.get_options(episodicdata, "PATIENT")
    gl_patient_status_arr = chart_utils.get_options(episodicdata, "PATIENT_STATUS")
    gl_pcc_arr = chart_utils.get_options(currentepisodic, "CASE_MANAGER_NAME")
    gl_lupa_risk_arr = chart_utils.get_options(currentepisodic, "LUPA_RISK")

    remove_cols = ['INS_CODE', 'OASIS_STATUS', 'OASIS_DETAILS', 'EPISODE_PRIMARY_INSURANCE_NAME', 'DATE_OF_BIRTH',
                   'PHONE','PHYSICIAN_FACSIMILE', 'PHYSICIAN_NAME', 'PHYSICIAN_PHONE', 'ZIP', 'ORDERS_STATUS', 'ORDERS_DETAILS',
                   'EARLY_LUPA_RISK', 'LATE_LUPA_RISK', 'EARLY_ORIGINAL_PROSPECTIVE_PAY',
                   'LATE_ORIGINAL_PROSPECTIVE_PAY', 'TOTAL_COST', 'TOTAL_PROFIT', 'EARLY_COST', 'EARLY_PROFIT',
                   'LATE_COST', 'LATE_PROFIT', 'EPISODE_BILLED_AMOUNT', 'EPISODE_ADJUSTMENTS', 'EPISODE_EARNED_AMOUNT',
                   'EPISODE_UNEARNED_AMOUNT',    'SCHEDULE_ACTIVE',    'COMPLETED_VISITS',    'TOTAL_VISITS' ,   'TOTAL_BILLABLE_HHA_VISITS'
                   ]
    max_date = pd.to_datetime(episodicdata['EPISODE_END_DATE']).max()
    today = dt.now().date()
    sixtydaysprior = today
    sixtydaysprior += datetime.timedelta(days=-60)
    #min_date = pd.to_datetime(episodicdata['EPISODE_END_DATE']).min()


    children = html.Div([

        # block on the right
        ddk.Block(
            width=100,
            children=[
                ddk.Row([
                    ddk.Block(
                        children=[
                            ddk.ControlCard(
                                orientation='horizontal',
                                width = 100,
                                children=[

                                    ddk.ControlItem(
                                        dcc.Dropdown(

                                            options=gl_ins_code_arr,
                                            multi=True,
                                            placeholder="Select",
                                            id="vp-ins-code-selector",
                                            # value=["Not Yet Started", "Saved"],
                                            style = {
                                                'fontSize': 12,
                                                'font-family': 'sans-serif',
                                            }
                                        ),
                                        width = 10,
                                        label='Billing Code',
                                        style={
                                            'fontSize': 12,
                                            'font-family': 'sans-serif',
                                        }
                                    ),
                                    ddk.ControlItem(
                                        dcc.Dropdown(

                                            options=gl_patient_arr,
                                            multi=True,
                                            placeholder="Select",
                                            id="vp-patient-selector",
                                            style = {
                                                'fontSize': 12,
                                                'font-family': 'sans-serif',
                                            }
                                        ),
                                        width=10,
                                        label='Patient',
                                        label_text_alignment='center',
                                        style={
                                            'fontSize': 12,
                                            'font-family': 'sans-serif',
                                        }
                                    ),
                                    ddk.ControlItem(
                                        dcc.Dropdown(

                                            options=gl_mrn_arr,
                                            multi=True,
                                            placeholder="Select",
                                            id="vp-mrn-selector",
                                            style={
                                                'fontSize': 12,
                                                'font-family': 'sans-serif',
                                            }

                                        ),
                                        width =10,
                                        label='MRN',
                                        label_text_alignment='center',
                                        style={
                                            'fontSize': 12,
                                            'font-family': 'sans-serif',
                                        }
                                    ),
                                    ddk.ControlItem(
                                        dcc.Dropdown(

                                            options=gl_patient_status_arr,
                                            id="vp-patient-status-selector",
                                            multi=True,
                                            placeholder="Select",
                                            value=['Active'],
                                            style={
                                                'fontSize': 12,
                                                'font-family': 'sans-serif',
                                            }

                                        ),
                                        width = 10,
                                        label = 'Patient Status',
                                        label_text_alignment='center',
                                        style={
                                            'fontSize': 12,
                                            'font-family': 'sans-serif',
                                        }
                                    ),
                                    ddk.ControlItem(
                                        dcc.Slider(
                                            id='vp-margin-slider',
                                            min=-50,
                                            max=100,
                                            step=10,
                                            marks={-50: '-50',
                                                   -40: '-40',
                                                   -20: '-20',
                                                   -10: '-10',
                                                   0: '0',
                                                   10: '10',
                                                   20: '20',
                                                   40: '40',
                                                   60: '60',
                                                   80: '80',
                                                   100: '100',
                                                   },
                                            value=20,
                                        ),
                                        width = 20,
                                        label='Margin (%)',
                                        label_text_alignment='center',
                                        style={
                                            'fontSize': 12,
                                            'font-family': 'sans-serif',
                                        }
                                    ),
                                    ddk.ControlItem(
                                        dcc.Dropdown(

                                            options=gl_pcc_arr,
                                            multi=True,
                                            placeholder="select",
                                            id="vp-case-manager-selector",
                                            style={
                                                'fontSize': 12,
                                                'font-family': 'sans-serif',
                                            }
                                        ),
                                        width=10,
                                        label='Case Manager',
                                        label_text_alignment= 'center',
                                        style={
                                            'fontSize': 12,
                                            'font-family': 'sans-serif',
                                        }
                                    ),
                                    ddk.ControlItem(
                                        dcc.DatePickerRange(
                                            id="vp-episode-picker",
                                            min_date_allowed=pd.to_datetime(episodicdata['EPISODE_START_DATE'].min()
                                            ),
                                            max_date_allowed=max_date,
                                            initial_visible_month=max_date,
                                            start_date=sixtydaysprior,
                                            end_date=max_date
                                        ),
                                        width = 20,
                                        label='Episode Range',
                                        label_text_alignment='center',
                                        style={
                                            'fontSize': 12,
                                            'font-family': 'sans-serif',
                                        }
                                    ),
                                    ddk.ControlItem(
                                        dcc.Dropdown(

                                            options=gl_lupa_risk_arr,
                                            multi=True,
                                            placeholder="select",
                                            id="vp-lupa-risk-selector",
                                            style={
                                                'fontSize': 12,
                                                'font-family': 'sans-serif',
                                            }

                                        ),
                                        width=10,
                                        label='LUPA RISK',
                                        label_text_alignment='center',
                                        style={
                                            'fontSize': 12,
                                            'font-family': 'sans-serif',
                                        }
                                    ),

                                ], )
                        ]
                    ),
                ]),
                ddk.Row([
                    ddk.Card(
                        children=[
                            ddk.CardHeader(
                                title="VISIT PLANNING",
                                children=[
                                    html.Div(
                                        [
                                            ddk.Modal(
                                                id="vp-modal-btn-outer",
                                                children=[
                                                    html.Button(
                                                        id="vp-expand-modal",
                                                        n_clicks=0,
                                                        children="Take action",
                                                    )
                                                ],
                                                target_id="vp-modal-content",
                                                hide_target=True,
                                                style={"float": "right"},
                                            ),
                                            ddk.Block(
                                                id="vp-modal-content",
                                                children=html.Div(id="vp-modal-div"),
                                                style={
                                                    "width": "50%",
                                                    "margin": "auto",
                                                    "overflow": "scroll",
                                                },
                                            ),
                                            ddk.DataCard(
                                                id='vp_episodic_selected_count',
                                                value=currentepisodic.shape[0],
                                                label='Episodic Selected Count',
                                                style={
                                                    'fontSize': 12,
                                                    'font-family': 'sans-serif',
                                                }
                                            ),
                                        ]
                                    ),
                                ],
                            ),
                            ddk.Block(

                                dcc.Tabs(id='tabs-example',
                                         value='tab-1',
                                         children=[
                                                    dcc.Tab(label='EPISODIC',
                                                            children=[generate_table_layout(episodicdata, "","vp_episodic-table", "MRN", remove_cols)]
                                                            ),
                                                    dcc.Tab(label='PERVISIT',
                                                            children=[generate_table_layout(pervisitdata, "","vp_pervisit-table", "MRN", remove_cols)]),
                                         ]
                                         ),

                            )
                            ]
                    ),


                ]),



            ]
        )
    ])

    return children
Beispiel #5
0
def update_charts(selected_mrns,selected_ins_codes, selected_patients,selected_patient_status, selected_pccs, selected_margin, start_date, end_date, selected_lupa_risks):
    # subset data-table data

    data = chart_utils.get_loaded_data("AXXESS_API.RAW.VW_MEDICARE_MCRADV_VISITPLANNING_CURRENT_EPISODES", "DATASET")
    pervisitdata = chart_utils.get_loaded_data("AXXESS_API.RAW.MANAGEDCARE_VISITPLANNING_NOAUTH", "DATASET")

    if start_date:
        pervisitdata = pervisitdata.loc[pervisitdata["EPISODE_START_DATE"] > start_date]
        data = data.loc[data["EPISODE_START_DATE"] > start_date]
    if end_date:
        data = data.loc[data["EPISODE_END_DATE"] < end_date]
        pervisitdata = pervisitdata.loc[pervisitdata["EPISODE_END_DATE"] > start_date]
    if selected_ins_codes:
        try:
            data = data.loc[data["INS_CODE"].isin(selected_ins_codes)]
            pervisitdata = pervisitdata.loc[pervisitdata["INS_CODE"].isin(selected_ins_codes)]

        except (IndexError):
            print('IndexError')
            print(selected_ins_codes)
        except:
            print('Something else went wrong for INS_CODE')
            print(sys.exc_info())
            print(selected_ins_codes)
    if selected_patients:
        try:
            data = data.loc[data["PATIENT"].isin(selected_patients)]
            pervisitdata = pervisitdata.loc[pervisitdata["PATIENT"].isin(selected_patients)]

        except (IndexError):
            print('IndexError')
            print(selected_mrns)
        except:
            print('Something else went wrong for PATIENT')
            print(sys.exc_info())
            print(selected_mrns)
    if selected_pccs:
        try:
            data = data.loc[data["CASE_MANAGER_NAME"].isin(selected_pccs)]
            pervisitdata = pervisitdata.loc[pervisitdata["CASE_MANAGER_NAME"].isin(selected_pccs)]

        except (IndexError):
            print('IndexError')
            print(selected_mrns)
        except:
            print('Something else went wrong for CASE_MANAGER_NAME')
            print(sys.exc_info())
            print(selected_mrns)
    if selected_patient_status:
        try:
            data = data.loc[data["PATIENT_STATUS"].isin(selected_patient_status)]
            pervisitdata = pervisitdata.loc[pervisitdata["PATIENT_STATUS"].isin(selected_patient_status)]
        except (IndexError):
            print('IndexError')
            print(selected_mrns)
        except:
            print('Something else went wrong for PATIENT_STATUS')
            print(sys.exc_info())
            print(selected_mrns)
    if selected_mrns:
        try:
            data = data.loc[data["MRN"].isin(selected_mrns)]
            pervisitdata = pervisitdata.loc[pervisitdata["MRN"].isin(selected_mrns)]


        except (IndexError):
            print('IndexError')
            print(selected_mrns)
        except:
            print('Something else went wrong for MRN')
            print(sys.exc_info())
            print(selected_mrns)
    if selected_lupa_risks:
        try:
            data = data.loc[data["LUPA_RISK"].isin(selected_lupa_risks)]

        except (IndexError):
            print('IndexError')
            print(selected_mrns)
        except:
            print('Something else went wrong for MRN')
            print(sys.exc_info())
            print(selected_mrns)
    data['TOTAL_MARGIN'] = pd.to_numeric(data['TOTAL_MARGIN'].replace('nan','-100'))
    data['EARLY_MARGIN'] = pd.to_numeric(data['EARLY_MARGIN'].replace('nan', '-100'))
    data['LATE_MARGIN'] = pd.to_numeric(data['LATE_MARGIN'].replace('nan', '-100'))
    data['EARLY_LUPA_T'] = pd.to_numeric(data['EARLY_LUPA_T'].replace('nan', ''))
    data['LATE_LUPA_T'] = pd.to_numeric(data['LATE_LUPA_T'].replace('nan', ''))

    if  selected_margin <= 100:
        try:
            data = data[(data["TOTAL_MARGIN"] <= selected_margin) | (data["EARLY_MARGIN"] <=selected_margin) | (data["LATE_MARGIN"]<=selected_margin)]
            print ("total margin <= {} = {}", selected_margin, data[(data["TOTAL_MARGIN"] <= selected_margin)].shape[0])
        except (IndexError):
            print('IndexError')
            print(selected_margin)
        except:
            print('Something else went wrong for MRN')
            print(sys.exc_info())
            print(selected_margin)
    #print(data.dtypes)


    # Apply Formatting to the columns

    data['TOTAL_MARGIN'] = data['TOTAL_MARGIN'].apply(formatter_number)
    data['EARLY_MARGIN'] = data['EARLY_MARGIN'].apply(formatter_number)
    data['LATE_MARGIN'] = data['LATE_MARGIN'].apply(formatter_number)
    data['EARLY_LUPA_T'] = data['EARLY_LUPA_T'].apply(formatter_number)
    data['LATE_LUPA_T'] = data['LATE_LUPA_T'].apply(formatter_number)
    #print(data.dtypes)

    data_table  = data.sort_values(by="MRN").to_dict("records") # data.sort_values(["MRN"], axis=0, ascending=True, inplace=True).to_dict("records")
    data_table2 = pervisitdata.sort_values(by="MRN").to_dict("records") #data #data.sort_values(["MRN"], axis=0, ascending=True, inplace=True).to_dict("records")
    selected_row_count = data.shape[0]
    # update cards

    return [data_table, data_table2, selected_row_count]
def layout():
    # load data for display
    episodesummdata = chart_utils.get_loaded_data(
        "AXXESS_API.USER_INPUTS.VW_PENDING_ORDERS_TF_SIMPLE", "DATASET")

    #reorder the columns
    new_order = [
        'INS_CODE', 'INITIAL_TIMELY_FILING', 'MRN', 'PATIENT',
        'PATIENT_STATUS', 'DATE_OF_BIRTH', 'EPISODE_START_DATE',
        'EPISODE_END_DATE', 'PHYSICIAN_NAME', 'PHYSICIAN_PHONE',
        'PHYSICIAN_FACSIMILE', 'ORDERS_DETAILS', 'CONSOLIDATED_COMMENTS',
        'COLOR', 'USER_UPDATE_DATE', 'NEW_COMMENTS', 'EPISODE_UNEARNED_AMOUNT',
        'EPISODE_EARNED_AMOUNT', 'EPISODE_BILLED_AMOUNT', 'EPISODE_ADJUSTMENTS'
    ]
    episodesummdata = episodesummdata[new_order]

    claimsdetailsdata = chart_utils.get_loaded_data(
        "AXXESS_API.RAW.VW_ALLPAYOR_BILLING_CLAIMS_DETAILS", "DATASET")

    # print(episodesummdata.columns)
    # print(claimsdetailsdata.columns)
    gl_mrn_arr = chart_utils.get_options(episodesummdata, "MRN")
    gl_ins_code_arr = chart_utils.get_options(episodesummdata, "INS_CODE")
    gl_patient_arr = chart_utils.get_options(episodesummdata, "PATIENT")
    gl_patient_status_arr = chart_utils.get_options(episodesummdata,
                                                    "PATIENT_STATUS")

    remove_cols = ['BRANCH', 'COLUMN_MAPPING', 'COLUMN_PARAMETERS']
    max_date = pd.to_datetime(episodesummdata['EPISODE_END_DATE']).max()
    min_date = pd.to_datetime(episodesummdata['EPISODE_END_DATE']).min()

    children = html.Div([

        # block on the right
        ddk.Block(
            width=100,
            children=[
                ddk.Row([
                    ddk.Block(children=[
                        ddk.ControlCard(
                            orientation='horizontal',
                            width=100,
                            children=[
                                html.Details([
                                    html.Summary("Filter here"),
                                    html.
                                    P("""Select attributes to fine tune tables."""
                                      ),
                                ]),
                                ddk.ControlItem(
                                    dcc.Dropdown(
                                        options=gl_ins_code_arr,
                                        multi=True,
                                        placeholder="Select Ins code",
                                        id="op-ins-code-selector"
                                        # value=["Not Yet Started", "Saved"],
                                    )),
                                ddk.ControlItem(
                                    dcc.Dropdown(
                                        options=gl_patient_arr,
                                        multi=True,
                                        placeholder="Select Patient",
                                        id="op-patient-selector"
                                        # value=["Not Yet Started", "Saved"],
                                    )),
                                ddk.ControlItem(
                                    dcc.Dropdown(
                                        options=gl_mrn_arr,
                                        multi=True,
                                        placeholder="Select MRN",
                                        id="op-mrn-selector"
                                        # value=["Not Yet Started", "Saved"],
                                    )),
                                ddk.ControlItem(
                                    dcc.DatePickerRange(
                                        id="op-episode-picker",
                                        min_date_allowed=pd.to_datetime(
                                            episodesummdata[
                                                'EPISODE_START_DATE'].min()),
                                        max_date_allowed=max_date,
                                        initial_visible_month=max_date,
                                        start_date=min_date,
                                        end_date=max_date), ),
                                ddk.ControlItem(
                                    html.Button(
                                        id="op-select-all-rows",
                                        children="Select all matching records",
                                        style={"margin": "auto"},
                                        n_clicks=0,
                                    )),
                            ],
                        )
                    ]),
                ]),
                ddk.Row([
                    ddk.Card(children=[
                        ddk.CardHeader(
                            title="Pending Orders",
                            children=[
                                html.Div([
                                    ddk.Modal(
                                        id="op-modal-btn-outer",
                                        children=[
                                            html.Button(
                                                id="op-expand-modal",
                                                n_clicks=0,
                                                children="Take action",
                                            )
                                        ],
                                        target_id="op-modal-content",
                                        hide_target=True,
                                        style={"float": "right"},
                                    ),
                                    ddk.Block(
                                        id="op-modal-content",
                                        children=html.Div(id="op-modal-div"),
                                        style={
                                            "width": "50%",
                                            "margin": "auto",
                                            "overflow": "scroll",
                                        },
                                    ),
                                ]),
                            ],
                        ),
                        ddk.Block(children=[
                            generate_table_layout(
                                episodesummdata, "PENDING ORDERS",
                                "pending_tf-table", "MRN", remove_cols)
                        ])
                    ]),
                ]),
                ddk.Row([
                    ddk.Block(children=[
                        generate_table_layout(
                            claimsdetailsdata, "CLAIMS DETAILS",
                            "op_claims_details-table", "MRN", remove_cols)
                    ])
                ]),
            ])
    ])

    return children
Beispiel #7
0
def layout():
    patient_roster_data = chart_utils.get_loaded_data("VW_PATIENT_ROSTER",
                                                      "DATASET")
    data = chart_utils.get_loaded_data("VW_VISITSBYSTATUS_TASK_CATEGORY",
                                       "DATASET")
    remove_cols = ['BRANCH', 'COLUMN_MAPPING', 'COLUMN_PARAMETERS']
    max_date = datetime.now()

    children = html.Div([
        ddk.Row([
            ddk.Card(id="patient-roster-chart"),
        ]),
        ddk.Row([
            ddk.ControlCard(
                [
                    html.Details([
                        html.Summary("About this app"),
                        html.
                        P("""Select attributes to fine tune graphs and tables."""
                          ),
                    ]),
                    ddk.ControlItem(
                        dcc.Dropdown(options=[{
                            "label": status,
                            "value": status
                        } for status in sorted([
                            status
                            for status in data["STATUS"].unique() if status
                        ])],
                                     multi=True,
                                     placeholder="Select Status",
                                     id="census-status-selector"
                                     #value=["Not Yet Started", "Saved"],
                                     )),
                    ddk.ControlItem(
                        dcc.Dropdown(options=[{
                            "label": task,
                            "value": task
                        } for task in sorted(
                            [task for task in data["TASK"].unique() if task])],
                                     multi=True,
                                     placeholder="Select Task",
                                     id="census-task-selector")),
                    ddk.ControlItem(
                        dcc.Dropdown(options=[{
                            "label": task_category,
                            "value": task_category
                        } for task_category in sorted([
                            task_category for task_category in
                            data["TASK_CATEGORY"].unique() if task_category
                        ])],
                                     multi=True,
                                     placeholder="Select Task Category",
                                     id="census-task_category-selector")),
                    ddk.ControlItem(
                        dcc.Dropdown(
                            options=get_options(data, "ASSIGNED_TO"),
                            multi=True,
                            placeholder="Select a Clinician",
                            id="census-clinician-selector",
                        )),
                    ddk.ControlItem(
                        dcc.Dropdown(
                            multi=True,
                            placeholder="Select a Patient",
                            id="census-patient-selector",
                        )),
                    ddk.ControlItem(
                        dcc.DatePickerRange(
                            id="census-date-picker",
                            min_date_allowed=pd.to_datetime(
                                data["SCHEDULED_DATE"].min()),
                            max_date_allowed=max_date,
                            initial_visible_month=max_date,
                            start_date=max_date - timedelta(days=30),
                            end_date=max_date,
                        ), ),
                    ddk.ControlItem(
                        html.Button(
                            id="census-select-all-rows",
                            children="Select all matching records",
                            style={"margin": "auto"},
                            n_clicks=0,
                        )),
                    html.Div(
                        [
                            ddk.Modal(
                                id="census-modal-btn-outer",
                                children=[
                                    html.Button(
                                        id="census-expand-modal-2",
                                        n_clicks=0,
                                        children="Take action",
                                    ),
                                ],
                                target_id="census-modal-content",
                                hide_target=True,
                                style={"float": "right"},
                            ),
                        ],
                        style={"margin": "auto"},
                    ),
                ],
                width=30,
                style={"overflow": "scroll"},
            ),
            ddk.Card(id="census-time-series"),
        ]),
        #ddk.Row(id="census-pie-charts"),
        ddk.Card(children=[
            ddk.CardHeader(children=[
                html.Div(
                    "Table of selected tasks",
                    style={"float": "left"},
                ),
                html.Div([
                    ddk.Modal(
                        id="census-modal-btn-outer",
                        children=[
                            html.Button(
                                id="census-expand-modal",
                                n_clicks=0,
                                children="Take action",
                            )
                        ],
                        target_id="census-modal-content",
                        hide_target=True,
                        style={"float": "right"},
                    ),
                    ddk.Block(
                        id="census-modal-content",
                        children=html.Div(id="census-modal-div"),
                        style={
                            "width": "50%",
                            "margin": "auto",
                            "overflow": "scroll",
                        },
                    ),
                ]),
            ]),
            ddk.Block(ddk.
                      DataTable(columns=[{
                          "name": i.replace("_", " ").title(),
                          "id": i
                      } for i in data.columns if (i not in remove_cols)],
                                filter_action="native",
                                page_action="native",
                                page_size=25,
                                row_selectable="multi",
                                id="census-data-table",
                                style_cell={
                                    'fontSize': 12,
                                    'font-family': 'sans-serif'
                                }),
                      style={"overflow": "scroll"}),
        ]),
    ])
    return children
Beispiel #8
0
def layout():
    # load data for display
    authorizations_data = chart_utils.get_loaded_data("VW_AUTHORIZATIONS", "DATASET")

    patient_status_arr = chart_utils.get_options(authorizations_data, "PATIENTSTATUS")
    discipline_arr = chart_utils.get_options(authorizations_data, "DISCIPLINE")
    auth_type_arr = chart_utils.get_options(authorizations_data, "AUTHORIZATION_TYPE")
    payer_arr = chart_utils.get_options(authorizations_data, "PAYER")
    patient_arr = chart_utils.get_options(authorizations_data, "PATIENT")
    remove_cols = ['BRANCH','COLUMN_MAPPING', 'COLUMN_PARAMETERS' ]
    max_date = datetime.now()
    #pending_df = authorizations_data.loc[authorizations_data["DATA_SOURCE_ARRAY"].str.contains(r'authsPENDINGMDS', na=True)]
    #history_df = authorizations_data.loc[authorizations_data["DATA_SOURCE_ARRAY"].str.contains(r'authsHISTORY', na=True)]
    #tbs_df = authorizations_data.loc[ authorizations_data["DATA_SOURCE_ARRAY"].str.contains(r'authsTOBESENT', na=True)]

    children = html.Div(
        [
            ddk.Row(
                [
                    ddk.DataCard(
                        id='auths_patient_status_count',
                        value=12 ,#tbs_df.shape[0],
                        label = 'Patient Status Count'
                    ),
                    ddk.DataCard(
                        id='auths_auth_type_count',
                        value=13,#pending_df.shape[0] ,
                        label='Authorization Type Count'
                    ),
                    ddk.DataCard(
                        id='auths_total_count',
                        value=authorizations_data.shape[0] ,
                        label='Total Authorizations'
                    ),
                ]
            ),
            ddk.Row(
                [
                    ddk.ControlCard(
                        [
                            html.Details(
                                [
                                    html.Summary("About this app"),
                                    html.P(
                                        """Select attributes to fine tune graphs and tables."""
                                    ),
                                ]
                            ),
                            ddk.ControlItem(
                                dcc.Dropdown(

                                    options=auth_type_arr,
                                    multi=True,
                                    placeholder="Select Authorization Type",
                                    id="auths-auth-type-selector"
                                    # value=["Not Yet Started", "Saved"],
                                )
                            ),
                            ddk.ControlItem(
                                dcc.Dropdown(
                                    options=discipline_arr,
                                    multi=True,
                                    placeholder="Select Discipline",
                                    id="auths-discipline-selector"
                                    # value=["Not Yet Started", "Saved"],
                                )
                            ),
                            ddk.ControlItem(
                                dcc.Dropdown(
                                    options=patient_arr,
                                    multi=True,
                                    placeholder="Select Patient",
                                    id="auths-patient-selector"
                                    # value=["Not Yet Started", "Saved"],
                                )
                            ),
                            ddk.ControlItem(
                                dcc.Dropdown(
                                    options=patient_status_arr,
                                    multi=True,
                                    placeholder="Select Discipline",
                                    id="auths-patientstatus-selector"
                                    # value=["Not Yet Started", "Saved"],
                                )
                            ),
                            ddk.ControlItem(
                                dcc.Dropdown(
                                    options=payer_arr,
                                    multi=True,
                                    placeholder="Select Payer",
                                    id="auths-payer-selector"
                                    # value=["Not Yet Started", "Saved"],
                                )
                            ),
                            ddk.ControlItem(
                                dcc.DatePickerRange(
                                    id="auths-date-picker",
                                    min_date_allowed=pd.to_datetime(
                                        authorizations_data["START_DATE"].min()
                                    ),
                                    max_date_allowed=max_date,
                                    initial_visible_month=max_date,
                                    start_date=max_date - timedelta(days=700),
                                    end_date=max_date +timedelta(days=700),
                                ),
                            ),
                            ddk.ControlItem(
                                html.Button(
                                    id="auths-select-all-rows",
                                    children="Select all matching records",
                                    style={"margin": "auto"},
                                    n_clicks=0,
                                )
                            ),
                        ],
                        width=25,
                        style={"overflow": "scroll"},
                    ),
                    ddk.Card(
                        width=75,
                        children=[
                            ddk.CardHeader(
                                children=[
                                    html.Div(
                                        "Combined auths View", style={"float": "left"},
                                    ),

                                ]
                            ),
                            ddk.Block(
                                ddk.DataTable(
                                    columns=[
                                        {"name": i.replace("_", " ").title(), "id": i}
                                        for i in authorizations_data.columns if (i not in remove_cols)
                                    ],
                                    data=authorizations_data.sort_values(by="START_DATE").to_dict("records"),
                                    filter_action="native",
                                    page_action="native",
                                    page_size=50,
                                    row_selectable="multi",
                                    id="auths-history-data-table",
                                    style_cell={'fontSize': 12, 'font-family': 'sans-serif'},
                                    style_table = {'overflowX': 'auto'},
                                ),
                                style={"overflow": "scroll"}
                            ),
                        ]
                    ),
                ]

            ),

        ]
    )
    return children
Beispiel #9
0
def layout():
    # load data for display
    orders_history_data = chart_utils.get_loaded_data("VIEW_ORDERSHISTORY", "DATASET")
    orders_pending_mds_data = chart_utils.get_loaded_data("VIEW_ORDERSMANAGEMENT_ORDERSPENDINGMDS", "DATASET")
    orders_tobe_sent_data = chart_utils.get_loaded_data("VIEW_ORDERSTOBESENT", "DATASET")
    max_date = datetime.now()

    order_number_data = pd.concat(
        [orders_history_data["ORDER_NUMBER"], orders_pending_mds_data["ORDER_NUMBER"],
         orders_tobe_sent_data["ORDER_NUMBER"]])
    physician_data = pd.concat(
        [orders_history_data["PHYSICIAN"], orders_pending_mds_data["PHYSICIAN"],
         orders_tobe_sent_data["PHYSICIAN"]])
    ordertype_data = pd.concat(
        [orders_history_data["TYPE"], orders_pending_mds_data["TYPE"],
         orders_tobe_sent_data["TYPE"]])
    patient_data = pd.concat(
        [orders_history_data["PATIENT"], orders_pending_mds_data["PATIENT"],
         orders_tobe_sent_data["PATIENT"]])

    children = html.Div(
        [
            ddk.Row(
                [
                    ddk.DataCard(
                        id='orders_tobe_sent_count',
                        value=orders_tobe_sent_data.shape[0],
                        label = 'To Be Sent'
                    ),
                    ddk.DataCard(
                        id='orders_pending_mds_count',
                        value=orders_pending_mds_data.shape[0] ,
                        label='Pending MD Signature'
                    ),
                    ddk.DataCard(
                        id='orders_history_count',
                        value=orders_history_data.shape[0] ,
                        label='Total Orders'
                    ),
                ]
            ),
            ddk.Row(
                [
                    ddk.ControlCard(
                        [
                            html.Details(
                                [
                                    html.Summary("About this app"),
                                    html.P(
                                        """Select attributes to fine tune graphs and tables."""
                                    ),
                                ]
                            ),
                            ddk.ControlItem(
                                dcc.Dropdown(
                                    options=[
                                        {"label": orderstype, "value": orderstype}
                                        for orderstype in sorted(
                                            [
                                                orderstype
                                                for orderstype in ordertype_data.unique()
                                                if orderstype
                                            ]
                                        )
                                    ],
                                    multi=True,
                                    placeholder="Select Type",
                                    id="orders-type-selector"
                                    # value=["Not Yet Started", "Saved"],
                                )
                            ),
                            ddk.ControlItem(
                                dcc.Dropdown(
                                    options=[
                                        {"label": physician, "value": physician}
                                        for physician in sorted(
                                            [
                                                physician
                                                for physician in physician_data.unique()
                                                if physician
                                            ]
                                        )
                                    ],
                                    multi=True,
                                    placeholder="Select Physician",
                                    id="orders-physician-selector"
                                    # value=["Not Yet Started", "Saved"],
                                )
                            ),
                            ddk.ControlItem(
                                dcc.Dropdown(
                                    options=[
                                        {"label": patient, "value": patient}
                                        for patient in sorted(
                                            [
                                                patient
                                                for patient in patient_data.unique()
                                                if patient
                                            ]
                                        )
                                    ],
                                    multi=True,
                                    placeholder="Select Patient",
                                    id="orders-patient-selector"
                                    # value=["Not Yet Started", "Saved"],
                                )
                            ),
                            ddk.ControlItem(
                                dcc.DatePickerRange(
                                    id="order-date-picker",
                                    min_date_allowed=pd.to_datetime(
                                        orders_history_data["ORDER_DATE"].min()
                                    ),
                                    max_date_allowed=max_date,
                                    initial_visible_month=max_date,
                                    start_date=max_date - timedelta(days=30),
                                    end_date=max_date,
                                ),
                            ),
                            ddk.ControlItem(
                                html.Button(
                                    id="orders_tob_esent-select-all-rows",
                                    children="Select all matching records",
                                    style={"margin": "auto"},
                                    n_clicks=0,
                                )
                            ),
                        ],
                        width=30,
                        style={"overflow": "scroll"},
                    ),
                    ddk.Card(
                        children=[
                            ddk.CardHeader(
                                children=[
                                    html.Div(
                                        "Table of selected tasks", style={"float": "left"},
                                    ),

                                ]
                            ),
                            ddk.Block(
                                ddk.DataTable(
                                    columns=[
                                        {"name": i.replace("_", " ").title(), "id": i}
                                        for i in orders_history_data.columns if (i != 'BRANCH')
                                    ],
                                    data=orders_history_data.sort_values(by="PHYSICIAN").to_dict("records"),
                                    filter_action="native",
                                    page_action="native",
                                    page_size=50,
                                    row_selectable="multi",
                                    id="orders-history-data-table",
                                    style_cell={'fontSize': 12, 'font-family': 'sans-serif'}
                                ),
                                style={"overflow": "scroll"}
                            ),
                        ]
                    ),
                ]

            ),

        ]
    )
    return children
def layout():
    # load data for display
    episodesummdata = chart_utils.get_loaded_data(
        "AXXESS_API.RAW.VW_ALLPAYOR_EPISODE_BILLING_TIMELYFILING", "DATASET")

    #reorder the columns
    new_order = [
        'INSURANCE_CODE', 'INITIAL_TIMELY_FILING', 'MRN', 'PATIENT',
        'PATIENT_STATUS', 'EPISODE_START_DATE', 'EPISODE_END_DATE',
        'INSURANCE', 'AUTH_REQUIRED', 'EPISODE_UNEARNED_AMOUNT',
        'EPISODE_EARNED_AMOUNT', 'EPISODE_BILLED_AMOUNT',
        'EPISODE_ADJUSTMENTS', 'ORDERS_DETAILS', 'PHYSICIAN_NAME',
        'PHYSICIAN_PHONE', 'PHYSICIAN_FACSIMILE',
        'Auth #|Auth type|Range|Discipline|Authorized|Used|Unused|Units|'
    ]
    episodesummdata = episodesummdata[new_order]

    claimsdetailsdata = chart_utils.get_loaded_data(
        "AXXESS_API.RAW.VW_ALLPAYOR_BILLING_CLAIMS_DETAILS", "DATASET")

    # print(episodesummdata.columns)
    # print(claimsdetailsdata.columns)
    gl_mrn_arr = chart_utils.get_options(episodesummdata, "MRN")
    gl_ins_code_arr = chart_utils.get_options(episodesummdata,
                                              "INSURANCE_CODE")
    gl_auth_reqd_arr = chart_utils.get_options(episodesummdata,
                                               "AUTH_REQUIRED")
    gl_patient_status_arr = chart_utils.get_options(episodesummdata,
                                                    "PATIENT_STATUS")

    remove_cols = ['BRANCH', 'COLUMN_MAPPING', 'COLUMN_PARAMETERS']
    max_date = pd.to_datetime(episodesummdata['EPISODE_END_DATE']).max()
    min_date = pd.to_datetime(episodesummdata['EPISODE_END_DATE']).min()

    children = html.Div([

        # block on the right
        ddk.Block(
            width=100,
            children=[
                ddk.Row([
                    ddk.Block(children=[
                        ddk.ControlCard(
                            orientation='horizontal',
                            width=100,
                            children=[
                                html.Details([
                                    html.Summary("Filter here"),
                                    html.
                                    P("""Select attributes to fine tune tables."""
                                      ),
                                ]),
                                ddk.ControlItem(
                                    dcc.Dropdown(
                                        options=gl_ins_code_arr,
                                        multi=True,
                                        placeholder="Select Ins code",
                                        id="billing-ins-code-selector"
                                        # value=["Not Yet Started", "Saved"],
                                    )),
                                ddk.ControlItem(
                                    dcc.Dropdown(
                                        options=gl_auth_reqd_arr,
                                        multi=True,
                                        placeholder="Select Auth Reqd Status",
                                        id="billing-auth-reqd-selector"
                                        # value=["Not Yet Started", "Saved"],
                                    )),
                                ddk.ControlItem(
                                    dcc.Dropdown(
                                        options=gl_mrn_arr,
                                        multi=True,
                                        placeholder="Select MRN",
                                        id="billing-mrn-selector"
                                        # value=["Not Yet Started", "Saved"],
                                    )),
                                ddk.ControlItem(
                                    dcc.DatePickerRange(
                                        id="billing-episode-picker",
                                        min_date_allowed=pd.to_datetime(
                                            episodesummdata[
                                                'EPISODE_START_DATE'].min()),
                                        max_date_allowed=max_date,
                                        initial_visible_month=max_date,
                                        start_date=min_date,
                                        end_date=max_date), ),
                                ddk.ControlItem(
                                    html.Button(
                                        id="billing-select-all-rows",
                                        children="Select all matching records",
                                        style={"margin": "auto"},
                                        n_clicks=0,
                                    )),
                            ],
                        )
                    ]),
                ]),
                ddk.Row([
                    ddk.Block(children=[
                        generate_table_layout(
                            episodesummdata, "ALL PAYOR EPISODES",
                            "all_payor_episodes-table", "MRN", remove_cols)
                    ])
                ]),
                ddk.Row([
                    ddk.Block(children=[
                        generate_table_layout(
                            claimsdetailsdata, "CLAIMS DETAILS",
                            "claims_details-table", "MRN", remove_cols)
                    ])
                ]),
            ])
    ])

    return children