-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add generate election package script #5721
Add generate election package script #5721
Conversation
layouts and translations. Follow the instructions to setup Google Cloud account | ||
authentication [here](/../backend/src/language_and_audio/README.md) before | ||
using. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this README section interrupts the Election Fixture Generator section. Also, it doesn't seem to include usage instructions for Election Package Generator
* Helper function that renders ballots and generates an election definition for the standard | ||
* VxSuite hmpb ballot layout. | ||
*/ | ||
export async function createElectionDefinitionForDefaultHmpbLayouts( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: maybe "Template" rather than "Layouts"
* Helper function to generate all necessary strings used in an election package. | ||
* Returns three packages of strings: app strings, HMPB strings, and election strings. | ||
*/ | ||
export async function getAllStringsForElectionPackage( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: change get
to translate
to be more specific about what's happening
import { generateElectionPackage } from '../../generate-election-package'; | ||
|
||
// A script to generate an election package. | ||
// Usage: ./generate-election-package <election_fixtures_directory_path> <is_multi_language> <force_restranslate> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API suggestions to improve clarity and better mesh with existing scripts in this lib:
- Take a path to the election.json rather than requiring that it is named
baseElection.json
so the script can be used more flexibly - Instead of
force_retranslate
, optionally take a path to the election package that should be used as a translation cache (e.g.--reuse-translations <path_to_package>
) - Change
is_multi_language
to a flag--multi-language
. It's a bit confusing just seeing a1
in the command - Require an output path to be specified
--outputPath <path>
Take them or leave them, not blocking
// by passing a third argument of '1'. | ||
|
||
// The generated election.json file for this election package will be stored alongside it in the | ||
// election package directory for convenance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spelling: convenance -> convenience
): Promise<number> { | ||
if (argv.length !== 5) { | ||
stderr.write( | ||
'Usage: generate-election-package <election_fixtures_directory_path> <is_multi_language> <force_restranslate>]\n' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling: force_restranslate -> force_retranslate
|
||
/** | ||
* Mock implementation of the SpeechSynthesizer interface. Returns the input text with '(audio)' appended rather | ||
* than a base64 encoded audio clip. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment doesn't seem to be accurate
* add generate-election-packages script with test when it needs regen * make default latest metadata * add version of electionPrimaryPrecinctSplits without ballot strings * all new fixtures generated files * fixtures build:resources * export newly added fixtures for use in package generator test * address pr comments * fix refactor
Overview
Next step of the plan outlined in #5695 and implementing a lot of the work from that draft.
This PR adds a script to lib/fixture-generators to generate an election package in a given lib/fixtures directory folder. I add the generated results for 1 initial election but the only work in this PR that uses those fixtures is the new test that makes sure election packages generated are up to date.
Future Planned Work Still Includes:
Testing Plan
Ran tests
Manually tested using generated election package with generated json linked in dev dock for smart cards