Spaces:
Sleeping
Sleeping
bugfix: concepts n
Browse files- app.py +12 -12
- modules/org_count.py +0 -4
- modules/utils.py +5 -2
app.py
CHANGED
@@ -26,15 +26,15 @@ from io import BytesIO
|
|
26 |
logger = logging.getLogger(__name__)
|
27 |
|
28 |
# Local
|
29 |
-
|
30 |
-
|
31 |
|
32 |
|
33 |
# Main app logic
|
34 |
def main():
|
35 |
# Temporarily set authentication to True for testing
|
36 |
if 'authenticated' not in st.session_state:
|
37 |
-
st.session_state['authenticated'] =
|
38 |
|
39 |
if st.session_state['authenticated']:
|
40 |
# Remove login success message for testing
|
@@ -183,15 +183,15 @@ def main():
|
|
183 |
|
184 |
|
185 |
# Comment out for testing
|
186 |
-
else:
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
|
196 |
|
197 |
|
|
|
26 |
logger = logging.getLogger(__name__)
|
27 |
|
28 |
# Local
|
29 |
+
from dotenv import load_dotenv
|
30 |
+
load_dotenv()
|
31 |
|
32 |
|
33 |
# Main app logic
|
34 |
def main():
|
35 |
# Temporarily set authentication to True for testing
|
36 |
if 'authenticated' not in st.session_state:
|
37 |
+
st.session_state['authenticated'] = True
|
38 |
|
39 |
if st.session_state['authenticated']:
|
40 |
# Remove login success message for testing
|
|
|
183 |
|
184 |
|
185 |
# Comment out for testing
|
186 |
+
# else:
|
187 |
+
# username = st.text_input("Username")
|
188 |
+
# password = st.text_input("Password", type="password")
|
189 |
+
# if st.button("Login"):
|
190 |
+
# if validate_login(username, password):
|
191 |
+
# st.session_state['authenticated'] = True
|
192 |
+
# st.rerun()
|
193 |
+
# else:
|
194 |
+
# st.error("Incorrect username or password")
|
195 |
|
196 |
|
197 |
|
modules/org_count.py
CHANGED
@@ -139,7 +139,3 @@ def standardize_organization_names(df):
|
|
139 |
|
140 |
return df
|
141 |
|
142 |
-
# Example usage:
|
143 |
-
if __name__ == "__main__":
|
144 |
-
df = pd.read_csv('sandbox/maf_orgs.csv')
|
145 |
-
df = standardize_organization_names(df)
|
|
|
139 |
|
140 |
return df
|
141 |
|
|
|
|
|
|
|
|
modules/utils.py
CHANGED
@@ -311,12 +311,15 @@ def process_data(uploaded_file, sens_level):
|
|
311 |
else 'ERROR', axis=1)
|
312 |
|
313 |
# Reorder columns in final dataframe
|
314 |
-
column_order = ['id', 'scope_txt', 'tech_txt', 'fin_txt', 'maf_funding', 'cont_public',
|
315 |
'cont_private', 'cont_other', 'scope_lab1', 'scope_lab2', 'tech_lab1',
|
316 |
'tech_lab3', 'fin_lab2', 'ADAPMIT_SCOPE', 'ADAPMIT_TECH', 'ADAPMIT', 'SECTOR1',
|
317 |
'SECTOR2', 'LANG', 'lev_total', 'lev_gt_0', 'lev_maf_%', 'lev_maf_scale',
|
318 |
'word_length_check', 'pred_score', 'pred_action']
|
319 |
-
|
|
|
|
|
|
|
320 |
|
321 |
return df
|
322 |
|
|
|
311 |
else 'ERROR', axis=1)
|
312 |
|
313 |
# Reorder columns in final dataframe
|
314 |
+
column_order = ['id', 'organization', 'org_renamed', 'concept_count', 'scope_txt', 'tech_txt', 'fin_txt', 'maf_funding', 'cont_public',
|
315 |
'cont_private', 'cont_other', 'scope_lab1', 'scope_lab2', 'tech_lab1',
|
316 |
'tech_lab3', 'fin_lab2', 'ADAPMIT_SCOPE', 'ADAPMIT_TECH', 'ADAPMIT', 'SECTOR1',
|
317 |
'SECTOR2', 'LANG', 'lev_total', 'lev_gt_0', 'lev_maf_%', 'lev_maf_scale',
|
318 |
'word_length_check', 'pred_score', 'pred_action']
|
319 |
+
|
320 |
+
# Only include columns that exist in the DataFrame
|
321 |
+
final_columns = [col for col in column_order if col in df.columns]
|
322 |
+
df = df[final_columns]
|
323 |
|
324 |
return df
|
325 |
|