This project, built in Daml, deals with student applications to universities.
A student can apply to a university. The university asks some teachers to review the application and decides whether to welcome or reject the student based on a score determined by the gathered reviews.
- student creates an
ApplicationRequest
contract mentioning the targeted university and containing a cover letter that fits length constraints - university exercises
ProcessRequest
and decides who will be the reviewing teachers and how many reviews are required at least. This creates anApplicationPending
contract, and oneReviewRequest
contract for each of the teachers. - teacher exercises
Evaluate
orScore
on theirReviewRequest
contract to create a correspondingReview
contract. - student may exercise the non consuming choice
Consult
on anyReview
to check the score they were given. - university queries for
Review
contracts offchain and exercisesGatherReviews
on the desired reviews. This in turn exercisesFetch
on the targettedReview
contracts. If enough reviews have been collected, this creates aRejection
orOffer
contract. If not, this creates an updatedApplicationPending
contract.
- In the initial design, the
GatherReviews
choice performed a lookup for all theReview
contracts on ledger, based on their(university, student, teacher)
key, iterating on the teachers. I realised that it was possible for an observer to fetch, but not lookup by key.Review
contracts would have needed the university as a key maintainer, and in turn as a signatory, while creating a review is supposed to be done from the teacher's perspective. From there, I saw two possible design modifications:- Have a choice
AddReview
inApplicationPending
that the teachers can exercise. Since there is a whole set of teachers who should be able to do that, I would need to have the controller as a parameter ofAddReview
and check with an assertion that the controller is indeed part of the teachers mentioned in the current payload. This is what I would have done in a real case. - Current choice: Instead of an on ledger lookup, perform an offchain
query of the reviews and pass their contract ids as a parameter of
GatherReviews
. I chose this alternative because it required little alteration and made it possible to showcase more on and off ledger iterations for the sake of this capstone project. This introduces a few shortcomings in the business logic:- The university can use selection bias and only cherry pick the reviews they like.
- In the original design, when enough reviews were collected, remaining review requests where automatically cancelled. Now, they are left to be dealt with manually.
- Have a choice
To run unit tests and example scenarios, run the pre-written scripts in
/daml/Test.daml
.
To compile and run Navigator:
$ daml start