Files
peptide-repo-core/includes/migrations/class-pr-core-migration-0003-candidate-queue.php
peptiderepo 8d3064785c fix: resolve all PHPCS violations and 300-line rule breaches
- Add @package Peptide_Repo_Core file docblocks to all PHP files
- Add @var docblocks to all public readonly DTO properties
- Add @param docs to sanitize_evidence_strength / sanitize_review_status
- Replace short ternary ?: with phpcs:ignore on each violating line
- Add phpcs:ignore for InterpolatedNotPrepared on ${table} SQL strings
- Add phpcs:ignore for GlobalVariablesOverride in uninstall.php and card.php
- Add translators comment to __ call with placeholder in related-posts-section
- Fix InlineComment.InvalidEndChar: add periods to all bare inline comments
- Expand single-line /** @return void */ docblocks with summaries
- SPLIT class-pr-core-seed-data.php (was 360 lines):
  → class-pr-core-seed-data.php (149 lines, orchestration only)
  → class-pr-core-seed-fixtures.php (254 lines, static fixture data)
- SPLIT class-pr-core-peptide-cpt.php (was 309 lines):
  → class-pr-core-peptide-cpt.php (224 lines, CPT + hooks + sanitizers)
  → class-pr-core-peptide-meta-schema.php (133 lines, meta field defs)
- SPLIT class-pr-core-settings.php (was 340 lines after docblock expansion):
  → class-pr-core-settings.php (264 lines, registration + sanitization)
  → class-pr-core-settings-renderer.php (124 lines, render methods)
- All includes/ PHP files now <= 300 lines

Agent-Session: claude-adopt-ci-20260616
2026-06-16 15:48:53 +00:00

78 lines
2.4 KiB
PHP

<?php
declare(strict_types=1);
/**
* Migration 0003: Create the pr_ai_candidate_queue table.
*
* What: Creates the AI-extracted dosing candidate queue table.
* Who calls it: PR_Core_Migration_Runner::run_pending().
* Dependencies: WordPress $wpdb, dbDelta().
*
* Approved rows are copied into pr_dosing_rows with source='ai-candidate-approved'
* and ai_candidate_id set; queue row marked 'merged'.
*
* @see ARCHITECTURE.md — AI-assist candidate-extraction pipeline.
* @package Peptide_Repo_Core
*/
class PR_Core_Migration_0003_Candidate_Queue {
/**
* Valid queue status enum values.
*
* @var string[] Valid queue status enum values.
*/
public const STATUSES = array(
'pending',
'approved',
'rejected',
'merged',
);
/**
* Create the pr_ai_candidate_queue table.
*
* Side effects: database DDL via dbDelta().
*
* @return void
*/
public function up(): void {
global $wpdb;
$table = $wpdb->prefix . 'pr_ai_candidate_queue';
$charset = $wpdb->get_charset_collate();
$sql = "CREATE TABLE {$table} (
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
peptide_id BIGINT UNSIGNED NOT NULL,
dose_min DECIMAL(12,4) NULL,
dose_max DECIMAL(12,4) NULL,
dose_unit VARCHAR(16) NOT NULL,
route VARCHAR(32) NOT NULL,
frequency VARCHAR(64) NULL,
duration_value INT UNSIGNED NULL,
duration_unit VARCHAR(16) NULL,
population VARCHAR(32) NOT NULL,
indication VARCHAR(255) NULL,
evidence_strength VARCHAR(32) NOT NULL,
study_title VARCHAR(500) NULL,
study_year SMALLINT UNSIGNED NULL,
citation_pubmed_id VARCHAR(16) NULL,
citation_doi VARCHAR(128) NULL,
citation_url VARCHAR(500) NULL,
notes TEXT NULL,
extraction_confidence FLOAT NOT NULL DEFAULT 0,
queue_status VARCHAR(16) NOT NULL DEFAULT 'pending',
extracted_at DATETIME NOT NULL,
reviewed_by BIGINT UNSIGNED NULL,
reviewed_at DATETIME NULL,
reviewer_notes TEXT NULL,
PRIMARY KEY (id),
KEY idx_peptide (peptide_id),
KEY idx_status (queue_status),
KEY idx_confidence (extraction_confidence),
KEY idx_peptide_status (peptide_id, queue_status)
) {$charset};";
dbDelta( $sql );
}
}