Shipbuilding Ledger Summarization and Report Generation: Database and Operations

Shipbuilding Ledger Summarization and Report Generation: Database and Operations

What this category of data looks like

Ledger data for shipbuilding comes from multiple sources. These include welding parameter collection at production stations, hull segment inspection records, material requisition documents, equipment operation logs, and quality inspection reports. The minimum update cycle is one shift. Multiple operation-level ledgers are generated each day, plus monthly summary reports. Each individual ledger document has structured fields. These fields include unique hull identifier, operation number, detection values (with units including MPa, mm, hours), operator ID, and timestamp. The ledger also includes unstructured materials such as inspection photos and process video clips. It also has summary calculation fields used for report generation, such as single-pass pass rate and cumulative man-hours.

What constraints do these characteristics impose on database and operations

The mixed semi-structured and structured nature of shipbuilding ledger data requires databases to support both transactional correlated queries and unstructured data storage. No single database type can fully meet these needs. Frequent station data reports and monthly summary tasks lead to large fluctuations in database connection counts. Connection pools and timeout recycling mechanisms must be configured in advance. Multi-field unit validation requirements — for example, pressure values must not exceed equipment rated ranges — require database-level field constraints to prevent dirty data writes. Ledger data and report generation have a strong correlation. Database migration or configuration changes must ensure consistency of associated tables. Otherwise, report generation will fail.

How to set configurations

Reference only; verify against the target FastGPT release and deployment documentation.

Config ItemRecommended SettingRationale
MONGODB_URImongodb://ship_ledger_user:secure_pass@db-host:27017/ship_ledger_db?authSource=adminStores unstructured semi-structured data such as inspection photos and process logs. A dedicated database and authentication source must be specified to ensure data isolation
PG_URLpostgresql://ship_struct_user:secure_pass@db-host:5432/ship_struct_db?sslmode=requireStores structured ledger fields and associated business data. Enable SSL to secure production data transmission, and support multi-table correlated summary queries
DB_MAX_LINK120–180Adapts to connection requirements for multi-station concurrent reports and monthly summary tasks, avoiding connection exhaustion in single-node deployments
REDIS_URLredis://redis-pass@redis-host:6379/1Caches daily ledger summary data for frequent queries to reduce database load, and stores task queues and session information

Three common mistakes

  • Phenomenon: MongoDB fails to start after migration. Deleting FastGPT mount files and reinstalling does not fix the issue. Cause: Residual indexes and data files in the corresponding shipbuilding ledger database in MongoDB were not cleaned up, or the authentication source specified in the MONGODB_URI configuration does not match the actual database.
  • Phenomenon: Service becomes unresponsive under 50 concurrent requests in a single-node deployment. Cause: The DB_MAX_LINK configuration value is lower than the concurrent requirement, and no connection pool timeout recycling mechanism is configured, causing database connections to be fully occupied and preventing new requests from being created.
  • Phenomenon: Empty fields or calculation errors occur during ledger queries. Cause: No field constraints were configured in the PostgreSQL database, allowing dirty data to be written, which affects the summary logic for report generation.

How to confirm the configuration is correct

  • Run mongo --eval "db.getSiblingDB('ship_ledger_db').getCollectionNames()" to connect to the address specified in MONGODB_URI, and verify that unstructured data collections can be accessed normally.
  • Run psql $PG_URL -c "SELECT AVG(welding_pressure) FROM ship_procedure_log WHERE date = CURRENT_DATE" to confirm that statistical data for structured ledgers can be queried normally.
  • Check Redis monitoring metrics to confirm that the connection count for the instance specified in REDIS_URL stays below 20, with no large number of timeout disconnection logs.
  • Initiate 50 concurrent ledger query requests, and observe the usage of the database connection pool to ensure that the configured value of DB_MAX_LINK is not fully occupied.

The values provided here are common starting points, and should be evaluated against the reader's own samples.

Question material comes from public community discussions. Configuration values are common starting points and should be measured against your own samples. Verified on 2026-09-28.