Skip to content

Deprecation of Analysis Inputs Filename APIs

Removed in Flywheel Core 22.0.0

The APIs listed below have been removed in Flywheel Core 22.0.0. Direct API integrations and SDK scripts that identify analysis input files by filename no longer work and must be updated before upgrading. See Migration Examples for the supported replacement patterns.

Change

The Flywheel SDK functions and HTTP API routes listed below were deprecated in Flywheel Core 20.2.0 and have been removed in 22.0.0. In every case the replacement is to identify the input file by file_id and act on the File object directly, as shown in the Migration Examples.

Removed SDK functions

In every replacement snippet below, input is a reloaded File object obtained from an analysis:

input = analysis.inputs[i].reload()

Reloading populates input.version and the rest of the File metadata, both of which are needed for the replacement calls.

Download an input file to disk

Replacement: input.download(dest, version=input.version)

  • download_input_from_analysis()
  • download_input_from_acquisition_analysis()
  • download_input_from_container_analysis()
  • download_input_from_project_analysis()
  • download_input_from_session_analysis()
  • download_input_from_subject_analysis()

Read an input file into memory

Replacement: input.read(version=input.version)

  • download_input_from_analysis_as_data()
  • download_input_from_acquisition_analysis_as_data()
  • download_input_from_container_analysis_as_data()
  • download_input_from_project_analysis_as_data()
  • download_input_from_session_analysis_as_data()
  • download_input_from_subject_analysis_as_data()

Get a time-limited download URL

Replacement: input.url(version=input.version)

  • get_analysis_input_download_url()
  • get_acquisition_analysis_input_download_url()
  • get_container_analysis_input_download_url()
  • get_project_analysis_input_download_url()
  • get_session_analysis_input_download_url()
  • get_subject_analysis_input_download_url()

Get input zipfile manifest

Replacement: input.get_zip_info(version=input.version)

  • get_analysis_input_zip_info()
  • get_acquisition_analysis_input_zip_info()
  • get_container_analysis_input_zip_info()
  • get_project_analysis_input_zip_info()
  • get_session_analysis_input_zip_info()
  • get_subject_analysis_input_zip_info()

Get input file metadata

Replacement: access File attributes on the reloaded input (input.size, input.type, input.modality, input.classification, input.info, input.hash), or client.get_file(input.file_id, version=input.version).

  • get_analysis_file_info()

Removed HTTP API routes

Route
GET /api/analyses/{cid}/inputs/{filename}
GET /api/analyses/{cid}/inputs/{filename}/info
GET /api/{ctype}/{cid}/analyses/{analysis_id}/inputs/{filename}
GET /api/{ctype}/{cid}/analyses/{analysis_id}/inputs/{filename}/info
GET /api/{ctype}/{cid}/inputs/{filename}/info

{ctype} is one of acquisitions, collections, containers, projects, sessions, or subjects.

Reason For Change

  • Behavior was undefined when an analysis had multiple inputs that share the same filename.
  • Identifying an analysis input by the combination of analysis ID plus filename was ambiguous, because analyses can hold multiple input files referencing different files with the same name.

Identify analysis input files by their file ID instead of by filename. Each File object on analysis.inputs exposes download(), url(), and read() methods directly, removing the ambiguity entirely.

Migration Examples

The following examples use the Flywheel Python SDK (pip install flywheel-sdk) and assume an authenticated client.

Always reload the input and pass version=

Two pitfalls to avoid when migrating:

  1. File objects on analysis.inputs are returned with a subset of fields populated. Call .reload() on the chosen input before downloading or reading it, so that version and other metadata are available on the object.
  2. download(), url(), and read() default to the latest version of the file on the parent container — not the version captured when the analysis was created. To retrieve the exact bytes the analysis was run against, pass version=input_file.version explicitly. The replaced/removed APIs returned the analysis-snapshotted version, so omitting version= here is a behavior change.

List analysis inputs and obtain each input's file ID

1
2
3
4
5
6
7
import flywheel

client = flywheel.Client()
analysis = client.get(analysis_id)

for input_file in analysis.inputs:
    print(input_file.file_id, input_file.name, input_file.type)

Download an input file

Operate on the File object directly — no filename lookup through the analysis is needed.

1
2
3
4
5
6
7
8
9
# Pick the input you want — for example, the first NIfTI input — and reload it
# to populate the full File metadata (including `version`).
nifti_input = next(f for f in analysis.inputs if f.type == "nifti").reload()

# Download the snapshotted version to disk
nifti_input.download("/path/to/destination.nii.gz", version=nifti_input.version)

# Or read the snapshotted version into memory
contents = nifti_input.read(version=nifti_input.version)

Get a time-limited download URL

download_url = nifti_input.url(version=nifti_input.version)

Get file info / metadata

After reload(), the File object carries the metadata previously returned by get_analysis_file_info() (size, type, modality, classification, info, hash). You can also re-fetch the file by ID at any time using client.get_file().

1
2
3
4
print(nifti_input.size, nifti_input.modality, nifti_input.classification, nifti_input.info)

# Or re-fetch by file ID and version
file_record = client.get_file(nifti_input.file_id, version=nifti_input.version)