Skip to content

Commit

Permalink
Merge pull request #78 from AllenNeuralDynamics/han_minor_improvements
Browse files Browse the repository at this point in the history
Han minor improvements
  • Loading branch information
hanhou authored Aug 9, 2024
2 parents bcf3e40 + 123615f commit a08a95e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
10 changes: 9 additions & 1 deletion code/Home.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ def init():

_df.columns = _df.columns.get_level_values(1)
_df.sort_values(['session_start_time'], ascending=False, inplace=True)
_df['session_start_time'] = _df['session_start_time'].astype(str) # Turn to string
_df = _df.reset_index().query('subject_id != "0"')

# Handle mouse and user name
Expand Down Expand Up @@ -440,6 +441,13 @@ def _get_data_source(rig):

# _df = _df.merge(
# diff_relative_weight_next_day, how='left', on=['h2o', 'session'])

# Recorder columns so that autotrain info is easier to see
first_several_cols = ['subject_id', 'session_date', 'nwb_suffix', 'session', 'rig',
'user_name', 'curriculum_name', 'curriculum_version', 'current_stage_actual',
'task', 'notes']
new_order = first_several_cols + [col for col in _df.columns if col not in first_several_cols]
_df = _df[new_order]

st.session_state.df['sessions_bonsai'] = _df # Somehow _df loses the reference to the original dataframe

Expand Down Expand Up @@ -720,7 +728,7 @@ def app():

# st.dataframe(st.session_state.df_session_filtered, use_container_width=True, height=1000)


ok = True
if 'df' not in st.session_state or 'sessions_bonsai' not in st.session_state.df.keys():
ok = init()

Expand Down
12 changes: 12 additions & 0 deletions code/pages/3_AIND data access playground.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@
import streamlit as st
from streamlit_dynamic_filters import DynamicFilters

try:
st.set_page_config(layout="wide",
page_title='Foraging behavior browser',
page_icon=':mouse2:',
menu_items={
'Report a bug': "https://github.com/hanhou/foraging-behavior-browser/issues",
'About': "Github repo: https://github.com/hanhou/foraging-behavior-browser/"
}
)
except:
pass

@st.cache_data
def load_data():
df = fetch_fip_data(client)
Expand Down

0 comments on commit a08a95e

Please sign in to comment.