Miamiohlibs / Dashboard

CAS-authenticated user dashboard with relevant LibGuides data
MIT License
2 stars 0 forks source link

Dashboard

Dashboard connects authenticated campus users with LibGuides data pertaining to their course and department affiliations. The Dashboard was developed by the Miami University Libraries in Ohio. Much of the code is specific to Miami's own situation; developers are welcome to fork the repo to develop it for their own uses.

Requirements

Additional (optional) ILS integration

Initial (Test) Setup

To use this repo as-is, with fake/modified data from Miami University's initial instance, do this on the command line:

fetch dependencies

  1. npm update

setup environment

  1. touch .env
  2. edit the .env file to include a version of this text ALLOWED_USERS=‘yourusername,root' (include the names of the users who should be permitted to start the app from the command line; this is more important in a server environment). If you're installing the Dashboard on a server, set ON_SERVER=true; otherwise use ON_SERVER=false

copy sample files to their locations

  1. cp samples/cache/* cache/
  2. cp config/default-sample.json config/default.json
  3. cp samples/fakeusers/* fakeUsers/
  4. cp config/fakeUser-sample.json config/fakeUser.json
  5. cp config/sierraConf-sample.json config/sierraConf.json
  6. edit the config files with the values you choose; you will need infomation about your CAS instance, LibGuides & Sierra API keys

generate cached subject files

  1. ./getData.sh
  2. ./compileSubjectCache.sh -- (ignore “no such file” warning)

start the app

  1. ./restart -- the app should be running on localhost:9999, and logging errors to logs/app.log

Full Setup

To use the app with your own data, you'll need to do some additional setup, and have appropriate API keys for your LibGuides instance.

How the Parts Connect

Auditing coverage

Sample .env file:

PORT=4000
SITE_ID=007
KEY=asdfasdfasdfasdfasdfasdfasd
ALLOWED_USERS='root,someuser'
ON_SERVER=true

Running the service

Routes

The service offers two routes: / - the normal html view /json - view the userinfo tree as json (useful for while we're building views -- this should probably be removed in production )

Running tests

Fake User Accounts

Custom Data

If you have a subject area for which there is no LibGuides subject, you can fake it! (We use this is our library for members of the library -- we link to some internal LibGuides that don't have their own public-facing "department"). Manually build a subject file in ./cache/custom, e.g. ./cache/custom/Library.json. The ./compileSubjectCache script will copy it over to the ./cache/subjects directory after compiling the other subject guides.

Data Structure

models/subjCodes.js

{
    name: 'Music',
    majorCode: 'ASJA',
    majorName: 'Music',
    majorCode2: 'FAJA',
    majorName2: 'Music',
    regCode: 'MUS',
    regName: 'Music',
    deptCode: 'mus',
    deptName: 'Music',
    libguides: ['Music'],
  },
{
      "id" : "8429",
      "ordering" : "0",
      "site_id" : "594",
      "slug" : null,
      "name" : "Music"
}

Subjects.js

In turn, the LibGuides subject ID defined above (8429) will include in the ./cache/subjects/Music.json file all the Librarians, Databases, and Guides that are associated with id: 8429 in ./cache/Librarians.js, ./cache/Database.js, and ./cache/Guides.js files

utilities/getSubjCodes.sh

Periodically, run the utilities/getSubjCodes.sh file to fetch any new or changed subject codes from campus APIs. Then run node utilities/checkSubjectCodes to audit the updated information against the existing models/subjCodes file and check for any discrepancies.

Miami departments list including non-academic depts:

https://community.miamioh.edu/directory-accounts/api/prefixDetails?type=dpt

Credits

The Dashboard was developed by Ken Irwin at the Miami University Libraries with UI support from Meng Qu.