File tree Expand file tree Collapse file tree 3 files changed +57
-0
lines changed
Expand file tree Collapse file tree 3 files changed +57
-0
lines changed Original file line number Diff line number Diff line change 1+ # a) 0th: edit title & backdate last-modified-date (→ to be updated)
2+ (.records [0 ].title.title.value ) |= "Title to be updated"
3+ | (.records [0 ]. "last-modified-date" .value ) -= 86400000
4+ # b) 1st) duplicate and change title & put-code (→ to be deleted)
5+ | .records += [.records [1 ]]
6+ | (.records [1 ]. "put-code" ) |= 999999
7+ | (.records [1 ].title.title.value ) |= "Title to be deleted"
8+ # c) 2nd: remove (→ to be added)
9+ | del (.records [2 ])
Original file line number Diff line number Diff line change 1+ # !/usr/bin/env pwsh
2+
3+ # 0) set your ORCID ID or sample ID
4+ $ORCID_ID = " 0000-0002-1825-0097"
5+
6+ # 1) initial fetch
7+ cargo run - p orcid- works- cli -- - i " $ORCID_ID " - o output.json
8+
9+ # 2) mangle the JSON (requires at least 3 records)
10+ jq -f filter.jq output.json > output- modified.json
11+ Copy-Item output- modified.json - Destination output- modified- 1. json
12+ Copy-Item output- modified.json - Destination output- modified- 2. json
13+
14+ # 3) refetch (diff-aware)
15+ cargo run - p orcid- works- cli -- - i " $ORCID_ID " - o output- modified- 1. json
16+ # => only missing/changed records are fetched
17+
18+ # 3') force-fetch (bypass diff)
19+ cargo run - p orcid- works- cli -- - i " $ORCID_ID " - o output- modified- 2. json -- force- fetch
20+ # => all records are fetched
21+
22+ # 4) compare results (expected: identical)
23+ Compare-Object output.json output- modified- 1. json
24+ Compare-Object output.json output- modified- 2. json
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ # 0) set your ORCID ID or sample ID
4+ ORCID_ID=" 0000-0002-1825-0097"
5+
6+ # 1) initial fetch
7+ cargo run -p orcid-works-cli -- -i " $ORCID_ID " -o output.json
8+
9+ # 2) mangle the JSON (requires at least 3 records)
10+ jq -f filter.jq output.json > output-modified.json
11+ cp output-modified.json output-modified-1.json
12+ cp output-modified.json output-modified-2.json
13+
14+ # 3) refetch (diff-aware)
15+ cargo run -p orcid-works-cli -- -i " $ORCID_ID " -o output-modified-1.json
16+ # => only missing/changed records are fetched
17+
18+ # 3') force-fetch (bypass diff)
19+ cargo run -p orcid-works-cli -- -i " $ORCID_ID " -o output-modified-2.json --force-fetch
20+ # => all records are fetched
21+
22+ # 4) compare results (expected: identical)
23+ diff -q output.json output-modified-1.json
24+ diff -q output.json output-modified-2.json
You can’t perform that action at this time.
0 commit comments