def save_contents(self): for url in self.trainsite_breif_list_www: html = self.check_link(url) if html.xpath('//tr/td/center/a[contains(text(),"点此可查询上一版本数据")]' ): # xpath 模糊匹配 continue else: checi = html.xpath('//tr[1]/td[3]/text()')[2] if '/' in checi: for checi_i in checi.split('/'): self.dist_info['trainsite_id'] = checi_i self.dist_info['time_long'] = html.xpath( '//tr[1]/td[5]/text()')[1] self.dist_info['start_station'] = html.xpath( '//tr[2]/td[2]/text()')[0] self.dist_info['end_station'] = html.xpath( '//tr[2]/td[4]/text()')[0] self.dist_info['start_time'] = html.xpath( '//tr[3]/td[2]/text()')[0] self.dist_info['end_time'] = html.xpath( '//tr[3]/td[4]/text()')[0] self.dist_info['trainsite_type'] = html.xpath( '//tr[4]/td[2]/text()')[0] self.dist_info['mile'] = html.xpath( '//tr[4]/td[4]/text()')[0] self.dist_info['update_day'] = html.xpath( '//tr[5]/td[1]/text()')[0].split(' ')[1] database_handler.DatabaseHandler().insert_into_mysql( self.dist_info) else: self.dist_info['trainsite_id'] = html.xpath( '//tr[1]/td[3]/text()')[2] self.dist_info['time_long'] = html.xpath( '//tr[1]/td[5]/text()')[1] self.dist_info['start_station'] = html.xpath( '//tr[2]/td[2]/text()')[0] self.dist_info['end_station'] = html.xpath( '//tr[2]/td[4]/text()')[0] self.dist_info['start_time'] = html.xpath( '//tr[3]/td[2]/text()')[0] self.dist_info['end_time'] = html.xpath( '//tr[3]/td[4]/text()')[0] self.dist_info['trainsite_type'] = html.xpath( '//tr[4]/td[2]/text()')[0] self.dist_info['mile'] = html.xpath( '//tr[4]/td[4]/text()')[0] self.dist_info['update_day'] = html.xpath( '//tr[5]/td[1]/text()')[0].split(' ')[1] database_handler.DatabaseHandler().insert_into_mysql( self.dist_info) print('\033[1;33;0m 完成爬取 \033[0m') self.trainsite_breif_list_www.clear()
def __init__(self): client = Client('****', '****') logging.basicConfig( format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO) self.order_id = 0 self.has_trade = False self.cur_thread = None self.cur_thread_started_at = 0 self.file_last_modified = os.path.getmtime('main.py') self.tele = telegram_bot.Telegram(self) self.db = database_handler.DatabaseHandler(self.tele, False) self.db.create_trading_session() self.db.delete_tests() # self.db.delete_old_strategies() self.db.send_balance_image() self.strategies = [] self.create_primary_strategy() self.db.set_strategies(self.strategies) self.db.set_balance(1000, strategy='primary') # load ai self.clf = load('tests/ai.joblib') with_strategy_test = False if len(sys.argv) > 1: with_strategy_test = sys.argv[1] == 'True' if not with_strategy_test: bm = BinanceSocketManager(client) bm.start_symbol_ticker_socket('BTCUSDT', self.test_tick) bm.start()
def test_user(name="user1"): handler = db.DatabaseHandler(name) #handler.clear_table() handler.create_table(name) for movie in my_movies: handler.store(movie) handler.print_table() print(handler.get_rating("Bad Boys for Life")) handler.close_connection()
def main(): from_date = date(2020, 3, 1) to_date = date(2020, 3, 13) month = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ] with open('databases/state_codes.json') as state_codes: state_dict = json.load(state_codes) state_list = list(state_dict.keys()) sql_db = dbhl.DatabaseHandler(from_date, to_date) # api_url = 'https://api.covid19india.org/states_daily.json' api_url = 'https://data.covid19india.org/v4/min/timeseries.min.json' # try: # with open('databases/states_daily.json', 'r', encoding='utf-8') as daily_file: # states_daily_json = json.load(daily_file) # states_daily_list = states_daily_json['states_daily'] # except FileNotFoundError: states_daily_response = requests.get(api_url) states_daily_json = json.loads(states_daily_response.text) states_daily_list = states_daily_json #['states_daily'] with open('databases/states_daily.json', 'w', encoding='utf-8') as daily_file: json.dump(states_daily_json, daily_file, ensure_ascii=False, indent=4) daily_confirmed = {} daily_recovered = {} daily_deceased = {} for state in state_list: # State counts from 1st March till 13th March _, confirmed_count = sql_db.get_total_count(state, cumulative=False) _, recovered_count = sql_db.get_recovered_count(state, cumulative=False) _, deceased_count = sql_db.get_deceased_count(state, cumulative=False) daily_confirmed[state] = confirmed_count.tolist() daily_recovered[state] = recovered_count.tolist() daily_deceased[state] = deceased_count.tolist() for item in states_daily_list: case = item['status'] for state, count in item.items(): if state == 'status' or state == 'date' or state == 'un' or state == "dateymd": continue state = state.upper() if count == '': count = 0 count = int(count) if case == 'Confirmed': daily_confirmed[state].append(count) elif case == 'Recovered': daily_recovered[state].append(count) elif case == 'Deceased': daily_deceased[state].append(count)
def build_bd(): """创建数据库""" config = configparser.ConfigParser() config.read('db.conf') info = config['DEFAULT'] dbh = database_handler.DatabaseHandler(db_name=info['db_name']) dbh.create_table(table_name=info['table_name'], columns=json.loads(info['columns']))
async def load_game(self, send_messages: bool = True): """ Load the player's information from the database if it is not already loaded. If the user does not exist, create them. :param send_messages: If the messages should be sent or not. They do not need to be resent if using a reaction, as the image will reload instead. """ self.all_user_info, database_messages = await database_handler.DatabaseHandler( ).load_player_info(self.all_user_info, self.user_object, self.bot) self.main_embed = main_game_window.MainGameWindow( self.all_user_info[self.user_name], self.user_name, self.direction).play_game() self.inventory_embed = inventory_window.InventoryWindow( self.all_user_info[self.user_name], self.user_name, self.direction).display_inventory() # # Send info and error message # for message, message_type in [[message, message_type] # for file_type in [self.inventory_embed['messages'], # self.main_embed['messages'], # database_messages] # for message_type in file_type # for message in file_type[message_type]]: # # Coming from a reaction # if not send_messages: # channel = await self.bot.fetch_channel(self.reaction_payload.channel_id) # await channel.send(f'{message_type.upper()}: {message}') # # # Coming from a regular message # else: # await self.message.channel.send(f'{message_type.upper()}: {message}') # Send embeds for the game windows if send_messages: for embed, embed_type, reactions, _ in [ self.inventory_embed.values(), self.main_embed.values() ]: message_sent = await self.channel.send('', embed=embed) self.all_user_info[self.user_name]['PreviousMessages'][ embed_type] = message_sent await self.add_reactions(message_sent, reactions) # Save the user dictionary to the database database_handler.DatabaseHandler().save_user_info_to_table( self.all_user_info, self.user_name, self.user_id) # Reset variables self.direction = None
def __init__(self, sbgnviz_port=3000): self.sbgnviz_port = sbgnviz_port self.user_id = '%s' % uuid.uuid4() self.user_name = 'CA' self.color_code = '#ff46a7' self.room_id = '' self.current_users = [] if len(sys.argv) == 1: path = _resource_dir else: path = sys.argv[1] self.db_handler = database_handler.DatabaseHandler(path) self.connect_sbgnviz()
def executeCustomBehavior(self, last_execution_date_override=None): # Initialize behaviors # ==================== self.map_handler_ = MapHandlingBehavior("MapHandlingBehavior", self.application_status_) self.dry_cleaner_ = DryCleaningBehavior("DryCleaningBehavior", self.application_status_) self.wet_cleaner_ = WetCleaningBehavior("WetCleaningBehavior", self.application_status_) # Load data from the robot device # =============================== # todo: read out these parameters if rospy.has_param('robot_frame'): self.robot_frame_id_ = rospy.get_param("robot_frame") self.printMsg("Imported parameter robot_frame = " + str(self.robot_frame_id_)) # todo: write into database ??? (rmb-ma) else: self.robot_frame_id_ = 'base_link' self.printMsg( "Parameter robot_frame_id assigned to default value '{}'". format(self.robot_frame_id_)) if rospy.has_param('robot_radius'): self.robot_radius_ = rospy.get_param("robot_radius") self.printMsg("Imported parameter robot_radius = " + str(self.robot_radius_)) else: self.robot_radius_ = 0.325 self.printMsg( "Parameter robot_radius assigned to default value '{}'".format( self.robot_radius_)) if rospy.has_param('coverage_radius'): self.coverage_radius_ = rospy.get_param("coverage_radius") self.printMsg("Imported parameter robot_radius = " + str(self.coverage_radius_)) else: self.printMsg("Parameter coverage radius doesn't exist") return # todo: get field_of_view #self.robot_frame_id_ = 'base_link' #self.robot_radius_ = 0.2875 #0.325 # todo: read from MIRA #self.coverage_radius_ = 0.233655 #0.25 # todo: read from MIRA # self.field_of_view_ = [Point32(x=0.04035, y=0.136), Point32(x=0.04035, y=-0.364), # Point32(x=0.54035, y=-0.364), Point32(x=0.54035, y=0.136)] # todo: read from MIRA # self.field_of_view_ = [Point32(x=0.080, y=0.7), Point32(x=0.080, y=-0.7), # Point32(x=2.30, y=-0.7), Point32(x=2.30, y=0.7)] # todo: read from MIRA # rmb-ma. Fake fov to get nice trajectory self.field_of_view_ = [ Point32(x=-0.5, y=0.5), Point32(x=-0.5, y=-0.7), Point32(x=0.5, y=-0.7), Point32(x=0.5, y=0.7) ] # todo: read from MIRA self.field_of_view_origin_ = Point32(x=0.0, y=0.0) # todo: read from MIRA # todo: hack: cleaning device can be turned off for trade fair show self.use_cleaning_device_ = False if rospy.has_param('use_cleaning_device'): self.use_cleaning_device_ = rospy.get_param("use_cleaning_device") self.printMsg("Imported parameter use_cleaning_device = " + str(self.use_cleaning_device_)) # Load database, initialize database handler # ========================================== # Initialize and load database self.printMsg("Loading database from files...") rospack = rospkg.RosPack() print str(rospack.get_path('baker_wet_cleaning_application')) self.database_ = database.Database(extracted_file_path=str( rospack.get_path('baker_wet_cleaning_application') + "/resources")) self.database_handler_ = database_handler.DatabaseHandler( self.database_) if self.database_.application_data_.last_planning_date_ is None: self.database_.application_data_.last_planning_date_ = datetime.datetime( datetime.MINYEAR, 1, 1) if self.database_.application_data_.last_execution_date_ is None: self.database_.application_data_.last_execution_date_ = datetime.datetime( datetime.MINYEAR, 1, 1) days_delta = datetime.datetime.now( ) - self.database_.application_data_.last_execution_date_ print("-- CURRENT_DATE: " + str(datetime.datetime.now())) print("-- LAST_EXECUTION_DATE: " + str(self.database_.application_data_.last_execution_date_)) print("-- LAST_PLANNING_DATE_0: " + str(self.database_.application_data_.last_planning_date_[0])) print("-- DAYS_DELTA: " + str(days_delta) + " " + str(days_delta.days)) print("-- PLANNING_OFFSET: " + str(self.database_.application_data_.planning_offset_)) shall_continue_old_cleaning = self.database_.application_data_.progress_[ 0] == 1 and days_delta.days == 0 if self.database_.application_data_.progress_[ 0] == 1 and days_delta.days != 0: self.printMsg( "ERROR: Dates do not match! Shall the old progress be discarded?" ) # TODO: Programm needs to pause here. Then the user must be asked if the old cleaning state shall be overwritten. else: self.database_.application_data_.progress_ = [ 1, datetime.datetime.now() ] self.database_handler_.applyChangesToDatabase() # Document start of the application # Also determine whether an old task is to be continued, independent of the current date # If datetime "last_execution_date_override" is not None, it will be set in the database. if last_execution_date_override is None: self.database_.application_data_.last_execution_date_ = datetime.datetime.now( ) else: self.database_.application_data_.last_execution_date_ = last_execution_date_override if self.handleInterrupt() >= 1: return # Find and sort all due rooms # =========================== (rooms_dry_cleaning, rooms_wet_cleaning ) = self.computeAndSortDueRooms(shall_continue_old_cleaning) if self.handleInterrupt() >= 1: return # Dry cleaning of the due rooms # ============================= self.processDryCleaning(rooms_dry_cleaning, is_overdue=False) if self.handleInterrupt() >= 1: return self.checkProcessDryCleaning(rooms_dry_cleaning) if self.handleInterrupt() >= 1: return # Wet cleaning of the due rooms # ============================= self.processWetCleaning(rooms_wet_cleaning, is_overdue=False) if self.handleInterrupt() >= 1: return self.checkProcessWetCleaning(rooms_wet_cleaning) if self.handleInterrupt() >= 1: return # Find and sort all overdue rooms # =============================== self.database_handler_.computeAllOverdueRooms() (rooms_dry_cleaning, rooms_wet_cleaning) = self.database_handler_.sortRoomsList( self.database_handler_.overdue_rooms_) # Document completed due rooms planning in the database self.database_.application_data_.last_planning_date_[ 1] = datetime.datetime.now() self.database_handler_.applyChangesToDatabase() # Dry cleaning of the overdue rooms # ================================= #self.processDryCleaning(rooms_dry_cleaning, is_overdue=True) self.checkProcessDryCleaning(rooms_dry_cleaning) if self.handleInterrupt() >= 1: return # Wet cleaning of the overdue rooms # ================================= #self.processWetCleaning(rooms_wet_cleaning, is_overdue=True) self.checkProcessWetCleaning(rooms_wet_cleaning) if self.handleInterrupt() >= 1: return # Complete application # ==================== self.printMsg("Cleaning completed. Overwriting database...") self.database_.application_data_.progress_ = [ 0, datetime.datetime.now() ] self.database_handler_.cleaningFinished()
from fastapi import FastAPI from pydantic import BaseModel import configparser import json import database_handler import method app = FastAPI() config = configparser.ConfigParser() config.read('db.conf') info = config['DEFAULT'] dbh = database_handler.DatabaseHandler(db_name=info['db_name'], check_same_thread=False) m = method.Method(conf_file='db.conf') class Schedule(BaseModel): sid: str # ID name: str # 名称 content: str # 内容 category: str # 分类 level: int # 重要程度, 0: 未定义 1: 低 2: 中 3: 高 status: float # 当前进度, 0 <= status <= 1 creation_time: str # 创建时间 start_time: str # 开始时间 end_time: str # 结束时间
def executeCustomBehavior(self, last_execution_date_override=None): # Initialize behaviors # ==================== self.map_handler_ = map_handling_behavior.MapHandlingBehavior( "MapHandlingBehavior", self.application_status_) self.dry_cleaner_ = dry_cleaning_behavior.DryCleaningBehavior( "DryCleaningBehavior", self.application_status_) self.wet_cleaner_ = wet_cleaning_behavior.WetCleaningBehavior( "WetCleaningBehavior", self.application_status_) # Load data from the robot device # =============================== # todo: read out these parameters if rospy.has_param('robot_frame'): self.robot_frame_id_ = rospy.get_param("robot_frame") self.printMsg("Imported parameter robot_frame = " + str(self.robot_frame_id_)) # todo: write into database if rospy.has_param('robot_radius'): self.robot_radius_ = rospy.get_param("robot_radius") self.printMsg("Imported parameter robot_radius = " + str(self.robot_radius_)) if rospy.has_param('coverage_radius'): self.coverage_radius_ = rospy.get_param("coverage_radius") self.printMsg("Imported parameter robot_radius = " + str(self.coverage_radius_)) # todo: get field_of_view self.field_of_view_ = [ Point32(x=0.04035, y=0.136), Point32(x=0.04035, y=-0.364), Point32(x=0.54035, y=-0.364), Point32(x=0.54035, y=0.136) ] # todo: read from MIRA # Load database, initialize database handler # ========================================== # Initialize and load database #try: self.printMsg("Loading database from files...") rospack = rospkg.RosPack() print str(rospack.get_path('baker_wet_cleaning_application')) self.database_ = database.Database(extracted_file_path=str( rospack.get_path('baker_wet_cleaning_application') + "/")) self.database_.loadDatabase() #except: # self.printMsg("Fatal: Loading of database failed! Stopping application.") # exit(1) # Initialize database handler #try: self.database_handler_ = database_handler.DatabaseHandler( self.database_) #except: # self.printMsg("Fatal: Initialization of database handler failed!") # exit(1) shall_continue_old_cleaning = False days_delta = datetime.datetime.now( ) - self.database_.application_data_.last_execution_date_ print "------------ CURRENT_DATE: " + str(datetime.datetime.now) print "------------ LAST_DATE: " + str( self.database_.application_data_.last_execution_date_) print "------------ DAYS_DELTA: " + str(days_delta) + " " + str( days_delta.days) if (self.database_.application_data_.progress_[0] == 1): if (days_delta.days == 0): shall_continue_old_cleaning = True else: self.printMsg( "ERROR: Dates do not match! Shall the old progress be discarded?" ) # TODO: Programm needs to pause here. Then the user must be asked if the old cleaning state shall be overwritten. else: self.database_.application_data_.progress_ = [ 1, datetime.datetime.now() ] self.database_handler_.applyChangesToDatabase() # Document start of the application # Also determine whether an old task is to be continued, independent of the current date # If datetime "last_execution_date_override" is not None, it will be set in the database. if (last_execution_date_override == None): self.database_.application_data_.last_execution_date_ = datetime.datetime.now( ) else: self.database_.application_data_.last_execution_date_ = last_execution_date_override # Interruption opportunity if self.handleInterrupt() == 2: return # Find and sort all due rooms # =========================== # Find due rooms self.printMsg("Collecting due rooms...") if ((self.database_handler_.noPlanningHappenedToday() == True) and (shall_continue_old_cleaning == False)): #try: self.database_handler_.restoreDueRooms() self.database_handler_.getAllDueRooms() print len(self.database_.rooms_) for room in self.database_handler_.due_rooms_: print room.room_name_ #except: # self.printMsg("Fatal: Collecting of the due rooms failed!") # exit(1) else: #try: self.database_handler_.restoreDueRooms() #except: # self.printMsg("Fatal: Restoring of the due rooms failed!") # exit(1) # Sort the due rooms with respect to cleaning method self.printMsg("Sorting the found rooms after cleaning method...") #try: rooms_dry_cleaning, rooms_wet_cleaning = self.database_handler_.sortRoomsList( self.database_handler_.due_rooms_) for room in rooms_dry_cleaning: self.printMsg(str(room.room_name_) + " ---> DRY") for room in rooms_wet_cleaning: self.printMsg(str(room.room_name_) + " ---> WET") #except: # self.printMsg("Fatal: Sorting after the cleaning method failed!") # exit(1) # Document completed due rooms planning in the database self.database_.application_data_.last_planning_date_[ 0] = datetime.datetime.now() self.database_handler_.applyChangesToDatabase() # Interruption opportunity if self.handleInterrupt() == 2: return # Dry cleaning of the due rooms # ============================= self.processDryCleaning(rooms_dry_cleaning, False) # Interruption opportunity if self.handleInterrupt() == 2: return # Wet cleaning of the due rooms # ============================= self.processWetCleaning(rooms_wet_cleaning, False) # Interruption opportunity if self.handleInterrupt() == 2: return # Find and sort all overdue rooms # =============================== # Find overdue rooms self.printMsg("Collecting overdue rooms...") #try: self.database_handler_.getAllOverdueRooms() #except: # self.printMsg("Fatal: Collecting of the over rooms failed!") # exit(1) # Sort the overdue rooms after cleaning method self.printMsg("Sorting the found rooms after cleaning method...") #try: rooms_dry_cleaning, rooms_wet_cleaning = self.database_handler_.sortRoomsList( self.database_handler_.overdue_rooms_) #except: # self.printMsg("Fatal: Sorting after the cleaning method failed!") # exit(1) # Document completed due rooms planning in the database self.database_.application_data_.last_planning_date_[ 1] = datetime.datetime.now() self.database_handler_.applyChangesToDatabase() # Dry cleaning of the overdue rooms # ================================= self.processDryCleaning(rooms_dry_cleaning, True) # Interruption opportunity if self.handleInterrupt() == 2: return # Wet cleaning of the overdue rooms # ================================= self.processWetCleaning(rooms_wet_cleaning, True) # Interruption opportunity if self.handleInterrupt() == 2: return # COMPLETE APPLICATION # ==================== self.printMsg("Cleaning completed. Overwriting database...") #try: self.database_.application_data_.progress_ = [ 0, datetime.datetime.now() ] self.database_handler_.cleaningFinished()
def main(): dbHandler = database_handler.DatabaseHandler() ended = time.time() * 1000 STATUS_READY = "Ready" username = "******" result = { 'oldMeanError': 0.0, 'oldErrors': [-3.0, 3.0, 0.0, 0.0], 'currentMeanError': 0.0, 'currentErrors': [-3.0, 3.0, 0.0, 0.0] } analysisTaskID = "analysistask_1435306425.698266" #database.create_user(";", "Jani", "Yli-Kantola", "Jani", "a password", "Nurse", "") #database.create_user(self, username, firstName, lastName, newUsername, password, jobTitle, ): #database.create_exerciseresult("user", "ss", "ws","dr","","","","") #database.create_data("none", "this be dataid", "this be deviceid", "sample; sample; sample; sample; sample;sample") #database.add_exerciseresult("","Evalan_rehab_test", "1sd23s9") #print database.list_analysistasks("user", "analysistask_1", "notification", "modified") #print dbHandler.update_analysistask(username=username, analysisTaskID=analysisTaskID, field="analysisResult", value=str(result)) #print dbHandler.update_analysistask(username=username, analysisTaskID=analysisTaskID, field="status", value=STATUS_READY) #print dbHandler.update_analysistask(username=username, analysisTaskID=analysisTaskID, field="ended", value=ended) #print dbHandler.list_analysistasks("Tommi") #dbHandler.__get_organization_rights__("Evalan_u_1","Evalan_1" ) #dbHandler.__Patient_in_User__("Evalan_u_1","Evalan_test_patient") #print dbHandler.__permissionLevel_by_username__("Evalan_u_1") #print dbHandler.list_usergroups("Evalan_u_1") #print dbHandler.__userGroupID_by_username__("Evalan_u_1") #print dbHandler.__organizationID_by_username__("Evalan_u_1") #print dbHandler.get_usergroup("Jani_test_user_username", "usergroup1436188340.516476" ) #print dbHandler.create_analysistask("Evalan_u_1", "Test task", "","","","","") #print dbHandler.update_usergroup(username="******", userGroupID="usergroup1438691764.082977", field="name", value="Tes_group_34") #print dbHandler.list_rehabilitationsets("Evalan_u_1") #print dbHandler.__organizationID_by_username__("Evalan_u_1") #print dbHandler.__permissionLevel_by_username__("Evalan_u_1") #print dbHandler.add_user_to_usergroup(username="******", userGroupID="usergroup1438693886.170913", userID="user_id_1") #print dbHandler.add_user_to_usergroup(username="******", userGroupID="usergroup1438693886.170913", userID="user_id_8") #print dbHandler.remove_user_from_usergroup(username="******", userGroupID="usergroup1438693886.170913", userID="user_id_7") #print dbHandler.get_user("Jani_test_user_username", "user_1438773019.000986" ) #print dbHandler.update_user(username="******", userID="user_1438776975.655928", field="firstName", value="firstANDsecond") #print dbHandler.delete_user("Jani_test_user_username" , "user_1438778823.524638" ) #print dbHandler.add_patient_to_user(username="******", userID="user_1438779915.942370", patientID="patient_E" ) #print dbHandler.list_patients("Jani_test_user_username") #print dbHandler.get_patient(username="******", patientID="patient_1438864828.349008") #print dbHandler.add_allowed_organization_to_patient(username="******", patientID="patient_1438864828.349008", organizationID="firma") #print dbHandler.create_patientcondition(username="******", allowedOrganizations="organization_1438603110.140505", label="Otsikko", description="Kuvaus", officialMedicalCode="A-152") #print dbHandler.delete_patientinformation("Jani_test_user_username", "patientInformation1438944139.254825") #print dbHandler.add_allowed_organization_to_rehabilitationSet("Jani_test_user_username", "rehabilitationSetID1439291490.190416", "loltest" ) #print dbHandler.remove_allowed_organization_from_rehabilitationSet("Jani_test_user_username", "rehabilitationSetID1439291490.190416", "loltest") #print dbHandler.add_allowed_organization_to_patient("Jani_test_user_username", "testi-id", "testilol") #print dbHandler.remove_allowed_organization_from_patient("Jani_test_user_username", "testi-id", "testilol") #print dbHandler.add_allowed_organization_to_exerciseresult("Evalan_u_1", "evalan_exerciseresultid_1435325732.364940", "testilol") #print dbHandler.remove_allowed_organization_from_exerciseresult("Evalan_u_1", "evalan_exerciseresultid_1435325732.364940", "testilol") #print dbHandler.add_allowed_organization_to_exercise("Evalan_u_1", "Evalan_test_exercise", "testilol") #print dbHandler.remove_allowed_organization_from_exercise("Evalan_u_1", "Evalan_test_exercise", "testilol") #print dbHandler.add_allowed_organization_to_device("Evalan_u_1", "Evalan_test_device", "testilol") #print dbHandler.remove_allowed_organization_from_device("Evalan_u_1", "Evalan_test_device", "testilol") #print dbHandler.add_allowed_organization_to_data("Evalan_u_1", "dataset_1435325732.339890", "testilol") #print dbHandler.remove_allowed_organization_from_data("Evalan_u_1", "dataset_1435325732.339890", "testilol") #print dbHandler.add_allowed_organization_to_analysistask("Evalan_u_1", "analysistask_1439470035.342530", "testilol") #print dbHandler.remove_allowed_organization_from_analysistask("Evalan_u_1", "analysistask_1439470035.342530", "testilol") #print dbHandler.create_analysistask("Evalan_u_1", "Evalan_1;hopoti", "Tommis test task", "analysisModule", "status", "notification", "configurationParameters", 0, 0, analysisResult="") #print dbHandler.delete_analysistask("Evalan_u_1", "analysistask_1439798745.107000" ) #print dbHandler.create_patient("Evalan_u_1", "Evalan_1", "") #print dbHandler.delete_patient("Evalan_u_1", "patient_1439804212.542000" ) #print dbHandler.list_analysistasks(username="******") #print dbHandler.get_usergroup_by_username(username).organizationID print dbHandler.__organizationID_by_username__("Evalan_u_1")