+
    ɰiF$                        R t ^ RIt^ RIt^ RIHt ^ RIHt ]! R4      t]R,          R,          tRRR	R
RRR/RRRR
RRR/RRRR
RRR/RRR	R
RRR/RRRR
RRR/RRRR
RRR//tR  t	R*R! lt
R" tR# tR+R$ lt]R%8X  dg   ]! ]P!                  R&4      4      t]'       d>   ]R,,          t]! R']P(                   24       ]! ]4      t]'       d   ]! R(] 24       R# R# ]! R)4       R# R# )-za
PHT Email Personalization
Generates custom email copy for each contact

Created: March 11, 2026
N)Path)datetimez*/Users/max/.openclaw/workspace/postharvest
automationdataapplescompanyStemiltstatzreduced quality claims by 34%
pain_pointz`Ethylene buildup in CA rooms can cost you thousands in damaged fruit during peak storage season.citruszWonderful Citrusz!eliminated $180K in annual losseszeEven small ethylene spikes during citrus storage can trigger early degreening and shorten shelf life.kiwisZesprizimproved quality scores by 28%u|   Kiwifruit is extremely sensitive to ethylene—undetected spikes mean shorter storage windows and lost export opportunities.pearsz\Pears are ethylene-sensitive, and CA storage issues often don't show up until it's too late.bananaszCosta Groupzextended shelf life by 5-7 daysu   Banana ripening is incredibly ethylene-dependent—real-time monitoring means you control the process, not the other way around.mixedzUSI Insurancez)helped clients prevent over $2M in claimsz[Quality issues from undetected ethylene spikes are one of the top causes of storage claims.c                f    V '       d   \        V 4      M^ p V ^28  d   R# V ^8  d   R# V ^
8  d   R# R# )z*Get ROI stat based on estimated room countz<At your scale (50+ rooms), we're seeing $200K+ annual impactzBFacilities with 30+ rooms typically see $120K+ in savings annuallyz4Even with 15-20 rooms, operators save $50K+ annuallyz7Operators consistently see 10-15x ROI in the first year)int)roomss   &J/Users/max/.openclaw/workspace/postharvest/automation/3_personalization.pyget_roi_statr   5   s0    CJQE{M	"S	"EH    c                .    V^8X  d   V  RV 2# RV RV  2# )z4Generate subject line (2 variations for A/B testing)z, reducing ethylene damage at zQuick question for z's  )
first_namecompany_name	variations   &&&r   generate_email_subjectr   B   s0     A~;L>JJ$\N#j\BBr   c                   V P                  R4      '       d   V R,          P                  4       ^ ,          MRpVP                  RR4      pVP                  RR4      pVP                  RR4      P                  4       pVP                  R^ 4      p\        P                  V\        R,          4      p\	        V4      pR	V R
V RV RV RVR,           RVR,           RVR,           RV RV R2p	V	# )z
Generate personalized email body

Args:
    contact: Dict with name, title, email
    company_data: Dict with company_name, domain, country, fruit_type, rooms
nametherer    country
fruit_typer   r   Hi z,

I noticed z	 handles z storage in z.

r
   z

We recently helped r    r	   z= using real-time ethylene monitoring across their CA rooms.

z-.

Would a 2-month pilot (10 units, free) at z\ make sense?

Best,
Jonny Shannon
PostHarvest Technologies
calendly.com/jonny_shannon/30mins)getsplitlowerCASE_STUDIESr   )
contactcompany_datar   r   r!   r"   r   
case_studyroi_statemails
   &&        r   generate_email_bodyr.   J   s    07{{6/B/B&&(+J##NB7Ly"-G!!,8>>@JWa(E !!*l7.CDJ E"H J<  .	*\' CL  y)*!Jv,>+? @	
 ++7. 9"%E" Lr   c                    RV  RV R2pRV  RVP                  4       R,           R2pRV  RV R2pRV  RV R	2pR
VRVRVRV/# )z!Generate follow-up email sequencer#   z7,

I sent over some info about ethylene monitoring for z earlier this week.

Thought this case study might be useful - it's from a similar operation:
[Case Study PDF Link]

No pressure, just wanted to make sure you had the resource.

Best,
Jonnyz5,

Quick update - we just closed a deal with another z facility last week.

They're starting with a 2-month pilot (10 units, free) to see the ROI firsthand.

Worth a quick 15-minute chat to see if it'd work for you too?

Best,
Jonny
calendly.com/jonny_shannon/30minszO,

Last follow-up on this - totally understand if now's not the right time for zx.

Quick yes/no question: Worth discussing ethylene monitoring for next season?

If not, no worries at all.

Best,
Jonnyz,,

Sounds like now isn't the right time for z - totally understand.

Feel free to reach out when storage season picks up or if ethylene issues come up.

All the best,
Jonnyemail_2email_3email_4email_5)r&   )r   r   r0   r1   r2   r3   s   &&    r   generate_follow_up_emailsr5   r   s     j\ "55AN C
	G j\ "33?3E3E3G3K2L M"
%G j\ "MMYN [		G j\ "**6 8	G 	7777	 r   c                Z   \        R4       \        RV  24       . p\        V RRR7      ;_uu_ 4       p\        P                  ! V4      p\	        V4      pRRR4       \        R\        V4       24       . pV EFR  pRVP                  RR	4      R
VP                  R
R	4      RVP                  RR	4      RVP                  RR4      RVP                  R^4      /pVP                  R4      '       d(   VP                  RR	4      P                  4       ^ ,          MRp\        WR,          ^4      p	\        WR,          ^4      p
\        Wg4      p\        WR,          4      pR\        T;'       d    VR8g  4      R\        VR,          4      R\        VP                  R4      4      R^\        V4      u;8*  ;'       d    R8*  Mu R\        V	4      ^<8  /p\        VP                  4       4      \        V4      ,          ^d,          p/ VCRV	RV
RVRVR,          RVR,          RVR,          RVR,          RVR\        P                  ! 4       P!                  4       /	CpVP#                  V4       \        V4      ^8:  g   EK  \        R \        V4       R!24       \        R"VP                  R#4       24       \        R$V	 24       \        R%VR& R'24       EKU  	  V'       g6   \        P                  ! 4       P%                  R(4      p\&        R)V R*2,          pV'       d   \        VR+R	RR,7      ;_uu_ 4       p\	        V^ ,          P)                  4       4      p\        P*                  ! VVR-7      pVP-                  4        VP/                  V4       RRR4       \        R. V 4       4      \        V4      ,          p\        R/4       \        R0\        V4       24       \        R1VR2 R'24       \        R3V 24       \1        V4      # \        R44       R#   + '       g   i     EL; i  + '       g   i     L; i)5z
Generate personalized emails for all contacts

Args:
    enriched_file: Path to enriched contacts CSV
    output_file: Path to save personalized data (optional)
u!   
✍️  Starting personalizationz
   Input: rzutf-8)encodingNz   Contacts to personalize: r   r    domainr!   r"   r   r   r   r   has_first_namehas_companyhas_fruit_typebody_length_oki,  subject_length_ok	subject_a	subject_b
email_bodyr0   r1   r2   r3   quality_scorepersonalized_dateu   
✉️  Preview #:z   To: r-   z   Subject: z   Quality: z.0f%z%Y%m%d_%H%M%Spersonalized_z.csvw)newliner8   )
fieldnamesc              3   2   "   T F  qR ,          x  K  	  R# 5i)rB   Nr   ).0ps   & r   	<genexpr>'personalize_contacts.<locals>.<genexpr>   s     ClO,,ls   u   
✅ Personalization complete!z   Total emails: z   Average quality: z.1fz
   Saved: u   
⚠ No emails generated)printopencsv
DictReaderlistlenr%   r&   r   r.   r5   boolsumvaluesr   now	isoformatappendstrftimeDATA_DIRkeys
DictWriterwriteheader	writerowsstr)enriched_fileoutput_filecontactsfreaderpersonalizedr)   r*   r   	subject_1	subject_2rA   
follow_upschecksrB   personalized_contact	timestamprI   writeravg_qualitys   &&                  r   personalize_contactsrp      s    
.0	J}o
&' H	mS7	3	3q"< 
4 
(X
89 LGKK;gkk(B/w{{9b1'++lG<W[["-
 <C;;v;N;NW[[,224Q7T[
*:N7SUVW	*:N7SUVW	 )?
 /z;WX
 d:#G#G*2GH4^ <=d7;;|#<=cS_;;;Y"!4
 FMMO,s6{:S@ 
 
*z),z),z),z),]!9!9!; 
 	01 |!'L(9':!<=GGKK0123L,-Ls 3156g l LLN++O<	=4!@@+sBAAQl1o2245J^^A*=F \*	 B ClCCc,FWW/1!#l"3!456$[$5Q78
;-();)*e 
4	3	3F BAs   "P*APP	P*	__main__zenriched_contacts_*.csvzUsing latest enrichment: u   
📁 Output: z3No enriched files found. Run 2_enrichment.py first.)   )Nr4   )__doc__rQ   jsonpathlibr   r   	WORKSPACEr\   r(   r   r   r.   r5   rp   __name__sortedglobenriched_fileslatestrO   r   resultr   r   r   <module>r}      st       =>	|#f, 9/x
 %3}
 80  U
 9/t
 =1  Y
 ?;s5DIC&P4l_B zHMM*CDEN#)&++78%f-OF8,-  	CD r   