Exemplo n.º 1
0
def save(options, oc):
    '''
        Create a new data element concept.
    '''
    _path = config.apihost + '/oc/%(id)s/dec'

    err, res = consume(
        'post', _path % oc, {
            'propertyName':
            options['name'],
            'propertyDefinition':
            options.get('definition', options['name'].lower()),
            'objectClassID':
            oc['id'],
            'mappings':
            options.get('mappings', []),
            'definition':
            oc['name'] + ':' + options['name'],
            'contextID':
            options['context'],
            'conceptualDomainID':
            options['cd']['id']
        })

    if err:
        raise Exception(err)

    return res
Exemplo n.º 2
0
def save(options):
    '''
        Create a new value domain.
    '''
    _path = config.apihost + '/cd/%(cd)s/vd'

    err, res = consume(
        'post', _path % options, {
            'conceptualDomainID':
            options['cd'],
            'contextID':
            options['context'],
            'dataType': {
                'schemeReference': options['dt']['scheme'],
                'datatypeName': options['dt']['name']
            },
            'enumerated':
            options['enumerated'],
            'permissibleValues':
            options['pvs'],
            'name':
            options['name'],
            'definition':
            options['definition']
            if 'definition' in options else options['name'].lower()
        })

    if err:
        raise Exception(err, res)

    return res
Exemplo n.º 3
0
def delete(options):
    '''
        Delete the existing context with the given id.
    '''
    _path = config.apihost + '/repository/%(id)s'

    err, res = consume('del', _path % options)
Exemplo n.º 4
0
def query():
    '''
        Get all data types available in the repository.
    '''
    _path = config.apihost + '/repository/dt'

    err, res = consume('get', _path)

    if err:
        raise Exception(err, res)

    return res
Exemplo n.º 5
0
def get(options):
    '''
        Get value domain with the given id.
    '''
    _path = config.apihost + '/vd/%(id)s'

    err, res = consume('get', _path % options)

    if err:
        raise Exception(err, res)

    return res
Exemplo n.º 6
0
def get(options):
    '''
        Get value domain with the given id.
    '''
    _path = config.apihost + '/vd/%(id)s'

    err, res = consume('get', _path % options)

    if err:
        raise Exception(err, res)

    return res
Exemplo n.º 7
0
def query(cd):
    '''
        Get all value meanings attached to the given conceptual domain.
    '''
    _path = config.apihost + '/repository/cd/%(domain)s/vm'

    err, res = consume('get', _path % {'domain': cd})

    if err:
        raise Exception(err)

    return res
Exemplo n.º 8
0
def delete(options):
    '''
        Delete the data type with the given name and scheme reference.
    '''
    _path = config.apihost + '/repository/dt'

    err, res = consume('del', _path, {
            'datatypeName': options['name'],
            'schemeReference': options['scheme']
        })

    if err:
        raise Exception(err, res)
Exemplo n.º 9
0
def get(context):
    '''
        Get context with the given name.
    '''
    _path = config.apihost = '/repository'

    err, res = consume('get', _path)

    if err:
        raise Exception(err)

    for ctx in res:
        if ctx['name'] == context:
            return ctx
Exemplo n.º 10
0
def get(options):
    '''
        Get conceptual domain with the given name.
    '''
    _path = config.apihost + '/repository/cd/search'

    err, res = consume('get', _path, params={'q': options['name']})

    if err:
        raise Exception(err, res)

    for cd in res:
        if cd['name'] == options['name']:
            return cd
Exemplo n.º 11
0
def get(options):
    '''
        Get conceptual domain with the given name.
    '''
    _path = config.apihost + '/repository/cd/search'

    err, res = consume('get', _path, params={'q': options['name']})

    if err:
        raise Exception(err, res)

    for cd in res:
        if cd['name'] == options['name']:
            return cd
Exemplo n.º 12
0
def delete(options):
    '''
        Delete an existing extraction specification.
    '''
    _path = config.apihost + '/de/%(de)s/extractionspecification'

    err, res = consume('del', _path % options, {
        'modelOID': options['oid'],
        'type': options['type'],
        'value': options['value']
    })

    if err:
        raise Exception(err, res)
Exemplo n.º 13
0
def delete(vm, cd):
    '''
        Delete the value meaning with the given id and conceptual domain.
    '''
    _path = config.apihost + '/cd/%(domain)s/vm'

    err, res = consume('del', _path % {'domain': cd}, {
            'id': vm
        })

    if err:
        raise Exception(err)

    return res
Exemplo n.º 14
0
def save(options):
    '''
        Create a new data type.
    '''
    _path = config.apihost + '/repository/dt'

    err, res = consume('post', _path, {
            'datatypeName': options['name'],
            'schemeReference': options['scheme']
        })

    if err:
        raise Exception(err, res)

    return res
Exemplo n.º 15
0
def delete(options):
    '''
        Delete an existing extraction specification.
    '''
    _path = config.apihost + '/de/%(de)s/extractionspecification'

    err, res = consume(
        'del', _path % options, {
            'modelOID': options['oid'],
            'type': options['type'],
            'value': options['value']
        })

    if err:
        raise Exception(err, res)
Exemplo n.º 16
0
def save(name, definition):
    '''
        Create a new context.
    '''
    _path = config.apihost + '/repository'

    err, res = consume('post', _path, {
            'name': name,
            'definition': definition
        })

    if err:
        raise Exception(err)

    return res
Exemplo n.º 17
0
def login(username, password):
    '''
        Authenticate the app with the given username and password.
    '''
    _path = config.apihost + '/auth'

    err, res = consume('put', _path, {
            'username': username,
            'password': password
        })

    if err:
        raise Exception(err, res)

    return res
Exemplo n.º 18
0
def save(cd, id, description):
    '''
        Create a value meaning for the given conceptual domain.
    '''
    _path = config.apihost + '/cd/%(domain)s/vm'

    err, res = consume('post', _path % {'domain': cd}, {
            'id': id,
            'description': description,
            'conceptualDomainID': cd
        })

    if err:
        raise Exception(err)

    return res
Exemplo n.º 19
0
def save(options):
    '''
        Create a new object class under the given context.
    '''
    _path = config.apihost + '/context/%(context)s/oc'

    err, res = consume('post', _path % {'context': options['context']}, {
            'contextID': options['context'],
            'name': options['name'],
            'definition': options['definition']
        })

    if err:
        raise Exception(err, res)

    return res
Exemplo n.º 20
0
def save(options):
    '''
        Create a new object class under the given context.
    '''
    _path = config.apihost + '/context/%(context)s/oc'

    err, res = consume('post', _path % {'context': options['context']}, {
        'contextID': options['context'],
        'name': options['name'],
        'definition': options['definition']
    })

    if err:
        raise Exception(err, res)

    return res
Exemplo n.º 21
0
def save(options): #concept, oid, type, value, de):
    '''
        Create a new extraction specification for the given data element.
    '''
    _path = config.apihost + '/de/%(de)s/extractionspecification'

    err, res = consume('post', _path % options, {
        'modelName': options['concept'],
        'modelOID': options['oid'],
        'type': options['type'],
        'value': options['value']
    })

    if err:
        raise Exception(err, res)

    return res
Exemplo n.º 22
0
def update(options):
    '''
        Update the given conceptual domain.
    '''
    _path = config.apihost + '/repository/cd'

    err, res = consume('put', _path, {
            'name': options['name'],
            'definition': options['definition'] if 'definition' in options else options['name'].lower(),
            'enumerated': options['enumerated'],
            'id': options['id']
        })

    if err:
        raise Exception(err, res)

    return res
Exemplo n.º 23
0
def save(options):
    '''
        Create a conceptual domain.
    '''
    _path = config.apihost + '/repository/cd'

    err, res = consume('post', _path, {
            'name': options['name'],
            'definition': options['definition'] if 'definition' in options else options['name'].lower(),
            'enumerated': options['enumerated'],
            'id': options['oid'] if options['enumerated'] else None
        })

    if err:
        raise Exception(err, res)

    return res
Exemplo n.º 24
0
def save(options):  #concept, oid, type, value, de):
    '''
        Create a new extraction specification for the given data element.
    '''
    _path = config.apihost + '/de/%(de)s/extractionspecification'

    err, res = consume(
        'post', _path % options, {
            'modelName': options['concept'],
            'modelOID': options['oid'],
            'type': options['type'],
            'value': options['value']
        })

    if err:
        raise Exception(err, res)

    return res
Exemplo n.º 25
0
def save(options, oc):
    '''
        Create a new data element concept.
    '''
    _path = config.apihost + '/oc/%(id)s/dec'

    err, res = consume('post', _path % oc, {
            'propertyName': options['name'],
            'propertyDefinition': options.get('definition', options['name'].lower()),
            'objectClassID': oc['id'],
            'mappings': options.get('mappings', []),
            'definition': oc['name'] + ':' + options['name'],
            'contextID': options['context'],
            'conceptualDomainID': options['cd']['id']
        })

    if err:
        raise Exception(err)

    return res
Exemplo n.º 26
0
def save(options):
    '''
        Create a new data element.
    '''
    _path = config.apihost + '/context/%(context)s/de'

    err, res = consume('post', _path % options, {
            'name': options['name'],
            'definition': options.get('definition', options['name'].lower()),
            'dataElementConceptID': options['dec'],
            'valueDomainID': options['vd']['id'],
            'valueDomainName': options['vd']['name'],
            'contextID': options['context'],
            'extractionSpecs': options.get('xspec', [])
        })

    if err:
        raise Exception(err, res)

    return res
Exemplo n.º 27
0
def save(options):
    '''
        Create a new data element.
    '''
    _path = config.apihost + '/context/%(context)s/de'

    err, res = consume(
        'post', _path % options, {
            'name': options['name'],
            'definition': options.get('definition', options['name'].lower()),
            'dataElementConceptID': options['dec'],
            'valueDomainID': options['vd']['id'],
            'valueDomainName': options['vd']['name'],
            'contextID': options['context'],
            'extractionSpecs': options.get('xspec', [])
        })

    if err:
        raise Exception(err, res)

    return res
Exemplo n.º 28
0
def save(options):
    '''
        Create a new value domain.
    '''
    _path = config.apihost + '/cd/%(cd)s/vd'

    err, res = consume('post', _path % options, {
            'conceptualDomainID': options['cd'],
            'contextID': options['context'],
            'dataType': {
                'schemeReference': options['dt']['scheme'],
                'datatypeName': options['dt']['name']
            },
            'enumerated': options['enumerated'],
            'permissibleValues': options['pvs'],
            'name': options['name'],
            'definition': options['definition'] if 'definition' in options else options['name'].lower()
        })

    if err:
        raise Exception(err, res)

    return res
Exemplo n.º 29
0
def save(options):
    '''
        Create a conceptual domain.
    '''
    _path = config.apihost + '/repository/cd'

    err, res = consume(
        'post', _path, {
            'name':
            options['name'],
            'definition':
            options['definition']
            if 'definition' in options else options['name'].lower(),
            'enumerated':
            options['enumerated'],
            'id':
            options['oid'] if options['enumerated'] else None
        })

    if err:
        raise Exception(err, res)

    return res
Exemplo n.º 30
0
def update(options):
    '''
        Update the given conceptual domain.
    '''
    _path = config.apihost + '/repository/cd'

    err, res = consume(
        'put', _path, {
            'name':
            options['name'],
            'definition':
            options['definition']
            if 'definition' in options else options['name'].lower(),
            'enumerated':
            options['enumerated'],
            'id':
            options['id']
        })

    if err:
        raise Exception(err, res)

    return res