Skip to content

Add Google Forms API integration for questionnaire import (closes #36)#126

Merged
woodthom2 merged 1 commit intoharmonydata:mainfrom
antuansabe:feature/google-forms-integration
Mar 12, 2026
Merged

Add Google Forms API integration for questionnaire import (closes #36)#126
woodthom2 merged 1 commit intoharmonydata:mainfrom
antuansabe:feature/google-forms-integration

Conversation

@antuansabe
Copy link
Contributor

Implements complete Google Forms API integration allowing users to import questionnaires directly from Google Forms URLs using simple API key authentication.

Features:

  • URL and form ID parsing with regex pattern matching
  • Google Forms API v1 integration using google-api-python-client
  • Support for multiple question types: multiple choice, checkboxes, dropdown, linear scale, text questions, and grid questions
  • Automatic language detection using langdetect
  • Comprehensive metadata extraction (form_id, title, description)
  • Complete test suite with mock data for testing without API calls
  • Documentation in README.md with setup instructions and usage examples

Technical details:

  • Authentication: API key via GOOGLE_FORMS_API_KEY environment variable
  • New FileType: google_forms enum value
  • Parser pattern: convert_google_forms_to_instruments(file: RawFile) -> List[Instrument]
  • Error handling for HttpError (403, 404, 429) and invalid inputs

Files added:

  • src/harmony/parsing/google_forms_parser.py (~350 lines)
  • tests/test_google_forms_parser.py (comprehensive test suite)

Files modified:

  • requirements.txt: Added google-api-python-client>=2.147.0
  • pyproject.toml: Added google-api-python-client dependency
  • src/harmony/schemas/enums/file_types.py: Added google_forms enum
  • src/harmony/parsing/wrapper_all_parsers.py: Added import and routing
  • README.md: Added Google Forms documentation section

…monydata#36)

Implements complete Google Forms API integration allowing users to import
questionnaires directly from Google Forms URLs using simple API key authentication.

Features:
- URL and form ID parsing with regex pattern matching
- Google Forms API v1 integration using google-api-python-client
- Support for multiple question types: multiple choice, checkboxes, dropdown,
  linear scale, text questions, and grid questions
- Automatic language detection using langdetect
- Comprehensive metadata extraction (form_id, title, description)
- Complete test suite with mock data for testing without API calls
- Documentation in README.md with setup instructions and usage examples

Technical details:
- Authentication: API key via GOOGLE_FORMS_API_KEY environment variable
- New FileType: google_forms enum value
- Parser pattern: convert_google_forms_to_instruments(file: RawFile) -> List[Instrument]
- Error handling for HttpError (403, 404, 429) and invalid inputs

Files added:
- src/harmony/parsing/google_forms_parser.py (~350 lines)
- tests/test_google_forms_parser.py (comprehensive test suite)

Files modified:
- requirements.txt: Added google-api-python-client>=2.147.0
- pyproject.toml: Added google-api-python-client dependency
- src/harmony/schemas/enums/file_types.py: Added google_forms enum
- src/harmony/parsing/wrapper_all_parsers.py: Added import and routing
- README.md: Added Google Forms documentation section
@woodthom2
Copy link
Contributor

Thanks very much @antuansabe ! Can you also see how to expose this functionality from the API repo https://github.com/harmonydata/harmonyapi ?

@woodthom2 woodthom2 merged commit 4cc04d5 into harmonydata:main Mar 12, 2026
1 check passed
@woodthom2
Copy link
Contributor

@antuansabe I have added an issue in the API repo to expose this functionality: harmonydata/harmonyapi#29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants