@@ -142,6 +142,57 @@ def export_survey_access_code(
142142
143143 return cast (str , self ._call_api (payload , return_type = "str" ))
144144
145+ def export_survey_return_code (
146+ self ,
147+ record : str ,
148+ instrument : str ,
149+ event : Optional [str ] = None ,
150+ repeat_instance : int = 1 ,
151+ ) -> str :
152+ # pylint: disable=line-too-long
153+ """
154+ Export a Survey Return Code for a Participant
155+
156+ Note:
157+ The passed instrument must be set up as a survey instrument, which has return codes enabled.
158+
159+ Args:
160+ record:
161+ Name of the record
162+ instrument:
163+ Name of instrument as seen in the Data Dictionary (metadata).
164+ event:
165+ Unique event name, only used in longitudinal projects
166+ repeat_instance:
167+ only for projects with repeating instruments/events)
168+ The repeat instance number of the repeating event (if longitudinal)
169+ or the repeating instrument (if classic or longitudinal).
170+ Default value is '1'.
171+
172+ Returns:
173+ A survey return code for a specified record and data collection
174+ instrument
175+
176+ Examples:
177+ >>> proj.export_survey_return_code(record="1", instrument="form_1", event="event_1_arm_1")
178+ '...'
179+ """
180+ # pylint: enable=line-too-long
181+ payload = self ._initialize_payload (
182+ content = "surveyReturnCode" ,
183+ # Hard-coded due to the nature of the response
184+ return_format_type = "csv" ,
185+ )
186+
187+ payload ["record" ] = record
188+ payload ["instrument" ] = instrument
189+ payload ["repeat_instance" ] = repeat_instance
190+
191+ if event :
192+ payload ["event" ] = event
193+
194+ return cast (str , self ._call_api (payload , return_type = "str" ))
195+
145196 def export_survey_participant_list (
146197 self ,
147198 instrument : str ,
0 commit comments