예제 #1
0
def fixed_input_layout(data, selected_rows):
    children = html.Div(children=[
        # This div only exists to preserve components with
        # certain IDs so that there are not errors retrieving the
        # selection if it's a custom input
        html.Div(
            children=[
                dcc.Dropdown(id=i)
                for i in ["selected-patient", "task-selection", "task-date"]
            ],
            style={"display": "none"},
        ),
        dcc.Markdown("**Take bulk action on selected rows**"),
        html.Div(
            ddk.DataTable(
                columns=[{
                    "name": i.replace("_", " ").title(),
                    "id": i
                } for i in data.columns],
                page_action="native",
                page_size=10,
                data=selected_rows,
            ),
            style={"overflow": "scroll"},
        ),
    ])
    return children
예제 #2
0
def generate_table_layout(table_df, title, tableid, sort_cols, remove_cols):
    children = html.Div([
        ddk.Card(children=[
            ddk.CardHeader(children=[
                html.Div(
                    title,
                    style={"float": "left"},
                ),
            ]),
            ddk.Block(ddk.DataTable(
                columns=[{
                    "name": i.replace("_", " ").title(),
                    "id": i
                } for i in table_df.columns if (i not in remove_cols)],
                filter_action="native",
                page_action="native",
                page_size=10,
                row_selectable="multi",
                id=tableid,
                style_cell={
                    'fontSize': 12,
                    'font-family': 'sans-serif'
                },
                style_table={'overflowX': 'auto'},
            ),
                      style={"overflow": "scroll"}),
        ]),
    ])
    return children
예제 #3
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
예제 #4
0
def layout():
    patient_roster_data = patient_roster_df()
    patient_roster_data["DOB"] = patient_roster_data["DOB"].astype(str)
    redis_instance.hset("app-data", "PATIENT_ROSTER", json.dumps(patient_roster_data.to_dict("records")))
    data = full_df()
    data["SCHEDULED_DATE"] = data["SCHEDULED_DATE"].astype(str)
    redis_instance.hset("app-data", "CENSUS_VISITS_BY_STATUS", json.dumps(data.to_dict("records")))
    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=[
                                        {"label": clinician, "value": clinician,}
                                        for clinician in sorted(
                                            [
                                                patient
                                                for patient in data[
                                                    "ASSIGNED_TO"
                                                ].unique()
                                                if patient
                                            ]
                                        )
                                        if clinician
                                    ],
                                    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 != 'BRANCH')
                            ],
                            filter_action="native",
                            page_action="native",
                            page_size=50,
                            row_selectable="multi",
                            id="census-data-table",
                            style_cell={'fontSize': 12, 'font-family': 'sans-serif'}
                        ),
                        style={"overflow": "scroll"}
                    ),
                ]
            ),
        ]
    )
    return children
예제 #5
0
 ddk.DataTable(
     id='companies-table',
     columns=[{
         "name": i,
         "id": i
     } for i in df[[
         'Company_Name', 'Project', '$_Amount'
     ]].columns],
     fill_width=False,
     filter_action='native',
     #filter_query=''
     sort_action='native',
     page_size=7,
     sort_mode='multi',
     style_header={
         "fontWeight": "bold",
         "textTransform": "capitalize"
     },
     style_cell_conditional=[
         {
             'if': {
                 'column_id': '$_Amount'
             },
             'width': '10%'
         },
         {
             'if': {
                 'column_id': 'Company_Name'
             },
             'width': '20%'
         },
         {
             'if': {
                 'column_id': 'Project'
             },
             'width': '50%'
         },
     ],
     style_cell={
         'whiteSpace': 'normal',
         #'height': 'auto',
     },
     style_data_conditional=[{
         "if": {
             "row_index": "even"
         },
         "backgroundColor":
         "var(--report_background_page)",
     }],
 ),
예제 #6
0
def generate_table_layout(table_df, title, tableid, sort_cols, remove_cols):
    children = html.Div(
        [
            ddk.Card(
                children=[
                    ddk.CardHeader(
                        children=[
                            html.Div(
                                title, style={"float": "left"},
                            ),

                        ]
                    ),
                    ddk.Block(
                        ddk.DataTable(
                            columns=[
                                {"name": i.replace("_", " ").title(), "id": i}
                                for i in table_df.columns if (i not in remove_cols)
                            ],
                            data=table_df.sort_values(by=sort_cols).to_dict("records"),
                            filter_action="native",
                            sort_action="native",
                            page_action="native",
                            # page_size=10,
                            row_selectable="multi",
                            id=tableid,
                            style_cell={
                                'height': 'auto',
                                # all three widths are needed
                                # 'minWidth': '180px', 'width': '180px', 'maxWidth': '180px',
                                'fontSize': 12,
                                'font-family': 'sans-serif',
                                'whiteSpace': 'pre',
                                #'wordBreak': 'break-all',
                                'textAlign': 'center'

                            },
                            style_cell_conditional=[

                                                       {
                                                           'if': {'column_id': c},
                                                           'textAlign': 'left'
                                                       } for c in ['ORDERS_DETAILS', 'OASIS_DETAILS', 'AUTH #|AUTH TYPE|RANGE|DISCIPLINE|AUTHORIZED|USED|UNUSED|UNITS']

                                                   ] +
                                                   [
                                                       {
                                                           'if': {'column_id': c},
                                                           'width': '100px',
                                                           'textAlign': 'right'
                                                       } for c in ['1-30 days Disc: T/S/C/M','31-60 days Disc: T/S/C/M', 'Visits Disc: T/S/C/M']
                                                   ]
                                                   +
                                                   [{'if': {'column_id': 'CONSOLIDATED_COMMENTS'},
                                                         'width': '100px',
                                                         'whiteSpace': 'normal',
                                                         'textAlign': 'left'
                                                         },
                                                        {'if': {'column_id': 'MRN'},
                                                         'width': '90px',
                                                         'whiteSpace': 'normal',
                                                         'textAlign': 'center'
                                                         },
                                                        {'if': {'column_id': 'INS_CODE'},
                                                         'width': '40px',
                                                         'whiteSpace': 'normal',
                                                         'textAlign': 'center'
                                                         },
                                                        {'if': {'column_id': 'PATIENT_STATUS'},
                                                         'width': '60px',
                                                         'whiteSpace': 'normal',
                                                         'textAlign': 'center'
                                                         },
                                                        {'if': {'column_id': 'INSURANCE'},
                                                         'width': '60px',
                                                         'whiteSpace': 'normal',
                                                         'textAlign': 'center'
                                                         },
                                                        {'if': {'column_id': 'PATIENT'},
                                                         'width': '60px',
                                                         'whiteSpace': 'normal',
                                                         'textAlign': 'center'
                                                         },

                                                        {'if': {'column_id': 'EPISODE_START_DATE'},
                                                         'width': '70px',
                                                         'whiteSpace': 'normal',
                                                         'textAlign': 'center'
                                                         },
                                                        {'if': {'column_id': 'EPISODE_END_DATE'},
                                                         'width': '70px',
                                                         'whiteSpace': 'normal',
                                                         'textAlign': 'center'
                                                         },
                                                        {'if': {'column_id': 'AUTH_REQUIRED'},
                                                         'width': '45px',
                                                         'whiteSpace': 'normal',
                                                         'textAlign': 'center'
                                                         },
                                                        {'if': {'column_id': 'EPISODE_UNEARNED_AMOUNT'},
                                                         'width': '70px',
                                                         'whiteSpace': 'normal',
                                                         'textAlign': 'center'
                                                         },
                                                        {'if': {'column_id': 'EPISODE_EARNED_AMOUNT'},
                                                         'width': '70px',
                                                         'whiteSpace': 'normal',
                                                         'textAlign': 'center'
                                                         },
                                                        {'if': {'column_id': 'EPISODE_BILLED_AMOUNT'},
                                                         'width': '70px',
                                                         'whiteSpace': 'normal',
                                                         'textAlign': 'center'
                                                         },
                                                        {'if': {'column_id': 'EPISODE_ADJUSTMENTS'},
                                                         'width': '70px',
                                                         'whiteSpace': 'normal',
                                                         'textAlign': 'center'
                                                         },

                                                        ],
                            style_data_conditional=[
                                                       {
                                                           'if': {'row_index': 'odd'},
                                                           'backgroundColor': 'rgb(248, 248, 248)'
                                                       }
                                                   ] + [
                                                       {'if': {'column_id': 'TOTAL_MARGIN',
                                                               'filter_query': '{TOTAL_MARGIN} < 20'},
                                                        'color': 'red'}
                                                        ],
                            style_header={
                                'backgroundColor': 'rgb(230, 230, 230)',
                                'fontWeight': 'bold',
                                'whiteSpace': 'normal',
                                'textAlign': 'center'
                            },
                            style_table={'overflowX': 'auto',  'overflowY': 'scroll'},
                            #style_table={'overflowX': 'auto', 'maxHeight': '400px', 'overflowY': 'scroll'},
                        ),
                        style={"overflow": "scroll"}
                    ),
                ]
            ),
        ]
    )
    return children
예제 #7
0
def layout():
    data = chart_utils.get_loaded_data("SCHEDULEREPORTS_VISITSBYSTATUS","DATASET")
    remove_cols = ['BRANCH','COLUMN_MAPPING', 'COLUMN_PARAMETERS']

    max_date = datetime.now()

    children = html.Div(
        [
            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(
                                            [
                                                patient
                                                for patient in data["STATUS"].unique()
                                                if patient
                                            ]
                                        )
                                    ],
                                    multi=True,
                                    placeholder="Select Status",
                                    id="status-selector",
                                    value=["Not Yet Started", "Saved"],
                                )
                            ),
                            ddk.ControlItem(
                                dcc.Dropdown(
                                    options=[
                                        {"label": clinician, "value": clinician,}
                                        for clinician in sorted(
                                            [
                                                patient
                                                for patient in data[
                                                    "ASSIGNED_TO"
                                                ].unique()
                                                if patient
                                            ]
                                        )
                                        if clinician
                                    ],
                                    multi=True,
                                    placeholder="Select a Clinician",
                                    id="clinician-selector",
                                )
                            ),
                            ddk.ControlItem(
                                dcc.Dropdown(
                                    multi=True,
                                    placeholder="Select a Patient",
                                    id="patient-selector",
                                )
                            ),
                            ddk.ControlItem(
                                dcc.DatePickerRange(
                                    id="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="select-all-rows",
                                    children="Select all matching records",
                                    style={"margin": "auto"},
                                    n_clicks=0,
                                )
                            ),
                            html.Div(
                                [
                                    ddk.Modal(
                                        id="modal-btn-outer",
                                        children=[
                                            html.Button(
                                                id="expand-modal-2",
                                                n_clicks=0,
                                                children="Take action",
                                            ),
                                        ],
                                        target_id="modal-content",
                                        hide_target=True,
                                        style={"float": "right"},
                                    ),
                                ],
                                style={"margin": "auto"},
                            ),
                        ],
                        width=30,
                        style={"overflow": "scroll"},
                    ),
                    ddk.Card(id="time-series"),
                ]
            ),
            ddk.Row(id="pie-charts"),
            ddk.Card(
                children=[
                    ddk.CardHeader(
                        title="Table of selected tasks",
                        children=[
                            html.Div(
                                [
                                    ddk.Modal(
                                        id="modal-btn-outer",
                                        children=[
                                            html.Button(
                                                id="expand-modal",
                                                n_clicks=0,
                                                children="Take action",
                                            )
                                        ],
                                        target_id="modal-content",
                                        hide_target=True,
                                        style={"float": "right"},
                                    ),
                                    ddk.Block(
                                        id="modal-content",
                                        children=html.Div(id="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)
                            ],
                            data = data.sort_values(by="SCHEDULED_DATE").to_dict("records"),
                            filter_action="native",
                            page_action="native",
                            page_size=25,
                            row_selectable="multi",
                            id="data-table",
                            style_cell={'fontSize': 12, 'font-family': 'sans-serif'}
                        ),
                        style={"overflow": "scroll"}
                    ),
                ]
            ),
        ]
    )
    return children
예제 #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
예제 #9
0
def portfolio_table():
    columns = [
        # these column IDs _must_ match the portfolio in the `schema`
        {
            'id': 'ticker_display',
            'name': ['Portfolio', 'Ticker'],
        },

        {
            'id': 'asset_class',
            'presentation': 'dropdown',
            'name': ['Portfolio', 'Asset Class'],
        },

        {
            'id': 'returns',
            'name': ['Portfolio', 'Returns'],
            'type': 'numeric',
            'format': FormatTemplate.percentage(1)
        },


        {
            'id': 'scenario.0.min_weight',
            'name': ['Scenario 1', 'Min Wt'],
        },

        {
            'id': 'scenario.0.max_weight',
            'name': ['Scenario 1', 'Max Wt'],
        },


        {
            'id': 'scenario.1.min_weight',
            'name': ['Scenario 2', 'Min Wt'],
        },

        {
            'id': 'scenario.1.max_weight',
            'name': ['Scenario 2', 'Max Wt'],
        },

        {
            'id': 'portfolio.0.portfolio_weights',
            'name': ['Portfolios', 'Portfolio 1'],
        },

        {
            'id': 'portfolio.1.portfolio_weights',
            'name': ['Portfolios', 'Portfolio 2'],
        }
    ]
    data = [DEFAULT_ROW] * 10

    # return DataTable(
    #                 id='portfolio-table',
    #                 merge_duplicate_headers=True,
    #                 columns=columns,
    #                 data=data,
    #                 editable=True,
    #             )

    return ddk.DataTable(
        columns=columns,
        data=NEW_DATA + data[0:2],
        merge_duplicate_headers=True,
        editable=True,
        id='portfolio-table',
        style_cell_conditional=[
            {'if': {'column_id': c['id']},
             'minWidth': '150px', 'width': '150px', 'maxWidth': '150px',}
        for c in columns],
        style_table={
            'overflowX': 'scroll'
        },
        dropdown={
            'asset_class': {
                'options': [
                    {'label': i, 'value': i}
                    for i in asset_classes
                ]
            }
        }
    )
예제 #10
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