def setUp(self): self.client = GenericDriver(host=self.host, path=self.path, token=self.token, secure=self.isSecure) self.driver = ehbDriver('https://' + self.host + self.path, password=self.token, secure=self.isSecure) self.regular_config = '''{ "form_names":["demographics", "testing", "imaging"] }''' self.long_config = '''{ "unique_event_names": [ "initial_arm_1", "update_one_arm_1", "update_two_arm_2" ], "event_labels": [ "Initial", "Update 1", "Update 2" ], "form_data": { "demographics_form": [ 1, 0, 0 ], "treatment": [ 1, 1, 1 ] }, "record_id_field_name": "study_id" }''' self.external_record = { 'id': 1, 'subject': 1, 'external_system': 1, 'record_id': '100001', 'path': 'test_path', 'label': 1, 'created': 'January 01, 2000 00:00:00', 'modified': 'January 02, 2000 00:00:00' }
def getDriver(self, protocol_user_credentials): """Get a configured driver backend instance for the DataSource.""" driver = None if self.driver == ProtocolDataSourceConstants.redcap_driver: pw = protocol_user_credentials.data_source_password driver = RedCapDriver.ehbDriver(self.data_source.url, password=pw, secure=self._isSecure()) elif self.driver == ProtocolDataSourceConstants.nautilus_driver: pw = protocol_user_credentials.data_source_password user = protocol_user_credentials.data_source_username driver = NauDriver.ehbDriver(url=self.data_source.url, user=user, password=pw, secure=self._isSecure()) elif self.driver == ProtocolDataSourceConstants.phenotype_driver: pw = protocol_user_credentials.data_source_password user = protocol_user_credentials.data_source_username driver = PhenotypeDriver.PhenotypeDriver(url=self.data_source.url, user=user, password=pw, secure=self._isSecure()) elif self.driver == ProtocolDataSourceConstants.external_identifiers: pw = protocol_user_credentials.data_source_password user = protocol_user_credentials.data_source_username driver = ExIdDriver.ehbDriver(url=self.data_source.url, user=user, password=pw, secure=self._isSecure()) return driver
def setUp(self): self.client = GenericDriver(host=self.host, path=self.path, token=self.token, secure=self.isSecure) self.driver = ehbDriver('https://'+self.host+self.path, password=self.token, secure=self.isSecure) self.regular_config = '''{ "form_names":["demographics", "testing", "imaging"] }''' self.long_config = '''{ "unique_event_names": [ "initial_arm_1", "update_one_arm_1", "update_two_arm_2" ], "event_labels": [ "Initial", "Update 1", "Update 2" ], "form_data": { "demographics_form": [ 1, 0, 0 ], "treatment": [ 1, 1, 1 ] }, "record_id_field_name": "study_id" }''' self.external_record = { 'id': 1, 'subject': 1, 'external_system': 1, 'record_id': '100001', 'path': 'test_path', 'label': 1, 'created': 'January 01, 2000 00:00:00', 'modified': 'January 02, 2000 00:00:00' }
def getDriver(self, protocol_user_credentials): driver = None if self.driver == ProtocolDataSourceConstants.redcap_driver: pw = protocol_user_credentials.data_source_password driver = RedCapDriver.ehbDriver( self.data_source.url, password=pw, secure=self._isSecure() ) elif self.driver == ProtocolDataSourceConstants.nautilus_driver: pw = protocol_user_credentials.data_source_password user = protocol_user_credentials.data_source_username driver = NauDriver.ehbDriver( url=self.data_source.url, user=user, password=pw, secure=self._isSecure() ) elif self.driver == ProtocolDataSourceConstants.phenotype_driver: pw = protocol_user_credentials.data_source_password user = protocol_user_credentials.data_source_username driver = PhenotypeDriver.PhenotypeDriver( url=self.data_source.url, user=user, password=pw, secure=self._isSecure() ) elif self.driver == ProtocolDataSourceConstants.external_identifiers: pw = protocol_user_credentials.data_source_password user = protocol_user_credentials.data_source_username driver = ExIdDriver.ehbDriver( url=self.data_source.url, user=user, password=pw, secure=self._isSecure() ) return driver
def driver(): return ehbDriver( url='http://example.com/api/', password='******', )