from net import *
import pandas as pd
rows=[
dict(appid=362860,name='Sylvio',event='2022-07-06',previous='2017-08-31',group='about_five_years',origin='random_news_sample',kind='gameplay accessibility and quality-of-life',notes='Explicit developer statement five years since last update. Running, keybinding, level/puzzle changes. Cross-promotes Dread X Collection 5; Summer Sale overlap.'),
dict(appid=347160,name='Steredenn: Binary Stars',event='2023-09-22',previous='2019-01-11',group='about_five_years',origin='named_update_lead',kind='ending, difficulty mode, balance, runtime',notes='Remote Play Together announcement Oct2019 intervenes; long gap is between substantive game patches. New art/localization/runtime bundled. Linux regressions reported afterward.'),
dict(appid=241600,name='Rogue Legacy',event='2018-06-21',previous='2013-12-17',group='about_five_years',origin='named_update_lead',kind='free public beta with gameplay and localization',notes='Public beta explicitly released during Steam Summer Sale; stable release July24. Use beta as first exposure, stable date as sensitivity.'),
dict(appid=247080,name='Crypt of the NecroDancer',event='2022-06-30',previous='2017-10-12',group='about_five_years',origin='named_update_lead',kind='major free gameplay, accessibility and editor overhaul',notes='Developer gives1721days, about4.71years despite headline saying five. Summer Sale overlap. Paid SYNCHRONY DLC released Aug4 (day35); later windows are a combined campaign.'),
dict(appid=12900,name='Audiosurf',event='2020-02-15',previous='2015-01-24',group='five_years_small_update',origin='named_update_lead',kind='widescreen and corkscrew behavior improvements',notes='Five-year gap from last announced fix; smaller update, not a content expansion.'),
dict(appid=70300,name='VVVVVV',event='2021-08-31',previous='2014-06-12',group='longer_major_gap',origin='named_update_lead',kind='engine, editor and extensive bug fixes',notes='Developer calls first major update in seven years; source code opened in2020 and community work contributed. Not seven years of no activity.'),
dict(appid=242680,name='Nuclear Throne',event='2025-12-05',previous='2017-11-06',group='longer_major_gap',origin='named_update_lead',kind='new character, custom mode, skins, four-player coop, localization/runtime',notes='Eight-year gap between numbered stable99 and100; public beta/community maintenance existed. Discount and anniversary campaign. Full post-year not yet observable.'),
]
g=pd.read_parquet(R.parent/'fable-verification-2026-09-06/games.parquet').set_index('appid');news=pd.read_csv(R/'news_inventory.csv')
for x in rows:
    date=pd.Timestamp(x['event'],tz='UTC');previous=pd.Timestamp(x['previous'],tz='UTC');x['gap_years']=(date-previous).days/365.25;x['game_url']=f'https://store.steampowered.com/app/{x["appid"]}/';x['snapshot_reviews']=int(g.loc[x['appid'],'reviews']);x['snapshot_price']=float(g.loc[x['appid'],'price'])
    match=news[news.appid.eq(x['appid'])&news.date.eq(x['event'])].iloc[0];x['announcement_title']=match.title;x['announcement_url']=match.url;x['announcement_gid']=str(match.gid)
    x['start']=str((date-pd.Timedelta(days=365)).date());finish=date+pd.Timedelta(days=365)
    if x['appid']==241600:finish=pd.Timestamp('2019-07-24',tz='UTC')
    x['end']=str(min(finish,pd.Timestamp('2026-09-07',tz='UTC')).date())
pd.DataFrame(rows).to_csv(R/'events.csv',index=False);dump(R/'events.json',rows);print('Frozen',len(rows),'events')
