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

Unable to upload images for the report when calling ipr_report. #36

Open
faruqsandi opened this issue Sep 15, 2024 · 2 comments
Open

Unable to upload images for the report when calling ipr_report. #36

faruqsandi opened this issue Sep 15, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@faruqsandi
Copy link

faruqsandi commented Sep 15, 2024

Describe the bug
Unable to upload images for the report when calling ipr_report.

To Reproduce
Steps to reproduce the behavior:

  1. Run command  ipr_report
  2. with input:
{
    "patientId": "Faruq-Test-Build-Report",
    "kbDiseaseMatch": "colorectal cancer",
    "project": "TEST",
    "template": "genomic",
    "ageOfConsent": 35,
    "alternateIdentifier": "fhir-patiet-id-here",
    "biopsyDate": "2021-06-04T16:36:37.279Z",
    "biopsyName": "colon",
    "ploidy": "diploid",
    "presentationDate": "2021-06-04T16:36:37.279Z",
    "subtyping": "adenocarcinoma",
    "images": [
        {
            "key": "mutationBurden.density_snv.primary",
            "path": "/absolute/path/to/pori_suite/mutationBurden.density_snv.primary.png",
            "title": "Mock Data",
            "caption": "Mock Data"
        }
}
  1. See error (unnecessary details omitted):
{'error': {'message': 'Error processing report image mutationBurden.density_snv.primary.png Error: Input file is missing: /home/bit/Playground/xnalabs/pori_suite/mutationBurden.density_snv.primary.png'}}

Expected behaviour
I expected that the image would be successfully uploaded. I see that function post_images never actually called besides in test cases.

Versions (please complete the following information):
 - OS: Windows 11, WSL 2, Ubuntu 22.04.4 LTS.
 - Python: 3.11.9
 - Version: pori_python==0.1.2
 - GraphKB URL: local
 - IPR URL: local

Additional context
I tried to construct a complete JSON for ipr_report that will produce a complete report in each section.

@faruqsandi faruqsandi added the bug Something isn't working label Sep 15, 2024
@dustinbleile
Copy link
Contributor

Input file is missing: /home/bit/Playground/xnalabs/pori_suite/mutationBurden.density_snv.primary.png
The error is showing this file as missing or inaccessible.

Are read permissions restricted on that file?
Is the directory correct.

@faruqsandi
Copy link
Author

faruqsandi commented Sep 18, 2024

Yes, paths are guaranteed to be OK and accessible using terminal.

My current workaround is to remove the "images" from the payload for individual upload after report created.

images = report_payload.pop()

ipr_conn = IprConnection(
    username=username, password=password, url=myurl
)

for image in images:
    image_key = image["key"]
    files = {
        f"{image_key}": image["path"],
    }
    data = {
        f"{image_key}.title": image["title"],
        f"{image_key}.caption": image["caption"],
    }
    try:
        response_image = ipr_conn.post_images(
            report_id=report_id, files=files, data=data
        )
        print(image_key, response_image)
    except Exception:
        print(f"Failed to upload image {image_key}")
        continue

Here is my json:
example_report.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants