I have uploaded my MD Ayurveda synopsis in Microsoft Word (.docx) format. I want you to **rewrite the entire synopsis**, not merely replace words. ### My revised title is: **Assessment of Deha Prakriti in Patients with Migraine – A Cross-Sectional Observational Study** My guide has instructed me to **completely remove the concept of "association", "correlation", "relationship", "comparison", "prediction" from the study. This is now a **pure descriptive cross-sectional observational study**. ## Your task Rewrite my entire synopsis while preserving the university format and headings. Do **NOT** simply replace words. Rewrite each section academically so that it is internally consistent. --- ## IMPORTANT INSTRUCTIONS ### 1. Title Replace every occurrence of > Assessment of Deha Prakriti and its association with Migraine with > Assessment of Deha Prakriti in Patients with Migraine – A Cross-Sectional Observational Study --- ### 2. Aim Rewrite as > To assess the Deha Prakriti in patients diagnosed with Migraine. --- ### 3. Objectives Rewrite as Primary Objective • To assess the Deha Prakriti using a validated Prakriti Assessment Tool among patients diagnosed with Migraine. Secondary Objective • To determine the distribution of different Deha Prakriti types among patients with Migraine. Remove objectives related to * association * correlation * frequency * severity * duration * MIDAS * VAS * laterality --- ### 4. Research Question Rewrite as > What is the distribution of Deha Prakriti among patients diagnosed with Migraine? --- ### 5. Hypothesis Since this is a descriptive study, Remove * Null hypothesis * Alternative hypothesis or replace with > Not applicable for a descriptive observational study. --- ### 6. Background & Rationale Rewrite so that it focuses on * importance of Deha Prakriti * constitutional assessment * baseline descriptive data * Ayurvedic individualized healthcare Remove statements like * establish association * predict susceptibility * correlate Prakriti * determine relationship --- ### 7. Significance of Study Rewrite completely. Do NOT mention * prediction * susceptibility * correlation * personalized treatment based on demonstrated association Instead mention * constitutional assessment * documentation * baseline data * future research * individualized Ayurvedic approach --- ### 8. Current Knowledge Rewrite without mentioning association studies. --- ### 9. Gap in Current Knowledge Rewrite as "There is limited descriptive information regarding the distribution of Deha Prakriti among patients diagnosed with Migraine." Avoid mentioning lack of association studies. --- ### 10. Research Scope Rewrite as * assessment of Deha Prakriti * documentation * descriptive distribution * future research Remove * association * severity * clinical correlation --- ### 11. Limitations Rewrite for a descriptive study. --- ### 12. Review of Previous Research Retain all cited studies. Rewrite the discussion so that it says These studies demonstrate the application of Deha Prakriti assessment in different clinical conditions. Do NOT say They support association with migraine. --- ### 13. Need of Study Rewrite completely. Focus on * documenting Prakriti * constitutional profile * descriptive observational evidence Remove * establish link * determine association --- ### 14. Expected Outcome Rewrite as Primary Outcome • Distribution of various Deha Prakriti types among patients diagnosed with Migraine. Secondary Outcome • Frequency and percentage of different Prakriti categories. Remove every statement about * statistical association * severity * VAS * MIDAS * frequency of attacks * duration * prediction --- ### 15. Study Design Table Purpose should read > To assess Deha Prakriti among patients diagnosed with Migraine. --- ### 16. Methodology Keep * ICHD-3 diagnosis * Deha Prakriti assessment Remove * VAS * MIDAS * correlation analysis * comparison analysis --- ### 17. Criteria for Assessment Keep ICHD-3 Deha Prakriti Assessment Tool Remove VAS MIDAS Migraine Frequency Migraine Severity Clinical correlation variables unless required only for diagnosis. --- ### 18. Statistical Analysis Rewrite as Descriptive statistics only. Use * Mean ± SD * Median (if required) * Frequency * Percentage * Pie charts * Bar charts Do NOT include * Chi-square * Pearson correlation * Spearman correlation * ANOVA * Regression * Odds ratio * Association tests --- ### 19. Consent Form Replace the title with the new title. --- ### 20. References Keep all references. Only modify wording where the study title has changed. --- ## WRITING STYLE Use * MD Ayurveda thesis language * formal academic writing * plagiarism-free * university-ready * concise * scientific * grammatically correct --- ## OUTPUT Return 1. A fully revised Microsoft Word (.docx) document. 2. Preserve formatting, fonts, spacing, headings, page numbers, tables, and numbering. 3. Do not shorten the synopsis. 4. Rewrite every affected paragraph completely. 5. Ensure there is **no remaining mention** of: * association * correlation * relationship * prediction * susceptibility * comparative analysis unless referring to previous published studies. 6. The final document should appear as though it was originally written for the title: > **Assessment of Deha Prakriti in Patients with Migraine – A Cross-Sectional Observational Study**
python3 -c " from docx import Document doc = Document('/tmp/workspace/attachments/c60a5ce8-7164-4376-806d-6d10fcc8548b/MY WORD.docx') for i, p in enumerate(doc.paragraphs): style = p.style.name if p.style else 'None' if p.text.strip(): print(f'[{i}][{style}] {p.text}') "
python3 -c " from docx import Document doc = Document('/tmp/workspace/attachments/c60a5ce8-7164-4376-806d-6d10fcc8548b/MY WORD.docx') # Print tables for i, table in enumerate(doc.tables): print(f'=== TABLE {i} ===') for row in table.rows: cells = [cell.text.strip() for cell in row.cells] print(' | '.join(cells)) print() "
python3 -c " from docx import Document doc = Document('/tmp/workspace/attachments/c60a5ce8-7164-4376-806d-6d10fcc8548b/MY WORD.docx') # Get statistical analysis section for i, p in enumerate(doc.paragraphs): if i >= 308 and i <= 336: style = p.style.name if p.style else 'None' print(f'[{i}][{style}] {p.text}') "
python3 -c " from docx import Document doc = Document('/tmp/workspace/attachments/c60a5ce8-7164-4376-806d-6d10fcc8548b/MY WORD.docx') # Get methodology section paragraphs 191-230 for i, p in enumerate(doc.paragraphs): if i >= 191 and i <= 230: style = p.style.name if p.style else 'None' print(f'[{i}][{style}] {repr(p.text)}') "
python3 -c " from docx import Document from docx.shared import Pt, RGBColor import copy doc = Document('/tmp/workspace/attachments/c60a5ce8-7164-4376-806d-6d10fcc8548b/MY WORD.docx') # Inspect fonts, sizes etc. of key paragraphs for i, p in enumerate(doc.paragraphs): if i in [0,1,9,10,11,72,74,86,123,147,155,159,167,169,189,191,308,316]: style = p.style.name if p.style else 'None' runs_info = [] for r in p.runs: if r.text.strip(): runs_info.append(f'text={repr(r.text[:30])}, bold={r.bold}, size={r.font.size}, font={r.font.name}') print(f'[{i}][{style}] runs: {runs_info}') "
python3 /tmp/skills/docx/scripts/office/unpack.py \ '/tmp/workspace/attachments/c60a5ce8-7164-4376-806d-6d10fcc8548b/MY WORD.docx' \ /tmp/workspace/synopsis_unpacked/ echo "Exit: $?" ls /tmp/workspace/synopsis_unpacked/
python3 << 'PYEOF' """ Rewrite the synopsis XML using python-docx on the unpacked copy. Strategy: load the original, walk paragraphs and tables, replace text run-by-run while preserving all XML formatting. """ from docx import Document from docx.oxml.ns import qn from docx.oxml import OxmlElement from lxml import etree import copy, re SRC = '/tmp/workspace/attachments/c60a5ce8-7164-4376-806d-6d10fcc8548b/MY WORD.docx' DST = '/tmp/workspace/synopsis_revised.docx' doc = Document(SRC) # ── helpers ────────────────────────────────────────────────────────────── def set_para_text(para, new_text, bold=None, font_name=None, font_size=None): """Replace all runs in para with a single run carrying the new text, preserving the first run's rPr (character properties) unless overrides given.""" p = para._p # grab first rPr if exists first_r = p.find(qn('w:r')) rpr_copy = None if first_r is not None: rpr = first_r.find(qn('w:rPr')) if rpr is not None: rpr_copy = copy.deepcopy(rpr) # remove all runs & hyperlinks for child in list(p): tag = child.tag.split('}')[-1] if '}' in child.tag else child.tag if tag in ('r', 'hyperlink', 'ins', 'del'): p.remove(child) # create new run r = OxmlElement('w:r') if rpr_copy is not None: # apply overrides if bold is not None: b = rpr_copy.find(qn('w:b')) if b is None: b = OxmlElement('w:b') rpr_copy.insert(0, b) if not bold: rpr_copy.remove(b) r.append(rpr_copy) t = OxmlElement('w:t') t.text = new_text if new_text.startswith(' ') or new_text.endswith(' '): t.set('{http://www.w3.org/XML/1998/namespace}space', 'preserve') r.append(t) p.append(r) def para_text(para): return para.text.strip() # ── identify paragraphs by index ───────────────────────────────────────── paras = doc.paragraphs # Helper: replace text while keeping all run formatting def replace_text_in_para(para, old, new): for run in para.runs: if old in run.text: run.text = run.text.replace(old, new) # Helper: set entire paragraph to new text (single run, preserving first-run rPr) def rewrite_para(para, new_text): set_para_text(para, new_text) # ── 1. TITLE (paragraphs 0 & 1) ────────────────────────────────────────── rewrite_para(paras[0], 'Assessment of Deha Prakriti in Patients with Migraine') rewrite_para(paras[1], '– A Cross-Sectional Observational Study') # ── 2. Title in cover letter (paragraph 51) ────────────────────────────── replace_text_in_para(paras[51], '"Assessment of Deha Prakriti in patients of Migraine - A cross-sectional observational study"', '"Assessment of Deha Prakriti in Patients with Migraine \u2013 A Cross-Sectional Observational Study"') # fallback partial for run in paras[51].runs: run.text = run.text.replace( 'Assessment of Deha Prakriti in patients of Migraine - A cross-sectional observational study', 'Assessment of Deha Prakriti in Patients with Migraine \u2013 A Cross-Sectional Observational Study') # ── 3. Old title in list item paragraph 66 ─────────────────────────────── replace_text_in_para(paras[66], '"Assessment of Deha Prakriti and its association with Migraine - A cross-sectional observational study"', '"Assessment of Deha Prakriti in Patients with Migraine \u2013 A Cross-Sectional Observational Study"') for run in paras[66].runs: run.text = run.text.replace( 'Assessment of Deha Prakriti and its association with Migraine - A cross-sectional observational study', 'Assessment of Deha Prakriti in Patients with Migraine \u2013 A Cross-Sectional Observational Study') # ── 4. Background & Rationale (paragraphs 76, 78, 80, 83) ──────────────── # Para 76 – keep, only remove "susceptibility" framing rewrite_para(paras[76], 'Deha Prakriti is one of the most fundamental concepts in Ayurveda, representing the unique psycho-somatic constitution of every individual, determined at the time of conception. Classical texts define Prakriti as the state of predominance of one or more Doshas (Vata, Pitta, Kapha) that persists from birth to death. Charaka Samhita (Vimana Sthana 8/95-98), Ashtanga Hridayam (Sharira Sthana 3), and Sushruta Samhita (Sharira Sthana 4) enumerate seven Prakriti types: Vata, Pitta, Kapha, Vata-Pitta, Vata-Kapha, Pitta-Kapha, and Sama Prakriti. Prakriti determines the physical, physiological, and psychological characteristics of an individual and serves as the cornerstone of Ayurvedic individualized healthcare.') # Para 78 – migraine context – keep factual, no changes needed substantively # just ensure no forbidden terms rewrite_para(paras[78], 'Migraine in Modern Context: Migraine is a chronic, episodic neurovascular disorder characterized by recurrent attacks of moderate to severe unilateral headache, often accompanied by nausea, vomiting, photophobia, and phonophobia. According to the World Health Organization (WHO), migraine is ranked as the third most prevalent and second most disabling neurological disorder globally. It affects approximately 14.7% of the world population, with a female-to-male ratio of 3:1, predominantly in the productive age group of 25-55 years. In India, the prevalence of migraine is reported at 25.4 per 1000 population.') # Para 80 – Ayurvedic correlation – keep as is, no forbidden terms rewrite_para(paras[80], 'Ayurvedic Perspective: In Ayurvedic classics, Migraine closely corresponds to Ardhavabhedaka (half-sided piercing headache), described in Madhava Nidana (Chapter 62), Charaka Samhita (Siddhi Sthana 9), and Ashtanga Hridayam (Uttara Tantra 23). The classical description of Ardhavabhedaka includes unilateral throbbing or piercing headache, pain in the temporal region, aggravation by exertion, and associated nausea \u2013 features that closely correspond to the modern ICHD-3 diagnostic criteria for Migraine.') # Para 83 – RATIONALE – rewrite removing predictor/susceptibility framing rewrite_para(paras[83], 'Rationale: The concept of Deha Prakriti as the biological individuality of every person is central to Ayurvedic clinical practice. Documenting the constitutional profile of patients with Migraine provides baseline information about the Doshika characteristics prevalent in this population. Such documentation will support individualized Ayurvedic management, facilitate constitutional profiling in clinical practice, and serve as foundational descriptive data for future research in Ayurvedic and integrative neurology. Despite the clinical importance of Prakriti assessment, there is a paucity of descriptive observational studies that have systematically documented Deha Prakriti in patients diagnosed with Migraine using validated tools.') # ── 5. Significance of Study (paras 88-93) ─────────────────────────────── rewrite_para(paras[88], 'Ayurveda is founded on the principle of individualized medicine, with Deha Prakriti serving as the primary parameter for understanding an individual\'s constitutional nature. This study is significant for the following reasons:') rewrite_para(paras[89], 'Constitutional Documentation: This study will provide systematic, validated documentation of the Deha Prakriti distribution among patients diagnosed with Migraine, generating baseline constitutional data that is currently unavailable in peer-reviewed literature.') rewrite_para(paras[90], 'Individualized Ayurvedic Approach: Understanding the constitutional profile of Migraine patients will assist Ayurvedic physicians in designing individualized dietary (Ahara) and lifestyle (Vihara) recommendations in clinical practice, in accordance with the classical principle of Prakriti-based management.') rewrite_para(paras[91], 'Foundation for Future Research: The descriptive data generated by this study will serve as a reference for future analytical and interventional studies exploring constitutional approaches to Migraine management in Ayurveda.') rewrite_para(paras[92], 'Scientific Documentation: This study will contribute evidence-based descriptive data, bridging classical Ayurvedic constitutional science with contemporary neurological practice, thereby enriching the literature in integrative medicine.') # ── 6. Current Knowledge (paras 95-98) ─────────────────────────────────── rewrite_para(paras[95], 'Migraine is a widely prevalent neurovascular disorder with substantial personal and socioeconomic burden.') rewrite_para(paras[96], 'Ayurveda recognizes Deha Prakriti as the unique constitutional type of every individual, which governs physiological characteristics, disease manifestation, and treatment response.') rewrite_para(paras[97], 'Previous studies have applied Deha Prakriti assessment across various physiological, metabolic, and clinical conditions, demonstrating the utility of validated Prakriti assessment tools in diverse patient populations.') rewrite_para(paras[98], 'However, systematic descriptive information regarding the distribution of Deha Prakriti specifically among patients diagnosed with Migraine remains limited.') # ── 7. Gaps in Current Knowledge (paras 100-103) ───────────────────────── rewrite_para(paras[99], ' Gaps in Current Knowledge:') rewrite_para(paras[100], 'There is limited descriptive observational data on the distribution of Deha Prakriti types among patients diagnosed with Migraine in a contemporary clinical setting.') rewrite_para(paras[101], 'Existing studies have not documented the constitutional profile of Migraine patients using validated Prakriti assessment instruments in a systematic manner.') rewrite_para(paras[102], 'There is insufficient baseline data on the frequency and percentage of different Prakriti categories among Migraine patients to guide individualized Ayurvedic clinical practice.') rewrite_para(paras[103], 'Therefore, a descriptive observational study is needed to generate foundational data on the Deha Prakriti distribution among Migraine patients, which may strengthen the evidence base for individualized Ayurvedic healthcare.') # ── 8. Research Scope (paras 111-113) ──────────────────────────────────── rewrite_para(paras[111], 'To assess the Deha Prakriti of patients diagnosed with Migraine using a validated Prakriti Assessment Tool (CCRAS AYUR PRAKRITI Web Portal).') rewrite_para(paras[112], 'To document the distribution and frequency of different Prakriti types (Vata, Pitta, Kapha, Vata-Pitta, Vata-Kapha, Pitta-Kapha, Sama Prakriti) among patients with Migraine.') rewrite_para(paras[113], 'To generate preliminary descriptive evidence on the constitutional profile of Migraine patients, which may provide a foundation for future research in individualized Ayurvedic management.') # ── 9. Limitations (paras 117-120) ─────────────────────────────────────── rewrite_para(paras[117], 'Being a cross-sectional observational study, it provides a snapshot of the Deha Prakriti distribution at one point in time and does not establish causal inferences.') rewrite_para(paras[118], 'The study will be conducted at a hospital setting, which may limit the generalizability of the findings to the broader population.') rewrite_para(paras[119], 'Migraine diagnosis will rely on ICHD-3 criteria confirmed by the treating physician; patient-reported symptom history may be subject to recall bias.') rewrite_para(paras[120], 'The findings may be influenced by potential confounding factors such as lifestyle, stress, sleep pattern, diet, and family history, which cannot be completely controlled in a descriptive observational design.') # ── 10. Relevance / Need of Study (paras 148-152) ──────────────────────── rewrite_para(paras[148], 'The prevalence of Migraine is steadily rising globally and in India, driven by changing modern lifestyles, chronic psychological stress, irregular sleep patterns, and emotional disturbances. Despite the clinical burden of this condition, systematic documentation of the constitutional profile of Migraine patients using Ayurvedic principles remains sparse.') rewrite_para(paras[149], 'Conventional Migraine management relies on generalized pharmacotherapy, which often carries risks of side effects, variable efficacy, and medication-overuse headaches. There is a recognized need for evidence-informed, individualized, non-pharmacological approaches to support patient care.') rewrite_para(paras[150], 'Deha Prakriti assessment is a non-invasive, cost-free methodology that provides detailed information about an individual\'s constitutional nature. Documenting the Prakriti distribution among Migraine patients provides a constitutional baseline that can inform individualized Ayurvedic clinical care.') rewrite_para(paras[151], 'Migraine presentations vary considerably from patient to patient. A constitutional framework based on Deha Prakriti offers a systematic Ayurvedic approach to understanding this inter-individual variability, supporting personalized dietary, lifestyle, and therapeutic recommendations.') rewrite_para(paras[152], 'There is a need to generate descriptive observational evidence on the Deha Prakriti profile of Migraine patients using standardized, validated tools, so that individualized Ayurvedic care can be supported by documented constitutional data.') # ── 11. Research Question (para 157) ───────────────────────────────────── rewrite_para(paras[157], 'What is the distribution of Deha Prakriti among patients diagnosed with Migraine?') # ── 12. Hypothesis – replace H0 and H1 with "Not applicable" ───────────── # Para 159 = Null hypothesis heading; 161 = H0 text; 164 = H1 heading; 165 = H1 text rewrite_para(paras[159], 'Hypothesis:') rewrite_para(paras[161], 'Not applicable. This is a descriptive observational study; hypothesis testing is not a component of the study design.') rewrite_para(paras[164], '') rewrite_para(paras[165], '') # ── 13. Aims and Objectives ─────────────────────────────────────────────── # Para 170 = Aim text rewrite_para(paras[170], 'To assess the Deha Prakriti in patients diagnosed with Migraine.') # Para 172 = Primary Objective rewrite_para(paras[172], 'Primary Objective: To assess the Deha Prakriti using the validated AYUR PRAKRITI Web Portal (CCRAS, Ministry of AYUSH) among patients diagnosed with Migraine as per ICHD-3 criteria.') # Para 173 = Secondary heading rewrite_para(paras[173], 'Secondary Objectives:') # Para 174 = old secondary 1 rewrite_para(paras[174], 'To determine the distribution of different Deha Prakriti types (Vata, Pitta, Kapha, Vata-Pitta, Vata-Kapha, Pitta-Kapha, Sama Prakriti) among patients diagnosed with Migraine.') # Para 175 = old secondary 2 (correlate – remove) rewrite_para(paras[175], '') # Para 176 = old secondary 3 (MIDAS – remove) rewrite_para(paras[176], '') # ── 14. Expected Outcome (paras 179-185) ───────────────────────────────── rewrite_para(paras[179], 'Primary Outcome:') rewrite_para(paras[180], 'Documentation of the distribution of various Deha Prakriti types among patients diagnosed with Migraine.') rewrite_para(paras[181], 'Secondary Outcome:') rewrite_para(paras[182], 'Frequency and percentage of different Prakriti categories (Vata, Pitta, Kapha, Vata-Pitta, Vata-Kapha, Pitta-Kapha, Sama Prakriti) among the study population.') rewrite_para(paras[183], 'By documenting the Deha Prakriti distribution among Migraine patients, this study will provide foundational descriptive data that can guide future research and support individualized Ayurvedic clinical management. The findings are expected to contribute to an evidence-informed understanding of constitutional diversity in the Migraine patient population.') rewrite_para(paras[184], 'Preventive Aspects: Constitutional documentation of Migraine patients supports the development of individualized preventive strategies based on Prakriti (diet, lifestyle, and behavioral modifications in accordance with Doshika nature). Promotion of awareness regarding constitutional tendencies and Migraine among patients and practitioners.') rewrite_para(paras[185], 'Promotive Aspects: Enhancement of overall health by integrating Ayurvedic constitutional principles with contemporary clinical understanding of Migraine. Encouragement of Prakriti-based individualized healthcare. Improvement in quality of life and daily functioning through balanced diet (Ahara), lifestyle (Vihara), and mental health practices rooted in constitutional knowledge.') # ── 15. Study Design Table (Table 0) ───────────────────────────────────── t0 = doc.tables[0] for row in t0.rows: cells = row.cells if cells[0].text.strip() == 'Purpose': for para in cells[1].paragraphs: for run in para.runs: run.text = '' cells[1].paragraphs[0].add_run('To assess Deha Prakriti among patients diagnosed with Migraine.') # ── 16. Criteria for Assessment Table (Table 1) ────────────────────────── # Remove VAS and MIDAS rows; keep only ICHD-3 and Deha Prakriti t1 = doc.tables[1] rows_to_remove = [] for row in t1.rows: row_text = ' '.join(c.text for c in row.cells) if 'VAS' in row_text or 'MIDAS' in row_text: rows_to_remove.append(row._tr) for tr in rows_to_remove: tr.getparent().remove(tr) # Add Deha Prakriti row if not present has_prakriti = any('Deha Prakriti' in ' '.join(c.text for c in r.cells) for r in t1.rows) if not has_prakriti: new_row = t1.add_row() new_row.cells[0].text = 'Deha Prakriti Assessment Tool' new_row.cells[1].text = 'Constitutional type (AYUR PRAKRITI Web Portal, CCRAS)' # ── 17. Title in Consent Form Table (Table 2) ──────────────────────────── t2 = doc.tables[2] for row in t2.rows: for cell in row.cells: for para in cell.paragraphs: for run in para.runs: run.text = run.text.replace( 'Assessment of Deha Prakriti and its association with', 'Assessment of Deha Prakriti in Patients with Migraine') run.text = run.text.replace( 'Migraine - A cross-sectional observational study', '– A Cross-Sectional Observational Study') # ── 18. Statistical Analysis section ───────────────────────────────────── # para 308 = "Statistical analysis:" heading — keep heading, content was empty (in XML below it) # We need to add content after the heading paragraph # Find the paragraph index of statistical analysis stat_idx = None for i, p in enumerate(doc.paragraphs): if 'Statistical analysis' in p.text: stat_idx = i break if stat_idx is not None: # The content paragraphs after heading — there seem to be none in the extracted text # Insert descriptive statistics content after heading stat_para = doc.paragraphs[stat_idx] # We'll add runs to the existing paragraph (it's just a heading) # Add a new paragraph after it from docx.oxml import OxmlElement as OE # create a new paragraph element new_p = OE('w:p') new_r = OE('w:r') new_t = OE('w:t') new_t.text = ('Data collected will be analyzed using descriptive statistics. ' 'The following measures will be employed: frequency and percentage for categorical variables; ' 'mean \u00b1 standard deviation (Mean \u00b1 SD) for continuous variables; ' 'and median with interquartile range where appropriate. ' 'Results will be presented using frequency tables, pie charts, and bar charts ' 'to illustrate the distribution of Deha Prakriti types among the study population. ' 'No inferential statistical tests (such as Chi-square, ANOVA, Pearson correlation, ' 'Spearman correlation, or regression analysis) will be applied, as this is a ' 'purely descriptive cross-sectional observational study.') new_t.set('{http://www.w3.org/XML/1998/namespace}space', 'preserve') new_r.append(new_t) new_p.append(new_r) stat_para._p.addnext(new_p) # ── 19. Review of Previous Research – rewrite relevance statement ───────── # Para 130 = "B. Research on Deha Prakriti:" – add a summary sentence # There is no explicit summary paragraph in the extracted text; the studies are listed 131-145 # We add a summary sentence after para 145 summary_p = doc.paragraphs[145] # Add a paragraph after the last study entry new_p2 = OE('w:p') new_r2 = OE('w:r') new_t2 = OE('w:t') new_t2.text = ('The above studies collectively demonstrate the application of Deha Prakriti assessment ' 'across diverse clinical conditions and physiological parameters. They validate the utility ' 'of standardized Prakriti assessment tools in clinical research and provide the methodological ' 'framework adopted in the present study. These works highlight the importance of constitutional ' 'documentation in Ayurvedic clinical science; however, systematic descriptive data on the ' 'Deha Prakriti distribution specifically among Migraine patients remains to be established.') new_t2.set('{http://www.w3.org/XML/1998/namespace}space', 'preserve') new_r2.append(new_t2) new_p2.append(new_r2) summary_p._p.addnext(new_p2) # ── 20. Methodology section – remove VAS/MIDAS/assessment criteria ──────── # Criteria for assessment paras 261-304 # Keep ICHD-3 diagnosis criteria (paras 234-244), Inclusion/Exclusion, Deha Prakriti (para 275-276) # Remove: Migraine Frequency (285-287), VAS (288-293), MIDAS (294-299), Clinical Characteristics (300-307) # Para indices for removal: remove_indices = list(range(285, 308)) # Migraine Frequency through end of clinical chars for idx in sorted(remove_indices, reverse=True): if idx < len(doc.paragraphs): p_to_remove = doc.paragraphs[idx] p_to_remove._p.getparent().remove(p_to_remove._p) # ── 21. Save ────────────────────────────────────────────────────────────── doc.save(DST) print("Saved to", DST) PYEOF
python3 -c " from docx import Document doc = Document('/tmp/workspace/synopsis_revised.docx') # Verify key paragraphs checks = [ ('Title', [0,1]), ('Background', [76,83]), ('Significance', [88,89,90]), ('Current Knowledge', [95,96,97,98]), ('Gaps', [100,101,102,103]), ('Scope', [111,112,113]), ('Limitations', [117,118,119,120]), ('Need', [148,149,150]), ('Research Q', [157]), ('Hypothesis', [159,161,164,165]), ('Aim', [170]), ('Objectives', [172,173,174,175,176]), ('Expected Outcomes', [179,180,181,182,183]), ] for label, indices in checks: print(f'=== {label} ===') for i in indices: if i < len(doc.paragraphs): print(f' [{i}] {doc.paragraphs[i].text[:120]}') print() "
python3 << 'PYEOF' from docx import Document from docx.oxml import OxmlElement as OE doc = Document('/tmp/workspace/synopsis_revised.docx') def rewrite_para(para, new_text): """Replace all runs in para with single run carrying new_text, preserve first run rPr.""" from docx.oxml.ns import qn import copy p = para._p first_r = p.find(qn('w:r')) rpr_copy = None if first_r is not None: rpr = first_r.find(qn('w:rPr')) if rpr is not None: rpr_copy = copy.deepcopy(rpr) for child in list(p): tag = child.tag.split('}')[-1] if '}' in child.tag else child.tag if tag in ('r', 'hyperlink', 'ins', 'del'): p.remove(child) r = OE('w:r') if rpr_copy is not None: r.append(rpr_copy) t = OE('w:t') t.text = new_text if new_text.startswith(' ') or new_text.endswith(' '): t.set('{http://www.w3.org/XML/1998/namespace}space', 'preserve') r.append(t) p.append(r) # Dump all paragraphs with text to find the shifted paragraphs for i, p in enumerate(doc.paragraphs): txt = p.text.strip() if txt: print(f'[{i}] {txt[:100]}') PYEOF
python3 << 'PYEOF' from docx import Document from docx.oxml import OxmlElement as OE from docx.oxml.ns import qn import copy doc = Document('/tmp/workspace/synopsis_revised.docx') def rewrite_para(para, new_text): p = para._p first_r = p.find(qn('w:r')) rpr_copy = None if first_r is not None: rpr = first_r.find(qn('w:rPr')) if rpr is not None: rpr_copy = copy.deepcopy(rpr) for child in list(p): tag = child.tag.split('}')[-1] if '}' in child.tag else child.tag if tag in ('r', 'hyperlink', 'ins', 'del'): p.remove(child) r = OE('w:r') if rpr_copy is not None: r.append(rpr_copy) t = OE('w:t') t.text = new_text if new_text.startswith(' ') or new_text.endswith(' '): t.set('{http://www.w3.org/XML/1998/namespace}space', 'preserve') r.append(t) p.append(r) def replace_runs(para, old, new): for run in para.runs: if old in run.text: run.text = run.text.replace(old, new) # Fix para 51 – cover letter title replace_runs(paras := doc.paragraphs or doc.paragraphs, 'Assessment of Deha Prakriti in patients of Migraine - A cross-sectional observational study', 'Assessment of Deha Prakriti in Patients with Migraine \u2013 A Cross-Sectional Observational Study') paras = doc.paragraphs # Para 51 for run in paras[51].runs: run.text = run.text.replace( 'Assessment of Deha Prakriti in patients of Migraine - A cross-sectional observational study', 'Assessment of Deha Prakriti in Patients with Migraine \u2013 A Cross-Sectional Observational Study') run.text = run.text.replace( 'in patients of Migraine', 'in Patients with Migraine') # Para 66 – proforma list item for run in paras[66].runs: run.text = run.text.replace( '"Assessment of Deha Prakriti and its association with Migraine - A cross-sectional observational study"', '"Assessment of Deha Prakriti in Patients with Migraine \u2013 A Cross-Sectional Observational Study"') run.text = run.text.replace( 'Assessment of Deha Prakriti and its association with Migraine - A cross-sectional observational study', 'Assessment of Deha Prakriti in Patients with Migraine \u2013 A Cross-Sectional Observational Study') # Para 279 – "Migraine Assessment:" – remove this heading (it's orphaned) rewrite_para(paras[279], '') # Check for any remaining forbidden terms forbidden = ['association', 'correlation', 'relationship', 'prediction', 'susceptibility', 'comparative analysis', 'VAS', 'MIDAS', 'null hypothesis', 'alternative hypothesis', 'chi-square', 'pearson', 'spearman', 'ANOVA', 'regression', 'odds ratio'] print("Checking forbidden terms:") for i, p in enumerate(doc.paragraphs): txt = p.text.lower() for term in forbidden: if term.lower() in txt: print(f" FOUND '{term}' at para [{i}]: {p.text[:100]}") doc.save('/tmp/workspace/synopsis_revised.docx') print("\nSaved.") PYEOF
python3 << 'PYEOF' from docx import Document from docx.oxml import OxmlElement as OE from docx.oxml.ns import qn import copy doc = Document('/tmp/workspace/synopsis_revised.docx') paras = doc.paragraphs def rewrite_para(para, new_text): p = para._p first_r = p.find(qn('w:r')) rpr_copy = None if first_r is not None: rpr = first_r.find(qn('w:rPr')) if rpr is not None: rpr_copy = copy.deepcopy(rpr) for child in list(p): tag = child.tag.split('}')[-1] if '}' in child.tag else child.tag if tag in ('r', 'hyperlink', 'ins', 'del'): p.remove(child) r = OE('w:r') if rpr_copy is not None: r.append(rpr_copy) t = OE('w:t') t.text = new_text if new_text.startswith(' ') or new_text.endswith(' '): t.set('{http://www.w3.org/XML/1998/namespace}space', 'preserve') r.append(t) p.append(r) # Para 51 – fix title in cover letter for run in paras[51].runs: run.text = run.text.replace( 'in patients of Migraine - A cross-sectional observational study', 'in Patients with Migraine \u2013 A Cross-Sectional Observational Study') run.text = run.text.replace( 'and its association with Migraine - A cross-sectional observational study', 'in Patients with Migraine \u2013 A Cross-Sectional Observational Study') # Para 66 – proforma title for run in paras[66].runs: run.text = run.text.replace( '"Assessment of Deha Prakriti and its association with Migraine - A cross-sectional observational study"', '"Assessment of Deha Prakriti in Patients with Migraine \u2013 A Cross-Sectional Observational Study"') run.text = run.text.replace( 'Assessment of Deha Prakriti and its association with Migraine - A cross-sectional observational study', 'Assessment of Deha Prakriti in Patients with Migraine \u2013 A Cross-Sectional Observational Study') # Para 279 – "Migraine Assessment:" orphaned heading rewrite_para(paras[279], '') # Check for forbidden terms in all paragraphs forbidden = ['VAS', 'MIDAS', 'null hypothesis', 'alternative hypothesis', 'chi-square', 'pearson', 'spearman', 'anova', 'regression', 'odds ratio'] non_study_paras = set() # paras that are citations/references (allowed to have study titles) print("Checking for remaining forbidden terms:") found_any = False for i, p in enumerate(paras): txt = p.text txt_lower = txt.lower() # skip reference/citation lines is_ref = any(x in txt for x in ['PMID', 'Cephalalgia', 'J Headache', 'Neurol India', 'J Ayurveda', 'CCRAS', 'ICMR', 'Charaka', 'Vagbhata', 'Sushruta', 'Madhavakara', 'Dr.', 'Dr ']) for term in forbidden: if term.lower() in txt_lower: print(f" FOUND '{term}' at [{i}] (ref={is_ref}): {txt[:100]}") found_any = True if not found_any: print(" None found.") # Also check for 'association' outside reference lines print("\nChecking 'association':") for i, p in enumerate(paras): txt = p.text if 'association' in txt.lower() or 'Association' in txt: is_citation = any(x in txt for x in ['Dr.', 'Dr ', 'PMID', '20', '201', '202', 'Cephalalgia', 'J Headache', 'ITRA', 'Jamnagar']) print(f" [{i}] (citation={is_citation}): {txt[:120]}") doc.save('/tmp/workspace/synopsis_revised.docx') print("\nSaved successfully.") PYEOF
python3 << 'PYEOF' from docx import Document from docx.oxml import OxmlElement as OE from docx.oxml.ns import qn import copy doc = Document('/tmp/workspace/synopsis_revised.docx') paras = doc.paragraphs def rewrite_para(para, new_text): p = para._p first_r = p.find(qn('w:r')) rpr_copy = None if first_r is not None: rpr = first_r.find(qn('w:rPr')) if rpr is not None: rpr_copy = copy.deepcopy(rpr) for child in list(p): tag = child.tag.split('}')[-1] if '}' in child.tag else child.tag if tag in ('r', 'hyperlink', 'ins', 'del'): p.remove(child) r = OE('w:r') if rpr_copy is not None: r.append(rpr_copy) t = OE('w:t') t.text = new_text if new_text.startswith(' ') or new_text.endswith(' '): t.set('{http://www.w3.org/XML/1998/namespace}space', 'preserve') r.append(t) p.append(r) # Fix para 66 – still has old title print("Para 66:", paras[66].text[:150]) rewrite_para(paras[66], 'Title of the study: "Assessment of Deha Prakriti in Patients with Migraine \u2013 A Cross-Sectional Observational Study"') print("Para 66 fixed:", paras[66].text[:150]) # Fix para 287 – rewrite stat analysis without listing inferential tests rewrite_para(paras[287], 'Data collected will be analyzed using descriptive statistics. Frequency and percentage will be calculated for categorical variables. Mean with standard deviation (Mean \u00b1 SD) will be reported for continuous variables, and median with interquartile range will be used where appropriate. Results will be visually presented using frequency tables, pie charts, and bar charts to illustrate the distribution of Deha Prakriti types among the study population. As this is a purely descriptive cross-sectional observational study, only descriptive statistical methods will be applied.') doc.save('/tmp/workspace/synopsis_revised.docx') print("Saved.") PYEOF
python3 << 'PYEOF' # Final verification pass from docx import Document doc = Document('/tmp/workspace/synopsis_revised.docx') paras = doc.paragraphs # Check title in cover letter para 51 print("Para 51:", paras[51].text[:200]) print("Para 66:", paras[66].text[:200]) print() print("Statistical analysis para 287:", paras[287].text[:300]) print() # Final forbidden check (excluding legitimate words) truly_forbidden = [ 'VAS score', 'MIDAS score', 'MIDAS questionnaire', 'null hypothesis', 'alternative hypothesis', 'H0', 'H1)', 'chi-square', 'pearson correlation', 'spearman correlation', 'anova', 'regression analysis', 'odds ratio', 'establish a correlation', 'correlate Prakriti', 'establish association', 'predict susceptibility', 'determine relationship', 'severity of migraine', 'frequency of attacks', 'duration of attack', 'association with migraine' ] print("Final forbidden term check:") found_any = False for i, p in enumerate(paras): txt = p.text txt_lower = txt.lower() for term in truly_forbidden: if term.lower() in txt_lower: print(f" FOUND '{term}' at [{i}]: {txt[:120]}") found_any = True if not found_any: print(" All clear.") PYEOF
python3 << 'PYEOF' from docx import Document from docx.oxml import OxmlElement as OE from docx.oxml.ns import qn import copy doc = Document('/tmp/workspace/synopsis_revised.docx') paras = doc.paragraphs def rewrite_para(para, new_text): p = para._p first_r = p.find(qn('w:r')) rpr_copy = None if first_r is not None: rpr = first_r.find(qn('w:rPr')) if rpr is not None: rpr_copy = copy.deepcopy(rpr) for child in list(p): tag = child.tag.split('}')[-1] if '}' in child.tag else child.tag if tag in ('r', 'hyperlink', 'ins', 'del'): p.remove(child) r = OE('w:r') if rpr_copy is not None: r.append(rpr_copy) t = OE('w:t') t.text = new_text if new_text.startswith(' ') or new_text.endswith(' '): t.set('{http://www.w3.org/XML/1998/namespace}space', 'preserve') r.append(t) p.append(r) rewrite_para(paras[51], 'Title of Dissertation: \u201cAssessment of Deha Prakriti in Patients with Migraine \u2013 A Cross-Sectional Observational Study\u201d') print("Para 51 fixed:", paras[51].text[:200]) doc.save('/tmp/workspace/synopsis_revised.docx') print("Saved.") PYEOF
synopsis revised
Word Document · DOCX