Spaces:
Running
Running
Download source/src/preparation.ts from Giuliocc/windtunnel-lab: direct link, hf CLI and curl.
- Browser
- Download file 2.56 kB
-
https://huggingface.co/spaces/Giuliocc/windtunnel-lab/resolve/main/source/src/preparation.ts
- Command line
-
hf download hf://spaces/Giuliocc/windtunnel-lab/source/src/preparation.ts
-
curl -L -o preparation.ts https://huggingface.co/spaces/Giuliocc/windtunnel-lab/resolve/main/source/src/preparation.ts
2.56 kB
| export interface PreparationInput { | |
| kind: 'policy' | 'ad'; | |
| stimulus: string; | |
| action: string; | |
| population: string; | |
| conditions: string; | |
| outcome: string; | |
| } | |
| export function fieldwork(input: PreparationInput) { | |
| const words = input.stimulus.trim().split(/\s+/u).filter(Boolean).length; | |
| const scope = input.kind === 'ad' ? 'offer' : 'proposal'; | |
| return { | |
| schema_version: 'windtunnel-fieldwork-preparation-v1', | |
| result_kind: 'qualitative_hypothesis', | |
| status: 'unsupported', | |
| option_probabilities: null, | |
| abstention_reasons: [`No matching human responses to this exact ${scope}, instrument and population.`], | |
| input, | |
| wording_review: [ | |
| `${words} words in the supplied text.`, | |
| ...(words > 150 ? ['Pilot reading burden before fielding.'] : []), | |
| ...(input.stimulus.includes('?') ? ['Review question marks for rhetorical or leading language.'] : []), | |
| ...(!input.conditions.trim() ? ['Confirm costs, timing and conditions before testing.'] : []), | |
| ], | |
| questionnaire: [ | |
| { id: 'comprehension', question: `In your own words, what does the ${scope} say?`, type: 'open_text', options: [] }, | |
| ...input.kind === 'ad' | |
| ? [{ id: 'interest', question: 'How interested, if at all, are you in learning more about the offer?', type: 'single_choice', | |
| options: ['Very interested', 'Somewhat interested', 'Not very interested', 'Not at all interested', 'Not sure'] }] | |
| : [{ id: 'support', question: 'Overall, do you support or oppose the proposal as described?', type: 'single_choice', | |
| options: ['Strongly support', 'Somewhat support', 'Somewhat oppose', 'Strongly oppose', 'Not sure'] }], | |
| { id: 'concerns', question: `What concerns or questions, if any, do you have about the ${scope}?`, type: 'open_text', options: [] }, | |
| ], | |
| measurement_plan: { | |
| recruitment: 'Recruit from the confirmed universe, document inclusion and mode, and assess coverage and nonresponse.', | |
| assignment: 'For variants, randomly assign one frozen stimulus per participant and use the same questionnaire and order in all arms.', | |
| analysis: 'Predefine the primary outcome, eligible denominator, smallest relevant difference and sample requirement. Compare distributions and report missingness separately.', | |
| rights: 'Document use and redistribution rights, consent, field dates, weights and retention before collection.', | |
| disclosure: 'Authored measurement template. No human outcomes were observed, and no probability estimate was produced.', | |
| }, | |
| }; | |
| } | |