Lightweight analytics tool for FOLIO services
Project description
LDLite
Copyright (C) 2021-2022 The Open Library Foundation. This software is distributed under the terms of the Apache License, Version 2.0. See the file LICENSE for more information.
LDLite is a lightweight, open source reporting tool for FOLIO services. It is part of the Library Data Platform project and provides basic LDP functions without requiring the server to be installed.
LDLite supports two modes of usage.
- Ad-hoc uses a local DuckDB to enable downloading small amounts of data and querying using sql.
- Server uses a persistent postgres server and managed cron server to download large amounts of data for analytic processing and reporting.
Usage with a persistent postgres server
See the Five Colleges Setup for an example of automating overnight data loads.
Usage for ad-hoc local querying
To install LDLite or upgrade to the latest version:
$ python -m pip install --upgrade ldlite
(On some systems it might be python3 rather than python.)
If you encounter the error ImportError: no pq wrapper available. you can either
- Run
python -m pip install psycopg[binary] - Ensure the libpq package is installed for your operating system
Check out the migration guide for more information about major version upgrades.
To extract and transform data:
$ python
>> > import ldlite
>> > ld = ldlite.LDLite()
>> > ld.connect_folio(url='https://folio-etesting-snapshot-kong.ci.folio.org',
tenant='diku',
user='diku_admin',
password='admin')
>> > db = ld.connect_db()
>> > _ = ld.query(table='g', path='/groups')
ldlite: querying: / groups
ldlite: created
tables: g, g__t, g__tcatalog
>> > ld.select(table='g__t')
__id | id | desc | expiration_offset_in_days | group
------+--------------------------------------+-----------------------+---------------------------+-----------
1 | 3684a786-6671-4268-8ed0-9db82ebca60b | Staff Member | 730 | staff
2 | 503a81cd-6c26-400f-b620-14c08943697c | Faculty Member | 365 | faculty
3 | ad0bc554-d5bc-463c-85d1-5562127ae91b | Graduate Student | | graduate
4 | bdc2b6d4-5ceb-4a12-ab46-249b9a68473e | Undergraduate Student | | undergrad
(4 rows)
>> > _ = ld.query(table='u', path='/users')
ldlite: querying: / users
ldlite: created
tables: u, u__t, u__t__departments, u__t__personal__addresses, u__t__proxy_for, u__tcatalog
>> > cur = db.cursor()
>> > _ = cur.execute("""
CREATE TABLE user_groups AS
SELECT u__t.id, u__t.username, g__t.group
FROM u__t
JOIN g__t ON u__t.patron_group = g__t.id;
""")
>> > ld.export_csv(table='user_groups', filename='groups.csv')
Features
- Queries FOLIO modules and transforms JSON data into tables for easier reporting
- Full SQL query support and export to CSV
- Compatible with DBeaver database tool
- Compatible with DuckDB and PostgreSQL database systems
- PostgreSQL support enables:
- Sharing the data in a multiuser database
- Access to the data using more database tools
- Storing the data in an existing LDP database if available
- Runs on Windows, macOS, and Linux.
More examples
LDLite resources
-
The LDP project runs a Slack workspace which is a good place to ask questions or to share your work. It also serves as a community space for working together on library data problems. To request an invitation, use the Contact page on the LDP website.
-
Report bugs at Issues
Other resources
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ldlite-3.2.1.tar.gz.
File metadata
- Download URL: ldlite-3.2.1.tar.gz
- Upload date:
- Size: 31.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.25.5 CPython/3.9.23 Linux/6.6.87.2-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8367a488bfe36c745cb0bf6f2fe283266d2c2fbc526648bff172568988e540d2
|
|
| MD5 |
00d324ba7012809d31bc8bbc936415d7
|
|
| BLAKE2b-256 |
5d33de5f1bf92ac9d382903849c8b82872cbb31cacc869f1ebe774f88457618e
|
File details
Details for the file ldlite-3.2.1-py3-none-any.whl.
File metadata
- Download URL: ldlite-3.2.1-py3-none-any.whl
- Upload date:
- Size: 26.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.25.5 CPython/3.9.23 Linux/6.6.87.2-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f8c52d9ad0b20a3b7b2221ba733fe4ef1b4803341c1f3b1e2e21f9d9ed89b12
|
|
| MD5 |
40bba5b84bc5ed8d2c31cd50a5abb76a
|
|
| BLAKE2b-256 |
e4a144aa2c4cde6e0d80ceae1d37b5a933aa33cae468e0babb2d898914593bb3
|