Make 20 weeks standard anomaly scan ultrasound report draft, follow ICRI and ISUOG guidelines

Reading File
Searching the Web

ISUOG 20 week anomaly scan ultrasound report guidelines 2024 parameters

Finding Sources
Reading Web Page

https://www.isuog.org/static/4e2ed89e-fa8a-42c2-9c0929cd89cb…

Finding Sources
Searching the Web

ICRI India anomaly scan report format 20 weeks second trimester guidelines

I now have comprehensive information from the ISUOG guidelines and supplementary sources. Let me produce the full report draft.
Here is the complete 20-week standard anomaly scan ultrasound report draft, aligned with ISUOG (routine mid-trimester fetal ultrasound) and ICRI (Indian College of Radiology and Imaging) guidelines:

STANDARD FETAL ANOMALY SCAN REPORT

(Mid-Trimester Ultrasound - 18 to 22 Weeks)

As per ISUOG Practice Guidelines & ICRI Standards

PATIENT INFORMATION

FieldDetails
Patient Name_________________________________
Age_______ years
Reg. / MRD No._________________________________
Referred ByDr. ______________________________
Date of Scan_________________________________
LMP_________________________________
Previous USG Dating_________________________________
GA by Dates_______ weeks _______ days
GA by Biometry_______ weeks _______ days
Gravida / Para / AbortionG ___ P ___ A ___
IndicationRoutine anomaly scan / ____________
Mode of Scan: Transabdominal (TA) / Transvaginal (TV) Machine Used: _____________________________ Probe: ____________ Clinical Correlation: ____________________________

SECTION 1: FETAL PRESENTATION & NUMBER

  • Lie: Longitudinal / Transverse / Oblique
  • Presentation: Cephalic / Breech / Transverse
  • Number of Fetuses: Singleton / Multiple
  • Fetal Cardiac Activity: Present - Regular / Irregular - Rate: _______ bpm

SECTION 2: FETAL BIOMETRY

(ISUOG standard planes; values referenced to INTERGROWTH-21st / WHO charts)
ParameterMeasurementGestational AgePercentile / Z-score
Biparietal Diameter (BPD)_______ mm_______ wks _______ d_______ %ile
Head Circumference (HC)_______ mm_______ wks _______ d_______ %ile
Abdominal Circumference (AC)_______ mm_______ wks _______ d_______ %ile
Femur Length (FL)_______ mm_______ wks _______ d_______ %ile
Estimated Fetal Weight (EFW)_______ g-_______ %ile
Reference Chart Used: INTERGROWTH-21st / Hadlock / _______________ Composite GA by Biometry: _______ weeks _______ days Estimated Date of Delivery (EDD): _______________________

SECTION 3: FETAL ANATOMY SURVEY

3A. HEAD AND BRAIN

StructureFinding
Shape of skull / CalvariumNormal ovoid / Abnormal: _________
Falx cerebri (midline echo)Present / Absent
Cavum Septi Pellucidi (CSP)Visualized / Not visualized
Cerebral ventricles (atrial width)Right: _______ mm Left: _______ mm (Normal: <10 mm)
Choroid plexusBilateral, symmetrical / Abnormal: _______
CerebellumPresent, normal size / Transverse diameter: _______ mm
Cisterna magna_______ mm (Normal: 2-10 mm)
Posterior fossaNormal / Abnormal: _____________
Brain parenchymaNormal echogenicity / ____________
Nuchal fold thickness_______ mm (Normal: <6 mm at 18-22 wks)

3B. FACE AND NECK

StructureFinding
Orbits / EyesBilateral, symmetrical / _________
Profile (mid-sagittal)Normal / Abnormal: _____________
Upper lip (coronal view)Intact / Cleft: ________________
Nasal bonePresent / Absent / Not assessed
Neck / Nuchal regionNormal / Cystic hygroma / _______

3C. SPINE

StructureFinding
Cervical spineNormal alignment and ossification / _______
Thoracic spineNormal / _______________________
Lumbar spineNormal / _______________________
Sacral spineNormal / _______________________
Skin covering (posterior)Intact / Defect seen at: _________
Neural tube defectNot seen / Suspected: ___________

3D. THORAX AND HEART

StructureFinding
Thorax shapeNormal / Abnormal: _____________
Lung echogenicityNormal / Echogenic: ____________
Heart position / SitusLevocardia / Dextrocardia / ______
Cardiac axisNormal (~45°, leftward) / Abnormal
Heart size (approx. 1/3 thorax)Normal / Enlarged / Small
4-chamber viewNormal / Abnormal: _____________
- LV / RV symmetrySymmetrical / Asymmetrical
- AV valvesNormal / _______________________
- Foramen ovale flapSeen in LA / __________________
- Interventricular septumIntact / VSD suspected
Left ventricular outflow tract (LVOT)Normal / Abnormal: _____________
Right ventricular outflow tract (RVOT)Normal / Abnormal: _____________
Crossing of great vesselsNormal / Parallel / Not seen
3-vessel trachea view (3VT)Normal / Abnormal: _____________
Cardiac rhythm (M-mode / Doppler)Regular / Irregular

3E. ABDOMEN

StructureFinding
Abdominal wall / Umbilical insertionIntact / Defect: ________________
StomachVisible, left side / Not seen / Situs inversus
LiverNormal / _______________________
BowelNon-dilated / Echogenic bowel / Dilated
Kidneys (bilateral)Present, normal echogenicity
- Right kidney_______ mm x _______ mm
- Left kidney_______ mm x _______ mm
Renal pelvis AP diameterRight: _______ mm Left: _______ mm (Alert: >7 mm)
Adrenal glandsNormal / _______________________
Urinary bladderVisible / Not seen
Intra-abdominal cystsNone / _______________________

3F. GENITALIA

  • Fetal Sex (if requested/consented): Male / Female / Not determined / Not disclosed per PC-PNDT Act
  • External genitalia appearance: Normal for stated sex / _______________
Note: In India, sex determination and disclosure are prohibited under the PC-PNDT Act, 1994. The sex of the fetus will NOT be disclosed.

3G. SKELETAL SURVEY / LIMBS

StructureFinding
Upper limbs (bilateral)Both present, normal appearance / __
- Humerus (both)Visualized / __________________
- Radius / Ulna (both)Visualized / __________________
- Hands (both)Visualized / ___________________
Lower limbs (bilateral)Both present, normal appearance / __
- Femur (both)Visualized / __________________
- Tibia / Fibula (both)Visualized / __________________
- Feet (both)Visualized / Clubfoot suspected / __
Bone echogenicityNormal / Reduced mineralization
Limb movementsActive / Reduced

SECTION 4: PLACENTA

ParameterFinding
Placental locationAnterior / Posterior / Fundal / Lateral / Low-lying
Placental grade (Grannum)Grade 0 / I / II / III
Placental thickness_______ mm
Placental echogenicityHomogeneous / Heterogeneous
Distance from internal os_______ mm (Normal: >20 mm acceptable; refer if <20 mm)
Placenta praeviaNot seen / Suspected / Present
Retroplacental clear zonePresent / Absent
Subchorionic hemorrhageNot seen / Present: _____________
Cord insertionCentral / Eccentric / Marginal / Velamentous

SECTION 5: UMBILICAL CORD

ParameterFinding
Number of cord vessels3-vessel cord (2 arteries + 1 vein) / 2-vessel cord
Cord presentation / positionNormal / _______________________
Umbilical artery Doppler (if indicated)S/D ratio: _______ PI: _______ RI: _______
Single umbilical artery (SUA)Not detected / Detected

SECTION 6: AMNIOTIC FLUID

ParameterFinding
Amniotic fluid volume (subjective)Normal / Increased (Polyhydramnios) / Reduced (Oligohydramnios)
Amniotic Fluid Index (AFI)_______ cm (Normal: 8-24 cm)
Single Deepest Pocket (SDP)_______ cm (Normal: 2-8 cm)
Echogenic particlesNot seen / Present

SECTION 7: UTERUS AND ADNEXA

ParameterFinding
Uterine wallNormal / Fibroids: ______________
Lower uterine segmentNormal / _______________________
Cervical length (if indicated)_______ mm (Normal: >25 mm)
Cervical osClosed / Dilated / Funneling
Right adnexaNormal / Cyst: _________________
Left adnexaNormal / Cyst: _________________
Periuterine massesNot seen / _____________________

SECTION 8: SOFT MARKERS FOR ANEUPLOIDY

(Document if present; counsel appropriately)
MarkerPresentAbsentMeasurement
Nuchal fold thickness (≥6 mm = significant)_______ mm
Echogenic cardiac focus (ECF)
Choroid plexus cyst (CPC)
Mild ventriculomegaly (10-15 mm)
Echogenic bowel
Renal pelvis dilatation (>7 mm)
Short femur / humerus
Two-vessel cord
Absent / hypoplastic nasal bone

SECTION 9: FETAL WELLBEING (if assessed)

  • Fetal Tone: Present (limb extension-flexion noted) / Absent
  • Fetal Movements: Active / Reduced
  • Fetal Breathing Movements: Present / Absent
  • Biophysical Profile (BPP) Score (if done): _______ / 8

SECTION 10: DOPPLER (if clinically indicated)

VesselParameterValueInterpretation
Umbilical arteryS/D ratio
Umbilical arteryPI
Umbilical arteryRI
Middle cerebral artery (MCA)Peak systolic velocity (PSV)
Uterine artery (if indicated)PI bilateral

SECTION 11: SUMMARY OF FINDINGS

Biometry consistent with: _______ weeks _______ days gestation Fetal anatomy survey: Complete / Incomplete (reason: _______________) Anomalies detected: None / Yes (see details below)
Details of any anomaly / finding requiring follow-up:




SECTION 12: IMPRESSION / CONCLUSION

SINGLE LIVE INTRAUTERINE FETUS IN _____ PRESENTATION GESTATIONAL AGE: _______ WEEKS _______ DAYS (by composite biometry) ESTIMATED DATE OF DELIVERY (EDD): _______________________
  1. Fetal biometry is appropriate for gestational age / _____________________.
  2. Fetal cardiac activity is regular at _______ bpm.
  3. Fetal anatomy survey is complete and shows no gross structural anomaly detected at this time / ANOMALY DETECTED: _________________________.
  4. Placenta is ______________ (location) and is not low-lying / is low-lying - repeat scan at 32 weeks advised.
  5. Amniotic fluid is normal / Oligohydramnios / Polyhydramnios (AFI: _______ cm).
  6. Umbilical cord shows a 3-vessel cord with normal insertion.
  7. Soft markers: None identified / Present - genetic counseling advised.
  8. Cervical length: _______ mm - Normal / Cervical incompetence suspected.
Recommendation / Advice:
  • No further action at this time; routine obstetric follow-up
  • Repeat scan at _______ weeks for: _________________________
  • Refer to Fetal Medicine Unit for: __________________________
  • Fetal echocardiography advised
  • Genetic counseling / amniocentesis discussion advised
  • Additional views could not be obtained due to: fetal position / maternal habitus / _______________

AUTHORISATION

Report prepared by: Name: _______________________________ Qualification: _________________________ (MD / DNB / DMRD / MBBS) Registration No.: ______________________
Report verified / countersigned by (if applicable): Name: _______________________________ Qualification: _________________________ Registration No.: ______________________
Date & Time of Report: _______________________________ Signature & Stamp: _______________________________ Centre Name & Address: _______________________________ PC-PNDT Registration No.: _______________________________

TECHNICAL NOTES & QUALITY FLAGS

  • Examination technically satisfactory
  • Suboptimal views due to: fetal position / maternal BMI / oligohydramnios / ___
  • Structures not adequately visualized (list): _________________________
  • Scan repeated on same day for incomplete views
  • Referral made for incomplete examination
  • Images archived as per institutional policy

DISCLAIMER

This report documents a screening ultrasound examination. A normal scan does not exclude all fetal anomalies. The sensitivity of ultrasound for detecting anomalies varies by organ system, gestational age, maternal factors, and equipment quality. Clinical correlation is essential. All findings should be interpreted in conjunction with clinical history, biochemical markers, and prior investigations.
Sex determination and disclosure is strictly prohibited under the Pre-Conception and Pre-Natal Diagnostic Techniques (PC-PNDT) Act, 1994, Government of India.

Key References:

Key points about this draft:
  1. ISUOG compliance - All mandatory structures (4-chamber view, LVOT, RVOT, 3VT view, CSP, cisterna magna, nuchal fold, renal pelvis, abdominal wall, lips) are included per ISUOG's minimum checklist.
  2. ICRI compliance - Includes PC-PNDT Act disclaimer (mandatory in India), centre registration number, and qualification documentation requirements.
  3. Biometry standard - Recommends INTERGROWTH-21st as the reference chart (preferred by ISUOG) but allows Hadlock or locally mandated charts.
  4. Soft markers - Dedicated section for aneuploidy soft markers with the ISUOG-recommended thresholds (nuchal fold ≥6 mm, ventriculomegaly ≥10 mm, renal pelvis >7 mm).
  5. Incomplete scan - Space to document technically limited views, per ISUOG's requirement to record reasons for deviations.
  6. Sex non-disclosure - Prominently noted in two places, as legally mandated in India.

Make final draft considering pcpndt law in mind

Searching the Web

PC-PNDT Act 2024 Form F ultrasound report mandatory fields requirements India

Reading Web Page

https://nhmmeghalaya.nic.in/programmes/pcpndt/form-f.pdf

I now have all the PC-PNDT Form F mandatory fields. Here is the complete final draft:

FORM F

[See proviso to Section 4(3), Rule 9(4) and Rule 10(1A)]

Pre-Conception and Pre-Natal Diagnostic Techniques (Prohibition of Sex Selection) Act, 1994 (Amended 4th February 2014, Notified 31st January 2014)
FORM FOR MAINTENANCE OF RECORD IN CASE OF PRENATAL DIAGNOSTIC PROCEDURE ULTRASOUND CLINIC / IMAGING CENTRE

SECTION A - CENTRE & PATIENT IDENTIFICATION

(Mandatory under PC-PNDT Act - to be filled for ALL ultrasound procedures)
1. Name and complete address of Ultrasound Clinic / Imaging Centre:


City: _________________ State: _________________ PIN: _________ Tel: __________________ Email: _____________________________
2. Registration No. under PC&PNDT Act, 1994: _________________ Valid up to: _______________________
3. Patient's Name: _________________________ Age: _______ years
4. Total number of living children:
  • (a) Number of living Sons with age of each (in years/months): _________________________
  • (b) Number of living Daughters with age of each (in years/months): ___________________
5. Husband's / Father's / Mother's Name: _________________________________
6. Full postal address of patient with contact number:

Contact No.: _________________
7. (a) Referred by (Full name and address of referring doctor): ________________________

(b) Indication for ultrasound (tick all appropriate):
Indication
Estimation of gestational age / dating
Detection of chromosomal abnormalities, fetal structural defects and other abnormalities (ANOMALY SCAN)
Evaluation of fetal growth parameters, fetal weight and fetal wellbeing
Evaluation of placental position, thickness, grading and abnormalities
Evaluation of umbilical cord - insertion, number of vessels
Assessment of liquor amnii
Evaluation of fetal presentation and position
Color flow mapping and duplex Doppler studies
Any suspected adnexal or uterine pathology
Other: __________________________________________________

SECTION B - OBSTETRIC ULTRASOUND REPORT

(Standard Anomaly Scan - 18 to 22 weeks | ISUOG & ICRI Guidelines)

B1. SCAN DETAILS

Date of scan
Time of scan
LMP (Last Menstrual Period)
GA by LMP_______ weeks _______ days
GA by previous USG (if done)_______ weeks _______ days (USG date: ________)
EDD by dates
Mode of scanTransabdominal (TA) / Transvaginal (TV)
Machine & Model
Probe

B2. FETAL VIABILITY & PRESENTATION

ParameterFinding
Number of fetusesSingleton / Multiple
Fetal cardiac activityPresent - Regular / Rate: _______ bpm
Fetal lieLongitudinal / Transverse / Oblique
PresentationCephalic / Breech / Transverse

B3. FETAL BIOMETRY

(Measured as per ISUOG standard planes; referenced to INTERGROWTH-21st / Hadlock)
ParameterMeasurementGA EquivalentPercentile
Biparietal Diameter (BPD)_______ mm_______ wks _______ d_______ %ile
Head Circumference (HC)_______ mm_______ wks _______ d_______ %ile
Abdominal Circumference (AC)_______ mm_______ wks _______ d_______ %ile
Femur Length (FL)_______ mm_______ wks _______ d_______ %ile
Estimated Fetal Weight (EFW)_______ grams_______ %ile
Reference chart used: INTERGROWTH-21st / Hadlock / _____________ Composite GA by biometry: _______ weeks _______ days EDD by biometry: _______________________

B4. FETAL ANATOMY SURVEY

CRANIUM & BRAIN

StructureNormalAbnormal / Comment
Skull shape & integrity (ovoid)
Midline falx cerebri
Cavum septi pellucidi (CSP)
Lateral ventricles - atrial widthR: _____ mm L: _____ mm (normal <10 mm)
Choroid plexus (bilateral)
CerebellumTransverse diameter: _______ mm
Cisterna magna_______ mm (normal 2-10 mm)
Brain parenchyma echogenicity
Nuchal fold thickness_______ mm (alert if ≥6 mm)

FACE & NECK

StructureNormalAbnormal / Comment
Orbits / eyes (bilateral)
Mid-sagittal facial profile
Upper lip - coronal viewIntact / Cleft: ______________
Nasal bonePresent / Absent / Not assessed
Neck / Nuchal region

SPINE

StructureNormalAbnormal / Comment
Cervical spine
Thoracic spine
Lumbar spine
Sacral spine
Posterior skin coveringIntact / Defect at: ___________
Neural tube defect☐ not seenSuspected: _________________

THORAX & HEART

StructureNormalAbnormal / Comment
Thorax shape
Lung echogenicity (bilateral)
Cardiac situs / position☐ LevocardiaDextrocardia / ______________
Cardiac axis (~45° leftward)
Heart size (~1/3 thorax)
4-chamber view
- LV / RV symmetry
- Atrioventricular valves
- Foramen ovale flap in LA
- Interventricular septum (IVS)☐ intactVSD suspected / ____________
- Interatrial septum
LVOT (Left ventricular outflow tract)
RVOT (Right ventricular outflow tract)
Crossing of great vesselsParallel / Not seen
3-vessel trachea view (3VT)
Cardiac rhythm☐ RegularIrregular / Rate: _______ bpm

ABDOMEN

StructureNormalAbnormal / Comment
Anterior abdominal wall☐ intactDefect: __________________
Umbilical cord insertion into abdomen☐ normal
Stomach (visible, left side)Not seen / Double bubble / _____
Liver
Bowel☐ non-dilatedEchogenic bowel / Dilated
Right kidneySize: _______ mm x _______ mm
Left kidneySize: _______ mm x _______ mm
Renal pelvis AP diameter☐ normalR: _____ mm L: _____ mm (alert >7 mm)
Urinary bladder☐ visibleNot seen
Adrenal glands
Intra-abdominal masses / cysts☐ nonePresent: __________________

SKELETAL / LIMBS

StructureNormalAbnormal / Comment
Right upper limb (humerus, radius/ulna, hand)
Left upper limb (humerus, radius/ulna, hand)
Right lower limb (femur, tibia/fibula, foot)
Left lower limb (femur, tibia/fibula, foot)
Bone echogenicity / mineralization☐ normalReduced / _________________
Fetal movements observed☐ activeReduced

B5. PLACENTA

ParameterFinding
LocationAnterior / Posterior / Fundal / Lateral / Low-lying
Placental thickness_______ mm
Grading (Grannum)Grade 0 / I / II / III
EchogenicityHomogeneous / Heterogeneous
Distance of lower edge from internal os_______ mm
Placenta praeviaNot seen / Suspected - repeat scan at 32 wks
Retroplacental clear zonePresent / Absent
Subchorionic haemorrhageNot seen / Present: ____________
Placental cord insertionCentral / Eccentric / Marginal / Velamentous

B6. UMBILICAL CORD

ParameterFinding
Number of vessels3-vessel cord (2 arteries + 1 vein) / 2-vessel cord (SUA)
Cord presentationNormal / Nuchal cord / __________
Umbilical artery Doppler (if indicated)S/D: _______ PI: _______ RI: _______

B7. AMNIOTIC FLUID

ParameterFinding
Subjective assessmentNormal / Polyhydramnios / Oligohydramnios
Amniotic Fluid Index (AFI)_______ cm (normal 8-24 cm)
Single Deepest Pocket (SDP)_______ cm (normal 2-8 cm)

B8. UTERUS & CERVIX

ParameterFinding
Uterine wallNormal / Fibroid(s): size _________ location _________
Lower uterine segmentNormal / Scar: ________________
Cervical length (if indicated)_______ mm (normal >25 mm)
Cervical internal osClosed / Dilated / Funneling seen
Adnexa - RightNormal / Cyst: ________________
Adnexa - LeftNormal / Cyst: ________________

B9. SOFT MARKERS FOR ANEUPLOIDY

(Document presence/absence; provide genetic counseling if ≥2 markers present)
Soft MarkerAbsentPresentValue
Nuchal fold ≥6 mm_______ mm
Echogenic intracardiac focus (EIF)
Choroid plexus cysts (CPC)
Mild ventriculomegaly (10-15 mm)_______ mm
Echogenic bowel
Renal pelvis dilatation >7 mm_______ mm
Short femur (<5th centile)
Short humerus (<5th centile)
Absent / hypoplastic nasal bone
Two-vessel cord (SUA)

B10. DOPPLER (if clinically indicated)

VesselS/DPIRIInterpretation
Umbilical artery (UA)
Middle cerebral artery (MCA) - PSV
Uterine artery (bilateral, if indicated)

B11. TECHNICAL QUALITY NOTE

  • ☐ Examination technically satisfactory - all structures adequately visualized
  • ☐ Suboptimal views: fetal position / maternal BMI / oligohydramnios / ________________
  • ☐ Structures not adequately visualized: ___________________________________________
  • ☐ Repeat scan recommended to complete examination
  • ☐ Patient referred to Fetal Medicine Unit for incomplete/abnormal findings

SECTION C - SUMMARY & IMPRESSION

SINGLE / MULTIPLE LIVE INTRAUTERINE FETUS / FETUSES IN _________________________ PRESENTATION
FindingDetail
Composite GA by biometry_______ weeks _______ days
EDD (by biometry)
Fetal heart rate_______ bpm, regular
Anatomy surveyComplete / Incomplete
Gross structural anomalyNot detected / Detected (see below)
PlacentaLocation: _______
Amniotic fluidNormal / Abnormal (AFI: _______ cm)
Umbilical cord3-vessel / 2-vessel cord
Soft markersNone / Present (as listed in B9)
CervixNormal (_______ mm) / Short cervix
Anomaly / Additional Findings (if any):


Recommendations:
  • ☐ Routine obstetric follow-up; no further USG action required at this time
  • ☐ Repeat scan at _______ weeks for: _______________________________________
  • ☐ Refer to Fetal Medicine Unit / Level III centre for: ___________________________
  • ☐ Fetal echocardiography advised
  • ☐ Genetic counseling advised (soft markers / family history / biochemistry)
  • ☐ Amniocentesis / invasive testing discussion
  • ☐ Placenta praevia - repeat scan at 32 weeks mandatory

SECTION D - DECLARATIONS (MANDATORY UNDER PC-PNDT ACT)


DECLARATION BY PATIENT

(To be obtained BEFORE the procedure, in a language the patient understands)
I, _________________________________ (name of patient), wife / daughter of _____________________________, residing at _________________________________________________, do hereby declare that I do not want to know the sex of my fetus.
Signature / Left Thumb Impression of Patient: _______________________
Date: _______________
(If thumb impression: Signature of person attesting: _________________ Date: _______)

DECLARATION BY DOCTOR / PERSON CONDUCTING ULTRASONOGRAPHY

(Three signatures of the doctor are required on Form F as per PC-PNDT Rules)
I, __________________________________ (name of person conducting ultrasonography / image scanning), declare that while conducting ultrasonography / image scanning on Ms. __________________________________ (name of the pregnant woman), I have neither detected nor disclosed the sex of the fetus to anybody in any manner.
Signature of Doctor (1st): _______________________ (At time of procedure)
Signature of Doctor (2nd): _______________________ (On the report)
Signature of Doctor (3rd): _______________________ (On the Form F record copy)
Name of Doctor: _________________________________ Qualifications: __________________________________ (MD Radiology / DNB Radiology / DMRD / DMRE / MS Obs-Gyn / MBBS with 6-month USG training) MCI / NMC Registration No.: ______________________ Date: ___________________ Stamp of Doctor / Centre: ________________________

SECTION E - ADMINISTRATIVE RECORD

(For centre use and submission to Appropriate Authority)
Form F Serial No.
Date of scan
Copy 1Submitted to Appropriate Authority by: _______ (date)
Copy 2Retained at centre (to be preserved for 2 years)
Online submission doneYes / No
Printout preserved with patient signatureYes / No
Report signed by:Doctor performing USG (not centre owner)

NOTICES MANDATORILY DISPLAYED AT CENTRE (per Rule 17)

"Disclosure of sex of fetus is prohibited under law. Sex determination is not done at this centre." (To be displayed in English and local language)

DISCLAIMER

This report constitutes a screening examination. A normal scan does not exclude all fetal anomalies - sensitivity varies by organ system, GA, maternal habitus, fetal position, and equipment. All findings must be clinically correlated.
This report is prepared in full compliance with the Pre-Conception and Pre-Natal Diagnostic Techniques (Prohibition of Sex Selection) Act, 1994, and its amendments. Sex of the fetus has not been determined or disclosed. Violation is a cognizable, non-bailable offence punishable with imprisonment up to 3 years and fine up to Rs. 10,000 for a first offence, and up to 5 years and Rs. 50,000 for subsequent offences, along with removal from the MCI/NMC register.

Report references: ISUOG Mid-Trimester Fetal Ultrasound Guidelines | PC-PNDT Act 1994 & 2014 Amendment | ICRI Standards

What changed in this final draft vs. the previous version:
AreaWhat was added / changed
Form F structureReport is now built inside the official PC-PNDT Form F framework (Section A = mandatory patient fields per the Act)
Patient declarationMandatory pre-procedure declaration by patient that she does not want to know the sex
Doctor declarationMandatory 3-signature doctor declaration (at procedure, on report, on record copy) that sex was neither detected nor disclosed
Living childrenForm F mandatory field - number of living sons and daughters with ages
PC-PNDT Reg. No.Prominently placed at the top, next to centre name
Genitalia section removedCompletely removed - PC-PNDT prohibits any documentation that could imply sex determination
Fetal sex field removedRemoved entirely - no "male/female/not disclosed" option - the field does not exist in this report
Two-copy record keepingAdministrative section documents copy 1 (Appropriate Authority) and copy 2 (clinic, 2 years)
Online Form F complianceProvision for portal reference number and printout with patient signature
Penalty clauseSpecific criminal penalties noted in the disclaimer

Make b/l lower limb varicose veins doppler report

Finding Sources
Searching the Web

bilateral lower limb varicose veins venous duplex doppler ultrasound report format SVS AVF guidelines 2024

Finding Sources
Searching the Web

venous duplex ultrasound varicose veins report template deep superficial perforator reflux CEAP GSV SSV

Finding Sources
Finding Sources
I have all the data needed. Here is the complete, fully structured bilateral lower limb varicose veins duplex Doppler report:

VENOUS DUPLEX DOPPLER ULTRASOUND REPORT

Bilateral Lower Limb Varicose Veins / Chronic Venous Disease Assessment


SECTION 1 - PATIENT & REFERRAL DETAILS

Patient Name
Age / Sex/ Female / Male
Reg. / MRD No.
Date of Scan
Referred ByDr.
Clinical IndicationBilateral lower limb varicose veins / leg swelling / leg pain / venous ulcer / pre-treatment mapping
Previous vein treatmentNone / Sclerotherapy / EVLA / Surgery (specify: ___________)

SECTION 2 - TECHNIQUE & EQUIPMENT

Machine
TransducerLinear / 7.5-15 MHz
Patient positionStanding / Reverse Trendelenburg (preferred for reflux testing)
Compression usedManual calf squeeze / Pneumatic cuff deflation
Valsalva usedYes (for SFJ / CFV) / No
Modes usedB-mode (greyscale) + Color Doppler + Spectral Doppler (Duplex)
Scan performed by
Interpreted by
Reflux threshold used (per SVS/AVF/AVLS 2023 Guidelines):
  • Superficial veins (GSV, SSV, AAGV, perforators): >500 ms retrograde flow = significant reflux
  • Deep veins (CFV, FV, Popliteal vein): >1000 ms retrograde flow = significant reflux

SECTION 3 - RIGHT LOWER LIMB

3A. DEEP VENOUS SYSTEM - RIGHT

(Assessed for patency, compressibility, thrombus, and reflux)
Vein SegmentCompressibleFlowAugmentationReflux DurationInterpretation
Common Femoral Vein (CFV)☐ Yes ☐ NoPhasic / Non-phasicPresent / Absent_______ msNormal / Reflux
Femoral Vein (FV) - proximal☐ Yes ☐ No_______ msNormal / Reflux
Femoral Vein (FV) - mid☐ Yes ☐ No_______ msNormal / Reflux
Femoral Vein (FV) - distal☐ Yes ☐ No_______ msNormal / Reflux
Deep Femoral Vein (Profunda)☐ Yes ☐ No_______ msNormal / Reflux
Popliteal Vein (POPV)☐ Yes ☐ No_______ msNormal / Reflux
Posterior Tibial Veins☐ Yes ☐ No_______ msNormal / Reflux
Peroneal Veins☐ Yes ☐ No_______ msNormal / Reflux
Anterior Tibial Veins☐ Yes ☐ No_______ msNormal / Reflux
Gastrocnemius Veins☐ Yes ☐ No_______ msNormal / Reflux
Soleal Veins☐ Yes ☐ No_______ msNormal / Reflux
DVT detected (Right): None / Acute DVT at: ________________ / Chronic changes at: ________________

3B. SUPERFICIAL VENOUS SYSTEM - RIGHT

Saphenofemoral Junction (SFJ) - Right

ParameterFinding
SFJ location_______ cm below inguinal ligament
SFJ competenceCompetent / Incompetent
Reflux at SFJ (Valsalva)No reflux / Reflux: _______ ms
Tributaries at SFJNormal / Accessory saphenous vein entering / __________

Great Saphenous Vein (GSV) - Right

SegmentDiameter (mm)In Saphenous CanalReflux DurationReflux Present
GSV - groin / proximal thigh_______ mm☐ Yes ☐ No_______ ms☐ Yes ☐ No
GSV - mid thigh_______ mm☐ Yes ☐ No_______ ms☐ Yes ☐ No
GSV - distal thigh_______ mm☐ Yes ☐ No_______ ms☐ Yes ☐ No
GSV - above knee_______ mm☐ Yes ☐ No_______ ms☐ Yes ☐ No
GSV - below knee_______ mm☐ Yes ☐ No_______ ms☐ Yes ☐ No
GSV - ankle level_______ mm☐ Yes ☐ No_______ ms☐ Yes ☐ No
GSV total refluxing length (Right): _______ cm GSV wall / morphology: Normal / Thickened wall / Intraluminal echoes / Post-thrombotic changes

Anterior Accessory Great Saphenous Vein (AAGSV) - Right

ParameterFinding
AAGSV visibleYes / No
Diameter_______ mm
RefluxNo / Yes: _______ ms

Posterior Accessory Great Saphenous Vein / Giacomini Vein - Right

ParameterFinding
VisibleYes / No
RefluxNo / Yes: _______ ms

3C. SMALL SAPHENOUS VEIN (SSV) - RIGHT

Saphenopopliteal Junction (SPJ) - Right

ParameterFinding
SPJ present / identifiableYes / No (absent in ~10-30% cases)
SPJ level_______ cm above popliteal crease
SPJ competenceCompetent / Incompetent
Reflux at SPJNo reflux / Reflux: _______ ms
SSV cranial extension (Giacomini)Present / Absent
SSV SegmentDiameter (mm)Reflux DurationReflux Present
SSV - upper calf_______ mm_______ ms☐ Yes ☐ No
SSV - mid calf_______ mm_______ ms☐ Yes ☐ No
SSV - lower calf_______ mm_______ ms☐ Yes ☐ No
SSV total refluxing length (Right): _______ cm

3D. INCOMPETENT PERFORATING VEINS (IPVs) - RIGHT

(Pathological perforator: outward flow ≥500 ms AND diameter ≥3.5 mm - per SVS/AVF 2023)
LocationLevelDiameter (mm)Outward Flow Duration (ms)Connecting toSignificant
Medial thigh_______ cm from groin_______ mm_______ msGSV / Tributary☐ Yes ☐ No
Hunterian perforatorMid thigh_______ mm_______ msGSV / FV☐ Yes ☐ No
Dodd's perforatorDistal thigh_______ mm_______ msGSV / FV☐ Yes ☐ No
Boyd's perforatorBelow knee_______ mm_______ msGSV / PT☐ Yes ☐ No
Cockett I (medial ankle)_______ cm from medial malleolus_______ mm_______ msPosterior arch / GSV☐ Yes ☐ No
Cockett II_______ cm from medial malleolus_______ mm_______ ms☐ Yes ☐ No
Cockett III_______ cm from medial malleolus_______ mm_______ ms☐ Yes ☐ No
Posterior tibial perforator_______ mm_______ ms☐ Yes ☐ No
Paratibial_______ mm_______ ms☐ Yes ☐ No
Lateral leg_______ mm_______ msSSV / tributary☐ Yes ☐ No
Total pathological perforators identified (Right): _______

3E. VARICOSITIES - RIGHT

LocationDistributionApprox. DiameterSource of Filling
Medial thighPresent / Absent_______ mmGSV trunk / AAGSV / perforator
Medial legPresent / Absent_______ mmGSV / Cockett perforator
Lateral thighPresent / Absent_______ mmSSV / LAGSV
Posterior calfPresent / Absent_______ mmSSV / perforator
Anterior legPresent / Absent_______ mm
Ankle / gaiter zonePresent / Absent_______ mmCockett perforator

3F. SKIN & SOFT TISSUE - RIGHT

FindingPresent / AbsentDetails
Pitting oedema
Haemosiderin / pigmentationSite: __________
LipodermatosclerosisSite: __________
Corona phlebectaticaAt ankle
Healed ulcerSite: __________
Active venous ulcerSite / size: _____
TelangiectasiasDistribution: ____

SECTION 4 - LEFT LOWER LIMB

4A. DEEP VENOUS SYSTEM - LEFT

Vein SegmentCompressibleFlowAugmentationReflux DurationInterpretation
Common Femoral Vein (CFV)☐ Yes ☐ NoPhasic / Non-phasicPresent / Absent_______ msNormal / Reflux
Femoral Vein (FV) - proximal☐ Yes ☐ No_______ msNormal / Reflux
Femoral Vein (FV) - mid☐ Yes ☐ No_______ msNormal / Reflux
Femoral Vein (FV) - distal☐ Yes ☐ No_______ msNormal / Reflux
Deep Femoral Vein (Profunda)☐ Yes ☐ No_______ msNormal / Reflux
Popliteal Vein (POPV)☐ Yes ☐ No_______ msNormal / Reflux
Posterior Tibial Veins☐ Yes ☐ No_______ msNormal / Reflux
Peroneal Veins☐ Yes ☐ No_______ msNormal / Reflux
Anterior Tibial Veins☐ Yes ☐ No_______ msNormal / Reflux
Gastrocnemius Veins☐ Yes ☐ No_______ msNormal / Reflux
Soleal Veins☐ Yes ☐ No_______ msNormal / Reflux
DVT detected (Left): None / Acute DVT at: ________________ / Chronic changes at: ________________

4B. SUPERFICIAL VENOUS SYSTEM - LEFT

Saphenofemoral Junction (SFJ) - Left

ParameterFinding
SFJ competenceCompetent / Incompetent
Reflux at SFJ (Valsalva)No reflux / Reflux: _______ ms
Tributaries at SFJNormal / ________________________________

Great Saphenous Vein (GSV) - Left

SegmentDiameter (mm)In Saphenous CanalReflux DurationReflux Present
GSV - groin / proximal thigh_______ mm☐ Yes ☐ No_______ ms☐ Yes ☐ No
GSV - mid thigh_______ mm☐ Yes ☐ No_______ ms☐ Yes ☐ No
GSV - distal thigh_______ mm☐ Yes ☐ No_______ ms☐ Yes ☐ No
GSV - above knee_______ mm☐ Yes ☐ No_______ ms☐ Yes ☐ No
GSV - below knee_______ mm☐ Yes ☐ No_______ ms☐ Yes ☐ No
GSV - ankle level_______ mm☐ Yes ☐ No_______ ms☐ Yes ☐ No
GSV total refluxing length (Left): _______ cm

AAGSV / Giacomini - Left

ParameterFinding
AAGSV visibleYes / No

4C. SMALL SAPHENOUS VEIN (SSV) - LEFT

Saphenopopliteal Junction (SPJ) - Left

ParameterFinding
SPJ identifiableYes / No
SPJ level_______ cm above popliteal crease
SPJ competenceCompetent / Incompetent
Reflux at SPJNo reflux / Reflux: _______ ms
SSV SegmentDiameter (mm)Reflux DurationReflux Present
SSV - upper calf_______ mm_______ ms☐ Yes ☐ No
SSV - mid calf_______ mm_______ ms☐ Yes ☐ No
SSV - lower calf_______ mm_______ ms☐ Yes ☐ No
SSV total refluxing length (Left): _______ cm

4D. INCOMPETENT PERFORATING VEINS (IPVs) - LEFT

(Same perforator groups as Right - fill as applicable)
LocationDiameter (mm)Outward Flow (ms)Significant
Medial thigh☐ Yes ☐ No
Hunterian☐ Yes ☐ No
Dodd's☐ Yes ☐ No
Boyd's☐ Yes ☐ No
Cockett I / II / III☐ Yes ☐ No
Paratibial☐ Yes ☐ No
Lateral leg☐ Yes ☐ No
Total pathological perforators (Left): _______

4E. VARICOSITIES - LEFT

LocationDistributionSource of Filling
Medial thighPresent / Absent
Medial legPresent / Absent
Lateral thighPresent / Absent
Posterior calfPresent / Absent
Ankle / gaiter zonePresent / Absent

4F. SKIN & SOFT TISSUE - LEFT

(Same as Right - fill as applicable) Pigmentation / Lipodermatosclerosis / Corona phlebectatica / Ulcer: ___________________________

SECTION 5 - REFLUX PATTERN CLASSIFICATION (BILATERAL SUMMARY)

(Per SVS/AVF/AVLS 2023 and UIP Consensus Document)
Reflux PatternRightLeft
Axial reflux (uninterrupted, groin to calf)☐ Present ☐ Absent☐ Present ☐ Absent
Junctional reflux only (SFJ or SPJ isolated)☐ Present ☐ Absent☐ Present ☐ Absent
Segmental reflux (portion of truncal vein only)☐ Present ☐ Absent☐ Present ☐ Absent
Deep vein reflux☐ Present ☐ Absent☐ Present ☐ Absent
Perforator-sourced reflux☐ Present ☐ Absent☐ Present ☐ Absent
Pelvic source suspected☐ Present ☐ Absent☐ Present ☐ Absent

SECTION 6 - CEAP CLASSIFICATION

(2020 Updated CEAP - American Venous Forum)
ComponentRightLeft
C - Clinical classC__ (see below)C__
E - EtiologyEp (primary) / Es (secondary/post-thrombotic) / Ec (congenital)
A - AnatomyAs (superficial) / Ad (deep) / Ap (perforator)
P - PathophysiologyPr (reflux) / Po (obstruction) / Pr,o (both)
Clinical Class Key:
ClassDescription
C0No visible or palpable signs of venous disease
C1Telangiectasias or reticular veins
C2Varicose veins
C2rRecurrent varicose veins
C3Oedema
C4aPigmentation or eczema
C4bLipodermatosclerosis or atrophie blanche
C4cCorona phlebectatica
C5Healed venous ulcer
C6Active venous ulcer
C6rRecurrent active venous ulcer
Suffix: s = symptomatic (pain, heaviness, swelling, achiness, itching - HASTI symptoms) / a = asymptomatic
Right CEAP: C___ E___ A___ P___ () Left CEAP: C E_ A___ P___ (_____)

SECTION 7 - SUMMARY OF FINDINGS

RIGHT LOWER LIMB

Deep system: Patent with no DVT. Deep venous reflux: Present / Absent (at ________________).
Superficial system:
  • SFJ: Competent / Incompetent with reflux of _______ ms
  • GSV: Reflux present from ______________ to ______________ (total _______ cm)
  • GSV diameter at SFJ: _______ mm; at below knee: _______ mm
  • SSV / SPJ: Competent / Incompetent with reflux of _______ ms
  • Reflux pattern: Axial / Junctional / Segmental
Perforators: _______ pathological perforator(s) at: _______________________________
Varicosities: Present in _________________ distribution, sourced from _________________
Skin changes: None / Pigmentation / LDS / Ulcer at _______________________________

LEFT LOWER LIMB

Deep system: Patent with no DVT. Deep venous reflux: Present / Absent (at ________________).
Superficial system:
  • SFJ: Competent / Incompetent with reflux of _______ ms
  • GSV: Reflux present from ______________ to ______________ (total _______ cm)
  • GSV diameter at SFJ: _______ mm; at below knee: _______ mm
  • SSV / SPJ: Competent / Incompetent with reflux of _______ ms
  • Reflux pattern: Axial / Junctional / Segmental
Perforators: _______ pathological perforator(s) at: _______________________________
Varicosities: Present in _________________ distribution, sourced from _________________
Skin changes: None / Pigmentation / LDS / Ulcer at _______________________________

SECTION 8 - IMPRESSION

RIGHT: C___ E___ A___ P___ (s/a)
Chronic venous insufficiency, right lower limb. [GSV axial reflux / SFJ junctional reflux / SSV reflux / isolated perforator reflux] from ___________________ to ___________________. Deep venous system patent. [No DVT / DVT at ___________________.]
LEFT: C___ E___ A___ P___ (s/a)
Chronic venous insufficiency, left lower limb. [GSV axial reflux / SFJ junctional reflux / SSV reflux / isolated perforator reflux] from ___________________ to ___________________. Deep venous system patent. [No DVT / DVT at ___________________.]

SECTION 9 - CLINICAL CORRELATION & RECOMMENDATION

  • ☐ Findings support conservative management (compression stockings, lifestyle) for C2/C3 disease
  • ☐ Patient suitable for endovenous thermal ablation (EVLA / RFA) of GSV - right / left
  • ☐ Patient suitable for ultrasound-guided foam sclerotherapy (UGFS) of ___________________
  • ☐ Patient suitable for phlebectomy / stab avulsions of varicosities
  • ☐ Perforator ablation (MOCA / UGFS) advised for IPVs at ____________________________
  • ☐ DVT found - anticoagulation workup recommended; further haematology referral
  • ☐ Deep venous reflux present - refer to vascular surgery for further evaluation
  • ☐ Pelvic source suspected - pelvic venous duplex / CT venography recommended
  • ☐ Pre-treatment anatomical mapping complete for planned intervention
  • ☐ Post-treatment follow-up scan - occlusion confirmed / re-canalisation noted

AUTHORISATION

Report prepared by
QualificationMD Radiology / DNB Radiology / DMRD / MS Vascular Surgery
Registration No.
Date & Time
Signature & Stamp
Centre Name & Address

TECHNICAL NOTES

  • ☐ Technically satisfactory examination, all segments adequately assessed
  • ☐ Suboptimal assessment of __________________ due to: oedema / pain / obesity / wound
  • ☐ Standing position not tolerated; examination performed supine - may underestimate reflux
  • ☐ Images archived to PACS / printed and stored

DISCLAIMER

This is a duplex ultrasound examination report and constitutes one component of clinical evaluation. Results must be interpreted in conjunction with clinical history, physical examination, and symptom severity. Reflux findings are position- and technique-dependent. A negative study in the supine position does not exclude significant venous incompetence. Clinical correlation is essential.
References: SVS/AVF/AVLS 2023 Varicose Vein Guidelines | 2020 CEAP Update (AVF) | UIP Duplex Consensus Document | ACR Duplex Ultrasound Standards

Key design decisions in this report:
FeatureRationale
Reflux thresholds stated explicitly>500 ms superficial/perforators; >1000 ms deep veins - per SVS/AVF 2023 (Grade 1B)
Pathological perforator criteria≥3.5 mm diameter AND ≥500 ms outward flow - per SVS/AVF 2023
Named perforatorsCockett I/II/III, Dodd, Hunterian, Boyd - standard anatomical landmarks for surgical planning
CEAP 2020Updated classification including C2r, C4c (corona phlebectatica), C6r
Reflux pattern subtypesAxial / junctional / segmental - required for treatment planning (ablation vs. sclerotherapy)
Standing position notedReflux is gravity-dependent; position must be documented as it affects interpretation
GSV segment-by-segment diameterRequired for EVLA/RFA suitability (typically GSV >3 mm needed for thermal ablation)
Bilateral symmetrical layoutMirrors standard clinical workflow - deep first, then GSV, SSV, perforators, skin

Make a pdf of above mentioned report

Reading File
Running Command

mkdir -p /home/daytona/workspace/varicose-doppler && ls /home/daytona/workspace/…

Writing File

~/varicose-doppler/generate_report.py

from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import mm
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    HRFlowable, KeepTogether
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_RIGHT
from reportlab.platypus import PageBreak

OUTPUT = "/home/daytona/workspace/varicose-doppler/Varicose_Veins_Doppler_Report.pdf"

# ── Colours ──────────────────────────────────────────────────────────────────
DARK_BLUE  = colors.HexColor("#1a3a5c")
MID_BLUE   = colors.HexColor("#2563a8")
LIGHT_BLUE = colors.HexColor("#dbeafe")
HEADER_BG  = colors.HexColor("#0f2d52")
ROW_ALT    = colors.HexColor("#f0f5fb")
BORDER     = colors.HexColor("#93c5fd")
TEXT_DARK  = colors.HexColor("#1e293b")
ORANGE     = colors.HexColor("#d97706")
WHITE      = colors.white

W, H = A4
ML = MR = 14*mm
MT = MB = 12*mm

styles = getSampleStyleSheet()

def S(name, **kw):
    base = styles[name]
    return ParagraphStyle(name + str(id(kw)), parent=base, **kw)

# ── Style helpers ─────────────────────────────────────────────────────────────
TITLE  = S("Title",  fontSize=15, textColor=WHITE,    alignment=TA_CENTER, spaceAfter=2)
SUB    = S("Normal", fontSize=9,  textColor=LIGHT_BLUE, alignment=TA_CENTER, spaceAfter=1)
SEC    = S("Normal", fontSize=10, textColor=WHITE,    fontName="Helvetica-Bold",
           alignment=TA_LEFT, leftIndent=4, spaceAfter=0, spaceBefore=0)
BODY   = S("Normal", fontSize=8,  textColor=TEXT_DARK, leading=11)
BOLD   = S("Normal", fontSize=8,  textColor=TEXT_DARK, fontName="Helvetica-Bold", leading=11)
ITALIC = S("Normal", fontSize=7.5,textColor=colors.HexColor("#475569"), leading=10)
CELL   = S("Normal", fontSize=7.5,textColor=TEXT_DARK, leading=10)
CELL_B = S("Normal", fontSize=7.5,textColor=TEXT_DARK, fontName="Helvetica-Bold", leading=10)
CELL_H = S("Normal", fontSize=7.5,textColor=WHITE,     fontName="Helvetica-Bold",
           leading=10, alignment=TA_CENTER)
NOTE   = S("Normal", fontSize=7,  textColor=colors.HexColor("#64748b"), leading=9)
IMPRS  = S("Normal", fontSize=8,  textColor=DARK_BLUE, fontName="Helvetica-Bold",
           leading=11, leftIndent=4)

def section_bar(title):
    tbl = Table([[Paragraph(title, SEC)]], colWidths=[W - ML - MR])
    tbl.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), MID_BLUE),
        ("TOPPADDING",    (0,0), (-1,-1), 4),
        ("BOTTOMPADDING", (0,0), (-1,-1), 4),
        ("LEFTPADDING",   (0,0), (-1,-1), 6),
    ]))
    return tbl

def header_row(*cols):
    return [Paragraph(c, CELL_H) for c in cols]

def trow(*cols, bold=False):
    st = CELL_B if bold else CELL
    return [Paragraph(str(c), st) for c in cols]

def blank_field(label, width=55*mm):
    return f"{label}: {'_'*30}"

DOTTED = "_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _"

def field_table(pairs, col1=65*mm, col2=None):
    col2 = col2 or (W - ML - MR - col1)
    rows = [[Paragraph(f"<b>{k}</b>", CELL), Paragraph(v, CELL)] for k, v in pairs]
    tbl = Table(rows, colWidths=[col1, col2])
    tbl.setStyle(TableStyle([
        ("GRID",           (0,0), (-1,-1), 0.3, BORDER),
        ("BACKGROUND",     (0,0), (0,-1), ROW_ALT),
        ("TOPPADDING",     (0,0), (-1,-1), 3),
        ("BOTTOMPADDING",  (0,0), (-1,-1), 3),
        ("LEFTPADDING",    (0,0), (-1,-1), 4),
    ]))
    return tbl

def vein_table(rows_data, col_widths, header):
    rows = [header_row(*header)]
    for i, r in enumerate(rows_data):
        row = trow(*r)
        rows.append(row)
    tbl = Table(rows, colWidths=col_widths)
    style = [
        ("BACKGROUND",    (0,0), (-1,0), DARK_BLUE),
        ("GRID",          (0,0), (-1,-1), 0.3, BORDER),
        ("TOPPADDING",    (0,0), (-1,-1), 3),
        ("BOTTOMPADDING", (0,0), (-1,-1), 3),
        ("LEFTPADDING",   (0,0), (-1,-1), 3),
        ("ROWBACKGROUNDS",(0,1), (-1,-1), [WHITE, ROW_ALT]),
    ]
    tbl.setStyle(TableStyle(style))
    return tbl

# ─────────────────────────────────────────────────────────────────────────────
# PAGE TEMPLATE – header/footer
# ─────────────────────────────────────────────────────────────────────────────
def on_page(canvas, doc):
    canvas.saveState()
    # Header band
    canvas.setFillColor(HEADER_BG)
    canvas.rect(0, H - 28*mm, W, 28*mm, fill=1, stroke=0)
    canvas.setFillColor(WHITE)
    canvas.setFont("Helvetica-Bold", 13)
    canvas.drawCentredString(W/2, H - 12*mm,
        "VENOUS DUPLEX DOPPLER ULTRASOUND REPORT")
    canvas.setFont("Helvetica", 8)
    canvas.setFillColor(LIGHT_BLUE)
    canvas.drawCentredString(W/2, H - 19*mm,
        "Bilateral Lower Limb Varicose Veins / Chronic Venous Disease Assessment")
    canvas.drawCentredString(W/2, H - 24*mm,
        "SVS/AVF/AVLS 2023 Guidelines  |  2020 CEAP Classification  |  UIP Consensus")
    # Footer
    canvas.setFillColor(HEADER_BG)
    canvas.rect(0, 0, W, 10*mm, fill=1, stroke=0)
    canvas.setFillColor(LIGHT_BLUE)
    canvas.setFont("Helvetica", 7)
    canvas.drawString(ML, 3.5*mm,
        "Reflux thresholds: Superficial/Perforators >500 ms  |  Deep veins (CFV/FV/POPV) >1000 ms  |  Pathological perforator: ≥3.5 mm & ≥500 ms outward flow")
    canvas.drawRightString(W - MR, 3.5*mm, f"Page {doc.page}")
    canvas.restoreState()

# ─────────────────────────────────────────────────────────────────────────────
# BUILD STORY
# ─────────────────────────────────────────────────────────────────────────────
story = []
SP = lambda n=4: Spacer(1, n*mm)

# ══ SECTION 1: Patient & Referral ════════════════════════════════════════════
story += [SP(2), section_bar("SECTION 1 — PATIENT & REFERRAL DETAILS"), SP(2)]
story += [field_table([
    ("Patient Name",        DOTTED),
    ("Age / Sex",           DOTTED),
    ("Reg. / MRD No.",      DOTTED),
    ("Date of Scan",        DOTTED),
    ("Referred By",         "Dr. " + DOTTED),
    ("Clinical Indication", "Bilateral lower limb varicose veins / leg swelling / leg pain / venous ulcer / pre-treatment mapping"),
    ("Previous Treatment",  "None  ☐  |  Sclerotherapy  ☐  |  EVLA  ☐  |  Surgery  ☐   Specify: " + DOTTED),
], col1=68*mm), SP(3)]

# ══ SECTION 2: Technique ═════════════════════════════════════════════════════
story += [section_bar("SECTION 2 — TECHNIQUE & EQUIPMENT"), SP(2)]
story += [field_table([
    ("Machine / Model",       DOTTED),
    ("Transducer",            "Linear high-frequency  7.5 – 15 MHz"),
    ("Patient Position",      "Standing / Reverse Trendelenburg  ☐   Supine  ☐"),
    ("Compression Method",    "Manual calf squeeze  ☐   Pneumatic cuff deflation  ☐"),
    ("Valsalva Manoeuvre",    "Yes  ☐   No  ☐   (used for SFJ / CFV assessment)"),
    ("Modes Used",            "B-mode (greyscale) + Colour Doppler + Spectral Doppler (Duplex)"),
    ("Scan Performed By",     DOTTED),
    ("Interpreted By",        DOTTED),
], col1=68*mm)]
story += [SP(2), Paragraph(
    "<b>Reflux Threshold (SVS/AVF/AVLS 2023):</b>  Superficial veins & perforators: <b>&gt;500 ms</b> retrograde flow.  "
    "Deep veins (CFV, FV, POPV): <b>&gt;1000 ms</b> retrograde flow.  "
    "Pathological perforator: diameter <b>≥3.5 mm</b> AND outward flow <b>≥500 ms</b>.", ITALIC), SP(3)]

# ══ Helper: deep vein table ═══════════════════════════════════════════════════
deep_veins = [
    ("Common Femoral Vein (CFV)",   "Yes ☐  No ☐", "Phasic / Non-phasic", "Present / Absent", "_______ ms", "Normal / Reflux"),
    ("Femoral Vein – proximal",     "Yes ☐  No ☐", "", "", "_______ ms", "Normal / Reflux"),
    ("Femoral Vein – mid",          "Yes ☐  No ☐", "", "", "_______ ms", "Normal / Reflux"),
    ("Femoral Vein – distal",       "Yes ☐  No ☐", "", "", "_______ ms", "Normal / Reflux"),
    ("Deep Femoral V. (Profunda)",  "Yes ☐  No ☐", "", "", "_______ ms", "Normal / Reflux"),
    ("Popliteal Vein (POPV)",       "Yes ☐  No ☐", "", "", "_______ ms", "Normal / Reflux"),
    ("Posterior Tibial Veins",      "Yes ☐  No ☐", "", "", "_______ ms", "Normal / Reflux"),
    ("Peroneal Veins",              "Yes ☐  No ☐", "", "", "_______ ms", "Normal / Reflux"),
    ("Anterior Tibial Veins",       "Yes ☐  No ☐", "", "", "_______ ms", "Normal / Reflux"),
    ("Gastrocnemius Veins",         "Yes ☐  No ☐", "", "", "_______ ms", "Normal / Reflux"),
    ("Soleal Veins",                "Yes ☐  No ☐", "", "", "_______ ms", "Normal / Reflux"),
]
deep_hdr  = ["Vein Segment", "Compressible", "Flow", "Augmentation", "Reflux Duration", "Interpretation"]
deep_cols = [52*mm, 22*mm, 28*mm, 26*mm, 26*mm, 28*mm]

gsv_rows = [
    ("GSV – groin / proximal thigh", "_______ mm", "Yes ☐  No ☐", "_______ ms", "Yes ☐  No ☐"),
    ("GSV – mid thigh",              "_______ mm", "Yes ☐  No ☐", "_______ ms", "Yes ☐  No ☐"),
    ("GSV – distal thigh",           "_______ mm", "Yes ☐  No ☐", "_______ ms", "Yes ☐  No ☐"),
    ("GSV – above knee",             "_______ mm", "Yes ☐  No ☐", "_______ ms", "Yes ☐  No ☐"),
    ("GSV – below knee",             "_______ mm", "Yes ☐  No ☐", "_______ ms", "Yes ☐  No ☐"),
    ("GSV – ankle level",            "_______ mm", "Yes ☐  No ☐", "_______ ms", "Yes ☐  No ☐"),
]
gsv_hdr  = ["GSV Segment", "Diameter (mm)", "In Saphenous Canal", "Reflux Duration", "Reflux Present"]
gsv_cols = [52*mm, 28*mm, 34*mm, 30*mm, 28*mm]

ssv_rows = [
    ("SSV – upper calf", "_______ mm", "_______ ms", "Yes ☐  No ☐"),
    ("SSV – mid calf",   "_______ mm", "_______ ms", "Yes ☐  No ☐"),
    ("SSV – lower calf", "_______ mm", "_______ ms", "Yes ☐  No ☐"),
]
ssv_hdr  = ["SSV Segment", "Diameter (mm)", "Reflux Duration", "Reflux Present"]
ssv_cols = [55*mm, 35*mm, 40*mm, 42*mm]

perforator_rows = [
    ("Medial thigh",         "_______ cm from groin",         "_______ mm", "_______ ms", "GSV / Tributary",  "Yes ☐  No ☐"),
    ("Hunterian perforator", "Mid thigh",                     "_______ mm", "_______ ms", "GSV / FV",         "Yes ☐  No ☐"),
    ("Dodd's perforator",    "Distal thigh",                  "_______ mm", "_______ ms", "GSV / FV",         "Yes ☐  No ☐"),
    ("Boyd's perforator",    "Below knee",                    "_______ mm", "_______ ms", "GSV / PT",         "Yes ☐  No ☐"),
    ("Cockett I",            "Medial ankle – lower",          "_______ mm", "_______ ms", "Post. arch / GSV", "Yes ☐  No ☐"),
    ("Cockett II",           "Medial ankle – mid",            "_______ mm", "_______ ms", "Post. arch / GSV", "Yes ☐  No ☐"),
    ("Cockett III",          "Medial ankle – upper",          "_______ mm", "_______ ms", "Post. arch / GSV", "Yes ☐  No ☐"),
    ("Posterior tibial",     "Medial leg",                    "_______ mm", "_______ ms", "",                 "Yes ☐  No ☐"),
    ("Paratibial",           "Medial leg",                    "_______ mm", "_______ ms", "",                 "Yes ☐  No ☐"),
    ("Lateral leg",          "Lateral calf",                  "_______ mm", "_______ ms", "SSV / Tributary",  "Yes ☐  No ☐"),
]
perf_hdr  = ["Perforator", "Location", "Diameter", "Outward Flow", "Connecting to", "Significant"]
perf_cols = [32*mm, 36*mm, 22*mm, 22*mm, 30*mm, 22*mm+2*mm]  # tight but fits

varic_rows = [
    ("Medial thigh",       "Present ☐  Absent ☐", "_______ mm", "GSV trunk / AAGSV / perforator"),
    ("Medial leg",         "Present ☐  Absent ☐", "_______ mm", "GSV / Cockett perforator"),
    ("Lateral thigh",      "Present ☐  Absent ☐", "_______ mm", "SSV / LAGSV"),
    ("Posterior calf",     "Present ☐  Absent ☐", "_______ mm", "SSV / perforator"),
    ("Anterior leg",       "Present ☐  Absent ☐", "_______ mm", "_________________"),
    ("Ankle / gaiter zone","Present ☐  Absent ☐", "_______ mm", "Cockett perforator"),
]
varic_hdr  = ["Location", "Distribution", "Approx. Diameter", "Source of Filling"]
varic_cols = [40*mm, 38*mm, 35*mm, 55*mm+14*mm]  # proportional

skin_rows = [
    ("Pitting oedema",          "Present ☐  Absent ☐", ""),
    ("Haemosiderin / pigmentation","Present ☐  Absent ☐","Site: _________________"),
    ("Lipodermatosclerosis",    "Present ☐  Absent ☐", "Site: _________________"),
    ("Corona phlebectatica",    "Present ☐  Absent ☐", "At ankle region"),
    ("Healed ulcer",            "Present ☐  Absent ☐", "Site: _________________"),
    ("Active venous ulcer",     "Present ☐  Absent ☐", "Site / size: ___________"),
    ("Telangiectasias",         "Present ☐  Absent ☐", "Distribution: __________"),
]
skin_hdr  = ["Finding", "Present / Absent", "Details"]
skin_cols = [55*mm, 42*mm, 75*mm]

def build_limb_section(side):
    s = []
    s += [section_bar(f"SECTION {'3' if side=='RIGHT' else '4'} — {side} LOWER LIMB"), SP(2)]

    # Deep
    s += [Paragraph(f"<b>{'3' if side=='RIGHT' else '4'}A.  Deep Venous System – {side}</b>", BOLD), SP(1)]
    s += [vein_table(deep_veins, deep_cols, deep_hdr), SP(1)]
    s += [Paragraph(f"<b>DVT ({side}):</b>  None ☐   Acute DVT at: __________________   Chronic changes at: __________________", CELL), SP(3)]

    # SFJ
    s += [Paragraph(f"<b>{'3' if side=='RIGHT' else '4'}B.  Superficial Venous System – {side}</b>", BOLD), SP(1)]
    s += [Paragraph("<i>Saphenofemoral Junction (SFJ)</i>", ITALIC), SP(1)]
    s += [field_table([
        ("SFJ location",    "_______ cm below inguinal ligament"),
        ("SFJ competence",  "Competent  ☐     Incompetent  ☐"),
        ("Reflux at SFJ",   "No reflux  ☐     Reflux: _______ ms  (Valsalva-provoked)"),
        ("Tributaries at SFJ","Normal  ☐     Accessory saphenous entering  ☐     Other: _______________"),
    ], col1=62*mm), SP(2)]

    # GSV
    s += [Paragraph("<i>Great Saphenous Vein (GSV)</i>", ITALIC), SP(1)]
    s += [vein_table(gsv_rows, gsv_cols, gsv_hdr), SP(1)]
    s += [Paragraph(
        "GSV total refluxing length: _______ cm     |     "
        "GSV wall: Normal ☐   Thickened ☐   Intraluminal echoes ☐   Post-thrombotic ☐", CELL), SP(2)]

    # AAGSV / Giacomini
    s += [field_table([
        ("AAGSV (Anterior Accessory GSV)", "Visible: Yes ☐  No ☐     Diameter: _______ mm     Reflux: _______ ms"),
        ("Giacomini / Posterior Accessory","Visible: Yes ☐  No ☐     Diameter: _______ mm     Reflux: _______ ms"),
    ], col1=68*mm), SP(2)]

    # SPJ / SSV
    s += [Paragraph(f"<b>{'3' if side=='RIGHT' else '4'}C.  Small Saphenous Vein (SSV) & Saphenopopliteal Junction (SPJ) – {side}</b>", BOLD), SP(1)]
    s += [field_table([
        ("SPJ identifiable",  "Yes  ☐     No  ☐   (absent in ~10-30% cases)"),
        ("SPJ level",         "_______ cm above popliteal crease"),
        ("SPJ competence",    "Competent  ☐     Incompetent  ☐"),
        ("Reflux at SPJ",     "No reflux  ☐     Reflux: _______ ms"),
        ("SSV cranial extension (Giacomini)", "Present  ☐     Absent  ☐"),
    ], col1=68*mm), SP(1)]
    s += [vein_table(ssv_rows, ssv_cols, ssv_hdr), SP(1)]
    s += [Paragraph("SSV total refluxing length: _______ cm", CELL), SP(2)]

    # Perforators
    s += [Paragraph(f"<b>{'3' if side=='RIGHT' else '4'}D.  Incompetent Perforating Veins (IPVs) – {side}</b>", BOLD), SP(0.5)]
    s += [Paragraph("<i>Pathological criterion: outward flow ≥500 ms AND diameter ≥3.5 mm  (SVS/AVF/AVLS 2023)</i>", ITALIC), SP(1)]
    s += [vein_table(perforator_rows, perf_cols, perf_hdr), SP(1)]
    s += [Paragraph(f"Total pathological perforators identified ({side}): _______", CELL), SP(2)]

    # Varicosities
    s += [Paragraph(f"<b>{'3' if side=='RIGHT' else '4'}E.  Varicosities – {side}</b>", BOLD), SP(1)]
    s += [vein_table(varic_rows, varic_cols, varic_hdr), SP(2)]

    # Skin
    s += [Paragraph(f"<b>{'3' if side=='RIGHT' else '4'}F.  Skin & Soft Tissue Changes – {side}</b>", BOLD), SP(1)]
    s += [vein_table(skin_rows, skin_cols, skin_hdr), SP(3)]
    return s

story += build_limb_section("RIGHT")
story += [PageBreak()]
story += build_limb_section("LEFT")

# ══ SECTION 5: Reflux Pattern ═════════════════════════════════════════════════
story += [SP(2), section_bar("SECTION 5 — REFLUX PATTERN CLASSIFICATION (BILATERAL SUMMARY)"), SP(2)]
reflux_rows = [
    ("Axial reflux (groin → calf, uninterrupted)",  "Present ☐  Absent ☐", "Present ☐  Absent ☐"),
    ("Junctional reflux only (SFJ or SPJ isolated)","Present ☐  Absent ☐", "Present ☐  Absent ☐"),
    ("Segmental reflux (portion of truncal vein)",  "Present ☐  Absent ☐", "Present ☐  Absent ☐"),
    ("Deep vein reflux",                            "Present ☐  Absent ☐", "Present ☐  Absent ☐"),
    ("Perforator-sourced reflux",                   "Present ☐  Absent ☐", "Present ☐  Absent ☐"),
    ("Pelvic source suspected",                     "Present ☐  Absent ☐", "Present ☐  Absent ☐"),
]
story += [vein_table(reflux_rows, [100*mm, 47*mm, 35*mm],
                     ["Reflux Pattern", "Right", "Left"]), SP(3)]

# ══ SECTION 6: CEAP ══════════════════════════════════════════════════════════
story += [section_bar("SECTION 6 — CEAP CLASSIFICATION  (2020 Updated CEAP – American Venous Forum)"), SP(2)]
ceap_comp = [
    ("C – Clinical class",   "C___ (see table below)", "C___"),
    ("E – Etiology",         "Ep (primary)  ☐   Es (secondary/post-thrombotic)  ☐   Ec (congenital)  ☐",
                              "Ep  ☐   Es  ☐   Ec  ☐"),
    ("A – Anatomy",          "As (superficial)  ☐   Ad (deep)  ☐   Ap (perforator)  ☐",
                              "As  ☐   Ad  ☐   Ap  ☐"),
    ("P – Pathophysiology",  "Pr (reflux)  ☐   Po (obstruction)  ☐   Pr,o (both)  ☐",
                              "Pr  ☐   Po  ☐   Pr,o  ☐"),
]
comp_rows = [[Paragraph(f"<b>{r[0]}</b>", CELL), Paragraph(r[1], CELL), Paragraph(r[2], CELL)] for r in ceap_comp]
comp_tbl = Table([header_row("Component", "Right", "Left")] + comp_rows,
                 colWidths=[35*mm, 105*mm, 42*mm])
comp_tbl.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,0), DARK_BLUE),
    ("GRID",          (0,0), (-1,-1), 0.3, BORDER),
    ("TOPPADDING",    (0,0), (-1,-1), 3),
    ("BOTTOMPADDING", (0,0), (-1,-1), 3),
    ("LEFTPADDING",   (0,0), (-1,-1), 4),
    ("ROWBACKGROUNDS",(0,1), (-1,-1), [WHITE, ROW_ALT]),
]))
story += [comp_tbl, SP(2)]

ceap_class = [
    ("C0","No visible or palpable signs of venous disease"),
    ("C1","Telangiectasias or reticular veins"),
    ("C2","Varicose veins"),
    ("C2r","Recurrent varicose veins"),
    ("C3","Oedema"),
    ("C4a","Pigmentation or eczema"),
    ("C4b","Lipodermatosclerosis or atrophie blanche"),
    ("C4c","Corona phlebectatica"),
    ("C5","Healed venous ulcer"),
    ("C6","Active venous ulcer"),
    ("C6r","Recurrent active venous ulcer"),
]
cc_rows = [[Paragraph(f"<b>{c[0]}</b>", CELL_B), Paragraph(c[1], CELL)] for c in ceap_class]
# 2-column layout side by side
half = len(cc_rows)//2 + len(cc_rows)%2
left_col  = cc_rows[:half]
right_col = cc_rows[half:]
while len(right_col) < len(left_col):
    right_col.append([Paragraph("", CELL), Paragraph("", CELL)])

merged_rows = [[Paragraph("<b>Class</b>", CELL_H), Paragraph("<b>Description</b>", CELL_H),
                Paragraph("<b>Class</b>", CELL_H), Paragraph("<b>Description</b>", CELL_H)]]
for l, r in zip(left_col, right_col):
    merged_rows.append(l + r)
cc_tbl = Table(merged_rows, colWidths=[14*mm, 80*mm, 14*mm, 74*mm])
cc_tbl.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,0), DARK_BLUE),
    ("GRID",          (0,0), (-1,-1), 0.3, BORDER),
    ("TOPPADDING",    (0,0), (-1,-1), 2),
    ("BOTTOMPADDING", (0,0), (-1,-1), 2),
    ("LEFTPADDING",   (0,0), (-1,-1), 3),
    ("ROWBACKGROUNDS",(0,1), (-1,-1), [WHITE, ROW_ALT]),
]))
story += [cc_tbl, SP(2)]
story += [Paragraph("<b>Suffix:</b>  s = symptomatic (pain, heaviness, swelling, achiness, itching – HASTI)   |   a = asymptomatic", CELL)]
story += [Paragraph("<b>Right CEAP:</b> C___ E___ A___ P___ ( s / a )     "
                    "<b>Left CEAP:</b> C___ E___ A___ P___ ( s / a )", BOLD), SP(3)]

# ══ SECTION 7: Summary ═══════════════════════════════════════════════════════
story += [PageBreak(), section_bar("SECTION 7 — SUMMARY OF FINDINGS"), SP(2)]

for side in ["RIGHT", "LEFT"]:
    story += [Paragraph(f"<b>{side} LOWER LIMB</b>", BOLD), SP(1)]
    rows = [
        ("Deep system",         f"Patent ☐  No DVT ☐     Deep venous reflux: Present ☐  Absent ☐   at: _______________________"),
        ("SFJ",                 "Competent ☐   Incompetent ☐   Reflux: _______ ms"),
        ("GSV",                 "Reflux from __________________ to __________________   Total: _______ cm   Diameter SFJ: _______ mm   BK: _______ mm"),
        ("SSV / SPJ",           "Competent ☐   Incompetent ☐   Reflux: _______ ms   SSV refluxing length: _______ cm"),
        ("Reflux pattern",      "Axial ☐   Junctional ☐   Segmental ☐"),
        ("Pathological IPVs",   "_______ perforator(s) at: _____________________________________________"),
        ("Varicosities",        "Distribution: ______________________   Source: ________________________"),
        ("Skin changes",        "None ☐   Pigmentation ☐   LDS ☐   Corona phlebectatica ☐   Ulcer at: ______________"),
    ]
    tbl = Table([[Paragraph(f"<b>{r[0]}</b>", CELL), Paragraph(r[1], CELL)] for r in rows],
                colWidths=[48*mm, W-ML-MR-48*mm])
    tbl.setStyle(TableStyle([
        ("GRID",           (0,0), (-1,-1), 0.3, BORDER),
        ("BACKGROUND",     (0,0), (0,-1), ROW_ALT),
        ("TOPPADDING",     (0,0), (-1,-1), 3),
        ("BOTTOMPADDING",  (0,0), (-1,-1), 3),
        ("LEFTPADDING",    (0,0), (-1,-1), 4),
    ]))
    story += [tbl, SP(3)]

# ══ SECTION 8: Impression ════════════════════════════════════════════════════
story += [section_bar("SECTION 8 — IMPRESSION"), SP(2)]
for side, n in [("RIGHT","8.1"), ("LEFT","8.2")]:
    box_rows = [
        [Paragraph(f"<b>{n}  {side} LOWER LIMB</b>", IMPRS)],
        [Paragraph(
            f"CEAP: C___ E___ A___ P___ (s/a)<br/>"
            f"Chronic venous insufficiency, {side.lower()} lower limb.<br/>"
            f"[GSV axial reflux  ☐  |  SFJ junctional reflux  ☐  |  SSV reflux  ☐  |  Isolated perforator reflux  ☐]<br/>"
            f"Reflux from ____________________ to ____________________.  Truncal length: _______ cm<br/>"
            f"Deep venous system: Patent ☐   DVT at: ____________________   Chronic changes: ____________________",
            BODY)],
    ]
    imp_tbl = Table(box_rows, colWidths=[W-ML-MR])
    imp_tbl.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (0,0), LIGHT_BLUE),
        ("BACKGROUND",    (0,1), (0,1), WHITE),
        ("BOX",           (0,0), (-1,-1), 0.8, MID_BLUE),
        ("TOPPADDING",    (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
        ("LEFTPADDING",   (0,0), (-1,-1), 6),
    ]))
    story += [imp_tbl, SP(3)]

# ══ SECTION 9: Recommendations ═══════════════════════════════════════════════
story += [section_bar("SECTION 9 — CLINICAL CORRELATION & RECOMMENDATIONS"), SP(2)]
recs = [
    "☐  Findings support conservative management (compression stockings, lifestyle modification) for C2/C3 disease",
    "☐  Patient suitable for endovenous thermal ablation (EVLA / RFA) of GSV – Right ☐  Left ☐  Bilateral ☐",
    "☐  Patient suitable for ultrasound-guided foam sclerotherapy (UGFS) of: ___________________________",
    "☐  Phlebectomy / stab avulsions of varicosities advised",
    "☐  Perforator ablation (MOCA / UGFS) advised for IPVs at: ___________________________________",
    "☐  DVT found – anticoagulation and haematology referral recommended",
    "☐  Deep venous reflux present – refer to vascular surgery for further evaluation",
    "☐  Pelvic source suspected – pelvic venous duplex / CT venography recommended",
    "☐  Pre-treatment anatomical mapping complete for planned intervention",
    "☐  Post-treatment follow-up – occlusion confirmed ☐   Re-canalisation noted ☐",
]
for r in recs:
    story += [Paragraph(r, BODY)]
story += [SP(3)]

# ══ SECTION 10: Technical Quality ════════════════════════════════════════════
story += [section_bar("SECTION 10 — TECHNICAL QUALITY"), SP(2)]
techs = [
    "☐  Technically satisfactory – all segments adequately assessed",
    "☐  Suboptimal assessment of: ____________________ due to: oedema / pain / obesity / wound dressing",
    "☐  Standing position not tolerated; scan performed supine – may underestimate reflux",
    "☐  Images archived to PACS / printed and filed",
]
for t in techs:
    story += [Paragraph(t, BODY)]
story += [SP(3)]

# ══ Authorisation ═════════════════════════════════════════════════════════════
story += [section_bar("AUTHORISATION"), SP(2)]
story += [field_table([
    ("Report Prepared By",    DOTTED),
    ("Qualification",         "MD Radiology / DNB Radiology / DMRD / MS Vascular Surgery"),
    ("MCI / NMC Reg. No.",    DOTTED),
    ("Date & Time of Report", DOTTED),
    ("Signature & Stamp",     ""),
    ("Centre Name & Address", DOTTED),
], col1=65*mm), SP(3)]

# ══ Disclaimer ════════════════════════════════════════════════════════════════
story += [HRFlowable(width="100%", thickness=0.5, color=MID_BLUE), SP(2)]
story += [Paragraph(
    "<b>DISCLAIMER:</b>  This report constitutes a screening/diagnostic duplex ultrasound examination. "
    "A normal study does not exclude all venous pathology. Results are position- and technique-dependent; "
    "reflux may be underestimated in the supine position. All findings must be correlated with clinical history, "
    "physical examination, and symptom severity (HASTI). Surveillance imaging is recommended for progressive disease. "
    "References: SVS/AVF/AVLS 2023 Varicose Vein Guidelines (PMID 37652254) | 2020 CEAP Update (AVF) | "
    "UIP Duplex Consensus Document | ACR Duplex Ultrasound Standards.",
    ITALIC), SP(2)]

# ─────────────────────────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=A4,
    leftMargin=ML, rightMargin=MR,
    topMargin=34*mm, bottomMargin=16*mm,
    title="Bilateral Lower Limb Varicose Veins Doppler Report",
    author="Orris Medical Reports",
    subject="Venous Duplex Doppler Ultrasound",
)
doc.build(story, onFirstPage=on_page, onLaterPages=on_page)
print("PDF created:", OUTPUT)
Running Command

cd /home/daytona/workspace/varicose-doppler && python generate_report.py 2>&1

Running Command

ls -lh /home/daytona/workspace/varicose-doppler/Varicose_Veins_Doppler_Report.pd…

Your PDF is ready for download:

Varicose Veins Doppler Report

PDF Document · PDF

What's inside the PDF (10 sections, A4, professionally formatted):
SectionContent
1Patient & Referral Details
2Technique & Equipment (with reflux threshold box)
3Right Lower Limb - Deep system, SFJ, GSV, SSV, IPVs, Varicosities, Skin changes
4Left Lower Limb - Same structure as Section 3
5Bilateral Reflux Pattern Classification (axial / junctional / segmental / deep / perforator / pelvic)
6CEAP Classification table (2020 updated, C0-C6r) with bilateral entry fields
7Summary of Findings - bilateral side-by-side
8Impression boxes for Right and Left limbs with CEAP codes
9Recommendations checklist (conservative / EVLA / RFA / UGFS / phlebectomy / DVT referral)
10Technical Quality + Authorisation + Disclaimer
Design features: Dark blue header band on every page with guideline references in the footer, colour-coded section bars, alternating row shading in all tables, and all reflux thresholds (>500 ms superficial, >1000 ms deep, ≥3.5 mm perforator) printed in the footer on every page so they are always visible to the reporting doctor.

Create a Word version of this varicose veins report for easy editing

Reading File
Running Command

node -e "require('docx'); console.log('docx ok')" 2>&1 | head -3

Writing File

~/varicose-doppler/generate_report.js

"use strict";
const fs = require("fs");
const {
  Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
  Header, Footer, AlignmentType, HeadingLevel, BorderStyle, WidthType,
  ShadingType, VerticalAlign, PageNumber, NumberFormat,
  convertInchesToTwip, convertMillimetersToTwip, PageBreak,
} = require("docx");

// ── Colours ────────────────────────────────────────────────────────────────
const C = {
  darkBlue:  "1a3a5c",
  midBlue:   "2563a8",
  lightBlue: "dbeafe",
  headerBg:  "0f2d52",
  rowAlt:    "f0f5fb",
  white:     "FFFFFF",
  textDark:  "1e293b",
  orange:    "d97706",
  grey:      "64748b",
};

// ── Helpers ────────────────────────────────────────────────────────────────
const mm  = convertMillimetersToTwip;
const twp = convertInchesToTwip;

function shading(hex) {
  return { type: ShadingType.SOLID, color: hex, fill: hex };
}

function borders(color = C.midBlue, sz = 4) {
  const b = { style: BorderStyle.SINGLE, size: sz, color };
  return { top: b, bottom: b, left: b, right: b };
}

function noBorders() {
  const b = { style: BorderStyle.NONE, size: 0, color: "FFFFFF" };
  return { top: b, bottom: b, left: b, right: b };
}

// ── Text helpers ───────────────────────────────────────────────────────────
function run(text, opts = {}) {
  return new TextRun({ text, font: "Calibri", size: opts.size || 18,
    bold: opts.bold || false, italics: opts.italic || false,
    color: opts.color || C.textDark, ...opts });
}

function para(children, opts = {}) {
  const c = typeof children === "string" ? [run(children, opts)] : children;
  return new Paragraph({
    children: c,
    alignment: opts.align || AlignmentType.LEFT,
    spacing: { before: opts.spaceBefore || 40, after: opts.spaceAfter || 40 },
    indent: opts.indent ? { left: mm(opts.indent) } : undefined,
  });
}

function emptyPara(space = 60) {
  return new Paragraph({ children: [], spacing: { before: 0, after: space } });
}

// ── Section bar (shaded heading row) ──────────────────────────────────────
function sectionBar(title) {
  return new Table({
    width: { size: 100, type: WidthType.PERCENTAGE },
    rows: [new TableRow({
      children: [new TableCell({
        children: [new Paragraph({
          children: [run(title, { bold: true, color: C.white, size: 20 })],
          spacing: { before: 60, after: 60 },
          indent: { left: mm(3) },
        })],
        shading: shading(C.midBlue),
        borders: noBorders(),
        margins: { left: mm(2), right: mm(2) },
      })],
    })],
    borders: { top: noBorders().top, bottom: noBorders().bottom,
               left: noBorders().left, right: noBorders().right,
               insideH: noBorders().top, insideV: noBorders().left },
  });
}

// ── 2-column field table (label | value) ──────────────────────────────────
function fieldTable(pairs, labelWidthPct = 30) {
  const rows = pairs.map(([label, value], i) => new TableRow({
    children: [
      new TableCell({
        children: [para([run(label, { bold: true, size: 17, color: C.darkBlue })], { spaceBefore: 30, spaceAfter: 30 })],
        width: { size: labelWidthPct, type: WidthType.PERCENTAGE },
        shading: shading(i % 2 === 0 ? C.rowAlt : C.white),
        borders: borders(C.midBlue, 3),
        margins: { left: mm(2), right: mm(2) },
        verticalAlign: VerticalAlign.CENTER,
      }),
      new TableCell({
        children: [para(value || "________________________________", { spaceBefore: 30, spaceAfter: 30 })],
        width: { size: 100 - labelWidthPct, type: WidthType.PERCENTAGE },
        shading: shading(i % 2 === 0 ? C.white : C.rowAlt),
        borders: borders(C.midBlue, 3),
        margins: { left: mm(2), right: mm(2) },
        verticalAlign: VerticalAlign.CENTER,
      }),
    ],
  }));
  return new Table({ width: { size: 100, type: WidthType.PERCENTAGE }, rows });
}

// ── Generic data table ─────────────────────────────────────────────────────
function dataTable(headers, rows, colPcts) {
  const headerRow = new TableRow({
    tableHeader: true,
    children: headers.map((h, i) => new TableCell({
      children: [new Paragraph({
        children: [run(h, { bold: true, color: C.white, size: 16 })],
        alignment: AlignmentType.CENTER,
        spacing: { before: 40, after: 40 },
      })],
      shading: shading(C.darkBlue),
      borders: borders(C.white, 4),
      width: { size: colPcts[i], type: WidthType.PERCENTAGE },
      margins: { left: mm(1.5), right: mm(1.5) },
      verticalAlign: VerticalAlign.CENTER,
    })),
  });

  const dataRows = rows.map((row, ri) => new TableRow({
    children: row.map((cell, ci) => new TableCell({
      children: [new Paragraph({
        children: [run(String(cell), { size: 16, color: C.textDark })],
        spacing: { before: 30, after: 30 },
      })],
      shading: shading(ri % 2 === 0 ? C.white : C.rowAlt),
      borders: borders(C.midBlue, 3),
      width: { size: colPcts[ci], type: WidthType.PERCENTAGE },
      margins: { left: mm(1.5), right: mm(1.5) },
      verticalAlign: VerticalAlign.CENTER,
    })),
  }));

  return new Table({
    width: { size: 100, type: WidthType.PERCENTAGE },
    rows: [headerRow, ...dataRows],
  });
}

// ── Sub-heading paragraph ──────────────────────────────────────────────────
function subHead(text) {
  return new Paragraph({
    children: [run(text, { bold: true, size: 18, color: C.darkBlue })],
    spacing: { before: 120, after: 40 },
  });
}
function subHeadItalic(text) {
  return new Paragraph({
    children: [run(text, { italic: true, size: 17, color: C.midBlue })],
    spacing: { before: 80, after: 30 },
  });
}
function note(text) {
  return new Paragraph({
    children: [run(text, { italic: true, size: 15, color: C.grey })],
    spacing: { before: 20, after: 60 },
  });
}
function bullet(text) {
  return new Paragraph({
    children: [run(text, { size: 17 })],
    spacing: { before: 20, after: 20 },
    indent: { left: mm(6) },
  });
}

// ─────────────────────────────────────────────────────────────────────────────
// DATA DEFINITIONS
// ─────────────────────────────────────────────────────────────────────────────
const DOTTED = "________________________________";

const deepVeins = [
  ["Common Femoral Vein (CFV)",   "Yes ☐  No ☐", "Phasic / Non-phasic", "Present / Absent", "_______ ms", "Normal / Reflux"],
  ["Femoral Vein – proximal",     "Yes ☐  No ☐", "",                    "",                  "_______ ms", "Normal / Reflux"],
  ["Femoral Vein – mid",          "Yes ☐  No ☐", "",                    "",                  "_______ ms", "Normal / Reflux"],
  ["Femoral Vein – distal",       "Yes ☐  No ☐", "",                    "",                  "_______ ms", "Normal / Reflux"],
  ["Deep Femoral V. (Profunda)",  "Yes ☐  No ☐", "",                    "",                  "_______ ms", "Normal / Reflux"],
  ["Popliteal Vein (POPV)",       "Yes ☐  No ☐", "",                    "",                  "_______ ms", "Normal / Reflux"],
  ["Posterior Tibial Veins",      "Yes ☐  No ☐", "",                    "",                  "_______ ms", "Normal / Reflux"],
  ["Peroneal Veins",              "Yes ☐  No ☐", "",                    "",                  "_______ ms", "Normal / Reflux"],
  ["Anterior Tibial Veins",       "Yes ☐  No ☐", "",                    "",                  "_______ ms", "Normal / Reflux"],
  ["Gastrocnemius Veins",         "Yes ☐  No ☐", "",                    "",                  "_______ ms", "Normal / Reflux"],
  ["Soleal Veins",                "Yes ☐  No ☐", "",                    "",                  "_______ ms", "Normal / Reflux"],
];
const deepHdr  = ["Vein Segment","Compressible","Flow","Augmentation","Reflux Duration","Interpretation"];
const deepCols = [24, 13, 15, 16, 16, 16];

const gsvRows = [
  ["GSV – groin / proximal thigh","_______ mm","Yes ☐  No ☐","_______ ms","Yes ☐  No ☐"],
  ["GSV – mid thigh",             "_______ mm","Yes ☐  No ☐","_______ ms","Yes ☐  No ☐"],
  ["GSV – distal thigh",          "_______ mm","Yes ☐  No ☐","_______ ms","Yes ☐  No ☐"],
  ["GSV – above knee",            "_______ mm","Yes ☐  No ☐","_______ ms","Yes ☐  No ☐"],
  ["GSV – below knee",            "_______ mm","Yes ☐  No ☐","_______ ms","Yes ☐  No ☐"],
  ["GSV – ankle level",           "_______ mm","Yes ☐  No ☐","_______ ms","Yes ☐  No ☐"],
];
const gsvHdr  = ["GSV Segment","Diameter (mm)","In Saphenous Canal","Reflux Duration","Reflux Present"];
const gsvCols = [28, 18, 22, 18, 14];

const ssvRows = [
  ["SSV – upper calf","_______ mm","_______ ms","Yes ☐  No ☐"],
  ["SSV – mid calf",  "_______ mm","_______ ms","Yes ☐  No ☐"],
  ["SSV – lower calf","_______ mm","_______ ms","Yes ☐  No ☐"],
];
const ssvHdr  = ["SSV Segment","Diameter (mm)","Reflux Duration","Reflux Present"];
const ssvCols = [30, 24, 26, 20];

const perfRows = [
  ["Medial thigh",          "_______ cm from groin",   "_______ mm","_______ ms","GSV / Tributary",   "Yes ☐  No ☐"],
  ["Hunterian perforator",  "Mid thigh",               "_______ mm","_______ ms","GSV / FV",          "Yes ☐  No ☐"],
  ["Dodd's perforator",     "Distal thigh",            "_______ mm","_______ ms","GSV / FV",          "Yes ☐  No ☐"],
  ["Boyd's perforator",     "Below knee",              "_______ mm","_______ ms","GSV / PT",          "Yes ☐  No ☐"],
  ["Cockett I",             "Medial ankle – lower",    "_______ mm","_______ ms","Post. arch / GSV",  "Yes ☐  No ☐"],
  ["Cockett II",            "Medial ankle – mid",      "_______ mm","_______ ms","Post. arch / GSV",  "Yes ☐  No ☐"],
  ["Cockett III",           "Medial ankle – upper",    "_______ mm","_______ ms","Post. arch / GSV",  "Yes ☐  No ☐"],
  ["Posterior tibial",      "Medial leg",              "_______ mm","_______ ms","",                  "Yes ☐  No ☐"],
  ["Paratibial",            "Medial leg",              "_______ mm","_______ ms","",                  "Yes ☐  No ☐"],
  ["Lateral leg",           "Lateral calf",            "_______ mm","_______ ms","SSV / Tributary",   "Yes ☐  No ☐"],
];
const perfHdr  = ["Perforator","Location","Diameter","Outward Flow","Connecting to","Significant"];
const perfCols = [18, 22, 12, 14, 19, 15];

const varicRows = [
  ["Medial thigh",        "Present ☐  Absent ☐","_______ mm","GSV trunk / AAGSV / perforator"],
  ["Medial leg",          "Present ☐  Absent ☐","_______ mm","GSV / Cockett perforator"],
  ["Lateral thigh",       "Present ☐  Absent ☐","_______ mm","SSV / LAGSV"],
  ["Posterior calf",      "Present ☐  Absent ☐","_______ mm","SSV / perforator"],
  ["Anterior leg",        "Present ☐  Absent ☐","_______ mm","_________________"],
  ["Ankle / gaiter zone", "Present ☐  Absent ☐","_______ mm","Cockett perforator"],
];
const varicHdr  = ["Location","Distribution","Approx. Diameter","Source of Filling"];
const varicCols = [22, 26, 22, 30];

const skinRows = [
  ["Pitting oedema",             "Present ☐  Absent ☐",""],
  ["Haemosiderin / pigmentation","Present ☐  Absent ☐","Site: _________________"],
  ["Lipodermatosclerosis",       "Present ☐  Absent ☐","Site: _________________"],
  ["Corona phlebectatica",       "Present ☐  Absent ☐","At ankle region"],
  ["Healed ulcer",               "Present ☐  Absent ☐","Site: _________________"],
  ["Active venous ulcer",        "Present ☐  Absent ☐","Site / size: ___________"],
  ["Telangiectasias",            "Present ☐  Absent ☐","Distribution: __________"],
];
const skinHdr  = ["Finding","Present / Absent","Details"];
const skinCols = [30, 30, 40];

// ─────────────────────────────────────────────────────────────────────────────
// PER-LIMB CONTENT BUILDER
// ─────────────────────────────────────────────────────────────────────────────
function buildLimb(side, secNum) {
  const items = [];
  items.push(sectionBar(`SECTION ${secNum} — ${side} LOWER LIMB`));

  // Deep
  items.push(subHead(`${secNum}A.  Deep Venous System – ${side}`));
  items.push(dataTable(deepHdr, deepVeins, deepCols));
  items.push(para(`DVT (${side}):  None ☐   Acute DVT at: __________________   Chronic changes at: __________________`));

  // SFJ
  items.push(subHead(`${secNum}B.  Superficial Venous System – ${side}`));
  items.push(subHeadItalic("Saphenofemoral Junction (SFJ)"));
  items.push(fieldTable([
    ["SFJ location",       "_______ cm below inguinal ligament"],
    ["SFJ competence",     "Competent  ☐     Incompetent  ☐"],
    ["Reflux at SFJ",      "No reflux  ☐     Reflux: _______ ms  (Valsalva-provoked)"],
    ["Tributaries at SFJ", "Normal  ☐     Accessory saphenous entering  ☐     Other: _______________"],
  ], 32));

  // GSV
  items.push(subHeadItalic("Great Saphenous Vein (GSV)"));
  items.push(dataTable(gsvHdr, gsvRows, gsvCols));
  items.push(para("GSV total refluxing length: _______ cm     GSV wall: Normal ☐   Thickened ☐   Intraluminal echoes ☐   Post-thrombotic ☐"));
  items.push(fieldTable([
    ["AAGSV (Anterior Accessory GSV)","Visible: Yes ☐  No ☐     Diameter: _______ mm     Reflux: _______ ms"],
    ["Giacomini / Posterior Accessory","Visible: Yes ☐  No ☐     Diameter: _______ mm     Reflux: _______ ms"],
  ], 38));

  // SSV / SPJ
  items.push(subHead(`${secNum}C.  Small Saphenous Vein (SSV) & Saphenopopliteal Junction (SPJ) – ${side}`));
  items.push(fieldTable([
    ["SPJ identifiable",               "Yes  ☐     No  ☐   (absent in ~10-30% of cases)"],
    ["SPJ level",                      "_______ cm above popliteal crease"],
    ["SPJ competence",                 "Competent  ☐     Incompetent  ☐"],
    ["Reflux at SPJ",                  "No reflux  ☐     Reflux: _______ ms"],
    ["SSV cranial extension (Giacomini)","Present  ☐     Absent  ☐"],
  ], 38));
  items.push(dataTable(ssvHdr, ssvRows, ssvCols));
  items.push(para("SSV total refluxing length: _______ cm"));

  // Perforators
  items.push(subHead(`${secNum}D.  Incompetent Perforating Veins (IPVs) – ${side}`));
  items.push(note("Pathological criterion: outward flow ≥500 ms AND diameter ≥3.5 mm  (SVS/AVF/AVLS 2023 Guidelines)"));
  items.push(dataTable(perfHdr, perfRows, perfCols));
  items.push(para(`Total pathological perforators identified (${side}): _______`));

  // Varicosities
  items.push(subHead(`${secNum}E.  Varicosities – ${side}`));
  items.push(dataTable(varicHdr, varicRows, varicCols));

  // Skin
  items.push(subHead(`${secNum}F.  Skin & Soft Tissue Changes – ${side}`));
  items.push(dataTable(skinHdr, skinRows, skinCols));

  return items;
}

// ─────────────────────────────────────────────────────────────────────────────
// DOCUMENT BUILD
// ─────────────────────────────────────────────────────────────────────────────
const docChildren = [];

// ── TITLE BLOCK ──────────────────────────────────────────────────────────────
docChildren.push(new Paragraph({
  children: [run("VENOUS DUPLEX DOPPLER ULTRASOUND REPORT", { bold: true, size: 28, color: C.white })],
  alignment: AlignmentType.CENTER,
  spacing: { before: 60, after: 20 },
  shading: shading(C.headerBg),
}));
docChildren.push(new Paragraph({
  children: [run("Bilateral Lower Limb Varicose Veins / Chronic Venous Disease Assessment", { size: 18, color: C.lightBlue })],
  alignment: AlignmentType.CENTER,
  spacing: { before: 0, after: 10 },
  shading: shading(C.headerBg),
}));
docChildren.push(new Paragraph({
  children: [run("SVS/AVF/AVLS 2023 Guidelines  |  2020 CEAP Classification  |  UIP Consensus Document", { italic: true, size: 15, color: C.lightBlue })],
  alignment: AlignmentType.CENTER,
  spacing: { before: 0, after: 80 },
  shading: shading(C.headerBg),
}));

// ── SECTION 1: Patient ────────────────────────────────────────────────────────
docChildren.push(sectionBar("SECTION 1 — PATIENT & REFERRAL DETAILS"));
docChildren.push(fieldTable([
  ["Patient Name",        DOTTED],
  ["Age / Sex",           DOTTED],
  ["Reg. / MRD No.",      DOTTED],
  ["Date of Scan",        DOTTED],
  ["Referred By",         "Dr. " + DOTTED],
  ["Clinical Indication", "Bilateral lower limb varicose veins / leg swelling / leg pain / venous ulcer / pre-treatment mapping"],
  ["Previous Treatment",  "None  ☐    Sclerotherapy  ☐    EVLA  ☐    Surgery  ☐    Specify: " + DOTTED],
], 28));
docChildren.push(emptyPara());

// ── SECTION 2: Technique ──────────────────────────────────────────────────────
docChildren.push(sectionBar("SECTION 2 — TECHNIQUE & EQUIPMENT"));
docChildren.push(fieldTable([
  ["Machine / Model",     DOTTED],
  ["Transducer",          "Linear high-frequency  7.5 – 15 MHz"],
  ["Patient Position",    "Standing / Reverse Trendelenburg  ☐   Supine  ☐"],
  ["Compression Method",  "Manual calf squeeze  ☐   Pneumatic cuff deflation  ☐"],
  ["Valsalva Manoeuvre",  "Yes  ☐   No  ☐   (used for SFJ / CFV assessment)"],
  ["Modes Used",          "B-mode (greyscale)  +  Colour Doppler  +  Spectral Doppler (Duplex)"],
  ["Scan Performed By",   DOTTED],
  ["Interpreted By",      DOTTED],
], 28));
docChildren.push(emptyPara(40));
docChildren.push(new Paragraph({
  children: [
    run("Reflux Threshold (SVS/AVF/AVLS 2023): ", { bold: true, size: 17, color: C.darkBlue }),
    run("Superficial veins & perforators: ", { size: 17 }),
    run(">500 ms", { bold: true, size: 17, color: C.midBlue }),
    run("  retrograde flow.  Deep veins (CFV, FV, POPV): ", { size: 17 }),
    run(">1000 ms", { bold: true, size: 17, color: C.midBlue }),
    run("  retrograde flow.  Pathological perforator: diameter ", { size: 17 }),
    run("≥3.5 mm", { bold: true, size: 17, color: C.midBlue }),
    run(" AND outward flow ", { size: 17 }),
    run("≥500 ms", { bold: true, size: 17, color: C.midBlue }),
  ],
  spacing: { before: 40, after: 120 },
  shading: shading(C.rowAlt),
}));

// ── SECTIONS 3 & 4: Right & Left Limbs ────────────────────────────────────────
buildLimb("RIGHT", "3").forEach(el => docChildren.push(el));
docChildren.push(new Paragraph({ children: [new PageBreak()] }));
buildLimb("LEFT",  "4").forEach(el => docChildren.push(el));

// ── SECTION 5: Reflux Pattern ─────────────────────────────────────────────────
docChildren.push(emptyPara());
docChildren.push(sectionBar("SECTION 5 — REFLUX PATTERN CLASSIFICATION (BILATERAL SUMMARY)"));
docChildren.push(dataTable(
  ["Reflux Pattern", "Right", "Left"],
  [
    ["Axial reflux (groin to calf, uninterrupted)",   "Present ☐  Absent ☐","Present ☐  Absent ☐"],
    ["Junctional reflux only (SFJ or SPJ isolated)",  "Present ☐  Absent ☐","Present ☐  Absent ☐"],
    ["Segmental reflux (portion of truncal vein)",    "Present ☐  Absent ☐","Present ☐  Absent ☐"],
    ["Deep vein reflux",                              "Present ☐  Absent ☐","Present ☐  Absent ☐"],
    ["Perforator-sourced reflux",                     "Present ☐  Absent ☐","Present ☐  Absent ☐"],
    ["Pelvic source suspected",                       "Present ☐  Absent ☐","Present ☐  Absent ☐"],
  ],
  [55, 22, 23]
));
docChildren.push(emptyPara());

// ── SECTION 6: CEAP ───────────────────────────────────────────────────────────
docChildren.push(sectionBar("SECTION 6 — CEAP CLASSIFICATION  (2020 Updated CEAP – American Venous Forum)"));
docChildren.push(dataTable(
  ["Component","Right","Left"],
  [
    ["C – Clinical class",   "C___",   "C___"],
    ["E – Etiology",         "Ep (primary) ☐   Es (secondary/post-thrombotic) ☐   Ec (congenital) ☐",  "Ep ☐  Es ☐  Ec ☐"],
    ["A – Anatomy",          "As (superficial) ☐   Ad (deep) ☐   Ap (perforator) ☐",                   "As ☐  Ad ☐  Ap ☐"],
    ["P – Pathophysiology",  "Pr (reflux) ☐   Po (obstruction) ☐   Pr,o (both) ☐",                     "Pr ☐  Po ☐  Pr,o ☐"],
  ],
  [20, 55, 25]
));
docChildren.push(emptyPara(40));
docChildren.push(subHead("CEAP Clinical Classes"));
docChildren.push(dataTable(
  ["Class","Description"],
  [
    ["C0","No visible or palpable signs of venous disease"],
    ["C1","Telangiectasias or reticular veins"],
    ["C2","Varicose veins"],
    ["C2r","Recurrent varicose veins"],
    ["C3","Oedema"],
    ["C4a","Pigmentation or eczema"],
    ["C4b","Lipodermatosclerosis or atrophie blanche"],
    ["C4c","Corona phlebectatica"],
    ["C5","Healed venous ulcer"],
    ["C6","Active venous ulcer"],
    ["C6r","Recurrent active venous ulcer"],
  ],
  [15, 85]
));
docChildren.push(emptyPara(40));
docChildren.push(para([
  run("Suffix: ", { bold: true, size: 17, color: C.darkBlue }),
  run("s = symptomatic (pain, heaviness, swelling, achiness, itching – HASTI symptoms)   |   a = asymptomatic", { size: 17 }),
]));
docChildren.push(para([
  run("Right CEAP: ", { bold: true, size: 18, color: C.darkBlue }),
  run("C___ E___ A___ P___  ( s / a )          ", { size: 18 }),
  run("Left CEAP: ", { bold: true, size: 18, color: C.darkBlue }),
  run("C___ E___ A___ P___  ( s / a )", { size: 18 }),
]));

// ── SECTION 7: Summary ────────────────────────────────────────────────────────
docChildren.push(new Paragraph({ children: [new PageBreak()] }));
docChildren.push(sectionBar("SECTION 7 — SUMMARY OF FINDINGS"));

for (const side of ["RIGHT", "LEFT"]) {
  docChildren.push(subHead(`${side} LOWER LIMB`));
  docChildren.push(fieldTable([
    ["Deep system",        "Patent ☐  No DVT ☐     Deep venous reflux: Present ☐  Absent ☐   at: _______________________"],
    ["SFJ",                "Competent ☐   Incompetent ☐   Reflux: _______ ms"],
    ["GSV",                "Reflux from __________________ to __________________   Total: _______ cm   Diameter SFJ: _______ mm   BK: _______ mm"],
    ["SSV / SPJ",          "Competent ☐   Incompetent ☐   Reflux: _______ ms   SSV length: _______ cm"],
    ["Reflux pattern",     "Axial ☐   Junctional ☐   Segmental ☐"],
    ["Pathological IPVs",  "_______ perforator(s) at: ________________________________________________"],
    ["Varicosities",       "Distribution: ______________________   Source: ________________________"],
    ["Skin changes",       "None ☐   Pigmentation ☐   LDS ☐   Corona phlebectatica ☐   Ulcer at: ______________"],
  ], 28));
  docChildren.push(emptyPara());
}

// ── SECTION 8: Impression ─────────────────────────────────────────────────────
docChildren.push(sectionBar("SECTION 8 — IMPRESSION"));
for (const [side, n] of [["RIGHT","8.1"],["LEFT","8.2"]]) {
  docChildren.push(new Paragraph({
    children: [run(`${n}  ${side} LOWER LIMB`, { bold: true, size: 18, color: C.darkBlue })],
    spacing: { before: 80, after: 20 },
    shading: shading(C.lightBlue),
  }));
  docChildren.push(new Paragraph({
    children: [
      run(`CEAP: C___ E___ A___ P___ (s/a)\n`, { bold: true, size: 17 }),
      run(`Chronic venous insufficiency, ${side.toLowerCase()} lower limb.\n`, { size: 17 }),
      run("Reflux type: GSV axial ☐   SFJ junctional ☐   SSV reflux ☐   Isolated perforator ☐\n", { size: 17 }),
      run("Reflux from ____________________ to ____________________   Truncal length: _______ cm\n", { size: 17 }),
      run("Deep venous system: Patent ☐   DVT at: ____________________   Chronic changes: ____________________", { size: 17 }),
    ],
    spacing: { before: 40, after: 80 },
    shading: shading(C.white),
    border: { top: { style: BorderStyle.SINGLE, size: 6, color: C.midBlue },
              bottom: { style: BorderStyle.SINGLE, size: 6, color: C.midBlue },
              left: { style: BorderStyle.SINGLE, size: 6, color: C.midBlue },
              right: { style: BorderStyle.SINGLE, size: 6, color: C.midBlue } },
  }));
}

// ── SECTION 9: Recommendations ───────────────────────────────────────────────
docChildren.push(emptyPara(40));
docChildren.push(sectionBar("SECTION 9 — CLINICAL CORRELATION & RECOMMENDATIONS"));
const recs = [
  "☐  Findings support conservative management (compression stockings, lifestyle) for C2/C3 disease",
  "☐  Patient suitable for endovenous thermal ablation (EVLA / RFA) of GSV – Right ☐  Left ☐  Bilateral ☐",
  "☐  Patient suitable for ultrasound-guided foam sclerotherapy (UGFS) of: ___________________________",
  "☐  Phlebectomy / stab avulsions of varicosities advised",
  "☐  Perforator ablation (MOCA / UGFS) advised for IPVs at: _____________________________________",
  "☐  DVT found – anticoagulation and haematology referral recommended",
  "☐  Deep venous reflux present – refer to vascular surgery for further evaluation",
  "☐  Pelvic source suspected – pelvic venous duplex / CT venography recommended",
  "☐  Pre-treatment anatomical mapping complete for planned intervention",
  "☐  Post-treatment follow-up – occlusion confirmed ☐   Re-canalisation noted ☐",
];
recs.forEach(r => docChildren.push(bullet(r)));
docChildren.push(emptyPara());

// ── SECTION 10: Technical Quality ────────────────────────────────────────────
docChildren.push(sectionBar("SECTION 10 — TECHNICAL QUALITY"));
[
  "☐  Technically satisfactory – all segments adequately assessed",
  "☐  Suboptimal assessment of: ____________________ due to: oedema / pain / obesity / wound",
  "☐  Standing position not tolerated; examination performed supine – may underestimate reflux",
  "☐  Images archived to PACS / printed and filed",
].forEach(t => docChildren.push(bullet(t)));
docChildren.push(emptyPara());

// ── Authorisation ─────────────────────────────────────────────────────────────
docChildren.push(sectionBar("AUTHORISATION"));
docChildren.push(fieldTable([
  ["Report Prepared By",   DOTTED],
  ["Qualification",        "MD Radiology / DNB Radiology / DMRD / MS Vascular Surgery"],
  ["MCI / NMC Reg. No.",   DOTTED],
  ["Date & Time",          DOTTED],
  ["Signature & Stamp",    ""],
  ["Centre Name & Address",DOTTED],
], 28));
docChildren.push(emptyPara(60));

// ── Disclaimer ────────────────────────────────────────────────────────────────
docChildren.push(new Paragraph({
  children: [
    run("DISCLAIMER:  ", { bold: true, size: 15, color: C.darkBlue }),
    run(
      "This report constitutes a screening/diagnostic duplex ultrasound examination. A normal study does not exclude all venous pathology. " +
      "Results are position- and technique-dependent; reflux may be underestimated in the supine position. " +
      "All findings must be correlated with clinical history, physical examination, and symptom severity (HASTI). " +
      "References: SVS/AVF/AVLS 2023 Varicose Vein Guidelines (PMID 37652254)  |  2020 CEAP Update (AVF)  |  " +
      "UIP Duplex Consensus Document  |  ACR Duplex Ultrasound Standards.",
      { italic: true, size: 15, color: C.grey }
    ),
  ],
  spacing: { before: 60, after: 60 },
  shading: shading(C.rowAlt),
}));

// ─────────────────────────────────────────────────────────────────────────────
// HEADER & FOOTER
// ─────────────────────────────────────────────────────────────────────────────
const pageHeader = new Header({
  children: [
    new Paragraph({
      children: [run("VENOUS DUPLEX DOPPLER – Bilateral Lower Limb Varicose Veins", { bold: true, size: 17, color: C.darkBlue })],
      alignment: AlignmentType.CENTER,
      border: { bottom: { style: BorderStyle.SINGLE, size: 6, color: C.midBlue } },
      spacing: { before: 0, after: 60 },
    }),
  ],
});

const pageFooter = new Footer({
  children: [
    new Paragraph({
      children: [
        run("Reflux thresholds: Superficial/Perforators >500 ms  |  Deep veins (CFV/FV/POPV) >1000 ms  |  Pathological perforator: ≥3.5 mm & ≥500 ms  |  Page ", { size: 14, color: C.grey }),
        new TextRun({ children: [PageNumber.CURRENT], font: "Calibri", size: 14, color: C.grey }),
      ],
      alignment: AlignmentType.CENTER,
      border: { top: { style: BorderStyle.SINGLE, size: 4, color: C.midBlue } },
      spacing: { before: 60, after: 0 },
    }),
  ],
});

// ─────────────────────────────────────────────────────────────────────────────
// ASSEMBLE & WRITE
// ─────────────────────────────────────────────────────────────────────────────
const doc = new Document({
  creator: "Orris Medical Reports",
  title: "Bilateral Lower Limb Varicose Veins Doppler Report",
  subject: "Venous Duplex Doppler Ultrasound",
  sections: [{
    headers: { default: pageHeader },
    footers: { default: pageFooter },
    properties: {
      page: {
        margin: { top: mm(20), bottom: mm(18), left: mm(18), right: mm(15) },
      },
    },
    children: docChildren,
  }],
});

const OUT = "/home/daytona/workspace/varicose-doppler/Varicose_Veins_Doppler_Report.docx";
Packer.toBuffer(doc).then(buf => {
  fs.writeFileSync(OUT, buf);
  console.log("DOCX created:", OUT);
});
Running Command

cd /home/daytona/workspace/varicose-doppler && node generate_report.js 2>&1

Running Command

ls -lh /home/daytona/workspace/varicose-doppler/ && python /home/daytona/skills/…

Running Command

cd /home/daytona/workspace/varicose-doppler && python3 -c " import zipfile, sys …

Your Word document is ready - validated and all required OOXML parts confirmed present:

Varicose Veins Doppler Report

Word Document · DOCX

Both files are available together:
FileFormatUse for

Varicose Veins Doppler Report

Word Document · DOCX

Word (.docx)Editing, customising centre name, filling patient data

Varicose Veins Doppler Report

PDF Document · PDF

PDFPrinting, archiving, sharing read-only
What the Word file includes:
  • Fully editable tables - all 10 sections with shaded headers (dark blue), alternating row colours, and fillable fields
  • Page header on every page showing report title in dark blue with a bottom border line
  • Page footer on every page with the reflux thresholds (>500 ms / >1000 ms) and page numbers
  • Colour-coded section bars in medium blue across the full page width
  • CEAP table (C0-C6r, 2020 updated), reflux pattern classification, bilateral summary, impression boxes, and recommendations checklist
  • All ☐ checkboxes are Unicode characters - they display clearly and can be replaced with ☑ when filling in Word
  • Calibri font throughout for clean, modern clinical look - editable in any version of Word or LibreOffice
This is a shared conversation. Sign in to Orris to start your own chat.