def setup_method(self): self.configuration = nlpsandbox.Configuration() self.api = nlpsandbox.ApiClient() self.mock_api = Mock() self.host = "0.0.0.0" self.config = patch.object(utils, "get_api_configuration", return_value=self.configuration) self.api_client = patch.object(nlpsandbox, "ApiClient") self.example_note = { "identifier": "note-1", "type": "loinc:LP29684-5", "patientId": "507f1f77bcf86cd799439011", "text": "On 12/26/2020, Ms. Chloe Price met with Dr. Prescott." } self.example_request = { "note": { "identifier": "note-1", "type": "loinc:LP29684-5", "patient_id": "507f1f77bcf86cd799439011", "text": "On 12/26/2020, Ms. Chloe Price met with Dr. Prescott." } } self.date_response = TextDateAnnotationResponse(text_date_annotations=[ TextDateAnnotation( start=10, length=10, text="foobar", confidence=95.5) ])
def test_get_api_configuration(): """Test getting API configuration""" configuration = nlpsandbox.Configuration() with patch.object(nlpsandbox, "Configuration", return_value=configuration),\ patch.object(utils, "check_url"): config = utils.get_api_configuration(host="0.0.0.0") assert config == configuration
def setup_method(self): self.configuration = nlpsandbox.Configuration() self.api = nlpsandbox.ApiClient() self.mock_api = Mock() self.host = "0.0.0.0" self.config = patch.object(utils, "get_api_configuration", return_value=self.configuration) self.api_client = patch.object(nlpsandbox, "ApiClient") self.dataset_id = "awesome-dataset" self.annotation_store_id = "annotation-store" self.annotation_id = "awesome-annotation" self.fhir_store_id = "fhir-store"
def get_api_configuration(host: str): """Get API configuration Args: host: Tool IP Returns: API configuration Examples: >>> get_api_configuration(host="http://0.0.0.0:8080/api/v1") """ # Check if URL exists check_url(url=os.path.join(host, "ui")) configuration = nlpsandbox.Configuration(host=host) return configuration
https://github.com/nlpsandbox/data-node - python push_dataset.py """ import json import nlpsandbox import nlpsandbox.apis import nlpsandbox.models from nlpsandbox.rest import ApiException import nlpsandboxclient.utils # Defining the host is optional and defaults to http://example.com/api/v1 # See configuration.py for a list of all supported configuration parameters. host = "http://localhost:8080/api/v1" configuration = nlpsandbox.Configuration(host=host) dataset_id = 'test-dataset' fhir_store_id = 'evaluation' annotation_store_id = 'goldstandard' json_filename = "example-patient-bundles.json" with nlpsandbox.ApiClient(configuration) as api_client: dataset_api = nlpsandbox.apis.DatasetApi(api_client) fhir_store_api = nlpsandbox.apis.FhirStoreApi(api_client) annotation_store_api = nlpsandbox.apis.AnnotationStoreApi(api_client) patient_api = nlpsandbox.apis.PatientApi(api_client) note_api = nlpsandbox.apis.NoteApi(api_client) annotation_api = nlpsandbox.apis.AnnotationApi(api_client) # The example is always deleted