def initData(): """Load data and mappings from Raw data files and mapping files""" Patient.load() Med.load() Problem.load() Lab.load() Refill.load()
def initData(): """Load data and mappings from Raw data files and mapping files""" Patient.load() Med.load() Problem.load() Lab.load() Refill.load() VitalSigns.load() Immunization.load() Procedure.load() SocialHistory.load() FamilyHistory.load() Allergy.load()
def clients(): if (__user_has_reserve()) and (auth.has_membership(group_id='admin') == False): return json.dumps({'error': "Tiene reservas activas. Por favor, cancelelas antes de realizar una nueva."}) else: opengnsys = Ognsys(db) if opengnsys.set_apikey(request.post_vars.ou_id): lab = Lab(request.post_vars.ou_id, request.post_vars.lab_id) return json.dumps(lab.get_remote_clients()) else: return json.dumps({'error': "Error de acceso. Por favor compruebe configuración de usuario y contraseña de la OU"})
def initData(): """Load data and mappings from Raw data files and mapping files""" Patient.load() Med.load() Problem.load() Lab.load() Refill.load() VitalSigns.load() Immunization.load() Procedure.load() SocialHistory.load() FamilyHistory.load() ClinicalNote.load() Allergy.load()
def __init__(self, json_data): self.rooms = {r: Room(r) for r in json_data['rooms']} self.labs = {l: Lab(l) for l in json_data['labs']} self.courses = [ Course(*(c[v] for v in [ "credits", "subj", "num", "lab", "room", "faculty", "conflicts" ])) for c in json_data['courses'] ] def get_info(person): days = [Day.MON, Day.TUE, Day.WED, Day.THU, Day.FRI] masked = functools.reduce( operator.or_, (d for d, m in zip(days, person['days']) if m)) low, high = person['times'] return masked, hhmm_to_timeid(*low), hhmm_to_timeid(*high) self.faculty = { x: get_info(json_data['faculty'][x]) for x in json_data['faculty'] } self.ranges = defaultdict(lambda: [0, 0]) def generate_slots(): low = TimeSlot.min_id() for credits in [3, 4]: yield from time_slots(credits) high = TimeSlot.max_id() self.ranges[credits] = [low, high] low = TimeSlot.max_id() + 1 self.slots = list(generate_slots()) self.constraints = self._build()
def initData(): """Load data and mappings from Raw data files and mapping files""" Patient.load() VitalSigns.load() Lab.load() Procedure.load() Immunization.load() FamilyHistory.load() SocialHistory.load() Condition.load() Med.load() Refill.load() Document.load() Allergy.load() ClinicalNote.load() Practitioner.load() Coverage.load() ExplanationOfBenefit.load()
def __init__(self, *, name: str, python_file: str, comment: str, check_repo_dirty: Optional[bool], is_log_python_file: Optional[bool]): """ ### Create the experiment :param name: name of the experiment :param python_file: `__file__` that invokes this. This is stored in the experiments list. :param comment: a short description of the experiment :param check_repo_dirty: whether not to start the experiment if there are uncommitted changes. The experiments log keeps track of `python_file`, `name`, `comment` as well as the git commit. Experiment maintains the locations of checkpoints, logs, etc. """ self.lab = Lab(python_file) if check_repo_dirty is None: check_repo_dirty = self.lab.check_repo_dirty if is_log_python_file is None: is_log_python_file = self.lab.is_log_python_file self.info = ExperimentInfo(self.lab, name) self.check_repo_dirty = check_repo_dirty experiment_path = pathlib.Path(self.info.experiment_path) if not experiment_path.exists(): experiment_path.mkdir(parents=True) self.trial = Trial.new_trial(python_file=python_file, trial_time=time.localtime(), comment=comment) repo = git.Repo(self.lab.path) self.trial.commit = repo.head.commit.hexsha self.trial.commit_message = repo.head.commit.message.strip() self.trial.is_dirty = repo.is_dirty() self.trial.diff = repo.git.diff() self.__progress_saver = _ExperimentProgressSaver( trial=self.trial, trials_log_file=self.info.trials_log_file, is_log_python_file=is_log_python_file) checkpoint_saver = self._create_checkpoint_saver() self.logger = Logger(progress_saver=self.__progress_saver, checkpoint_saver=checkpoint_saver)
def __init__(self, test_config, lab_config): self.log.info('[__init__]: Initializing Test...') self.results = [] ########### # THE LAB # ########### self.log.info('[__init__]: Creating lab...') if lab_config: self.lab = Lab(lab_config) else: raise Exception( "Exception: [Test::__init__]: Lab config not found!")
def concretize(map: Dict) -> Iterable[Dict]: for t in TimeSlot.get(map["time"]).times(): yield { "id": map["name"], "loc": Room.get(map["room"]), "fac": map["faculty"], "time": t } if 'lab' in map and map['lab']: yield { "id": map["name"], "loc": Lab.get(map["lab"]), "fac": map["faculty"], "time": TimeSlot.get(map["time"]).lab_time() }
def load(filename): with open(filename) as f: data = json.load(f) ROOMS = {r: Room(r) for r in data['rooms']} LABS = {l: Lab(l) for l in data['labs']} COURSES = [ Course(*(c[v] for v in ["subj", "num", "lab", "room", "faculty", "conflicts"])) for c in data['courses'] ] def get_info(person): days = [Day.MON, Day.TUE, Day.WED, Day.THU, Day.FRI] masked = functools.reduce( operator.or_, (d for d, m in zip(days, person['days']) if m)) low, high = person['times'] return masked, low * 60, high * 60 FACULTY = {x: get_info(data['faculty'][x]) for x in data['faculty']} return (ROOMS, LABS, COURSES, FACULTY)
sn = entry.sn.value return "{} {}".format(givenName, sn) if __name__ == "__main__": labs = list() LDAP_server = Server(settings.LDAP_SERVER, use_ssl=True, get_info=ALL) conn = Connection(LDAP_server, auto_bind=True) conn.search(settings.LDAP_BASE_DN, settings.LDAP_SEARCH_FILTER, attributes=settings.LDAP_ATTRIBUTES_TO_RETURN) for entry in conn.entries: lab = Lab() lab.name = entry.cn.value.upper() lab.description = get_longest_string(entry.ou.values) lab.url = "https://{}.epfl.ch".format(entry.cn.value) lab.faculties = get_faculty_name(entry.entry_dn) lab.professors = get_professors(entry.unitManager.value) labs.append(lab) # Finds the current_running_path = os.path.dirname(__file__) absolute_output_path = os.path.join(current_running_path, settings.OUTPUT_FILE) with open(settings.OUTPUT_FILE, 'w', newline='') as csvfile: entryWriter = csv.writer(csvfile, delimiter=',',
block.append(c == m[d]) s.add(z3.simplify(z3.Not(z3.And(*block)))) else: # failed or limit -- print stats of last check print(s.statistics()) if __name__ == '__main__': if len(sys.argv) < 2: print(f"Usage: {sys.argv[0]} <json_config> [limit=10]") exit(1) limit = 10 if len(sys.argv) == 2 else int(sys.argv[2]) print(f"> Using limit={limit}") init_data(sys.argv[1]) print("> Initialized data") C = make_constraints() print("> Made all constraints") for i, m in get_models(C, limit): print(f'Model {i}:') for c in COURSES: timeslot = str(TimeSlot.get(m.eval(c.time()).as_long())) room = str(Room.get(m.eval(c.room()).as_long())) lab = 'None' if not c.labs else str( Lab.get(m.eval(c.lab()).as_long())) print(f'{c},{c.faculty},{room},{lab},{timeslot}') try: input('press <enter> for the next schedule (or Ctrl+D) to quit') except: exit(0)
def __init__(self): self._lab = Lab()
from tk_wig import Tk_rt, PM_Menu #Root window root = Tk_rt("Materials Physics") #Main frame: container for everything else main_frm = tk.Frame(root) main_frm.pack(fill=tk.BOTH, expand=1) #Toolbars add_mem_bar = Add_mem(main_frm) add_sup_bar = Add_sup(main_frm) add_load_bar = Add_load(main_frm) #"Materials" Lab with canvas mlab = Lab(main_frm, add_mem_bar, add_sup_bar, add_load_bar) #Menu bar menubar = PM_Menu(root, mlab) root.config(menu=menubar) def cleanup(): mlab.cleanup() root.destroy() root.protocol("WM_DELETE_WINDOW", cleanup) #Start root.mainloop()
def list_experiments(lab: Lab, logger: Logger): experiments = lab.get_experiments() names = [e.name for e in experiments] names.sort() logger.info(names)
def labAllocate(mydb, c, s1, s2, labs, s, f, allocid): print(c) mycursor = mydb.cursor() mycursor.execute("SELECT building, ID FROM lab WHERE Type = 'Computer-1';") myresult = mycursor.fetchall() for x in myresult: flag1 = 0 for y in labs: if y.Lid == x[1]: flag1 = 1 break if flag1 == 0: l = Lab(x[0], x[1]) labs.append(l) iter1 = 0 while (iter1 < len(labs)): if s1 in labs[iter1].slotfree and s2 in labs[iter1].slotfree: labs[iter1].slotfree.remove(s1) labs[iter1].slotfree.remove(s2) labs[iter1].slotfixed.append(s1) labs[iter1].slotfixed.append(s1) s.slotfree.remove(s1) s.slotfree.remove(s2) s.slotfixed.append(s1) s.slotfixed.append(s2) f.slotfree.remove(s1) f.slotfree.remove(s2) f.slotfixed.append(s1) f.slotfixed.append(s2) # print(allocid," ",f) # for z in faculties: # print(z) # INSERT INTO facultyallocation VALUES(50017, 30000018, 7, 'Tuesday', '15CSE302'); # INSERT INTO sectionallocation VALUES(50017, 'A', 'CSE', 5, 7, 'Tuesday'); # INSERT INTO laballocation VALUES(50017, '800', 'AB2', 7, 'Tuesday'); ts, day1 = getTsDay(s1) ts1 = ts + 1 # print(ts,day1) facid = list(f.Fid) facid = str(facid[0]) allocid1 = allocid + 1 print(allocid, " ", facid, " ", ts, " ", day1, " ", c.Cid) sqlQ = "INSERT INTO facultyallocation1 VALUES(" + str( allocid) + "," + facid + "," + str( ts) + ",\'" + day1 + "\',\'" + c.Cid + "\');" mycursor.execute(sqlQ) # mydb.commit() print(allocid1, " ", facid, " ", ts, " ", day1, " ", c.Cid) sqlQ = "INSERT INTO facultyallocation1 VALUES(" + str( allocid1) + "," + facid + "," + str( ts1) + ",\'" + day1 + "\',\'" + c.Cid + "\');" mycursor.execute(sqlQ) # mydb.commit() print(allocid, " ", s.Sid, " ", s.Sdept, " ", s.Ssem, " ", ts, " ", day1) sqlQ = "INSERT INTO sectionallocation1 VALUES(" + str( allocid) + ",\'" + s.Sid + "\',\'" + s.Sdept + "\'," + str( s.Ssem) + "," + str(ts) + ",\'" + day1 + "\');" mycursor.execute(sqlQ) # mydb.commit() print(allocid1, " ", s.Sid, " ", s.Sdept, " ", s.Ssem, " ", ts, " ", day1) sqlQ = "INSERT INTO sectionallocation1 VALUES(" + str( allocid1) + ",\'" + s.Sid + "\',\'" + s.Sdept + "\'," + str( s.Ssem) + "," + str(ts1) + ",\'" + day1 + "\');" mycursor.execute(sqlQ) # mydb.commit() print(allocid, " ", labs[iter1].Lid, " ", labs[iter1].Lbuilding, " ", s.Ssem, " ", ts, " ", day1) sqlQ = "INSERT INTO laballocation1 VALUES(" + str( allocid) + ",\'" + str(labs[iter1].Lid) + "\',\'" + str( labs[iter1].Lbuilding) + "\'," + str( ts) + ",\'" + day1 + "\');" mycursor.execute(sqlQ) # mydb.commit() print(allocid1, " ", labs[iter1].Lid, " ", labs[iter1].Lbuilding, " ", s.Ssem, " ", ts, " ", day1) sqlQ = "INSERT INTO laballocation1 VALUES(" + str( allocid1) + ",\'" + str(labs[iter1].Lid) + "\',\'" + str( labs[iter1].Lbuilding) + "\'," + str( ts1) + ",\'" + day1 + "\');" mycursor.execute(sqlQ) mydb.commit() allocid += 2 return allocid else: iter1 += 1 return -1