Open qjhart opened 8 months ago
This data is all available in the expert's complete API record, but it is more verbose:
{
"assignedBy": {
"@type": "FundingOrganization",
"name": "NASA/MISCELLANEOUS CENTERS",
"@id": "ark:/87287/d7gt0q/grant/K382939-102424#funder"
},
"dateTimeInterval": {
"start": {
"dateTime": "2011-05-01",
"@id": "ark:/87287/d7gt0q/grant/K382939-102424#start_date",
"dateTimePrecision": "vivo:yearMonthDayPrecision"
},
"end": {
"dateTime": "2015-04-30",
"@id": "ark:/87287/d7gt0q/grant/K382939-102424#end_date",
"dateTimePrecision": "vivo:yearMonthDayPrecision"
},
"@id": "ark:/87287/d7gt0q/grant/K382939-102424#interval"
},
"@type": [
"Grant",
"Grant_Research"
],
"name": "NEAR REAL TIME SCIENCE PROCESSING ALGORITHM FOR LIVE FUEL MOISTURE CONTENT FOR THE MODIS DIRECT READOUT SYSTEM",
"@id": "ark:/87287/d7gt0q/grant/K382939-102424",
"relatedBy": [
{
"relates": [
{
"@type": "vivo:Person",
"name": "KOLTUNOV, ALEXANDER",
"@id": "ark:/87287/d7gt0q/grant/K382939-102424#co_pi_586b332a4702f921115e6560a936b4b5"
},
"ark:/87287/d7gt0q/grant/K382939-102424"
],
"@type": "CoPrincipalInvestigatorRole",
"@id": "ark:/87287/d7gt0q/grant/K382939-102424#co_pi_role_586b332a4702f921115e6560a936b4b5"
},
{
"relates": [
{
"@type": "vivo:Person",
"name": "HART, QUINN J",
"@id": "ark:/87287/d7gt0q/grant/K382939-102424#co_pi_b66911c899cd3447cee58cf14392df0a"
},
"ark:/87287/d7gt0q/grant/K382939-102424"
],
"@type": "CoPrincipalInvestigatorRole",
"@id": "ark:/87287/d7gt0q/grant/K382939-102424#co_pi_role_b66911c899cd3447cee58cf14392df0a"
},
{
"relates": [
{
"@type": "vivo:Person",
"name": "USTIN, SUSAN L",
"@id": "ark:/87287/d7gt0q/grant/K382939-102424#co_pi_572cba88db679c9931b4efcbde6e686d"
},
"ark:/87287/d7gt0q/grant/K382939-102424"
],
"@type": "CoPrincipalInvestigatorRole",
"@id": "ark:/87287/d7gt0q/grant/K382939-102424#co_pi_role_572cba88db679c9931b4efcbde6e686d"
},
{
"inheres_in": "expert/66356b7eec24c51f01e757af2b27ebb8",
"relates": [
"ark:/87287/d7gt0q/grant/K382939-102424",
"expert/66356b7eec24c51f01e757af2b27ebb8"
],
"@type": [
"GrantRole",
"CoPrincipalInvestigatorRole"
],
"@id": "ark:/87287/d7mh2m/relationship/13749424",
"is-visible": true
},
{
"relates": [
{
"@type": "vivo:Person",
"name": "USTIN, SUSAN L",
"@id": "ark:/87287/d7gt0q/grant/K382939-102424#pi"
},
"ark:/87287/d7gt0q/grant/K382939-102424"
],
"@type": "PrincipalInvestigatorRole",
"@id": "ark:/87287/d7gt0q/grant/K382939-102424#pi_role"
}
],
"sponsorAwardId": "NNX11AF93G"
}
I added another endpoint example, https://sandbox.experts.library.ucdavis.edu/api/miv/raw_grants?userId=quinn
This allows searching on the date, but responds with a matching list of the grants, but unmodified from how they are in the standard document. If you are familiar with jq you can pretty much create the current record from the raw with:
http https://sandbox.experts.library.ucdavis.edu/api/miv/raw_grants?userId=quinn Authorization:"Bearer $jwt" |\
jq '.[] | {"@id","title":.name,"end_date":.dateTimeInterval.end.dateTime,"start_date":.dateTimeInterval.start.dateTime,"grant_amount":.totalAwardAmount,"sponsor_id":.sponsorAwardId,"sponsor_name":.assignedBy.name,"type":.["@type"],"role_label":(.relatedBy[] | select(.inheres_in) | .["@type"])}'
Reviewing the rc.experts log file, MIV seems to still use the sparql query match from the last query. This uses three parameters,
cas
,since
,until
. The query flattens the data into a more concise summary.Comparison
Using the query on
cas=quinn
, here is an grant returned.We have created and API endpoint that approximates this format. The endpoint is: /api/miv/grants?userId={id}&since=[date]&until=[date]. where userId is IAM's standard variable for cas. The equivalent grant is:
Issues
There are the following differences that need to be addressed:
Identifier
Because there are now two source for grants (kfs for archive, enterprise for current) we have two diffferent identifiers. We used arks: to differentiate them, but you can see the last part is the original kfs number, so we can replicate the
grant:number
for the old ones, and decide on what to do for the new ones.Also, active grants (~6K) we're moved to the Aggie Enterprise, and in our system, we removed those from the kfs, and they have a new identifier
type
Aggie Enterprise didn't transfer the single character grant type. Here is a table of the KFS, AE and combined grant types:
Need some guidance on what MIV would like to see.
CoPIs
The PI is represented as both a PI, and a CO-PI. This is because we know the PI designation at UCD, but we don't know if the sponsor has a different PI, or Co-Pis for the grant.
In addition, the Co-PIs don't have their associated cas ids, because we try to include all, regardless of their affiliation.
Authorization
In addition to the backend change, we have standardized the library's auth[z] mechanism. Currently, there is a long living jwt token that MIV uses to authenticate. In the new system. MIV will have a service account with a never expiring password, and that service account will get a token to use for calling the MIV api. This token will be relatively short lived (1 hr). We anticipate MIV getting a token for every request. Here's an example: