Mirror 01979ec from github.com/open-reaction-database/ord-data
Browse files
README.md
CHANGED
|
@@ -293,13 +293,13 @@ the data into human readable text format, *.pb.txt.
|
|
| 293 |
|
| 294 |
```python
|
| 295 |
# import requirements
|
| 296 |
-
from ord_schema.message_helpers import load_message,
|
| 297 |
from ord_schema.proto import dataset_pb2
|
| 298 |
|
| 299 |
# load the binary ord file
|
| 300 |
dataset = load_message("input_fname.pb.gz", dataset_pb2.Dataset)
|
| 301 |
# save the ord file as human readable text
|
| 302 |
-
|
| 303 |
```
|
| 304 |
|
| 305 |
We can also convert ORD data into JSON format.
|
|
@@ -308,7 +308,7 @@ We can also convert ORD data into JSON format.
|
|
| 308 |
# import requirements
|
| 309 |
import json
|
| 310 |
|
| 311 |
-
from ord_schema.message_helpers import load_message
|
| 312 |
from ord_schema.proto import dataset_pb2
|
| 313 |
from google.protobuf.json_format import MessageToJson
|
| 314 |
|
|
@@ -396,8 +396,9 @@ Please see the [Submission Workflow](https://docs.open-reaction-database.org/en/
|
|
| 396 |
|
| 397 |
### Skipping the `Update submission` step
|
| 398 |
|
| 399 |
-
The submission workflow's `Update submission` step runs
|
| 400 |
-
--update --cleanup`
|
|
|
|
| 401 |
submitted files and rewrite them to the canonical on-disk format. For
|
| 402 |
maintainer PRs that touch dataset files but should *not* be re-processed
|
| 403 |
this way — e.g., format conversions or mass migrations of already-finalized
|
|
@@ -415,17 +416,15 @@ outputs, converts everything else 1:1 (carrying the existing `dataset_id`), and
|
|
| 415 |
skips any output that already exists — so it is safe to re-run and writes only
|
| 416 |
what is missing.
|
| 417 |
|
| 418 |
-
It needs `ord_schema`
|
| 419 |
-
|
| 420 |
-
inputs first:
|
| 421 |
|
| 422 |
```bash
|
| 423 |
-
uv
|
| 424 |
-
pip install "ord-schema==0.6.3" # match ORD_SCHEMA_TAG
|
| 425 |
|
| 426 |
git lfs pull --include="data/**/*.pb.gz" # the converter reads pb.gz content
|
| 427 |
-
python scripts/convert_to_parquet.py --dry-run # preview
|
| 428 |
-
python scripts/convert_to_parquet.py # write the
|
| 429 |
```
|
| 430 |
|
| 431 |
Commit the new `.parquet` files (they become LFS objects), push them (see
|
|
|
|
| 293 |
|
| 294 |
```python
|
| 295 |
# import requirements
|
| 296 |
+
from ord_schema.message_helpers import load_message, save_message
|
| 297 |
from ord_schema.proto import dataset_pb2
|
| 298 |
|
| 299 |
# load the binary ord file
|
| 300 |
dataset = load_message("input_fname.pb.gz", dataset_pb2.Dataset)
|
| 301 |
# save the ord file as human readable text
|
| 302 |
+
save_message(dataset, "output_fname.pbtxt")
|
| 303 |
```
|
| 304 |
|
| 305 |
We can also convert ORD data into JSON format.
|
|
|
|
| 308 |
# import requirements
|
| 309 |
import json
|
| 310 |
|
| 311 |
+
from ord_schema.message_helpers import load_message
|
| 312 |
from ord_schema.proto import dataset_pb2
|
| 313 |
from google.protobuf.json_format import MessageToJson
|
| 314 |
|
|
|
|
| 396 |
|
| 397 |
### Skipping the `Update submission` step
|
| 398 |
|
| 399 |
+
The submission workflow's `Update submission` step runs
|
| 400 |
+
[`scripts/process_dataset.py`](scripts/process_dataset.py) `--update --cleanup`
|
| 401 |
+
to assign reaction/dataset IDs and timestamps to newly
|
| 402 |
submitted files and rewrite them to the canonical on-disk format. For
|
| 403 |
maintainer PRs that touch dataset files but should *not* be re-processed
|
| 404 |
this way — e.g., format conversions or mass migrations of already-finalized
|
|
|
|
| 416 |
skips any output that already exists — so it is safe to re-run and writes only
|
| 417 |
what is missing.
|
| 418 |
|
| 419 |
+
It needs `ord_schema`, which comes from the `pipeline` dependency group. Because
|
| 420 |
+
it reads every `.pb.gz` to classify by name, pull the inputs first:
|
|
|
|
| 421 |
|
| 422 |
```bash
|
| 423 |
+
uv sync --only-group pipeline
|
|
|
|
| 424 |
|
| 425 |
git lfs pull --include="data/**/*.pb.gz" # the converter reads pb.gz content
|
| 426 |
+
uv run --no-sync python scripts/convert_to_parquet.py --dry-run # preview
|
| 427 |
+
uv run --no-sync python scripts/convert_to_parquet.py # write the siblings
|
| 428 |
```
|
| 429 |
|
| 430 |
Commit the new `.parquet` files (they become LFS objects), push them (see
|