Commit c484860
Genai speech to form (#3666)
* Initial commit
* Add dependencies
* Transcribe an audio file to text using Google Cloud Speech-to-Text API
* Gemini client
* TextToForm code
* remove validation
* SpeechToForm class
* add genai lib, mock gemini class with it
* use suspend, rename to model, update template
* Add unit tests
* Add lisences, clean up
* fix tests
* expand docs
* Allow for GEMINI_API_KEY to be passed as project property
* Update SpeechToForm to use GeminiModel in instantiating TextToForm
Update GeminiModel to return model
* Clean up temp file after test
* Add option to run tests bu hitting the actual API
* Update method name to avoid conflict
* pull out qr validation
* QR generation retry logic incase of errors.
Refactor some functions
* Address changes
* Add test audio file
* move to new package structure and abstract models
* match tests to new abstractions
* turn class into interface, do not override autogen getter
* retry if not able to extract response, always return a qr
* refactor some constants
* Add sample transcript
* rename packages and add outline of summarize class
* add scaffold for live speech to text
* Refine model layer abstraction.
Make it easy to change models.
* Refactor dispatcher.
* Convert Speech to text to an object.
Use proper logging.
Remove redundant qR checks
* refactor TextToForm to an object. Utilize refactored models.
Handle different responses
* Update tests
* fix summarize and remove wildcard
* spotless
* Resolved issues making build fail:
- Excluded conflicting dependencies (com.google.guava:guava and org.threeten:threetenbp) from the google-cloud-speech library.
- Upgraded google-cloud-speech to version 4.50.0 to address compatibility issues.
* Additional sample test files
* Use real files TextToForm tests
* Add grpc-okhttp dependency needed by google cloud speech
* Switch transcription to only transcribe wav files as recommended.
* Improve SpeechToTextTest to only mock api calls but use real files
* Add sample conversation.wav file
* Handle edge case in retryLogic where QR, QRJson of generatedText could be blank
Add more TextToFormTest tests
* Gnerate Summary initial work and tests
* Resolve tests failure caused by refactoring QuestionnaireResponseValidator
* Add SpeechToext fragment views
* add starter gemma model
* Update questionnaire form on new QuestionnaireResponse
* Refactor showing progress dialog in Questionnaire activity
* Show record button
* Toggle record button and show speech-to-text 'window'
* Exclude protobuf-javalite to fix duplicated classes error
Since full version protobuf-java is required for com.google.cloud:google-cloud-speech
* Add record-audio permission before lauching speech to text
* Simulate stop recording processing progress view
* add tests, fix style
* set type and create constants
* Integrate to TextToForm api with Gemini
* Show edit button to exit speech-to-text without updating form
* Integrate speech-to-text to call cloud speech-to-text api
* Fix errors in tests
* Fix failing tests for QuestionnaireViewModel
* Latest working changes - add build variant
* Run spotless
* Add enableSpeechToText to questionnaire config
* Edit GemmaModel class to allow test
* refactor hasDebygSuffix and allow more paths
* check buffer min and use generic mic
* newer model, fix prompt for multiselects
* line breaks
* move hasDebugSuffix tests
* use a list and remove need for test
* extend timeout, check adb
* add ram size
* add missing mocks and ids
* add test for service points map
* test unmocked debug variant
* add note for gradle change
* increase heap
* disable avd force
* remove memory changes
* shard quest tests
* fix time stripping code
* add info
* add shard suffix to test report
* remove clean
* update regex and examples
* add worker cleanup
* add unmock
* more agressive test cleanup
* remove verbose
* add roll up step
* increase heap size
* more shards less heap
---------
Co-authored-by: pld <peter@ona.io>
Co-authored-by: L≡ZRS <12814349+LZRS@users.noreply.github.com>
Co-authored-by: Francis Odhiambo <4540684+f-odhiambo@users.noreply.github.com>1 parent d1454d4 commit c484860
File tree
52 files changed
+5298
-346
lines changed- .github/workflows
- android
- buildSrc/src/main/kotlin
- engine/src
- main/java/org/smartregister/fhircore/engine
- configuration
- util
- test/java/org/smartregister/fhircore/engine/util
- geowidget/src
- main/java/org/smartregister/fhircore/geowidget/screens
- test/java/org/smartregister/fhircore/geowidget/screens
- gradle
- quest
- src
- genAi/res/drawable
- main
- java/org/smartregister/fhircore/quest
- medintel
- speech
- models
- speechtoform
- summarization
- ui
- appsetting
- questionnaire
- util
- res
- drawable
- layout
- values
- test/java/org/smartregister/fhircore/quest
- medintel
- speech
- models
- speechtoform
- summarization
- resources
- robolectric
- ui
- appsetting
- geowidget
- login
- questionnaire
- util/extensions
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
52 files changed
+5298
-346
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
| 28 | + | |
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
| 32 | + | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
114 | 115 | | |
115 | 116 | | |
116 | 117 | | |
117 | | - | |
118 | | - | |
| 118 | + | |
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| 202 | + | |
202 | 203 | | |
203 | 204 | | |
204 | 205 | | |
| 206 | + | |
| 207 | + | |
205 | 208 | | |
206 | | - | |
207 | 209 | | |
208 | 210 | | |
209 | 211 | | |
| |||
258 | 260 | | |
259 | 261 | | |
260 | 262 | | |
261 | | - | |
| 263 | + | |
262 | 264 | | |
263 | 265 | | |
264 | 266 | | |
| |||
269 | 271 | | |
270 | 272 | | |
271 | 273 | | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
| 274 | + | |
| 275 | + | |
285 | 276 | | |
286 | 277 | | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
302 | 283 | | |
303 | 284 | | |
304 | 285 | | |
305 | 286 | | |
306 | 287 | | |
307 | | - | |
| 288 | + | |
308 | 289 | | |
309 | 290 | | |
310 | 291 | | |
311 | 292 | | |
312 | 293 | | |
313 | 294 | | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
27 | 30 | | |
28 | 31 | | |
29 | 32 | | |
| |||
108 | 111 | | |
109 | 112 | | |
110 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
111 | 120 | | |
112 | 121 | | |
113 | 122 | | |
| |||
android/engine/src/test/java/org/smartregister/fhircore/engine/util/SharedPreferencesHelperTest.kt
Lines changed: 36 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
122 | 124 | | |
123 | 125 | | |
124 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
125 | 161 | | |
android/geowidget/src/main/java/org/smartregister/fhircore/geowidget/screens/GeoWidgetViewModel.kt
Lines changed: 43 additions & 44 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
29 | 70 | | |
30 | 71 | | |
31 | 72 | | |
| |||
34 | 75 | | |
35 | 76 | | |
36 | 77 | | |
37 | | - | |
38 | 78 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
| 79 | + | |
| 80 | + | |
82 | 81 | | |
83 | 82 | | |
Lines changed: 7 additions & 34 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
150 | 123 | | |
151 | 124 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | | - | |
| 28 | + | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
0 commit comments