人脉维护提醒程序,按重要程度,设定联系频率。自动提醒,关系不疏远。
人脉维护提醒程序一、实际应用场景描述作为一名全栈开发工程师兼技术布道博主我每周要接触大量的技术同行、潜在合作伙伴、媒体编辑和行业大咖。这些人脉对我的职业发展至关重要- 技术圈KOL可以为我的博客带来流量- 潜在合作伙伴可能带来项目机会- 媒体编辑关注我的技术观点- 同行朋友可以互相交流学习但是随着人脉网络的扩大我遇到了严重的维护难题- 重要的人脉因为忘记联系而逐渐疏远- 不知道多久联系一次才算合适- 每次联系都像尬聊不知道聊什么- 重要程度不同的人用同样的频率联系浪费精力- 错过关键时机如对方升职、创业、获奖本系统基于智能决策课程理论通过分析人脉的重要程度、关系亲密度、历史互动记录智能设定联系频率自动发送提醒并提供个性化的沟通话题建议确保重要人脉关系持续升温。二、引入痛点1. 重要人脉遗忘核心合作伙伴/行业大咖因长期不联系而关系淡化2. 联系频率混乱对所有人都用相同频率联系要么打扰别人要么关系冷却3. 沟通内容空洞每次联系都不知道说什么只能问最近怎么样4. 时机把握不准错过对方职业变动、项目发布等关键互动窗口5. 关系状态模糊不清楚哪些关系需要紧急维护哪些可以暂缓6. 维护成本高手动管理大量人脉时间和精力投入产出比低三、核心逻辑讲解系统架构设计graph TDA[人脉数据输入] -- B(关系评估引擎)B -- C{智能决策分析}C --|重要程度| D[联系频率计算]C --|关系亲密度| E[提醒优先级排序]C --|历史互动| F[沟通话题生成]D -- G[个性化提醒计划]E -- GF -- GG -- H[自动提醒话题建议]H -- I[关系维护执行]I -- J[互动反馈收集]J -- B关键技术点1. 多维度关系评估模型基于智能决策课程中的多准则决策分析(MCDA)关系重要度 职业影响力×0.35 合作潜力×0.30 情感价值×0.20 稀缺性×0.152. 动态联系频率算法基于马尔可夫决策过程(MDP)的关系状态转移模型- 状态关系亲密度等级陌生→认识→熟悉→亲密→核心- 动作联系行为点赞/评论/私信/线下聚会- 奖励关系亲密度提升、合作机会产生3. 智能提醒调度基于约束满足问题(CSP)的时间安排优化- 约束用户可用时间、对方时区、避免打扰时段- 目标最大化关系维护效果最小化打扰成本4. 个性化话题生成基于知识图谱的兴趣关联挖掘- 构建人物-兴趣-事件的知识网络- 基于共同兴趣点和近期事件生成话题四、代码模块化实现项目结构network_maintenance_reminder/├── main.py # 主程序入口├── data_models.py # 数据模型定义├── relationship_database.py # 人脉数据库├── decision_engine.py # 智能决策引擎├── reminder_scheduler.py # 提醒调度器├── topic_generator.py # 话题生成器├── feedback_processor.py # 反馈处理器├── utils.py # 工具函数└── config.py # 配置文件1. 数据模型 (data_models.py)from dataclasses import dataclass, fieldfrom enum import Enumfrom typing import List, Optional, Dict, Any, Setfrom datetime import datetime, timedeltafrom collections import defaultdictclass ImportanceLevel(Enum):人脉重要程度等级CRITICAL 核心 # 行业大咖/重要合作伙伴/直接上级HIGH 高 # 潜在合作方/技术KOL/重要客户MEDIUM 中 # 同行朋友/一般合作伙伴/媒体编辑LOW 低 # 普通联系人/一次性合作方class IntimacyLevel(Enum):关系亲密度等级STRANGER 陌生 # 刚认识无深入交流ACQUAINTANCE 认识 # 有过基本交流知道基本信息FAMILIAR 熟悉 # 经常互动了解工作生活CLOSE 亲密 # 互相信任可讨论私人话题CORE 核心 # 深度绑定利益共同体class ContactMethod(Enum):联系方式类型WECHAT 微信LINKEDIN LinkedInEMAIL 邮件PHONE 电话OFFLINE 线下见面SOCIAL_MEDIA 社交媒体class InteractionType(Enum):互动类型LIKE 点赞COMMENT 评论PRIVATE_MESSAGE 私信FORWARD 转发MEETING 会议COLLABORATION 合作INTRODUCTION 介绍CELEBRATION 祝贺 # 生日/升职/获奖等dataclassclass Person:人脉数据模型id: str # 唯一标识符name: str # 姓名company: str # 公司/组织position: str # 职位industry: str # 行业领域importance: ImportanceLevel # 重要程度intimacy_level: IntimacyLevel # 关系亲密度contact_methods: List[ContactMethod] # 可用联系方式interests: List[str] # 兴趣爱好expertise: List[str] # 专业领域recent_events: List[str] # 近期重要事件notes: str # 备注信息tags: List[str] # 标签如技术KOL、投资人def to_dict(self) - Dict[str, Any]:return {id: self.id,name: self.name,company: self.company,position: self.position,industry: self.industry,importance: self.importance.value,intimacy_level: self.intimacy_level.value,contact_methods: [m.value for m in self.contact_methods],interests: self.interests,expertise: self.expertise,recent_events: self.recent_events,notes: self.notes,tags: self.tags}dataclassclass InteractionRecord:互动记录数据模型id: str # 互动记录IDperson_id: str # 对应人脉IDinteraction_type: InteractionType # 互动类型content: str # 互动内容timestamp: datetime # 互动时间platform: str # 互动平台response_received: bool # 是否收到回复sentiment_score: float # 情感倾向评分(-1到1)follow_up_needed: bool # 是否需要跟进notes: str # 备注def to_dict(self) - Dict[str, Any]:return {id: self.id,person_id: self.person_id,interaction_type: self.interaction_type.value,content: self.content,timestamp: self.timestamp.isoformat(),platform: self.platform,response_received: self.response_received,sentiment_score: self.sentiment_score,follow_up_needed: self.follow_up_needed,notes: self.notes}dataclassclass Reminder:提醒数据模型id: str # 提醒IDperson_id: str # 对应人脉IDreminder_type: str # 提醒类型常规联系/重要事件/关系预警scheduled_time: datetime # 计划提醒时间priority: int # 优先级(1-10, 10最高)suggested_method: ContactMethod # 建议联系方式suggested_topics: List[str] # 建议沟通话题reason: str # 提醒原因status: str # 状态待处理/已完成/已忽略/已延期created_at: datetime field(default_factorydatetime.now)def to_dict(self) - Dict[str, Any]:return {id: self.id,person_id: self.person_id,reminder_type: self.reminder_type,scheduled_time: self.scheduled_time.isoformat(),priority: self.priority,suggested_method: self.suggested_method.value,suggested_topics: self.suggested_topics,reason: self.reason,status: self.status,created_at: self.created_at.isoformat()}dataclassclass UserProfile:用户个人资料name: str # 用户姓名company: str # 用户公司position: str # 用户职位core_interests: List[str] # 核心兴趣领域availability_hours: Dict[str, List[int]] # 每日可用时间段timezone: str # 时区communication_style: str # 沟通风格正式/轻松/技术导向max_daily_contacts: int # 每日最大联系人数last_update: datetime field(default_factorydatetime.now)2. 人脉数据库 (relationship_database.py)import uuidimport jsonimport osfrom datetime import datetime, timedeltafrom typing import List, Optional, Dict, Anyfrom .data_models import (Person, InteractionRecord, UserProfile,ImportanceLevel, IntimacyLevel, ContactMethod,InteractionType)class RelationshipDatabase:人脉关系数据库 - 管理所有人脉数据和互动记录def __init__(self, db_path: str network_db.json):self.db_path db_pathself.persons: Dict[str, Person] {}self.interactions: Dict[str, List[InteractionRecord]] defaultdict(list)self.user_profile: Optional[UserProfile] Noneself._load_data()def _load_data(self):从文件加载数据if os.path.exists(self.db_path):with open(self.db_path, r, encodingutf-8) as f:data json.load(f)# 加载用户资料if user_profile in data:up_data data[user_profile]self.user_profile UserProfile(nameup_data[name],companyup_data[company],positionup_data[position],core_interestsup_data[core_interests],availability_hoursup_data.get(availability_hours, {}),timezoneup_data.get(timezone, Asia/Shanghai),communication_styleup_data.get(communication_style, 轻松),max_daily_contactsup_data.get(max_daily_contacts, 10))# 加载人脉数据for p_data in data.get(persons, []):person Person(idp_data[id],namep_data[name],companyp_data[company],positionp_data[position],industryp_data[industry],importanceImportanceLevel(p_data[importance]),intimacy_levelIntimacyLevel(p_data[intimacy_level]),contact_methods[ContactMethod(m) for m in p_data[contact_methods]],interestsp_data[interests],expertisep_data[expertise],recent_eventsp_data.get(recent_events, []),notesp_data.get(notes, ),tagsp_data.get(tags, []))self.persons[person.id] person# 加载互动记录for i_data in data.get(interactions, []):record InteractionRecord(idi_data[id],person_idi_data[person_id],interaction_typeInteractionType(i_data[interaction_type]),contenti_data[content],timestampdatetime.fromisoformat(i_data[timestamp]),platformi_data[platform],response_receivedi_data[response_received],sentiment_scorei_data[sentiment_score],follow_up_neededi_data[follow_up_needed],notesi_data.get(notes, ))self.interactions[record.person_id].append(record)def _save_data(self):保存数据到文件data {user_profile: {name: self.user_profile.name,company: self.user_profile.company,position: self.user_profile.position,core_interests: self.user_profile.core_interests,availability_hours: self.user_profile.availability_hours,timezone: self.user_profile.timezone,communication_style: self.user_profile.communication_style,max_daily_contacts: self.user_profile.max_daily_contacts} if self.user_profile else None,persons: [p.to_dict() for p in self.persons.values()],interactions: [i.to_dict() for interactions_list in self.interactions.values()for i in interactions_list]}with open(self.db_path, w, encodingutf-8) as f:json.dump(data, f, ensure_asciiFalse, indent2)# 人脉管理方法 def add_person(self, person: Person) - bool:添加新人脉if person.id in self.persons:return Falseself.persons[person.id] personself._save_data()return Truedef update_person(self, person_id: str, **kwargs) - bool:更新人脉信息if person_id not in self.persons:return Falseperson self.persons[person_id]for key, value in kwargs.items():if hasattr(person, key):setattr(person, key, value)self._save_data()return Truedef get_person(self, person_id: str) - Optional[Person]:获取人脉详情return self.persons.get(person_id)def get_all_persons(self) - List[Person]:获取所有人脉return list(self.persons.values())def search_persons(self, **criteria) - List[Person]:搜索人脉results list(self.persons.values())if importance in criteria:imp ImportanceLevel(criteria[importance])results [p for p in results if p.importance imp]if intimacy in criteria:intim IntimacyLevel(criteria[intimacy])results [p for p in results if p.intimacy_level intim]if industry in criteria:results [p for p in results if criteria[industry] in p.industry]if tag in criteria:results [p for p in results if criteria[tag] in p.tags]if keyword in criteria:keyword criteria[keyword].lower()results [p for p in resultsif keyword in p.name.lower()or keyword in p.company.lower()or keyword in p.position.lower()]return results# 互动记录方法 def add_interaction(self, record: InteractionRecord) - bool:添加互动记录if record.person_id not in self.persons:return Falseself.interactions[record.person_id].append(record)self._save_data()# 更新关系亲密度self._update_intimacy_after_interaction(record)return Truedef get_interactions(self, person_id: str,days: int None) - List[InteractionRecord]:获取某人的互动记录records self.interactions.get(person_id, [])if days:cutoff datetime.now() - timedelta(daysdays)records [r for r in records if r.timestamp cutoff]return sorted(records, keylambda x: x.timestamp, reverseTrue)def get_last_interaction(self, person_id: str) - Optional[InteractionRecord]:获取最后一次互动records self.get_interactions(person_id)return records[0] if records else Nonedef get_interaction_frequency(self, person_id: str,period_days: int 90) - Dict[str, int]:计算互动频率cutoff datetime.now() - timedelta(daysperiod_days)records [r for r in self.interactions.get(person_id, [])if r.timestamp cutoff]frequency defaultdict(int)for record in records:frequency[record.interaction_type.value] 1return dict(frequency)def _update_intimacy_after_interaction(self, record: InteractionRecord):根据互动更新关系亲密度person self.persons.get(record.person_id)if not person:return# 基于智能决策的马尔可夫决策过程互动→亲密度转移intimacy_transitions {IntimacyLevel.STRANGER: {InteractionType.LIKE: IntimacyLevel.ACQUAINTANCE,InteractionType.COMMENT: IntimacyLevel.ACQUAINTANCE,InteractionType.PRIVATE_MESSAGE: IntimacyLevel.FAMILIAR,InteractionType.MEETING: IntimacyLevel.FAMILIAR,InteractionType.COLLABORATION: IntimacyLevel.CLOSE},IntimacyLevel.ACQUAINTANCE: {InteractionType.LIKE: IntimacyLevel.FAMILIAR,InteractionType.COMMENT: IntimacyLevel.FAMILIAR,InteractionType.PRIVATE_MESSAGE: IntimacyLevel.FAMILIAR,InteractionType.MEETING: IntimacyLevel.CLOSE,InteractionType.COLLABORATION: IntimacyLevel.CLOSE,InteractionType.CELEBRATION: IntimacyLevel.FAMILIAR},IntimacyLevel.FAMILIAR: {InteractionType.LIKE: IntimacyLevel.FAMILIAR,InteractionType.COMMENT: IntimacyLevel.CLOSE,InteractionType.PRIVATE_MESSAGE: IntimacyLevel.CLOSE,InteractionType.MEETING: IntimacyLevel.CORE,InteractionType.COLLABORATION: IntimacyLevel.CORE,InteractionType.CELEBRATION: IntimacyLevel.CLOSE,InteractionType.INTRODUCTION: IntimacyLevel.CLOSE},IntimacyLevel.CLOSE: {InteractionType.PRIVATE_MESSAGE: IntimacyLevel.CORE,InteractionType.MEETING: IntimacyLevel.CORE,InteractionType.COLLABORATION: IntimacyLevel.CORE,InteractionType.CELEBRATION: IntimacyLevel.CORE,InteractionType.INTRODUCTION: IntimacyLevel.CORE}}# 根据互动类型和情感评分决定是否升级current_level person.intimacy_levelpossible_transitions intimacy_transitions.get(current_level, {})if record.interaction_type in possible_transitions:new_level possible_transitions[record.interaction_type]# 只有积极互动才升级if record.sentiment_score 0.3:person.intimacy_level new_levelself._save_data()# 用户资料方法 def set_user_profile(self, profile: UserProfile):设置用户资料self.user_profile profileself._save_data()def get_user_profile(self) - Optional[UserProfile]:获取用户资料return self.user_profile# 统计分析 def get_relationship_health_report(self) - Dict[str, Any]:生成关系健康度报告persons self.get_all_persons()stats {total_contacts: len(persons),by_importance: defaultdict(int),by_intimacy: defaultdict(int),at_risk_relationships: [], # 关系疏远预警upgrade_candidates: [], # 可升级关系的候选人attention_needed: [] # 需要关注的VIP关系}now datetime.now()for person in persons:stats[by_importance][person.importance.value] 1stats[by_intimacy][person.intimacy_level.value] 1# 检查关系疏远风险last_interaction self.get_last_interaction(person.id)if last_interaction:days_since (now - last_interaction.timestamp).daysexpected_interval self._calculate_expected_contact_interval(person)if days_since expected_interval * 1.5: # 超过期望间隔50%stats[at_risk_relationships].append({person: person,days_since_contact: days_since,expected_interval: expected_interval})# 检查升级候选人if person.intimacy_level in [IntimacyLevel.STRANGER, IntimacyLevel.ACQUAINTANCE]:recent_positive_interactions [r for r in self.get_interactions(person.id, 30)if r.sentiment_score 0.5]if len(recent_positive_interactions) 2:stats[upgrade_candidates].append(person)# 检查VIP关系关注需求if person.importance in [ImportanceLevel.CRITICAL, ImportanceLevel.HIGH]:last_interaction self.get_last_interaction(person.id)if not last_interaction or (now - last_interaction.timestamp).days 14:stats[attention_needed].append(person)return statsdef _calculate_expected_contact_interval(self, person: Person) - int:计算期望联系间隔天base_intervals {ImportanceLevel.CRITICAL: 7,ImportanceLevel.HIGH: 14,ImportanceLevel.MEDIUM: 30,ImportanceLevel.LOW: 60}intimacy_multipliers {IntimacyLevel.STRANGER: 2.0,IntimacyLevel.ACQUAINTANCE: 1.5,IntimacyLevel.FAMILIAR: 1.0,IntimacyLevel.CLOSE: 0.8,IntimacyLevel.CORE: 0.6}利用AI解决实际问题如果你觉得这个工具好用欢迎关注长安牧笛