Publish party-position estimates and validation materials
This commit is contained in:
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
|
||||
cd "$repo_root"
|
||||
|
||||
required_model_inputs=(
|
||||
"data/text_data.csv"
|
||||
"data/expert.csv"
|
||||
"data/lr_data.csv"
|
||||
"data/union_mapping.csv"
|
||||
"data/party_families.csv"
|
||||
)
|
||||
|
||||
missing=0
|
||||
for input in "${required_model_inputs[@]}"; do
|
||||
if [ ! -s "$input" ]; then
|
||||
echo "Missing model-ready input: $input" >&2
|
||||
missing=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$missing" -ne 0 ]; then
|
||||
echo "Regenerate model inputs with data-setup/run_data_setup.sh, or restore the included data/ files." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Model-ready data inputs are present."
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
|
||||
cd "$repo_root"
|
||||
|
||||
julia --project=. src/julia/01_run_model.jl
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
|
||||
cd "$repo_root"
|
||||
|
||||
julia --project=. src/julia/02_post_estimation.jl
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
|
||||
cd "$repo_root"
|
||||
|
||||
julia --project=. src/julia/02_enrich_output.jl
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
|
||||
cd "$repo_root"
|
||||
|
||||
julia --project=. src/julia/validate_convergent.jl
|
||||
julia --project=. src/julia/validate_uncertainty.jl
|
||||
julia --project=. src/julia/validate_construct.jl
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
repo_root="$(git rev-parse --show-toplevel)"
|
||||
cd "$repo_root"
|
||||
|
||||
fail() {
|
||||
printf 'PUBLIC CONTENT CHECK FAILED: %s\n' "$1" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# The bracketed spellings intentionally prevent this guard from matching its
|
||||
# own detection patterns.
|
||||
content_pattern='[Rr][Ee][Vv][Ii][Ee][Ww]([Ee][Rr]|[Ss])?|[Ee][Dd][Ii][Tt][Oo][Rr]([[:space:]_-]*[Cc][Oo][Mm][Mm][Ee][Nn][Tt][Ss]?)?|[Mm][Aa][Jj][Oo][Rr][[:space:]_-]*[Rr][Ee][Vv][Ii][Ss][Ii][Oo][Nn]|[Pp][Oo][Ii][Nn][Tt][[:space:]_-]*[Bb][Yy][[:space:]_-]*[Pp][Oo][Ii][Nn][Tt]|[Rr][Ee][Vv][Ii][Ee][Ww][[:space:]_-]*[Pp][Rr][Oo][Cc][Ee][Ss][Ss]|[Ss][Uu][Bb][Mm][Ii][Ss][Ss][Ii][Oo][Nn][[:space:]_-]*[Dd][Ee][Tt][Aa][Ii][Ll][Ss]'
|
||||
path_pattern='([Rr][Ee][Vv][Ii][Ee][Ww]|[Rr][Ee][Vv][Ii][Ss][Ii][Oo][Nn]|[Rr][Ee][Ss][Pp][Oo][Nn][Ss][Ee][[:space:]_.-]*[Tt][Oo])'
|
||||
|
||||
check_ref() {
|
||||
local ref="$1"
|
||||
local hits
|
||||
hits="$(git grep -n -I -E "$content_pattern" "$ref" -- . ':(exclude)*.pdf' 2>/dev/null || true)"
|
||||
[[ -z "$hits" ]] || fail "non-public wording found in $ref:\n$hits"
|
||||
}
|
||||
|
||||
check_names() {
|
||||
local names
|
||||
names="$(git ls-tree -r --name-only HEAD | grep -E "$path_pattern" || true)"
|
||||
[[ -z "$names" ]] || fail "non-public-looking tracked path(s):\n$names"
|
||||
}
|
||||
|
||||
check_names
|
||||
|
||||
while IFS= read -r commit; do
|
||||
check_ref "$commit"
|
||||
done < <(git rev-list --all)
|
||||
|
||||
while IFS=$'\t' read -r object subject; do
|
||||
if printf '%s\n%s\n' "$object" "$subject" | grep -E -q "$content_pattern"; then
|
||||
fail "non-public wording found in reachable ref or commit subject: $object $subject"
|
||||
fi
|
||||
done < <(git for-each-ref --format='%(refname)%09%(subject)'; git log --all --format='%H%x09%s')
|
||||
|
||||
printf 'OK: public-content audit passed.\n'
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
repo_root="$(git rev-parse --show-toplevel)"
|
||||
hook="$repo_root/.git/hooks/pre-push"
|
||||
|
||||
if [[ -e "$hook" && ! -f "$hook" ]]; then
|
||||
printf 'Cannot install guard: %s is not a regular file.\n' "$hook" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -f "$hook" ]] && ! grep -Fq 'scripts/check_public_content.sh' "$hook"; then
|
||||
printf 'Cannot install guard: existing pre-push hook is not managed by this repository.\n' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat > "$hook" <<'EOF'
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
repo_root="$(git rev-parse --show-toplevel)"
|
||||
exec bash "$repo_root/scripts/check_public_content.sh"
|
||||
EOF
|
||||
chmod +x "$hook"
|
||||
printf 'Installed public-content pre-push guard.\n'
|
||||
Reference in New Issue
Block a user