/**
 * Copyright 2019 The Hyve B.V.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */ import { Observable , of as observableOf } from 'rxjs' ; import { CohortRepresentation } from '../../models/gb-backend-models/cohort-representation' ; import { TransmartAndConstraint , TransmartNegationConstraint } from '../../models/transmart-models/transmart-constraint' ; export class GbBackendHttpServiceMock { constructor ( ) { } getQueries ( ) { let q1 = new CohortRepresentation ( 'dt' , 'patient' ) ; q1 . bookmarked = false ; q1 . createDate = '2018-07-03T13:18:31Z' ; q1 . subscribed = false ; q1 . subscriptionFreq = null ; q1 . updateDate = '2018-07-03T13:18:31Z' ; q1 . queryConstraint = { type : 'true' } ; q1 . queryBlob = { queryConstraintFull : q1 . queryConstraint } ; let q2 = new CohortRepresentation ( 'test' , 'patient' ) ; q2 . bookmarked = false ; q2 . createDate = '2018-07-04T10:08:33Z' ; q2 . subscribed = false ; q2 . subscriptionFreq = null ; q2 . updateDate = '2018-07-04T10:08:33Z' ; q2 . queryConstraint = { type : 'and' , args : [ { constraint : { type : 'or' , args : [ { type : 'subselection' , dimension : 'patient' , constraint : { type : 'and' , args : [ { conceptCode : 'SCSCP:DEM:AGE' , conceptPath : '\\Private Studies\\SHARED_CONCEPTS_STUDY_C_PRIV\\Demography\\Age\\' , fullName : '\\Private Studies\\SHARED_CONCEPTS_STUDY_C_PRIV\\Demography\\Age\\' , name : 'Age' , type : 'concept' , valueType : 'NUMERIC' } , { operator : '<=' , type : 'value' , value : 35 , valueType : 'NUMERIC' } ] } } , { type : 'subselection' , dimension : 'patient' , constraint : { type : 'and' , args : [ { conceptCode : 'O1KP:CAT8' , conceptPath : '\\Public Studies\\Oracle_1000_Patient\\Categorical_locations\\categorical_8\\' , fullName : '\\Public Studies\\Oracle_1000_Patient\\Categorical_locations\\categorical_8\\' , name : 'categorical_8' , type : 'concept' , valueType : 'CATEGORICAL' } , { type : 'or' , args : [ { operator : '=' , type : 'value' , value : 'Heart' , valueType : 'STRING' } , { operator : '=' , type : 'value' , value : 'Liver' , valueType : 'STRING' } ] } ] } } ] } , dimension : 'patient' , type : 'subselection' } , { arg : { type : 'subselection' , dimension : 'patient' , constraint : { conceptCode : 'VSIGN:HR' , conceptPath : '\\Vital Signs\\Heart Rate\\' , fullName : '\\Private Studies\\SHARED_CONCEPTS_STUDY_C_PRIV\\Vital Signs\\Heart Rate\\' , name : 'Heart Rate' , type : 'concept' , valueType : 'NUMERIC' } } , type : 'negation' } as TransmartNegationConstraint ] } as TransmartAndConstraint ; q2 . queryBlob = { queryConstraintFull : q2 . queryConstraint } ; let queries = [ q1 , q2 ] ; return observableOf ( queries ) ; } }