write Abstract of this word document according to image uploaded for non dissertation research purpose
python3 -c " from docx import Document doc = Document('/tmp/workspace/attachments/e4c0cdf5-4071-41b7-ac33-d555893b9962/Title-1.docx') for p in doc.paragraphs: style = p.style.name if p.style else 'None' if p.text.strip(): print(f'[{style}] {p.text}') "
python3 -c " from docx import Document from docx.shared import Pt, RGBColor from docx.enum.text import WD_ALIGN_PARAGRAPH doc = Document('/tmp/workspace/attachments/e4c0cdf5-4071-41b7-ac33-d555893b9962/Title-1.docx') # Find a good place to insert abstract - after title, before introduction # We'll just print the structure to find where to add for i, p in enumerate(doc.paragraphs): if p.text.strip(): print(i, repr(p.text[:60])) "
python3 << 'EOF' import os import shutil from docx import Document from docx.shared import Pt, RGBColor from docx.enum.text import WD_ALIGN_PARAGRAPH from docx.oxml.ns import qn from docx.oxml import OxmlElement import copy src = '/tmp/workspace/attachments/e4c0cdf5-4071-41b7-ac33-d555893b9962/Title-1.docx' os.makedirs('/tmp/workspace/output/', exist_ok=True) dst = '/tmp/workspace/output/Title-1_with_abstract.docx' shutil.copy(src, dst) doc = Document(dst) abstract_heading = "ABSTRACT" abstract_body = ( "Background: Medical residency is a period of intense academic and clinical demands. " "Junior resident doctors are exposed to prolonged duty hours, sleep deprivation, high patient loads, " "and hierarchical institutional pressures, all of which are recognized antecedents of psychological " "stress. Stress, in turn, adversely affects subjective well-being and overall happiness. " "Despite this, data on the relationship between perceived stress and happiness among resident doctors " "in Indian settings remain limited.\n\n" "Aim: To assess the relationship between perceived stress and happiness among junior resident doctors " "at a tertiary care government medical college.\n\n" "Methods: An observational, cross-sectional study was conducted among all junior resident doctors " "enrolled at Dr Vaishampayan Memorial Government Medical College, Solapur. Sociodemographic data " "were collected using a structured proforma. Perceived stress was measured using the Perceived Stress " "Scale (PSS-10) developed by Cohen et al., which evaluates perceived unpredictability, lack of " "control, and overload over the preceding month. Happiness was assessed using the Oxford Happiness " "Questionnaire (OHQ), a 29-item instrument scored on a six-point Likert scale, with higher scores " "indicating greater subjective happiness. Statistical analysis will be performed to determine " "associations between perceived stress, happiness, and relevant sociodemographic variables.\n\n" "Expected Results: The study aims to document the prevalence and levels of perceived stress and " "happiness among junior residents, and to determine the strength and direction of their relationship. " "Factors such as year of residency, specialty, sleep duration, physical activity, and family support " "are expected to emerge as significant modifiers.\n\n" "Conclusion: Understanding the interplay between occupational stress and subjective happiness in " "resident doctors is essential for designing targeted institutional interventions. Findings from this " "study are expected to inform policies regarding resident welfare, duty hour regulations, and mental " "health support systems in Indian medical colleges.\n\n" "Keywords: Perceived stress, Happiness, Junior resident doctors, PSS-10, Oxford Happiness " "Questionnaire, Residency training, Medical education, Occupational stress." ) # Insert abstract after the title paragraph (index 0) # We need to add it before paragraph index 1 ('Introduction') # Get reference paragraph (Introduction heading, index 1 in filled paragraphs) # In the actual doc paragraphs list we need to find index 1 all_paras = doc.paragraphs # para 0 is title, para 1 is 'Introduction' intro_para = None for p in all_paras: if p.text.strip() == 'Introduction': intro_para = p break def insert_paragraph_before(ref_paragraph, text, style='Normal', bold_heading=False): """Insert a new paragraph before ref_paragraph.""" new_para = OxmlElement('w:p') ref_paragraph._element.addprevious(new_para) new_p = ref_paragraph._element.getprevious() # Create a proper paragraph using the document from docx.text.paragraph import Paragraph p_obj = Paragraph(new_para, ref_paragraph._parent) p_obj.style = doc.styles[style] run = p_obj.add_run(text) if bold_heading: run.bold = True run.font.size = Pt(12) return p_obj # Insert blank line then abstract body, then blank line, then heading # (insert in reverse order since each goes BEFORE intro_para) # 5. blank line after abstract insert_paragraph_before(intro_para, '', 'Normal') # 4. keywords line is already in abstract_body, just insert body # Split body by section for proper formatting sections = [ ("Background:", abstract_body.split("Aim:")[0].replace("Background:", "").strip()), ("Aim:", abstract_body.split("Methods:")[0].split("Aim:")[1].strip()), ("Methods:", abstract_body.split("Expected Results:")[0].split("Methods:")[1].strip()), ("Expected Results:", abstract_body.split("Conclusion:")[0].split("Expected Results:")[1].strip()), ("Conclusion:", abstract_body.split("Keywords:")[0].split("Conclusion:")[1].strip()), ("Keywords:", abstract_body.split("Keywords:")[1].strip()), ] # Insert in reverse order so they appear in correct sequence for label, content in reversed(sections): p = insert_paragraph_before(intro_para, '', 'Normal') run1 = p.add_run(label + " ") run1.bold = True run1.font.size = Pt(11) run2 = p.add_run(content) run2.bold = False run2.font.size = Pt(11) p.paragraph_format.space_after = Pt(4) # Insert abstract heading p_head = insert_paragraph_before(intro_para, '', 'Normal') run_h = p_head.add_run("ABSTRACT") run_h.bold = True run_h.font.size = Pt(13) p_head.alignment = WD_ALIGN_PARAGRAPH.CENTER p_head.paragraph_format.space_before = Pt(10) p_head.paragraph_format.space_after = Pt(8) doc.save(dst) print("Saved:", dst) EOF
python3 -c " from docx import Document doc = Document('/tmp/workspace/output/Title-1_with_abstract.docx') for p in doc.paragraphs[:30]: if p.text.strip(): print(repr(p.text[:100])) "
python3 << 'EOF' import os, shutil from docx import Document from docx.shared import Pt from docx.enum.text import WD_ALIGN_PARAGRAPH from docx.oxml import OxmlElement src = '/tmp/workspace/attachments/e4c0cdf5-4071-41b7-ac33-d555893b9962/Title-1.docx' dst = '/tmp/workspace/output/Title-1_with_abstract.docx' shutil.copy(src, dst) doc = Document(dst) # Find the Introduction paragraph intro_para = None for p in doc.paragraphs: if p.text.strip() == 'Introduction': intro_para = p break def insert_para_before(ref, bold_label, normal_text, font_size=11): """Insert a paragraph with a bold label + normal text BEFORE ref.""" new_xml = OxmlElement('w:p') ref._element.addprevious(new_xml) from docx.text.paragraph import Paragraph p_obj = Paragraph(new_xml, ref._parent) p_obj.style = doc.styles['Normal'] p_obj.paragraph_format.space_after = Pt(4) if bold_label: r1 = p_obj.add_run(bold_label + " ") r1.bold = True r1.font.size = Pt(font_size) r2 = p_obj.add_run(normal_text) r2.bold = False r2.font.size = Pt(font_size) return p_obj # We insert in REVERSE order (each new para goes just before intro_para, # so the last-inserted ends up first). sections = [ ("Background:", "Medical residency is a period of intense academic and clinical demands. Junior resident doctors " "are exposed to prolonged duty hours, sleep deprivation, high patient loads, and hierarchical " "institutional pressures, all of which are recognized antecedents of psychological stress. Stress, " "in turn, adversely affects subjective well-being and overall happiness. Despite this, data on the " "relationship between perceived stress and happiness among resident doctors in Indian settings remain limited."), ("Aim:", "To assess the relationship between perceived stress and happiness among junior resident doctors " "at a tertiary care government medical college."), ("Methods:", "An observational, cross-sectional study was conducted among all junior resident doctors enrolled " "at Dr Vaishampayan Memorial Government Medical College, Solapur. Sociodemographic data were " "collected using a structured proforma. Perceived stress was measured using the Perceived Stress " "Scale (PSS-10) (Cohen et al.), evaluating perceived unpredictability, lack of control, and " "overload during the preceding month (Cronbach's \u03b1 \u22480.78\u20130.91). Happiness was assessed " "using the Oxford Happiness Questionnaire (OHQ), a 29-item instrument scored on a six-point Likert " "scale, where higher scores indicate greater subjective happiness."), ("Expected Results:", "The study aims to document the prevalence and levels of perceived stress and happiness among junior " "residents and to determine the strength and direction of their relationship. Factors such as year " "of residency, specialty, sleep duration, physical activity, and family support are expected to " "emerge as significant modifiers of both stress and happiness."), ("Conclusion:", "Understanding the interplay between occupational stress and subjective happiness in resident doctors " "is essential for designing targeted institutional interventions. Findings from this study are " "expected to inform policies regarding resident welfare, duty hour regulations, and mental health " "support systems in Indian medical colleges."), ("Keywords:", "Perceived stress, Happiness, Junior resident doctors, PSS-10, Oxford Happiness Questionnaire, " "Residency training, Medical education, Occupational stress."), ] # Insert blank line after abstract (before Introduction) blank_after = OxmlElement('w:p') intro_para._element.addprevious(blank_after) # Insert sections in REVERSE so they appear in correct order for label, content in reversed(sections): insert_para_before(intro_para, label, content, font_size=11) # Insert ABSTRACT heading h_xml = OxmlElement('w:p') intro_para._element.addprevious(h_xml) from docx.text.paragraph import Paragraph h_obj = Paragraph(h_xml, intro_para._parent) h_obj.style = doc.styles['Normal'] h_obj.alignment = WD_ALIGN_PARAGRAPH.CENTER h_obj.paragraph_format.space_before = Pt(12) h_obj.paragraph_format.space_after = Pt(8) r = h_obj.add_run("ABSTRACT") r.bold = True r.font.size = Pt(13) doc.save(dst) print("Done. Verifying order:") doc2 = Document(dst) for p in doc2.paragraphs[:20]: if p.text.strip(): print(repr(p.text[:90])) EOF
python3 << 'EOF' import os, shutil from docx import Document from docx.shared import Pt from docx.enum.text import WD_ALIGN_PARAGRAPH from docx.oxml import OxmlElement src = '/tmp/workspace/attachments/e4c0cdf5-4071-41b7-ac33-d555893b9962/Title-1.docx' dst = '/tmp/workspace/output/Title-1_with_abstract.docx' shutil.copy(src, dst) doc = Document(dst) # Find the Introduction paragraph intro_para = None for p in doc.paragraphs: if p.text.strip() == 'Introduction': intro_para = p break # Helper: insert paragraph AFTER a given paragraph element (cursor) # Returns the new paragraph element so we can chain def insert_para_after(cursor_elem, bold_label, normal_text, font_size=11, centered=False): new_xml = OxmlElement('w:p') cursor_elem.addnext(new_xml) from docx.text.paragraph import Paragraph p_obj = Paragraph(new_xml, intro_para._parent) p_obj.style = doc.styles['Normal'] p_obj.paragraph_format.space_after = Pt(4) if centered: p_obj.alignment = WD_ALIGN_PARAGRAPH.CENTER if bold_label: r1 = p_obj.add_run(bold_label + " ") r1.bold = True r1.font.size = Pt(font_size) if normal_text: r2 = p_obj.add_run(normal_text) r2.bold = False r2.font.size = Pt(font_size) return new_xml # return the xml element as the new cursor # Find the title paragraph (index 0) title_para = doc.paragraphs[0] cursor = title_para._element # Insert ABSTRACT heading after title cursor = insert_para_after(cursor, None, "ABSTRACT", font_size=13, centered=True) # Adjust heading spacing via direct xml tweak from docx.text.paragraph import Paragraph as DocxPara h_obj = DocxPara(cursor, title_para._parent) h_obj.paragraph_format.space_before = Pt(12) h_obj.paragraph_format.space_after = Pt(8) # Make bold for run in h_obj.runs: run.bold = True sections = [ ("Background:", "Medical residency is a period of intense academic and clinical demands. Junior resident doctors " "are exposed to prolonged duty hours, sleep deprivation, high patient loads, and hierarchical " "institutional pressures, all of which are recognized antecedents of psychological stress. Stress, " "in turn, adversely affects subjective well-being and overall happiness. Despite this, data on the " "relationship between perceived stress and happiness among resident doctors in Indian settings remain limited."), ("Aim:", "To assess the relationship between perceived stress and happiness among junior resident doctors " "at a tertiary care government medical college."), ("Methods:", "An observational, cross-sectional study was conducted among all junior resident doctors enrolled " "at Dr Vaishampayan Memorial Government Medical College, Solapur. Sociodemographic data were " "collected using a structured proforma. Perceived stress was measured using the Perceived Stress " "Scale (PSS-10) (Cohen et al.), evaluating perceived unpredictability, lack of control, and " "overload during the preceding month (Cronbach's \u03b1 \u22480.78\u20130.91). Happiness was assessed " "using the Oxford Happiness Questionnaire (OHQ), a 29-item instrument scored on a six-point Likert " "scale, where higher scores indicate greater subjective happiness."), ("Expected Results:", "The study aims to document the prevalence and levels of perceived stress and happiness among junior " "residents and to determine the strength and direction of their relationship. Factors such as year " "of residency, specialty, sleep duration, physical activity, and family support are expected to " "emerge as significant modifiers of both stress and happiness."), ("Conclusion:", "Understanding the interplay between occupational stress and subjective happiness in resident doctors " "is essential for designing targeted institutional interventions. Findings from this study are " "expected to inform policies regarding resident welfare, duty hour regulations, and mental health " "support systems in Indian medical colleges."), ("Keywords:", "Perceived stress, Happiness, Junior resident doctors, PSS-10, Oxford Happiness Questionnaire, " "Residency training, Medical education, Occupational stress."), ] for label, content in sections: cursor = insert_para_after(cursor, label, content, font_size=11) # Add a blank line after abstract sections blank_xml = OxmlElement('w:p') cursor.addnext(blank_xml) doc.save(dst) print("Done. Verifying order:") doc2 = Document(dst) for p in doc2.paragraphs[:22]: if p.text.strip(): print(repr(p.text[:90])) EOF
Title 1 with abstract
Word Document · DOCX
Create a detailed Results & Discussion template based on your aims and objectives
python3 << 'EOF' import os from docx import Document from docx.shared import Pt, RGBColor, Inches from docx.enum.text import WD_ALIGN_PARAGRAPH from docx.oxml.ns import qn from docx.oxml import OxmlElement os.makedirs('/tmp/workspace/output/', exist_ok=True) doc = Document() # ── Global styles ────────────────────────────────────────────────────────────── normal = doc.styles['Normal'] normal.font.name = 'Times New Roman' normal.font.size = Pt(12) # ── Helper functions ────────────────────────────────────────────────────────── def add_heading(text, level=1, size=14, bold=True, underline=False, color=None): p = doc.add_paragraph() p.paragraph_format.space_before = Pt(14) p.paragraph_format.space_after = Pt(6) run = p.add_run(text) run.bold = bold run.underline = underline run.font.size = Pt(size) run.font.name = 'Times New Roman' if color: run.font.color.rgb = RGBColor(*color) return p def add_subheading(text, size=12, bold=True, italic=False): p = doc.add_paragraph() p.paragraph_format.space_before = Pt(10) p.paragraph_format.space_after = Pt(4) run = p.add_run(text) run.bold = bold run.italic = italic run.font.size = Pt(size) run.font.name = 'Times New Roman' return p def add_body(text, italic=False, indent=False): p = doc.add_paragraph() p.paragraph_format.space_after = Pt(4) p.paragraph_format.first_line_indent = Pt(18) if indent else Pt(0) run = p.add_run(text) run.italic = italic run.font.size = Pt(12) run.font.name = 'Times New Roman' return p def add_placeholder(text): """Gray italic instruction/placeholder text.""" p = doc.add_paragraph() p.paragraph_format.space_after = Pt(4) run = p.add_run(text) run.italic = True run.font.size = Pt(11) run.font.name = 'Times New Roman' run.font.color.rgb = RGBColor(0x80, 0x80, 0x80) return p def add_bullet(text, bold_prefix=None): p = doc.add_paragraph(style='List Bullet') p.paragraph_format.space_after = Pt(3) if bold_prefix: r1 = p.add_run(bold_prefix + ": ") r1.bold = True r1.font.name = 'Times New Roman' r1.font.size = Pt(12) r2 = p.add_run(text) r2.font.name = 'Times New Roman' r2.font.size = Pt(12) return p def add_table_template(headers, sample_rows, caption): """Add a simple table with headers and placeholder rows.""" cap = doc.add_paragraph() cap.paragraph_format.space_before = Pt(8) r = cap.add_run(caption) r.bold = True r.font.size = Pt(11) r.font.name = 'Times New Roman' cap.alignment = WD_ALIGN_PARAGRAPH.CENTER table = doc.add_table(rows=1 + len(sample_rows), cols=len(headers)) table.style = 'Table Grid' # Header row hdr_cells = table.rows[0].cells for i, h in enumerate(headers): hdr_cells[i].text = h for para in hdr_cells[i].paragraphs: for run in para.runs: run.bold = True run.font.size = Pt(11) run.font.name = 'Times New Roman' # Data rows for ri, row_data in enumerate(sample_rows): row_cells = table.rows[ri + 1].cells for ci, val in enumerate(row_data): row_cells[ci].text = val for para in row_cells[ci].paragraphs: for run in para.runs: run.font.size = Pt(11) run.font.name = 'Times New Roman' doc.add_paragraph() # spacing after table def page_break(): doc.add_page_break() # ══════════════════════════════════════════════════════════════════════════════ # TITLE # ══════════════════════════════════════════════════════════════════════════════ t = doc.add_paragraph() t.alignment = WD_ALIGN_PARAGRAPH.CENTER t.paragraph_format.space_after = Pt(4) r = t.add_run("Voices from the Wards: A Cross-Sectional Assessment of\nStress and Happiness in Junior Resident Doctors") r.bold = True; r.font.size = Pt(14); r.font.name = 'Times New Roman' sub = doc.add_paragraph() sub.alignment = WD_ALIGN_PARAGRAPH.CENTER sub.paragraph_format.space_after = Pt(14) rs = sub.add_run("Results & Discussion — Template") rs.italic = True; rs.font.size = Pt(12); rs.font.name = 'Times New Roman' rs.font.color.rgb = RGBColor(0x44, 0x44, 0x44) doc.add_paragraph() # ══════════════════════════════════════════════════════════════════════════════ # SECTION 1 – SOCIODEMOGRAPHIC PROFILE # ══════════════════════════════════════════════════════════════════════════════ add_heading("RESULTS", level=1, size=14) add_heading("Section 1: Sociodemographic Profile of Participants", level=2, size=13, underline=True) add_placeholder("[Insert total number of participants enrolled and response rate, e.g., 'A total of __ junior resident doctors were enrolled; __ completed the questionnaire (response rate: __%).']") add_table_template( headers=["Sociodemographic Variable", "Category", "Frequency (n)", "Percentage (%)"], sample_rows=[ ["Age (years)", "< 25", "__", "__"], ["", "25–28", "__", "__"], ["", "> 28", "__", "__"], ["Sex", "Male", "__", "__"], ["", "Female","__", "__"], ["Year of Residency","1st Year","__","__"], ["", "2nd Year","__","__"], ["", "3rd Year","__","__"], ["Type of Family","Nuclear","__","__"], ["", "Joint", "__","__"], ["Avg. Daily Sleep (hrs)","< 5","__","__"], ["", "5–7", "__","__"], ["", "> 7", "__","__"], ["Physical Activity","Sedentary","__","__"], ["", "Moderate","__","__"], ["", "Active", "__","__"], ["Substance Use","Yes", "__","__"], ["", "No", "__","__"], ], caption="Table 1: Sociodemographic Characteristics of Study Participants (n = __)" ) add_placeholder("[Describe the dominant age group, sex distribution, most common year of residency, family type, sleep pattern, and substance use prevalence in 3–5 sentences.]") # ══════════════════════════════════════════════════════════════════════════════ # SECTION 2 – OBJECTIVE 1: PERCEIVED STRESS (PSS-10) # ══════════════════════════════════════════════════════════════════════════════ page_break() add_heading("Section 2: Objective 1 – Perceived Stress Among Junior Resident Doctors (PSS-10)", level=2, size=13, underline=True) add_subheading("2.1 PSS-10 Score Distribution") add_placeholder("[Report mean ± SD PSS-10 total score. State the range (min–max) observed. E.g., 'The mean PSS-10 score was __ ± __ (range: __–__).']") add_table_template( headers=["PSS-10 Stress Category", "Score Range", "Frequency (n)", "Percentage (%)"], sample_rows=[ ["Low Stress", "0–13", "__", "__"], ["Moderate Stress", "14–26", "__", "__"], ["High Stress", "27–40", "__", "__"], ["Total", "", "__", "100%"], ], caption="Table 2: Distribution of Perceived Stress Levels by PSS-10 Category (n = __)" ) add_placeholder("[State the most common stress category, percentage of residents with high stress, and any notable pattern (e.g., predominance of moderate or high stress).]") add_subheading("2.2 PSS-10 Scores by Sociodemographic Variables") add_placeholder("[Report PSS-10 mean scores stratified by sex, year of residency, specialty, sleep duration, and physical activity. Include p-values from ANOVA / independent t-test / Mann-Whitney U as appropriate.]") add_table_template( headers=["Variable", "Category", "Mean PSS-10 (±SD)", "p-value"], sample_rows=[ ["Sex", "Male", "__ ± __", "__"], ["", "Female", "__ ± __", "__"], ["Year", "1st", "__ ± __", "__"], ["", "2nd", "__ ± __", "__"], ["", "3rd", "__ ± __", "__"], ["Sleep (hrs)","< 5", "__ ± __", "__"], ["", "5–7", "__ ± __", "__"], ["", "> 7", "__ ± __", "__"], ["Physical Activity","Sedentary","__ ± __","__"], ["", "Moderate","__ ± __", "__"], ["", "Active", "__ ± __", "__"], ["Substance Use","Yes", "__ ± __", "__"], ["", "No", "__ ± __", "__"], ], caption="Table 3: Mean PSS-10 Scores by Sociodemographic Variables" ) add_placeholder("[Highlight any significant associations (p < 0.05). E.g., first-year residents, those sleeping < 5 hours/day, or sedentary residents showed significantly higher PSS-10 scores.]") # ══════════════════════════════════════════════════════════════════════════════ # SECTION 3 – OBJECTIVE 2: HAPPINESS (OHQ) # ══════════════════════════════════════════════════════════════════════════════ page_break() add_heading("Section 3: Objective 2 – Happiness Index Among Junior Resident Doctors (OHQ)", level=2, size=13, underline=True) add_subheading("3.1 OHQ Score Distribution") add_placeholder("[Report mean ± SD OHQ score. State the range. E.g., 'The mean OHQ score was __ ± __ (range: __–__), indicating __ levels of subjective happiness overall.']") add_table_template( headers=["OHQ Happiness Category", "Score Range", "Frequency (n)", "Percentage (%)"], sample_rows=[ ["Unhappy", "1.00–2.00", "__", "__"], ["Not particularly happy", "2.01–3.00", "__", "__"], ["Moderately happy", "3.01–4.00", "__", "__"], ["Rather happy", "4.01–5.00", "__", "__"], ["Very happy", "5.01–6.00", "__", "__"], ["Total", "", "__", "100%"], ], caption="Table 4: Distribution of Happiness Levels by OHQ Category (n = __)" ) add_placeholder("[Describe the predominant happiness category and the proportion of residents falling in the lower happiness range.]") add_subheading("3.2 OHQ Scores by Sociodemographic Variables") add_placeholder("[Report OHQ mean scores stratified by sex, year of residency, specialty, sleep duration, physical activity, and family type. Include p-values.]") add_table_template( headers=["Variable", "Category", "Mean OHQ (±SD)", "p-value"], sample_rows=[ ["Sex", "Male", "__ ± __", "__"], ["", "Female", "__ ± __", "__"], ["Year", "1st", "__ ± __", "__"], ["", "2nd", "__ ± __", "__"], ["", "3rd", "__ ± __", "__"], ["Sleep (hrs)","< 5", "__ ± __", "__"], ["", "5–7", "__ ± __", "__"], ["", "> 7", "__ ± __", "__"], ["Family Type","Nuclear", "__ ± __", "__"], ["", "Joint", "__ ± __", "__"], ["Physical Activity","Sedentary","__ ± __","__"], ["", "Active", "__ ± __", "__"], ], caption="Table 5: Mean OHQ Scores by Sociodemographic Variables" ) add_placeholder("[Note significant positive associations: e.g., adequate sleep, active lifestyle, and joint family support may be associated with higher OHQ scores.]") # ══════════════════════════════════════════════════════════════════════════════ # SECTION 4 – OBJECTIVE 3: RELATIONSHIP BETWEEN STRESS AND HAPPINESS # ══════════════════════════════════════════════════════════════════════════════ page_break() add_heading("Section 4: Objective 3 – Relationship Between Perceived Stress and Happiness", level=2, size=13, underline=True) add_subheading("4.1 Correlation Analysis") add_placeholder("[State the Pearson's r (or Spearman's rho if non-normal distribution) between PSS-10 and OHQ total scores. E.g., 'A statistically significant negative correlation was found between PSS-10 and OHQ scores (r = __, p < 0.001), indicating that higher perceived stress was associated with lower subjective happiness.']") add_table_template( headers=["Statistical Test", "Value", "95% CI", "p-value", "Interpretation"], sample_rows=[ ["Pearson's r (PSS-10 vs OHQ)", "__", "__ to __", "__", "Negative / Positive / NS"], ["Spearman's rho (if non-normal)","__","__ to __","__","Negative / Positive / NS"], ], caption="Table 6: Correlation Between PSS-10 and OHQ Scores" ) add_subheading("4.2 Cross-Tabulation: Stress Category vs. Happiness Category") add_placeholder("[Present a cross-tab showing how stress categories map to happiness categories. Use Chi-square test to assess significance.]") add_table_template( headers=["PSS-10 Category", "Unhappy n (%)", "Moderately Happy n (%)", "Rather/Very Happy n (%)", "Chi-square (p)"], sample_rows=[ ["Low Stress", "__ (__%)", "__ (__%)", "__ (__%)", "__"], ["Moderate Stress", "__ (__%)", "__ (__%)", "__ (__%)", "__"], ["High Stress", "__ (__%)", "__ (__%)", "__ (__%)", "__"], ], caption="Table 7: Cross-Tabulation of PSS-10 Stress Category vs. OHQ Happiness Category" ) add_subheading("4.3 Linear Regression: Predictors of Happiness") add_placeholder("[Perform simple linear regression with PSS-10 as predictor and OHQ as outcome. Report R², β, SE, and p. Consider a multiple regression including significant sociodemographic covariates.]") add_table_template( headers=["Predictor", "β (Unstd.)", "Std. Error", "β (Std.)", "t", "p-value"], sample_rows=[ ["PSS-10 Total Score", "__", "__", "__", "__", "__"], ["Sleep Duration", "__", "__", "__", "__", "__"], ["Year of Residency", "__", "__", "__", "__", "__"], ["Physical Activity", "__", "__", "__", "__", "__"], ["Substance Use", "__", "__", "__", "__", "__"], ], caption="Table 8: Multiple Linear Regression — Predictors of OHQ Happiness Score (Dependent Variable: OHQ Total Score)" ) add_placeholder("[Report R² (total variance explained). E.g., 'The model explained __% of variance in happiness scores (R² = __, F = __, p < 0.001). PSS-10 was the strongest significant predictor (β = __, p < 0.001).']") # ══════════════════════════════════════════════════════════════════════════════ # SECTION 5 – DISCUSSION # ══════════════════════════════════════════════════════════════════════════════ page_break() add_heading("DISCUSSION", level=1, size=14) add_subheading("5.1 Sociodemographic Findings") add_placeholder("[Describe the typical profile of your resident sample (age, sex ratio, year distribution) and compare with published data from similar Indian studies (e.g., Saini et al. 2010, Grover et al. 2018).]") add_subheading("5.2 Perceived Stress in Resident Doctors") add_body( "The findings on perceived stress must be interpreted in the context of the established literature on " "occupational stress in postgraduate medical trainees." ) add_placeholder("[Compare your mean PSS-10 score and prevalence of high stress with previously published values:]") add_bullet("Iqbal et al. (2015) reported high perceived stress in >50% of postgraduate residents, particularly first-year trainees — compare with your finding.") add_bullet("Saini et al. (2010) identified academic workload and sleep deprivation as strongest predictors — discuss if consistent with your regression findings.") add_bullet("Dey et al. (2025, Bangladesh) found 65.7% stress prevalence linked to work hours and reduced sleep — note cross-cultural parallels.") add_placeholder("[Discuss significant sociodemographic predictors of stress found in your study. If first-year residents showed higher stress, attribute this to transitional phase of residency. If sleep < 5 hours predicted higher stress, link to the neurobiological literature on sleep deprivation and hypothalamic-pituitary-adrenal axis activation.]") add_subheading("5.3 Happiness Index in Resident Doctors") add_placeholder("[Compare your mean OHQ score with general population norms and with healthcare professional samples where available.]") add_bullet("Hills & Argyle (2002) reported a mean OHQ of ~4.0 in general adult samples — discuss if your residents scored above or below this.") add_bullet("Rodrigues et al. (burnout meta-analysis) — residents with higher burnout show lower life satisfaction; relate to your happiness data.") add_placeholder("[Discuss which sociodemographic factors significantly predicted better happiness in your sample. Specifically address sleep adequacy, physical activity, and family support as protective factors.]") add_subheading("5.4 Relationship Between Perceived Stress and Happiness") add_placeholder("[This is the core discussion section — allocate the most space here.]") add_body( "The theoretical underpinning for an inverse stress-happiness relationship rests on the " "conservation of resources (COR) theory (Hobfoll, 1989) and the broaden-and-build theory of " "positive emotions (Fredrickson, 2001). Sustained occupational stress depletes personal and " "psychological resources, narrowing cognitive and emotional repertoires and thereby reducing " "subjective well-being." ) add_placeholder("[Cite Schiffrin & Nelson (2010) who demonstrated significantly lower subjective happiness with higher perceived stress — compare the direction and magnitude of your correlation with their findings.]") add_placeholder("[Cite Extremera & Fernández-Berrocal (2006) on emotional intelligence as a moderator — discuss whether your data allow any inference on buffering factors.]") add_placeholder("[If PSS-10 was the strongest regression predictor of OHQ, emphasize that stress reduction is the single most impactful lever for improving resident happiness — with direct policy implications.]") add_placeholder("[Discuss the clinical significance: residents scoring in the high-stress + unhappy quadrant (Table 7) represent the most vulnerable group. What support systems should be directed at them?]") add_subheading("5.5 Strengths of the Study") add_bullet("Census-based sampling (all eligible junior residents) eliminates selection bias.") add_bullet("Use of validated, internationally recognized instruments (PSS-10 and OHQ) with established psychometric properties in Indian populations.") add_bullet("Comprehensive sociodemographic profiling allows identification of modifiable risk factors.") add_placeholder("[Add any institution-specific strengths.]") add_subheading("5.6 Limitations of the Study") add_bullet("Cross-sectional design precludes causal inference; longitudinal follow-up would be needed to establish directionality.") add_bullet("Self-reported data are subject to social desirability bias, particularly in a hierarchical institutional setting.") add_bullet("Single-centre design limits generalizability to other medical colleges with different working conditions.") add_bullet("Duty hours were not objectively measured; only sleep duration was self-reported.") add_placeholder("[Add any other limitations identified during data collection.]") add_subheading("5.7 Implications") add_body( "The findings have practical implications at three levels:" ) add_bullet("Individual level", "Screening residents with PSS-10 can identify those at high risk. Mindfulness-based stress reduction (MBSR) programmes have demonstrated efficacy in resident populations.") add_bullet("Institutional level", "Mandatory rest periods, regulated duty hours aligned with ACGME guidelines (≤80 hours/week), structured mentorship, and peer support groups.") add_bullet("Policy level", "The National Medical Commission (NMC) should consider mandating mental health screening as part of annual postgraduate training assessment.") # ══════════════════════════════════════════════════════════════════════════════ # FIGURES PLACEHOLDER # ══════════════════════════════════════════════════════════════════════════════ page_break() add_heading("FIGURES (to be inserted after data collection)", level=1, size=14) add_placeholder("[Figure 1: Bar chart — Distribution of PSS-10 stress categories among participants.]") add_placeholder("[Figure 2: Bar chart — Distribution of OHQ happiness categories among participants.]") add_placeholder("[Figure 3: Scatter plot with regression line — PSS-10 (x-axis) vs. OHQ (y-axis), showing negative correlation.]") add_placeholder("[Figure 4: Grouped bar chart — Mean PSS-10 scores by year of residency and sex.]") add_placeholder("[Figure 5: Grouped bar chart — Mean OHQ scores by sleep duration category.]") add_placeholder("[All figures should include: title, axis labels, units, sample size, and p-value/r value where appropriate. Figures may be submitted as separate image files as per journal requirements.]") doc.save('/tmp/workspace/output/Results_Discussion_Template.docx') print("Saved successfully.") EOF
python3 -c " from docx import Document doc = Document('/tmp/workspace/output/Results_Discussion_Template.docx') for p in doc.paragraphs[:10]: print(repr(p.text[:80])) print('...') print('Total paragraphs:', len(doc.paragraphs)) print('Total tables:', len(doc.tables)) "
Results Discussion Template
Word Document · DOCX
| Sub-section | Content |
|---|---|
| 5.1 Sociodemographic Findings | Compare sample profile with published Indian studies |
| 5.2 Perceived Stress | Compare with Iqbal et al. 2015, Saini et al. 2010, Dey et al. 2025 |
| 5.3 Happiness Index | Compare with Hills & Argyle 2002 norms; burnout-happiness links |
| 5.4 Stress-Happiness Relationship | Core section - COR theory, Schiffrin & Nelson 2010, Extremera 2006, regression interpretation |
| 5.5 Strengths | Census sampling, validated tools, comprehensive profiling |
| 5.6 Limitations | Cross-sectional design, self-report bias, single centre |
| 5.7 Implications | Individual, institutional, and NMC policy levels |
__ are data entry slots.