Skip to content

Add public archive export command#305

Open
level09 wants to merge 4 commits intomainfrom
feature/export-public
Open

Add public archive export command#305
level09 wants to merge 4 commits intomainfrom
feature/export-public

Conversation

@level09
Copy link
Copy Markdown
Collaborator

@level09 level09 commented Apr 5, 2026

Summary

  • New flask export public CLI command that exports labeled bulletins as denormalized JSON for the Bayanat Document Archive (BDA) portal
  • Serializes only public-facing fields, strips all workflow/internal metadata
  • Copies media files from local filesystem or S3 (auto-detected from config)
  • Eager-loads all relationships to avoid N+1 queries

Usage

flask export public --label "public-archive" --output ./export/
flask export public --label "public-archive" --output ./export/ --no-copy-media

Produces documents.json + media/ directory consumed by the bayanat-archive portal.

Fields exported

Bulletin: id, title, title_ar, description, source_link, publish_date, documentation_date

Relations (denormalized): labels, verified_labels, sources, locations, geo_locations, events, media (with OCR extraction text), related_bulletins, related_actors, related_incidents

Fields excluded

status, assigned_to, user_id, peer reviewers, comments, review, review_action, tags, originid, meta, tsv, sjac_title, sjac_title_ar, roles, reliability_score, dynamic_fields

Test plan

  • Tested with 323 bulletins on local filesystem (25 media files copied, 0 missing)
  • Tested with 10 bulletins on S3 storage (10 media files downloaded, 0 missing)
  • Verified zero internal fields leaked in output JSON
  • Verified all existing CLI commands still registered and functional
  • Error handling: nonexistent label exits with clear message

New CLI command exports labeled bulletins as denormalized JSON with
media files for the Bayanat Document Archive portal. Supports both
local filesystem and S3 storage.

Usage: flask export public --label "public-archive" --output ./export/
@level09 level09 requested a review from apodacaduron as a code owner April 5, 2026 14:30
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 5, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1f4cbb12-432e-4cfd-80aa-55676862044a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/export-public

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@level09 level09 self-assigned this Apr 5, 2026
Comment thread enferno/commands.py Fixed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant