PersonalLGECH_PSI_Weekly_Refresh
psilgechai-agent
Inactive
Deterministic extract + AI diagnosis. Code locks the week and numbers. The AI Agent writes bilingual executive diagnosis for Tab 5 and Teams. It does not calculate PSI math.
Current week W38 Β· Tuesday job = W-2 actual Β· HQ close Wed 15:00
1. Trigger and lock the closed week
2. Extract the same modules used by the PSI HTML
3. Convert, snapshot, inject into existing HTML payloads
5. AI Agent: bilingual diagnosis, not arithmetic
4. Publish the HTML or stop with pending

Weekly rule

Run once every Tuesday 10:00 KST. Wednesday 15:00 is HQ close. Before close the cube is W-2; after close it becomes W-1. Tuesday publishes last closed W-2 actual.

AI does not replace math

Code owns actualWeek, WOS and units. The Agent only writes Tab 5 diagnosis, Top 10 attention text, and the Teams executive card in KR/EN.

βœ“
SCHEDULE TRIGGEREvery Tuesday 10:00 KST0 10 * * 2 Β· Asia/Seoul
βœ“
SETLGECH constantssubsidiary, currentWeek, units
βœ“
HTTP REQUESTList Plan Week memberssnopolap.lge.com / GDMi
βœ“
CODEApply N / N-1 / N-237 β†’ query 36 β†’ actual 35
βœ“
HTTP REQUESTProbe REF close boundarycompare last two Plan Weeks
βœ“
IFIs week N-2 closed?true = extract Β· false = pending
βœ“
HTTP REQUESTPull LGECH total PSIfeeds DATA / Tab 1
βœ“
HTTP REQUESTPull product week seriesREF / W/M / LTV / MNT
βœ“
HTTP REQUESTPull Model.Suffix Top 10WOS +8W > 12, then Inventory
βœ“
HTTP REQUESTPull channel OLAPRetailer / Omni / Dealer / D2C
βœ“
HTTP REQUESTPull waterfall matricesPlanWeek Γ— P.Unit Γ— Normal Week
βœ“
READ BINARY FILELoad SEiF correction booksame structure as D2C
βœ“
MERGECombine cube + SEiFby year-week key, not column offset
βœ“
CODEUnits, nulls, WOS snapshotsUSD→K USD · never fill 0
βœ“
CODEBuild gdmi_snapshot.jsonsource of truth for HTML inject
βœ“
CODEInject numeric payloadsDATA, PSI, channel, waterfall, SEiF
βœ“
IFActual β‰  forecast?reject R+F labeled as actual
βœ“
AI AGENTSCM diagnosis specialistTab 5 + Top 10 attention + Teams card
βœ“
CHAT MODELOpenAI / EXAONEtemperature 0.2
βœ“
OUTPUT PARSERStructured JSONko / zh diagnosis schema
βœ“
CODEAttach AI text to HTMLnever overwrite numeric fields
βœ“
READ/WRITE FILEUpdate existing PSI HTML6 tabs stay unchanged
βœ“
HTTP REQUESTPublish internal URLSharePoint / HQ portal / Pages
βœ“
MICROSOFT TEAMSW-2 actual + AI briefopen the existing dashboard
βœ“
MICROSOFT TEAMSPending noticedo not use forecast as actual
βœ“
NO OPERATIONStop publishkeep last trusted HTML
βˆ’100%+Tidy up
English workflow briefing

Deterministic PSI pipeline + AI diagnosis agent

n8n extracts and locks the closed week with code. The AI Agent then writes bilingual executive text for Tab 5, Top 10 attention, and Teams. It never calculates Sell-Out, WOS or actualWeek.

Why the Agent is here

The 6-tab HTML already has numbers. The remaining HQ gap is weekly interpretation: what changed, which model needs attention, and what managers should inspect. The Agent consumes the validated snapshot and returns structured Korean + Chinese text. If HQ later asks β€œwhere is AX?”, this node is the answer.

Code still owns

  • Plan Week offset 37 β†’ 36 β†’ 35
  • Close-boundary check
  • Qty / Amt / Inventory / WOS math
  • Unit conversion and null handling
  • Actual vs forecast gate

AI Agent owns

  • Tab 5 PSI management diagnosis copy
  • Top 10 model attention language
  • Teams executive card, 3 bullets max
  • Korean primary, Chinese secondary
  • Risk wording only: attention / inspect / monitor

Week offset and clock stay unchanged

LATEST PLAN WEEKNdo not query
QUERY SLICEN-1stable Plan Week
ACTUAL SELL-OUTN-2HTML publish week

Tuesday 10:00 KST publishes last closed W-2. Wednesday 15:00 HQ close turns the source into W-1. The Agent is not called on the pending path.