Context
Inherited from previous app, we have an Indicator model with whom I have several issues:
- the
indicateur field
- ambiguity : these objects are indicators (as in "a type of measurement of product's usage") and, at the same time, a specific instance of said measurement
and all methods are hardcoded and called one by one whenever we need to add new instances of said indicator.
Proposition
Architectural changes to adaptors, based on people's webhooks.
We'd go from an structure with only Indicator model and hardcoded client methods to
In the end, each Product have several Indicators, whom evolution is tracked by listing Records.
These records are fetched and saved according to Indicators' Adaptor info, linking an Indicator to the right method in a Client
Implem
Notes from where I was very confused about it all
`
class Adaptor :
foreign key = product
client = method
url = string
options = {"option1: bla"}
last_successful = date
last_run = date
et/ou potentiellement :
class Indicator :
product = foreign key product
method = adaptor
frequence = daily / weekly / monthly / yearly
count relevés = value
dernier relevé = value
unit = string
Context
Inherited from previous app, we have an
Indicatormodel with whom I have several issues:indicateurfieldand all methods are hardcoded and called one by one whenever we need to add new instances of said indicator.
Proposition
Architectural changes to adaptors, based on people's webhooks.
We'd go from an structure with only
Indicatormodel and hardcoded client methods toClientclass for each type of source (e.g. Metabase, Posthog, datagouv, direct API calls)Adaptormodel, describing how to create Records of anIndicator, using a ClientRecordmodels and migrate all infos from existing IndicatorsAnd maybe, mergeAdaptorandIndicatorinto a single model, because they have the same function ?In the end, each
Producthave severalIndicators, whom evolution is tracked by listingRecords.These records are fetched and saved according to Indicators'
Adaptorinfo, linking an Indicator to the right method in aClientImplem
Notes from where I was very confused about it all
`
et/ou potentiellement :