NASA-PDS / registry-api

Web API service for the PDS Registry, providing the implementation of the PDS Search API (https://github.com/nasa-pds/pds-api) for the PDS Registry.
https://nasa-pds.github.io/pds-api
Apache License 2.0
2 stars 5 forks source link

Proof-of-concept prototype of crosslinking capability to provide applicable tools for a specific product (`/products/{lidvid}/tools`) #498

Open tariqksoliman opened 2 months ago

tariqksoliman commented 2 months ago

Staging

🗒️ Summary

⚙️ Test Data and/or Report

Sample curls:

curl -GET http://localhost:8081/products/urn:nasa:pds:insight_rad::2.1/tools | jq
[
  {
    "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"
  }
]

curl -GET http://localhost:8081/products/urn:nasa:pds:epoxi_mri::1.0/tools | jq
[
  {
    "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": []
    }
  ]
}

♻️ 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.

tloubrieu-jpl commented 2 months ago

Thanks @tariqksoliman ! Just last week, we made some optimization of the opensearch request builder that are conflicting with your code. Do you mind to pull the latest develop branch and rebase it in your branch ? Let me know if you have questions on that.

jordanpadams commented 2 months ago

@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!

tariqksoliman commented 1 month ago

@tloubrieu-jpl As request, I've moved cross-links.json into /service/src/main/resources.

jordanpadams commented 1 month ago

Switching this PR to draft for the time being until we are able to get this into a more production-ready state