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.
To use this repo as-is, with fake/modified data from Miami University's initial instance, do this on the command line:
npm update
touch .env
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
cp samples/cache/* cache/
cp config/default-sample.json config/default.json
cp samples/fakeusers/* fakeUsers/
cp config/fakeUser-sample.json config/fakeUser.json
cp config/sierraConf-sample.json config/sierraConf.json
./getData.sh
./compileSubjectCache.sh
-- (ignore “no such file” warning)./restart
-- the app should be running on localhost:9999, and logging errors to logs/app.log
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.
npm update
to install dependencies.env
file in the top level directory of the appconfig/default-sample.json
to config/default.json
and add your organization's CAS server details and secret key.env
file (see below)cron
or similar, run the ./getData.sh
periodically; this will:
./restart
, which will run some checks for missing data in advance of running the app. (To skip these checks, run the app using node app
(on localhost), or npm run server
to run on the server.).env
./killapp
./killapp -r
or ./restart
./getData.sh
pulls JSON lists of Subjects, Databases, Librarians, & Guides from LibGuides and stores them in the ./cache/
folder
./getData.sh
retrieves the Librarians info, it's written to ./cache/LibrariansTemp.js
, the ./getData.sh
script goes on to process the content with utilities/runCleanCache.js
, which cleans up the "mysched" scheduling block widget code, adding a standard class and applying standardized CSS to eliminate visual variation between librarians.compileSubjectCache
(see below)utilities/compareLGSubjects
and reports on any changes since the last update. If there are changes, they may need to be reflected in the Majors.js file manually (e.g. if a Subject guide changes name)./models/Majors.js
is a manually-compiled list of majors and course subjects, including registrar's department codes and program codes, the human-readable department name, and the names of the associated LibGuide Subjects. (LibGuide Subjects are the broader categories; each subject may have zero or more linked Guides -- Majors.js knows about the Subjects, not the Guides.)node compileSubjectCache.js
reads the cached LibGuides data and the Majors array to synthesize the relevant data for each subject area: for each subject in the Majors array, it creates a file in ./cache/subjects/
that lists all of the Guides, Databases, and Librarians associated with the LibGuides Subjects identified in Majors.js. The subject cache will include duplicate files for variant versions of a subject name, e.g. WomensGenderandSexualityStudies.json
and WomensGenderSexualityStudies.json
node coverageReport.js
to generate cache/subjects/coverageReport.csv
listing number of librarians, guides, and databases per subject.env
file:PORT=4000
SITE_ID=007
KEY=asdfasdfasdfasdfasdfasdfasd
ALLOWED_USERS='root,someuser'
ON_SERVER=true
npm run server
: adds --name=Dashboard
for easy finding./killapp
: searches processes for dashboard
and kills that proc./killapp -r
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
)
npm test
./samples/
-- these JSON files contain simulated CAS data for a variety of users./config/fakeUser-sample.json
file./config/fakeUser.json
; in that file, set "useFakeUser": false
and select the "fakeUserId" you wish to simulate; IDs start from 0, referencing the "fakeUsers" array.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.
{
name: 'Music',
majorCode: 'ASJA',
majorName: 'Music',
majorCode2: 'FAJA',
majorName2: 'Music',
regCode: 'MUS',
regName: 'Music',
deptCode: 'mus',
deptName: 'Music',
libguides: ['Music'],
},
./cache/subject/
named Journalism.json
Journalism.json
will be based on the librarians, databases, and guides associated with the Music
LibGuide Subject in the ./cache/Subjects.js
file:{
"id" : "8429",
"ordering" : "0",
"site_id" : "594",
"slug" : null,
"name" : "Music"
}
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.
https://community.miamioh.edu/directory-accounts/api/prefixDetails?type=dpt
The Dashboard was developed by Ken Irwin at the Miami University Libraries with UI support from Meng Qu.