Proof-of-concept prototype of crosslinking capability to provide applicable tools for a specific product (/products/{lidvid}/tools)#498
Conversation
|
Thanks @tariqksoliman ! |
alexdunnjpl
left a comment
There was a problem hiding this comment.
Some comments - will look closely at the meat of CrossLinks.java once doco is there
service/for
Outdated
There was a problem hiding this comment.
Request: remove extraneous file
There was a problem hiding this comment.
Branch needs to be rebased on #489
@tariqksoliman @tloubrieu-jpl this should be simple - if it isn't and you'd like to get this in before taking the time to understand the new approach, let me know and I should be able to sort out the conflict pretty quickly
There was a problem hiding this comment.
Docstring please - ideally I should be able to read it and walk away with a good understanding of what it is/does (for the class, and any inobvious methods)
https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html
service/unittests.txt
Outdated
There was a problem hiding this comment.
Prefer: remove file and add path to .gitignore
There was a problem hiding this comment.
Does this need to be configurable, or is this behaviour a relatively-immutable structured collection of values which could be defined within the Java code?
I'm taking it on faith that loading from a JSON configuration is the way to go here vs defining a constant - as long as that question was considered that's fine.
|
@tariqksoliman we can talk more about this offline at the next IMG - EN tag-up, but for an operational deployment to enable supporting this at scale across the PDS, we will need to refactor this to use Product_Service, e.g. this one for analyst's notebook. I thought I documented this in the ticket, but looks like this was just an offline discussion at our last meeting. Thanks for the PR! |
/products/{lidvid}/tools)
|
@tloubrieu-jpl As request, I've moved cross-links.json into |
|
Switching this PR to draft for the time being until we are able to get this into a more production-ready state |
Staging
🗒️ Summary
/products/{lidvid}/toolslidvid -> toolmappings. Located at/service/cross-links.jsonCrossLinksLoader.javafile to load that file on startCrossLinks.javafile to represent that json file and perform the mapping logicproductCrossLinks()method toProductsController.javaCrossLinksto get all tool cross-links.⚙️ Test Data and/or Report
Sample curls:
[ { "link": "https://an.rsl.wustl.edu/ins/AN/an3.aspx?it=B1&ii=readme", "description": "A tool for accessing the science data archives from NASA landed Mars and lunar missions.", "tool": "analysts_notebook" }, { "link": "https://pds-imaging.jpl.nasa.gov/beta/record?lidvid=urn:nasa:pds:insight_rad::2.1", "description": "The Official Image Search of the PDS Cartography and Imaging Sciences Node (PDSIMG)", "tool": "atlas4" } ][ { "link": "https://pds-imaging.jpl.nasa.gov/beta/record?lidvid=urn:nasa:pds:epoxi_mri::1.0", "description": "The Official Image Search of the PDS Cartography and Imaging Sciences Node (PDSIMG)", "tool": "atlas4" } ]Explanation of cross-links.json
Sample:
{ "injectableParams": [ "vid", "lid", "lidvid", "mission", "spacecraft", "bundle", "collection", "target", "filename", "filenameWithoutFileExtension", "fileExtension", "fileRef", "productClass", "productType", "nodeName" ], "tools": [ { "name": "analysts_notebook", "base": "https://an.rsl.wustl.edu/{mission}/AN/an3.aspx?it=B1&ii={filenameWithoutFileExtension}", "description": "A tool for accessing the science data archives from NASA landed Mars and lunar missions.", "aliases": [ { "field": "mission", "alias": "m20", "from": ["mars_2020", "m2020", "mars2020", "Mars2020"] }, { "field": "mission", "alias": "ins", "from": ["InSight"] } ], "acceptOnly": [ { "field": "mission", "match": "m20" }, { "field": "mission", "match": "ins" }, { "field": "fileExtension", "match": "\\.IMG" } ], "reject": [{ "field": "lidvid", "match": ".*mars2020_helicam.*" }] }, { "name": "atlas4", "base": "https://pds-imaging.jpl.nasa.gov/beta/record?lidvid={lidvid}", "description": "The Official Image Search of the PDS Cartography and Imaging Sciences Node (PDSIMG)", "aliases": [], "acceptOnly": [], "reject": [] } ] }injectableParams: Doesn't nothing but indicate with params can be set in a tool's"base"url.toolsname: tool name that just gets passed to the responsebase: Base template url to deep link to the given lidvid product in the tool.injectableParamscan be templated by wrapping it in curly brackets:{injectableVariable}description: tool description that just gets passed to the responsealiases: Sometimes tools have slightly different names for things. If a tool requires "m20" in their url, aliases allows such mapping.acceptOnly: Leave as empty array to accept all, otherwise if a lidvid's field's value does not match what's configured here, the tool entry will not show in the response.acceptOnlys are ANDed together. "match" supports java regexesreject: Leave as empty array to not specify any rejections. Otherwise if any lidvid's field matches a reject case, the tool entry will not show up in the response. "match" supports java regexes♻️ Related Issues
Fixes #472
Note: This is my first PR and first time using Java in over a decade so please review this with extra caution.