def setUp(self): """ Define some rql and create a connection. """ # Set logging level logging.basicConfig(level=logging.DEBUG) # Ask for url & login information http_url = raw_input( "\nEnter the http url [default: http://localhost:8080/]: ") if not http_url: http_url = "http://localhost:8080/" login = raw_input("\nEnter the login: "******"Enter the password: "******"Any S WHERE S is Subject") self.rql2 = ("Any S WHERE S is Scan, S has_data A, A field '3T', " "S in_assessment B, B timepoint 'V0', B concerns D, " "D code_in_study 'subject2'") # HTTP test self.connection = CWInstanceConnection(http_url, login, password, port=22)
def setUp(self): """ Define some rql and create a connection. """ # Set logging level logging.basicConfig(level=logging.DEBUG) # Ask for url & login information http_url = raw_input( "\nEnter the http url [default: http://localhost:8080/]: ") if not http_url: http_url = "http://localhost:8080/" login = raw_input("\nEnter the login [default: admin]: ") if not login: login = "******" password = getpass.getpass("Enter the password [default: a]: ") if not password: password = "******" # Create dummy rqls self.rql1 = ("Any C, G Where X is Subject, X code_in_study C, " "X handedness 'ambidextrous', X gender G") self.rql2 = ("Any S WHERE S is Subject") self.rql3 = ("Any S WHERE S is Scan, S has_data A, A field '3T', " "S in_assessment B, B timepoint 'V0', B concerns D, " "D code_in_study 'subject1'") # HTTP test self.connection = CWInstanceConnection(http_url, login, password, port=9191)
def connect_metagen_server(login=None, password=None, metagen_url=DEFAULT_METAGEN_URL): """ Create a connection to a Metagen server. The login and password are requested interactively if not provided. """ if login is None: login = raw_input("\nMetagen login: "******"Metagen password: ") metagen_connection = CWInstanceConnection(url=metagen_url, login=login, password=password) return metagen_connection
def setUp(self): """ Define some rql and create a connection. """ # Set logging level logging.basicConfig(level=logging.DEBUG) # Ask for url & login information https_url = raw_input( "\nEnter the http url [default: https://imagen2.cea.fr/database/]: ") if not https_url: https_url = "https://imagen2.cea.fr/database/" login = raw_input("\nEnter the login: "******"Enter the password: "******"Any C, G Where X is Subject, X code_in_study C, " "X handedness 'ambidextrous', X gender G") # HTTP test self.connection = CWInstanceConnection(https_url, login, password, realm="Imagen")
return login, password # Query demographics if __name__ == "__main__": """ query_subject """ #set login, password, DB url = "https://imagen2.cea.fr/database/" login, password = get_credentials() if (login is None) or (password is None): print 'login: '******'password: '******'DAWBA-dawba-youth', " "QR in_assessment A, A timepoint 'BL', QR file F, " "F data D, QR subject S, S code_in_study ID, " "S handedness HAND, S gender SEX") # execute rset = connect.execute(rql, export_type="json") # parse the result with specifi attention for the last field loaded_rset = [(sid, handednesss, sex, int(sdata[u'sstartdate'])) for sid, handednesss, sex, sdata in rset