### Install F.A.R.F.A.N Pipeline Dependencies Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/QUICK_START.md Installs all required packages for the F.A.R.F.A.N Pipeline, creating a Python 3.12+ virtual environment. This is the first step for first-time users. ```bash ./scripts/canonical_auxiliary/01_install_dependencies.sh ``` -------------------------------- ### View F.A.R.F.A.N Pipeline Options Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/QUICK_START.md Displays all available options and flags for running the F.A.R.F.A.N pipeline script. Useful for understanding advanced usage. ```bash ./scripts/run_farfan_pipeline.sh --help ``` -------------------------------- ### Install FARFAN-MCDPP with Python Environment Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/README.md This snippet details the steps to clone the FARFAN-MCDPP repository, create and activate a Python virtual environment (version 3.11+), and install project dependencies using pip. ```bash # Clone repository git clone https://github.com/ALOHAALOHAALOJHA/FARFAN_MCDPP.git cd FARFAN_MCDPP # Create virtual environment (Python 3.11+) python3 -m venv venv source venv/bin/activate # Install dependencies pip install -r requirements.txt pip install -e . ``` -------------------------------- ### CI/CD Integration Examples (YAML/Bash) Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/AUDIT_QUICK_REFERENCE.md Configuration snippets for integrating the audit system into CI/CD pipelines using GitHub Actions, GitLab CI, and pre-commit hooks. These examples automate the audit process and report artifact uploads. ```yaml # GitHub Actions - name: Run Audit run: ./quick_audit.sh --ci - name: Upload Reports if: always() uses: actions/upload-artifact@v3 with: name: audit-reports path: audit_reports/ # GitLab CI audit: script: - python audit_phase0_comprehensive.py artifacts: paths: - audit_reports/ when: always # Pre-commit Hook #!/bin/bash python audit_phase0_comprehensive.py > /dev/null 2>&1 if [ $? -eq 2 ]; then echo "❌ Critical issues - commit blocked" exit 1 fi ``` -------------------------------- ### GitLab CI/CD Integration Example Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/AUDIT_INDEX.md Example configuration for integrating the audit process into a GitLab CI pipeline. This snippet shows how to execute the audit script and manage its artifacts. ```yaml audit: script: - python audit_phase0_comprehensive.py artifacts: paths: [audit_reports/] ``` -------------------------------- ### Execute F.A.R.F.A.N Pipeline Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/QUICK_START.md Executes the complete F.A.R.F.A.N pipeline (Phases 0-9) and generates outputs in the 'artifacts/' directory. Requires a plan file as input. ```bash ./scripts/run_farfan_pipeline.sh --plan data/plans/Plan_1.pdf ``` -------------------------------- ### Hierarchical Configuration Loading in Python Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/docs/SYSTEM_ARCHITECTURE.md Demonstrates a Python example of loading configuration settings hierarchically. It prioritizes environment variables, default configurations, environment-specific overrides, and local overrides. ```python # Hierarchical configuration loading config = load_config() ├── .env (environment variables) ├── config/default.yaml (base config) ├── config/production.yaml (environment override) └── config/local.yaml (local override) ``` -------------------------------- ### GitHub Actions CI/CD Integration Example Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/AUDIT_INDEX.md Example configuration for running the audit script within a GitHub Actions workflow. This snippet demonstrates how to integrate the audit process into a CI pipeline. ```yaml - name: Run Audit run: ./quick_audit.sh --ci ``` -------------------------------- ### Basic Signal Emission Example (Python) Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/docs/EXTRACTOR_SIGNAL_ARCHITECTURE.md A practical example demonstrating how to use the `extract_and_emit_signal` method of a `CausalVerbExtractor`. It processes sample text and prints the number of found links and signal details like ID and routing information. ```python from farfan_pipeline.infrastructure.extractors import CausalVerbExtractor extractor = CausalVerbExtractor(enable_signal_emission=True) text = "Fortalecer la infraestructura educativa para mejorar la calidad." result, signal = extractor.extract_and_emit_signal( text=text, source_file="plan_desarrollo_2024.pdf", policy_area="PA04", slot="D2-Q3" ) print(f"Found {len(result.matches)} causal links") print(f"Signal ID: {signal.signal_id}") print(f"Signal routed to: {signal.scope.phase}/{signal.scope.policy_area}") ``` -------------------------------- ### CPP DEBUG Log Example Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/docs/PHASE1_PDM_CONDITIONING_ENHANCEMENTS.md Example log messages at the DEBUG level, showing adjusted parameters for conditioning (threshold, confidence), enhancements made, and recommendations for improving profile conditioning. ```log SP5: Adjusted parameters - threshold: 0.43 (was 0.50), confidence: 0.66 (was 0.60) SP8: Enhanced with 5 PDM-specific temporal patterns PDM Profile recommendations: Add more patterns for better conditioning ``` -------------------------------- ### SQL Query Examples for Performance Testing (Python) Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/audit_report_20260204_143636.html This snippet presents examples of SQL queries used for performance testing within the FARFAN-MCPPIPELINE project. These queries are part of test cases designed to evaluate the query engine's efficiency and robustness under various conditions. The code is written in Python. ```python ("SELECT * FROM evidence WHERE node_id = 'node_001'", 1) ``` ```python ("SELECT * FROM evidence WHERE confidence > 0.8", 1) ``` ```python ("SELECT * FROM evidence WHERE source = 'test_source'", 2) ``` ```python ("SELECT * FROM evidence WHERE timestamp > '2026-01-01'", 2) ``` -------------------------------- ### CPP INFO Log Example Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/docs/PHASE1_PDM_CONDITIONING_ENHANCEMENTS.md Example log message at the INFO level, indicating the initialization of the PDM Profile Conditioner with its version and detailing the application of profile conditioning steps (SP5, SP7, SP8). ```log PDM Profile Conditioner initialized with profile version: PDM-2025.1 SP5: Profile conditioning applied - Added PDM causal dimension patterns; Lowered threshold for diagnostic-rich PDM SP7: 5 semantic integrity rules will be applied SP8: Enhanced with 5 PDM-specific temporal patterns ``` -------------------------------- ### Phase 8 Post-Deployment Tasks Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/PHASE_1_VS_PHASE_8_AUDIT_COMPARISON.md Example of post-deployment tasks for Phase 8, which are generic and not self-contained. ```json { "post_deployment_tasks": [ "Create Phase READMEs for all 10 phases" ] } ``` -------------------------------- ### Run F.A.R.F.A.N Pipeline Diagnostics Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/QUICK_START.md Executes detailed diagnostics for the F.A.R.F.A.N Pipeline, useful for troubleshooting any issues encountered during setup or execution. ```bash ./scripts/canonical_auxiliary/03_health_diagnostics.sh ``` -------------------------------- ### Verify F.A.R.F.A.N Pipeline Environment Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/QUICK_START.md Runs health checks to ensure the environment is properly set up for the F.A.R.F.A.N Pipeline. This step is crucial after installing dependencies. ```bash ./scripts/canonical_auxiliary/02_environment_check.sh ``` -------------------------------- ### Audit Script Usage Examples (Bash) Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/AUDIT_QUICK_REFERENCE.md Demonstrates various ways to run the audit script, including verbose output, quiet mode, CI/CD mode, and checking exit codes for automation. ```bash # Show full output ./quick_audit.sh --verbose # Show summary only ./quick_audit.sh --quiet # CI/CD mode (strict) ./quick_audit.sh --ci # Check Exit Code ./quick_audit.sh EXIT_CODE=$? if [ $EXIT_CODE -eq 2 ]; then echo "Critical failures!" exit 1 fi ``` -------------------------------- ### Run FARFAN-MCDPP Pipeline Commands Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/README.md Demonstrates basic command-line usage for the FARFAN-MCDPP pipeline, including running on a single document, batch processing from a directory, and checking system health. ```bash # Run pipeline on a single document farfan-pipeline run --input document.pdf --output results/ # Batch processing farfan-pipeline batch --input-dir pdfs/ --output-dir results/ # Check system health farfan-pipeline diagnose ``` -------------------------------- ### Create Core Documentation Files Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/AUDIT_PHASE1_FINAL_REPORT.md This command demonstrates how to create essential documentation files for the project. These files, such as SYSTEM_ARCHITECTURE.md, OPERATIONS_HANDBOOK.md, and RUNBOOK.md, are crucial for understanding and maintaining the system. They should be populated with relevant information extracted from existing documentation. ```bash # Create these files referencing existing content touch docs/SYSTEM_ARCHITECTURE.md touch docs/OPERATIONS_HANDBOOK.md touch docs/RUNBOOK.md ``` -------------------------------- ### Graceful Degradation Error Handling using Python Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/docs/semantic_relationship_extractor_event_driven_guide.md Provides an example of graceful degradation in error handling for the SemanticRelationshipExtractor. This pattern catches specific runtime errors, such as SISAS unavailability, and falls back to a non-event-driven mode. ```python try: extractor = SemanticRelationshipExtractor(sdo=sdo) extractor.ingest(adapter) except RuntimeError as e: if "SISAS not available" in str(e): # Fallback to non-event-driven mode extractor = SemanticRelationshipExtractor() extractor.ingest(adapter) ``` -------------------------------- ### Event-Driven Relationship Extraction with SDO (Python) Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/docs/semantic_relationship_extractor_event_driven_guide.md Illustrates event-driven relationship extraction using SemanticRelationshipExtractor integrated with SignalDistributionOrchestrator (SDO). This setup automatically dispatches MC10_SEMANTIC signals upon ingestion. It requires 'farfan_pipeline' and 'canonic_questionnaire_central' libraries. ```python from farfan_pipeline.infrastructure.extractors.semantic_relationship_extractor import ( SemanticRelationshipExtractor, DictRelationshipAdapter ) from canonic_questionnaire_central.core.signal_distribution_orchestrator import ( SignalDistributionOrchestrator ) # Initialize SDO sdo = SignalDistributionOrchestrator() # Register a consumer def handle_semantic_signals(signal): print(f"Received MC10_SEMANTIC signal with {len(signal.payload['relationships'])} relationships") sdo.register_consumer( consumer_id="semantic_analyzer", scopes=[{"phase": "phase_01", "policy_area": "ALL", "slot": "ALL"}], capabilities=["semantic_graph", "relationship_analysis"], handler=handle_semantic_signals ) # Create extractor with SDO (auto-dispatch enabled by default) extractor = SemanticRelationshipExtractor( sdo=sdo, source_file="pdt_relationships.json", empirical_availability=0.92 ) # Extract - signals are automatically dispatched! adapter = DictRelationshipAdapter(relationships) extractor.ingest(adapter) # → Consumer receives MC10_SEMANTIC signal automatically ``` -------------------------------- ### Compose Chain with Verbose Output (Python) Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/TASK_COMPLETION_CHAIN_COMPOSER_v5.md Demonstrates the recommended way to compose a chain using the composer, including how to obtain verbose output that preserves all metadata. The old method is shown for comparison but is superseded by the new verbose option. ```python # Old code (still works) chain = composer.compose_chain(method_set, classification) # New code (recommended) chain = composer.compose_chain(method_set, classification) contract_data = chain.to_dict_verbose() # Preserves ALL metadata ``` -------------------------------- ### Python Test Path Cleanup with Pytest Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/MIGRATION_PROGRESS_SUMMARY.md Illustrates the cleanup of `sys.path` manipulations in Python test configurations, leveraging `pyproject.toml` for global path management with pytest. This approach simplifies test setup and ensures consistency. These examples show the removal of manual path manipulation in favor of pytest's built-in capabilities. ```python # Removed sys.path manipulation in conftest.py, relying on pytest pythonpath config # Example: tests/conftest.py # No sys.path modifications needed here anymore. ``` ```python # Marked as deprecated: tests/pytest_add_src_path.py # Kept for backward compatibility but does nothing. # This file is no longer necessary due to pyproject.toml configuration. ``` ```python # Updated src_added fixture to not manipulate sys.path # Example: tests/phase_1/test_phase1_e2e_chain.py # The fixture now relies on the global pytest pythonpath setting. ``` -------------------------------- ### CPP Best Practice: Provide Profile (Python) Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/docs/PHASE1_PDM_CONDITIONING_ENHANCEMENTS.md Illustrates the best practice of always providing a structural profile when initializing the Phase1CPPIngestionFullContract. It shows both the recommended way with an explicit profile and an acceptable alternative that uses a default profile. ```python # Good profile = get_default_profile() phase1 = Phase1CPPIngestionFullContract(structural_profile=profile) # Acceptable (uses default) phase1 = Phase1CPPIngestionFullContract(structural_profile=None) ``` -------------------------------- ### Install Dependencies Script (Bash) Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/scripts/canonical_auxiliary/README.md Installs Python dependencies and creates a virtual environment for the F.A.R.F.A.N pipeline. It checks for Python 3.12+, creates a 'farfan-env' virtual environment, installs requirements from 'requirements.txt', and installs the 'farfan_pipeline' package in editable mode. This script does not execute the pipeline or produce artifacts. ```bash #!/bin/bash # Check Python version if ! python3 --version 2>&1 | grep -q "3.12"; then echo "Error: Python 3.12+ is required." exit 1 fi # Create virtual environment if it doesn't exist if [ ! -d "farfan-env" ]; then echo "Creating virtual environment 'farfan-env'..."; python3 -m venv farfan-env fi # Activate virtual environment source farfan-env/bin/activate # Install dependencies echo "Installing dependencies from requirements.txt..."; pip install -r requirements.txt # Install farfan_pipeline package in editable mode echo "Installing farfan_pipeline package in editable mode..."; pip install -e . echo "Dependencies installed and virtual environment set up." ``` -------------------------------- ### Python Package Initialization (__init__.py) - Example Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/audit_reports/audit_phase0_20260204_144835.md This snippet demonstrates a typical Python package initialization file (__init__.py). It can be used to define package-level variables, import submodules, or specify what should be exported when using 'from package import *'. Empty __init__.py files can sometimes indicate unutilized package structures or missed opportunities for better module organization. ```python # Example __init__.py for a Python package # Import specific functions or classes from submodules from .module_a import function_one from .module_b import ClassB # Define package-level variables __version__ = "1.0.0" # Define what gets imported with 'from package import *' __all__ = ["function_one", "ClassB", "__version__"] ``` -------------------------------- ### Deprecated Shell Script Example (Forbidden) Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/RUNBOOK.md An example of a deprecated shell script that should not be used for running the Farfan pipeline. These scripts violate constitutional requirements and are forbidden. ```bash scripts/deprecated_run_scripts/run_farfan_pipeline_v2.sh ``` ```bash scripts/deprecated_run_scripts/run_pipeline.sh ``` -------------------------------- ### Method Configuration in Farfan-MCPPipeline Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/CHAIN_COMPOSER_ARCHITECTURE_DIAGRAM.md This snippet shows the configuration for a method within the Farfan-MCPPipeline project. It includes details like class name, method name, provided data, and level, while also indicating missing ontological mode and fusion strategy configurations. ```json { "class_name": "X", "method_name": "y", "provides": ["raw_facts"], "level": "N1-EMP", ❌ MISSING: ontological_mode ❌ MISSING: veto_conditions (for N3) ❌ MISSING: method-level fusion_strategy ❌ MISSING: evidence_type, extraction_method } ``` -------------------------------- ### Example Commit Message (Conventional Commits) Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/COMMIT_SUMMARY.md This is an example commit message following the conventional commits format. It summarizes the changes, highlights breaking changes, lists updated files, and references related documentation. ```git feat(phase2): Update nomenclature to CANONICAL standards + extend epistemological framework BREAKING CHANGE: Input files must be renamed with CANONICAL_ prefix - Update file path references: CANONICAL_classified_methods.json → CANONICAL_classified_methods.json - Update file path references: CANONICAL_question_executors.json → CANONICAL_question_executors.json - Update file path references: CANONICAL_question_typology.json → CANONICAL_question_typology.json - Update epistemological levels: N2-INF → N2A-INF (Bayesian parameters) - Add new level: N2B-INF (Causal structures) - Update level: N4-META → N4-SYN (Synthesis/narrative) - Add output types: STRUCTURE, NARRATIVE - Add fusion behavior: structural_overlay - Update documentation to reference 787 methods and PARTE VIII - All files compile successfully - Backward compatibility preserved for existing levels - Forward compatibility enabled for N2B and N4-SYN methods Files modified: - input_registry.py (+43/-31) - method_expander.py (+63/-9) - contract_assembler.py (+6/-6) - contract_generator.py (+1/-1) - chain_composer.py (+1/-1) Refs: reglas_epistemologicas (documento completo: PARTE 0-IX) ``` -------------------------------- ### Register Consumer with SDO (Python) Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/canonic_questionnaire_central/documentation/SISAS_2_0_SPECIFICATION.md Demonstrates how to register a consumer with the Signal Distribution Orchestrator (SDO). This involves providing a unique consumer ID, the scopes it listens to, its required capabilities, and a handler function to process incoming signals. ```python # Assuming 'sdo' is an initialized SDO instance sdo.register_consumer( consumer_id="phase_1_extraction", scopes=[{"phase": "phase_01", "policy_area": "ALL", "slot": "ALL"}], capabilities=["NUMERIC_PARSING", "FINANCIAL_ANALYSIS", "CAUSAL_INFERENCE", ...], handler=phase_1_handler_function ) ``` -------------------------------- ### FARFAN-MCDPP Python API Usage Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/README.md Illustrates how to use the FARFAN-MCDPP Python API to initialize the orchestrator with a configuration file and execute the pipeline on a given PDF document, then check the result. ```python from farfan_pipeline import UnifiedOrchestrator # Initialize orchestrator = UnifiedOrchestrator(config_path="config.yaml") # Execute result = orchestrator.execute_pipeline(input_pdf="document.pdf") # Check result if result.is_ok(): print(f"MacroScore: {result.value.macro_score}") ``` -------------------------------- ### CPP WARNING Log Example Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/docs/PHASE1_PDM_CONDITIONING_ENHANCEMENTS.md Example log messages at the WARNING level, indicating issues found during PDM Profile validation, such as missing canonical sections or a low number of defined causal patterns. ```log PDM Profile validation found 1 errors: No canonical sections defined PDM Profile validation warnings: Only 8 causal patterns defined ``` -------------------------------- ### Python Package Initialization (__init__.py) Analysis Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/audit_reports/audit_phase0_20260204_145304.md This snippet details the identification of empty __init__.py files within Python packages in the FARFAN-MCPPIPELINE project. These files are crucial for package initialization and can benefit from explicit imports and __all__ exports for better module management and convenience. ```json { "files": [ "src/farfan_pipeline/infrastructure/irrigation_using_signals/SISAS/_deprecated/__init__.py", "src/farfan_pipeline/infrastructure/irrigation_using_signals/SISAS/audit/__init__.py", "src/farfan_pipeline/infrastructure/irrigation_using_signals/SISAS/consumers/phase7/__init__.py", "src/farfan_pipeline/infrastructure/irrigation_using_signals/SISAS/integration/__init__.py", "src/farfan_pipeline/infrastructure/irrigation_using_signals/SISAS/irrigation/__init__.py", "src/farfan_pipeline/infrastructure/irrigation_using_signals/SISAS/metadata/__init__.py", "src/farfan_pipeline/infrastructure/irrigation_using_signals/SISAS/semantic/__init__.py", "src/farfan_pipeline/infrastructure/irrigation_using_signals/SISAS/signals/types/__init__.py", "src/farfan_pipeline/infrastructure/irrigation_using_signals/SISAS/utils/__init__.py", "src/farfan_pipeline/infrastructure/irrigation_using_signals/SISAS/vocabulary/__init__.py" ] } ``` -------------------------------- ### Run Phase 0 Audit in CI Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/PHASE0_AUDIT_EXECUTIVE_SUMMARY.md This snippet shows how to integrate the Phase 0 audit into a GitHub Actions workflow. It ensures that the audit is run automatically before commits or releases, using the `./quick_audit.sh` script with a `--ci` flag for continuous integration environments. ```yaml - name: Run Phase 0 Audit run: ./quick_audit.sh --ci ``` -------------------------------- ### Python Metaphor for Contract Assembly Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/CHAIN_COMPOSER_EPISTEMOLOGICAL_ANALYSIS.md Illustrates the difference between the current 'flattening' assembly process and the desired 'granular manifestation' process in Python. The 'BAD' example shows information loss, while the 'GOOD' example emphasizes preserving all class knowledge. ```python # Current (BAD) contract = FlattenedDict(chain) # Loses information # Desired (GOOD) contract = VerboseManifestor(chain) # Preserves all class knowledge ``` -------------------------------- ### Get or Create Global Schema Drift Detector in Python Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/audit_report_20260128_223912.html Detects code smells associated with getting or creating a global schema drift detector. This indicates potential issues with global state. Refactoring is recommended to improve code quality and maintainability. ```python """Get or create global schema drift detector.""" global _global_detector if _global_detector is None: ``` -------------------------------- ### Configuration Manager - Load Config Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/n4_methods.txt Loads configuration settings. ```APIDOC ## POST /configurationmanager.loadconfig ### Description Loads the application configuration. ### Method POST ### Endpoint /configurationmanager.loadconfig ### Parameters #### Request Body - **config_path** (string) - Optional - The path to the configuration file. ### Request Example ```json { "config_path": "/etc/app/config.yaml" } ``` ### Response #### Success Response (200) - **configuration** (object) - The loaded configuration settings. #### Response Example ```json { "configuration": { "setting1": "value1" } } ``` ``` -------------------------------- ### Ontology Field Injection: Method-Level Override Example (JSON) Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/CONTRACT_GENERATOR_V5_EPISTEMOLOGICAL_ALIGNMENT.md A JSON example demonstrating Regla O-1, showing a method assignment where the 'ontology' field is explicitly set to 'critical_realist', overriding the default ontology associated with the 'N2A-INF' level. ```json { "class_name": "SpecializedAnalyzer", "method_name": "custom_inference", "level": "N2A-INF", "ontology": "critical_realist", // Overrides default "bayesian_epistemic" } ``` -------------------------------- ### Python Contract Validation Violation Examples Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/EPISTEMOLOGICAL_VALIDATION_ENHANCEMENT.md Provides examples of violation messages generated during the epistemological validation process for PARTE I (Classification) and PARTE II (Method Binding). These messages indicate specific rule breaches related to ratios, operations, orchestration modes, and execution phases. ```python # PARTE I Violation Examples print("PARTE_I: N1 ratio 0.15 outside [0.20, 0.40] for TYPE_A (N1 methods: 1/7)") print("PARTE_I: Contract uses PROHIBITED operation 'bayesian_update' for TYPE_A") # PARTE II Violation Examples print("PARTE_II: orchestration_mode is 'simple_sequential', expected 'epistemological_pipeline'") print("PARTE_II: ontological_coherence_check not enabled") print("PARTE_II: Missing execution phase 'phase_B_computation'") print("PARTE_II: phase_B_computation missing sublayers (N2A_epistemic, N2B_causal)") ``` -------------------------------- ### List and Verify Files Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/PHASE1_INDEX.md This command lists files in a long format and checks for the existence of key project deliverables. It's a basic verification step to ensure all expected files are present in the project directory. ```bash ls -lh CANONICAL_classified_methods.json PHASE1_*.* CLASSIFIED_*.md TRINITY_*.md epistemological_trinity_classifier.py ``` -------------------------------- ### Dynamic Import Patterns Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/docs/IMPORT_SECURITY_ARCHITECTURE.md Demonstrates how to replace direct dynamic imports with safe wrappers provided by the pipeline. ```APIDOC ## Dynamic Import Patterns This section details how to replace common dynamic import patterns with the provided safe wrappers to enhance import security. ### Pattern 1: importlib.import_module **Before:** ```python import importlib module = importlib.import_module("farfan_pipeline.methods.some_method") ``` **After:** ```python from farfan_pipeline.phases.Phase_00.phase0_01_01_dynamic_import_registry import ( safe_import_module ) module = safe_import_module( "farfan_pipeline.methods.some_method", caller=__name__ ) ``` ### Pattern 2: spec_from_file_location **Before:** ```python import importlib.util spec = importlib.util.spec_from_file_location("config", config_path) module = importlib.util.module_from_spec(spec) spec.loader.exec_module(module) ``` **After:** ```python from farfan_pipeline.phases.Phase_00.phase0_01_01_dynamic_import_registry import ( safe_import_from_file ) module = safe_import_from_file( config_path, "config", caller=__name__ ) ``` ### Pattern 3: __import__() **Before:** ```python module = __import__("uuid") ``` **After:** ```python # Preferably use static import: import uuid # If dynamic import required: from farfan_pipeline.phases.Phase_00.phase0_01_01_dynamic_import_registry import ( safe_import_module ) module = safe_import_module("uuid", caller=__name__) ``` ``` -------------------------------- ### Get or Create Global Resolver Instance in Python Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/audit_report_20260128_225715.html This Python code snippet describes the process of getting or creating a global resolver instance. It's designed to ensure singleton behavior across the application, meaning only one instance of the resolver exists. This is useful for centralized management of resolution logic. ```python global _GLOBAL_RESOLVER if _GLOBAL_RESOLVER is None: ``` -------------------------------- ### Update Contract Assembler Traceability Metadata - Python Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/BEFORE_AFTER_EXAMPLES.md This Python code snippet shows the traceability metadata for input files within a Contract Assembler. The 'BEFORE' and 'AFTER' examples are identical, indicating that the file names ('CANONICAL_classified_methods.json', 'CANONICAL_question_executors.json', 'CANONICAL_question_typology.json') and their associated hash retrieval logic remain unchanged. ```python "input_files": { "classified_methods": { "file": "CANONICAL_classified_methods.json", "hash": self.registry.classified_methods_hash, }, "contratos_clasificados": { "file": "CANONICAL_question_executors.json", "hash": self.registry.contratos_clasificados_hash, }, "method_sets": { "file": "CANONICAL_question_typology.json", "hash": self.registry.method_sets_hash, }, } ``` -------------------------------- ### Create Method Lookup Dictionary (Python) Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/EPISTEMOLOGICAL_CLASSIFICATION_INDEX.md Loads method classifications from a JSON file and creates a dictionary for quick lookups of methods by their 'provides' identifier. This is useful for accessing specific method details efficiently. ```python import json with open('CANONICAL_classified_methods.json', 'r') as f: methods = json.load(f) method_lookup = { m['provides']: m for m in methods['methods'] } bayesian_update = method_lookup.get('bayesianmultilevelsystem.bayesianupdate') ``` -------------------------------- ### Extractor Initialization with Signal Emission (Python) Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/docs/EXTRACTOR_SIGNAL_ARCHITECTURE.md Shows how to initialize an extractor, specifically enabling signal emission for signal-driven architecture. It also demonstrates passing a custom calibration file path, though it defaults to loading from a standard location if `None`. ```python extractor = CausalVerbExtractor( calibration_file=None, # Auto-loads from default location enable_signal_emission=True # Enable signal mode ) ``` -------------------------------- ### Causal Structure Learner - Get Structure Summary Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/n4_methods.txt Retrieves a summary of the learned causal structure. ```APIDOC ## GET /causalstructurelearner.getstructuresummary ### Description Returns a summary of the current causal structure. ### Method GET ### Endpoint /causalstructurelearner.getstructuresummary ### Parameters #### Query Parameters - **structure_id** (string) - Optional - Identifier for a specific causal structure. ### Response #### Success Response (200) - **structure_summary** (object) - A summary detailing the causal structure. #### Response Example ```json { "structure_summary": { "nodes": 10, "edges": 15, "type": "DAG" } } ``` ``` -------------------------------- ### Run Farfan Pipeline CLI Command Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/docs/COMPONENT_CATALOG.md This command initiates the main pipeline execution. It requires an input PDF file and an output directory for results. Other subcommands manage configuration, calibration, validation, testing, and monitoring. ```bash # Main command farfan-pipeline run --input --output # Subcommands farfan-pipeline config # Configuration management farfan-pipeline calibration # Calibration operations farfan-pipeline validate # Validation tools farfan-pipeline test # Testing utilities farfan-pipeline monitor # Monitoring dashboard ``` -------------------------------- ### Missing Documentation Files in FARFAN-MCPPIPELINE Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/audit_reports/audit_phase0_20260204_145304.md Lists critical documentation files that are missing from the FARFAN-MCPPIPELINE project. This includes essential files like ARCHITECTURE.md, CONTRIBUTING.md, and specific phase/contract documentation. Recommendations are to create these files. ```json { "missing": [ "ARCHITECTURE.md", "CONTRIBUTING.md", "docs/PHASE_EXECUTION_ORDER.md", "docs/CONTRACT_SPECIFICATION.md" ] } ``` -------------------------------- ### set_sdo Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/docs/semantic_relationship_extractor_event_driven_guide.md Sets or updates the SignalDistributionOrchestrator instance for the extractor after its initialization. ```APIDOC ## set_sdo ### Description Allows setting or updating the SignalDistributionOrchestrator (SDO) instance associated with the SemanticRelationshipExtractor after the extractor has been constructed. This is useful if the SDO is initialized separately or needs to be changed dynamically. ### Method `set_sdo` ### Endpoint N/A (Method within the extractor class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **sdo** (SignalDistributionOrchestrator) - Required - The SignalDistributionOrchestrator instance to set for the extractor. ``` -------------------------------- ### Bash: Verification Commands for Python Project Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/VISUALIZATION_BUILDER_COMPLETION.md A set of bash commands to verify the Python project implementation. This includes running a syntax check, executing specific test suites for empty state and artifact loading, and verifying that mock methods have been removed from builder classes. ```bash # Run syntax check python3 -m py_compile src/farfan_pipeline/dashboard_atroz_/api_v1_visualizations.py # Run empty state tests python3 test_visualization_builders.py # Run artifact loading tests python3 test_artifact_loading.py # Verify implementation python3 -c " from farfan_pipeline.dashboard_atroz_.api_v1_visualizations import * assert not hasattr(PhylogramBuilder, '_build_mock_phylogram') assert not hasattr(MeshBuilder, '_build_mock_mesh') assert not hasattr(HelixBuilder, '_build_mock_helix') print('✓ Mock methods removed') " ``` -------------------------------- ### emit_relationship_signals Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/docs/semantic_relationship_extractor_event_driven_guide.md Manually emits MC10_SEMANTIC signals for extracted relationships with specified scope. ```APIDOC ## emit_relationship_signals ### Description Manually emits MC10_SEMANTIC signals for the relationships that have been extracted by the extractor. This method allows for custom scoping of the emitted signals. ### Method `emit_relationship_signals` ### Endpoint N/A (Method within the extractor class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **phase** (str) - Required - The phase for the signal scope. - **policy_area** (str) - Required - The policy area for the signal scope. - **slot** (str) - Required - The slot for the signal scope. ### Request Example ```python # Assuming 'extractor' is an instance of SemanticRelationshipExtractor count = extractor.emit_relationship_signals( phase="phase_02", policy_area="PA01", slot="D1-Q5" ) print(f"Dispatched {count} signals") ``` ### Response #### Success Response (200) - **count** (int) - The number of signals dispatched. ``` -------------------------------- ### Get Extractor Performance Source: https://github.com/cvbnm-h/farfan-mcppipeline/blob/main/src/farfan_pipeline/dashboard_atroz_/static/sisas-ecosystem-view-enhanced.html Fetches performance data for the extractors within the SISAS pipeline. ```APIDOC ## GET /api/v1/sisas/extractors/performance ### Description Retrieves performance metrics for the various extractors operating within the SISAS pipeline. This helps in monitoring the health and efficiency of data extraction processes. ### Method GET ### Endpoint /api/v1/sisas/extractors/performance ### Parameters #### Query Parameters None #### Path Parameters None ### Request Body None ### Response #### Success Response (200) - **extractors** (array) - An array of extractor objects, each detailing performance metrics like `id`, `status`, `processed_signals`, `error_rate`. #### Response Example ```json { "extractors": [ { "id": "MC01", "status": "Online", "processed_signals": 5000, "error_rate": 0.1 }, { "id": "MC02", "status": "Online", "processed_signals": 4800, "error_rate": 0.05 }, ... ] } ``` ```