Skip to content

Commit

Permalink
Merge pull request #37 from neuroscout/enh/neurovault_meta
Browse files Browse the repository at this point in the history
Add n_subjects to upload options
  • Loading branch information
adelavega committed Apr 9, 2019
2 parents 9d2b480 + d2a6975 commit b7e6a01
Show file tree
Hide file tree
Showing 4 changed files with 180 additions and 20 deletions.
7 changes: 5 additions & 2 deletions pyns/models/analysis.py
Expand Up @@ -242,17 +242,20 @@ def get_report(self, id, run_id=None):
"""
return self.get(id=id, sub_route='report', run_id=run_id)

def upload_neurovault(self, id, tarball, validation_hash, force=False):
def upload_neurovault(self, id, tarball, validation_hash, force=False,
n_subjects=None):
""" Submit analysis for report generation
:param str id: Analysis hash_id.
:param str tarball: Path to tarball.
:param str validation_hash: Validation hash string.
:param bool force: Force upload with unique timestamped name.
:param int n_subjects: Number of subjects in analysis.
:return: client response object
"""
files = {'tarball': open(tarball, 'rb')}
return self.post(id=id, sub_route='upload', files=files,
validation_hash=validation_hash, force=force)
validation_hash=validation_hash, force=force,
n_subjects=n_subjects)

def get_uploads(self, id):
""" Get NeuroVault uploads associated with this analysis
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Expand Up @@ -5,11 +5,11 @@
long_description = fh.read()

setup(name='pyns',
version='0.2.2',
version='0.2.3',
description='Neuroscout API wrapper',
long_description=long_description,
long_description_content_type="text/markdown",
url='http://github.com/neuroscout/pynv',
url='http://github.com/neuroscout/pyns',
author='Alejandro de la Vega',
author_email='aleph4@gmail.com',
license='MIT',
Expand Down
186 changes: 171 additions & 15 deletions tests/cassettes/upload_analysis.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion tests/test_analysis.py
Expand Up @@ -218,7 +218,8 @@ def test_upload_analysis(recorder, neuroscout, analysis, get_test_data_path):
with recorder.use_cassette('upload_analysis'):
resp = neuroscout.analyses.upload_neurovault(
id=analysis_id, tarball=str(get_test_data_path / 'tarball.tar.gz'),
validation_hash='8Av1Jbo1aO', force=True)
validation_hash='8Av1Jbo1aO', force=True,
n_subjects=99)

assert 'uploaded_at' in resp
uploaded_at = resp['uploaded_at']
Expand Down

0 comments on commit b7e6a01

Please sign in to comment.