diff --git a/docs/benchmark/first_dasha_oracle_packet_assistant.json b/docs/benchmark/first_dasha_oracle_packet_assistant.json index dc53d19c..d045c9a5 100644 --- a/docs/benchmark/first_dasha_oracle_packet_assistant.json +++ b/docs/benchmark/first_dasha_oracle_packet_assistant.json @@ -14,6 +14,25 @@ "metadata.source_artifact", "target.vimshottari_start_date" ], + "missing_groups": { + "metadata": { + "count": 5, + "fields": [ + "metadata.tool_name", + "metadata.tool_version_or_url", + "metadata.capture_date", + "metadata.operator_note", + "metadata.source_artifact" + ] + }, + "target": { + "count": 1, + "fields": [ + "target.vimshottari_start_date" + ] + }, + "bodies": {} + }, "ready_to_apply": false, "external_sources": [ "JHora Vimshottari Dasha screen", diff --git a/docs/benchmark/first_dasha_oracle_packet_assistant.md b/docs/benchmark/first_dasha_oracle_packet_assistant.md index 223cbbfa..6270ec07 100644 --- a/docs/benchmark/first_dasha_oracle_packet_assistant.md +++ b/docs/benchmark/first_dasha_oracle_packet_assistant.md @@ -7,6 +7,11 @@ - operator_card: `docs/benchmark/dasha_steve_jobs_first_packet_operator_card.md` - packet_template: `references/oracle/evidence_packet_templates/dasha_steve_jobs_lahiri_first_packet_only.json` +## Missing Summary + +- metadata: `5` +- target: `1` + ## Missing Fields - `metadata.tool_name` diff --git a/docs/benchmark/first_shadbala_oracle_packet_assistant.json b/docs/benchmark/first_shadbala_oracle_packet_assistant.json index 075f85aa..08812008 100644 --- a/docs/benchmark/first_shadbala_oracle_packet_assistant.json +++ b/docs/benchmark/first_shadbala_oracle_packet_assistant.json @@ -63,6 +63,159 @@ "target.shadbala_components.Saturn.drik", "target.shadbala_components.Saturn.total_rupa" ], + "missing_groups": { + "metadata": { + "count": 5, + "fields": [ + "metadata.tool_name", + "metadata.tool_version_or_url", + "metadata.capture_date", + "metadata.operator_note", + "metadata.source_artifact" + ] + }, + "target": { + "count": 50, + "fields": [ + "target.moon_sidereal_longitude_deg", + "target.shadbala_components.Sun.sthana", + "target.shadbala_components.Sun.dig", + "target.shadbala_components.Sun.kala", + "target.shadbala_components.Sun.chesta", + "target.shadbala_components.Sun.naisargika", + "target.shadbala_components.Sun.drik", + "target.shadbala_components.Sun.total_rupa", + "target.shadbala_components.Moon.sthana", + "target.shadbala_components.Moon.dig", + "target.shadbala_components.Moon.kala", + "target.shadbala_components.Moon.chesta", + "target.shadbala_components.Moon.naisargika", + "target.shadbala_components.Moon.drik", + "target.shadbala_components.Moon.total_rupa", + "target.shadbala_components.Mars.sthana", + "target.shadbala_components.Mars.dig", + "target.shadbala_components.Mars.kala", + "target.shadbala_components.Mars.chesta", + "target.shadbala_components.Mars.naisargika", + "target.shadbala_components.Mars.drik", + "target.shadbala_components.Mars.total_rupa", + "target.shadbala_components.Mercury.sthana", + "target.shadbala_components.Mercury.dig", + "target.shadbala_components.Mercury.kala", + "target.shadbala_components.Mercury.chesta", + "target.shadbala_components.Mercury.naisargika", + "target.shadbala_components.Mercury.drik", + "target.shadbala_components.Mercury.total_rupa", + "target.shadbala_components.Jupiter.sthana", + "target.shadbala_components.Jupiter.dig", + "target.shadbala_components.Jupiter.kala", + "target.shadbala_components.Jupiter.chesta", + "target.shadbala_components.Jupiter.naisargika", + "target.shadbala_components.Jupiter.drik", + "target.shadbala_components.Jupiter.total_rupa", + "target.shadbala_components.Venus.sthana", + "target.shadbala_components.Venus.dig", + "target.shadbala_components.Venus.kala", + "target.shadbala_components.Venus.chesta", + "target.shadbala_components.Venus.naisargika", + "target.shadbala_components.Venus.drik", + "target.shadbala_components.Venus.total_rupa", + "target.shadbala_components.Saturn.sthana", + "target.shadbala_components.Saturn.dig", + "target.shadbala_components.Saturn.kala", + "target.shadbala_components.Saturn.chesta", + "target.shadbala_components.Saturn.naisargika", + "target.shadbala_components.Saturn.drik", + "target.shadbala_components.Saturn.total_rupa" + ] + }, + "bodies": { + "Jupiter": { + "count": 7, + "fields": [ + "target.shadbala_components.Jupiter.sthana", + "target.shadbala_components.Jupiter.dig", + "target.shadbala_components.Jupiter.kala", + "target.shadbala_components.Jupiter.chesta", + "target.shadbala_components.Jupiter.naisargika", + "target.shadbala_components.Jupiter.drik", + "target.shadbala_components.Jupiter.total_rupa" + ] + }, + "Mars": { + "count": 7, + "fields": [ + "target.shadbala_components.Mars.sthana", + "target.shadbala_components.Mars.dig", + "target.shadbala_components.Mars.kala", + "target.shadbala_components.Mars.chesta", + "target.shadbala_components.Mars.naisargika", + "target.shadbala_components.Mars.drik", + "target.shadbala_components.Mars.total_rupa" + ] + }, + "Mercury": { + "count": 7, + "fields": [ + "target.shadbala_components.Mercury.sthana", + "target.shadbala_components.Mercury.dig", + "target.shadbala_components.Mercury.kala", + "target.shadbala_components.Mercury.chesta", + "target.shadbala_components.Mercury.naisargika", + "target.shadbala_components.Mercury.drik", + "target.shadbala_components.Mercury.total_rupa" + ] + }, + "Moon": { + "count": 7, + "fields": [ + "target.shadbala_components.Moon.sthana", + "target.shadbala_components.Moon.dig", + "target.shadbala_components.Moon.kala", + "target.shadbala_components.Moon.chesta", + "target.shadbala_components.Moon.naisargika", + "target.shadbala_components.Moon.drik", + "target.shadbala_components.Moon.total_rupa" + ] + }, + "Saturn": { + "count": 7, + "fields": [ + "target.shadbala_components.Saturn.sthana", + "target.shadbala_components.Saturn.dig", + "target.shadbala_components.Saturn.kala", + "target.shadbala_components.Saturn.chesta", + "target.shadbala_components.Saturn.naisargika", + "target.shadbala_components.Saturn.drik", + "target.shadbala_components.Saturn.total_rupa" + ] + }, + "Sun": { + "count": 7, + "fields": [ + "target.shadbala_components.Sun.sthana", + "target.shadbala_components.Sun.dig", + "target.shadbala_components.Sun.kala", + "target.shadbala_components.Sun.chesta", + "target.shadbala_components.Sun.naisargika", + "target.shadbala_components.Sun.drik", + "target.shadbala_components.Sun.total_rupa" + ] + }, + "Venus": { + "count": 7, + "fields": [ + "target.shadbala_components.Venus.sthana", + "target.shadbala_components.Venus.dig", + "target.shadbala_components.Venus.kala", + "target.shadbala_components.Venus.chesta", + "target.shadbala_components.Venus.naisargika", + "target.shadbala_components.Venus.drik", + "target.shadbala_components.Venus.total_rupa" + ] + } + } + }, "ready_to_apply": false, "external_sources": [ "JHora Shadbala component table screenshot", diff --git a/docs/benchmark/first_shadbala_oracle_packet_assistant.md b/docs/benchmark/first_shadbala_oracle_packet_assistant.md index c3b67fab..9da9f8a7 100644 --- a/docs/benchmark/first_shadbala_oracle_packet_assistant.md +++ b/docs/benchmark/first_shadbala_oracle_packet_assistant.md @@ -7,6 +7,20 @@ - operator_card: `docs/benchmark/shadbala_redacted_place_raman_first_packet_operator_card.md` - packet_template: `references/oracle/evidence_packet_templates/shadbala_redacted_place_raman_first_packet.json` +## Missing Summary + +- metadata: `5` +- target: `50` +- bodies: + + - Jupiter: `7` + - Mars: `7` + - Mercury: `7` + - Moon: `7` + - Saturn: `7` + - Sun: `7` + - Venus: `7` + ## Missing Fields - `metadata.tool_name` diff --git a/docs/benchmark/first_tajika_oracle_packet_assistant.json b/docs/benchmark/first_tajika_oracle_packet_assistant.json index 7ae2074f..01da6e31 100644 --- a/docs/benchmark/first_tajika_oracle_packet_assistant.json +++ b/docs/benchmark/first_tajika_oracle_packet_assistant.json @@ -23,6 +23,34 @@ "target.tajika_yogas", "target.source_artifact" ], + "missing_groups": { + "metadata": { + "count": 5, + "fields": [ + "metadata.tool_name", + "metadata.tool_version_or_url", + "metadata.capture_date", + "metadata.operator_note", + "metadata.source_artifact" + ] + }, + "target": { + "count": 10, + "fields": [ + "target.solar_return_datetime", + "target.varsha_lagna_deg", + "target.muntha_sign", + "target.year_lord", + "target.mudda_dasha_first_lord", + "target.sahams.punya_saham", + "target.sahams.rajya_saham", + "target.sahams.vivah_saham", + "target.tajika_yogas", + "target.source_artifact" + ] + }, + "bodies": {} + }, "ready_to_apply": false, "external_sources": [ "JHora Varshaphala/Tajika annual chart screen", diff --git a/docs/benchmark/first_tajika_oracle_packet_assistant.md b/docs/benchmark/first_tajika_oracle_packet_assistant.md index 94aac965..93372064 100644 --- a/docs/benchmark/first_tajika_oracle_packet_assistant.md +++ b/docs/benchmark/first_tajika_oracle_packet_assistant.md @@ -7,6 +7,11 @@ - operator_card: `docs/benchmark/tajika_steve_jobs_1984_first_packet_operator_card.md` - packet_template: `references/oracle/evidence_packet_templates/tajika_steve_jobs_1984_first_packet.json` +## Missing Summary + +- metadata: `5` +- target: `10` + ## Missing Fields - `metadata.tool_name` diff --git a/scripts/first_oracle_packet_assistant.py b/scripts/first_oracle_packet_assistant.py index 08d572bc..35bb4931 100644 --- a/scripts/first_oracle_packet_assistant.py +++ b/scripts/first_oracle_packet_assistant.py @@ -69,6 +69,39 @@ FRONTS = { } +def _group_missing_fields(missing_fields: list[str]) -> dict[str, Any]: + metadata_fields = [field for field in missing_fields if field.startswith("metadata.")] + target_fields = [field for field in missing_fields if field.startswith("target.")] + body_groups: dict[str, list[str]] = {} + prefix = "target.shadbala_components." + for field in target_fields: + if not field.startswith(prefix): + continue + remainder = field[len(prefix):] + body, _, component = remainder.partition(".") + if not body or not component: + continue + body_groups.setdefault(body, []).append(field) + grouped_bodies = { + body: { + "count": len(fields), + "fields": fields, + } + for body, fields in sorted(body_groups.items()) + } + return { + "metadata": { + "count": len(metadata_fields), + "fields": metadata_fields, + }, + "target": { + "count": len(target_fields), + "fields": target_fields, + }, + "bodies": grouped_bodies, + } + + def _run_json(command: list[str]) -> dict[str, Any]: completed = subprocess.run( command, @@ -114,6 +147,7 @@ def build_report(front: str) -> dict[str, Any]: status = _run_json(config["status_command"]) first = status["first_priority"] packet_missing = _packet_missing(config["packet_template"]) + missing_groups = _group_missing_fields(packet_missing) return { "scope": "first_external_oracle_packet_assistant", "schema_version": 1, @@ -123,6 +157,7 @@ def build_report(front: str) -> dict[str, Any]: "operator_card": config["operator_card"], "packet_template": config["packet_template"], "missing_fields": packet_missing, + "missing_groups": missing_groups, "ready_to_apply": not packet_missing, "external_sources": config["external_sources"], "apply_command": first["apply_command"].replace(first["packet_path"], config["packet_template"]), @@ -145,9 +180,24 @@ def render_markdown(report: dict[str, Any]) -> str: f"- operator_card: `{report['operator_card']}`", f"- packet_template: `{report['packet_template']}`", "", + "## Missing Summary", + "", + f"- metadata: `{report['missing_groups']['metadata']['count']}`", + f"- target: `{report['missing_groups']['target']['count']}`", + ] + if report["missing_groups"]["bodies"]: + lines.extend(["- bodies:", ""]) + lines.extend( + f" - {body}: `{payload['count']}`" + for body, payload in report["missing_groups"]["bodies"].items() + ) + lines.extend( + [ + "", "## Missing Fields", "", - ] + ] + ) lines.extend(f"- `{field}`" for field in report["missing_fields"]) lines.extend( [ diff --git a/tests/test_first_oracle_packet_assistant.py b/tests/test_first_oracle_packet_assistant.py index 39b7d698..298abd0d 100644 --- a/tests/test_first_oracle_packet_assistant.py +++ b/tests/test_first_oracle_packet_assistant.py @@ -47,6 +47,9 @@ def test_first_oracle_packet_assistant_reports_dasha_next_fields() -> None: "metadata.source_artifact", "target.vimshottari_start_date", ] + assert report["missing_groups"]["metadata"]["count"] == 5 + assert report["missing_groups"]["target"]["count"] == 1 + assert report["missing_groups"]["target"]["fields"] == ["target.vimshottari_start_date"] assert report["ready_to_apply"] is False assert "JHora" in " ".join(report["external_sources"]) @@ -87,6 +90,8 @@ def test_first_oracle_packet_assistant_reports_tajika_front() -> None: assert report["case_id"] == "template_steve_jobs_varshaphala_1984_lahiri" assert report["operator_card"].endswith("tajika_steve_jobs_1984_first_packet_operator_card.md") assert report["packet_template"].endswith("tajika_steve_jobs_1984_first_packet.json") + assert report["missing_groups"]["metadata"]["count"] == 5 + assert report["missing_groups"]["target"]["count"] == 10 assert "target.solar_return_datetime" in report["missing_fields"] assert "target.sahams.punya_saham" in report["missing_fields"] @@ -114,5 +119,35 @@ def test_first_oracle_packet_assistant_reports_shadbala_front() -> None: assert report["case_id"] == "template_redacted_place_shadbala_raman" assert report["operator_card"].endswith("shadbala_redacted_place_raman_first_packet_operator_card.md") assert report["packet_template"].endswith("shadbala_redacted_place_raman_first_packet.json") + assert report["missing_groups"]["metadata"]["count"] == 5 + assert report["missing_groups"]["target"]["count"] == 50 + assert report["missing_groups"]["bodies"]["Sun"]["count"] == 7 + assert report["missing_groups"]["bodies"]["Moon"]["count"] == 7 + assert report["missing_groups"]["bodies"]["Saturn"]["count"] == 7 assert "target.moon_sidereal_longitude_deg" in report["missing_fields"] assert "target.shadbala_components.Sun.sthana" in report["missing_fields"] + + +def test_first_oracle_packet_assistant_markdown_includes_group_summary() -> None: + completed = subprocess.run( + [ + sys.executable, + "scripts/first_oracle_packet_assistant.py", + "--front", + "shadbala", + "--format", + "markdown", + ], + cwd=ROOT, + text=True, + capture_output=True, + timeout=60, + check=False, + ) + + assert completed.returncode == 0, completed.stderr or completed.stdout + markdown = completed.stdout + assert "## Missing Summary" in markdown + assert "- metadata: `5`" in markdown + assert "- target: `50`" in markdown + assert "- Sun: `7`" in markdown