ADR-0042 UC2 GCP Trend Score Update function
In ADR 0033 a decision was made to not use a proxy function to access the l API for Trend Detection / Recommendations.
Mallzee’s Trend Detection / Recommendations service can be accessed directly only by UC1 and UC3 because the API Key is not exposed. This is not the case with UC2 that is a web application, and a potential invocation of the Mallzee API would expose the API key.
Also UC2 (Dress Me Up app) need to have at all times, the latest trend scores for all demographics, in order to avoid wait times calling the Mallzee API. A request takes typically about 5 seconds to complete thus impacting user experience.
So a cloud function is created that updates all score values for each demographic option for all garments.
The values are then accessed easily from the Dress Me Up application throught Firestore calls.
For Use Case 2 (Dress Me Up application) we created a Trend Score Updater cloud function that upates Firestore periodically with the trend score values for each garment & demographic option.
The Dress Me Up application will use Firestore calls to access Trend Scores, instead of using a proxy function or querying directly to the the Mallzee API.