diff --git a/services/index.html b/services/index.html index 868686b4..2f65d37a 100644 --- a/services/index.html +++ b/services/index.html @@ -3219,7 +3219,7 @@

Class variables

Methods

-def create_set(self, set_type: phc.services.genomics.Genomics.SetType, project_id: str, name: str, file_id: str, patient_id: str, reference: phc.services.genomics.Genomics.Reference, sequence_type: phc.services.genomics.Genomics.SequenceType, test_type: str, sequence_id: Optional[str] = '6a1b8abe-da42-4c25-a4cf-66a54dfac6f5', indexed_date: Optional[datetime.datetime] = None, performer_id: Optional[str] = None, test_id: Optional[str] = None, update_sample: Optional[bool] = False, pass_filter: Optional[bool] = False, output_vcf_name: Optional[str] = None) ‑> phc.api_response.ApiResponse +def create_set(self, set_type: phc.services.genomics.Genomics.SetType, project_id: str, name: str, file_id: str, patient_id: str, reference: phc.services.genomics.Genomics.Reference, sequence_type: phc.services.genomics.Genomics.SequenceType, test_type: str, sequence_id: Optional[str] = 'ebc18e62-c32f-422f-b565-634e3bbebb05', indexed_date: Optional[datetime.datetime] = None, performer_id: Optional[str] = None, test_id: Optional[str] = None, update_sample: Optional[bool] = False, pass_filter: Optional[bool] = False, output_vcf_name: Optional[str] = None) ‑> phc.api_response.ApiResponse

Creates a genomic set

@@ -3783,7 +3783,7 @@

Returns

return GetModelLogsResponse.parse_obj(res.data) def create_approval_decision( - self, model_id: str, run_id: str, body: CreateApprovalDecisionRequest + self, model_id: str, run_id: str, body: ApprovalDecisionInput ): """Adds a new approval decision to a model run.""" res = self._api_call( @@ -3793,53 +3793,102 @@

Returns

) return CreateApprovalDecisionResponse.parse_obj(res.data) - def get_examples(self, model_id: str, params: GetExamplesParams): + def predict(self, model_id: str): + """Constructs an example and submits it to the referenced model for inference. The model's output predictions are then returned. The example is retrieved based on the model's problem type and the provided query parameters. Note that this route is only supported for models using the `cloud` deploy type, and which have a currently deployed model version (champion).""" + res = self._api_call( + api_path=f"/v1/patient-ml/models/{model_id}/predictions", + http_verb="GET", + ) + return PredictionResponse.parse_obj(res.data) + + def create_dataset(self, body: DatasetConfigInput): + """Creates a new dataset via a dataset config object.""" + res = self._api_call( + api_path="/v1/patient-ml/datasets", + http_verb="POST", + json=json.loads(body.json(exclude_none=True)), + ) + return CreateDatasetResponse.parse_obj(res.data) + + def get_datasets(self): + """Gets all dataset configs in the account.""" + res = self._api_call( + api_path="/v1/patient-ml/datasets", http_verb="GET" + ) + return GetDatasetsResponse.parse_obj(res.data) + + def update_dataset(self, id: str, body: DatasetConfigInput): + """Updates a dataset config.""" + res = self._api_call( + api_path=f"/v1/patient-ml/datasets/{id}", + http_verb="PUT", + json=json.loads(body.json(exclude_none=True)), + ) + return UpdateDatasetResponse.parse_obj(res.data) + + def delete_dataset(self, id: str): + """Deletes a dataset.""" + res = self._api_call( + api_path=f"/v1/patient-ml/datasets/{id}", http_verb="DELETE" + ) + return DeleteDatasetResponse.parse_obj(res.data) + + def get_dataset(self, id: str): + """Gets a dataset config.""" + res = self._api_call( + api_path=f"/v1/patient-ml/datasets/{id}", http_verb="GET" + ) + return GetDatasetResponse.parse_obj(res.data) + + def get_dataset_examples( + self, dataset_id: str, params: GetDatasetExamplesParams + ): """Fetches a page of training data examples for data labeling.""" res = self._api_call( - api_path=f"/v1/patient-ml/models/{model_id}/examples", + api_path=f"/v1/patient-ml/datasets/{dataset_id}/examples", http_verb="GET", params=json.loads(params.json(exclude_none=True)), ) - return GetExamplesResponse.parse_obj(res.data) + return GetDatasetExamplesResponse.parse_obj(res.data) - def get_example( - self, model_id: str, example_id: str, params: GetExampleParams + def get_dataset_example( + self, dataset_id: str, example_id: str, params: GetDatasetExampleParams ): """Fetches a single training data example for data labeling.""" res = self._api_call( - api_path=f"/v1/patient-ml/models/{model_id}/examples/{example_id}", + api_path=f"/v1/patient-ml/datasets/{dataset_id}/examples/{example_id}", http_verb="GET", params=json.loads(params.json(exclude_none=True)), ) - return GetExampleResponse.parse_obj(res.data) + return GetDatasetExampleResponse.parse_obj(res.data) - def put_label(self, model_id: str, example_id: str, body: Label): - """Updates the label for a training data example""" + def put_dataset_label(self, dataset_id: str, example_id: str, body: Label): + """Updates the label for a training data example.""" res = self._api_call( - api_path=f"/v1/patient-ml/models/{model_id}/examples/{example_id}/label", + api_path=f"/v1/patient-ml/datasets/{dataset_id}/examples/{example_id}/label", http_verb="PUT", json=json.loads(body.json(exclude_none=True)), ) return Example.parse_obj(res.data) - def get_label_file(self, model_id: str, example_id: str): + def get_dataset_label_file(self, dataset_id: str, example_id: str): """Retrieves the label file for the given example, if it exists, and converts it to the format LabelStudio expects.""" res = self._api_call( - api_path=f"/v1/patient-ml/models/{model_id}/examples/{example_id}/label-file", + api_path=f"/v1/patient-ml/datasets/{dataset_id}/examples/{example_id}/label-file", http_verb="GET", ) - return GetLabelFileResponse.parse_obj(res.data) + return GetDatasetLabelFileResponse.parse_obj(res.data) - def put_label_file( - self, model_id: str, example_id: str, body: LabelFileData + def put_dataset_label_file( + self, dataset_id: str, example_id: str, body: LabelFileData ): """Preprocesses the label data and updates the label file for a training data example. This is done for ML problem types that store their labels as independent files, such as image segmentation. For those problem types, The label data is not stored on a label FHIR record, but in a separate file-service file, and pointed to by a label FHIR record.""" res = self._api_call( - api_path=f"/v1/patient-ml/models/{model_id}/examples/{example_id}/label-file", + api_path=f"/v1/patient-ml/datasets/{dataset_id}/examples/{example_id}/label-file", http_verb="PUT", json=json.loads(body.json(exclude_none=True)), ) - return PutLabelFileResponse.parse_obj(res.data) + return PutDatasetLabelFileResponse.parse_obj(res.data)

Ancestors

    @@ -3848,7 +3897,7 @@

    Ancestors

    Methods

    -def create_approval_decision(self, model_id: str, run_id: str, body: phc.services.patient_ml.CreateApprovalDecisionRequest) +def create_approval_decision(self, model_id: str, run_id: str, body: phc.services.patient_ml.ApprovalDecisionInput)

    Adds a new approval decision to a model run.

    @@ -3857,7 +3906,7 @@

    Methods

    Expand source code
    def create_approval_decision(
    -    self, model_id: str, run_id: str, body: CreateApprovalDecisionRequest
    +    self, model_id: str, run_id: str, body: ApprovalDecisionInput
     ):
         """Adds a new approval decision to a model run."""
         res = self._api_call(
    @@ -3868,6 +3917,25 @@ 

    Methods

    return CreateApprovalDecisionResponse.parse_obj(res.data)
    +
    +def create_dataset(self, body: phc.services.patient_ml.DatasetConfigInput) +
    +
    +

    Creates a new dataset via a dataset config object.

    +
    + +Expand source code + +
    def create_dataset(self, body: DatasetConfigInput):
    +    """Creates a new dataset via a dataset config object."""
    +    res = self._api_call(
    +        api_path="/v1/patient-ml/datasets",
    +        http_verb="POST",
    +        json=json.loads(body.json(exclude_none=True)),
    +    )
    +    return CreateDatasetResponse.parse_obj(res.data)
    +
    +
    def create_model(self, body: phc.services.patient_ml.ModelConfigInput)
    @@ -3904,6 +3972,23 @@

    Methods

    return CreateRunResponse.parse_obj(res.data)
+
+def delete_dataset(self, id: str) +
+
+

Deletes a dataset.

+
+ +Expand source code + +
def delete_dataset(self, id: str):
+    """Deletes a dataset."""
+    res = self._api_call(
+        api_path=f"/v1/patient-ml/datasets/{id}", http_verb="DELETE"
+    )
+    return DeleteDatasetResponse.parse_obj(res.data)
+
+
def delete_model(self, id: str)
@@ -3921,8 +4006,25 @@

Methods

return DeleteModelResponse.parse_obj(res.data) -
-def get_example(self, model_id: str, example_id: str, params: phc.services.patient_ml.GetExampleParams) +
+def get_dataset(self, id: str) +
+
+

Gets a dataset config.

+
+ +Expand source code + +
def get_dataset(self, id: str):
+    """Gets a dataset config."""
+    res = self._api_call(
+        api_path=f"/v1/patient-ml/datasets/{id}", http_verb="GET"
+    )
+    return GetDatasetResponse.parse_obj(res.data)
+
+
+
+def get_dataset_example(self, dataset_id: str, example_id: str, params: phc.services.patient_ml.GetDatasetExampleParams)

Fetches a single training data example for data labeling.

@@ -3930,20 +4032,20 @@

Methods

Expand source code -
def get_example(
-    self, model_id: str, example_id: str, params: GetExampleParams
+
def get_dataset_example(
+    self, dataset_id: str, example_id: str, params: GetDatasetExampleParams
 ):
     """Fetches a single training data example for data labeling."""
     res = self._api_call(
-        api_path=f"/v1/patient-ml/models/{model_id}/examples/{example_id}",
+        api_path=f"/v1/patient-ml/datasets/{dataset_id}/examples/{example_id}",
         http_verb="GET",
         params=json.loads(params.json(exclude_none=True)),
     )
-    return GetExampleResponse.parse_obj(res.data)
+ return GetDatasetExampleResponse.parse_obj(res.data)
-
-def get_examples(self, model_id: str, params: phc.services.patient_ml.GetExamplesParams) +
+def get_dataset_examples(self, dataset_id: str, params: phc.services.patient_ml.GetDatasetExamplesParams)

Fetches a page of training data examples for data labeling.

@@ -3951,18 +4053,20 @@

Methods

Expand source code -
def get_examples(self, model_id: str, params: GetExamplesParams):
+
def get_dataset_examples(
+    self, dataset_id: str, params: GetDatasetExamplesParams
+):
     """Fetches a page of training data examples for data labeling."""
     res = self._api_call(
-        api_path=f"/v1/patient-ml/models/{model_id}/examples",
+        api_path=f"/v1/patient-ml/datasets/{dataset_id}/examples",
         http_verb="GET",
         params=json.loads(params.json(exclude_none=True)),
     )
-    return GetExamplesResponse.parse_obj(res.data)
+ return GetDatasetExamplesResponse.parse_obj(res.data)
-
-def get_label_file(self, model_id: str, example_id: str) +
+def get_dataset_label_file(self, dataset_id: str, example_id: str)

Retrieves the label file for the given example, if it exists, and converts it to the format LabelStudio expects.

@@ -3970,13 +4074,30 @@

Methods

Expand source code -
def get_label_file(self, model_id: str, example_id: str):
+
def get_dataset_label_file(self, dataset_id: str, example_id: str):
     """Retrieves the label file for the given example, if it exists, and converts it to the format LabelStudio expects."""
     res = self._api_call(
-        api_path=f"/v1/patient-ml/models/{model_id}/examples/{example_id}/label-file",
+        api_path=f"/v1/patient-ml/datasets/{dataset_id}/examples/{example_id}/label-file",
         http_verb="GET",
     )
-    return GetLabelFileResponse.parse_obj(res.data)
+ return GetDatasetLabelFileResponse.parse_obj(res.data)
+ +
+
+def get_datasets(self) +
+
+

Gets all dataset configs in the account.

+
+ +Expand source code + +
def get_datasets(self):
+    """Gets all dataset configs in the account."""
+    res = self._api_call(
+        api_path="/v1/patient-ml/datasets", http_verb="GET"
+    )
+    return GetDatasetsResponse.parse_obj(res.data)
@@ -4085,27 +4206,45 @@

Methods

return GetRunsResponse.parse_obj(res.data)
-
-def put_label(self, model_id: str, example_id: str, body: phc.services.patient_ml.Label) +
+def predict(self, model_id: str)
-

Updates the label for a training data example

+

Constructs an example and submits it to the referenced model for inference. The model's output predictions are then returned. The example is retrieved based on the model's problem type and the provided query parameters. Note that this route is only supported for models using the cloud deploy type, and which have a currently deployed model version (champion).

Expand source code -
def put_label(self, model_id: str, example_id: str, body: Label):
-    """Updates the label for a training data example"""
+
def predict(self, model_id: str):
+    """Constructs an example and submits it to the referenced model for inference. The model's output predictions are then returned. The example is retrieved based on the model's problem type and the provided query parameters. Note that this route is only supported for models using the `cloud` deploy type, and which have a currently deployed model version (champion)."""
     res = self._api_call(
-        api_path=f"/v1/patient-ml/models/{model_id}/examples/{example_id}/label",
+        api_path=f"/v1/patient-ml/models/{model_id}/predictions",
+        http_verb="GET",
+    )
+    return PredictionResponse.parse_obj(res.data)
+
+
+
+def put_dataset_label(self, dataset_id: str, example_id: str, body: phc.services.patient_ml.Label) +
+
+

Updates the label for a training data example.

+
+ +Expand source code + +
def put_dataset_label(self, dataset_id: str, example_id: str, body: Label):
+    """Updates the label for a training data example."""
+    res = self._api_call(
+        api_path=f"/v1/patient-ml/datasets/{dataset_id}/examples/{example_id}/label",
         http_verb="PUT",
         json=json.loads(body.json(exclude_none=True)),
     )
     return Example.parse_obj(res.data)
-
-def put_label_file(self, model_id: str, example_id: str, body: phc.services.patient_ml.LabelFileData) +
+def put_dataset_label_file(self, dataset_id: str, example_id: str, body: phc.services.patient_ml.LabelFileData)

Preprocesses the label data and updates the label file for a training data example. This is done for ML problem types that store their labels as independent files, such as image segmentation. For those problem types, The label data is not stored on a label FHIR record, but in a separate file-service file, and pointed to by a label FHIR record.

@@ -4113,16 +4252,35 @@

Methods

Expand source code -
def put_label_file(
-    self, model_id: str, example_id: str, body: LabelFileData
+
def put_dataset_label_file(
+    self, dataset_id: str, example_id: str, body: LabelFileData
 ):
     """Preprocesses the label data and updates the label file for a training data example. This is done for ML problem types that store their labels as independent files, such as image segmentation. For those problem types, The label data is not stored on a label FHIR record, but in a separate file-service file, and pointed to by a label FHIR record."""
     res = self._api_call(
-        api_path=f"/v1/patient-ml/models/{model_id}/examples/{example_id}/label-file",
+        api_path=f"/v1/patient-ml/datasets/{dataset_id}/examples/{example_id}/label-file",
+        http_verb="PUT",
+        json=json.loads(body.json(exclude_none=True)),
+    )
+    return PutDatasetLabelFileResponse.parse_obj(res.data)
+ +
+
+def update_dataset(self, id: str, body: phc.services.patient_ml.DatasetConfigInput) +
+
+

Updates a dataset config.

+
+ +Expand source code + +
def update_dataset(self, id: str, body: DatasetConfigInput):
+    """Updates a dataset config."""
+    res = self._api_call(
+        api_path=f"/v1/patient-ml/datasets/{id}",
         http_verb="PUT",
         json=json.loads(body.json(exclude_none=True)),
     )
-    return PutLabelFileResponse.parse_obj(res.data)
+ return UpdateDatasetResponse.parse_obj(res.data)
@@ -6192,20 +6350,26 @@

Genomic

PatientML