@@ -192,3 +192,38 @@ def test_expand_responses(report):
192192def test_data_dictionary (report ):
193193 _data = MindloggerData (report )
194194 assert len (list (_data .data_dictionary )) != 0
195+
196+
197+ @WITH_REPORT
198+ def test_redcap_format_integration_with_test_data (datafiles : Path ):
199+ """Integration test for RedcapImportFormat with actual test data."""
200+ from mindlogger_data_export .outputs import RedcapImportFormat
201+
202+ mindlogger_data = MindloggerData .create (datafiles )
203+
204+ # Create REDCap metadata with mixed suffix patterns
205+ redcap_metadata = pl .DataFrame (
206+ {
207+ "field_name" : [
208+ "mood1_1_response" , # Has _response suffix
209+ "mood2_1" , # Base name
210+ "sleepquality_1_index" , # Has _index suffix
211+ ],
212+ "select_choices_or_calculations" : [
213+ "0, 0-Very Cheerful | 6, 6-Very Sad" ,
214+ "0, 0-Very Relaxed | 6, 6-Very Anxious" ,
215+ "0, 0-Very Poor | 4, 4-Very Good" ,
216+ ],
217+ }
218+ )
219+
220+ # Create RedcapImportFormat with metadata
221+ redcap_format = RedcapImportFormat (redcap_metadata = redcap_metadata )
222+
223+ # Use produce() instead of non-existent to_wide()
224+ outputs = redcap_format .produce (mindlogger_data )
225+
226+ # Should successfully process despite suffix pattern differences
227+ assert outputs is not None
228+ assert len (outputs ) > 0
229+ assert all (isinstance (output .output , pl .DataFrame ) for output in outputs )
0 commit comments