UNPKG

@codeplaydata/datasus

Version:

This application decompress the datasus micro data and serve as a gateway class.

45 lines (44 loc) 1.31 kB
import { JobMessage } from "./JobMessage.js"; /** * Worker-side processor that reads a DBC/DBF file and emits records. * * It loads criteria from the message, optionally filters records, and for each * record it either prints to stdout or appends to a file, updating a summary. */ export declare class JobProcessor { private summary; private dbc; private msg; /** * @param msg Job message containing file, output, criteria and data path. */ constructor(msg: JobMessage); /** * Processes one record according to the configured output mode. */ private handleRecord; /** * Appends the record as JSON to the data.json file in the given data path. */ private writeToFile; /** * Builds Criteria objects from the message structure. */ private loadCriteriaFromMsg; /** * Main workflow: open file, iterate records, filter/emit, finalize and cleanup. */ process(): Promise<void>; /** * Opens the DBC (converting to DBF if needed) and logs initial info. */ private initialize; /** * Writes a summary and performs final cleanup. */ private finalize; /** * Ensures temporary files are removed and the process exits with the right code. */ private cleanup; }