in ingestion/batch/configurationManager.js [166:195]
function parseDerivedFileAttributes(options) {
const basename = path.basename(options.fileName);
const pathParts = path.dirname(options.fileName).split("/").filter(Boolean);
const datasetId = pathParts[1];
const destinationTableId = pathParts[2];
const bucketPath = path.dirname(options.fileName);
const schemaFileBucketPath = path.join(bucketPath, "..", "config", `schema.json`);
const transformFileBucketPath = path.join(bucketPath, "..", "config", `transform.sql`);
const archivePath = path.join(bucketPath, "archive", `${basename}`);
const isDataFile = (pathParts.length === 4 && pathParts[0].toLowerCase() === cfg.pathPrefix && pathParts[3].toLowerCase() === "data");
const isConfigFile = (pathParts.length === 4 && pathParts[0].toLowerCase() === cfg.pathPrefix && pathParts[3].toLowerCase() === "config");
const isArchived = (pathParts.length === 5 && pathParts[0].toLowerCase() === cfg.pathPrefix && pathParts[3].toLowerCase() === "data" && pathParts[4].toLowerCase() === "archive");
let isDirectoryPath = false;
if (options.fileName.endsWith("/")) {
isDirectoryPath = true;
}
return {
datasetId: datasetId,
destinationTableId: destinationTableId,
schemaPath: schemaFileBucketPath,
transformPath: transformFileBucketPath,
archivePath: archivePath,
isDataFile: isDataFile,
isArchiveFile: isArchived,
isDirectoryPath: isDirectoryPath,
isConfigFile: isConfigFile
};
}