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
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
def delete(options): ''' Delete the existing context with the given id. ''' _path = config.apihost + '/repository/%(id)s' err, res = consume('del', _path % options)
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
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
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
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)
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
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
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)
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
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
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)
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
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
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
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
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
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
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
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
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
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
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
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
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
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