feat(oracle): enrich first packet fill plans
This commit is contained in:
@@ -33,6 +33,31 @@
|
||||
},
|
||||
"bodies": {}
|
||||
},
|
||||
"prefilled_fields": {
|
||||
"status": "draft",
|
||||
"promotion_status_after_fill": "external_verified",
|
||||
"metadata": {
|
||||
"ayanamsa": "Lahiri",
|
||||
"node_mode": "true node",
|
||||
"timezone": "UTC-08:00"
|
||||
},
|
||||
"settings": {
|
||||
"ayanamsa": "lahiri",
|
||||
"node_mode": "true"
|
||||
}
|
||||
},
|
||||
"manual_fill_plan": {
|
||||
"status_value": "external_verified",
|
||||
"manual_entry_count": 6,
|
||||
"remaining_manual_fields": [
|
||||
"metadata.tool_name",
|
||||
"metadata.tool_version_or_url",
|
||||
"metadata.capture_date",
|
||||
"metadata.operator_note",
|
||||
"metadata.source_artifact",
|
||||
"target.vimshottari_start_date"
|
||||
]
|
||||
},
|
||||
"ready_to_apply": false,
|
||||
"external_sources": [
|
||||
"JHora Vimshottari Dasha screen",
|
||||
|
||||
@@ -12,6 +12,28 @@
|
||||
- metadata: `5`
|
||||
- target: `1`
|
||||
|
||||
## Prefilled Fields
|
||||
|
||||
- status: `draft`
|
||||
- promotion_status_after_fill: `external_verified`
|
||||
|
||||
- metadata:
|
||||
|
||||
- ayanamsa: `Lahiri`
|
||||
- node_mode: `true node`
|
||||
- timezone: `UTC-08:00`
|
||||
|
||||
- settings:
|
||||
|
||||
- ayanamsa: `lahiri`
|
||||
- node_mode: `true`
|
||||
|
||||
|
||||
## Manual Fill Plan
|
||||
|
||||
- status_value: `external_verified`
|
||||
- manual_entry_count: `6`
|
||||
|
||||
## Missing Fields
|
||||
|
||||
- `metadata.tool_name`
|
||||
|
||||
@@ -216,6 +216,80 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"prefilled_fields": {
|
||||
"status": "draft",
|
||||
"promotion_status_after_fill": "external_verified",
|
||||
"metadata": {
|
||||
"ayanamsa": "Raman",
|
||||
"node_mode": "mean node",
|
||||
"timezone": "UTC+08:00"
|
||||
},
|
||||
"settings": {
|
||||
"ayanamsa": "raman",
|
||||
"node_mode": "mean"
|
||||
}
|
||||
},
|
||||
"manual_fill_plan": {
|
||||
"status_value": "external_verified",
|
||||
"manual_entry_count": 55,
|
||||
"remaining_manual_fields": [
|
||||
"metadata.tool_name",
|
||||
"metadata.tool_version_or_url",
|
||||
"metadata.capture_date",
|
||||
"metadata.operator_note",
|
||||
"metadata.source_artifact",
|
||||
"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"
|
||||
]
|
||||
},
|
||||
"ready_to_apply": false,
|
||||
"external_sources": [
|
||||
"JHora Shadbala component table screenshot",
|
||||
|
||||
@@ -21,6 +21,28 @@
|
||||
- Sun: `7`
|
||||
- Venus: `7`
|
||||
|
||||
## Prefilled Fields
|
||||
|
||||
- status: `draft`
|
||||
- promotion_status_after_fill: `external_verified`
|
||||
|
||||
- metadata:
|
||||
|
||||
- ayanamsa: `Raman`
|
||||
- node_mode: `mean node`
|
||||
- timezone: `UTC+08:00`
|
||||
|
||||
- settings:
|
||||
|
||||
- ayanamsa: `raman`
|
||||
- node_mode: `mean`
|
||||
|
||||
|
||||
## Manual Fill Plan
|
||||
|
||||
- status_value: `external_verified`
|
||||
- manual_entry_count: `55`
|
||||
|
||||
## Missing Fields
|
||||
|
||||
- `metadata.tool_name`
|
||||
|
||||
@@ -51,6 +51,44 @@
|
||||
},
|
||||
"bodies": {}
|
||||
},
|
||||
"prefilled_fields": {
|
||||
"status": "draft",
|
||||
"promotion_status_after_fill": "external_verified",
|
||||
"metadata": {
|
||||
"ayanamsa": "Lahiri",
|
||||
"node_mode": "true node",
|
||||
"timezone": "UTC-08:00",
|
||||
"annual_system": "Varshaphala/Tajika",
|
||||
"target_year": 1984
|
||||
},
|
||||
"settings": {
|
||||
"ayanamsa": "lahiri",
|
||||
"node_mode": "true",
|
||||
"annual_system": "varshaphala",
|
||||
"target_year": 1984
|
||||
}
|
||||
},
|
||||
"manual_fill_plan": {
|
||||
"status_value": "external_verified",
|
||||
"manual_entry_count": 15,
|
||||
"remaining_manual_fields": [
|
||||
"metadata.tool_name",
|
||||
"metadata.tool_version_or_url",
|
||||
"metadata.capture_date",
|
||||
"metadata.operator_note",
|
||||
"metadata.source_artifact",
|
||||
"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"
|
||||
]
|
||||
},
|
||||
"ready_to_apply": false,
|
||||
"external_sources": [
|
||||
"JHora Varshaphala/Tajika annual chart screen",
|
||||
|
||||
@@ -12,6 +12,32 @@
|
||||
- metadata: `5`
|
||||
- target: `10`
|
||||
|
||||
## Prefilled Fields
|
||||
|
||||
- status: `draft`
|
||||
- promotion_status_after_fill: `external_verified`
|
||||
|
||||
- metadata:
|
||||
|
||||
- ayanamsa: `Lahiri`
|
||||
- node_mode: `true node`
|
||||
- timezone: `UTC-08:00`
|
||||
- annual_system: `Varshaphala/Tajika`
|
||||
- target_year: `1984`
|
||||
|
||||
- settings:
|
||||
|
||||
- ayanamsa: `lahiri`
|
||||
- node_mode: `true`
|
||||
- annual_system: `varshaphala`
|
||||
- target_year: `1984`
|
||||
|
||||
|
||||
## Manual Fill Plan
|
||||
|
||||
- status_value: `external_verified`
|
||||
- manual_entry_count: `15`
|
||||
|
||||
## Missing Fields
|
||||
|
||||
- `metadata.tool_name`
|
||||
|
||||
@@ -102,6 +102,34 @@ def _group_missing_fields(missing_fields: list[str]) -> dict[str, Any]:
|
||||
}
|
||||
|
||||
|
||||
def _prefilled_fields(packet: dict[str, Any], missing_fields: list[str]) -> dict[str, Any]:
|
||||
missing = set(missing_fields)
|
||||
metadata = {
|
||||
key: value
|
||||
for key, value in packet.get("metadata", {}).items()
|
||||
if f"metadata.{key}" not in missing and value not in ("", None, [], {})
|
||||
}
|
||||
settings = {
|
||||
key: value
|
||||
for key, value in packet.get("settings", {}).items()
|
||||
if value not in ("", None, [], {})
|
||||
}
|
||||
return {
|
||||
"status": packet.get("status"),
|
||||
"promotion_status_after_fill": packet.get("promotion_status_after_fill"),
|
||||
"metadata": metadata,
|
||||
"settings": settings,
|
||||
}
|
||||
|
||||
|
||||
def _manual_fill_plan(packet: dict[str, Any], missing_fields: list[str]) -> dict[str, Any]:
|
||||
return {
|
||||
"status_value": packet.get("promotion_status_after_fill", "external_verified"),
|
||||
"manual_entry_count": len(missing_fields),
|
||||
"remaining_manual_fields": missing_fields,
|
||||
}
|
||||
|
||||
|
||||
def _run_json(command: list[str]) -> dict[str, Any]:
|
||||
completed = subprocess.run(
|
||||
command,
|
||||
@@ -148,6 +176,7 @@ def build_report(front: str) -> dict[str, Any]:
|
||||
first = status["first_priority"]
|
||||
packet_missing = _packet_missing(config["packet_template"])
|
||||
missing_groups = _group_missing_fields(packet_missing)
|
||||
packet = json.loads((ROOT / config["packet_template"]).read_text(encoding="utf-8"))
|
||||
return {
|
||||
"scope": "first_external_oracle_packet_assistant",
|
||||
"schema_version": 1,
|
||||
@@ -158,6 +187,8 @@ def build_report(front: str) -> dict[str, Any]:
|
||||
"packet_template": config["packet_template"],
|
||||
"missing_fields": packet_missing,
|
||||
"missing_groups": missing_groups,
|
||||
"prefilled_fields": _prefilled_fields(packet, packet_missing),
|
||||
"manual_fill_plan": _manual_fill_plan(packet, packet_missing),
|
||||
"ready_to_apply": not packet_missing,
|
||||
"external_sources": config["external_sources"],
|
||||
"apply_command": first["apply_command"].replace(first["packet_path"], config["packet_template"]),
|
||||
@@ -194,8 +225,39 @@ def render_markdown(report: dict[str, Any]) -> str:
|
||||
lines.extend(
|
||||
[
|
||||
"",
|
||||
"## Missing Fields",
|
||||
"",
|
||||
"## Prefilled Fields",
|
||||
"",
|
||||
f"- status: `{report['prefilled_fields']['status']}`",
|
||||
f"- promotion_status_after_fill: `{report['prefilled_fields']['promotion_status_after_fill']}`",
|
||||
"",
|
||||
]
|
||||
)
|
||||
if report["prefilled_fields"]["metadata"]:
|
||||
lines.append("- metadata:")
|
||||
lines.append("")
|
||||
lines.extend(
|
||||
f" - {key}: `{value}`"
|
||||
for key, value in report["prefilled_fields"]["metadata"].items()
|
||||
)
|
||||
lines.append("")
|
||||
if report["prefilled_fields"]["settings"]:
|
||||
lines.append("- settings:")
|
||||
lines.append("")
|
||||
lines.extend(
|
||||
f" - {key}: `{value}`"
|
||||
for key, value in report["prefilled_fields"]["settings"].items()
|
||||
)
|
||||
lines.append("")
|
||||
lines.extend(
|
||||
[
|
||||
"",
|
||||
"## Manual Fill Plan",
|
||||
"",
|
||||
f"- status_value: `{report['manual_fill_plan']['status_value']}`",
|
||||
f"- manual_entry_count: `{report['manual_fill_plan']['manual_entry_count']}`",
|
||||
"",
|
||||
"## Missing Fields",
|
||||
"",
|
||||
]
|
||||
)
|
||||
lines.extend(f"- `{field}`" for field in report["missing_fields"])
|
||||
|
||||
@@ -50,6 +50,12 @@ def test_first_oracle_packet_assistant_reports_dasha_next_fields() -> None:
|
||||
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["prefilled_fields"]["metadata"]["ayanamsa"] == "Lahiri"
|
||||
assert report["prefilled_fields"]["metadata"]["node_mode"] == "true node"
|
||||
assert report["prefilled_fields"]["metadata"]["timezone"] == "UTC-08:00"
|
||||
assert report["manual_fill_plan"]["status_value"] == "external_verified"
|
||||
assert report["manual_fill_plan"]["manual_entry_count"] == 6
|
||||
assert report["manual_fill_plan"]["remaining_manual_fields"][-1] == "target.vimshottari_start_date"
|
||||
assert report["ready_to_apply"] is False
|
||||
assert "JHora" in " ".join(report["external_sources"])
|
||||
|
||||
@@ -92,6 +98,7 @@ def test_first_oracle_packet_assistant_reports_tajika_front() -> None:
|
||||
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 report["manual_fill_plan"]["manual_entry_count"] == 15
|
||||
assert "target.solar_return_datetime" in report["missing_fields"]
|
||||
assert "target.sahams.punya_saham" in report["missing_fields"]
|
||||
|
||||
@@ -124,6 +131,7 @@ def test_first_oracle_packet_assistant_reports_shadbala_front() -> None:
|
||||
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 report["manual_fill_plan"]["manual_entry_count"] == 55
|
||||
assert "target.moon_sidereal_longitude_deg" in report["missing_fields"]
|
||||
assert "target.shadbala_components.Sun.sthana" in report["missing_fields"]
|
||||
|
||||
@@ -148,6 +156,9 @@ def test_first_oracle_packet_assistant_markdown_includes_group_summary() -> None
|
||||
assert completed.returncode == 0, completed.stderr or completed.stdout
|
||||
markdown = completed.stdout
|
||||
assert "## Missing Summary" in markdown
|
||||
assert "## Prefilled Fields" in markdown
|
||||
assert "## Manual Fill Plan" in markdown
|
||||
assert "- metadata: `5`" in markdown
|
||||
assert "- target: `50`" in markdown
|
||||
assert "- Sun: `7`" in markdown
|
||||
assert "- status_value: `external_verified`" in markdown
|
||||
|
||||
Reference in New Issue
Block a user