Skip to content

Commit 986454f

Browse files
authored
Merge pull request #1022 from hubmapconsortium/Derek-Furst/doi-forwarding
Derek furst/doi forwarding
2 parents aee2591 + f8993c4 commit 986454f

3 files changed

Lines changed: 88 additions & 17 deletions

File tree

‎doi-pages/doi-redirect.tsv‎

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
hubmap_id landing_page_to_register data_information_page doi
2+
HBM377.WFSM.936 test_landing_page1 https://purl.humanatlas.io/omap/1-human-lymph-node-ibex/v1. https://doi.org/10.35079/HBM377.WFSM.936
3+
HBM522.KQLL.594 test_landing_page2 https://purl.humanatlas.io/asct-b/lymph-vasculature/v1.5 https://doi.org/10.35079/HBM522.KQLL.594
4+
HBM838.CHFF.356 test_landing_page3 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
5+
HBM528.GWLG.472 test_landing_page4 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
6+
HBM286.QFNP.554 test_landing_page4 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
7+
HBM846.LZCV.363 test_landing_page5 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
8+
HBM663.DHKQ.865 test_landing_page6 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
9+
HBM629.BDQB.527 test_landing_page7 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
10+
HBM676.GTXH.329 test_landing_page8 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
11+
HBM653.SJPF.374 test_landing_page9 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
12+
HBM656.ZKVH.979 test_landing_page10 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
13+
HBM957.HKNH.796 test_landing_page11 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
14+
HBM639.WWMD.883 test_landing_page12 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
15+
HBM683.KXSC.925 test_landing_page13 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
16+
HBM353.CWQW.535 test_landing_page14 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
17+
HBM425.GDQX.743 test_landing_page15 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
18+
HBM646.WTZK.555 test_landing_page16 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
19+
HBM722.FWCH.887 test_landing_page17 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
20+
HBM284.KHZR.923 test_landing_page18 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
21+
HBM999.RGNX.353 test_landing_page19 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
22+
HBM236.WBVX.927 test_landing_page20 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
23+
HBM387.GWMM.369 test_landing_page21 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
24+
HBM283.JWPZ.657 test_landing_page22 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
25+
HBM678.SJXK.375 test_landing_page23 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
26+
HBM744.HXCC.628 test_landing_page24 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
27+
HBM523.FTSL.294 test_landing_page25 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
28+
HBM428.VFLB.998 test_landing_page26 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
29+
HBM646.LHSJ.765 test_landing_page27 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
30+
HBM226.CSDM.832 test_landing_page28 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
31+
HBM673.QFPX.636 test_landing_page29 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
32+
HBM967.WHNN.233 test_landing_page30 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
33+
HBM638.XQKL.755 test_landing_page31 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
34+
HBM428.HCDN.258 test_landing_page32 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
35+
HBM765.TCFP.373 test_landing_page33 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
36+
HBM698.RZDG.587 test_landing_page34 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
37+
HBM974.DJSV.344 test_landing_page35 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
38+
HBM443.ZFRL.298 test_landing_page36 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
39+
HBM858.WBVC.362 test_landing_page37 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
40+
HBM298.LDDB.387 test_landing_page38 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
41+
HBM253.VXLN.367 test_landing_page39 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
42+
HBM556.VHXG.898 test_landing_page40 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
43+
HBM674.XVGG.736 test_landing_page41 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
44+
HBM749.SCVF.253 test_landing_page42 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
45+
HBM425.QWWF.933 test_landing_page43 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
46+
HBM837.HCJN.829 test_landing_page44 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
47+
HBM288.RSVK.723 test_landing_page45 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
48+
HBM346.DFPP.785 test_landing_page46 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
49+
HBM646.NHKK.829 test_landing_page47 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
50+
HBM577.XHHB.694 test_landing_page48 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
51+
HBM449.BMVS.455 test_landing_page49 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
52+
HBM737.CVZK.963 test_landing_page50 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
53+
HBM244.DLVB.376 test_landing_page51 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
54+
HBM589.XHFM.629 test_landing_page52 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
55+
HBM442.NPRG.337 test_landing_page53 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
56+
HBM769.WSLR.852 test_landing_page54 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
57+
HBM447.MXVB.286 test_landing_page55 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
58+
HBM585.JSKG.833 test_landing_page56 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
59+
HBM437.GKTS.458 test_landing_page57 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
60+
HBM965.PTTW.982 test_landing_page58 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759
61+
HBM854.FKSW.462 test_landing_page59 https://purl.humanatlas.io/asct-b/main-bronchus/v1.2 https://doi.org/10.35079/HBM467.LMBG.759

‎src/app.py‎

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -265,29 +265,37 @@ def http_internal_server_error(e):
265265
## sets the reference_redirects dict which is used
266266
## by the /redirect method below
267267
try:
268+
csv_reader_list = []
268269
reference_redirects = {}
269270
url = app.config['REDIRECTION_INFO_URL']
271+
url2 = app.config['SECONDARY_REDIRECTION_INFO_URL']
270272
# Use Memcached to improve performance
271273
response = schema_manager.make_request_get(url)
272274
resp_txt = response.content.decode('utf-8')
273275
cr = csv.reader(resp_txt.splitlines(), delimiter='\t')
274-
275-
first = True
276-
id_column = None
277-
redir_url_column = None
278-
for row in cr:
279-
if first:
280-
first = False
281-
header = row
282-
column = 0
283-
for label in header:
284-
if label == 'hubmap_id': id_column = column
285-
if label == 'data_information_page': redir_url_column = column
286-
column = column + 1
287-
if id_column is None: raise Exception(f"Column hubmap_id not found in {url}")
288-
if redir_url_column is None: raise Exception (f"Column data_information_page not found in {url}")
289-
else:
290-
reference_redirects[row[id_column].upper().strip()] = row[redir_url_column]
276+
csv_reader_list.append(cr)
277+
response2 = schema_manager.make_request_get(url2)
278+
resp_txt2 = response2.content.decode('utf-8')
279+
cr2 = csv.reader(resp_txt2.splitlines(), delimiter='\t')
280+
csv_reader_list.append(cr2)
281+
282+
for csv_reader in csv_reader_list:
283+
first = True
284+
id_column = None
285+
redir_url_column = None
286+
for row in csv_reader:
287+
if first:
288+
first = False
289+
header = row
290+
column = 0
291+
for label in header:
292+
if label == 'hubmap_id': id_column = column
293+
if label == 'data_information_page': redir_url_column = column
294+
column = column + 1
295+
if id_column is None: raise Exception(f"Column hubmap_id not found in {url}")
296+
if redir_url_column is None: raise Exception (f"Column data_information_page not found in {url}")
297+
else:
298+
reference_redirects[row[id_column].upper().strip()] = row[redir_url_column]
291299
rr = redirect('abc', code = 307)
292300
print(rr)
293301
except Exception:

‎src/instance/app.cfg.example‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,6 @@ DOI_REDIRECT_URL = 'https://portal.hubmapconsortium.org/browse/<entity_type>/<id
8484
# OLD: https://raw.githubusercontent.com/hubmapconsortium/ccf-releases/main/reference-entity-ids.tsv
8585
# New URL in use since 7/2/2024 following the HRA 2.1 release
8686
REDIRECTION_INFO_URL = 'https://cdn.humanatlas.io/digital-objects/reference-entity-ids.tsv'
87+
#Replace with correct branch in the url for secondary redirection info url
88+
SECONDARY_REDIRECTION_INFO_URL = #'https://raw.githubusercontent.com/hubmapconsortium/entity-api/refs/heads/<branch>/doi-pages/doi-redirect.tsv'
8789

0 commit comments

Comments
 (0)