Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TCIA Adapter #121

Merged
merged 20 commits into from
Jan 21, 2025
Merged

TCIA Adapter #121

merged 20 commits into from
Jan 21, 2025

Conversation

m0nhawk
Copy link
Contributor

@m0nhawk m0nhawk commented Dec 19, 2024

Link to JIRA ticket if there is one: PROM-168

New Features

Breaking Changes

Bug Fixes

Improvements

Dependency updates

Deployment changes

Copy link

The style in this PR agrees with black. ✔️

This formatting comment was generated automatically by a script in uc-cdis/wool.

Copy link

filepath $$\textcolor{#23d18b}{\tt{passed}}$$ SUBTOTAL
$$\textcolor{#23d18b}{\tt{tests/test\_discoverypage.py}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{tests/test\_aggregate\_mds.py}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{tests/test\_metadata\_ingestion.py}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{TOTAL}}$$ $$\textcolor{#23d18b}{\tt{3}}$$ $$\textcolor{#23d18b}{\tt{3}}$$

Please find the detailed integration test report here

Please find the ci env pod logs here

]
"""

field_mappings = {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need PatientID, EthnicGroup, Patient Sex and SeriesCount also in the final fields

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just tests. Though, I have added the fields for clarification.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the fields. I had requested it to align with CTDS guidelines, but as long as it works reliably, I’m okay to proceed.

assert get_metadata(
"tcia", "http://test/ok", filters=filters, mappings=field_mappings
) == {
"study_id_1": {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On some level this is how the subject metadata coming out of adapter should be

{
  "_guid_type": "TCIA_promethueus_subject_metadata",
  "gen3_discovery": {
    "tags": [
      {
           "name": "TCIA",
           "category": "Data Source"
      },
      {
           "name": "path:PatientSex",
           "category": "gender"
      },
      {
          "name": "path:EthnicGroup",
          "category": "race"
      }
    ],
    "authz": "",
    "gender": "path:PatientSex",
    "commons": "",
    "data_source": "TCIA",
    "apollo_id": "path:PatientID",
    "_unique_id": "path:StudyInstanceUID",
    "subject_id": "path:StudyInstanceUID",
    "year_of_birth" :  datetime.datetime.now().year - path:PatientAge.replace("Y" , ""), (convert age to year of birth)
    "gender" :  "path:PatientSex",
    "race" :  "path:EthnicGroup",
    "_series_count" : "path:SeriesCount",
    "study_title": "path:StudyDescription",
    "program_name": "path:Collection",
  }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just tests. From what I see it has the same structure to what you provided.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Appreciate that. My request was to meet the testing standards, but looking at time crunch, if it works as required, I’m fine moving forward

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am as well.


@respx.mock
def test_get_metadata_tcia():
tcia_response = """

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This TCIA response only test for subject level metadata. For study-level metadata coming from this URL I think the mapping should be like this

{
  "_guid_type": "TCIA_promethueus_study_metadata",
  "gen3_discovery": {
    "tags": [
      {
           "name": "TCIA",
           "category": "Data Source"
      }
    ],
    "authz": "",
    "_unique_id": "path:SeriesInstanceUID",
    "commons": "",
    "data_source": "TCIA",
    "apollo_id": "path:PatientID",
    "short_name": "path:ProtocolName",
    "study_description" : "path:SeriesDescription",
    "program_name": "path:Collection",
    "subject_id": "path:StudyInstanceUID",
    "series_number" : "path:SeriesNumber",
    "image_count": "path:ImageCount",
    "study_url": "path:CollectionURI",
  }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added the part for study-level to the tests.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding that

Copy link

Please find the ci env pod logs here

Copy link
Contributor Author

@m0nhawk m0nhawk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have done some extra changes.

]
"""

field_mappings = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just tests. Though, I have added the fields for clarification.


@respx.mock
def test_get_metadata_tcia():
tcia_response = """
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added the part for study-level to the tests.

@m0nhawk m0nhawk requested a review from urvi-occ January 14, 2025 05:11
Copy link

filepath $$\textcolor{#23d18b}{\tt{passed}}$$ SUBTOTAL
$$\textcolor{#23d18b}{\tt{tests/test\_discoverypage.py}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{tests/test\_aggregate\_mds.py}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{tests/test\_metadata\_ingestion.py}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{TOTAL}}$$ $$\textcolor{#23d18b}{\tt{3}}$$ $$\textcolor{#23d18b}{\tt{3}}$$

Please find the detailed integration test report here

Please find the ci env pod logs here

@m0nhawk m0nhawk requested a review from craigrbarnes January 16, 2025 22:42
craigrbarnes
craigrbarnes previously approved these changes Jan 17, 2025
Copy link
Contributor

@craigrbarnes craigrbarnes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes look fine.

Copy link

filepath $$\textcolor{#23d18b}{\tt{passed}}$$ $$\textcolor{#f14c4c}{\tt{error}}$$ SUBTOTAL
$$\textcolor{#f14c4c}{\tt{tests/test\_data\_upload.py}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#f14c4c}{\tt{3}}$$ $$\textcolor{#f14c4c}{\tt{3}}$$
$$\textcolor{#23d18b}{\tt{tests/test\_discoverypage.py}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{tests/test\_aggregate\_mds.py}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{tests/test\_metadata\_ingestion.py}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#f14c4c}{\tt{TOTAL}}$$ $$\textcolor{#23d18b}{\tt{3}}$$ $$\textcolor{#f14c4c}{\tt{3}}$$ $$\textcolor{#f14c4c}{\tt{6}}$$

Please find the detailed integration test report here

Please find the ci env pod logs here

Copy link

Please find the ci env pod logs here

Copy link

filepath $$\textcolor{#23d18b}{\tt{passed}}$$ SUBTOTAL
$$\textcolor{#23d18b}{\tt{tests/test\_discoverypage.py}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{tests/test\_aggregate\_mds.py}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{tests/test\_metadata\_ingestion.py}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{TOTAL}}$$ $$\textcolor{#23d18b}{\tt{3}}$$ $$\textcolor{#23d18b}{\tt{3}}$$

Please find the detailed integration test report here

Please find the ci env pod logs here

@m0nhawk m0nhawk requested a review from craigrbarnes January 21, 2025 17:31
@m0nhawk m0nhawk merged commit 05a7153 into master Jan 21, 2025
8 checks passed
@m0nhawk m0nhawk deleted the feat/tciaadapter branch January 21, 2025 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants