[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6FJWVX6JS8CD1RCX1VVQ56K":3,"skill-same:01M6FJWVX6JS8CD1RCX1VVQ56K":62},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":29,"linkOnly":30,"markdownContent":31,"markdownBody":32,"frontMatter":33,"refName":35,"commitSha":36,"skillDirectory":37,"forksCount":38,"repositoryHtmlUrl":39,"repositoryHomepageUrl":6,"ownerHtmlUrl":40,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":41,"install":42,"resources":55},"01M6FJWVX6JS8CD1RCX1VVQ56K","erp-integration-analysis",null,"Analyze ERP system integration for construction data flows. Map and optimize data flows between ERP modules","kbarbel640-del\u002Fskills","kbarbel640-del","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F255315490?v=4","01M6CJPPQGCCESXMG3K7BBGQ5J","01M6CJPPX2PB2BCZERFVM2C2B3",1,"MIT","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fdatadrivenconstruction\u002Ferp-integration-analysis\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27,28],"integration","analysis","erp","erp integration analysis","data","system","analyze","modules","optimize","map","flows","2026-11-10 10:12:30",false,"---\r\nslug: \"erp-integration-analysis\"\r\ndisplay_name: \"Erp Integration Analysis\"\r\ndescription: \"Analyze ERP system integration for construction data flows. Map and optimize data flows between ERP modules\"\r\n---\r\n\r\n# ERP Integration Analysis\r\n\r\n## Overview\r\n\r\nBased on DDC methodology (Chapter 1.2), this skill analyzes ERP system integration patterns in construction organizations, mapping data flows between modules and identifying optimization opportunities.\r\n\r\n**Book Reference:** \"Технологии и системы управления в современном строительстве\" \u002F \"Technologies and Management Systems in Modern Construction\"\r\n\r\n## Quick Start\r\n\r\n```python\r\nfrom dataclasses import dataclass, field\r\nfrom enum import Enum\r\nfrom typing import List, Dict, Optional, Set, Tuple\r\nfrom datetime import datetime\r\nimport json\r\n\r\nclass ERPModule(Enum):\r\n    \"\"\"Common ERP modules in construction\"\"\"\r\n    FINANCE = \"finance\"\r\n    PROJECT_MANAGEMENT = \"project_management\"\r\n    PROCUREMENT = \"procurement\"\r\n    INVENTORY = \"inventory\"\r\n    HR = \"human_resources\"\r\n    PAYROLL = \"payroll\"\r\n    EQUIPMENT = \"equipment\"\r\n    SUBCONTRACTS = \"subcontracts\"\r\n    BILLING = \"billing\"\r\n    COST_CONTROL = \"cost_control\"\r\n    DOCUMENT_MANAGEMENT = \"document_management\"\r\n    REPORTING = \"reporting\"\r\n\r\nclass IntegrationMethod(Enum):\r\n    \"\"\"Types of integration methods\"\"\"\r\n    API = \"api\"\r\n    DATABASE = \"database\"\r\n    FILE_EXPORT = \"file_export\"\r\n    MANUAL = \"manual\"\r\n    WEBHOOK = \"webhook\"\r\n    MESSAGE_QUEUE = \"message_queue\"\r\n    ETL = \"etl\"\r\n\r\nclass DataFlowDirection(Enum):\r\n    \"\"\"Direction of data flow\"\"\"\r\n    INBOUND = \"inbound\"\r\n    OUTBOUND = \"outbound\"\r\n    BIDIRECTIONAL = \"bidirectional\"\r\n\r\n@dataclass\r\nclass DataFlow:\r\n    \"\"\"Represents a data flow between systems\u002Fmodules\"\"\"\r\n    source_module: str\r\n    target_module: str\r\n    data_type: str\r\n    frequency: str  # real-time, hourly, daily, weekly, manual\r\n    method: IntegrationMethod\r\n    direction: DataFlowDirection\r\n    volume: str  # low, medium, high\r\n    critical: bool = False\r\n    issues: List[str] = field(default_factory=list)\r\n\r\n@dataclass\r\nclass ERPSystem:\r\n    \"\"\"ERP system definition\"\"\"\r\n    name: str\r\n    vendor: str\r\n    version: str\r\n    modules: List[ERPModule]\r\n    database: str\r\n    has_api: bool\r\n    api_type: Optional[str] = None  # REST, SOAP, GraphQL\r\n    custom_modules: List[str] = field(default_factory=list)\r\n\r\n@dataclass\r\nclass IntegrationPoint:\r\n    \"\"\"Integration point between systems\"\"\"\r\n    id: str\r\n    source_system: str\r\n    target_system: str\r\n    method: IntegrationMethod\r\n    endpoint: Optional[str] = None\r\n    authentication: Optional[str] = None\r\n    data_format: str = \"json\"\r\n    status: str = \"active\"\r\n    reliability_score: float = 1.0\r\n    last_sync: Optional[datetime] = None\r\n\r\n@dataclass\r\nclass IntegrationAnalysis:\r\n    \"\"\"Complete integration analysis results\"\"\"\r\n    erp_system: ERPSystem\r\n    external_systems: List[str]\r\n    data_flows: List[DataFlow]\r\n    integration_points: List[IntegrationPoint]\r\n    integration_score: float\r\n    bottlenecks: List[str]\r\n    recommendations: List[str]\r\n    data_flow_diagram: Dict\r\n\r\n\r\nclass ERPIntegrationAnalyzer:\r\n    \"\"\"\r\n    Analyze ERP system integration for construction data flows.\r\n    Based on DDC methodology Chapter 1.2.\r\n    \"\"\"\r\n\r\n    def __init__(self):\r\n        self.module_dependencies = self._define_module_dependencies()\r\n        self.critical_flows = self._define_critical_flows()\r\n\r\n    def _define_module_dependencies(self) -> Dict[ERPModule, List[ERPModule]]:\r\n        \"\"\"Define typical module dependencies\"\"\"\r\n        return {\r\n            ERPModule.PROJECT_MANAGEMENT: [\r\n                ERPModule.COST_CONTROL,\r\n                ERPModule.PROCUREMENT,\r\n                ERPModule.HR,\r\n                ERPModule.DOCUMENT_MANAGEMENT\r\n            ],\r\n            ERPModule.COST_CONTROL: [\r\n                ERPModule.FINANCE,\r\n                ERPModule.PROJECT_MANAGEMENT,\r\n                ERPModule.BILLING\r\n            ],\r\n            ERPModule.PROCUREMENT: [\r\n                ERPModule.INVENTORY,\r\n                ERPModule.FINANCE,\r\n                ERPModule.SUBCONTRACTS\r\n            ],\r\n            ERPModule.BILLING: [\r\n                ERPModule.FINANCE,\r\n                ERPModule.PROJECT_MANAGEMENT,\r\n                ERPModule.COST_CONTROL\r\n            ],\r\n            ERPModule.PAYROLL: [\r\n                ERPModule.HR,\r\n                ERPModule.FINANCE,\r\n                ERPModule.PROJECT_MANAGEMENT\r\n            ],\r\n            ERPModule.INVENTORY: [\r\n                ERPModule.PROCUREMENT,\r\n                ERPModule.PROJECT_MANAGEMENT,\r\n                ERPModule.FINANCE\r\n            ],\r\n            ERPModule.EQUIPMENT: [\r\n                ERPModule.PROJECT_MANAGEMENT,\r\n                ERPModule.FINANCE,\r\n                ERPModule.INVENTORY\r\n            ],\r\n            ERPModule.SUBCONTRACTS: [\r\n                ERPModule.PROCUREMENT,\r\n                ERPModule.FINANCE,\r\n                ERPModule.PROJECT_MANAGEMENT\r\n            ]\r\n        }\r\n\r\n    def _define_critical_flows(self) -> List[Tuple[str, str]]:\r\n        \"\"\"Define business-critical data flows\"\"\"\r\n        return [\r\n            (\"project_management\", \"cost_control\"),\r\n            (\"cost_control\", \"finance\"),\r\n            (\"procurement\", \"inventory\"),\r\n            (\"billing\", \"finance\"),\r\n            (\"hr\", \"payroll\"),\r\n            (\"project_management\", \"billing\")\r\n        ]\r\n\r\n    def analyze_erp_integration(\r\n        self,\r\n        erp_system: ERPSystem,\r\n        external_systems: List[Dict],\r\n        integration_points: List[IntegrationPoint],\r\n        transaction_logs: Optional[List[Dict]] = None\r\n    ) -> IntegrationAnalysis:\r\n        \"\"\"\r\n        Perform comprehensive ERP integration analysis.\r\n\r\n        Args:\r\n            erp_system: The ERP system to analyze\r\n            external_systems: List of external systems\r\n            integration_points: Defined integration points\r\n            transaction_logs: Optional transaction logs for analysis\r\n\r\n        Returns:\r\n            Complete integration analysis\r\n        \"\"\"\r\n        # Map all data flows\r\n        data_flows = self._map_data_flows(\r\n            erp_system, integration_points, transaction_logs\r\n        )\r\n\r\n        # Calculate integration score\r\n        integration_score = self._calculate_integration_score(\r\n            erp_system, data_flows, integration_points\r\n        )\r\n\r\n        # Identify bottlenecks\r\n        bottlenecks = self._identify_bottlenecks(\r\n            data_flows, integration_points\r\n        )\r\n\r\n        # Generate recommendations\r\n        recommendations = self._generate_recommendations(\r\n            erp_system, data_flows, bottlenecks\r\n        )\r\n\r\n        # Create data flow diagram\r\n        diagram = self._create_flow_diagram(\r\n            erp_system, external_systems, data_flows\r\n        )\r\n\r\n        return IntegrationAnalysis(\r\n            erp_system=erp_system,\r\n            external_systems=[s[\"name\"] for s in external_systems],\r\n            data_flows=data_flows,\r\n            integration_points=integration_points,\r\n            integration_score=integration_score,\r\n            bottlenecks=bottlenecks,\r\n            recommendations=recommendations,\r\n            data_flow_diagram=diagram\r\n        )\r\n\r\n    def _map_data_flows(\r\n        self,\r\n        erp: ERPSystem,\r\n        integration_points: List[IntegrationPoint],\r\n        logs: Optional[List[Dict]]\r\n    ) -> List[DataFlow]:\r\n        \"\"\"Map all data flows in the system\"\"\"\r\n        flows = []\r\n\r\n        # Internal module flows\r\n        for module in erp.modules:\r\n            dependencies = self.module_dependencies.get(module, [])\r\n            for dep in dependencies:\r\n                if dep in erp.modules:\r\n                    is_critical = (module.value, dep.value) in self.critical_flows\r\n                    flows.append(DataFlow(\r\n                        source_module=module.value,\r\n                        target_module=dep.value,\r\n                        data_type=self._get_data_type(module, dep),\r\n                        frequency=\"real-time\",\r\n                        method=IntegrationMethod.DATABASE,\r\n                        direction=DataFlowDirection.BIDIRECTIONAL,\r\n                        volume=\"high\" if is_critical else \"medium\",\r\n                        critical=is_critical\r\n                    ))\r\n\r\n        # External integration flows\r\n        for point in integration_points:\r\n            if point.source_system == erp.name or point.target_system == erp.name:\r\n                flows.append(DataFlow(\r\n                    source_module=point.source_system,\r\n                    target_module=point.target_system,\r\n                    data_type=\"mixed\",\r\n                    frequency=self._infer_frequency(point),\r\n                    method=point.method,\r\n                    direction=DataFlowDirection.BIDIRECTIONAL,\r\n                    volume=\"medium\",\r\n                    critical=False\r\n                ))\r\n\r\n        # Analyze logs if available\r\n        if logs:\r\n            flows = self._enhance_flows_from_logs(flows, logs)\r\n\r\n        return flows\r\n\r\n    def _get_data_type(\r\n        self, source: ERPModule, target: ERPModule\r\n    ) -> str:\r\n        \"\"\"Determine data type for module pair\"\"\"\r\n        data_types = {\r\n            (ERPModule.PROJECT_MANAGEMENT, ERPModule.COST_CONTROL): \"costs_budgets\",\r\n            (ERPModule.COST_CONTROL, ERPModule.FINANCE): \"financial_transactions\",\r\n            (ERPModule.PROCUREMENT, ERPModule.INVENTORY): \"purchase_orders\",\r\n            (ERPModule.HR, ERPModule.PAYROLL): \"employee_time\",\r\n            (ERPModule.BILLING, ERPModule.FINANCE): \"invoices\"\r\n        }\r\n        return data_types.get((source, target), \"general_data\")\r\n\r\n    def _infer_frequency(self, point: IntegrationPoint) -> str:\r\n        \"\"\"Infer integration frequency from method\"\"\"\r\n        if point.method == IntegrationMethod.WEBHOOK:\r\n            return \"real-time\"\r\n        elif point.method == IntegrationMethod.API:\r\n            return \"hourly\"\r\n        elif point.method == IntegrationMethod.ETL:\r\n            return \"daily\"\r\n        elif point.method == IntegrationMethod.FILE_EXPORT:\r\n            return \"daily\"\r\n        else:\r\n            return \"manual\"\r\n\r\n    def _enhance_flows_from_logs(\r\n        self,\r\n        flows: List[DataFlow],\r\n        logs: List[Dict]\r\n    ) -> List[DataFlow]:\r\n        \"\"\"Enhance flow information from transaction logs\"\"\"\r\n        # Analyze log patterns\r\n        flow_stats = {}\r\n        for log in logs:\r\n            key = (log.get(\"source\"), log.get(\"target\"))\r\n            if key not in flow_stats:\r\n                flow_stats[key] = {\"count\": 0, \"errors\": 0}\r\n            flow_stats[key][\"count\"] += 1\r\n            if log.get(\"status\") == \"error\":\r\n                flow_stats[key][\"errors\"] += 1\r\n\r\n        # Update flows with statistics\r\n        for flow in flows:\r\n            key = (flow.source_module, flow.target_module)\r\n            if key in flow_stats:\r\n                stats = flow_stats[key]\r\n                error_rate = stats[\"errors\"] \u002F stats[\"count\"] if stats[\"count\"] > 0 else 0\r\n                if error_rate > 0.1:\r\n                    flow.issues.append(f\"High error rate: {error_rate:.1%}\")\r\n                if stats[\"count\"] \u003C 10:\r\n                    flow.issues.append(\"Low transaction volume\")\r\n\r\n        return flows\r\n\r\n    def _calculate_integration_score(\r\n        self,\r\n        erp: ERPSystem,\r\n        flows: List[DataFlow],\r\n        points: List[IntegrationPoint]\r\n    ) -> float:\r\n        \"\"\"Calculate overall integration score (0-1)\"\"\"\r\n        scores = []\r\n\r\n        # API availability\r\n        if erp.has_api:\r\n            scores.append(1.0)\r\n        else:\r\n            scores.append(0.3)\r\n\r\n        # Integration method quality\r\n        method_scores = {\r\n            IntegrationMethod.API: 1.0,\r\n            IntegrationMethod.WEBHOOK: 1.0,\r\n            IntegrationMethod.MESSAGE_QUEUE: 0.9,\r\n            IntegrationMethod.ETL: 0.8,\r\n            IntegrationMethod.DATABASE: 0.7,\r\n            IntegrationMethod.FILE_EXPORT: 0.5,\r\n            IntegrationMethod.MANUAL: 0.2\r\n        }\r\n\r\n        if points:\r\n            avg_method_score = sum(\r\n                method_scores.get(p.method, 0.5) for p in points\r\n            ) \u002F len(points)\r\n            scores.append(avg_method_score)\r\n\r\n        # Critical flow coverage\r\n        critical_covered = sum(1 for f in flows if f.critical) \u002F len(self.critical_flows)\r\n        scores.append(critical_covered)\r\n\r\n        # Flow health (issues)\r\n        flows_with_issues = sum(1 for f in flows if f.issues)\r\n        flow_health = 1 - (flows_with_issues \u002F len(flows)) if flows else 1\r\n        scores.append(flow_health)\r\n\r\n        return sum(scores) \u002F len(scores)\r\n\r\n    def _identify_bottlenecks(\r\n        self,\r\n        flows: List[DataFlow],\r\n        points: List[IntegrationPoint]\r\n    ) -> List[str]:\r\n        \"\"\"Identify integration bottlenecks\"\"\"\r\n        bottlenecks = []\r\n\r\n        # Manual integrations\r\n        manual_flows = [f for f in flows if f.method == IntegrationMethod.MANUAL]\r\n        if manual_flows:\r\n            bottlenecks.append(\r\n                f\"{len(manual_flows)} manual data flows requiring automation\"\r\n            )\r\n\r\n        # File-based integrations\r\n        file_flows = [f for f in flows if f.method == IntegrationMethod.FILE_EXPORT]\r\n        if file_flows:\r\n            bottlenecks.append(\r\n                f\"{len(file_flows)} file-based integrations causing delays\"\r\n            )\r\n\r\n        # Low reliability points\r\n        low_reliability = [p for p in points if p.reliability_score \u003C 0.8]\r\n        if low_reliability:\r\n            bottlenecks.append(\r\n                f\"{len(low_reliability)} integration points with low reliability\"\r\n            )\r\n\r\n        # Flows with issues\r\n        problem_flows = [f for f in flows if f.issues]\r\n        for flow in problem_flows:\r\n            for issue in flow.issues:\r\n                bottlenecks.append(\r\n                    f\"{flow.source_module} → {flow.target_module}: {issue}\"\r\n                )\r\n\r\n        # Missing critical flows\r\n        existing_critical = {\r\n            (f.source_module, f.target_module) for f in flows if f.critical\r\n        }\r\n        for critical in self.critical_flows:\r\n            if critical not in existing_critical:\r\n                bottlenecks.append(\r\n                    f\"Missing critical flow: {critical[0]} → {critical[1]}\"\r\n                )\r\n\r\n        return bottlenecks\r\n\r\n    def _generate_recommendations(\r\n        self,\r\n        erp: ERPSystem,\r\n        flows: List[DataFlow],\r\n        bottlenecks: List[str]\r\n    ) -> List[str]:\r\n        \"\"\"Generate integration improvement recommendations\"\"\"\r\n        recommendations = []\r\n\r\n        # API recommendations\r\n        if not erp.has_api:\r\n            recommendations.append(\r\n                \"Enable API access for the ERP system to improve integration capabilities\"\r\n            )\r\n\r\n        # Method upgrades\r\n        manual_count = sum(1 for f in flows if f.method == IntegrationMethod.MANUAL)\r\n        if manual_count > 0:\r\n            recommendations.append(\r\n                f\"Automate {manual_count} manual data flows using API or ETL\"\r\n            )\r\n\r\n        file_count = sum(1 for f in flows if f.method == IntegrationMethod.FILE_EXPORT)\r\n        if file_count > 2:\r\n            recommendations.append(\r\n                \"Replace file-based integrations with real-time API connections\"\r\n            )\r\n\r\n        # Real-time integration\r\n        non_realtime = sum(\r\n            1 for f in flows\r\n            if f.critical and f.frequency not in [\"real-time\", \"hourly\"]\r\n        )\r\n        if non_realtime > 0:\r\n            recommendations.append(\r\n                f\"Upgrade {non_realtime} critical flows to real-time synchronization\"\r\n            )\r\n\r\n        # Data quality\r\n        if any(\"error rate\" in b.lower() for b in bottlenecks):\r\n            recommendations.append(\r\n                \"Implement data validation at integration points to reduce errors\"\r\n            )\r\n\r\n        # Monitoring\r\n        recommendations.append(\r\n            \"Implement integration monitoring dashboard for proactive issue detection\"\r\n        )\r\n\r\n        return recommendations\r\n\r\n    def _create_flow_diagram(\r\n        self,\r\n        erp: ERPSystem,\r\n        external_systems: List[Dict],\r\n        flows: List[DataFlow]\r\n    ) -> Dict:\r\n        \"\"\"Create data flow diagram structure\"\"\"\r\n        nodes = []\r\n        edges = []\r\n\r\n        # Add ERP modules as nodes\r\n        for module in erp.modules:\r\n            nodes.append({\r\n                \"id\": module.value,\r\n                \"type\": \"erp_module\",\r\n                \"label\": module.value.replace(\"_\", \" \").title(),\r\n                \"system\": erp.name\r\n            })\r\n\r\n        # Add external systems as nodes\r\n        for system in external_systems:\r\n            nodes.append({\r\n                \"id\": system[\"name\"],\r\n                \"type\": \"external\",\r\n                \"label\": system[\"name\"],\r\n                \"system\": \"external\"\r\n            })\r\n\r\n        # Add flows as edges\r\n        for flow in flows:\r\n            edges.append({\r\n                \"source\": flow.source_module,\r\n                \"target\": flow.target_module,\r\n                \"method\": flow.method.value,\r\n                \"frequency\": flow.frequency,\r\n                \"critical\": flow.critical,\r\n                \"data_type\": flow.data_type\r\n            })\r\n\r\n        return {\r\n            \"nodes\": nodes,\r\n            \"edges\": edges,\r\n            \"legend\": {\r\n                \"node_types\": [\"erp_module\", \"external\"],\r\n                \"edge_methods\": [m.value for m in IntegrationMethod]\r\n            }\r\n        }\r\n\r\n    def compare_integration_options(\r\n        self,\r\n        options: List[Dict]\r\n    ) -> Dict:\r\n        \"\"\"Compare different integration approaches\"\"\"\r\n        comparison = []\r\n\r\n        for option in options:\r\n            score = self._score_integration_option(option)\r\n            comparison.append({\r\n                \"name\": option[\"name\"],\r\n                \"method\": option.get(\"method\", \"unknown\"),\r\n                \"cost\": option.get(\"cost\", \"unknown\"),\r\n                \"implementation_time\": option.get(\"time\", \"unknown\"),\r\n                \"reliability\": score[\"reliability\"],\r\n                \"scalability\": score[\"scalability\"],\r\n                \"maintenance\": score[\"maintenance\"],\r\n                \"total_score\": score[\"total\"]\r\n            })\r\n\r\n        # Sort by total score\r\n        comparison.sort(key=lambda x: x[\"total_score\"], reverse=True)\r\n\r\n        return {\r\n            \"options\": comparison,\r\n            \"recommendation\": comparison[0][\"name\"] if comparison else None\r\n        }\r\n\r\n    def _score_integration_option(self, option: Dict) -> Dict:\r\n        \"\"\"Score an integration option\"\"\"\r\n        method = option.get(\"method\", \"\")\r\n\r\n        # Base scores by method\r\n        method_scores = {\r\n            \"api\": {\"reliability\": 0.9, \"scalability\": 0.9, \"maintenance\": 0.8},\r\n            \"etl\": {\"reliability\": 0.8, \"scalability\": 0.8, \"maintenance\": 0.7},\r\n            \"file\": {\"reliability\": 0.6, \"scalability\": 0.5, \"maintenance\": 0.6},\r\n            \"manual\": {\"reliability\": 0.4, \"scalability\": 0.2, \"maintenance\": 0.3}\r\n        }\r\n\r\n        scores = method_scores.get(method, {\"reliability\": 0.5, \"scalability\": 0.5, \"maintenance\": 0.5})\r\n        scores[\"total\"] = sum(scores.values()) \u002F 3\r\n\r\n        return scores\r\n\r\n\r\nclass IntegrationHealthMonitor:\r\n    \"\"\"Monitor ERP integration health\"\"\"\r\n\r\n    def __init__(self, integration_points: List[IntegrationPoint]):\r\n        self.points = integration_points\r\n        self.history: List[Dict] = []\r\n\r\n    def check_health(self) -> Dict:\r\n        \"\"\"Check current integration health\"\"\"\r\n        results = {\r\n            \"timestamp\": datetime.now(),\r\n            \"overall_status\": \"healthy\",\r\n            \"points_checked\": len(self.points),\r\n            \"issues\": []\r\n        }\r\n\r\n        for point in self.points:\r\n            status = self._check_point(point)\r\n            if status[\"status\"] != \"healthy\":\r\n                results[\"issues\"].append({\r\n                    \"point\": point.id,\r\n                    \"status\": status[\"status\"],\r\n                    \"message\": status[\"message\"]\r\n                })\r\n\r\n        if len(results[\"issues\"]) > 0:\r\n            results[\"overall_status\"] = \"degraded\"\r\n        if len(results[\"issues\"]) > len(self.points) * 0.5:\r\n            results[\"overall_status\"] = \"critical\"\r\n\r\n        self.history.append(results)\r\n        return results\r\n\r\n    def _check_point(self, point: IntegrationPoint) -> Dict:\r\n        \"\"\"Check individual integration point\"\"\"\r\n        if point.status != \"active\":\r\n            return {\"status\": \"inactive\", \"message\": \"Integration point disabled\"}\r\n\r\n        if point.reliability_score \u003C 0.5:\r\n            return {\"status\": \"degraded\", \"message\": \"Low reliability score\"}\r\n\r\n        if point.last_sync:\r\n            hours_since_sync = (datetime.now() - point.last_sync).total_seconds() \u002F 3600\r\n            if hours_since_sync > 24:\r\n                return {\"status\": \"stale\", \"message\": f\"No sync for {hours_since_sync:.0f} hours\"}\r\n\r\n        return {\"status\": \"healthy\", \"message\": \"OK\"}\r\n\r\n    def get_health_report(self) -> str:\r\n        \"\"\"Generate health report\"\"\"\r\n        current = self.check_health()\r\n\r\n        report = f\"\"\"\r\n# ERP Integration Health Report\r\nGenerated: {current['timestamp'].strftime('%Y-%m-%d %H:%M')}\r\n\r\n## Overall Status: {current['overall_status'].upper()}\r\n\r\n### Integration Points: {current['points_checked']}\r\n### Active Issues: {len(current['issues'])}\r\n\"\"\"\r\n        if current['issues']:\r\n            report += \"\\n### Issues:\\n\"\r\n            for issue in current['issues']:\r\n                report += f\"- **{issue['point']}**: {issue['status']} - {issue['message']}\\n\"\r\n\r\n        return report\r\n```\r\n\r\n## Common Use Cases\r\n\r\n### Analyze ERP Integration\r\n\r\n```python\r\nanalyzer = ERPIntegrationAnalyzer()\r\n\r\n# Define ERP system\r\nerp = ERPSystem(\r\n    name=\"SAP S\u002F4HANA\",\r\n    vendor=\"SAP\",\r\n    version=\"2023\",\r\n    modules=[\r\n        ERPModule.FINANCE,\r\n        ERPModule.PROJECT_MANAGEMENT,\r\n        ERPModule.PROCUREMENT,\r\n        ERPModule.COST_CONTROL,\r\n        ERPModule.HR,\r\n        ERPModule.BILLING\r\n    ],\r\n    database=\"HANA\",\r\n    has_api=True,\r\n    api_type=\"REST\"\r\n)\r\n\r\n# Define external systems\r\nexternal = [\r\n    {\"name\": \"Procore\", \"type\": \"project_management\"},\r\n    {\"name\": \"Revit\", \"type\": \"bim\"},\r\n    {\"name\": \"Primavera\", \"type\": \"scheduling\"}\r\n]\r\n\r\n# Define integration points\r\npoints = [\r\n    IntegrationPoint(\r\n        id=\"erp-procore\",\r\n        source_system=\"SAP S\u002F4HANA\",\r\n        target_system=\"Procore\",\r\n        method=IntegrationMethod.API\r\n    ),\r\n    IntegrationPoint(\r\n        id=\"erp-primavera\",\r\n        source_system=\"SAP S\u002F4HANA\",\r\n        target_system=\"Primavera\",\r\n        method=IntegrationMethod.FILE_EXPORT\r\n    )\r\n]\r\n\r\nanalysis = analyzer.analyze_erp_integration(\r\n    erp_system=erp,\r\n    external_systems=external,\r\n    integration_points=points\r\n)\r\n\r\nprint(f\"Integration Score: {analysis.integration_score:.0%}\")\r\nprint(f\"Bottlenecks: {len(analysis.bottlenecks)}\")\r\n```\r\n\r\n### Monitor Integration Health\r\n\r\n```python\r\nmonitor = IntegrationHealthMonitor(integration_points)\r\n\r\nhealth = monitor.check_health()\r\nprint(f\"Status: {health['overall_status']}\")\r\n\r\nif health['issues']:\r\n    for issue in health['issues']:\r\n        print(f\"  - {issue['point']}: {issue['message']}\")\r\n\r\n# Generate report\r\nreport = monitor.get_health_report()\r\nprint(report)\r\n```\r\n\r\n### Compare Integration Options\r\n\r\n```python\r\noptions = [\r\n    {\"name\": \"REST API Integration\", \"method\": \"api\", \"cost\": 50000, \"time\": \"3 months\"},\r\n    {\"name\": \"ETL Pipeline\", \"method\": \"etl\", \"cost\": 30000, \"time\": \"2 months\"},\r\n    {\"name\": \"File-based Export\", \"method\": \"file\", \"cost\": 10000, \"time\": \"1 month\"}\r\n]\r\n\r\ncomparison = analyzer.compare_integration_options(options)\r\nprint(f\"Recommended: {comparison['recommendation']}\")\r\n```\r\n\r\n## Quick Reference\r\n\r\n| Component | Purpose |\r\n|-----------|---------|\r\n| `ERPIntegrationAnalyzer` | Main analysis engine |\r\n| `ERPSystem` | ERP system definition |\r\n| `ERPModule` | Standard ERP modules |\r\n| `IntegrationPoint` | Integration connection |\r\n| `DataFlow` | Data flow mapping |\r\n| `IntegrationHealthMonitor` | Health monitoring |\r\n\r\n## Resources\r\n\r\n- **Book**: \"Data-Driven Construction\" by Artem Boiko, Chapter 1.2\r\n- **Website**: https:\u002F\u002Fdatadrivenconstruction.io\r\n\r\n## Next Steps\r\n\r\n- Use [data-silo-detection](..\u002Fdata-silo-detection\u002FSKILL.md) to identify isolated systems\r\n- Use [etl-pipeline](..\u002F..\u002FChapter-4.2\u002Fetl-pipeline\u002FSKILL.md) for data integration\r\n- Use [interoperability-analyzer](..\u002F..\u002FChapter-3.5\u002Finteroperability-analyzer\u002FSKILL.md) for standards compliance\r\n","# ERP Integration Analysis\r\n\r\n## Overview\r\n\r\nBased on DDC methodology (Chapter 1.2), this skill analyzes ERP system integration patterns in construction organizations, mapping data flows between modules and identifying optimization opportunities.\r\n\r\n**Book Reference:** \"Технологии и системы управления в современном строительстве\" \u002F \"Technologies and Management Systems in Modern Construction\"\r\n\r\n## Quick Start\r\n\r\n```python\r\nfrom dataclasses import dataclass, field\r\nfrom enum import Enum\r\nfrom typing import List, Dict, Optional, Set, Tuple\r\nfrom datetime import datetime\r\nimport json\r\n\r\nclass ERPModule(Enum):\r\n    \"\"\"Common ERP modules in construction\"\"\"\r\n    FINANCE = \"finance\"\r\n    PROJECT_MANAGEMENT = \"project_management\"\r\n    PROCUREMENT = \"procurement\"\r\n    INVENTORY = \"inventory\"\r\n    HR = \"human_resources\"\r\n    PAYROLL = \"payroll\"\r\n    EQUIPMENT = \"equipment\"\r\n    SUBCONTRACTS = \"subcontracts\"\r\n    BILLING = \"billing\"\r\n    COST_CONTROL = \"cost_control\"\r\n    DOCUMENT_MANAGEMENT = \"document_management\"\r\n    REPORTING = \"reporting\"\r\n\r\nclass IntegrationMethod(Enum):\r\n    \"\"\"Types of integration methods\"\"\"\r\n    API = \"api\"\r\n    DATABASE = \"database\"\r\n    FILE_EXPORT = \"file_export\"\r\n    MANUAL = \"manual\"\r\n    WEBHOOK = \"webhook\"\r\n    MESSAGE_QUEUE = \"message_queue\"\r\n    ETL = \"etl\"\r\n\r\nclass DataFlowDirection(Enum):\r\n    \"\"\"Direction of data flow\"\"\"\r\n    INBOUND = \"inbound\"\r\n    OUTBOUND = \"outbound\"\r\n    BIDIRECTIONAL = \"bidirectional\"\r\n\r\n@dataclass\r\nclass DataFlow:\r\n    \"\"\"Represents a data flow between systems\u002Fmodules\"\"\"\r\n    source_module: str\r\n    target_module: str\r\n    data_type: str\r\n    frequency: str  # real-time, hourly, daily, weekly, manual\r\n    method: IntegrationMethod\r\n    direction: DataFlowDirection\r\n    volume: str  # low, medium, high\r\n    critical: bool = False\r\n    issues: List[str] = field(default_factory=list)\r\n\r\n@dataclass\r\nclass ERPSystem:\r\n    \"\"\"ERP system definition\"\"\"\r\n    name: str\r\n    vendor: str\r\n    version: str\r\n    modules: List[ERPModule]\r\n    database: str\r\n    has_api: bool\r\n    api_type: Optional[str] = None  # REST, SOAP, GraphQL\r\n    custom_modules: List[str] = field(default_factory=list)\r\n\r\n@dataclass\r\nclass IntegrationPoint:\r\n    \"\"\"Integration point between systems\"\"\"\r\n    id: str\r\n    source_system: str\r\n    target_system: str\r\n    method: IntegrationMethod\r\n    endpoint: Optional[str] = None\r\n    authentication: Optional[str] = None\r\n    data_format: str = \"json\"\r\n    status: str = \"active\"\r\n    reliability_score: float = 1.0\r\n    last_sync: Optional[datetime] = None\r\n\r\n@dataclass\r\nclass IntegrationAnalysis:\r\n    \"\"\"Complete integration analysis results\"\"\"\r\n    erp_system: ERPSystem\r\n    external_systems: List[str]\r\n    data_flows: List[DataFlow]\r\n    integration_points: List[IntegrationPoint]\r\n    integration_score: float\r\n    bottlenecks: List[str]\r\n    recommendations: List[str]\r\n    data_flow_diagram: Dict\r\n\r\n\r\nclass ERPIntegrationAnalyzer:\r\n    \"\"\"\r\n    Analyze ERP system integration for construction data flows.\r\n    Based on DDC methodology Chapter 1.2.\r\n    \"\"\"\r\n\r\n    def __init__(self):\r\n        self.module_dependencies = self._define_module_dependencies()\r\n        self.critical_flows = self._define_critical_flows()\r\n\r\n    def _define_module_dependencies(self) -> Dict[ERPModule, List[ERPModule]]:\r\n        \"\"\"Define typical module dependencies\"\"\"\r\n        return {\r\n            ERPModule.PROJECT_MANAGEMENT: [\r\n                ERPModule.COST_CONTROL,\r\n                ERPModule.PROCUREMENT,\r\n                ERPModule.HR,\r\n                ERPModule.DOCUMENT_MANAGEMENT\r\n            ],\r\n            ERPModule.COST_CONTROL: [\r\n                ERPModule.FINANCE,\r\n                ERPModule.PROJECT_MANAGEMENT,\r\n                ERPModule.BILLING\r\n            ],\r\n            ERPModule.PROCUREMENT: [\r\n                ERPModule.INVENTORY,\r\n                ERPModule.FINANCE,\r\n                ERPModule.SUBCONTRACTS\r\n            ],\r\n            ERPModule.BILLING: [\r\n                ERPModule.FINANCE,\r\n                ERPModule.PROJECT_MANAGEMENT,\r\n                ERPModule.COST_CONTROL\r\n            ],\r\n            ERPModule.PAYROLL: [\r\n                ERPModule.HR,\r\n                ERPModule.FINANCE,\r\n                ERPModule.PROJECT_MANAGEMENT\r\n            ],\r\n            ERPModule.INVENTORY: [\r\n                ERPModule.PROCUREMENT,\r\n                ERPModule.PROJECT_MANAGEMENT,\r\n                ERPModule.FINANCE\r\n            ],\r\n            ERPModule.EQUIPMENT: [\r\n                ERPModule.PROJECT_MANAGEMENT,\r\n                ERPModule.FINANCE,\r\n                ERPModule.INVENTORY\r\n            ],\r\n            ERPModule.SUBCONTRACTS: [\r\n                ERPModule.PROCUREMENT,\r\n                ERPModule.FINANCE,\r\n                ERPModule.PROJECT_MANAGEMENT\r\n            ]\r\n        }\r\n\r\n    def _define_critical_flows(self) -> List[Tuple[str, str]]:\r\n        \"\"\"Define business-critical data flows\"\"\"\r\n        return [\r\n            (\"project_management\", \"cost_control\"),\r\n            (\"cost_control\", \"finance\"),\r\n            (\"procurement\", \"inventory\"),\r\n            (\"billing\", \"finance\"),\r\n            (\"hr\", \"payroll\"),\r\n            (\"project_management\", \"billing\")\r\n        ]\r\n\r\n    def analyze_erp_integration(\r\n        self,\r\n        erp_system: ERPSystem,\r\n        external_systems: List[Dict],\r\n        integration_points: List[IntegrationPoint],\r\n        transaction_logs: Optional[List[Dict]] = None\r\n    ) -> IntegrationAnalysis:\r\n        \"\"\"\r\n        Perform comprehensive ERP integration analysis.\r\n\r\n        Args:\r\n            erp_system: The ERP system to analyze\r\n            external_systems: List of external systems\r\n            integration_points: Defined integration points\r\n            transaction_logs: Optional transaction logs for analysis\r\n\r\n        Returns:\r\n            Complete integration analysis\r\n        \"\"\"\r\n        # Map all data flows\r\n        data_flows = self._map_data_flows(\r\n            erp_system, integration_points, transaction_logs\r\n        )\r\n\r\n        # Calculate integration score\r\n        integration_score = self._calculate_integration_score(\r\n            erp_system, data_flows, integration_points\r\n        )\r\n\r\n        # Identify bottlenecks\r\n        bottlenecks = self._identify_bottlenecks(\r\n            data_flows, integration_points\r\n        )\r\n\r\n        # Generate recommendations\r\n        recommendations = self._generate_recommendations(\r\n            erp_system, data_flows, bottlenecks\r\n        )\r\n\r\n        # Create data flow diagram\r\n        diagram = self._create_flow_diagram(\r\n            erp_system, external_systems, data_flows\r\n        )\r\n\r\n        return IntegrationAnalysis(\r\n            erp_system=erp_system,\r\n            external_systems=[s[\"name\"] for s in external_systems],\r\n            data_flows=data_flows,\r\n            integration_points=integration_points,\r\n            integration_score=integration_score,\r\n            bottlenecks=bottlenecks,\r\n            recommendations=recommendations,\r\n            data_flow_diagram=diagram\r\n        )\r\n\r\n    def _map_data_flows(\r\n        self,\r\n        erp: ERPSystem,\r\n        integration_points: List[IntegrationPoint],\r\n        logs: Optional[List[Dict]]\r\n    ) -> List[DataFlow]:\r\n        \"\"\"Map all data flows in the system\"\"\"\r\n        flows = []\r\n\r\n        # Internal module flows\r\n        for module in erp.modules:\r\n            dependencies = self.module_dependencies.get(module, [])\r\n            for dep in dependencies:\r\n                if dep in erp.modules:\r\n                    is_critical = (module.value, dep.value) in self.critical_flows\r\n                    flows.append(DataFlow(\r\n                        source_module=module.value,\r\n                        target_module=dep.value,\r\n                        data_type=self._get_data_type(module, dep),\r\n                        frequency=\"real-time\",\r\n                        method=IntegrationMethod.DATABASE,\r\n                        direction=DataFlowDirection.BIDIRECTIONAL,\r\n                        volume=\"high\" if is_critical else \"medium\",\r\n                        critical=is_critical\r\n                    ))\r\n\r\n        # External integration flows\r\n        for point in integration_points:\r\n            if point.source_system == erp.name or point.target_system == erp.name:\r\n                flows.append(DataFlow(\r\n                    source_module=point.source_system,\r\n                    target_module=point.target_system,\r\n                    data_type=\"mixed\",\r\n                    frequency=self._infer_frequency(point),\r\n                    method=point.method,\r\n                    direction=DataFlowDirection.BIDIRECTIONAL,\r\n                    volume=\"medium\",\r\n                    critical=False\r\n                ))\r\n\r\n        # Analyze logs if available\r\n        if logs:\r\n            flows = self._enhance_flows_from_logs(flows, logs)\r\n\r\n        return flows\r\n\r\n    def _get_data_type(\r\n        self, source: ERPModule, target: ERPModule\r\n    ) -> str:\r\n        \"\"\"Determine data type for module pair\"\"\"\r\n        data_types = {\r\n            (ERPModule.PROJECT_MANAGEMENT, ERPModule.COST_CONTROL): \"costs_budgets\",\r\n            (ERPModule.COST_CONTROL, ERPModule.FINANCE): \"financial_transactions\",\r\n            (ERPModule.PROCUREMENT, ERPModule.INVENTORY): \"purchase_orders\",\r\n            (ERPModule.HR, ERPModule.PAYROLL): \"employee_time\",\r\n            (ERPModule.BILLING, ERPModule.FINANCE): \"invoices\"\r\n        }\r\n        return data_types.get((source, target), \"general_data\")\r\n\r\n    def _infer_frequency(self, point: IntegrationPoint) -> str:\r\n        \"\"\"Infer integration frequency from method\"\"\"\r\n        if point.method == IntegrationMethod.WEBHOOK:\r\n            return \"real-time\"\r\n        elif point.method == IntegrationMethod.API:\r\n            return \"hourly\"\r\n        elif point.method == IntegrationMethod.ETL:\r\n            return \"daily\"\r\n        elif point.method == IntegrationMethod.FILE_EXPORT:\r\n            return \"daily\"\r\n        else:\r\n            return \"manual\"\r\n\r\n    def _enhance_flows_from_logs(\r\n        self,\r\n        flows: List[DataFlow],\r\n        logs: List[Dict]\r\n    ) -> List[DataFlow]:\r\n        \"\"\"Enhance flow information from transaction logs\"\"\"\r\n        # Analyze log patterns\r\n        flow_stats = {}\r\n        for log in logs:\r\n            key = (log.get(\"source\"), log.get(\"target\"))\r\n            if key not in flow_stats:\r\n                flow_stats[key] = {\"count\": 0, \"errors\": 0}\r\n            flow_stats[key][\"count\"] += 1\r\n            if log.get(\"status\") == \"error\":\r\n                flow_stats[key][\"errors\"] += 1\r\n\r\n        # Update flows with statistics\r\n        for flow in flows:\r\n            key = (flow.source_module, flow.target_module)\r\n            if key in flow_stats:\r\n                stats = flow_stats[key]\r\n                error_rate = stats[\"errors\"] \u002F stats[\"count\"] if stats[\"count\"] > 0 else 0\r\n                if error_rate > 0.1:\r\n                    flow.issues.append(f\"High error rate: {error_rate:.1%}\")\r\n                if stats[\"count\"] \u003C 10:\r\n                    flow.issues.append(\"Low transaction volume\")\r\n\r\n        return flows\r\n\r\n    def _calculate_integration_score(\r\n        self,\r\n        erp: ERPSystem,\r\n        flows: List[DataFlow],\r\n        points: List[IntegrationPoint]\r\n    ) -> float:\r\n        \"\"\"Calculate overall integration score (0-1)\"\"\"\r\n        scores = []\r\n\r\n        # API availability\r\n        if erp.has_api:\r\n            scores.append(1.0)\r\n        else:\r\n            scores.append(0.3)\r\n\r\n        # Integration method quality\r\n        method_scores = {\r\n            IntegrationMethod.API: 1.0,\r\n            IntegrationMethod.WEBHOOK: 1.0,\r\n            IntegrationMethod.MESSAGE_QUEUE: 0.9,\r\n            IntegrationMethod.ETL: 0.8,\r\n            IntegrationMethod.DATABASE: 0.7,\r\n            IntegrationMethod.FILE_EXPORT: 0.5,\r\n            IntegrationMethod.MANUAL: 0.2\r\n        }\r\n\r\n        if points:\r\n            avg_method_score = sum(\r\n                method_scores.get(p.method, 0.5) for p in points\r\n            ) \u002F len(points)\r\n            scores.append(avg_method_score)\r\n\r\n        # Critical flow coverage\r\n        critical_covered = sum(1 for f in flows if f.critical) \u002F len(self.critical_flows)\r\n        scores.append(critical_covered)\r\n\r\n        # Flow health (issues)\r\n        flows_with_issues = sum(1 for f in flows if f.issues)\r\n        flow_health = 1 - (flows_with_issues \u002F len(flows)) if flows else 1\r\n        scores.append(flow_health)\r\n\r\n        return sum(scores) \u002F len(scores)\r\n\r\n    def _identify_bottlenecks(\r\n        self,\r\n        flows: List[DataFlow],\r\n        points: List[IntegrationPoint]\r\n    ) -> List[str]:\r\n        \"\"\"Identify integration bottlenecks\"\"\"\r\n        bottlenecks = []\r\n\r\n        # Manual integrations\r\n        manual_flows = [f for f in flows if f.method == IntegrationMethod.MANUAL]\r\n        if manual_flows:\r\n            bottlenecks.append(\r\n                f\"{len(manual_flows)} manual data flows requiring automation\"\r\n            )\r\n\r\n        # File-based integrations\r\n        file_flows = [f for f in flows if f.method == IntegrationMethod.FILE_EXPORT]\r\n        if file_flows:\r\n            bottlenecks.append(\r\n                f\"{len(file_flows)} file-based integrations causing delays\"\r\n            )\r\n\r\n        # Low reliability points\r\n        low_reliability = [p for p in points if p.reliability_score \u003C 0.8]\r\n        if low_reliability:\r\n            bottlenecks.append(\r\n                f\"{len(low_reliability)} integration points with low reliability\"\r\n            )\r\n\r\n        # Flows with issues\r\n        problem_flows = [f for f in flows if f.issues]\r\n        for flow in problem_flows:\r\n            for issue in flow.issues:\r\n                bottlenecks.append(\r\n                    f\"{flow.source_module} → {flow.target_module}: {issue}\"\r\n                )\r\n\r\n        # Missing critical flows\r\n        existing_critical = {\r\n            (f.source_module, f.target_module) for f in flows if f.critical\r\n        }\r\n        for critical in self.critical_flows:\r\n            if critical not in existing_critical:\r\n                bottlenecks.append(\r\n                    f\"Missing critical flow: {critical[0]} → {critical[1]}\"\r\n                )\r\n\r\n        return bottlenecks\r\n\r\n    def _generate_recommendations(\r\n        self,\r\n        erp: ERPSystem,\r\n        flows: List[DataFlow],\r\n        bottlenecks: List[str]\r\n    ) -> List[str]:\r\n        \"\"\"Generate integration improvement recommendations\"\"\"\r\n        recommendations = []\r\n\r\n        # API recommendations\r\n        if not erp.has_api:\r\n            recommendations.append(\r\n                \"Enable API access for the ERP system to improve integration capabilities\"\r\n            )\r\n\r\n        # Method upgrades\r\n        manual_count = sum(1 for f in flows if f.method == IntegrationMethod.MANUAL)\r\n        if manual_count > 0:\r\n            recommendations.append(\r\n                f\"Automate {manual_count} manual data flows using API or ETL\"\r\n            )\r\n\r\n        file_count = sum(1 for f in flows if f.method == IntegrationMethod.FILE_EXPORT)\r\n        if file_count > 2:\r\n            recommendations.append(\r\n                \"Replace file-based integrations with real-time API connections\"\r\n            )\r\n\r\n        # Real-time integration\r\n        non_realtime = sum(\r\n            1 for f in flows\r\n            if f.critical and f.frequency not in [\"real-time\", \"hourly\"]\r\n        )\r\n        if non_realtime > 0:\r\n            recommendations.append(\r\n                f\"Upgrade {non_realtime} critical flows to real-time synchronization\"\r\n            )\r\n\r\n        # Data quality\r\n        if any(\"error rate\" in b.lower() for b in bottlenecks):\r\n            recommendations.append(\r\n                \"Implement data validation at integration points to reduce errors\"\r\n            )\r\n\r\n        # Monitoring\r\n        recommendations.append(\r\n            \"Implement integration monitoring dashboard for proactive issue detection\"\r\n        )\r\n\r\n        return recommendations\r\n\r\n    def _create_flow_diagram(\r\n        self,\r\n        erp: ERPSystem,\r\n        external_systems: List[Dict],\r\n        flows: List[DataFlow]\r\n    ) -> Dict:\r\n        \"\"\"Create data flow diagram structure\"\"\"\r\n        nodes = []\r\n        edges = []\r\n\r\n        # Add ERP modules as nodes\r\n        for module in erp.modules:\r\n            nodes.append({\r\n                \"id\": module.value,\r\n                \"type\": \"erp_module\",\r\n                \"label\": module.value.replace(\"_\", \" \").title(),\r\n                \"system\": erp.name\r\n            })\r\n\r\n        # Add external systems as nodes\r\n        for system in external_systems:\r\n            nodes.append({\r\n                \"id\": system[\"name\"],\r\n                \"type\": \"external\",\r\n                \"label\": system[\"name\"],\r\n                \"system\": \"external\"\r\n            })\r\n\r\n        # Add flows as edges\r\n        for flow in flows:\r\n            edges.append({\r\n                \"source\": flow.source_module,\r\n                \"target\": flow.target_module,\r\n                \"method\": flow.method.value,\r\n                \"frequency\": flow.frequency,\r\n                \"critical\": flow.critical,\r\n                \"data_type\": flow.data_type\r\n            })\r\n\r\n        return {\r\n            \"nodes\": nodes,\r\n            \"edges\": edges,\r\n            \"legend\": {\r\n                \"node_types\": [\"erp_module\", \"external\"],\r\n                \"edge_methods\": [m.value for m in IntegrationMethod]\r\n            }\r\n        }\r\n\r\n    def compare_integration_options(\r\n        self,\r\n        options: List[Dict]\r\n    ) -> Dict:\r\n        \"\"\"Compare different integration approaches\"\"\"\r\n        comparison = []\r\n\r\n        for option in options:\r\n            score = self._score_integration_option(option)\r\n            comparison.append({\r\n                \"name\": option[\"name\"],\r\n                \"method\": option.get(\"method\", \"unknown\"),\r\n                \"cost\": option.get(\"cost\", \"unknown\"),\r\n                \"implementation_time\": option.get(\"time\", \"unknown\"),\r\n                \"reliability\": score[\"reliability\"],\r\n                \"scalability\": score[\"scalability\"],\r\n                \"maintenance\": score[\"maintenance\"],\r\n                \"total_score\": score[\"total\"]\r\n            })\r\n\r\n        # Sort by total score\r\n        comparison.sort(key=lambda x: x[\"total_score\"], reverse=True)\r\n\r\n        return {\r\n            \"options\": comparison,\r\n            \"recommendation\": comparison[0][\"name\"] if comparison else None\r\n        }\r\n\r\n    def _score_integration_option(self, option: Dict) -> Dict:\r\n        \"\"\"Score an integration option\"\"\"\r\n        method = option.get(\"method\", \"\")\r\n\r\n        # Base scores by method\r\n        method_scores = {\r\n            \"api\": {\"reliability\": 0.9, \"scalability\": 0.9, \"maintenance\": 0.8},\r\n            \"etl\": {\"reliability\": 0.8, \"scalability\": 0.8, \"maintenance\": 0.7},\r\n            \"file\": {\"reliability\": 0.6, \"scalability\": 0.5, \"maintenance\": 0.6},\r\n            \"manual\": {\"reliability\": 0.4, \"scalability\": 0.2, \"maintenance\": 0.3}\r\n        }\r\n\r\n        scores = method_scores.get(method, {\"reliability\": 0.5, \"scalability\": 0.5, \"maintenance\": 0.5})\r\n        scores[\"total\"] = sum(scores.values()) \u002F 3\r\n\r\n        return scores\r\n\r\n\r\nclass IntegrationHealthMonitor:\r\n    \"\"\"Monitor ERP integration health\"\"\"\r\n\r\n    def __init__(self, integration_points: List[IntegrationPoint]):\r\n        self.points = integration_points\r\n        self.history: List[Dict] = []\r\n\r\n    def check_health(self) -> Dict:\r\n        \"\"\"Check current integration health\"\"\"\r\n        results = {\r\n            \"timestamp\": datetime.now(),\r\n            \"overall_status\": \"healthy\",\r\n            \"points_checked\": len(self.points),\r\n            \"issues\": []\r\n        }\r\n\r\n        for point in self.points:\r\n            status = self._check_point(point)\r\n            if status[\"status\"] != \"healthy\":\r\n                results[\"issues\"].append({\r\n                    \"point\": point.id,\r\n                    \"status\": status[\"status\"],\r\n                    \"message\": status[\"message\"]\r\n                })\r\n\r\n        if len(results[\"issues\"]) > 0:\r\n            results[\"overall_status\"] = \"degraded\"\r\n        if len(results[\"issues\"]) > len(self.points) * 0.5:\r\n            results[\"overall_status\"] = \"critical\"\r\n\r\n        self.history.append(results)\r\n        return results\r\n\r\n    def _check_point(self, point: IntegrationPoint) -> Dict:\r\n        \"\"\"Check individual integration point\"\"\"\r\n        if point.status != \"active\":\r\n            return {\"status\": \"inactive\", \"message\": \"Integration point disabled\"}\r\n\r\n        if point.reliability_score \u003C 0.5:\r\n            return {\"status\": \"degraded\", \"message\": \"Low reliability score\"}\r\n\r\n        if point.last_sync:\r\n            hours_since_sync = (datetime.now() - point.last_sync).total_seconds() \u002F 3600\r\n            if hours_since_sync > 24:\r\n                return {\"status\": \"stale\", \"message\": f\"No sync for {hours_since_sync:.0f} hours\"}\r\n\r\n        return {\"status\": \"healthy\", \"message\": \"OK\"}\r\n\r\n    def get_health_report(self) -> str:\r\n        \"\"\"Generate health report\"\"\"\r\n        current = self.check_health()\r\n\r\n        report = f\"\"\"\r\n# ERP Integration Health Report\r\nGenerated: {current['timestamp'].strftime('%Y-%m-%d %H:%M')}\r\n\r\n## Overall Status: {current['overall_status'].upper()}\r\n\r\n### Integration Points: {current['points_checked']}\r\n### Active Issues: {len(current['issues'])}\r\n\"\"\"\r\n        if current['issues']:\r\n            report += \"\\n### Issues:\\n\"\r\n            for issue in current['issues']:\r\n                report += f\"- **{issue['point']}**: {issue['status']} - {issue['message']}\\n\"\r\n\r\n        return report\r\n```\r\n\r\n## Common Use Cases\r\n\r\n### Analyze ERP Integration\r\n\r\n```python\r\nanalyzer = ERPIntegrationAnalyzer()\r\n\r\n# Define ERP system\r\nerp = ERPSystem(\r\n    name=\"SAP S\u002F4HANA\",\r\n    vendor=\"SAP\",\r\n    version=\"2023\",\r\n    modules=[\r\n        ERPModule.FINANCE,\r\n        ERPModule.PROJECT_MANAGEMENT,\r\n        ERPModule.PROCUREMENT,\r\n        ERPModule.COST_CONTROL,\r\n        ERPModule.HR,\r\n        ERPModule.BILLING\r\n    ],\r\n    database=\"HANA\",\r\n    has_api=True,\r\n    api_type=\"REST\"\r\n)\r\n\r\n# Define external systems\r\nexternal = [\r\n    {\"name\": \"Procore\", \"type\": \"project_management\"},\r\n    {\"name\": \"Revit\", \"type\": \"bim\"},\r\n    {\"name\": \"Primavera\", \"type\": \"scheduling\"}\r\n]\r\n\r\n# Define integration points\r\npoints = [\r\n    IntegrationPoint(\r\n        id=\"erp-procore\",\r\n        source_system=\"SAP S\u002F4HANA\",\r\n        target_system=\"Procore\",\r\n        method=IntegrationMethod.API\r\n    ),\r\n    IntegrationPoint(\r\n        id=\"erp-primavera\",\r\n        source_system=\"SAP S\u002F4HANA\",\r\n        target_system=\"Primavera\",\r\n        method=IntegrationMethod.FILE_EXPORT\r\n    )\r\n]\r\n\r\nanalysis = analyzer.analyze_erp_integration(\r\n    erp_system=erp,\r\n    external_systems=external,\r\n    integration_points=points\r\n)\r\n\r\nprint(f\"Integration Score: {analysis.integration_score:.0%}\")\r\nprint(f\"Bottlenecks: {len(analysis.bottlenecks)}\")\r\n```\r\n\r\n### Monitor Integration Health\r\n\r\n```python\r\nmonitor = IntegrationHealthMonitor(integration_points)\r\n\r\nhealth = monitor.check_health()\r\nprint(f\"Status: {health['overall_status']}\")\r\n\r\nif health['issues']:\r\n    for issue in health['issues']:\r\n        print(f\"  - {issue['point']}: {issue['message']}\")\r\n\r\n# Generate report\r\nreport = monitor.get_health_report()\r\nprint(report)\r\n```\r\n\r\n### Compare Integration Options\r\n\r\n```python\r\noptions = [\r\n    {\"name\": \"REST API Integration\", \"method\": \"api\", \"cost\": 50000, \"time\": \"3 months\"},\r\n    {\"name\": \"ETL Pipeline\", \"method\": \"etl\", \"cost\": 30000, \"time\": \"2 months\"},\r\n    {\"name\": \"File-based Export\", \"method\": \"file\", \"cost\": 10000, \"time\": \"1 month\"}\r\n]\r\n\r\ncomparison = analyzer.compare_integration_options(options)\r\nprint(f\"Recommended: {comparison['recommendation']}\")\r\n```\r\n\r\n## Quick Reference\r\n\r\n| Component | Purpose |\r\n|-----------|---------|\r\n| `ERPIntegrationAnalyzer` | Main analysis engine |\r\n| `ERPSystem` | ERP system definition |\r\n| `ERPModule` | Standard ERP modules |\r\n| `IntegrationPoint` | Integration connection |\r\n| `DataFlow` | Data flow mapping |\r\n| `IntegrationHealthMonitor` | Health monitoring |\r\n\r\n## Resources\r\n\r\n- **Book**: \"Data-Driven Construction\" by Artem Boiko, Chapter 1.2\r\n- **Website**: https:\u002F\u002Fdatadrivenconstruction.io\r\n\r\n## Next Steps\r\n\r\n- Use [data-silo-detection](..\u002Fdata-silo-detection\u002FSKILL.md) to identify isolated systems\r\n- Use [etl-pipeline](..\u002F..\u002FChapter-4.2\u002Fetl-pipeline\u002FSKILL.md) for data integration\r\n- Use [interoperability-analyzer](..\u002F..\u002FChapter-3.5\u002Finteroperability-analyzer\u002FSKILL.md) for standards compliance\r\n",{"slug":5,"description":7,"display_name":34},"Erp Integration Analysis","main","e7e336ac628c3e3bd771aff1aaa469c93778f94a","skills\u002Fdatadrivenconstruction\u002Ferp-integration-analysis",0,"https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del","2026-08-23 22:39:37",{"source":8,"skillName":5,"commands":43,"prompt":53,"zipAvailable":54},[44,47,50],{"tool":45,"command":46},"npx","npx skills add kbarbel640-del\u002Fskills --skill erp-integration-analysis",{"tool":48,"command":49},"bunx","bunx skills add kbarbel640-del\u002Fskills --skill erp-integration-analysis",{"tool":51,"command":52},"pnpm","pnpm dlx skills add kbarbel640-del\u002Fskills --skill erp-integration-analysis","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fdatadrivenconstruction\u002Ferp-integration-analysis\u002FSKILL.md",true,[56],{"path":57,"resourceType":58,"resourceTypeDesc":59,"sizeBytes":60,"sourceHtmlUrl":61},"_meta.json","REFERENCE","参考文档",316,"https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fdatadrivenconstruction\u002Ferp-integration-analysis\u002F_meta.json",[63,93,121,142,148,168],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":74,"publishedAt":29},"01M6G8J55967D6281ACMKAKTEQ","crowd-prompting","A marketplace where AI agents improve prompts, system instructions, tool descriptions, and other text-based content with domain expertise from real-world operations — and earn tokens for valuable contributions.","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fzzadrian\u002Fcrowd-prompting\u002FSKILL.md",[69],{"categoryNo":70,"categoryName":71,"taxonomyType":72,"taxonomyTypeDesc":73},"01JBSEEDCAT000000000000036","内容创作者","PROFESSION","适用职业",[75,76,77,78,79,80,81,82,83,84,85,86,23,87,88,89,90,91,92],"crowd prompting","prompting","api","with","tokens","domain","world","prompts","operations","instructions","text","tool","improve","productivity","marketplace","https","content","ai agents",{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":104,"publishedAt":29},"01M6G8J0PKPAYVET6BWE8W4C26","dilemm-ai","Compete in DilemmAI, the prisoner's dilemma AI arena at dilemm.ai. Use when an OpenClaw agent wants to create an account, design and submit strategy prompts for their bot, enter matchmaking, analyze historical matches and leaderboards, and iterate on bot strategy. Requires headless browser automation (no API available yet).","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fzyori\u002Fdilemm-ai\u002FSKILL.md",[99],{"categoryNo":100,"categoryName":101,"taxonomyType":102,"taxonomyTypeDesc":103},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[105,77,106,24,107,108,109,110,111,112,113,114,115,116,117,118,119,82,120],"dilemm ai","arena","browser","openclaw agent","create","automation","browser automation","bot","openclaw","design","strategy","headless","compete","submit","matchmaking","use",{"skillNo":122,"name":123,"nameZh":6,"description":124,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":125,"categories":126,"keywords":130,"publishedAt":29},"01M6G8HWAF3K9SW7NP3Z83CPJ6","arxiv-paper-reviews","Interact with arXiv Crawler API to fetch papers, read reviews, and submit comments. Use when working with arXiv papers, fetching paper lists by date\u002Fcategory\u002Finterest, viewing paper details with comments, or submitting paper reviews via API at http:\u002F\u002F150.158.152.82:8000.","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fzxrys\u002Fweak-accept\u002FSKILL.md",[127],{"categoryNo":128,"categoryName":129,"taxonomyType":102,"taxonomyTypeDesc":103},"01JBSEEDCAT000000000000021","资料检索与研究",[131,132,133,134,135,136,137,78,138,118,120,139,77,140,141],"arxiv paper reviews","reviews","arxiv","paper","crawler","papers","comments","fetch","read","http","via",{"skillNo":143,"name":123,"nameZh":6,"description":124,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":144,"categories":145,"keywords":147,"publishedAt":29},"01M6G8HQJ7N7WMY6YV7D7SSJ16","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fzxrys\u002Farxiv-paper-reviews\u002FSKILL.md",[146],{"categoryNo":128,"categoryName":129,"taxonomyType":102,"taxonomyTypeDesc":103},[134,133,132,131,141,136,137,78,135,118,120,138,139,77,140],{"skillNo":149,"name":150,"nameZh":6,"description":151,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":152,"categories":153,"keywords":154,"publishedAt":29},"01M6G8HM95Y64JNVFC2HN4E2BG","git-summary","Get a quick summary of the current Git repository including status, recent commits, branches, and contributors.","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fzweack\u002Fgit-summary\u002FSKILL.md",[],[155,156,157,158,159,160,161,162,163,164,165,166,167],"git","summary","git summary","commits","repository","win32","status","linux","contributors","true","quick","get","branches",{"skillNo":169,"name":170,"nameZh":6,"description":171,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":172,"categories":173,"keywords":178,"publishedAt":29},"01M6G8HGEGF05CNEJCGVYFSC4R","agent-constitution","Interact with AgentConstitution governance contracts on Base Sepolia. Check compliance, read rules, log actions, query governance state.","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fztsalexey\u002Fagent-constitution\u002FSKILL.md",[174,175],{"categoryNo":100,"categoryName":101,"taxonomyType":102,"taxonomyTypeDesc":103},{"categoryNo":176,"categoryName":177,"taxonomyType":72,"taxonomyTypeDesc":73},"01JBSEEDCAT000000000000037","律师与法务",[179,180,181,182,78,183,184,35,185,139,186,187,188,189,190,90,191,192,193],"agent constitution","constitution","contracts","tree","query","base","log","check","Rules","projects","compliance","actions","state","governance","github"]