Giter VIP home page Giter VIP logo

Comments (4)

topless avatar topless commented on August 27, 2024
  • loan record json response in links does not include self
  • for pending loans, LoanAvailableItems component
  • for running loans, LoanItem component displaying information on loaned item
  • address loan actions
  • resolve item_pid, pickup_location_pid, transaction_location_pid, transaction_user_pid to their actual objects

from invenio-app-ils.

topless avatar topless commented on August 27, 2024

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:

  1. we fire a request from the front end to fetch the entity or
  2. 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.

topless avatar topless commented on August 27, 2024

Screenshot 2019-01-08 01.19.04.png

from invenio-app-ils.

ntarocco avatar ntarocco commented on August 27, 2024

@topless nice writing here, thanks for the detailed explanations!
I agree with the solution!

from invenio-app-ils.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.