- Added `check_invoice_number_exists` method in `EconomicService` to verify invoice numbers in e-conomic journals. - Introduced `quick_analysis_on_upload` method in `OllamaService` for extracting critical fields from uploaded PDFs, including CVR, document type, and document number. - Created migration script to add new fields for storing detected CVR, vendor ID, document type, and document number in the `incoming_files` table. - Developed comprehensive tests for the quick analysis functionality, validating CVR detection, document type identification, and invoice number extraction.
19 lines
1.0 KiB
SQL
19 lines
1.0 KiB
SQL
-- Migration 011: Add context fields to extraction_lines
|
|
-- These fields capture additional context information from invoice line items
|
|
|
|
ALTER TABLE extraction_lines
|
|
ADD COLUMN IF NOT EXISTS ip_address VARCHAR(50),
|
|
ADD COLUMN IF NOT EXISTS contract_number VARCHAR(100),
|
|
ADD COLUMN IF NOT EXISTS location_street VARCHAR(255),
|
|
ADD COLUMN IF NOT EXISTS location_zip VARCHAR(10),
|
|
ADD COLUMN IF NOT EXISTS location_city VARCHAR(100);
|
|
|
|
-- Add index for contract number lookups
|
|
CREATE INDEX IF NOT EXISTS idx_extraction_lines_contract_number ON extraction_lines(contract_number);
|
|
|
|
COMMENT ON COLUMN extraction_lines.ip_address IS 'IP address/subnet from line context (e.g., 152.115.56.192/27)';
|
|
COMMENT ON COLUMN extraction_lines.contract_number IS 'Contract number from line context (e.g., NKA-008225)';
|
|
COMMENT ON COLUMN extraction_lines.location_street IS 'Street address from line context';
|
|
COMMENT ON COLUMN extraction_lines.location_zip IS 'Zip code from line context';
|
|
COMMENT ON COLUMN extraction_lines.location_city IS 'City from line context';
|