Clojure Libraries in ODH

Table of Contents

Intro

The following is a copy of a blog post for our organization, originally posted at https://odh.byu.edu/blog/clojure-libraries-in-odh

My work with The Office of Digital Humanities is as a senior web developer. My teams and I build applications in the Clojure programming language1 to serve the college of Humanities and the Office of Digital Humanities, and utility libraries that serve the university and the broader developer community. Here are a few of our heavily used utility libraries, which have been used internally for years.

  • Retabled: A tabular data solution, for showing speadsheet-like views of data
  • BYU-CAS: A Clojure client for BYU’s particular Central Authentication Service
  • Reformation: A utility for generating forms for applications or reviews of said applications

Retabled

img

Our Retabled library was birthed from the repeated need to display tabular data in our web apps2 and limitations in existing tabular data libraries.3 Our current version of Retabled includes sorting, filtering, and linkability/shareability through regular URLs. In a recently added feature it also pairs with another library4 of ours to allow CSV downloads of the data you are viewing that can be viewed in Excel, LibreOffice Calc, Google Sheets, or whatever other table viewer you like.

BYU-CAS

img

Universities have for a long time used the CAS (Central Authentication Service) method for logging in to their systems. Java, of course, has a solid official CAS implementation library5. Since Clojure is fully compatible with the two biggest code ecosystems as of 20226, it was only a matter of convenience to adapt the CAS implementation into something customized to the BYU CAS servers and for easy use in our Clojure apps, allowing all of them to draw upon CAS login both for safe-guarding pages and for obtaining user information necessary for some application use7.

Reformation

img

One of the major services we perform is to create form applications that can replace old paper-submission applications for various kinds of funding, both for University students and for faculty. We have complemented some of our efforts with third-party form application8, but still operate certain forms we develop via custom solutions when they need to integrate University data about the applicants or observe FERPA data security requirements for student data privacy. Our Reformation library9 does just two things: it provides a clean and consistent way of defining a form which can be drawn on a web page and submitted when filled out, and also provides a way of viewing a read-only version of a submission that has been made earlier in Reformation. Although there are other libraries for generating React or Reagent-based forms, they lack certain features we needed.10

Conclusion

These are a few of the libraries we use internally; we are happy to make them available to the community, but our response to requests is limited by our priority use needs within our college and university.

Footnotes

1 The Clojure Language draws upon a tradition of flexibility, fun, and power, and particularly emphasizes stability and battle-ready performance. The stability is great for the long-lived utility applications, and the flexibility is well suited for the Humanities research applications my teams support. Learn more about Clojure at https://clojure.org/.

2 We use Reagent, a Single Page Application library available at https://holmsand.github.io/reagent/. It is a high-performance wrapper for Facebook’s React.js, and has a tradition of innovating improvements so effective they are inspiration to upgrades to React itself.

3 One major Clojure table library is reagent-table at https://github.com/Frozenlock/reagent-table, as well as some popular React libraries like Material Table, RSuite Table, React Table, Material UI Table. But those alternatives included some difficult customizability stories, or include sort a kitchen sink approach with more complexity and fragility than was necessary for us. They have, however, been useful inspiration for features and approaches.

4 cljc-csv https://gitlab.com/BYU-ODH/cljc-csv is a super-lightweight library for converting the data format of Retabled or straight from your database into CSV strings which can be inserted for download straight into a web page, without creating any file that will need to be stored.

5 Here is the foundational Java CAS implementation: https://github.com/apereo/java-cas-client/

6 Java long held the title of biggest code repository with Maven. In 2019 Javascript took the lead thanks to NPM. Clojure and ClojureScript can utilize easily utilize these big ecosystems, meaning lots of already-solved problems and resources are available.

7 Our byu-cas implementation is available at https://github.com/BYU-ODH/byu-cas

8 For some of our Faculty-serving applications we started with formstack https://www.formstack.com/ and then made a very happy switch to Kuali Build. Kuali Build https://www.kualibuild.com has offered a much better API integration and more responsive support system, and has a pay model that makes a lot more sense for our needs.

9 Our Reformation library is open source and available at https://github.com/BYU-ODH/reformation. You’ll have noticed a mix of GitLab and GitHub for our libraries; we are in the gradual process of moving our operations out of GitHub, but it is not a priority for older projects.

10 Features of Reformation forms include typical short and long text boxes, select dropdowns, areas that appear only when a checkbox has been checked, and, crucially, multi tables that allow applicants to fill out a set of data (e.g. name, teacher, grade, etc for a class they’ve taken at another university) and add additional rows to the fillable-table (e.g. “list all classes that you’ve taken about…").The multitables and the review option were two crucial features that we didn’t find in other solutions.

Tory Anderson avatar
Tory Anderson
Full-time Web App Engineer, Digital Humanist, Researcher, Computer Psychologist