type
entity
created
Tue Apr 07 2026 02:00:00 GMT+0200 (Central European Summer Time)
updated
Tue Apr 07 2026 02:00:00 GMT+0200 (Central European Summer Time)
sources
raw/articles/CHANGELOG, raw/articles/DISCOVERIES, raw/notes/activeContext
tags
entity data-migration legacy morichal import

MorichalAI

abstract
MorichalAI is the legacy data source from which 1,714 records were imported into the Paper Surplus Marketplace -- 111 mills, 162 buyers, 486 products, 170 buyer specs, 12 freight rates, and 773 transactions -- providing the initial seed dataset for the platform.

Overview

MorichalAI is Rafael's (co-founder) previous system for managing paper trading data. It contained years of accumulated business relationships, product specifications, buyer preferences, and transaction history. This data was migrated to bootstrap the marketplace with real-world records rather than synthetic test data.

Migration Architecture

Source

Import Service

Located at backend/common/services/morichal_import/ with 11 modules handling different entity types and their relationships. The import is orchestrated by a management command.

Management Command

python manage.py import_morichal [options]
Flag Purpose
--dry-run Preview import without writing to database
--phases Selective import (e.g., --phases mills,buyers)
--clear-existing Delete existing imported records before re-importing
--report-file Save import report to a file

Import Results

Entity Count Notes
Mills 111 Company details, capabilities, regions
Buyers 162 Company type, country, preferences
Products 486 Full specifications (paper type, GSM, width, etc.)
Buyer Specs 170 Paper type ranges, GSM ranges, width ranges
Freight Rates 12 Common trade routes with LCL/FCL pricing
Transactions 773 Historical deal records
Total 1,714

Data Quality and Provenance

Idempotency

The import uses get_or_create patterns throughout, making it safe to re-run. Running the command a second time creates zero new records -- all existing records are matched and skipped.

Test Coverage

119 tests cover the migration:

Significance

The MorichalAI migration is important because:

  1. Real data: The marketplace launched with actual business relationships, not fake data
  2. Validation: The 773 historical transactions validate that the data model supports real-world paper trading scenarios
  3. Bootstrap: The derive_specs and derive_products commands use transaction history to auto-generate BuyerSpecs and Products, bootstrapping the matching algorithm
  4. Credibility: When Thierry demos the platform to mills, the buyer list is real and recognizable

Sources

Related