pmc-node-utils
v0.3.1
Published
Node Utilities for PMC submissions including a CLI
Readme
PMC Utils Node Package
A Node.js package for building and validating PMC (PubMed Central) manuscript deposits. This package provides tools for creating properly formatted PMC submission packages, including manifest generation, XML validation, and archive creation.
Features
- Build PMC deposit packages from manifest files
- Generate PMC-compliant manifest text files
- Validate XML against PMC DTD specifications
- Create tar.gz archives for submission
- Support for multiple file types (manuscripts, figures, tables, supplements)
- Local file system integration
Prerequisites
- Node.js (v16 or higher)
xmllintcommand-line tool for XML validation- On macOS:
brew install libxml2 - On Ubuntu/Debian:
apt-get install libxml2-utils - On Windows: Install via Chocolatey or MSYS2
- On macOS:
Installation
npm install pmc-utilsUsage
Building a PMC Deposit
import { buildDeposit } from 'pmc-utils';
const manifest = {
taskId: 'example-task-123',
doi: '10.1234/example.doi',
agency: 'example-agency',
metadata: {
title: 'Example Manuscript',
authors: [
{
fname: 'John',
lname: 'Doe',
email: '[email protected]',
contactType: 'reviewer'
}
],
journal: {
issn: '1234-5678',
issnType: 'electronic',
title: 'Example Journal'
},
grants: [
{
funder: 'NIH',
id: 'R01-123456'
}
]
},
files: [
{
type: 'manuscript',
filename: 'manuscript.pdf',
path: './manuscripts',
storage: 'local'
},
{
type: 'figure',
label: 'fig1',
filename: 'figure1.png',
path: './figures',
storage: 'local'
}
]
};
const options = {
output: './deposits',
keepFiles: false,
log: console
};
try {
const tarFile = await buildDeposit(manifest, options);
console.log(`Deposit package created at: ${tarFile}`);
} catch (error) {
console.error('Error creating deposit:', error);
}Manifest File Format
The package generates a manifest file in the following format:
<file_type> <label> <file_name>File types supported:
bulksub_meta_xml: Required metadata filemanuscript: Manuscript text file(s)figure: Figure filetable: Table filesupplement: Supplementary material file
Development
Setup
- Clone the repository
- Install dependencies:
npm install
Building
npm run buildTesting
npm testAPI Reference
buildDeposit(manifest: AAMDepositManifest, opts: BuildDepositOptions)
Builds a complete PMC deposit package from a manifest object.
Options:
output: Directory for output files (default: 'deposits')keepFiles: Whether to keep temporary files (default: false)log: Logger instance (default: console)
preparePMCManifestText(manifest: AAMDepositManifest)
Generates the manifest text file content for a PMC deposit.
validateXml(xml: string)
Validates XML content against the PMC DTD specification.
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
