← All writing

learning

Personal Social Capacity ကို တိုင်းတာဖို့

· Cisco Ramon

let’s create graph for personal social conection

include

person, car, object etc connections event location contact information touch point etc

so user can visualize and see thier social capacity and search for required and related information

ဒီကနေ ဘာကို မျှော်လင့်မလဲ

ကိုယ့်ဘဝ ဖြတ်သန်းမှု ကိုယ်ထိတွေ့ခဲ့ဖူးတဲ့ Experience တွေကို မေ့မသွားစေဖို့

တွေ့ခဲ့ဖူးတဲ့ကား လူ အဖြစ်အပျက် နေရာ အချိန်

အခုဆို လွန်ခဲ့တဲ့ (၁၀) နှစ်က အင်မတန်ရင်းနှီးခဲ့တဲ့ လူတွေအကြောင်း မေ့တေ့တေ့ ဖြစ်နေပြီ. သူတို့ ရဲ့ လက်ရှိ Update ကို သိဖို့ ခက်နေပြီ.

အရေးအကြောင်းရှိမှ ပြန်ချိတ်ဆက်တာထက် အခုကတည်းက ဒေတာနဲ့ ချိတ်ဆက်ထားတာ ပိုပြီး အကျိုးရှိမယ်။

web အရင် ထုတ်မယ်။ local storage ပဲ သုံးရမလား? yes,

ပြီးမှ cloudfalre ecosystem ထဲ အကုန်ဝင်လိုက်မယ်။ ၏ API+JWT astro+react

ဒါမျိုးလုပ်မလား

လောလောဆယ်

Local Storage နဲ့ သွားမယ်။

ဘယ်က ဘယ်လို စကြမလဲ?

ဘာက စပြောရမလဲ?

Work Flow

  • Open App / Web Page
  • Add Node / Entity
  • Edit Node
  • Delete Node
  • Connect Node with node along with relationship
  • Disconnect relationship

Data Structure

Entity

  • id
  • name

Edge

  • id
  • source_entity_id
  • destination_entity_id

Entity - Cisco Entity - Mg Cho Entity - Intake 55

Edge - Cisco Intake 55
Edge - Mg Cho Intake 55

Entity အနေနဲ့ပဲ အကုန်လုံးကို ခွဲထုတ်ရမလား Entity ရဲ့ meta data အနေနဲ့ တွဲမှတ်ရမလား

The “Is it a Hub?” Test The “Is it a Descriptor?” Test

API

UI

Integration

ဒါမျိုး အဆင့်ဆင့် သွားမယ်။ မဟုတ်ရင် မျက်လုံးထဲ မမြင်ဘူး ဖြစ်နေတယ်။

-- အဟောင်းတွေရှိရင် ဖျက်မယ် (Dev အဆင့်မှာပဲ သုံးရန်)
DROP TABLE IF EXISTS edges;
DROP TABLE IF EXISTS entities;

-- 1. Entities Table
CREATE TABLE entities (
    id TEXT PRIMARY KEY,
    type TEXT NOT NULL,       -- PERSON, EVENT, LOCATION, OBJECT
    name TEXT NOT NULL,
    metadata TEXT DEFAULT '{}', -- JSON data တွေကို Text အနေနဲ့ သိမ်းမယ်
    created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);

-- 2. Edges Table (Connections)
CREATE TABLE edges (
    id TEXT PRIMARY KEY,
    source_id TEXT NOT NULL,
    target_id TEXT NOT NULL,
    relationship TEXT NOT NULL, -- KNOWS, ATTENDED, OWNS
    metadata TEXT DEFAULT '{}', -- JSON data
    created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (source_id) REFERENCES entities(id) ON DELETE CASCADE,
    FOREIGN KEY (target_id) REFERENCES entities(id) ON DELETE CASCADE
);

-- Search မြန်အောင် Index တွေ လုပ်ထားမယ်
CREATE INDEX idx_edges_source ON edges(source_id);
CREATE INDEX idx_edges_target ON edges(target_id);

ဒါက Meta တွေ အကုန်ခွဲထုတ်တာ

-- 1. Entities Table
CREATE TABLE entities (
    id TEXT PRIMARY KEY,
    type TEXT NOT NULL,       -- PERSON, EVENT, LOCATION, OBJECT
    name TEXT NOT NULL,
    created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);

-- 2. Edges Table (Connections)
CREATE TABLE edges (
    id TEXT PRIMARY KEY,
    source_id TEXT NOT NULL,
    target_id TEXT NOT NULL,
    relationship TEXT NOT NULL, -- KNOWS, ATTENDED, OWNS
    created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (source_id) REFERENCES entities(id) ON DELETE CASCADE,
    FOREIGN KEY (target_id) REFERENCES entities(id) ON DELETE CASCADE
);

-- 3. Entity Metas Table (Entity များ၏ အချက်အလက်များအတွက်)
CREATE TABLE entity_metas (
    id TEXT PRIMARY KEY,
    entity_id TEXT NOT NULL,
    attribute_key TEXT NOT NULL,   -- e.g., 'phone', 'dob'
    attribute_value TEXT NOT NULL, -- e.g., '0912345678', '1990-01-01'
    created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (entity_id) REFERENCES entities(id) ON DELETE CASCADE
);

-- 4. Edge Metas Table (Connection များ၏ အချက်အလက်များအတွက်)
CREATE TABLE edge_metas (
    id TEXT PRIMARY KEY,
    edge_id TEXT NOT NULL,
    attribute_key TEXT NOT NULL,   -- e.g., 'since', 'strength'
    attribute_value TEXT NOT NULL, -- e.g., '2015', '5'
    created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (edge_id) REFERENCES edges(id) ON DELETE CASCADE
);

Commands

npm create astro@latest personal-graph
cd personal-graph
npx astro add react
npx astro add tailwind # Styling အတွက် Tailwind သုံးရင် ပိုမြန်ပါတယ်
npm install uuid # Unique ID တွေထုတ်ဖို့

AI Sections

Building a personal knowledge graph (or personal CRM) is an excellent way to map out your social capacity. Traditional databases store data in rigid tables, but a graph database models your life exactly how it happens: as a web of interconnected people, places, and events.

Here is how we can structure the schema to visualize your network and make it searchable.

Before diving into the data architecture, here is an interactive visualization of how these entities connect.


1. Nodes (The Entities)

Nodes are the nouns of your database. By separating these into distinct entities, you prevent duplicate data and make it easier to search for cross-connections.

Entity (Node) Core Properties Description
Person Name, DOB, Notes, Tags The core entity of the graph.
Contact Info Type (email/phone), Value, Primary Separating this from the Person node allows one person to have multiple contact methods.
Location Name, City, Coordinates, Type Places where people live, work, or where events happen.
Event Name, Date, Type (conference, party) Gatherings that act as hubs for multiple people.
Touchpoint Date, Type (call, coffee), Summary 1-on-1 or small group interactions to track when you last spoke.
Object Category (Car, Gift, Pet), Name Tangible items tied to a person (e.g., remembering they drive a specific car or own a specific dog).

2. Edges (The Connections)

Edges are the verbs that link your nouns. The real power of a graph database lies in applying properties to the connections themselves (like tracking how long you’ve known someone).

Start Node Relationship End Node Edge Properties to Track
Person KNOWS Person Context (work, gym), Since (year), Strength (1-5)
Person ATTENDED Event Role (host, guest, speaker)
Person LIVES_AT Location Current (boolean), Since (year)
Person OWNS Object Acquired_Date, Notes
Person PARTICIPATED_IN Touchpoint Initiator (who reached out?)
Event / Touchpoint TOOK_PLACE_AT Location None needed

How This Empowers Your Search (Use Cases)

By structuring your data this way, you can query your “social capacity” to extract insights that a standard address book cannot provide:

  • The Proximity Search: “Show me all People who LIVE_AT a location within 10 miles of Chicago who I haven’t had a Touchpoint with in the last 6 months.”
  • The Mutual Connection Search: “Who is the strongest bridge between my work friends and my college friends?” (The database finds a Person node with high-strength KNOWS edges to both groups).
  • Contextual Recall: “Who was that person I met at the ‘2023 Tech Conference’ (Event) who drives a ‘Tesla’ (Object)?”