HASH f82aceccb992
DATE 2025-07-20
SUBJECT nix: change output json output schema
FILES 4 CHANGED
HASH f82aceccb992
DATE 2025-07-20
SUBJECT nix: change output json output schema
FILES 4 CHANGED
┌─ nix/apps.nix ─────────────────────────────────────────────────────────────┐
│ diff --git a/nix/apps.nix b/nix/apps.nix │
│ index 7edcbb4..92c4a36 100644 │
│ --- a/nix/apps.nix │
│ +++ b/nix/apps.nix │
│ @@ -63,21 +63,30 @@ │
│ specs = "dps"; # shortcut to all DPS classes templates │
│ encounter = encounter.raid.long.singleTarget; │
│ iterations = 10000; │
│ - output = "singleTargetDPSraidp1long"; │
│ + phase = "p1"; │
│ + encounterType = "raid"; │
│ + targetCount = "single"; │
│ + duration = "long"; │
│ }; │
│ │
│ multiTargetRaidLong = mkMassSim { │
│ specs = "dps"; │
│ encounter = encounter.raid.long.multiTarget; │
│ iterations = 10000; │
│ - output = "multiTargetDPSraidp1long"; │
│ + phase = "p1"; │
│ + encounterType = "raid"; │
│ + targetCount = "multi"; │
│ + duration = "long"; │
│ }; │
│ │
│ cleaveRaidLong = mkMassSim { │
│ specs = "dps"; │
│ encounter = encounter.raid.long.cleave; │
│ iterations = 10000; │
│ - output = "cleaveDPSraidp1long"; │
│ + phase = "p1"; │
│ + encounterType = "raid"; │
│ + targetCount = "cleave"; │
│ + duration = "long"; │
│ }; │
│ }; │
│ in { │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ nix/apps.nix ───────────────────────┐
│ diff --git a/nix/apps.nix b/nix/apps.nix │
│ index 7edcbb4..92c4a36 100644 │
│ --- a/nix/apps.nix │
│ +++ b/nix/apps.nix │
│ @@ -63,21 +63,30 @@ │
│ specs = "dps"; # shortcut to all DP │
│ S classes templates │
│ encounter = encounter.raid.long.sin │
│ gleTarget; │
│ iterations = 10000; │
│ - output = "singleTargetDPSraidp1long │
│ "; │
│ + phase = "p1"; │
│ + encounterType = "raid"; │
│ + targetCount = "single"; │
│ + duration = "long"; │
│ }; │
│ │
│ multiTargetRaidLong = mkMassSim { │
│ specs = "dps"; │
│ encounter = encounter.raid.long.mul │
│ tiTarget; │
│ iterations = 10000; │
│ - output = "multiTargetDPSraidp1long" │
│ ; │
│ + phase = "p1"; │
│ + encounterType = "raid"; │
│ + targetCount = "multi"; │
│ + duration = "long"; │
│ }; │
│ │
│ cleaveRaidLong = mkMassSim { │
│ specs = "dps"; │
│ encounter = encounter.raid.long.cle │
│ ave; │
│ iterations = 10000; │
│ - output = "cleaveDPSraidp1long"; │
│ + phase = "p1"; │
│ + encounterType = "raid"; │
│ + targetCount = "cleave"; │
│ + duration = "long"; │
│ }; │
│ }; │
│ in { │
└──────────────────────────────────────────────┘
┌─ nix/default.nix ──────────────────────────────────────────────────────────┐
│ diff --git a/nix/default.nix b/nix/default.nix │
│ index 58a286f..44d9a28 100644 │
│ --- a/nix/default.nix │
│ +++ b/nix/default.nix │
│ @@ -3,7 +3,6 @@ │
│ ./shell.nix │
│ ./apps.nix │
│ ./checks.nix │
│ - ./test.nix │
│ │
│ # components │
│ ./classes │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ nix/default.nix ────────────────────┐
│ diff --git a/nix/default.nix b/nix/default.n │
│ ix │
│ index 58a286f..44d9a28 100644 │
│ --- a/nix/default.nix │
│ +++ b/nix/default.nix │
│ @@ -3,7 +3,6 @@ │
│ ./shell.nix │
│ ./apps.nix │
│ ./checks.nix │
│ - ./test.nix │
│ │
│ # components │
│ ./classes │
└──────────────────────────────────────────────┘
┌─ nix/lib/mkMassSim.nix ────────────────────────────────────────────────────┐
│ diff --git a/nix/lib/mkMassSim.nix b/nix/lib/mkMassSim.nix │
│ index cafe1d8..ec1e3ed 100644 │
│ --- a/nix/lib/mkMassSim.nix │
│ +++ b/nix/lib/mkMassSim.nix │
│ @@ -50,7 +50,10 @@ │
│ specs ? "dps", │
│ encounter, │
│ iterations ? 10000, │
│ - output, │
│ + phase ? "p1", │
│ + encounterType ? "raid", │
│ + targetCount ? "single", │
│ + duration ? "long", │
│ }: let │
│ # Get the list of specs based on the specs parameter │
│ specConfigs = if specs == "dps" then getAllDPSSpecs classes │
│ @@ -123,13 +126,16 @@ │
│ ''; │
│ }) specConfigs); │
│ │
│ + # Generate structured output filename: <type>_<phase>_<encounter-type>_<targe │
│ t-count>_<duration> │
│ + structuredOutput = "${specs}_${phase}_${encounterType}_${targetCount}_${durat │
│ ion}"; │
│ + │
│ # Aggregation script that combines all results │
│ aggregationScript = pkgs.writeShellApplication { │
│ - name = "${output}-aggregator"; │
│ + name = "${structuredOutput}-aggregator"; │
│ text = '' │
│ set -euo pipefail │
│ │
│ - echo "Aggregating mass simulation results for: ${output}" │
│ + echo "Aggregating mass simulation results for: ${structuredOutput}" │
│ echo "Specs simulated: ${toString (lib.length specConfigs)}" │
│ │
│ # Create base structure │
│ @@ -154,7 +160,7 @@ │
│ │
│ # Create final output with metadata including encounter information │
│ finalResult=$(echo "$result" | jq \ │
│ - --arg output "${output}" \ │
│ + --arg output "${structuredOutput}" \ │
│ --arg timestamp "$(date -Iseconds)" \ │
│ --arg iterations "${toString iterations}" \ │
│ --arg specCount "${toString (lib.length specConfigs)}" \ │
│ @@ -173,11 +179,11 @@ │
│ }') │
│ │
│ # Write to file and stdout │
│ - echo "$finalResult" | tee "${output}.json" │
│ + echo "$finalResult" | tee "${structuredOutput}.json" │
│ │
│ # Copy to web public directory for Astro │
│ mkdir -p web/public/data │
│ - cp "${output}.json" web/public/data/ │
│ + cp "${structuredOutput}.json" web/public/data/ │
│ │
│ echo "" │
│ echo "Top DPS Rankings:" │
│ @@ -190,7 +196,7 @@ │
│ ' | sort -k2 -nr | head -10 │
│ │
│ echo "" │
│ - echo "Results written to: ${output}.json" │
│ + echo "Results written to: ${structuredOutput}.json" │
│ ''; │
│ runtimeInputs = [ pkgs.jq pkgs.coreutils ]; │
│ }; │
│ @@ -204,7 +210,8 @@ │
│ │
│ # Metadata about this mass simulation │
│ metadata = { │
│ - inherit output iterations; │
│ + output = structuredOutput; │
│ + inherit iterations phase encounterType targetCount duration; │
│ specCount = lib.length specConfigs; │
│ specs = map (s: "${s.className}/${s.specName}") specConfigs; │
│ }; │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ nix/lib/mkMassSim.nix ──────────────┐
│ diff --git a/nix/lib/mkMassSim.nix b/nix/lib │
│ /mkMassSim.nix │
│ index cafe1d8..ec1e3ed 100644 │
│ --- a/nix/lib/mkMassSim.nix │
│ +++ b/nix/lib/mkMassSim.nix │
│ @@ -50,7 +50,10 @@ │
│ specs ? "dps", │
│ encounter, │
│ iterations ? 10000, │
│ - output, │
│ + phase ? "p1", │
│ + encounterType ? "raid", │
│ + targetCount ? "single", │
│ + duration ? "long", │
│ }: let │
│ # Get the list of specs based on the sp │
│ ecs parameter │
│ specConfigs = if specs == "dps" then ge │
│ tAllDPSSpecs classes │
│ @@ -123,13 +126,16 @@ │
│ ''; │
│ }) specConfigs); │
│ │
│ + # Generate structured output filename: │
│ <type>_<phase>_<encounter-type>_<target-coun │
│ t>_<duration> │
│ + structuredOutput = "${specs}_${phase}_$ │
│ {encounterType}_${targetCount}_${duration}"; │
│ + │
│ # Aggregation script that combines all │
│ results │
│ aggregationScript = pkgs.writeShellAppl │
│ ication { │
│ - name = "${output}-aggregator"; │
│ + name = "${structuredOutput}-aggregato │
│ r"; │
│ text = '' │
│ set -euo pipefail │
│ │
│ - echo "Aggregating mass simulation r │
│ esults for: ${output}" │
│ + echo "Aggregating mass simulation r │
│ esults for: ${structuredOutput}" │
│ echo "Specs simulated: ${toString ( │
│ lib.length specConfigs)}" │
│ │
│ # Create base structure │
│ @@ -154,7 +160,7 @@ │
│ │
│ # Create final output with metadata │
│ including encounter information │
│ finalResult=$(echo "$result" | jq \ │
│ - --arg output "${output}" \ │
│ + --arg output "${structuredOutput} │
│ " \ │
│ --arg timestamp "$(date -Iseconds │
│ )" \ │
│ --arg iterations "${toString iter │
│ ations}" \ │
│ --arg specCount "${toString (lib. │
│ length specConfigs)}" \ │
│ @@ -173,11 +179,11 @@ │
│ }') │
│ │
│ # Write to file and stdout │
│ - echo "$finalResult" | tee "${output │
│ }.json" │
│ + echo "$finalResult" | tee "${struct │
│ uredOutput}.json" │
│ │
│ # Copy to web public directory for │
│ Astro │
│ mkdir -p web/public/data │
│ - cp "${output}.json" web/public/data │
│ / │
│ + cp "${structuredOutput}.json" web/p │
│ ublic/data/ │
│ │
│ echo "" │
│ echo "Top DPS Rankings:" │
│ @@ -190,7 +196,7 @@ │
│ ' | sort -k2 -nr | head -10 │
│ │
│ echo "" │
│ - echo "Results written to: ${output} │
│ .json" │
│ + echo "Results written to: ${structu │
│ redOutput}.json" │
│ ''; │
│ runtimeInputs = [ pkgs.jq pkgs.coreut │
│ ils ]; │
│ }; │
│ @@ -204,7 +210,8 @@ │
│ │
│ # Metadata about this mass simulation │
│ metadata = { │
│ - inherit output iterations; │
│ + output = structuredOutput; │
│ + inherit iterations phase encounterTyp │
│ e targetCount duration; │
│ specCount = lib.length specConfigs; │
│ specs = map (s: "${s.className}/${s.s │
│ pecName}") specConfigs; │
│ }; │
└──────────────────────────────────────────────┘
┌─ web/src/pages/index.astro ────────────────────────────────────────────────┐
│ diff --git a/web/src/pages/index.astro b/web/src/pages/index.astro │
│ index c6bec00..6aba47c 100644 │
│ --- a/web/src/pages/index.astro │
│ +++ b/web/src/pages/index.astro │
│ @@ -4,6 +4,6 @@ import RankingsLayout from '../layouts/RankingsLayout.astro'; │
│ │
│ <RankingsLayout │
│ title="Single Target DPS Rankings" │
│ - dataFile="singleTargetDPSraidp1long.json" │
│ + dataFile="dps_p1_raid_single_long.json" │
│ description="Simulation results for single target raid encounters in MoP" │
│ /> │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ web/src/pages/index.astro ──────────┐
│ diff --git a/web/src/pages/index.astro b/web │
│ /src/pages/index.astro │
│ index c6bec00..6aba47c 100644 │
│ --- a/web/src/pages/index.astro │
│ +++ b/web/src/pages/index.astro │
│ @@ -4,6 +4,6 @@ import RankingsLayout from ' │
│ ../layouts/RankingsLayout.astro'; │
│ │
│ <RankingsLayout │
│ title="Single Target DPS Rankings" │
│ - dataFile="singleTargetDPSraidp1long.json" │
│ + dataFile="dps_p1_raid_single_long.json" │
│ description="Simulation results for singl │
│ e target raid encounters in MoP" │
│ /> │
└──────────────────────────────────────────────┘
[ BACK TO LOG ]
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET