Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2192 from teovin/volume-json-updates
Browse files Browse the repository at this point in the history
[ENG-595] Enhance volume metadata json files
  • Loading branch information
teovin authored Feb 5, 2024
2 parents 9521fce + c75988f commit a65d5c7
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 8 deletions.
3 changes: 3 additions & 0 deletions capstone/scripts/export_cap_static.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ def finalize_reporters_dir(dest_dir: Path) -> None:
# write reporter-level VolumesMetadata.json
print("Writing VolumesMetadata.json")
volumes_metadata = [json.loads(f.read_text()) for f in natsorted(reporter_dir.glob("*/VolumeMetadata.json"))]
for volume in volumes_metadata:
volume["reporter_slug"] = reporter_dir.name
write_json(reporter_dir / "VolumesMetadata.json", volumes_metadata)
all_volumes.extend(volumes_metadata)

Expand Down Expand Up @@ -267,6 +269,7 @@ def volume_to_dict(volume: VolumeMetadata) -> dict:
volume_data["spine_end_year"] = volume.spine_end_year
volume_data["publication_city"] = volume.publication_city
volume_data["second_part_of_id"] = volume.second_part_of_id
volume_data["redacted"] = volume.redacted

# add information about volume's nominative_reporter
if volume.nominative_reporter_id:
Expand Down
8 changes: 6 additions & 2 deletions capstone/test_data/cap_static/redacted/VolumesMetadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
"spine_end_year": null,
"publication_city": null,
"second_part_of_id": null,
"nominative_reporter": null
"redacted": true,
"nominative_reporter": null,
"reporter_slug": "us"
},
{
"volume_number": "2",
Expand Down Expand Up @@ -53,6 +55,8 @@
"spine_end_year": null,
"publication_city": null,
"second_part_of_id": null,
"nominative_reporter": null
"redacted": true,
"nominative_reporter": null,
"reporter_slug": "us"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@
"spine_end_year": null,
"publication_city": null,
"second_part_of_id": null,
"redacted": true,
"nominative_reporter": null
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@
"spine_end_year": null,
"publication_city": null,
"second_part_of_id": null,
"redacted": true,
"nominative_reporter": null
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
"spine_end_year": null,
"publication_city": null,
"second_part_of_id": null,
"nominative_reporter": null
"redacted": true,
"nominative_reporter": null,
"reporter_slug": "us"
},
{
"volume_number": "2",
Expand Down Expand Up @@ -53,6 +55,8 @@
"spine_end_year": null,
"publication_city": null,
"second_part_of_id": null,
"nominative_reporter": null
"redacted": true,
"nominative_reporter": null,
"reporter_slug": "us"
}
]
8 changes: 6 additions & 2 deletions capstone/test_data/cap_static/unredacted/VolumesMetadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
"spine_end_year": null,
"publication_city": null,
"second_part_of_id": null,
"nominative_reporter": null
"redacted": false,
"nominative_reporter": null,
"reporter_slug": "us"
},
{
"volume_number": "2",
Expand Down Expand Up @@ -53,6 +55,8 @@
"spine_end_year": null,
"publication_city": null,
"second_part_of_id": null,
"nominative_reporter": null
"redacted": false,
"nominative_reporter": null,
"reporter_slug": "us"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@
"spine_end_year": null,
"publication_city": null,
"second_part_of_id": null,
"redacted": false,
"nominative_reporter": null
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@
"spine_end_year": null,
"publication_city": null,
"second_part_of_id": null,
"redacted": false,
"nominative_reporter": null
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
"spine_end_year": null,
"publication_city": null,
"second_part_of_id": null,
"nominative_reporter": null
"redacted": false,
"nominative_reporter": null,
"reporter_slug": "us"
},
{
"volume_number": "2",
Expand Down Expand Up @@ -53,6 +55,8 @@
"spine_end_year": null,
"publication_city": null,
"second_part_of_id": null,
"nominative_reporter": null
"redacted": false,
"nominative_reporter": null,
"reporter_slug": "us"
}
]

0 comments on commit a65d5c7

Please sign in to comment.