diff --git a/VERSION b/VERSION index ee4c1b2e..d62d896a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.6.17 +2.6.18 diff --git a/refs/heads/main/doi-redirect/doi-redirects.tsv b/refs/heads/main/doi-redirect/doi-redirects.tsv new file mode 100644 index 00000000..014394f4 --- /dev/null +++ b/refs/heads/main/doi-redirect/doi-redirects.tsv @@ -0,0 +1,4 @@ +hubmap_id landing_page_to_register data_information_page doi +HBM377.WFSM.936 test_landing_page1 https://purl.humanatlas.io/omap/1-human-lymph-node-ibex/v1. test_doi1 +HBM522.KQLL.594 test_landing_page2 https://purl.humanatlas.io/asct-b/lymph-vasculature/v1.5 test_doi2 +HBM838.CHFF.356 test_landing_page3 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 test_doi3 diff --git a/src/app.py b/src/app.py index 0bb46f15..4cd24fb4 100644 --- a/src/app.py +++ b/src/app.py @@ -265,29 +265,37 @@ def http_internal_server_error(e): ## sets the reference_redirects dict which is used ## by the /redirect method below try: + csv_reader_list = [] reference_redirects = {} url = app.config['REDIRECTION_INFO_URL'] + url2 = app.config['SECONDARY_REDIRECTION_INFO_URL'] # Use Memcached to improve performance response = schema_manager.make_request_get(url) resp_txt = response.content.decode('utf-8') cr = csv.reader(resp_txt.splitlines(), delimiter='\t') - - first = True - id_column = None - redir_url_column = None - for row in cr: - if first: - first = False - header = row - column = 0 - for label in header: - if label == 'hubmap_id': id_column = column - if label == 'data_information_page': redir_url_column = column - column = column + 1 - if id_column is None: raise Exception(f"Column hubmap_id not found in {url}") - if redir_url_column is None: raise Exception (f"Column data_information_page not found in {url}") - else: - reference_redirects[row[id_column].upper().strip()] = row[redir_url_column] + csv_reader_list.append(cr) + response2 = schema_manager.make_request_get(url2) + resp_txt2 = response2.content.decode('utf-8') + cr2 = csv.reader(resp_txt2.splitlines(), delimiter='\t') + csv_reader_list.append(cr2) + + for csv_reader in csv_reader_list: + first = True + id_column = None + redir_url_column = None + for row in csv_reader: + if first: + first = False + header = row + column = 0 + for label in header: + if label == 'hubmap_id': id_column = column + if label == 'data_information_page': redir_url_column = column + column = column + 1 + if id_column is None: raise Exception(f"Column hubmap_id not found in {url}") + if redir_url_column is None: raise Exception (f"Column data_information_page not found in {url}") + else: + reference_redirects[row[id_column].upper().strip()] = row[redir_url_column] rr = redirect('abc', code = 307) print(rr) except Exception: