mohd-faraz

_blogs

// blogs / 20260520.md

Dev Log: May 20 Wrap-up

2026-05-20
#backend#debugging#java#kafka

Overview

Today was split between dealing with deeply nested data structures for our CRM sales alerts and polishing up some access control logic for our Multi-Disciplinary Team (MDT) worklist. A lot of back-and-forth debugging, but ended the day with things actually working as expected.

What I Worked On

Untangling nested maps for sales alerts

I was tasked with setting up a new notification flow to ping our sales team whenever a new partner signs up. We use Kafka to pass these alert events along, but I quickly hit a roadblock with how our CRM data is structured. The alert manager expects a simple, flat metadata map, but the incoming partner and customer records are deeply nested with custom objects and inner maps.

To handle this, I wrote a recursive utility to crawl through the payload and flatten everything out on the fly. Of course, it wasn't that simple. During my initial test run, I noticed some metadata fields were still going missing. It turned out some nested elements were instances of our custom resource types rather than standard Java Map objects, so my crawler was just skipping them. I updated the recursive logic to handle these custom base resources, converted them to maps, and added some debugging logs to trace exactly how the keys were being unnested. Now, everything gets squashed down nicely into a single-level payload before it hits the message queue.

Fixing admin access and schemas in the MDT board

After sorting out the alerting side of things, I hopped over to our clinical module to fix a couple of bugs with the Multi-Disciplinary Team (MDT) board worklist.

First up was a classic role-scoping issue. The query that fetches worklists was strictly filtering items by the creator's user ID. That makes sense for normal clinical users, but Facility Admins need a high-level view of everything going on. I added a quick bypass so that if the service detects an admin role, it drops the user-specific filter and pulls the global worklist instead.

While I was in there, I did some schema cleanup. I moved fields like status, stage, and remarks to the correct underlying resources to ensure they map correctly to the database, and made sure any newly initialized boards are properly stamped with a default 'New' status right out of the gate.

Wrapping Up

It feels good to get that nested data logic sorted out—recursion issues are always a bit of a headache to trace through raw logs. Tomorrow, I'll be keeping an eye on the staging environment to make sure the partner signup alerts flow smoothly in our end-to-end tests.