IFRCGo / go-api

MIT License
14 stars 6 forks source link

Determine root cause of tag_type in Molnix tags not populating #1813

Open JonathanGarro opened 1 year ago

JonathanGarro commented 1 year ago

Issue

Surge alerts attach a series of molnix_tags to surge alerts, all with the same keys:

The only tag_type that is being pulled in is "language" - and all the rest are listed as "regular". In order to facilitate analysis and visualization, it would be immensely helpful if we could pull those values for tag_type over. The surge team reports that they are saving that data on their side, so it sounds like we just need to determine what the ingest issue is on the GO side.

In the absence of a solution here, we also discussed the possibility on the call of syncing or at least building a pipeline to grab the list of possible values for the name and description keys. Having these would help to process the data on the dashboarding side. Consider the following example:

anamariaescobar commented 1 year ago

looping @alicefahey into this ticket

batpad commented 1 year ago

Soo .. I think tag_type on Molnix is a slightly different concept, and there is another concept called tag "groups", which we probably missed since it is only available in the API call when fetching a single tag (i.e. not in the call to get the list of tags).

I think what we want here is to add the Tag "Groups" to the system. For this, for each tag, we will need to call a URL like https://ifrc-staging.rpm.molnix.com/api/api/tags/edit/18 and look at the groups key in the JSON response. A "group" has an id, a name and created and modified timestamps. A tag can belong to multiple groups. An example group name is REGIONS.

So, what we do here:

Create another model called MolnixTagGroup with a Many2Many relation to MolnixTag . When ingesting tags into the system, we will need to make an additional call to the Molnix API to fetch the details for a single tag which will include the groups key, and make sure we populate MolnixTagGroup with the groups returned. Will be roughly around here: https://github.com/IFRCGo/go-api/blob/develop/api/management/commands/sync_molnix.py#L54