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

Pairedttest #292

Merged
merged 5 commits into from
Nov 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ def histograms_inputerrorchecking(xisCategorical,bins):
histograms_inputerrorchecking.registered = True


def pairedttest_inputerrorchecking(variableNo):
if variableNo%2 == 1:
raise functions.OperatorError("ExaremeError", "The input should be in the form of y1-y2,y3-y4,.. Therefore the number of variables should be modulo 2")
else:
return "OK"

pairedttest_inputerrorchecking.registered = True



if not ('.' in __name__):
"""
This is needed to be able to test the function, put it at the end of every
Expand Down
10 changes: 10 additions & 0 deletions Exareme-Docker/src/mip-algorithms/TTEST_PAIRED/local.template.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ var 'xnames' from
select group_concat(xname) as xname from
(select distinct xname from (select strsplitv(regexpr("\-",'%{x}',"+") ,'delimiter:+') as xname) where xname!=0);


--Check input: number of variables is modulo 2
select pairedttest_inputerrorchecking(no) from
(select count(*) as no from
(select strsplitv(xname,'dialect:csv') from
(select group_concat(xname) as xname from
(select distinct xname from (select strsplitv(regexpr("\-",'%{x}',"+") ,'delimiter:+') as xname) where xname!=0))));



--Read dataset and Cast values of columns using cast function.
var 'cast_x' from select create_complex_query("","tonumber(?) as ?", "," , "" , '%{xnames}');
drop table if exists localinputtblflat;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,27 @@
from tests import vm_url



def test_parameter_modulo2():

endpointUrl1 = vm_url + "TTEST_PAIRED"

logging.info("---------- TEST : t-test input parameters throwing error.")
data = [
{"name": "y", "value": "lefthippocampus-righthippocampus,leftententorhinalarea"},
{"name": "hypothesis", "value": "different"},
{"name": "pathology", "value": "dementia"},
{"name": "dataset", "value": "desd-synthdata"},
{"name": "filter", "value": ""},
]
headers = {"Content-type": "application/json", "Accept": "text/plain"}
r = requests.post(endpointUrl1, data=json.dumps(data), headers=headers)
result = json.loads(r.text)
assert(result["result"][0]["data"]==" The input should be in the form of y1-y2,y3-y4,.. Therefore the number of variables should be modulo 2 ")
assert(result["result"][0]["type"]=="text/plain+user_error")



def test_valueEnumerationsParameter():

endpointUrl1 = vm_url + "LINEAR_REGRESSION"
Expand Down