12
12
from msfocr .doctr import ocr_functions as doctr_ocr_functions
13
13
from msfocr .llm import ocr_functions
14
14
15
- # Wrapper functions
16
15
16
+ # Hardcoded period types and formatting, probably won't update but can get them through API
17
+ PERIOD_TYPES = {
18
+ "Daily" : "{year}{month}{day}" ,
19
+ "Weekly" : "{year}W{week}" ,
20
+ "WeeklyWednesday" : "{year}WedW{week}" ,
21
+ "WeeklyThursday" : "{year}ThuW{week}" ,
22
+ "WeeklySaturday" : "{year}SatW{week}" ,
23
+ "WeeklySunday" : "{year}SunW{week}" ,
24
+ "BiWeekly" : "{year}Bi{week}" ,
25
+ "Monthly" : "{year}{month}" ,
26
+ "BiMonthly" : "{year}{month}B" ,
27
+ "Quarterly" : "{year}{quarter_number}" ,
28
+ "SixMonthly" : "{year}{semiyear_number}" ,
29
+ "SixMonthlyApril" : "{year}April{semiyear_number}" ,
30
+ "SixMonthlyNovember" : "{year}Nov{semiyear_number}" ,
31
+ "Yearly" : "{year}" ,
32
+ "FinancialApril" : "{year}April" ,
33
+ "FinancialJuly" : "{year}July" ,
34
+ "FinancialOct" : "{year}Oct" ,
35
+ "FinancialNov" : "{year}Nov" ,
36
+ }
37
+
38
+ PAGE_REVIEWED_INDICATOR = "✓"
39
+
40
+ # Wrapper functions
17
41
@st .cache_data (show_spinner = False )
18
42
def get_results_wrapper (tally_sheet ):
19
43
"""A wrapper function for caching the get_results function."""
@@ -243,36 +267,12 @@ def evaluate_cells(table_dfs):
243
267
return table_dfs
244
268
245
269
246
-
247
- PAGE_REVIEWED_INDICATOR = "✓"
248
-
249
270
# Initializing session state variables that only need to be set on startup
250
271
if "initialised" not in st .session_state :
251
272
st .session_state ['initialised' ] = True
252
273
st .session_state ['upload_key' ] = 1000
253
274
st .session_state ['password_correct' ] = False
254
275
255
- # Hardcoded period types and formatting, probably won't update but can get them through API
256
- PERIOD_TYPES = {
257
- "Daily" : "{year}{month}{day}" ,
258
- "Weekly" : "{year}W{week}" ,
259
- "WeeklyWednesday" : "{year}WedW{week}" ,
260
- "WeeklyThursday" : "{year}ThuW{week}" ,
261
- "WeeklySaturday" : "{year}SatW{week}" ,
262
- "WeeklySunday" : "{year}SunW{week}" ,
263
- "BiWeekly" : "{year}Bi{week}" ,
264
- "Monthly" : "{year}{month}" ,
265
- "BiMonthly" : "{year}{month}B" ,
266
- "Quarterly" : "{year}{quarter_number}" ,
267
- "SixMonthly" : "{year}{semiyear_number}" ,
268
- "SixMonthlyApril" : "{year}April{semiyear_number}" ,
269
- "SixMonthlyNovember" : "{year}Nov{semiyear_number}" ,
270
- "Yearly" : "{year}" ,
271
- "FinancialApril" : "{year}April" ,
272
- "FinancialJuly" : "{year}July" ,
273
- "FinancialOct" : "{year}Oct" ,
274
- "FinancialNov" : "{year}Nov" ,
275
- }
276
276
277
277
# *****Page display*****
278
278
@@ -283,8 +283,6 @@ def evaluate_cells(table_dfs):
283
283
server_url = os .environ ["DHIS2_SERVER_URL" ]
284
284
dhis2 .configure_DHIS2_server (server_url = server_url )
285
285
286
- API_URL = f'{ dhis2 .DHIS2_SERVER_URL } /api/33/me'
287
-
288
286
# Initialize session state variables
289
287
if 'authenticated' not in st .session_state :
290
288
st .session_state ['authenticated' ] = False
@@ -298,7 +296,7 @@ def evaluate_cells(table_dfs):
298
296
placeholder = st .empty ()
299
297
300
298
def authenticate ():
301
- response = requests .get (API_URL , auth = HTTPBasicAuth (st .session_state ['username' ], st .session_state ['password' ]))
299
+ response = requests .get (f' { dhis2 . DHIS2_SERVER_URL } /api/33/me' , auth = HTTPBasicAuth (st .session_state ['username' ], st .session_state ['password' ]))
302
300
if response .status_code == 200 :
303
301
st .session_state ['authenticated' ] = True
304
302
st .session_state ['auth_failed' ] = False
0 commit comments