def get_role_type_by_id(role_id): sql = "SELECT displayname, id from codesystems " \ "where name = 'OrganisationRole' AND id = %s;" data = (role_id,) cur = connect.get_cursor() cur.execute(sql, data) returned_row = cur.fetchone() role_code = returned_row['id'] role_display_name = returned_row['displayname'] link_self_href = str.format('http://{0}/role-types/{1}', config.APP_HOSTNAME, role_code) link_search_primary_role_code_href = str.format('http://{0}/organisations?primaryRoleCode={1}', config.APP_HOSTNAME, role_code) link_search_role_code_href = str.format('http://{0}/organisations?roleCode={1}', config.APP_HOSTNAME, role_code) result = { 'name': role_display_name, 'code': role_code, 'links': [{ 'rel':'self', 'href': link_self_href }, { 'rel':'searchOrganisationsWithThisPrimaryRoleType', 'href': link_search_primary_role_code_href }, { 'rel':'searchOrganisationsWithThisRoleType', 'href': link_search_role_code_href }] } return result
def get_dataset_info(): sql = "SELECT * from versions; " cur = connect.get_cursor() cur.execute(sql) row_settings = cur.fetchone() result = { 'importTimestamp': row_settings['import_timestamp'], 'fileVersion': row_settings['file_version'], 'publicationSeqNo': row_settings['publication_seqno'], 'publicationDate': row_settings['publication_date'], 'publicationType': row_settings['publication_type'] } return result