Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

1.6 KB
Raw Blame
{
  "db_name": "PostgreSQL",
  "query": "\n            WITH per_speaker AS (\n                SELECT\n                    u.macro_user_id,\n                    COUNT(*) AS total_segments,\n                    COUNT(t.diarized_speaker_id) AS diarized_segments,\n                    COUNT(DISTINCT t.diarized_speaker_id) AS distinct_diarized_speaker_ids,\n                    ARRAY_AGG(DISTINCT t.voice_id) FILTER (WHERE t.voice_id IS NOT NULL) AS voice_ids,\n                    MIN(t.sequence_num) AS first_sequence_num\n                FROM call_record_transcripts t\n                JOIN \"User\" u\n                  ON u.id = t.speaker_id\n                 AND u.macro_user_id IS NOT NULL\n                WHERE t.call_record_id = $1\n                GROUP BY t.speaker_id, u.macro_user_id\n            )\n            SELECT macro_user_id AS \"macro_user_id!\", voices.voice_id AS \"voice_id!\"\n            FROM per_speaker\n            CROSS JOIN LATERAL UNNEST(voice_ids) AS voices(voice_id)\n            WHERE total_segments = diarized_segments\n              AND distinct_diarized_speaker_ids = 1\n            ORDER BY first_sequence_num ASC, voices.voice_id ASC\n            ",
  "describe": {
    "columns": [
      {
        "ordinal": 0,
        "name": "macro_user_id!",
        "type_info": "Uuid"
      },
      {
        "ordinal": 1,
        "name": "voice_id!",
        "type_info": "Uuid"
      }
    ],
    "parameters": {
      "Left": [
        "Uuid"
      ]
    },
    "nullable": [
      false,
      null
    ]
  },
  "hash": "609f0f7ffb41618435bfabd82f782666220cf9bf24918ba7c7b9fce1fcd5783e"
}