The `ord-schema` package provides JavaScript and TypeScript wrappers for interacting with the Open Reaction Database (ORD) schema. The ORD project standardizes the representation of chemical reaction data, facilitating data exchange, analysis, and machine learning applications within the chemistry domain. This library offers client-side tools, primarily built on Protocol Buffers (protobuf), to create, manipulate, and validate reaction data according to the ORD specification. Currently at version 0.4.7, the package has a consistent release cadence, often addressing internal tooling, dependency updates (like Protobuf), and minor bug fixes. Its core differentiator lies in enabling structured, interoperable chemical reaction data handling.
npm install ord-schemaVerified import paths — ran on the pinned version, not inferred.
Demonstrates creating a new Reaction object, populating basic fields, performing client-side validation, and handling Protobuf serialization/deserialization.
Review your `package.json` for other `protobufjs` dependencies. If conflicts arise, consider upgrading other dependencies or using package manager overrides if possible. Thoroughly test your application after upgrading `ord-schema` to version `0.4.4` or later.
Always use the provided setters (`set*`, `add*`) to modify Protobuf message fields. For example, instead of `reaction.getMeasurements()[0].setOutcome('FAILURE')`, create a new `ReactionMeasurement` or ensure you're modifying a detached copy if complex manipulation is needed.Ensure `reaction` is an instance of `ord-schema.Reaction`. Instantiate it with `const reaction = new Reaction();` before calling any Protobuf-specific methods.
Consult the ORD schema documentation for the specific message type (e.g., `Reaction`) to identify all required fields and their expected data types. Ensure all mandatory fields are populated correctly before validation.
Most common symbols like `Reaction`, `validateReaction`, etc., are re-exported directly from the root `ord-schema` package. Use `import { Reaction } from 'ord-schema';` instead of `import { Reaction } from 'ord-schema/proto/ord_pb';`.