Grouping data is messy

18 views
Skip to first unread message

Mike Austin

unread,
Sep 1, 2026, 4:12:26 PMSep 1
to PiLuD
But not too bad if you break it down. I've been using RemedaJS.

const tags = groupBy === "tagId" && data && pipe(
  data.items,
  flatMap(item => item.tags), // Get all the tags
  uniqueBy(tag => tag.id), // Remove duplicates
  sortBy(tag => tag.label), // Sort alphabetically
  mapToObj(tag => [ // Convert to a dictionary
    tag.label,
    data.items.filter(item => item.tags.find(t => t.id === tag.id))
  ] as const), // as const so TS knows it's a tuple
  merge({ // Add items that don't have any tags
    "Items with no Tags": data.items.filter(item => item.tags.length === 0)
  })
);

Raoul Duke

unread,
Sep 1, 2026, 4:40:57 PMSep 1
to pi...@googlegroups.com
lord loves a wall of ascii text yessir :-)


--
You received this message because you are subscribed to the Google Groups "PiLuD" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pilud+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pilud/d0e6233c-f19b-4f04-b5a6-e0be7a6c925cn%40googlegroups.com.

Mike Austin

unread,
Sep 2, 2026, 11:51:14 PMSep 2
to PiLuD
Yeah, text. How do you imagine it? Icons? A graph? 3D? Actually, maybe a mix of all those. But still text.

Raoul Duke

unread,
Sep 3, 2026, 12:02:23 AMSep 3
to pi...@googlegroups.com
no idea, it is all a tad inherently terrible. 

complexity is complex. 

neuralink?!

Mike Austin

unread,
Sep 3, 2026, 4:13:59 PMSep 3
to PiLuD
I don't see the above code as "complex". It's not hard to understand... mapping, flattening, sorting, merging. A diagram would be nice, but the concept would still be the same.

Raoul Duke

unread,
Sep 3, 2026, 6:19:50 PMSep 3
to pi...@googlegroups.com
meh. maybe a real APL with symbols. :-) :-)

Mike Austin

unread,
Sep 5, 2026, 2:05:02 PMSep 5
to PiLuD
AHHH LINE NOISE!!
Reply all
Reply to author
Forward
0 new messages