Skip to content

Commit

Permalink
Pull request #9: Data validation
Browse files Browse the repository at this point in the history
BAC-9366: Docs data validation

Squashed commit of the following:

commit 1214b4c19cdefb9ff225c876a4892ff706cea59e
Author: Jeroen Pinxten <jeroen.pinxten@icometrix.com>
Date:   Wed Jun 19 17:18:46 2024 +0200

    BAC-9366: data validation docs

commit c54ac15fb08952bcc8ea949a5f120bea22173308
Author: Jeroen Pinxten <jeroen.pinxten@icometrix.com>
Date:   Wed Jun 19 16:59:48 2024 +0200

    BAC-9366: data validation examples
  • Loading branch information
jpinxten committed Jun 19, 2024
1 parent 22620eb commit d977dfd
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 2 deletions.
37 changes: 37 additions & 0 deletions docs/developer_guide/data_validation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Data validation
===============

Validating imported data
------------------------

.. code-block:: python
from icometrix_sdk import IcometrixApi
PROJECT_ID = "<your-project-uuid>"
# A directory containing your DICOM files
DICOM_DIR_PATH = "..."
# Initialize the icometrix API
ico_api = IcometrixApi()
# Get the project, to make sure its there (will throw a 404 in case the project is not found)
project = ico_api.projects.get_one_by_id(PROJECT_ID)
# Upload a directory of DICOMs
data = StartUploadDto(icobrain_report_type="icobrain_ms")
upload = ico_api.uploads.upload_dicom_dir(PROJECT_ID, DICOM_DIR_PATH, data)
# Wait for data to be imported
upload = ico_api.uploads.wait_for_data_import(upload.folder_uri)
# Get imported studies
studies_in_upload = ico_api.uploads.get_studies_for_upload(upload_folder_uri=upload.folder_uri)
for uploaded_study in studies_in_upload:
study = ico_api.studies.get_one(uploaded_study.project_id, uploaded_study.patient_id, uploaded_study.study_id)
# Add some validation logic for each study e.g. find series
series = ico_api.series.get_all_for_study(study.uri)
# ...
1 change: 1 addition & 0 deletions docs/developer_guide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ Developer Guide
session
models
anonymization
data_validation
4 changes: 2 additions & 2 deletions docs/developer_guide/paginators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ Sometimes it is needed to loop over all items in a collection, the SDK has a hel
from icometrix_sdk import IcometrixApi
from icometrix_sdk.utils.paginator import get_paginator
PROJECT_ID = "<a-project-uuid>"
PROJECT_ID = "<your-project-uuid>"
os.environ["API_HOST"] = "https://icobrain-test.icometrix.com"
os.environ["API_HOST"] = "..."
# Initialize the icometrix API
ico_api = IcometrixApi()
Expand Down
2 changes: 2 additions & 0 deletions docs/models/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Models
user
project
patient
study
series
upload
customer_result
customer_report
Expand Down
6 changes: 6 additions & 0 deletions docs/models/series.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Series
======

.. automodule:: icometrix_sdk.models.series_entity
:members:
:undoc-members:
6 changes: 6 additions & 0 deletions docs/models/study.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Study
=====

.. automodule:: icometrix_sdk.models.study_entity
:members:
:undoc-members:
2 changes: 2 additions & 0 deletions docs/resources/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Resources
profile
projects
patients
studies
series
uploads
customer_results
customer_reports
8 changes: 8 additions & 0 deletions docs/resources/series.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Series
======

.. automodule:: icometrix_sdk.resources.series

.. autoclass:: icometrix_sdk.resources.series.Series
:members:
:show-inheritance:
8 changes: 8 additions & 0 deletions docs/resources/studies.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Studies
=======

.. automodule:: icometrix_sdk.resources.studies

.. autoclass:: icometrix_sdk.resources.studies.Studies
:members:
:show-inheritance:

0 comments on commit d977dfd

Please sign in to comment.