def get_all_rows(self): """ Rows to appear in the "Subjects" sheet of export_table(). CdiscOdmExportWriter will render this using the odm_export.xml template to combine subjects into a single ODM XML document. The values are also used to register new subjects if the web service is enabled. """ audit_log_id_ref = {'id': 0} # To exclude audit logs, set `custom.openclinica.const.AUDIT_LOGS = False` query = self._build_query().case_type(CC_SUBJECT_CASE_TYPE).start(0).size(SIZE_LIMIT) rows = [] for result in query.scroll(): case = CommCareCase.wrap(result) if not self.is_subject_selected(case): continue subject = Subject.wrap(case, audit_log_id_ref) row = [ 'SS_' + subject.subject_key, # OpenClinica prefixes subject key with "SS_" to make the OID subject.study_subject_id, subject.enrollment_date, subject.sex, subject.dob, subject.get_export_data(), ] rows.append(row) return rows
def rows(self): audit_log_id_ref = {'id': 0} # To exclude audit logs, set `custom.openclinica.const.AUDIT_LOGS = False` for res in self.es_results['hits'].get('hits', []): case = CommCareCase.wrap(res['_source']) if not self.is_subject_selected(case): continue subject = Subject.wrap(case, audit_log_id_ref) row = [ subject.subject_key, # What OpenClinica refers to as Person ID; i.e. OID with the "SS_" prefix subject.study_subject_id, subject.enrollment_date, subject.sex, subject.dob, subject.get_report_events(), ] yield row
def rows(self): audit_log_id_ref = {'id': 0} # To exclude audit logs, set `custom.openclinica.const.AUDIT_LOGS = False` query = self._build_query().case_type(CC_SUBJECT_CASE_TYPE) for result in query.scroll(): case = CommCareCase.wrap(result) if not self.is_subject_selected(case): continue subject = Subject.wrap(case, audit_log_id_ref) row = [ subject.subject_key, # What OpenClinica refers to as Person ID; i.e. OID with the "SS_" prefix subject.study_subject_id, subject.enrollment_date, subject.sex, subject.dob, subject.get_report_events(), ] yield row
def get_all_rows(self): """ Rows to appear in the "Subjects" sheet of export_table(). CdiscOdmExportWriter will render this using the odm_export.xml template to combine subjects into a single ODM XML document. """ audit_log_id_ref = {'id': 0} # To exclude audit logs, set `custom.openclinica.const.AUDIT_LOGS = False` query = self._build_query().start(0).size(SIZE_LIMIT) for result in query.scroll(): case = CommCareCase.wrap(result) if not self.is_subject_selected(case): continue subject = Subject.wrap(case, audit_log_id_ref) row = [ 'SS_' + subject.subject_key, # OpenClinica prefixes subject key with "SS_" to make the OID subject.study_subject_id, subject.get_export_data(), ] yield row