dump new
Signed-off-by: Hilmar Magnusson <hilmarmag@protonmail.com>
This commit is contained in:
		
							parent
							
								
									d608f3fc6f
								
							
						
					
					
						commit
						5672217c5c
					
				
							
								
								
									
										4
									
								
								data/cases.csv
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								data/cases.csv
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,4 @@
 | 
				
			||||||
 | 
					CaseID,PatientID,Station,EKT,Erhaltung,Ket,Date
 | 
				
			||||||
 | 
					1,21-239,1,15,0,no,28/11/2024
 | 
				
			||||||
 | 
					2,21-237,0,22,1,no,29/11/2024
 | 
				
			||||||
 | 
					3,21-238,3,12,1,no,30/11/2024
 | 
				
			||||||
		
		
			
  | 
							
								
								
									
										12
									
								
								data/patients.csv
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								data/patients.csv
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,12 @@
 | 
				
			||||||
 | 
					Id,PatientID,Patient,Station
 | 
				
			||||||
 | 
					1,21-239,Hans Zimmer,1
 | 
				
			||||||
 | 
					2,21-237,Lina Gruber,0
 | 
				
			||||||
 | 
					3,21-238,Victoria J,3
 | 
				
			||||||
 | 
					4,21-229,Hilmario Maggio,3
 | 
				
			||||||
 | 
					5,21-249,Egon Schiele,2
 | 
				
			||||||
 | 
					6,21-219,Hans Landa,1
 | 
				
			||||||
 | 
					7,21-213,Gregor Samsa,1
 | 
				
			||||||
 | 
					8,21-222,Johanne,2
 | 
				
			||||||
 | 
					9,21-223,Angela Merkel,1
 | 
				
			||||||
 | 
					10,21-240,Britney Spears,3
 | 
				
			||||||
 | 
					11,21-241,Madonna,0
 | 
				
			||||||
		
		
			
  | 
							
								
								
									
										5
									
								
								data/sessions.csv
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								data/sessions.csv
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,5 @@
 | 
				
			||||||
 | 
					SessionID,Date,Start,End,Duration,ConsultantID,Specialty
 | 
				
			||||||
 | 
					1001,03/06/2020,08:30:00,18:00:00,570,11,Ophthalmology
 | 
				
			||||||
 | 
					1002,10/06/2020,08:30:00,18:00:00,570,11,Ophthalmology
 | 
				
			||||||
 | 
					1003,17/06/2020,08:30:00,18:00:00,570,11,Ophthalmology
 | 
				
			||||||
 | 
					1004,25/06/2020,08:30:00,13:00:00,270,11,Ophthalmology
 | 
				
			||||||
		
		
			
  | 
							
								
								
									
										8
									
								
								opt.py
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								opt.py
									
									
									
									
									
								
							| 
						 | 
					@ -3,6 +3,7 @@ solver = SolverFactory('glpk')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import pandas as pd
 | 
					import pandas as pd
 | 
				
			||||||
import pyomo.environ as pyo
 | 
					import pyomo.environ as pyo
 | 
				
			||||||
 | 
					import datetime
 | 
				
			||||||
# Create a model
 | 
					# Create a model
 | 
				
			||||||
model = pyo.ConcreteModel()
 | 
					model = pyo.ConcreteModel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -54,6 +55,11 @@ def date2int(date):
 | 
				
			||||||
    week = int((delta - day)/7)
 | 
					    week = int((delta - day)/7)
 | 
				
			||||||
    return week,day
 | 
					    return week,day
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def int2date(week, day):
 | 
				
			||||||
 | 
					    d0 = pd.to_datetime("25/11/2024", dayfirst=True)
 | 
				
			||||||
 | 
					    delta = datetime.timedelta(days = 7*week + day)
 | 
				
			||||||
 | 
					    date = d0 + delta
 | 
				
			||||||
 | 
					    return date
 | 
				
			||||||
 | 
					
 | 
				
			||||||
path = '/home/hmag/code/pyomo/data'
 | 
					path = '/home/hmag/code/pyomo/data'
 | 
				
			||||||
my = Scheduler(path+'/cases.csv', path+'/sessions.csv', path+'/patients.csv')
 | 
					my = Scheduler(path+'/cases.csv', path+'/sessions.csv', path+'/patients.csv')
 | 
				
			||||||
| 
						 | 
					@ -67,3 +73,5 @@ print(my.df_cases['Date'][0])
 | 
				
			||||||
date = my.df_cases['Date'][0]
 | 
					date = my.df_cases['Date'][0]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
print(date2int(date))
 | 
					print(date2int(date))
 | 
				
			||||||
 | 
					print(int2date(1,0))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user