ucd-library / aggie-experts

Publicly reported feedback and issues for Aggie Experts
https://ucd-library.github.io/aggie-experts/
MIT License
1 stars 2 forks source link

MIV support #334

Open qjhart opened 8 months ago

qjhart commented 8 months ago

MIV Integration

The MIV team have simple access to the an experts data, in particular, their grants data. MIV can easily access experts data, and are provided any specific APIs that they might need to simplify their tasks.

QA / QC We will work with Stephen Paulsen on the development of the best API for this access

qjhart commented 8 months ago

Authorization

We are updating our authorization method for all library applications. We are using a single keycloak authorization server, and using that to mint signed tokens, define roles and manage active tokens.

For MIV, we’ll share an miv user/password service account combination, that does not require full CAS identification. We’ll also specify an MIV client with a client secret. You can use this to generate an authorization token for accessing aggie-experts. We are looking into making this specific token long lived, even though you can get them on demand, like per-request.

You’re current sdpaulsen cas account has the same MIV role, so you can access the data via your browser as well.

API

We can specialize an API creation specifically for MIV. To best match the current setup, we could include cas, start_date,~enddate~ as the parameters to an endpoint like: /api/miv/grants?cas=quinn,start_date=2000-01-01&end_date=2024-02-15

We can use a format for the grants that is more consistent with what we are using in our application or match the current setup.

  1. Identifiers

    We are trying to me more consistent with our identifier scheme and for grants this means that we want to explicitly differeniate if the grant is in the new Aggie Enterprise system, or has been archived by us. We are currently thinking of using arks: to specify the different sources for the identifiers that we use. Grants come from both the new aggie enterprise system, and the old KFS system. We’ve created ark: prefixes for both these. In addition, to simplify comparison between the two (eg. to make sure they don’t exist twice) we’ve added the computed orcale identifier for old KFS grants as well. However, they are not unique in KFS, so we also added the original KFS number. This is different then the current setup.

    The current setup uses the old KFS identifier number for the grants:

    {
      "@graph": [
      {
      "@id" : "grant:102424",
        "title" : "NEAR REAL TIME SCIENCE PROCESSING ALGORITHM FOR LIVE FUEL MOISTURE CONTENT FOR THE MODIS DIRECT READOUT SYSTEM"
    }],
      "grant":"http://experts.ucdavis.edu/grant/",
    }

    The KFS system is now deprecated. Not all grants are being moved to the new system, so some older grants are being moved to CDL’s elements service, which have their own identifiers:

    One proposed scheme is to use these new source (CDL elements), and use that ark: and the CDL identifer for the ’@id’

    {
      "name": "NEAR REAL TIME SCIENCE PROCESSING ALGORITHM FOR LIVE FUEL MOISTURE CONTENT FOR THE MODIS DIRECT READOUT SYSTEM",
      "@id": "ark:/87287/d7mh2m/grant/4431398",
    }

    Alternatively

Format

We are trying to be more standardized with our repesentation with our own application, and with any partner applications. So, we are trying to create data that maintains a valid linked-data file, while also being more proactively convenient of a JSON representation for developers. This implies framing the data so it is more readable.

Current Query

This is the full linked-data query in the current system.

PREFIX experts: <http://experts.ucdavis.edu/>
PREFIX grant: <http://experts.ucdavis.edu/grant/>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX person: <http://experts.ucdavis.edu/person/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ucdrp: <http://experts.ucdavis.edu/schema#>
PREFIX vcard: <http://www.w3.org/2006/vcard/ns#>
PREFIX vivo: <http://vivoweb.org/ontology/core#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX null: <#>
construct {
  ?grant null:cas ?cas_name;
     null:type ?type_abbrev;
  null:title ?title;
  null:sponsor_name ?sponsor_name;
  null:sponsor_id ?sponsor_id;
  null:sponsor_sponsor_name ?pass_thru_sponsor;
  null:grant_amount ?grant_amount;
  null:start_date ?start_date;
  null:end_date ?end_date;
  null:role_label ?role; .
  ?other_role null:name ?other_role_name;
          null:role ?other_role_label;
          null:casId ?casId; .
} WHERE {
  bind('stephenp' as ?cas_name)
  bind('2000-01-01' as ?since)
  bind('2024-02-13' as ?until)
  bind(uri(concat(str(person:),md5(?cas_name))) as ?researcher)
  ?grant_role obo:RO_000052 ?researcher;
          a ?role;
          .
  ?grant a vivo:Grant;
     rdfs:label ?title;
     vivo:relates ?grant_role;
     vivo:sponsorAwardId ?sponsor_id;
     ucdrp:grantType/ucdrp:abbrev ?type_abbrev;
     vivo:totalAwardAmount ?grant_amount;
     vivo:assignedBy/rdfs:label ?sponsor_name;
     vivo:dateTimeInterval [ vivo:start [vivo:dateTime ?start_date ] ;
                 vivo:end [vivo:dateTime ?end_date ] ];
                                   .
  OPTIONAL {
    ?grant ucdrp:subAwardOf/vivo:assignedBy/rdfs:label ?pass_thru_sponsor.
  } .
  OPTIONAL {
    ?grant vivo:relates ?all_roles.
    ?all_roles rdf:type/ucdrp:abbrev ?other_role_label;
           obo:RO_000052 [rdfs:label ?other_role_name;
                 ucdrp:casId ?casId]
    .
    filter(?all_roles != ?grant_role)
    bind(uri(concat(str(?grant),"\uFDD1",md5(concat(?other_role_name,?other_role_label)))) as ?other_role)
  }
  filter( xsd:date(?since) <= xsd:date(?start_date) &&
     xsd:date(?start_date) <= xsd:date(?until) )
} limit 500

An output for quinn might be:

      {
  "@graph" : [ {
    "@id" : "grant:101639",
    "cas" : "quinn",
    "end_date" : "2011-12-31",
    "null:grant_amount" : 0,
    "role_label" : [ "vivo:ResearcherRole", "ucdrp:GrantOtherRole" ],
    "sponsor_id" : "NAS203144TO0308MDD",
    "sponsor_name" : "NASA AMES RESEARCH CENTER",
    "start_date" : "2011-01-01",
    "title" : "DEVELOPMENT OF A VICARIOUS CALIBRATION PROGRAM FOR THE NASA FACILITY E-MAS, MAS AND MASTER IMAGERS",
    "type" : "C"
  }, {
    "@id" : "grant:101639﷑bf09bc1de2870cbe5b735ff0aa6677cc",
    "casId" : "sashak",
    "name" : "KOLTUNOV, ALEXANDER",
    "role" : "OTHR"
  }, {
    "@id" : "grant:101639﷑c484218383a7dba823b38fbc6b1c9bcc",
    "casId" : "fzustin",
    "name" : "USTIN, SUSAN L",
    "role" : "PI"
  }, {
    "@id" : "grant:102424",
    "cas" : "quinn",
    "end_date" : "2015-04-30",
    "null:grant_amount" : 783000,
    "role_label" : [ "ucdrp:GrantCoPrincipalInvestigatorRole", "vivo:CoPrincipalInvestigatorRole" ],
    "sponsor_id" : "NNX11AF93G",
    "sponsor_name" : "NASA/MISCELLANEOUS CENTERS",
    "start_date" : "2011-05-01",
    "title" : "NEAR REAL TIME SCIENCE PROCESSING ALGORITHM FOR LIVE FUEL MOISTURE CONTENT FOR THE MODIS DIRECT READOUT SYSTEM",
    "type" : "C"
  }, {
    "@id" : "grant:102424﷑c484218383a7dba823b38fbc6b1c9bcc",
    "casId" : "fzustin",
    "name" : "USTIN, SUSAN L",
    "role" : "PI"
  }, {
    "@id" : "grant:102424﷑d4e91bb0663b0bff910bee7be520a039",
    "casId" : "sashak",
    "name" : "KOLTUNOV, ALEXANDER",
    "role" : "COPI"
  } ],
  "@context" : {
    "grant" : "http://experts.ucdavis.edu/grant/",
    "experts" : "http://experts.ucdavis.edu/",
  }
}