diff --git a/.circleci/config.yml b/.circleci/config.yml
index dcd77dd..79370d8 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -5,7 +5,7 @@ jobs:
working_directory: /home/circleci/mriqcwebapi
machine:
- image: circleci/classic:201711-01
+ image: circleci/classic:latest
environment:
- SECRET_KEY: CI
@@ -28,7 +28,7 @@ jobs:
touch dockereve-master/nginx/.ssl/mriqcep.crt
touch dockereve-master/nginx/.ssl/mriqcep.key
docker pull mongo:latest
- docker pull swaggerapi/swagger-ui:v3.0.12
+ docker pull swaggerapi/swagger-ui:latest
docker pull nginx:latest
docker-compose -f dockereve-master/docker-compose.yml build
- run:
diff --git a/dockereve-master/docker-compose.yml b/dockereve-master/docker-compose.yml
index 8d17dda..30b1617 100644
--- a/dockereve-master/docker-compose.yml
+++ b/dockereve-master/docker-compose.yml
@@ -16,7 +16,7 @@ nginx:
- swagger_ui:swagger_ui
swagger_ui:
- image: swaggerapi/swagger-ui:v3.0.12
+ image: swaggerapi/swagger-ui:latest
env_file: .env
eve:
diff --git a/dockereve-master/eve-app/Dockerfile b/dockereve-master/eve-app/Dockerfile
index ba6c90a..ebcc4c7 100644
--- a/dockereve-master/eve-app/Dockerfile
+++ b/dockereve-master/eve-app/Dockerfile
@@ -1,4 +1,4 @@
-FROM python:3.4-onbuild
+FROM python:3.6-onbuild
WORKDIR /usr/src/app
@@ -6,7 +6,7 @@ ADD . /usr/src/app
RUN pip3 install -r requirements.txt
RUN pip3 install pytest
-RUN sed -i 's/\[scheme\]/\["https"\]/' /usr/local/lib/python3.4/site-packages/eve_swagger/objects.py
+RUN sed -i 's/\[scheme\]/\["https"\]/' /usr/local/lib/python3.6/site-packages/eve_swagger/objects.py
#EXPOSE 5000
#CMD ["python3", "server.py"]
diff --git a/dockereve-master/eve-app/app.py b/dockereve-master/eve-app/app.py
index 35d7594..94b5638 100644
--- a/dockereve-master/eve-app/app.py
+++ b/dockereve-master/eve-app/app.py
@@ -11,10 +11,12 @@
API_TOKEN = os.environ.get("API_TOKEN")
+
class TokenAuth(TokenAuth):
def check_auth(self, token, allowed_roles, resource, method):
return token == API_TOKEN
+
app = Eve(settings=settings, auth=TokenAuth)
app.register_blueprint(swagger, url_prefix='/docs/api')
app.add_url_rule('/docs/api', 'eve_swagger.index')
@@ -23,13 +25,14 @@ def check_auth(self, token, allowed_roles, resource, method):
app.config['SWAGGER_INFO'] = {
'title': 'MRIQC Web API',
'version': 'v1',
- 'description': """MRIQC is an open-source tool that extracts
-no-reference image quality metrics from structural and
-functional MRI data developed by the
-Poldrack Lab at Stanford University.
-This website provides an api to a crowdsourced repository of MRI quality
-metrics contributed by users of MRIQC and hosted by
-the Data Science and Sharing Team
+ 'description': """\
+MRIQC is an open-source tool that extracts
+no-reference image quality metrics from structural and
+functional MRI data developed by the
+Poldrack Lab at Stanford University.
+This website provides an api to a crowdsourced repository of MRI quality
+metrics contributed by users of MRIQC and hosted by
+the Data Science and Sharing Team
at the National Institute of Mental Health.""",
}
diff --git a/dockereve-master/eve-app/requirements.txt b/dockereve-master/eve-app/requirements.txt
index f44a394..ddbee9e 100644
--- a/dockereve-master/eve-app/requirements.txt
+++ b/dockereve-master/eve-app/requirements.txt
@@ -1,3 +1,3 @@
-gunicorn==19.3.0
-eve==0.7.4
-eve-swagger==0.0.7
+gunicorn
+eve
+eve-swagger
diff --git a/dockereve-master/eve-app/settings.py b/dockereve-master/eve-app/settings.py
index 1eff30e..2ccc135 100644
--- a/dockereve-master/eve-app/settings.py
+++ b/dockereve-master/eve-app/settings.py
@@ -1,5 +1,4 @@
import os
-import re
from copy import deepcopy
bids_schema = {
@@ -553,7 +552,7 @@
'API_VERSION': 'v1',
'ALLOWED_FILTERS': ['*'],
'MONGO_HOST': os.environ.get('MONGODB_HOST', ''),
- 'MONGO_PORT': os.environ.get('MONGODB_PORT', ''),
+ 'MONGO_PORT': int(os.environ.get('MONGODB_PORT', '')),
'MONGO_DBNAME': 'mriqc_api',
'PUBLIC_METHODS': ['GET'],
'PUBLIC_ITEM_METHODS': ['GET'],
diff --git a/dockereve-master/eve-app/test_settings.py b/dockereve-master/eve-app/test_settings.py
index d3842b6..75a00e5 100644
--- a/dockereve-master/eve-app/test_settings.py
+++ b/dockereve-master/eve-app/test_settings.py
@@ -1,45 +1,46 @@
from eve.tests import TestMinimal
import os
-import re
from flask_pymongo import MongoClient
url = 'mriqc_api'
MONGO_HOST = os.environ.get("MONGODB_HOST", 'mongodb'),
MONGO_PORT = int(os.environ.get("MONGODB_PORT", 27017))
MONGO_DBNAME = 'test_DB'
+
+
class settingsTestCase(TestMinimal):
- def setUp(self):
- return super().setUp(settings_file = './settings.py')
- def dropDB(self):
- self.connection = MongoClient(MONGO_HOST,MONGO_PORT)
- self.connection.drop_database(MONGO_DBNAME)
- self.connection.close()
- def setupDB(self):
- self.connection = MongoClient(MONGO_HOST,MONGO_PORT)
- self.connection.drop_database(MONGO_DBNAME)
- def testGet(self):
- return_json,return_code = self.get(url)
- self.assert200(return_code)
- def testPost(self):
- return_json, return_code = self.post(url, {"cjv": 0.1231231})
- self.assertFalse(self.domain)
- self.assertFalse(return_json)
- # self.assert200(return_code)
-
-# class settingsTestCase(TestMinimal):
-# def dropDB(self):
-# self.connection = MongoClient(MONGO_HOST, MONGO_PORT)
-# self.connection.drop_database(MONGO_DBNAME)
-# self.connection.close()
+ def setUp(self):
+ return super().setUp(settings_file='./settings.py')
-# def setupDB(self):
-# self.connection = MongoClient(MONGO_HOST, MONGO_PORT)
-# self.connection.drop_database(MONGO_DBNAME)
-# def testPost():
-# return_json, return_code = self.post(url,{"cjg":0.123123})
-# print(return_json)
-# print(return_code)
+ def dropDB(self):
+ self.connection = MongoClient(MONGO_HOST, MONGO_PORT)
+ self.connection.drop_database(MONGO_DBNAME)
+ self.connection.close()
+ def setupDB(self):
+ self.connection = MongoClient(MONGO_HOST, MONGO_PORT)
+ self.connection.drop_database(MONGO_DBNAME)
+ def testGet(self):
+ return_json, return_code = self.get(url)
+ self.assert200(return_code)
+ def testPost(self):
+ return_json, return_code = self.post(url, {"cjv": 0.1231231})
+ self.assertFalse(self.domain)
+ self.assertFalse(return_json)
+ # self.assert200(return_code)
+
+# class settingsTestCase(TestMinimal):
+# def dropDB(self):
+# self.connection = MongoClient(MONGO_HOST, MONGO_PORT)
+# self.connection.drop_database(MONGO_DBNAME)
+# self.connection.close()
+# def setupDB(self):
+# self.connection = MongoClient(MONGO_HOST, MONGO_PORT)
+# self.connection.drop_database(MONGO_DBNAME)
+# def testPost():
+# return_json, return_code = self.post(url,{"cjg":0.123123})
+# print(return_json)
+# print(return_code)
diff --git a/test/T1w/missingField/sub-10159_T1w.json b/test/T1w/missingField/sub-10159_T1w.json
index c2095bc..ff55cdb 100755
--- a/test/T1w/missingField/sub-10159_T1w.json
+++ b/test/T1w/missingField/sub-10159_T1w.json
@@ -37,8 +37,7 @@
"icvs_csf": 0.2430190456707652,
"PatientPosition": "HFS",
"SequenceName": "*tfl3d1_ns",
- "summary_bg_p05": 0.0,
- "ImageType": "ORIGINAL/PRIMARY/M/ND/NORM",
+ "summary_bg_p05": 0.0,
"qi_2": 0.0042996791690604694,
"qi_1": 5.289201412128623e-06,
"ImagingFrequency": 123249959,
diff --git a/test/T1w/validData/sub-50785_T1w.json b/test/T1w/validData/sub-50785_T1w.json
index 239485f..d56c48d 100644
--- a/test/T1w/validData/sub-50785_T1w.json
+++ b/test/T1w/validData/sub-50785_T1w.json
@@ -1,16 +1,7 @@
{
"bids_meta": {
"modality": "T1w",
- "subject_id": "50785",
- "ImageType": [
- "ORIGINAL",
- "PRIMARY",
- "M",
- "MB",
- "ND",
- "NORM",
- "MOSAIC"
- ]
+ "subject_id": "50785"
},
"cjv": 0.3881841572763748,
"cnr": 3.139893975583801,
diff --git a/test/testGetPost.py b/test/testGetPost.py
index ca37f23..c9696f0 100644
--- a/test/testGetPost.py
+++ b/test/testGetPost.py
@@ -29,7 +29,7 @@ def getRequest(post_resp, url):
return get_resp.json()
-###### MAIN ######
+# MAIN ######
header = {'content-type': 'application/json', 'Accept-Charset': 'UTF-8'}
authenticated_header = header.copy()
authenticated_header['Authorization'] = os.environ.get('API_TOKEN', '')
@@ -62,8 +62,7 @@ def test_00_GETAllData(self):
input_count)
self.assertTrue(input_count == get_resp['_meta']['total'])
-
- ########## Testing Bold ############
+ # Testing Bold ############
def test_01_ConnectionStatus(self):
log = logging.getLogger("mriqcwebapi")
@@ -85,10 +84,7 @@ def test_01_ConnectionStatus(self):
log.debug('Response: %s', get_resp.json())
self.assertTrue(get_resp.raise_for_status() is None)
-
def test_02_MissingFieldInput(self):
- log = logging.getLogger("mriqcwebapi")
-
for file_name in glob(boldMissingPattern):
with open(file_name) as fp:
input_data = json.load(fp)
@@ -99,8 +95,7 @@ def test_02_MissingFieldInput(self):
# print post_resp.status_code
self.assertTrue(post_resp.status_code == codeForInvalid)
-
- ########## Testing T1w ############
+ # Testing T1w ############
def test_03_ConnectionStatus(self):
log = logging.getLogger("mriqcwebapi")
@@ -122,10 +117,7 @@ def test_03_ConnectionStatus(self):
log.debug('Response: %s', get_resp.json())
self.assertTrue(get_resp.raise_for_status() is None)
-
def test_04_MissingFieldInput(self):
- log = logging.getLogger("mriqcwebapi")
-
for file_name in glob(T1wMissingPattern):
with open(file_name) as fp:
input_data = json.load(fp)
@@ -136,11 +128,8 @@ def test_04_MissingFieldInput(self):
# print post_resp.status_code
self.assertTrue(post_resp.status_code == codeForInvalid)
-
- ########## Cross Testing: send data to wrong end point ############
+ # Cross Testing: send data to wrong end point ############
def test_05_boldDataToT1wEndPoint(self):
- log = logging.getLogger("mriqcwebapi")
-
for file_name in glob(boldPattern):
with open(file_name) as fp:
input_data = json.load(fp)
@@ -150,10 +139,7 @@ def test_05_boldDataToT1wEndPoint(self):
headers=authenticated_header)
self.assertTrue(post_resp.status_code == codeForInvalid)
-
def test_06_T1wDataToBoldEndPoint(self):
- log = logging.getLogger("mriqcwebapi")
-
for file_name in glob(T1wPattern):
with open(file_name) as fp:
input_data = json.load(fp)
@@ -163,7 +149,6 @@ def test_06_T1wDataToBoldEndPoint(self):
headers=authenticated_header)
self.assertTrue(post_resp.status_code == codeForInvalid)
-
def test_07_T1wDataValid(self):
for file_name in glob(T1wPattern):
with open(file_name) as fp:
@@ -182,7 +167,6 @@ def test_07_T1wDataValid(self):
# check key-value pair match
self.assertTrue(input_data[key] == queried_data[key])
-
def test_08_boldDataValid(self):
for file_name in glob(boldPattern):
with open(file_name) as fp:
@@ -203,7 +187,6 @@ def test_08_boldDataValid(self):
# check key-value pair match
self.assertTrue(input_data[key] == queried_data[key])
-
def test_09_failedAuth(self):
with open(glob(boldPattern)[0]) as fp:
inputData = json.load(fp)
@@ -234,6 +217,7 @@ def test_10_ratingDataValid(self):
if elem['_id'] == "bad":
self.assertTrue(elem['count'] == 1)
+
if __name__ == '__main__':
logging.basicConfig(stream=sys.stderr)
logging.getLogger("mriqcwebapi").setLevel(logging.DEBUG)