open questions from file research skill answer edit its answer from question 1 to 39 and take the answers from the research final open docs and then aje a new file
python3 -c " from docx import Document # Read Research Skills Answers.docx doc = Document('/tmp/workspace/attachments/e2bc6853-e80b-4898-98b9-0b8af4a713b8/Research Skills Answers.docx') print('=== RESEARCH SKILLS ANSWERS ===') for i, p in enumerate(doc.paragraphs): if p.text.strip(): print(f'[{p.style.name}] {p.text}') " 2>&1 | head -300
python3 -c " from docx import Document # Read Research finals open (2).docx doc = Document('/tmp/workspace/attachments/e2bc6853-e80b-4898-98b9-0b8af4a713b8/Research finals open (2).docx') print('=== RESEARCH FINALS OPEN ===') for i, p in enumerate(doc.paragraphs): if p.text.strip(): print(f'[{p.style.name}] {p.text}') " 2>&1 | head -300
python3 -c " from docx import Document # Get question headings from Research Skills Answers doc = Document('/tmp/workspace/attachments/e2bc6853-e80b-4898-98b9-0b8af4a713b8/Research Skills Answers.docx') print('=== HEADINGS (Questions) from Research Skills Answers ===') for i, p in enumerate(doc.paragraphs): if p.style.name == 'Heading 1': print(f'IDX {i}: {p.text}') " 2>&1
python3 << 'PYEOF' from docx import Document from docx.shared import Pt, RGBColor from docx.oxml.ns import qn import copy # ── Load source files ────────────────────────────────────────────────────────── rsa = Document('/tmp/workspace/attachments/e2bc6853-e80b-4898-98b9-0b8af4a713b8/Research Skills Answers.docx') rfo = Document('/tmp/workspace/attachments/e2bc6853-e80b-4898-98b9-0b8af4a713b8/Research finals open (2).docx') # ── Extract paragraphs from Research Finals Open grouped by question number ──── # We'll iterate all paragraphs and group them by question block (1-39) rfo_paras = [p for p in rfo.paragraphs] # Find each question block in rfo: question number line + subsequent answer lines # Questions in rfo start with "1. ", "2. ", etc. import re # Build a dict: question_num -> list of paragraph objects (question line + answer lines) rfo_questions = {} current_q = None for p in rfo_paras: text = p.text.strip() m = re.match(r'^(\d+)\.\s+', text) if m: qnum = int(m.group(1)) if 1 <= qnum <= 39: current_q = qnum rfo_questions[current_q] = [p] elif current_q is not None and current_q <= 39 and text: rfo_questions[current_q].append(p) elif current_q is not None and current_q <= 39: # empty line — still append to preserve spacing if needed pass # Show what we captured for k in sorted(rfo_questions.keys()): print(f"Q{k}: {len(rfo_questions[k])} paragraphs") for pp in rfo_questions[k][:2]: print(f" [{pp.style.name}] {pp.text[:80]}") PYEOF
mkdir -p /tmp/workspace/research-output && python3 << 'PYEOF' from docx import Document from docx.shared import Pt, RGBColor, Inches from docx.oxml.ns import qn from docx.oxml import OxmlElement import copy, re # ── Load source files ────────────────────────────────────────────────────────── rsa = Document('/tmp/workspace/attachments/e2bc6853-e80b-4898-98b9-0b8af4a713b8/Research Skills Answers.docx') rfo = Document('/tmp/workspace/attachments/e2bc6853-e80b-4898-98b9-0b8af4a713b8/Research finals open (2).docx') # ── Extract RFO paragraphs, group by question 1-39 ──────────────────────────── rfo_paras = list(rfo.paragraphs) # Build blocks: find start index of each Q1-Q39 and the next Q after it starts = {} # qnum -> index in rfo_paras for i, p in enumerate(rfo_paras): m = re.match(r'^(\d+)\.\s+', p.text.strip()) if m: qnum = int(m.group(1)) if 1 <= qnum <= 39: starts[qnum] = i # For each Q, take paragraphs from its start up to (but not including) next Q's start rfo_questions = {} sorted_qs = sorted(starts.keys()) for idx, qnum in enumerate(sorted_qs): start = starts[qnum] if idx + 1 < len(sorted_qs): end = starts[sorted_qs[idx + 1]] else: end = len(rfo_paras) # last question — take to end # Skip the question-line itself (first para), keep the answer paragraphs answer_paras = rfo_paras[start + 1 : end] # Strip trailing empty paragraphs while answer_paras and not answer_paras[-1].text.strip(): answer_paras.pop() rfo_questions[qnum] = answer_paras print("RFO question blocks (answer para counts):") for k in sorted(rfo_questions.keys()): print(f" Q{k}: {len(rfo_questions[k])} answer paras") PYEOF
python3 << 'PYEOF' from docx import Document import re rfo = Document('/tmp/workspace/attachments/e2bc6853-e80b-4898-98b9-0b8af4a713b8/Research finals open (2).docx') rfo_paras = list(rfo.paragraphs) # Find Q39 and Q40 for i, p in enumerate(rfo_paras): m = re.match(r'^(39|40|41)\.\s+', p.text.strip()) if m: print(f"idx {i}: {p.text[:100]}") # Show what follows Q39 starts = {} for i, p in enumerate(rfo_paras): m = re.match(r'^(\d+)\.\s+', p.text.strip()) if m: qnum = int(m.group(1)) starts[qnum] = i q39_start = starts.get(39) q40_start = starts.get(40) print(f"\nQ39 starts at index {q39_start}, Q40 at {q40_start}") if q39_start: print("Q39 answer paras:") end = q40_start if q40_start else q39_start + 10 for p in rfo_paras[q39_start+1:end]: print(f" [{p.style.name}] {p.text[:80]}") PYEOF
python3 << 'PYEOF' from docx import Document from docx.shared import Pt, RGBColor, Inches from docx.oxml.ns import qn from docx.oxml import OxmlElement import copy, re # ── Load source files ────────────────────────────────────────────────────────── rsa = Document('/tmp/workspace/attachments/e2bc6853-e80b-4898-98b9-0b8af4a713b8/Research Skills Answers.docx') rfo = Document('/tmp/workspace/attachments/e2bc6853-e80b-4898-98b9-0b8af4a713b8/Research finals open (2).docx') rfo_paras = list(rfo.paragraphs) # Build index of all question starts (including Q40+ as boundaries) starts = {} for i, p in enumerate(rfo_paras): m = re.match(r'^(\d+)\.\s+', p.text.strip()) if m: qnum = int(m.group(1)) starts[qnum] = i # Extract answer blocks for Q1-Q39 (bounded by the next question start) rfo_questions = {} sorted_qs = sorted(starts.keys()) for idx, qnum in enumerate(sorted_qs): if qnum < 1 or qnum > 39: continue start = starts[qnum] # Find the next question (any number) after this one next_q_start = None for jdx in range(idx + 1, len(sorted_qs)): next_q_start = starts[sorted_qs[jdx]] break end = next_q_start if next_q_start else start + 20 answer_paras = rfo_paras[start + 1 : end] # Strip trailing empty paragraphs while answer_paras and not answer_paras[-1].text.strip(): answer_paras.pop() rfo_questions[qnum] = answer_paras # ── Extract questions 1-39 from RSA (their heading text) ───────────────────── # The headings ARE the questions; we need the first 39 Heading 1 paragraphs rsa_headings = [] for p in rsa.paragraphs: if p.style.name == 'Heading 1' and p.text.strip(): rsa_headings.append(p.text.strip()) print(f"Total headings in RSA: {len(rsa_headings)}") for i, h in enumerate(rsa_headings[:39]): print(f" {i+1}. {h[:70]}") PYEOF
python3 << 'PYEOF' from docx import Document from docx.shared import Pt, RGBColor, Inches from docx.oxml.ns import qn from docx.oxml import OxmlElement import copy, re # ── Load source files ────────────────────────────────────────────────────────── rsa = Document('/tmp/workspace/attachments/e2bc6853-e80b-4898-98b9-0b8af4a713b8/Research Skills Answers.docx') rfo = Document('/tmp/workspace/attachments/e2bc6853-e80b-4898-98b9-0b8af4a713b8/Research finals open (2).docx') rfo_paras = list(rfo.paragraphs) # Build index of all question starts starts = {} for i, p in enumerate(rfo_paras): m = re.match(r'^(\d+)\.\s+', p.text.strip()) if m: qnum = int(m.group(1)) starts[qnum] = i # Extract answer blocks for Q1-Q39, bounded by next question start rfo_answers = {} sorted_qs = sorted(starts.keys()) for idx, qnum in enumerate(sorted_qs): if qnum < 1 or qnum > 39: continue start = starts[qnum] # find the next question start (of any Q number) next_start = None for j in sorted_qs[idx + 1:]: next_start = starts[j] break end = next_start if next_start else start + 30 paras = rfo_paras[start + 1 : end] while paras and not paras[-1].text.strip(): paras.pop() rfo_answers[qnum] = paras # ── Get RSA question headings (first 39) ────────────────────────────────────── rsa_headings = [] for p in rsa.paragraphs: if p.style.name == 'Heading 1' and p.text.strip(): rsa_headings.append(p.text.strip()) rsa_headings_39 = rsa_headings[:39] # ── Helper: copy paragraph XML into new doc ─────────────────────────────────── def add_para_from(new_doc, src_para): """Clone a paragraph's XML element into new_doc's body.""" new_para = copy.deepcopy(src_para._element) new_doc.element.body.append(new_para) # ── Build new document ──────────────────────────────────────────────────────── new_doc = Document() # Apply title title_para = new_doc.add_paragraph() title_run = title_para.add_run("Research Skills — Questions 1–39 with Updated Answers") title_run.bold = True title_run.font.size = Pt(16) title_run.font.color.rgb = RGBColor(0x1F, 0x49, 0x7D) title_para.style = new_doc.styles['Title'] new_doc.add_paragraph() # spacer for i, question_text in enumerate(rsa_headings_39): q_num = i + 1 # Question heading h = new_doc.add_heading(f"{q_num}. {question_text}", level=1) # Style the heading text for run in h.runs: run.font.color.rgb = RGBColor(0x2E, 0x74, 0xB5) # Answer paragraphs from RFO if q_num in rfo_answers and rfo_answers[q_num]: for src_p in rfo_answers[q_num]: add_para_from(new_doc, src_p) else: # No answer found — add placeholder new_doc.add_paragraph("[No answer available in source file for this question]") new_doc.add_paragraph() # spacer between questions output_path = '/tmp/workspace/research-output/Research_Skills_Q1-39_Updated_Answers.docx' new_doc.save(output_path) print(f"Saved to: {output_path}") # Verify check = Document(output_path) headings = [p.text for p in check.paragraphs if 'Heading' in p.style.name] print(f"Total headings in new doc: {len(headings)}") for h in headings[:5]: print(f" {h}") PYEOF
python3 << 'PYEOF' from docx import Document doc = Document('/tmp/workspace/research-output/Research_Skills_Q1-39_Updated_Answers.docx') # Print first few Q+A pairs to verify current_heading = None para_count = 0 shown = 0 for p in doc.paragraphs: text = p.text.strip() if not text: continue if 'Heading' in p.style.name: if current_heading and shown < 5: print(f" [{para_count} answer paras]\n") current_heading = text para_count = 0 shown += 1 if shown <= 5: print(f"Q: {text}") else: para_count += 1 if shown <= 5 and para_count <= 3: print(f" A: {text[:90]}") print(f"\nTotal shown headings: {shown}") PYEOF
python3 << 'PYEOF' from docx import Document from docx.shared import Pt, RGBColor from docx.oxml import OxmlElement from docx.oxml.ns import qn import copy, re # ── Load sources ─────────────────────────────────────────────────────────────── rsa = Document('/tmp/workspace/attachments/e2bc6853-e80b-4898-98b9-0b8af4a713b8/Research Skills Answers.docx') rfo = Document('/tmp/workspace/attachments/e2bc6853-e80b-4898-98b9-0b8af4a713b8/Research finals open (2).docx') rfo_paras = list(rfo.paragraphs) # Build question-start index for RFO starts = {} for i, p in enumerate(rfo_paras): m = re.match(r'^(\d+)\.\s+', p.text.strip()) if m: starts[int(m.group(1))] = i sorted_qs = sorted(starts.keys()) # Extract answer text blocks Q1-Q39 # Each entry: list of (text, style_name, is_bold_run, is_list) rfo_answers = {} for idx, qnum in enumerate(sorted_qs): if qnum < 1 or qnum > 39: continue start = starts[qnum] next_start = starts[sorted_qs[idx + 1]] if idx + 1 < len(sorted_qs) else start + 40 raw = rfo_paras[start + 1 : next_start] while raw and not raw[-1].text.strip(): raw.pop() rfo_answers[qnum] = raw # ── Get RSA question headings (first 39) ────────────────────────────────────── rsa_headings_39 = [p.text.strip() for p in rsa.paragraphs if p.style.name == 'Heading 1' and p.text.strip()][:39] # ── Build new document ──────────────────────────────────────────────────────── new_doc = Document() # Set default style style = new_doc.styles['Normal'] style.font.name = 'Arial' style.font.size = Pt(11) # Document title t = new_doc.add_paragraph() t.style = new_doc.styles['Normal'] run = t.add_run("Research Skills — Questions 1–39 with Updated Answers") run.bold = True run.font.size = Pt(16) run.font.color.rgb = RGBColor(0x1F, 0x49, 0x7D) new_doc.add_paragraph() def copy_paragraph_to_doc(new_doc, src_para): """ Add a new paragraph to new_doc that copies the text and basic formatting from src_para. Uses add_paragraph for proper body placement. """ # Determine if it's a list item (bullet) style_name = src_para.style.name if src_para.style else 'Normal' # Map styles from source to destination if style_name in ('List Paragraph', 'List Bullet', 'List Number'): dest_style = 'List Bullet' elif style_name in ('Body Text',): dest_style = 'Normal' elif 'Heading' in style_name: level = int(style_name[-1]) if style_name[-1].isdigit() else 2 p = new_doc.add_heading('', level=min(level, 4)) # clear auto run and add text for run in p.runs: run.text = '' p.clear() run = p.add_run(src_para.text) return else: dest_style = 'Normal' # Try to use the style if it exists in new_doc if dest_style not in [s.name for s in new_doc.styles]: dest_style = 'Normal' p = new_doc.add_paragraph(style=dest_style) # Copy runs with formatting for src_run in src_para.runs: r = p.add_run(src_run.text) r.bold = src_run.bold r.italic = src_run.italic r.underline = src_run.underline if src_run.font.size: r.font.size = src_run.font.size if src_run.font.color and src_run.font.color.type is not None: try: r.font.color.rgb = src_run.font.color.rgb except Exception: pass # If no runs, just set text if not src_para.runs and src_para.text: p.add_run(src_para.text) for i, question_text in enumerate(rsa_headings_39): q_num = i + 1 # Question heading h = new_doc.add_heading(f"{q_num}. {question_text}", level=1) # Answer from RFO if q_num in rfo_answers and rfo_answers[q_num]: for src_p in rfo_answers[q_num]: if src_p.text.strip(): copy_paragraph_to_doc(new_doc, src_p) else: new_doc.add_paragraph("[No matching answer found in Research Finals Open]") # spacer new_doc.add_paragraph() output_path = '/tmp/workspace/research-output/Research_Skills_Q1-39_Updated_Answers.docx' new_doc.save(output_path) print(f"Saved: {output_path}") # Verify check = Document(output_path) all_p = [p for p in check.paragraphs if p.text.strip()] print(f"Total non-empty paragraphs: {len(all_p)}") # Show first Q+A in_q1 = False for p in all_p: if '1. What constitutes' in p.text: in_q1 = True if in_q1: print(f" [{p.style.name}] {p.text[:90]}") if in_q1 and '2. Aim of' in p.text: break PYEOF
python3 << 'PYEOF' from docx import Document doc = Document('/tmp/workspace/research-output/Research_Skills_Q1-39_Updated_Answers.docx') headings = [(p.text, p.style.name) for p in doc.paragraphs if 'Heading' in p.style.name and p.text.strip()] print(f"Total headings: {len(headings)}") for h in headings: print(f" {h[0][:80]}") PYEOF
Research Skills Q1 39 Updated Answers
Word Document · DOCX
check again u have wrote incoorect ans questoion is saying somwthng else and u have written somethung ekse im saying again edit the answer from 1 to 39 and for those extract the answers from thr finals pdf
python3 << 'PYEOF' from docx import Document # Read Research Skills Answers - show ALL content with index rsa = Document('/tmp/workspace/attachments/e2bc6853-e80b-4898-98b9-0b8af4a713b8/Research Skills Answers.docx') print('=== RESEARCH SKILLS ANSWERS (full structure) ===') for i, p in enumerate(rsa.paragraphs): if p.text.strip(): print(f'[{i}][{p.style.name}] {p.text[:100]}') PYEOF
python3 << 'PYEOF' from docx import Document # Read Research Finals Open - show ALL content with index rfo = Document('/tmp/workspace/attachments/e2bc6853-e80b-4898-98b9-0b8af4a713b8/Research finals open (2).docx') print('=== RESEARCH FINALS OPEN (full structure) ===') for i, p in enumerate(rfo.paragraphs): if p.text.strip(): print(f'[{i}][{p.style.name}] {p.text[:120]}') PYEOF
python3 << 'PYEOF' # Let me map RSA questions to matching RFO questions by topic # RSA headings (1-39): rsa_questions = [ (1, "What constitutes a literature review?"), (2, "Aim of the information handling process and information literacy"), (3, "Primary, secondary, and tertiary literature"), (4, "Systematic reviews and meta-analysis"), (5, "When and why use Boolean operators?"), (6, "6. Expanding and narrowing the literature search"), (7, "Impact factor"), (8, "Personal reference databases"), (9, "Salami vs. duplicate publications"), (10, "Falsification vs. fabrication"), (11, "Main types of authorship misconduct"), (12, "Main aspects of an experimental protocol"), (13, "Principal points of a research protocol"), (14, "Characteristics of the research hypothesis"), (15, "1C. Types of research hypotheses"), (16, "Definitions of epidemiology"), (17, "Research strategy using a historical control group"), (18, "Role of epidemiology"), (19, "Steps of the research process (in order)"), (20, "Main aspects of an informed consent document"), (21, "Characteristics of a well-conceived research problem"), (22, "Animal ethics — the 3Rs"), (23, "Null hypothesis and alternative hypothesis relationship"), (24, "Sampling differences: qualitative vs. quantitative"), (25, "2C. Bradford Hill criteria of causality (4–5 examples)"), (26, "Ethical theories used in research"), (27, "Negative predictive value (NPV)"), (28, "Basic (fundamental) research"), (29, "Cohort vs. case-control studies"), (30, "Sensitivity and specificity"), (31, "Historical control groups and cohort study limitations"), (32, "Unequal group size effects in clinical research"), (33, "Elements in sample size calculation"), (34, "Power of study"), (35, "3C. Why keywords are needed in literature searching"), (36, "Subject headings vs. keywords"), (37, "Observational vs. experimental studies"), (38, "What is a placebo?"), (39, "What should be explained in informed consent"), ] # RFO questions and their numbers: rfo_questions = [ (1, "What are the different types of research?"), (2, "What is basic (fundamental) research?"), (3, "Explain scientific vs. non-scientific approaches."), (4, "Explain observational and experimental studies."), (5, "Explain the importance of research results in observational and experimental studies."), (6, "What are the types/designs of observational epidemiological studies?"), (7, "What are longitudinal studies?"), (8, "What are randomized controlled trials (RCTs)?"), (9, "What are the advantages and disadvantages of prospective cohort studies?"), (10, "What are the characteristics of a well-conceived research problem?"), (11, "What are the essential considerations/criteria when improving or refining a research question?"), (12, "What are the Tuckman characteristics (five principles) of research?"), (13, "Why are most research results in emerging fields false?"), (14, "What is a research hypothesis?"), (15, "How is the null hypothesis related to the alternative hypothesis?"), (16, "What is the power of a study in relation to the null and alternative hypothesis?"), (17, "What are variables and what do they indicate about a research hypothesis?"), (18, "What are the requirements/components of a research protocol?"), (19, "What is a research protocol and what does it indicate about the research?"), (20, "What are the components of the Introduction section of a scientific research paper?"), (21, "What is a literature search and how can it be expanded or narrowed?"), (22, "What are Boolean operators (AND, OR, NOT)?"), (23, "What is a research database and what is its purpose?"), (24, "What is a systematic review and what is a meta-analysis?"), (25, "Describe the types of data and explain the difference between categorical and numerical data."), (26, "When are non-parametric tests used?"), (27, "What are non-parametric methods?"), (28, "What is positive predictive value (PPV)?"), (29, "What is negative predictive value (NPV)?"), (30, "What is the impact factor and how is it calculated?"), (31, "List all nine Bradford Hill criteria for causality."), (32, "Explain qualitative vs. quantitative research."), (33, "How does sampling differ between qualitative and quantitative research?"), (34, "What are the limitations of qualitative studies?"), (35, "What are the advantages and disadvantages of animal experimentation?"), (36, "What are the basic principles of human research ethics (IRB ethical principles)?"), (37, "Explain autonomy."), (38, "Explain the moral foundations/backgrounds of ethical theories."), (39, "Explain the moral background of consequentialism."), (40, "What is deontological ethics?"), (41, "What is virtue ethics?"), (42, "What are the theories of truth?"), (43, "What are the moral conditions regarding ethical values?"), (44, "What constitutes research/authorship misconduct?"), (45, "Name five types of authorship misconduct."), (46, "Explain the ICMJE authorship rules."), (47, "What is blinding? Explain its types and importance."), (48, "What is placebo and what is its significance?"), (49, "What is the aim of the information-handling process and information literacy?"), (50, "What constitutes a literature review?"), (51, "Explain primary, secondary, and tertiary literature resources."), (52, "What is a personal reference database?"), (53, "What distinguishes duplicate publication from salami publication?"), (54, "What distinguishes falsification from fabrication?"), (55, "Order the steps of the research process."), (56, "What are the characteristics of a research hypothesis?"), (57, "What are the types of research hypotheses?"), (58, "Provide some definitions of epidemiology."), (59, "Discuss the role of epidemiology."), (60, "Historical control group – definition, when used, and limitations."), (61, "What are the elements in sample size calculation?"), (62, "What is the importance of keywords in literature searching?"), (63, "What are the essential parts of volunteering?"), (64, "What is the role of a Research Ethics Committee (REC/IRB)?"), (65, "What are the basic principles of human research ethics according to the Belmont Report?"), (66, "What is the purpose of randomization?"), (67, "Explain randomization and its types."), (68, "What is a non-inferiority study?"), (71, "What are the types of comparative studies?"), (72, "Explain parallel and crossover group studies."), (73, "What are common methods for qualitative data collection?"), (74, "Explain clinical phases of new drug development."), (75, "What is misconduct in observership?"), (77, "What are necessary and sufficient conditions for disease development?"), (78, "Explain the difference between subject headings and keywords and their importance."), (80, "Describe the main aspects of an experimental protocol."), (81, "Describe the main aspects of an informed consent document."), (82, "Explain animal ethics and the fundamental concepts of animal research ethics (3Rs)."), (83, "Describe 4–5 Bradford Hill criteria of causality with examples."), (84, "Advantages and disadvantages of cohort and case-control studies."), (85, "Criteria to assess a medical test: sensitivity and specificity."), (86, "How do unequal group sizes affect clinical research?"), ] # Now manually map RSA Q -> best matching RFO Q mapping = { 1: 50, # "What constitutes a literature review?" -> RFO 50 2: 49, # "Aim of information handling process..." -> RFO 49 3: 51, # "Primary, secondary, tertiary literature" -> RFO 51 4: 24, # "Systematic reviews and meta-analysis" -> RFO 24 5: 22, # "Boolean operators" -> RFO 22 6: 21, # "Expanding and narrowing literature search" -> RFO 21 7: 30, # "Impact factor" -> RFO 30 8: 52, # "Personal reference databases" -> RFO 52 9: 53, # "Salami vs duplicate" -> RFO 53 10: 54, # "Falsification vs fabrication" -> RFO 54 11: 45, # "Main types of authorship misconduct" -> RFO 45 12: 80, # "Main aspects of experimental protocol" -> RFO 80 13: 18, # "Principal points of research protocol" -> RFO 18 (components) or 19 14: 56, # "Characteristics of research hypothesis" -> RFO 56 15: 57, # "Types of research hypotheses" -> RFO 57 16: 58, # "Definitions of epidemiology" -> RFO 58 17: 60, # "Research strategy using historical control group" -> RFO 60 18: 59, # "Role of epidemiology" -> RFO 59 19: 55, # "Steps of research process" -> RFO 55 20: 81, # "Main aspects of informed consent document" -> RFO 81 21: 10, # "Characteristics of well-conceived research problem" -> RFO 10 22: 82, # "Animal ethics — 3Rs" -> RFO 82 23: 15, # "Null hypothesis and alternative hypothesis relationship" -> RFO 15 24: 33, # "Sampling differences qualitative vs quantitative" -> RFO 33 25: 83, # "Bradford Hill criteria 4-5 examples" -> RFO 83 26: 38, # "Ethical theories used in research" -> RFO 38 27: 29, # "Negative predictive value (NPV)" -> RFO 29 28: 2, # "Basic (fundamental) research" -> RFO 2 29: 84, # "Cohort vs case-control studies" -> RFO 84 30: 85, # "Sensitivity and specificity" -> RFO 85 31: 60, # "Historical control groups and cohort study limitations" -> RFO 60 32: 86, # "Unequal group size effects" -> RFO 86 33: 61, # "Elements in sample size calculation" -> RFO 61 34: 16, # "Power of study" -> RFO 16 35: 62, # "Why keywords needed in literature searching" -> RFO 62 36: 78, # "Subject headings vs keywords" -> RFO 78 37: 4, # "Observational vs experimental studies" -> RFO 4 38: 48, # "What is a placebo?" -> RFO 48 39: 81, # "What should be explained in informed consent" -> RFO 81 } for rsa_q, rfo_q in mapping.items(): rsa_title = rsa_questions[rsa_q-1][1] rfo_title = next((t for n, t in rfo_questions if n == rfo_q), "NOT FOUND") print(f"RSA Q{rsa_q}: {rsa_title[:55]}") print(f" -> RFO Q{rfo_q}: {rfo_title[:55]}") print() PYEOF
python3 << 'PYEOF' from docx import Document from docx.shared import Pt, RGBColor import re, copy # ── Load sources ─────────────────────────────────────────────────────────────── rsa = Document('/tmp/workspace/attachments/e2bc6853-e80b-4898-98b9-0b8af4a713b8/Research Skills Answers.docx') rfo = Document('/tmp/workspace/attachments/e2bc6853-e80b-4898-98b9-0b8af4a713b8/Research finals open (2).docx') rfo_paras = list(rfo.paragraphs) # Build question-start index for ALL RFO questions starts = {} for i, p in enumerate(rfo_paras): m = re.match(r'^(\d+)\.\s+', p.text.strip()) if m: starts[int(m.group(1))] = i sorted_q_nums = sorted(starts.keys()) def get_rfo_answer(qnum): """Return list of answer paragraphs for RFO question number.""" if qnum not in starts: return [] start = starts[qnum] # Find next question's start next_start = None for n in sorted_q_nums: if n > qnum: next_start = starts[n] break end = next_start if next_start else start + 40 paras = rfo_paras[start + 1 : end] while paras and not paras[-1].text.strip(): paras.pop() return paras # ── Mapping: RSA question index (1-39) -> RFO question number ───────────────── mapping = { 1: 50, 2: 49, 3: 51, 4: 24, 5: 22, 6: 21, 7: 30, 8: 52, 9: 53, 10: 54, 11: 45, 12: 80, 13: 18, 14: 56, 15: 57, 16: 58, 17: 60, 18: 59, 19: 55, 20: 81, 21: 10, 22: 82, 23: 15, 24: 33, 25: 83, 26: 38, 27: 29, 28: 2, 29: 84, 30: 85, 31: 60, 32: 86, 33: 61, 34: 16, 35: 62, 36: 78, 37: 4, 38: 48, 39: 81, } # ── Get RSA headings (the questions 1-39) ───────────────────────────────────── rsa_headings = [p.text.strip() for p in rsa.paragraphs if p.style.name == 'Heading 1' and p.text.strip()][:39] # ── Build new document ──────────────────────────────────────────────────────── new_doc = Document() # Title title_para = new_doc.add_paragraph() run = title_para.add_run("Research Skills — Questions 1–39 with Answers from Research Finals Open") run.bold = True run.font.size = Pt(16) run.font.color.rgb = RGBColor(0x1F, 0x49, 0x7D) new_doc.add_paragraph() def copy_para_content(new_doc, src_para): """Add a paragraph to new_doc copying text and run-level formatting from src_para.""" style_name = src_para.style.name if src_para.style else 'Normal' if style_name in ('List Paragraph', 'List Bullet', 'List Number'): dest_style = 'List Bullet' else: dest_style = 'Normal' p = new_doc.add_paragraph(style=dest_style) if src_para.runs: for src_run in src_para.runs: r = p.add_run(src_run.text) r.bold = src_run.bold r.italic = src_run.italic r.underline = src_run.underline try: if src_run.font.size: r.font.size = src_run.font.size except Exception: pass else: # No runs — just set raw text if src_para.text: p.add_run(src_para.text) for i, question_text in enumerate(rsa_headings): rsa_qnum = i + 1 rfo_qnum = mapping.get(rsa_qnum) # Question heading h = new_doc.add_heading(f"{rsa_qnum}. {question_text}", level=1) # Fetch answer from RFO answer_paras = get_rfo_answer(rfo_qnum) if rfo_qnum else [] if answer_paras: for src_p in answer_paras: if src_p.text.strip(): copy_para_content(new_doc, src_p) else: new_doc.add_paragraph("[Answer not available in source file]") new_doc.add_paragraph() # spacer output_path = '/tmp/workspace/research-output/Research_Skills_Q1-39_Corrected_Answers.docx' new_doc.save(output_path) print(f"Saved: {output_path}") # ── Quick verification ──────────────────────────────────────────────────────── check = Document(output_path) all_paras = [p for p in check.paragraphs if p.text.strip()] headings = [p.text for p in all_paras if 'Heading' in p.style.name] print(f"Total headings: {len(headings)}") print(f"Total non-empty paras: {len(all_paras)}") # Show a few Q+A samples print("\n--- SAMPLE CONTENT ---") current_h = None count = 0 for p in all_paras: if 'Heading' in p.style.name: current_h = p.text count = 0 print(f"\nQ: {p.text}") else: count += 1 if count <= 4: print(f" {p.text[:100]}") if current_h and '5.' in current_h and count > 4: break PYEOF
python3 << 'PYEOF' from docx import Document import re rfo = Document('/tmp/workspace/attachments/e2bc6853-e80b-4898-98b9-0b8af4a713b8/Research finals open (2).docx') rfo_paras = list(rfo.paragraphs) # Check if Q50 is found starts = {} for i, p in enumerate(rfo_paras): m = re.match(r'^(\d+)\.\s+', p.text.strip()) if m: starts[int(m.group(1))] = i print("Q50 in starts?", 50 in starts) if 50 in starts: idx = starts[50] print(f"Q50 idx={idx}: {rfo_paras[idx].text}") for p in rfo_paras[idx:idx+10]: print(f" {p.text[:100]}") # Also check what number 50 looks like in the doc for i, p in enumerate(rfo_paras): if '50' in p.text[:5]: print(f"idx {i}: {p.text[:100]}") break PYEOF
python3 << 'PYEOF' from docx import Document from docx.shared import Pt, RGBColor import re rfo = Document('/tmp/workspace/attachments/e2bc6853-e80b-4898-98b9-0b8af4a713b8/Research finals open (2).docx') rfo_paras = list(rfo.paragraphs) # Fix regex - allow optional period: "50 " or "50. " starts = {} for i, p in enumerate(rfo_paras): m = re.match(r'^(\d+)\.?\s+', p.text.strip()) if m: qnum = int(m.group(1)) if qnum not in starts: # first occurrence wins starts[qnum] = i sorted_q_nums = sorted(starts.keys()) print(f"Total questions found: {len(sorted_q_nums)}") print(f"Q50 found: {50 in starts}, idx: {starts.get(50)}") print(f"Q49 found: {49 in starts}, idx: {starts.get(49)}") print(f"Q51 found: {51 in starts}, idx: {starts.get(51)}") # Check Q50 content if 50 in starts: idx = starts[50] next_q = next((starts[n] for n in sorted_q_nums if n > 50), idx + 10) print(f"\nQ50 answer paras ({idx+1} to {next_q}):") for p in rfo_paras[idx+1:next_q]: if p.text.strip(): print(f" {p.text[:90]}") PYEOF
python3 << 'PYEOF' from docx import Document from docx.shared import Pt, RGBColor import re # ── Load sources ─────────────────────────────────────────────────────────────── rsa = Document('/tmp/workspace/attachments/e2bc6853-e80b-4898-98b9-0b8af4a713b8/Research Skills Answers.docx') rfo = Document('/tmp/workspace/attachments/e2bc6853-e80b-4898-98b9-0b8af4a713b8/Research finals open (2).docx') rfo_paras = list(rfo.paragraphs) # Build RFO question index (allow optional period after number) starts = {} for i, p in enumerate(rfo_paras): m = re.match(r'^(\d+)\.?\s+\S', p.text.strip()) if m: qnum = int(m.group(1)) if qnum not in starts: starts[qnum] = i sorted_q_nums = sorted(starts.keys()) def get_rfo_answer(qnum): if qnum not in starts: return [] start = starts[qnum] next_start = next((starts[n] for n in sorted_q_nums if n > qnum), start + 40) paras = rfo_paras[start + 1 : next_start] while paras and not paras[-1].text.strip(): paras.pop() return paras # Mapping RSA Q number (1-39) -> RFO Q number mapping = { 1: 50, # What constitutes a literature review? 2: 49, # Aim of information handling process and information literacy 3: 51, # Primary, secondary, tertiary literature 4: 24, # Systematic reviews and meta-analysis 5: 22, # Boolean operators 6: 21, # Expanding and narrowing literature search 7: 30, # Impact factor 8: 52, # Personal reference databases 9: 53, # Salami vs duplicate 10: 54, # Falsification vs fabrication 11: 45, # Main types of authorship misconduct 12: 80, # Main aspects of experimental protocol 13: 18, # Principal points of research protocol 14: 56, # Characteristics of research hypothesis 15: 57, # Types of research hypotheses 16: 58, # Definitions of epidemiology 17: 60, # Research strategy using historical control group 18: 59, # Role of epidemiology 19: 55, # Steps of research process 20: 81, # Main aspects of informed consent document 21: 10, # Characteristics of well-conceived research problem 22: 82, # Animal ethics — 3Rs 23: 15, # Null hypothesis and alternative hypothesis relationship 24: 33, # Sampling differences qualitative vs quantitative 25: 83, # Bradford Hill criteria 4-5 examples 26: 38, # Ethical theories used in research 27: 29, # Negative predictive value NPV 28: 2, # Basic (fundamental) research 29: 84, # Cohort vs case-control studies 30: 85, # Sensitivity and specificity 31: 60, # Historical control groups and cohort study limitations 32: 86, # Unequal group size effects 33: 61, # Elements in sample size calculation 34: 16, # Power of study 35: 62, # Why keywords needed in literature searching 36: 78, # Subject headings vs keywords 37: 4, # Observational vs experimental studies 38: 48, # What is a placebo? 39: 81, # What should be explained in informed consent } # Get RSA question headings (first 39) rsa_headings = [p.text.strip() for p in rsa.paragraphs if p.style.name == 'Heading 1' and p.text.strip()][:39] # ── Build new document ──────────────────────────────────────────────────────── new_doc = Document() style = new_doc.styles['Normal'] style.font.name = 'Arial' style.font.size = Pt(11) # Title t = new_doc.add_paragraph() run = t.add_run("Research Skills — Questions 1–39 with Answers from Research Finals Open") run.bold = True run.font.size = Pt(16) run.font.color.rgb = RGBColor(0x1F, 0x49, 0x7D) new_doc.add_paragraph() def copy_para(new_doc, src): style_name = src.style.name if src.style else 'Normal' if style_name in ('List Paragraph', 'List Bullet', 'List Number'): dest_style = 'List Bullet' else: dest_style = 'Normal' p = new_doc.add_paragraph(style=dest_style) if src.runs: for r in src.runs: nr = p.add_run(r.text) nr.bold = r.bold nr.italic = r.italic nr.underline = r.underline elif src.text: p.add_run(src.text) for i, qtxt in enumerate(rsa_headings): rsa_qnum = i + 1 rfo_qnum = mapping[rsa_qnum] # Heading new_doc.add_heading(f"{rsa_qnum}. {qtxt}", level=1) # Answer paragraphs from RFO answer_paras = get_rfo_answer(rfo_qnum) if answer_paras: for p in answer_paras: if p.text.strip(): copy_para(new_doc, p) else: new_doc.add_paragraph(f"[Source: RFO Q{rfo_qnum} — not found]") new_doc.add_paragraph() output_path = '/tmp/workspace/research-output/Research_Skills_Q1-39_Corrected_Answers.docx' new_doc.save(output_path) print(f"Saved: {output_path}") # Verify all 39 Q+A check = Document(output_path) all_paras = [p for p in check.paragraphs if p.text.strip()] # Print all Q headings + first 2 answer lines each cur_h = None ans_count = 0 missing = [] for p in all_paras: if 'Heading' in p.style.name: if cur_h and ans_count == 0: missing.append(cur_h) cur_h = p.text ans_count = 0 else: ans_count += 1 headings = [p.text for p in all_paras if 'Heading' in p.style.name] print(f"\nTotal Q headings: {len(headings)}") if missing: print(f"Questions with no answers: {missing}") else: print("All questions have answers!") # Print full content for Q1, Q7, Q10, Q20 as samples print("\n--- Q1 sample ---") in_q = False for p in all_paras: if '1. What constitutes' in p.text: in_q = True if in_q: print(f" {p.text[:100]}") if in_q and '2. Aim of' in p.text: break PYEOF
Research Skills Q1 39 Corrected Answers
Word Document · DOCX