1.4.2 • Published 7 years ago

revman v1.4.2

Weekly downloads
14
License
MIT
Repository
github
Last release
7 years ago

Simple RevMan XML file reader

Simple module that reads a RevMan XML file and makes it suitable for use in Node.

The following operations are applied to the raw source data:

  • XML (buffer or string) translated into JSON object
  • All XML keys lower-cased and camelCased
  • Initial cochraneReview key removed and main body returned as object
  • Date fields automatically translated into Date objects
  • Various fields automatically translated into arrays
  • The participants field will automatically be calculated for each comparison each dichOutcome and each dichSubgroup
  • The p field is calculated and rounded using the pRounding precision. pText is also calculated (e.g. P < 0.001 etc.)
  • The effectMeasureText value is set to the long-hand version of the shorter effectMeasure value (e.g. effectMeasure=RR sets effectMeasureText=Rick Ratio)
  • The outcome collection is calculated for each comparison providing easier access to the outcomes and studies without having to look at specific types of study key
  • The outcomeType key is set for each outcome to label what type of outcome it is
var revman = require('revman');

revman.parseFile('./test/data/antibiotics-for-sore-throat.rm5', function(err, res, warnings) {
	// Data should now be a JSON tree object
});

See the antibiotics-for-sore-throat.json file for the JSON output for that sample file and as a rough guide as to the valid RevMan fields.

Outcome traversal

In order to simplify traversal of a RevMan file an additional meta object, outcome, is added to each comparison. The structure of this object is usually of the form: comparisons[].outcome[].subgroup[].study[].

However, since comparisons sometimes do not contain subgroups that portion of the path is optional.

The following trees are example structures using the outcome structure:

// The first study within an outcome that has subgroups
analysesAndData.comparison[0].outcome[0].subgroup[0].study[0]

// The first study within an outcome with no subgroups
analysesAndData.comparison[0].outcome[0].study[0]

API

parse(data, options, callback)

Parse raw data (data is assumed to be valid XML as a string, stream or buffer) and return the formatted output.

The callback will be called with the pattern (err, parsedResult, warnings). Warnings will be an array of any non-fatal errors encounted when parsing the files (empty subGroups, missing studies etc.)

Options can be any of the following:

OptionTypeDefaultDescription
pRoundingNumber6Decimal place precision when rounding P values
arrayFieldsArraySee codeAn array of fields that should be coerced into an array
booleanFieldsArray(Strings)See codeAn array of fields that should be translated into JavaScript booleans
dateFieldsArray(Strings)['modified']An array of fields that should be translated into JavaScript dates
numberFieldsArray(Strings)See codeAn array of fields that should be translated into JavaScript numbers
floatFieldsArray(Strings)See codeAn array of fields that should be translated into JavaScript floats
effectMeasureLookupObjectSee codeText value of shorthand effect measures (e.g. effectMeasure=RR sets effectMeasureText=Rick Ratio)
outcomeKeysArray(Objects)See codeKeys to use when creating the outcome structure. Set this to falsy to disable
removeEmptyOutcomesBooleantrueRemove any invalid looking outcomes with no studies or subgroup child nodes
debugOutcomesBooleanfalseBe extra careful reading the comparison structure and warn on any unknown *Outcome keys

parseFile(path, options, callback)

Convenience function to read a file from disk and return the formatted output.

See the parse() function for details on the available options.

Sample data credits

Thanks to Anneliese Spinks, Paul Glasziou, Chris Del Mar for the sample data set antibiotics-for-sore-throat which forms the supplied testing kit.

1.4.2

7 years ago

1.4.1

8 years ago

1.4.0

8 years ago

1.3.1

8 years ago

1.3.0

8 years ago

1.2.2

8 years ago

1.2.1

8 years ago

1.2.0

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago

0.0.1

8 years ago

0.0.0

8 years ago