Comments (4)
- loan record
json
response in links does not includeself
- for pending loans,
LoanAvailableItems
component - for running loans,
LoanItem
component displaying information on loaned item - address loan actions
-
resolveitem_pid
,pickup_location_pid
,transaction_location_pid
,transaction_user_pid
to their actual objects
from invenio-app-ils.
While working on loan details page, I came across an issue which should be addressed.
The story is when fetching the loan it comes with an item_id
. In order to present relevant information of the item we have to fetch the actual record. In that step we have two options:
- we fire a request from the front end to fetch the entity or
- we create a
$ref
property in the loan and a json ref resolver to replace it with the actual item record.
The benefit of the second approach apart from the extraneous requests (we might need to resolve more type of records), is that if we resolve it we are also able to index it in elastic search.
The hidden circular dependencies problem was not visible straight away due to the fact that we were calling item.replace_refs()
because the item has also $refs
and then we were calling loan.replace_refs()
which had an item with resolved refs inside it. This was preventing the circulation problem to show up and instead threw a Python copy error for failing to deep copy objects.
The actual problem raises from the fact that the item
has a property called circulation_status
(which represents a loan) and the loan has an item, so they are point one another.
Proposed solution is to index everything on the item. It might feel a bit "slow" firing extra requests on the front end but like this, we leave circulation isolated without the hassle of overriding methods that resolve records from other services and we keep all our business logic to ils. As it concerns indexing we had a conversation with @zzacharo and we believe that in the worst case we will have to do an extra db query to fetch the record with the id we are looking for.
I might be missing something obvious or not but is there a case that item -> loan
reference cannot address and we need loan -> item
relation? @ntarocco, @kprzerwa, @ludmilamarian ?
In case you want to test, experiment or whatever the following branches contain the solution with the $ref.
Branches with circular dependencies: invenio-app-ils, invenio-circulation
Update: After a short talk with the team, we will have to explore further and agree on how we will structure our models and their dependencies. Something we tried out with @zzacharo and actually worked, is to manually remove the circulation_status
from the item when it gets resolved by a loan
. Either way I have a branch with each one of the aforementioned solutions (1 and 2) on top.
I will also tag @ntarocco for his feedback since he loves manual manipulations on models.
from invenio-app-ils.
from invenio-app-ils.
@topless nice writing here, thanks for the detailed explanations!
I agree with the solution!
from invenio-app-ils.
Related Issues (20)
- Docker-compose fails at installing fs: use_2to3 invalid.
- Bulk extension backend test
- Requirement parse error at bootstrapping
- Location: make sure an (internal) location name can not be the key of the key used for the total amount (for example: "total")
- docker-compose -f ... up breaks
- Installation/setup issue HOT 1
- Preview with Docker Shows SQLAlchemy Errors, and Server shows "Network Error"
- Docker Preview build
- Create a cookiecutter generation for InvenioILS
- Uploaded EItem file disappearing
- Breaking change when upgrading Invenio modules
- Rework cli setup function for easier usage of cookiecutter-invenio-ils
- Migrate to OpenSearch HOT 1
- Docker preview build fails with syntax error for gyp printing found python version
- cryptography does not support 3.6 - docker build fails
- More problems running the Docker preview HOT 1
- Cannot extend service 'es' in ~/git/invenio-app-ils/docker-services.yml: Service not found
- Broken documentation links HOT 2
- Upgrade invenio packages
- jsonschemas: items: Move isbns to identifiers object
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from invenio-app-ils.