Exemple #1
0
def update_charts(selected_status, selected_clinicians, selected_patients, start_date, end_date, selected_task, selected_task_category):
    data = chart_utils.get_loaded_data('CENSUS_VISITS_BY_STATUS')
    patient_roster_data = chart_utils.get_loaded_data('PATIENT_ROSTER')

    if start_date:
        data = data.loc[data["SCHEDULED_DATE"] >= start_date]
    if end_date:
        data = data.loc[data["SCHEDULED_DATE"] < end_date]
    if selected_clinicians:
        data = data.loc[data["ASSIGNED_TO"].isin(selected_clinicians)]
    if selected_status:
        data = data.loc[data["STATUS"].isin(selected_status)]
    if selected_patients:
        data = data.loc[data["PATIENT"].isin(selected_patients)]
    if selected_task:
        data = data.loc[data["TASK"].isin(selected_task)]
    if selected_task_category:
        data = data.loc[data["TASK_CATEGORY"].isin(selected_task_category)]

    pie_charts = [
        ddk.Card(
            [
                ddk.CardHeader("Overview of {}".format(column.title())),
                chart_utils.generate_pie(data, column),
            ],
        )
        for column in ["PAYOR", "STATUS"]
    ]

    time_series = [
        ddk.DataCard(
            id='visits_by_status_count',
            value=data.shape[0]
        ),
        ddk.CardHeader("Status of tasks for selected clinicians, dates, and status"),
        chart_utils.generate_census_bar(data),
    ]
    data_table = data.sort_values(by="SCHEDULED_DATE").to_dict("records")

    patient_roster_chart = [
        ddk.DataCard(
            id='census_count',
            value=patient_roster_data.shape[0]
        ),
        ddk.CardHeader("Patient Roster Chart"),
        chart_utils.generate_patient_roster_bar(patient_roster_data),
    ]
    return patient_roster_chart, data_table, time_series, 0
Exemple #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
Exemple #3
0
    def trigger_by_modify(n):
        # print("###############  UPDATE 1  #########################")
        # PARSER.new_refresh()
        # Structure.refresh_BD()
        # print("###############  UPDATE 2  #########################")
        print("###############  START UPDATE   #########################")

        result = [
            ddk.CardHeader(title='Матчи',
                           style={
                               'background-color': '#1c424c',
                               'margin': '0px',
                               'padding': '15px',
                               'display': 'block',
                               'font-size': '20px'
                           }),
            Main_page.main_page()
        ]

        # live = [i for i in Live_matches.live()]

        results = [
            ddk.CardHeader(title='Результаты',
                           style={
                               'background-color': '#1c424c',
                               'margin': '0px',
                               'padding': '15px',
                               'display': 'block',
                               'font-size': '20px'
                           }),
            Result_page.result_page()
        ]

        #
        # tour = [
        #      ddk.CardHeader(title='Турниры',
        #                     style={'background-color': '#1c424c',
        #                            'margin': '0px',
        #                            'padding': '15px',
        #                            'display':'block',
        #                            'font-size': '20px'}),
        #      Main_tours_page.tour_page()]

        print("###############  UPDATED   #########################")
        return result, results
def update_charts(
    selected_status, selected_clinicians, selected_patients, start_date, end_date
):
    data = chart_utils.get_loaded_data("SCHEDULEREPORTS_VISITSBYSTATUS","DATASET")
    #print(data.columns)
    if start_date:
        data = data.loc[data["SCHEDULED_DATE"] > start_date]
    if end_date:
        data = data.loc[data["SCHEDULED_DATE"] < end_date]
    if selected_clinicians:
        data = data.loc[data["ASSIGNED_TO"].isin(selected_clinicians)]
    if selected_status:
        data = data.loc[data["STATUS"].isin(selected_status)]
    if selected_patients:
        data = data.loc[data["PATIENT"].isin(selected_patients)]

    pie_charts = [
        ddk.Card(
            [
                ddk.CardHeader(title="Overview of {}".format(column.title())),
                chart_utils.generate_pie(data, column),
            ],
        )
        for column in ["PAYOR", "STATUS"]
    ]

    time_series = [
        ddk.DataCard(
            id='total_visits_count',
            value=data.shape[0]
        ),
        ddk.CardHeader(
            title="Status of tasks for selected clinicians, dates, and status"
        ),
        chart_utils.generate_bar(data),
    ]
    data_table = data.sort_values(by="SCHEDULED_DATE").to_dict("records")

    return pie_charts, data_table, time_series, 0
Exemple #5
0
def news_items():
    newsBD = pd.read_csv(main_path_data + '\\news.csv')
    cards = []

    for ind in newsBD.index:
        ##########################    NEWS CARD   ###################################
        news_item = dbc.ListGroupItem(
            href='/news/{}'.format(newsBD['Mid'][ind]),
            id={
                'type': 'news-card',
                'index': str(newsBD['Mid'][ind])
            },
            style={
                'padding': '0px',
                'margin-bottom': "10px",
                'margin-top': "10px",
                'border': 'none'
            },
            children=[
                ddk.Card(style={
                    'background-color': '#073642',
                    'max-height': '100px',
                    'min-height': '100px',
                    'overflowY': 'hidden',
                    'text-align': 'center',
                    'margin': '0',
                    'padding': '0px'
                },
                         card_hover=True,
                         children=[
                             ddk.CardHeader(newsBD['name'][ind],
                                            style={
                                                'text-align': 'left',
                                                'font-size': '12px',
                                                'height': '40px',
                                                'max-height': '40px',
                                                'overflow-y': 'hidden',
                                                'background-color':
                                                'transparent',
                                            }),
                             html.H6(newsBD['disc'][ind],
                                     style={
                                         'margin': '0',
                                         'padding-bottom': '5px',
                                         'color': 'lightslategrey'
                                     })
                         ])
            ])

        cards.append(news_item)
    return cards
Exemple #6
0
    def _perform_layout(self):
        ddk = import_ddk()

        # No callbacks here. Must be constant or idempotent
        card_children = []
        if self.title:
            card_children.append(ddk.CardHeader(title=self.title))

        card_children.append(
            html.Div(
                style={"padding": 20}, children=html.Div(self.get_containers("output"))
            )
        )
        card_children.append(html.Hr(style={"width": "100%", "margin": "auto"}))
        card_children.extend(self.get_containers("input"))

        layout = ddk.ControlCard(
            children=card_children,
            **filter_kwargs(width=self.width),
        )

        return layout
Exemple #7
0
    def _perform_layout(self):
        ddk = import_ddk()

        # Input card
        input_card = ddk.ControlCard(
            children=self.get_containers("input"),
            width=self.input_width,
        )

        output_card_children = []
        if self.title is not None:
            output_card_children.append(ddk.CardHeader(title=self.title))
        output_card_children.extend(self.get_containers("output"))

        output_card = ddk.ControlCard(
            children=output_card_children,
            width=100 - self.input_width,
        )

        row_children = [input_card, output_card]
        layout = ddk.Row(row_children)

        return layout
Exemple #8
0
def news_page(id):

    all_cardsBD = pd.read_csv(main_path_data + '\\news.csv')
    # print(" id from NEWS :", id)

    # id = id.replace("news/", "")
    df = all_cardsBD[(all_cardsBD['Mid'].isin([int(id)]))]

    ##############     HEAD CARD of MATCH   ###################################
    news_head = ddk.Card(
        style={
            'width': '-webkit-fill-available',
            'min-height': '120px',
            'margin': '10px',
            'padding': '15px',
            'background-color': '#f9f9f91c'
        },
        children=[
            ddk.Block(width=100,
                      style={
                          'height': 'fit-content',
                      },
                      children=[
                          html.H2(df.iloc[0]['name'],
                                  style={
                                      'text-align': 'left',
                                      'font-size': '30px',
                                      'text-color': 'azure',
                                      'margin': '0'
                                  })
                      ]),
            ddk.Block(width=100,
                      style={
                          'max-height': 'fit-content',
                          'margin-bottom': '20px',
                      },
                      children=[
                          html.P('{}'.format(df.iloc[0]['date']),
                                 style={
                                     'text-align': 'left',
                                     'margin': '0'
                                 })
                      ]),
            ddk.Block(width=100,
                      style={'max-height': 'fit-content'},
                      children=[
                          html.P('{}'.format(df.iloc[0]['disc']),
                                 style={
                                     'text-align': 'left',
                                     'margin': '0'
                                 })
                      ]),
        ])

    match_card = ddk.Block(
        width=100,
        style={
            'height': '93vh',
            'text-align': 'center'
        },
        children=[
            ddk.Block(
                width=70,
                style={
                    'height': '89vh',
                    'margin': '0',
                    'padding': '0',
                    'color': 'azure',
                    'overflowY': 'scroll',
                    'overflowX': 'hidden',
                },
                children=[
                    news_head

                    # ddk.Card(style={'width':'-webkit-fill-available',
                    #                 'margin':'10px', 'padding':'0',
                    #                 'background-color': '#f9f9f91c',},
                    #          children=news_head),
                ]),
            ddk.Block(width=30,
                      style={'height': '90vh'},
                      children=[
                          ddk.Card(width=100,
                                   style={
                                       'background-color': 'transparent',
                                       'max-height': '40vh',
                                       'min-height': '40vh',
                                       'padding-bottom': '5px',
                                       'padding': '0',
                                       'overflowY': 'hidden',
                                       'margin': '10px'
                                   },
                                   children=[
                                       ddk.CardHeader(title='Live',
                                                      style={
                                                          'background-color':
                                                          'transparent'
                                                      }),
                                       Live_matches.live_list()
                                   ]),
                          ddk.Card(width=100,
                                   id='match_sample_right',
                                   style={
                                       'background-color': 'transparent',
                                       'max-height': '45vh',
                                       'min-height': '45vh',
                                       'padding-bottom': '5px',
                                       'padding': '0',
                                       'overflowY': 'hidden',
                                       'margin': '10px'
                                   },
                                   children=[
                                       ddk.CardHeader(title='Matches',
                                                      style={
                                                          'background-color':
                                                          'transparent'
                                                      }),
                                       Main_page.main_page()
                                   ])
                      ])
        ])

    return match_card
Exemple #9
0
                                        searchable=True,
                                        ),
                                        html.Div(id="Period-dropdown"),
                                        html.Label('Dino Type', style={'fontSize':30, 'textAlign':'center'}),
                                        dcc.Dropdown(id='display-type', options=[], multi=True, value=[]),
                                        
                                ]
                                )
                        ),
                        width=8,
                        ),

                        ddk.Card(
                        width=24,
                        children=[
                                ddk.CardHeader(title='Total Fossils Found Across All Periods'),
                                ddk.DataCard(value=totalFossilsFounds,
                                        style={'width':'fit-content'}),
                        ]
                        ),
                        # ddk.Card(
                        # width=24,
                        # children=[
                        #         ddk.CardHeader(title='Total Fossils Found'),
                        #         ddk.DataCard(
                        #                 id='total-fossils',
                        #                 value='',
                        #                 style={'width':'fit-content'}),
                        # ]
                        # ),
Exemple #10
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
Exemple #11
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
Exemple #12
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
Exemple #13
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
Exemple #14
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
Exemple #15
0
             "width": "auto",
         },
     ),
     ddk.Title('NRC IRAP - Corporate Funding in Canada from 2018-2020'),
 ]),  # end of ddk.Header
 ddk.Block(  # left-hand column
     width=20,
     children=[
         dcc.Tabs([
             dcc.Tab(
                 label='Map Filters',
                 children=[
                     ddk.ControlCard(
                         id='map-controls',
                         children=[
                             ddk.CardHeader(title='Search for Funding'),
                             ddk.ControlItem(dcc.Dropdown(
                                 id='province-dropdown',
                                 options=[{
                                     'label': i,
                                     'value': i
                                 } for i in province_list],
                                 multi=True,
                                 clearable=False,
                                 value=province_list),
                                             label='Province'),
                             ddk.ControlItem(dcc.Dropdown(
                                 id='naics-dropdown',
                                 options=[{
                                     'label': i,
                                     'value': i
Exemple #16
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
Exemple #17
0
import dash
import dash_design_kit as ddk
import plotly.express as px
import pandas as pd

app = dash.Dash(__name__)
server = app.server  # expose server variable for Procfile

df = pd.DataFrame({
    "Fruit": ["Apples", "Oranges", "Bananas", "Apples", "Oranges", "Bananas"],
    "Amount": [4, 1, 2, 2, 4, 5],
    "City": ["SF", "SF", "SF", "Montreal", "Montreal", "Montreal"]
})

fig = px.bar(df, x="Fruit", y="Amount", color="City", barmode="group")

app.layout = ddk.App(
    show_editor=True,
    children=[
        ddk.Header([ddk.Title('Hello Dash')]),
        ddk.Card(children=[
            ddk.CardHeader(
                title='Dash: A Web application framework for Python.'),
            ddk.Graph(figure=fig)
        ])
    ])
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
Exemple #19
0
def Graphs():
    df_streamtube = ddk.datasets.df_streamtube()
    df_choropleth = ddk.datasets.df_choropleth()
    df_scattergeo = ddk.datasets.df_scattergeo()
    df_iris = ddk.datasets.df_iris()

    x = [1, 2, 3]
    labels = ['Montreal', 'Tofu Bowl', 'Tropical Beaches']
    labels_long = [
        'Montreal', 'New York City', 'Tokyo',
        'Cincinatti', 'Miami', 'London', 'Vancouver'
    ]
    values_long = [1, 2, 3, 1, 5, 6, 7]
    y1 = [3, 1, 2]
    y2 = [4, 10, 4]
    y3 = [5, 2, 3]
    y4 = [9, 3, 8]
    y5 = [10, 5, 12]
    y6 = [11, 8, 10]
    y7 = [1, 2, 1]
    y8 = [5, 3, 1]
    z = [5, 3, 1]
    matrix = [
        [1, 2, 3],
        [4, 1, 2],
        [1, 3, 4]
    ]

    open = [33.0, 33.3, 33.5, 33.0, 34.1]
    high = [33.1, 33.3, 33.6, 33.2, 34.8]
    low = [32.7, 32.7, 32.8, 32.6, 32.8]
    close = [33.0, 32.9, 33.3, 33.1, 33.1]
    dates = [dt(year=2013, month=10, day=10),
             dt(year=2013, month=11, day=10),
             dt(year=2013, month=12, day=10),
             dt(year=2014, month=1, day=10),
             dt(year=2014, month=2, day=10)]

    r = [0.5, 1, 2, 2.5, 3, 4]
    theta = [35, 70, 120, 155, 205, 240]


    datas = [
        [
            {'type': 'scatter', 'x': x, 'y': y1, 'mode': 'lines'},
            {'type': 'scatter', 'x': x, 'y': y2, 'mode': 'lines'},
        ],

        [
            {'type': 'scatter', 'x': x, 'y': y1, 'mode': 'lines'},
            {'type': 'scatter', 'x': x, 'y': y2, 'mode': 'lines'},
            {'type': 'scatter', 'x': x, 'y': y3, 'mode': 'lines'},
            {'type': 'scatter', 'x': x, 'y': y4, 'mode': 'lines'},
        ],

        [
            {'type': 'scatter', 'x': x, 'y': y1, 'mode': 'lines'},
            {'type': 'scatter', 'x': x, 'y': y2, 'mode': 'lines'},
            {'type': 'scatter', 'x': x, 'y': y3, 'mode': 'lines'},
            {'type': 'scatter', 'x': x, 'y': y4, 'mode': 'lines'},
            {'type': 'scatter', 'x': x, 'y': y5, 'mode': 'lines'},
            {'type': 'scatter', 'x': x, 'y': y6, 'mode': 'lines'},
            {'type': 'scatter', 'x': x, 'y': y7, 'mode': 'lines'},
            {'type': 'scatter', 'x': x, 'y': y8, 'mode': 'lines'},
        ],

        [
            {'type': 'scatter', 'x': x, 'y': y1, 'mode': 'markers'},
            {'type': 'scatter', 'x': x, 'y': y2, 'mode': 'markers'},
        ],

        [
            {'type': 'scatter', 'x': x, 'y': y1, 'mode': 'markers'},
            {'type': 'scatter', 'x': x, 'y': y2, 'mode': 'markers'},
            {'type': 'scatter', 'x': x, 'y': y3, 'mode': 'markers'},
            {'type': 'scatter', 'x': x, 'y': y4, 'mode': 'markers'},
        ],

        [
            {'type': 'scatter', 'x': x, 'y': y1, 'mode': 'markers'},
            {'type': 'scatter', 'x': x, 'y': y2, 'mode': 'markers'},
            {'type': 'scatter', 'x': x, 'y': y3, 'mode': 'markers'},
            {'type': 'scatter', 'x': x, 'y': y4, 'mode': 'markers'},
            {'type': 'scatter', 'x': x, 'y': y5, 'mode': 'markers'},
            {'type': 'scatter', 'x': x, 'y': y6, 'mode': 'markers'},
            {'type': 'scatter', 'x': x, 'y': y7, 'mode': 'markers'},
            {'type': 'scatter', 'x': x, 'y': y8, 'mode': 'markers'},
        ],

        [
            {
                'type': 'scatter', 'x': x, 'y': y1, 'marker': {'color': y2},
                'mode': 'markers'
            },
        ],

        [
            {'type': 'scatter', 'x': x, 'y': y1, 'mode': 'lines+markers'},
            {'type': 'scatter', 'x': x, 'y': y2, 'mode': 'lines+markers'},
        ],

        [
            {'type': 'bar', 'x': labels, 'y': y1},
            {'type': 'bar', 'x': labels, 'y': y2},
        ],

        [
            {'type': 'bar', 'x': labels, 'y': y1},
            {'type': 'bar', 'x': labels, 'y': y2},
            {'type': 'bar', 'x': labels, 'y': y3},
            {'type': 'bar', 'x': labels, 'y': y4},
        ],

        [
            {'type': 'bar', 'x': labels, 'y': y1},
            {'type': 'bar', 'x': labels, 'y': y2},
            {'type': 'bar', 'x': labels, 'y': y3},
            {'type': 'bar', 'x': labels, 'y': y4},
            {'type': 'bar', 'x': labels, 'y': y5},
            {'type': 'bar', 'x': labels, 'y': y6},
            {'type': 'bar', 'x': labels, 'y': y7},
            {'type': 'bar', 'x': labels, 'y': y8},
        ],

        [
            {'type': 'scatter', 'x': x, 'y': y1, 'mode': 'lines', 'fill': 'tonexty'},
            {'type': 'scatter', 'x': x, 'y': y2, 'mode': 'lines', 'fill': 'tonexty'},
        ],

        [
            {'type': 'heatmap', 'z': matrix}
        ],

        [
            {'type': 'contour', 'z': matrix}
        ],

        [
            {'type': 'histogram2d', 'x': x, 'y': y1}
        ],

        [
            {'type': 'histogram2dcontour', 'x': x, 'y': y1}
        ],

        [
            {'type': 'pie', 'labels': labels, 'values': y1}
        ],

        [
            {'type': 'pie', 'labels': labels_long, 'values': values_long}
        ],

        [
            {'type': 'box', 'y': y1},
            {'type': 'box', 'y': y2}
        ],

        [
            {'type': 'box', 'y': y1, 'boxpoints': 'all'},
            {'type': 'box', 'y': y2, 'boxpoints': 'all'}
        ],

        [
            {'type': 'violin', 'y': y1},
            {'type': 'violin', 'y': y2}
        ],

        [
            {'type': 'violin', 'y': y1, 'points': 'all'},
            {'type': 'violin', 'y': y2, 'points': 'all'}
        ],

        [
            {'type': 'histogram', 'y': y1}
        ],

        [
            {'type': 'scatter3d', 'x': x, 'y': y1, 'z': z, 'mode': 'markers'},
            {'type': 'scatter3d', 'x': x, 'y': y2, 'z': z, 'mode': 'markers'}
        ],

        [
            {'type': 'scatter3d', 'x': x, 'y': y1, 'z': z, 'mode': 'lines'},
            {'type': 'scatter3d', 'x': x, 'y': y2, 'z': z, 'mode': 'lines'}
        ],

        [
            {'type': 'scatter3d', 'x': x, 'y': y1, 'z': z, 'mode': 'markers+lines'},
            {'type': 'scatter3d', 'x': x, 'y': y2, 'z': z, 'mode': 'markers+lines'}
        ],

        [
            {'type': 'surface', 'z': matrix}
        ],

        [
            {
                'type': 'cone',
                'x': [row[0] for row in cone_data],
                'y': [row[1] for row in cone_data],
                'z': [row[2] for row in cone_data],
                'u': [row[3] for row in cone_data],
                'v': [row[4] for row in cone_data],
                'w': [row[5] for row in cone_data],
            }
        ],

        [
            {
                'type': 'streamtube',
                'x': df_streamtube['x'],
                'y': df_streamtube['y'],
                'z': df_streamtube['z'],
                'u': df_streamtube['u'],
                'v': df_streamtube['v'],
                'w': df_streamtube['w'],
                'sizeref': 0.5
            }
        ],

        [
            {
                'type': 'choropleth',
                'z': df_choropleth['GDP (BILLIONS)'],
                'locations': df_choropleth['CODE'],
                'text': df_choropleth['COUNTRY']
            }
        ],

        [
            {
                'type': 'scattergeo',
                'lon': df_scattergeo['long'],
                'lat': df_scattergeo['lat'],
                'mode': 'markers',
            }
        ],

        [
            {
                'type': 'scattermapbox',
                'lon': df_scattergeo['long'],
                'lat': df_scattergeo['lat'],
                'mode': 'markers',
            }
        ],

        [
            {
                'type': 'candlestick',
                'open': open,
                'high': high,
                'low': low,
                'close': close
            }
        ],

        [
            {
                'type': 'ohlc',
                'open': open,
                'high': high,
                'low': low,
                'close': close
            }
        ],

        [
            {'type': 'scatterternary', 'a': x, 'b': y1, 'c': y2, 'mode': 'markers'},
        ],

        [
            {'type': 'scatterternary', 'a': x, 'b': y1, 'c': y2, 'mode': 'lines'},
        ],

        [
            {'type': 'scatterpolar', 'r': r, 'theta': theta, 'mode': 'markers'},
        ],
        [
            {'type': 'scatterpolar', 'r': r, 'theta': theta, 'mode': 'lines'},
        ],

        [
            dict(
                type='parcoords',
                dimensions=list([
                    dict(range=[0,8],
                        constraintrange=[4,8],
                        label='Sepal Length', values=df_iris['sepal_length']),
                    dict(range=[0,8],
                        label='Sepal Width', values=df_iris['sepal_width']),
                    dict(range=[0,8],
                        label='Petal Length', values=df_iris['petal_length']),
                    dict(range=[0,8],
                        label='Petal Width', values=df_iris['petal_width'])
                ])
            )
        ],

        [
            dict(
                type='sankey',
                node=dict(
                    label=["Nuclear", "Wind Energy", "Thermal", "Bio Conversion", "Airline Industry", "Losses"],
                ),
                link=dict(
                    source=[0, 1, 0, 2, 3, 3],
                    target=[2, 3, 3, 4, 4, 5],
                    value=[8, 4, 2, 8, 4, 2]
                )
            )
        ],

        [
            {
                'type': 'carpet',
                'a': [4, 4, 4, 4.5, 4.5, 4.5, 5, 5, 5, 6, 6, 6],
                'b': [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3],
                'y': [2, 3.5, 4, 3, 4.5, 5, 5.5, 6.5, 7.5, 8, 8.5, 10],
            }
        ],

        [
            {
                'type': 'contourcarpet',
                'a': [0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3],
                'b': [4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6],
                'z': [1, 1.96, 2.56, 3.0625, 4, 5.0625, 1, 7.5625, 9, 12.25, 15.21, 14.0625],
            },
            {
                'type': 'carpet',
                'a': [0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3],
                'b': [4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6],
                'x': [2, 3, 4, 5, 2.2, 3.1, 4.1, 5.1, 1.5, 2.5, 3.5, 4.5],
                'y': [1, 1.4, 1.6, 1.75, 2, 2.5, 2.7, 2.75, 3, 3.5, 3.7, 3.75],
            }
        ]

    ]

    return html.Div([
        ddk.Card(width=25, children=[
            ddk.CardHeader(title=data[0]['type']),
            ddk.Graph(
                id='graph-{}'.format(i),
                figure={
                    'data': data,
                    'layout': {
                        'title': 'Hello World',
                    }
                }
            )
        ])
        for (i, data) in enumerate(datas)
    ])
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