ios , react.js , android
backend
database
Symptom Input (Manual / Voice / Questionnaire) for iOS
To implement Symptom Input (Manual / Voice / Questionnaire) for an iOS app, here’s a structured breakdown with code-level suggestions, UI ideas, and Apple frameworks you should use.
✅ 1. Manual Symptom Input (Text Entry)
🛠 Tools:
UITextFieldorUITextView- Autocomplete with
UITableVieworUICollectionView - Optional: use medical term dictionaries (e.g., SNOMED CT, ICD-10) for suggestions
🔤 Example SwiftUI:
swiftField("Enter symptoms", text: $symptomText)
.textFieldStyle(RoundedBorderTextFieldStyle())
.autocapitalization(.none)
🎙️ 2. Voice Input (Speech-to-Text)
🛠 Tools:
Speechframework (SFSpeechRecognizer)- Works offline (some languages), supports Thai, English, etc.
- Requires user permission
🔤 Example Swift (UIKit or SwiftUI):
swiftimport Speech
let recognizer = SFSpeechRecognizer(locale: Locale(identifier: "en-US"))
let request = SFSpeechAudioBufferRecognitionRequest()
let audioEngine = AVAudioEngine()
// Start recording and recognizing
try AVAudioSession.sharedInstance().setCategory(.record, mode: .measurement)
audioEngine.inputNode.installTap(onBus: 0, bufferSize: 1024, format: audioEngine.inputNode.outputFormat(forBus: 0)) {
buffer, when in request.append(buffer)
}
recognizer?.recognitionTask(with: request) { result, error in
if let result = result {
let spokenText = result.bestTranscription.formattedString
print("Recognized: \(spokenText)")
}
}
⚠️ Don’t forget
NSMicrophoneUsageDescriptionandNSSpeechRecognitionUsageDescriptionin Info.plist.
🧾 3. Symptom Questionnaire
🛠 Tools:
FormorList(SwiftUI)- Logic engine using rules or tree structure
- Save answers to local
CoreDataor remoteFirestore
🔤 Example SwiftUI:
swiftCopy codeForm {
Section(header: Text("General Symptoms")) {
Toggle("Fever", isOn: $hasFever)
Toggle("Cough", isOn: $hasCough)
Toggle("Shortness of breath", isOn: $hasSOB)
}
Button("Submit") {
diagnoseBasedOnCheckboxes()
}
}
You can connect the selected symptoms to your rule-based engine from previous steps.
🧠 Optional Enhancements
| Feature | Tool / Framework |
|---|---|
| NLP Symptom Extraction | CoreML + CreateML model |
| Face-based symptom | Vision framework + CoreML (for swelling, ptosis) |
| Voice-based Q&A | SiriKit / Custom speech interface |
| Multilingual support | NSLocalizedString, SFSpeechRecognizer(locale:) |
📦 Suggested Architecture
plaintextCopy code[TextField / Voice / Checkbox]
↓
[Symptom Normalizer + SNOMED ID]
↓
[Rule-based or ML-based Diagnosis Engine]
↓
[Results Page / Refer / Save to History]
✅ Summary for iOS Integration
| Input Method | Tech | Swift API |
|---|---|---|
| Manual Entry | TextField/TextView + Dictionary | UITextField, List, Form |
| Voice | Apple Speech Framework | SFSpeechRecognizer |
| Questionnaire | SwiftUI Form / UIKit TableView | Form, Toggle, Button |
Would you like:
- A full SwiftUI diagnosis page template?
- A sample voice recognition component pre-wired to symptom matching?
Let me know your target audience (patient, doctor) and interface style (minimal, visual, clinical).Tools
