Create a handwritten style note

Reading File
Browsing Directory

~/

Browsing Directory

~/attachments/29009151-755e-4adf-8502-4eee7bf0d86d/

Searching the Web

handwritten style note document formatting fonts and layout

Running Command

python3 -c "from docx import Document; p='/tmp/workspace/attachments/29009151-755e-4adf-8502-4eee7bf0d86d/SHAKIBA .docx'; d=Document(p); print('PARAGRAPHS:'); [print(f'[{x.style.name}] {x.text}') for x in d.paragraphs if x.text.strip()]; print('TABLES',len(d.tables)); [print([[c.text for c in r.cells] for r in t.rows]) for t in d.tables]"

Reading File
I’m formatting the supplied clinical details as a legible, non-prescriptive case note.
Browsing Directory

~/

Reading File
Running Command

mkdir -p "/tmp/workspace/shakiba-handwritten-note/output" "/tmp/workspace/shakiba-handwritten-note/src" && python3 - <<'PY' from docx import Document from docx.shared import Inches, Pt, RGBColor from docx.enum.text import WD_ALIGN_PARAGRAPH from docx.enum.section import WD_SECTION from docx.oxml import OxmlElement from docx.oxml.ns import qn from docx.enum.table import WD_TABLE_ALIGNMENT, WD_CELL_VERTICAL_ALIGNMENT from docx.enum.style import WD_STYLE_TYPE from reportlab.lib.pagesizes import A4 from reportlab.pdfgen.canvas import Canvas from reportlab.lib.colors import HexColor from reportlab.pdfbase.pdfmetrics import stringWidth from reportlab.lib.units import mm from textwrap import wrap from pathlib import Path out=Path('/tmp/workspace/shakiba-handwritten-note/output') blue=RGBColor(23,56,110) red=RGBColor(150,25,25) def shade(cell, fill): tcPr=cell._tc.get_or_add_tcPr(); shd=OxmlElement('w:shd'); shd.set(qn('w:fill'),fill);tcPr.append(shd) def border_bottom(p,color='9DB8DD'): pPr=p._p.get_or_add_pPr(); pbdr=OxmlElement('w:pBdr'); bot=OxmlElement('w:bottom'); bot.set(qn('w:val'),'single'); bot.set(qn('w:sz'),'5'); bot.set(qn('w:space'),'6'); bot.set(qn('w:color'),color); pbdr.append(bot);pPr.append(pbdr) def add_para(doc,text='',bold_prefix=None, color=blue, size=11, space=2): p=doc.add_paragraph(); p.paragraph_format.space_after=Pt(space); p.paragraph_format.line_spacing=1.18; border_bottom(p) if bold_prefix and text.startswith(bold_prefix): r=p.add_run(bold_prefix); r.bold=True;r.font.color.rgb=color;r.font.name='Segoe Print';r.font.size=Pt(size) r=p.add_run(text[len(bold_prefix):]);r.font.color.rgb=color;r.font.name='Segoe Print';r.font.size=Pt(size) else: r=p.add_run(text);r.font.color.rgb=color;r.font.name='Segoe Print';r.font.size=Pt(size) return p def heading(doc,t): p=doc.add_paragraph();p.paragraph_format.space_before=Pt(6);p.paragraph_format.space_after=Pt(2) r=p.add_run(t.upper());r.bold=True;r.underline=True;r.font.name='Segoe Print';r.font.size=Pt(13);r.font.color.rgb=red doc=Document();sec=doc.sections[0];sec.top_margin=Inches(.55);sec.bottom_margin=Inches(.5);sec.left_margin=Inches(.7);sec.right_margin=Inches(.55) style=doc.styles['Normal'];style.font.name='Segoe Print';style.font.size=Pt(11);style.font.color.rgb=blue for s in doc.sections: s.header_distance=Inches(.25) h=s.header.paragraphs[0];h.alignment=WD_ALIGN_PARAGRAPH.RIGHT rr=h.add_run('Clinical handwritten-style summary | 21 Oct 2026');rr.font.name='Segoe Print';rr.font.size=Pt(8);rr.font.color.rgb=RGBColor(95,95,95) # title p=doc.add_paragraph();p.alignment=WD_ALIGN_PARAGRAPH.CENTER;p.paragraph_format.space_after=Pt(2) r=p.add_run('SHAKIBA - CLINICAL CASE NOTE');r.bold=True;r.underline=True;r.font.name='Segoe Print';r.font.size=Pt(16);r.font.color.rgb=red add_para(doc,'36 years / Female',size=11) add_para(doc,'Referral: Rheumatology - chronic pancytopenia; review and management.',bold_prefix='Referral: ') heading(doc,'Known diagnoses / background') for t in ['Systemic lupus erythematosus: mucocutaneous + musculoskeletal + hematological involvement.','Secondary APS. Prior SVC thrombosis with collateral formation; query warfarin resistance.','HFpEF with pulmonary arterial hypertension (PAH).','Ulcerative colitis, biopsy proven Nov 2023, currently quiescent.','Antral-predominant gastritis; type 2 diabetes mellitus; hypothyroidism; hypertension.','Current concerns: possible URTI and fluid retention.']: add_para(doc,'• '+t) heading(doc,'Current vitals') for t in ['Temperature: normal','PR: 98/min','BP: 108/68 mmHg','RR: 26/min','SpO₂: 90% on room air -> 94% on 2 L/min nasal prongs'] : add_para(doc,t) heading(doc,'Systemic examination') for t in ['CVS: S1 S2 present; no murmur.','RS: Air entry mildly reduced in right lower lung; crepitations in right infrascapular/inter- and infra-axillary areas (as documented).','CNS: Conscious, oriented; follows verbal commands.','P/A: Soft, non-tender.'] : add_para(doc,t) heading(doc,'Key investigations') for t in ['17/10/2026: Reticulocyte count 1.6%.','CBC 17/10/2026: Hb 6.0 g/dL / WBC 1.48 ×10³/µL / platelets 122 ×10³/µL.','CBC 19/10/2026: Hb 6.5 g/dL / WBC 1.68 ×10³/µL / platelets 98 ×10³/µL.','Sputum C/S: Escherichia coli. Stool R/M: NAD. Troponin I: negative.','Iron studies: serum iron 23 µg/dL (low); TIBC 134 µg/dL (low); ferritin 521.95 ng/mL (high).','Other: CPK 14 U/L; LDH 189 U/L; ESR 31 mm/h; NT-proBNP 1663.8.'] : add_para(doc,'• '+t) doc.add_page_break() heading(doc,'Laboratory highlights') for t in ['Renal/electrolytes: urea 57 mg/dL (H), creatinine 1.44 mg/dL (H), Na 140 mmol/L, K 3.16 mmol/L (L), Cl 111 mmol/L.','Liver/proteins: AST 23 U/L, ALT 16 U/L, ALP 191 U/L (H), total bilirubin 0.37 mg/dL, total protein 5.39 g/dL (L), albumin 2.58 g/dL (L).','Coagulation: PT 15 sec; INR 1.01.','CBC detailed: Hb 5.6 g/dL, WBC 1.56 ×10³/µL, RBC 2.05 ×10⁶/µL, Hct 18.4%, MCV 89.7 fL, RDW 17%; platelets 124 ×10³/µL.','Differential: neutrophils 90%, lymphocytes 6%, monocytes 2%, eosinophils 2%.','Peripheral smear: normocytic normochromic RBCs with anisopoikilocytosis; few microcytes, occasional macrocytes and tear-drop cells. WBCs and platelets reduced; few large platelets. Malarial parasite not seen.'] : add_para(doc,'• '+t) heading(doc,'Imaging / cardiac work-up') for t in ['USG whole abdomen (16/10/2026): grade II fatty liver; spleen normal; kidneys normal in size with no hydronephrosis/calculus; mild ascites.','CECT neck + HRCT plain (17/10/2026): neck essentially normal. Cardiomegaly with congestive changes, smooth interstitial septal thickening, pericardial and pleural effusions. 2D echo correlation suggested.','2D echo (17/10/2026): EF 60%; normal-sized LV with normal LV function; moderate PAH.'] : add_para(doc,'• '+t) heading(doc,'Bone marrow biopsy - 09/09/2025') for t in ['Reported hypocellular according to age. Erythropoiesis relatively reduced with normoblastic and micronormoblastic maturation; dyserythropoiesis present.','Myelopoiesis: all stages of maturation; focal dysmyelopoiesis and abnormal intertrabecular localization (ALIP).','Megakaryopoiesis increased; focal dysmegakaryopoiesis and abnormal paratrabecular localization.','Reticulin grade 1 (modified Bauermeister): occasional fine individual fibres/foci of fine fibre network.','Impression recorded: trilineage hematopoiesis with focal dysplasia; possibility of secondary dysplasia related to autoimmune disorder/SLE.'] : add_para(doc,'• '+t) doc.add_page_break() heading(doc,'Treatment history') for t in ['Rituximab 500 mg on 03/10/2025 and 28/10/2025; rituximab 1000 mg on 20/04/2026.','20/07/2026: methylprednisolone 500 mg for 3 days, followed by cyclophosphamide 500 mg IV on 24/07/2026 (first dose).','MMF stopped after cyclophosphamide was given.'] : add_para(doc,'• '+t) heading(doc,'Medications recorded (POM)') for t in ['Omnacortil 30 mg OD, tapering dose','HCQ 200 mg OD','Apixaban 5 mg BD','Thyroxine 125 mcg OD','Endobloc 5 mg OD','Mesacol 1.2 g, 1-0-1','Benizep 1-0-1','Nexpro IT 1-0-1'] : add_para(doc,'• '+t) heading(doc,'Ongoing treatment / hematology note') for t in ['Cyclophosphamide 500 mg in 500 mL NS IV over 3 hours - ongoing as documented.','Hematology: case discussed with Dr Sanket Shah; bone marrow biopsy report noted.','Advice documented: watch for bleeding.','Question for treating team: in context of pancytopenia and active infection/congestion, should IV cyclophosphamide be withheld or continued?'] : add_para(doc,'• '+t) p=doc.add_paragraph();p.paragraph_format.space_before=Pt(10) r=p.add_run('Safety note: This is a reformatted transcription, not a treatment order. Decisions regarding cyclophosphamide, anticoagulation, transfusion, antimicrobial therapy, oxygen, and admission should be made by the responsible treating specialists after immediate clinical review.');r.italic=True;r.font.name='Segoe Print';r.font.size=Pt(9);r.font.color.rgb=red # footer for s in doc.sections: f=s.footer.paragraphs[0];f.alignment=WD_ALIGN_PARAGRAPH.CENTER; rr=f.add_run('Reformatted from supplied record | Patient-identifying data withheld');rr.font.name='Segoe Print';rr.font.size=Pt(8);rr.font.color.rgb=RGBColor(100,100,100) docx=out/'Shakiba_handwritten_clinical_note.docx';doc.save(docx) # PDF direct, simplified pdf=out/'Shakiba_handwritten_clinical_note.pdf';c=Canvas(str(pdf),pagesize=A4);W,H=A4 lines=[] for p in doc.paragraphs: if p.text.strip(): lines.append(p.text) y=H-18*mm for text in lines: if text.isupper() and len(text)<55: font='Helvetica-BoldOblique';size=11;color=HexColor('#961919') else: font='Helvetica-Oblique';size=9.5;color=HexColor('#17386e') chunks=wrap(text,width=105,break_long_words=False,break_on_hyphens=False) or [''] for line in chunks: if y<18*mm: c.showPage();y=H-18*mm c.setStrokeColor(HexColor('#bfd3ec'));c.setLineWidth(.25);c.line(15*mm,y-3.3*mm,W-14*mm,y-3.3*mm) c.setFont(font,size);c.setFillColor(color);c.drawString(17*mm,y,line);y-=6.1*mm y-=1.3*mm c.save() print(docx);print(pdf) PY python3 - <<'PY' from docx import Document from pypdf import PdfReader p='/tmp/workspace/shakiba-handwritten-note/output/Shakiba_handwritten_clinical_note.docx'; print('DOCX paragraphs',len(Document(p).paragraphs)); q='/tmp/workspace/shakiba-handwritten-note/output/Shakiba_handwritten_clinical_note.pdf'; print('PDF pages',len(PdfReader(q).pages)) PY

Browsing Directory

~/shakiba-handwritten-note/output/

Running Command

python3 - <<'PY' from pypdf import PdfReader for f in ['/tmp/workspace/shakiba-handwritten-note/output/Shakiba_handwritten_clinical_note.pdf']: r=PdfReader(f); text=''.join(p.extract_text() or '' for p in r.pages); print('pages=',len(r.pages),'chars=',len(text),'has_title=', 'SHAKIBA' in text, 'has_safety=', 'Safety note' in text) PY

Created a handwritten-style, structured clinical note from the supplied document. It includes an editable Word version and a print-ready PDF.

Shakiba handwritten clinical note

Word Document · DOCX

Shakiba handwritten clinical note

PDF Document · PDF

Only blue colour

Browsing Directory

~/

Running Command

python3 - <<'PY' from docx import Document from pathlib import Path p=Path('/tmp/workspace/shakiba-handwritten-note/output/Shakiba_handwritten_clinical_note.docx') d=Document(p) print('paragraphs:', len(d.paragraphs)) print('headers:', [h.text for s in d.sections for h in s.header.paragraphs]) print('footers:', [f.text for s in d.sections for f in s.footer.paragraphs]) print('first:', [x.text for x in d.paragraphs[:5]]) PY

Searching the Web

blue ink handwritten note styling document

Browsing Directory

~/shakiba-handwritten-note/output/

Running Command

python3 - <<'PY' from docx import Document from docx.shared import RGBColor from docx.oxml.ns import qn from pathlib import Path from reportlab.lib.pagesizes import A4 from reportlab.pdfgen.canvas import Canvas from reportlab.lib.colors import HexColor from reportlab.lib.units import mm from textwrap import wrap base=Path('/tmp/workspace/shakiba-handwritten-note/output') docx_path=base/'Shakiba_handwritten_clinical_note.docx' blue=RGBColor(23,56,110) doc=Document(docx_path) # Set every visible text run to blue, including headers and footers. for section in doc.sections: containers=[doc.paragraphs, section.header.paragraphs, section.footer.paragraphs] for paras in containers: for p in paras: for r in p.runs: r.font.color.rgb=blue for table in list(doc.tables)+list(section.header.tables)+list(section.footer.tables): for row in table.rows: for cell in row.cells: for p in cell.paragraphs: for r in p.runs:r.font.color.rgb=blue # Preserve heading emphasis but no red ink. doc.save(docx_path) # Recreate the companion PDF entirely in blue ink. pdf_path=base/'Shakiba_handwritten_clinical_note.pdf' c=Canvas(str(pdf_path),pagesize=A4);W,H=A4;y=H-18*mm ink=HexColor('#17386E'); rule=HexColor('#BFD3EC') for para in doc.paragraphs: text=para.text.strip() if not text: continue heading=text.isupper() and len(text)<55 font='Helvetica-BoldOblique' if heading else 'Helvetica-Oblique' size=11 if heading else 9.5 for line in (wrap(text,width=105,break_long_words=False,break_on_hyphens=False) or ['']): if y<18*mm: c.showPage();y=H-18*mm c.setStrokeColor(rule);c.setLineWidth(.25);c.line(15*mm,y-3.3*mm,W-14*mm,y-3.3*mm) c.setFont(font,size);c.setFillColor(ink);c.drawString(17*mm,y,line);y-=6.1*mm y-=1.3*mm c.save() print('updated',docx_path,pdf_path) PY python3 - <<'PY' from docx import Document from pypdf import PdfReader from pathlib import Path base=Path('/tmp/workspace/shakiba-handwritten-note/output') d=Document(base/'Shakiba_handwritten_clinical_note.docx') colors=set() for sec in d.sections: for ps in (d.paragraphs,sec.header.paragraphs,sec.footer.paragraphs): for p in ps: for r in p.runs: if r.font.color.rgb: colors.add(str(r.font.color.rgb)) print('DOCX text colours:',colors) r=PdfReader(base/'Shakiba_handwritten_clinical_note.pdf');print('PDF pages:',len(r.pages),'text chars:',sum(len(x.extract_text() or '') for x in r.pages)) PY

Updated both versions to use only blue ink color throughout.

Shakiba handwritten clinical note

Word Document · DOCX

Shakiba handwritten clinical note

PDF Document · PDF

attachment
attachment

I have attached a template make like this one

analyse_media
Reading File
Browsing Directory

~/

I’ll remake the note in the same blue-ink referral-sheet format: all-capital underlined headings, sparse bullet points, dates and investigations grouped like the sample, with no colored accents.
Running Command

python3 - <<'PY' from pathlib import Path from docx import Document from docx.shared import Inches, Pt, RGBColor from docx.enum.text import WD_ALIGN_PARAGRAPH, WD_LINE_SPACING from docx.oxml import OxmlElement from docx.oxml.ns import qn from reportlab.pdfgen import canvas from reportlab.lib.pagesizes import A4 from reportlab.lib.colors import HexColor from reportlab.lib.units import mm from textwrap import wrap import matplotlib.font_manager as fm project=Path('/tmp/workspace/shakiba-handwritten-note') out=project/'output'; out.mkdir(parents=True,exist_ok=True) blue=RGBColor(12,44,130) blue_hex=HexColor('#0C2C82') line_blue=HexColor('#C9D8EF') fonts=[Path(x).name for x in fm.findSystemFonts()] hand_font=next((x for x in ['Segoe Print','Bradley Hand ITC','Comic Sans MS','Chilanka','Purisa','URW Chancery L'] if any(x.lower().replace(' ','') in f.lower().replace(' ','') for f in fonts)), 'Comic Sans MS') def set_run(run, size=12, bold=False, underline=False): run.font.name=hand_font; run._element.rPr.rFonts.set(qn('w:eastAsia'),hand_font) run.font.size=Pt(size);run.font.color.rgb=blue;run.bold=bold;run.underline=underline def add_bottom_rule(p): pPr=p._p.get_or_add_pPr(); pbdr=pPr.find(qn('w:pBdr')) if pbdr is None: pbdr=OxmlElement('w:pBdr');pPr.append(pbdr) b=OxmlElement('w:bottom');b.set(qn('w:val'),'single');b.set(qn('w:sz'),'3');b.set(qn('w:space'),'4');b.set(qn('w:color'),'CBD9F0');pbdr.append(b) def ptext(doc, text='', indent=0, size=12, rule=False): p=doc.add_paragraph();p.paragraph_format.left_indent=Inches(indent);p.paragraph_format.space_after=Pt(2);p.paragraph_format.line_spacing=1.12 r=p.add_run(text);set_run(r,size=size) if rule: add_bottom_rule(p) return p def heading(doc, text): p=doc.add_paragraph();p.paragraph_format.space_before=Pt(7);p.paragraph_format.space_after=Pt(2);p.paragraph_format.line_spacing=1.0 r=p.add_run(text.upper());set_run(r,size=14,bold=False,underline=True) return p def bullet(doc,text, indent=.12, size=12): return ptext(doc,'• '+text,indent=indent,size=size) def subbullet(doc,text,indent=.4,size=11.5): return ptext(doc,'- '+text,indent=indent,size=size) doc=Document();sec=doc.sections[0];sec.page_width=Inches(8.27);sec.page_height=Inches(11.69);sec.top_margin=Inches(.42);sec.bottom_margin=Inches(.45);sec.left_margin=Inches(.45);sec.right_margin=Inches(.36) style=doc.styles['Normal'];style.font.name=hand_font;style.font.size=Pt(12);style.font.color.rgb=blue # no header/footer exactly to preserve template p=doc.add_paragraph();p.alignment=WD_ALIGN_PARAGRAPH.CENTER;p.paragraph_format.space_after=Pt(4) r=p.add_run('REFER FOR HEMATOLOGY OPINION - PANCYTOPENIA');set_run(r,15,underline=True) ptext(doc,'SHAKIBA',size=13) ptext(doc,'36 Y / F',size=13) ptext(doc,'Referred from Rheumatology for chronic pancytopenia and further management.',size=12) heading(doc,'Known case of') for x in [ 'SLE - mucocutaneous + musculoskeletal + hematological involvement.', 'Secondary APS with SVC thrombosis and collateral formation; query warfarin resistance.', 'HFpEF + PAH.', 'Ulcerative colitis - biopsy proven Nov 2023, currently quiescent.', 'Antral-predominant gastritis + DM-2 + hypothyroidism + hypertension.' ]:bullet(doc,x) ptext(doc,'A/W - ? URTI + fluid retention.',size=13) heading(doc,'Present status') for x in ['Temp - normal','PR - 98/min','BP - 108/68 mm Hg','RR - 26/min','SpO₂ - 90% on RA -> 94% on 2 L NP'] : bullet(doc,x) heading(doc,'Systemic examination') for x in ['CVS - S1 S2 +; no murmur.','RS - AE mildly reduced in RLL; crepitations in right ISA / IAA / IMA (as documented).','CNS - conscious, oriented, follows verbal commands.','P/A - soft, non-tender.'] : bullet(doc,x) heading(doc,'Relevant labs') ptext(doc,'1. CBC',indent=.02,size=13) for x in ['17/10/26 - retic count 1.6%.','17/10/26 - CBC: 6.0 / 1.48 / 122.','19/10/26 - CBC: 6.5 / 1.68 / 98.','CBC detailed: Hb 5.6, WBC 1.56, RBC 2.05, Hct 18.4, MCV 89.7, RDW 17.0, platelet 124.','PS: normocytic normochromic RBCs with anisopoikilocytosis; few microcytes, occasional macrocytes and tear-drop cells. WBCs and platelets reduced; few large platelets. MP not seen.'] : subbullet(doc,x) ptext(doc,'2. Iron profile / other labs',indent=.02,size=13) for x in ['Serum iron 23 (L), TIBC 134 (L), ferritin 521.95 (H).','LDH 189; CPK 14; ESR 31; NT-proBNP 1663.8.','Urea 57 (H), creatinine 1.44 (H), Na 140, K 3.16 (L), Cl 111.','ALP 191 (H), total protein 5.39 (L), albumin 2.58 (L).','PT 15 sec / INR 1.01.'] : subbullet(doc,x) # page 2 doc.add_page_break() heading(doc,'Microbiology / imaging') for x in ['Sputum C/S - Escherichia coli. Stool R/M - NAD. Trop I - negative.','USG W/A (16/10/26): grade II fatty liver; spleen normal; bilateral kidneys normal with no hydronephrosis/calculus; mild ascites.','CECT neck + HRCT plain (17/10/26): neck essentially normal. Cardiomegaly with congestive changes, smooth interstitial septal thickening, pericardial and pleural effusions.','2D echo (17/10/26): EF 60%; normal-sized LV with normal LV function; moderate PAH.'] : bullet(doc,x) heading(doc,'Bone marrow biopsy - 09/09/2025') for x in ['Hypocellular according to age.','Erythropoiesis relatively reduced with normoblastic / micronormoblastic maturation; dyserythropoiesis present.','Myelopoiesis with all maturation stages; focal dysmyelopoiesis and ALIP.','Megakaryopoiesis increased; focal dysmegakaryopoiesis and abnormal paratrabecular localization.','Reticulin grade 1, modified Bauermeister.','Reported impression: trilineage hematopoiesis with focal dysplasia; possibility of secondary dysplasia due to autoimmune disorder / known SLE.'] : bullet(doc,x) heading(doc,'Treatment history') for x in ['Rituximab 500 mg on 03/10/2025 and 28/10/2025; 1000 mg on 20/04/2026.','20/07/26 - Inj MPS 500 mg given for 3 days.','24/07/26 - Inj cyclophosphamide 500 mg IV, first dose.','MMF stopped since cyclophosphamide was given.'] : bullet(doc,x) heading(doc,'POM') for x in ['Tab Omnacortil 30 mg OD - tapering dose.','Tab HCQ 200 mg OD.','Tab Apixaban 5 mg BD.','Tab Thyroxine 125 mcg OD.','Tab Endobloc 5 mg OD.','Tab Mesacol 1.2 g 1-0-1.','Tab Benizep 1-0-1.','Tab Nexpro IT 1-0-1.'] : bullet(doc,x) heading(doc,'Current treatment / advice') for x in ['Inj cyclophosphamide 500 mg in 500 cc NS IV over 3 hours - ongoing, as documented.','Hematology - C/D/W Dr Sanket Shah; BM biopsy report noted.','Watch for bleeding.','CT your line of management.'] : bullet(doc,x) p=doc.add_paragraph();p.paragraph_format.space_before=Pt(13);p.paragraph_format.space_after=Pt(2) r=p.add_run('SIR, SHOULD WE WITHHOLD INJ CYCLOPHOSPHAMIDE OR CONTINUE YOUR LINE OF MANAGEMENT?');set_run(r,13,underline=True) ptext(doc,'Note: reformatted transcription from the supplied record. Management decisions remain with the treating team.',size=9) docx_path=out/'Shakiba_referral_note_template_style.docx';doc.save(docx_path) # PDF uses blue handwritten-ish oblique with template-style all caps and lines. pdf_path=out/'Shakiba_referral_note_template_style.pdf' c=canvas.Canvas(str(pdf_path),pagesize=A4);W,H=A4; y=H-12*mm for para in doc.paragraphs: text=para.text.strip() if not text: continue is_heading=(text.isupper() and len(text)<72) font='Helvetica-BoldOblique' if is_heading else 'Helvetica-Oblique' size=11.5 if is_heading else 9.8 available=96 if is_heading else 108 parts=wrap(text,width=available,break_long_words=False,break_on_hyphens=False) or [''] for i,line in enumerate(parts): if y < 15*mm: c.showPage();y=H-12*mm c.setFillColor(blue_hex);c.setFont(font,size);c.drawString(13*mm,y,line) if is_heading and i==len(parts)-1: width=c.stringWidth(line,font,size);c.setStrokeColor(blue_hex);c.setLineWidth(.55);c.line(13*mm,y-1.4*mm,13*mm+width,y-1.4*mm) else: c.setStrokeColor(line_blue);c.setLineWidth(.20);c.line(12*mm,y-2.8*mm,W-12*mm,y-2.8*mm) y-=5.8*mm y-=1.2*mm c.save() print('font',hand_font) print(docx_path) print(pdf_path) PY python3 - <<'PY' from pathlib import Path from docx import Document from pypdf import PdfReader base=Path('/tmp/workspace/shakiba-handwritten-note/output') doc=Document(base/'Shakiba_referral_note_template_style.docx') colors=set() for p in doc.paragraphs: for r in p.runs: if r.font.color.rgb: colors.add(str(r.font.color.rgb)) pdf=PdfReader(base/'Shakiba_referral_note_template_style.pdf') text=''.join(x.extract_text() or '' for x in pdf.pages) print('docx paragraphs',len(doc.paragraphs),'colours',colors) print('pdf pages',len(pdf.pages),'chars',len(text),'title?', 'REFER FOR HEMATOLOGY' in text) PY

Reading File
Remade the case note to match the attached referral-sheet style:
  • Blue ink only
  • Underlined all-capital headings
  • Simple handwritten-style font
  • Sparse bullet-point layout
  • Grouped labs, imaging, marrow report, treatment history, and final referral question

Shakiba referral note template style

Word Document · DOCX

Shakiba referral note template style

PDF Document · PDF

Use this format

The revised note already uses the attached referral-note format: blue handwritten-style text, underlined capital headings, bullet points, and a final referral question.

Shakiba referral note template style

Word Document · DOCX

Shakiba referral note template style

PDF Document · PDF

This is a shared conversation. Sign in to Orris to start your own chat.