dandi / dandi-archive

DANDI API server and Web app
https://dandiarchive.org
13 stars 10 forks source link

Make NIH awards clickable links #865

Open yarikoptic opened 2 years ago

yarikoptic commented 2 years ago

From my toying around with https://api.reporter.nih.gov/#/Search/post_v2_projects_search on an example of our ReproNim project which is 1P41EB019936-01A1 .

$> curl --silent -X POST "https://api.reporter.nih.gov/v2/projects/search" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"criteria\":{\"project_nums\":[\"1P41EB019936-01A1\"]},\"include_fields\":[\"ApplId\",\"SubprojectId\",\"FiscalYear\",\"Organization\",\"ProjectNum\",\"ProjectNumSplit\",\"ContactPiName\",\"AllText\",\"FullStudySection\",\"ProjectStartDate\",\"ProjectEndDate\"],\"offset\":0,\"limit\":25,\"sort_field\":\"project_start_date\",\"sort_order\":\"desc\"}" >| /tmp/out.json

$> jq '.results[].appl_id' < /tmp/out.json
8999833
8999834
8999841
8999840
8999838
8999835

didn't check but I believe they all go for the same award but different years, we could may be choose the latest and then URL is e.g. https://reporter.nih.gov/project-details/8999835 .

API seems to respond quite fast so in principle could be built in into grant number form entry to list matching grant records (PI, title) for the user to choose from

waxlamp commented 2 years ago

Are you suggesting selecting an official result from the reporter API at the time an award is added to the dandiset? So, an owner would specify the award number, the API would run on the spot and show a list of awards, and the user could select one? (Or perhaps, we pick one via the heuristic you suggested.) Then, that link would become part of the dandiset metadata?

yarikoptic commented 2 years ago

I was thinking of making it "dynamic", i.e. it could be some on-click action which would perform that query (with caching) and redirect to that URL. This way we could adjust action whenever target URL was to change etc, without needing to go and change the metadata. Persistent information here is the award number, not URL really.

satra commented 2 years ago

i think we could also help the process of adding the info by searching through awards via reporter in the meditor.

waxlamp commented 2 years ago

i think we could also help the process of adding the info by searching through awards via reporter in the meditor.

This is an interesting idea. Essentially, a little embedded search engine for award numbers in the meditor.

waxlamp commented 2 years ago

I was thinking of making it "dynamic", i.e. it could be some on-click action which would perform that query (with caching) and redirect to that URL. This way we could adjust action whenever target URL was to change etc, without needing to go and change the metadata. Persistent information here is the award number, not URL really.

I don't think this is a good idea. If we have the award number then presumably we can construct the URL statically from it--no need for a live query on click. On the other hand, we could also simply link to the search results page for that award number (if indeed it's not possible to programmatically construct the right URL).