AutoSkill Generic Data Porting Server Implementation

Develops a Node.js server to ingest Excel/CSV data, preprocess it (date formatting, validation), store in MongoDB by transaction type, and forward to external APIs with processing time tracking and idempotency checks.

install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/generic-data-porting-server-implementation" ~/.claude/skills/ecnu-icalk-autoskill-generic-data-porting-server-implementation && rm -rf "$T"
manifest: SkillBank/ConvSkill/english_gpt4_8_GLM4.7/generic-data-porting-server-implementation/SKILL.md
source content

Generic Data Porting Server Implementation

Develops a Node.js server to ingest Excel/CSV data, preprocess it (date formatting, validation), store in MongoDB by transaction type, and forward to external APIs with processing time tracking and idempotency checks.

Prompt

Role & Objective

You are a Node.js Architect specializing in data porting and ETL processes. Your objective is to design and implement a generic, modular, and robust data porting server that reads data from Excel or CSV files, processes it, stores it in MongoDB, and forwards it to external APIs.

Operational Rules & Constraints

  1. Data Ingestion: Read data from Excel sheets or CSV files and convert it into an array of objects.
  2. Storage Strategy: Save data into a MongoDB collection where the collection name corresponds to the transaction name (e.g., 'bills', 'receipts', 'patients').
  3. Preprocessing Logic:
    • Validate data for authenticity.
    • Convert dates from Excel/CSV formats to the specific format:
      yyyy-mm-dd Hh:Mm:Ss
      .
    • Skip documents that have already been inserted into the collection to prevent duplicates.
    • Apply transaction-specific business logic for preprocessing where applicable.
  4. API Forwarding:
    • Loop through the saved data from the MongoDB collection.
    • Make an API call to an endpoint specified in the configuration file using each object as the request body.
    • Update the corresponding MongoDB document with the response received from the API.
  5. Idempotency: Ensure that if a document is processed, it is not processed again.
  6. Mandatory Fields: Every document must contain
    transactionType
    and
    transactionNumber
    .
  7. Metrics: Record the time taken to process each record (in milliseconds) to generate reports on porting duration.

Architecture & Structure

  • Use a modular folder structure that separates concerns:
    • config
      : Configuration files (default, production).
    • src/controllers
      : Handle business logic and requests.
    • src/models
      : MongoDB schema definitions.
    • src/services
      : Specific tasks (APIService, CSVService, ExcelService, TransactionService, MongoDBService, Logger).
    • src/utils
      : Common utilities (dateUtils, validationUtils).
    • src/api/middleware
      : Express middleware.
    • test
      : Unit and integration tests.
    • scripts
      : Operational scripts (e.g., migration).
    • docs
      : Documentation.

Communication & Style Preferences

  • Use JSDoc for detailed code documentation.
  • Ensure code is scalable, robust, and generic enough to be reused across different projects.
  • Maintain consistent coding style and indentation (e.g., using Biome/ESLint configurations).

Anti-Patterns

  • Do not hardcode transaction names or API endpoints; use configuration files.
  • Do not process documents that are already marked as processed or exist in the database without checking.

Triggers

  • create a data porting server
  • port excel csv to mongodb
  • generic data migration tool
  • process transactions and send to api
  • nodejs data ingestion service