Explain in simple words. And make another good colourful pdf with pictures and explanations

Reading File
Browsing Directory

~/

Running Command

python - <<'PY' from pypdf import PdfReader p='/tmp/workspace/attachments/d1b2c79c-acb5-4ec2-83a4-281a70da77e4/Новый документ (20).pdf' r=PdfReader(p) print('PAGES',len(r.pages)) for i,page in enumerate(r.pages): print('\n--- PAGE',i+1,'---') print((page.extract_text() or '')[:8000]) PY

Reading File
Finding Sources
Searching Images

labeled diagram female reproductive anatomy uterus ovaries fallopian tubes vagina

Searching PubMed

menstrual cycle physiology

Searching the Web

ACOG menstrual cycle normal 21 35 days physiology patient education

Running Command

mkdir -p "/tmp/workspace/gynae_simplified_pdf/src" "/tmp/workspace/gynae_simplified_pdf/output" "/tmp/workspace/gynae_simplified_pdf/assets" && printf 'directories created\n'

Writing File

~/gynae_simplified_pdf/src/create_booklet.py

from reportlab.lib.pagesizes import A4
from reportlab.pdfgen import canvas
from reportlab.lib import colors
from reportlab.lib.colors import HexColor
from reportlab.lib.units import cm
from reportlab.pdfbase.pdfmetrics import stringWidth
from reportlab.lib.utils import ImageReader
import math, os

OUT='/tmp/workspace/gynae_simplified_pdf/output/Female_Reproductive_System_Simple_Guide.pdf'
W,H=A4
NAVY=HexColor('#253457'); PURPLE=HexColor('#7654C8'); PINK=HexColor('#F3639A'); PEACH=HexColor('#FFD5C7'); TEAL=HexColor('#2CB9B1'); MINT=HexColor('#DDF7EF'); GOLD=HexColor('#FFBE4F'); INK=HexColor('#263243'); PALE=HexColor('#F7F7FC'); RED=HexColor('#E85563')

c=canvas.Canvas(OUT,pagesize=A4)
c.setTitle('Female Reproductive System - Simple Guide')

def box(x,y,w,h,fill=colors.white,stroke=None,r=14):
    c.setFillColor(fill)
    c.setStrokeColor(stroke or fill)
    c.roundRect(x,y,w,h,r,fill=1,stroke=1 if stroke else 0)

def text(x,y,s,size=12,color=INK,font='Helvetica',maxw=None,leading=None):
    c.setFillColor(color); c.setFont(font,size)
    if not maxw:
        c.drawString(x,y,s); return y-size
    words=s.split(); lines=[]; line=''
    for word in words:
        test=(line+' '+word).strip()
        if stringWidth(test,font,size)<=maxw: line=test
        else: lines.append(line); line=word
    if line: lines.append(line)
    leading=leading or size*1.35
    for ln in lines:
        c.drawString(x,y,ln); y-=leading
    return y

def title(kicker, heading, sub=''):
    c.setFillColor(PALE);c.rect(0,0,W,H,fill=1,stroke=0)
    c.setFillColor(PURPLE);c.rect(0,H-2.1*cm,W,2.1*cm,fill=1,stroke=0)
    text(1.4*cm,H-1.05*cm,kicker.upper(),9,colors.white,'Helvetica-Bold')
    text(1.4*cm,H-1.72*cm,heading,22,colors.white,'Helvetica-Bold')
    if sub: text(1.4*cm,H-2.65*cm,sub,10,NAVY,'Helvetica',maxw=W-2.8*cm)

def footer(n):
    text(1.4*cm,.8*cm,'Simple study guide | Female reproductive anatomy and physiology',8,HexColor('#707888'))
    text(W-2.0*cm,.8*cm,str(n),9,PURPLE,'Helvetica-Bold')

def pill(x,y,label,fill):
    w=stringWidth(label,'Helvetica-Bold',8)+16
    box(x,y,w,18,fill)
    text(x+8,y+5,label,8,colors.white,'Helvetica-Bold')

def bullet(x,y,head,body,col=PURPLE, width=15*cm):
    c.setFillColor(col);c.circle(x+4,y+3,4,fill=1,stroke=0)
    c.setFillColor(INK);c.setFont('Helvetica-Bold',11);c.drawString(x+16,y,head)
    return text(x+16,y-15,body,10,INK,'Helvetica',width,14)-9

def uterus_diagram(cx,cy,scale=1):
    # ovaries, tubes and uterus
    c.setStrokeColor(PINK);c.setLineWidth(7*scale);c.setLineCap(1)
    c.bezier(cx-10*scale,cy+32*scale,cx-35*scale,cy+47*scale,cx-55*scale,cy+43*scale,cx-68*scale,cy+27*scale)
    c.bezier(cx+10*scale,cy+32*scale,cx+35*scale,cy+47*scale,cx+55*scale,cy+43*scale,cx+68*scale,cy+27*scale)
    c.setFillColor(GOLD); c.ellipse(cx-85*scale,cy+14*scale,cx-63*scale,cy+38*scale,fill=1,stroke=0);c.ellipse(cx+63*scale,cy+14*scale,cx+85*scale,cy+38*scale,fill=1,stroke=0)
    c.setFillColor(PEACH);c.setStrokeColor(PINK);c.setLineWidth(2*scale)
    p=c.beginPath();p.moveTo(cx-30*scale,cy+39*scale);p.curveTo(cx-31*scale,cy+3*scale,cx-18*scale,cy-8*scale,cx,cy-11*scale);p.curveTo(cx+18*scale,cy-8*scale,cx+31*scale,cy+3*scale,cx+30*scale,cy+39*scale);p.curveTo(cx+16*scale,cy+32*scale,cx+8*scale,cy+31*scale,cx,cy+35*scale);p.curveTo(cx-8*scale,cy+31*scale,cx-16*scale,cy+32*scale,cx-30*scale,cy+39*scale);c.drawPath(p,fill=1,stroke=1)
    c.setFillColor(PINK); c.roundRect(cx-8*scale,cy-26*scale,16*scale,19*scale,7*scale,fill=1,stroke=0)
    c.setFillColor(HexColor('#F5A7BE'));c.roundRect(cx-12*scale,cy-68*scale,24*scale,43*scale,11*scale,fill=1,stroke=0)

def label(x,y,tx,ty,s):
    c.setStrokeColor(NAVY);c.setLineWidth(.8);c.line(x,y,tx,ty);text(tx+4,ty-3,s,8,NAVY,'Helvetica-Bold')

# cover
c.setFillColor(HexColor('#FBF5FC'));c.rect(0,0,W,H,fill=1,stroke=0)
for x,y,r,col in [(2,25,1.3,PINK),(18,20,.7,TEAL),(17,5,.8,GOLD),(3,6,.55,PURPLE)]:
    c.setFillColor(col); c.circle(x*cm,y*cm,r*cm,fill=1,stroke=0)
text(1.6*cm,H-3*cm,'A SIMPLE, VISUAL STUDY GUIDE',10,PURPLE,'Helvetica-Bold')
text(1.6*cm,H-4.5*cm,'Female reproductive',27,NAVY,'Helvetica-Bold')
text(1.6*cm,H-5.5*cm,'system',27,NAVY,'Helvetica-Bold')
text(1.6*cm,H-6.5*cm,'Normal anatomy, hormones, periods, pregnancy, and breasts - in easy words.',12,INK,'Helvetica',maxw=10.5*cm)
box(1.6*cm,H-9.2*cm,10.5*cm,1.5*cm,MINT)
text(2*cm,H-8.25*cm,'What you will learn',10,TEAL,'Helvetica-Bold')
text(2*cm,H-8.75*cm,'• Where the organs are   • How hormones work   • What happens in one cycle',9,INK)
uterus_diagram(15.6*cm,H-10.5*cm,1.5)
text(1.6*cm,1.5*cm,'For learning only - it does not replace advice from a doctor or nurse.',8,HexColor('#777777'),'Helvetica-Oblique')
c.showPage()

# Page 2
 title('ANATOMY', 'The organs: a simple map', 'The reproductive system has outer parts and inner parts. They work together.')
box(1.4*cm,3.0*cm,10.2*cm,13.2*cm,colors.white)
uterus_diagram(6.5*cm,10.4*cm,1.55)
label(4.45*cm,11.8*cm,1.8*cm,12.3*cm,'Fallopian tube')
label(3.6*cm,10.2*cm,1.8*cm,9.5*cm,'Ovary')
label(7.0*cm,9.9*cm,9.0*cm,9.3*cm,'Uterus (womb)')
label(6.7*cm,8.5*cm,9.0*cm,8.1*cm,'Cervix')
label(6.7*cm,6.8*cm,9.0*cm,6.3*cm,'Vagina')
box(12.1*cm,3.0*cm,7.5*cm,13.2*cm,colors.white)
y=14.9*cm
y=bullet(12.6*cm,y,'Ovaries','Two small glands. They release eggs and make hormones.',GOLD,6.4*cm)
y=bullet(12.6*cm,y,'Fallopian tubes','Soft tubes that guide the egg toward the uterus.',PINK,6.4*cm)
y=bullet(12.6*cm,y,'Uterus','A strong, pear-shaped organ. A pregnancy grows here.',PURPLE,6.4*cm)
y=bullet(12.6*cm,y,'Cervix','The lower, narrow opening of the uterus.',TEAL,6.4*cm)
y=bullet(12.6*cm,y,'Vagina','A stretchy muscular passage. It is the route for period blood and birth.',PINK,6.4*cm)
footer(2);c.showPage()

# Page 3
title('ANATOMY', 'Outer parts: the vulva', '“Vulva” is the name for the outside genital area. The vagina is inside the body.')
box(1.5*cm,5.3*cm,8.8*cm,9.1*cm,colors.white)
# simplified external illustration
c.setFillColor(PEACH);c.ellipse(4.1*cm,7.1*cm,7.7*cm,12.7*cm,fill=1,stroke=0)
c.setFillColor(PINK);c.ellipse(5.35*cm,7.4*cm,6.45*cm,12.4*cm,fill=1,stroke=0)
c.setFillColor(HexColor('#A34278'));c.circle(5.9*cm,11.85*cm,.16*cm,fill=1,stroke=0)
c.setFillColor(HexColor('#875178'));c.ellipse(5.68*cm,9.5*cm,6.12*cm,10.85*cm,fill=1,stroke=0)
label(6.0*cm,12.1*cm,8.0*cm,13.1*cm,'Clitoris')
label(6.2*cm,10.3*cm,8.0*cm,11.3*cm,'Urethral opening')
label(6.0*cm,9.3*cm,8.0*cm,8.7*cm,'Vaginal opening')
text(2.0*cm,6.0*cm,'This is a simplified educational drawing. Normal bodies vary.',8,HexColor('#6d6d78'),'Helvetica-Oblique',7.6*cm)
box(11.0*cm,5.3*cm,8.5*cm,9.1*cm,colors.white)
y=13.3*cm
y=bullet(11.5*cm,y,'Mons pubis','A soft, fatty pad over the pubic bone.',PURPLE,7.3*cm)
y=bullet(11.5*cm,y,'Labia majora','The outer skin folds. They protect the area.',PINK,7.3*cm)
y=bullet(11.5*cm,y,'Labia minora','The inner folds. They are sensitive and protect openings.',TEAL,7.3*cm)
y=bullet(11.5*cm,y,'Vestibule','The space that contains the urethral and vaginal openings.',GOLD,7.3*cm)
footer(3);c.showPage()

# Page 4
title('HORMONES', 'The hormone message system', 'Hormones are chemical messages. They travel in the blood and tell organs what to do.')
# arrows / pathway
items=[('1','Brain: hypothalamus','Sends GnRH messages',PURPLE),('2','Pituitary gland','Releases FSH and LH',TEAL),('3','Ovaries','Make estrogen and progesterone',PINK),('4','Uterus','Builds or sheds its lining',GOLD)]
x=1.5*cm
for i,(num,h,b,col) in enumerate(items):
    box(x,11.0*cm,4.45*cm,3.2*cm,colors.white)
    c.setFillColor(col);c.circle(x+.55*cm,13.25*cm,.36*cm,fill=1,stroke=0);text(x+.45*cm,13.13*cm,num,9,colors.white,'Helvetica-Bold')
    text(x+.35*cm,12.4*cm,h,11,NAVY,'Helvetica-Bold',3.7*cm)
    text(x+.35*cm,11.65*cm,b,9,INK,'Helvetica',3.7*cm)
    if i<3:
        c.setStrokeColor(NAVY);c.setLineWidth(2);c.line(x+4.48*cm,12.6*cm,x+4.9*cm,12.6*cm)
        c.setFillColor(NAVY);c.wedge(x+4.72*cm,12.45*cm,x+4.98*cm,12.75*cm,0,360,fill=1,stroke=0)
    x+=4.55*cm
box(1.5*cm,4.0*cm,17.9*cm,5.4*cm,MINT)
text(2.0*cm,8.45*cm,'The four main messages',15,NAVY,'Helvetica-Bold')
y=7.65*cm
y=bullet(2.0*cm,y,'FSH','helps a follicle (a tiny egg sac) grow in the ovary.',TEAL,16.1*cm)
y=bullet(2.0*cm,y,'LH','surges to release the egg. This is ovulation.',PURPLE,16.1*cm)
y=bullet(2.0*cm,y,'Estrogen','helps build the uterine lining.',PINK,16.1*cm)
y=bullet(2.0*cm,y,'Progesterone','keeps the lining soft and ready for a possible pregnancy.',GOLD,16.1*cm)
footer(4);c.showPage()

# page 5 cycle
title('MENSTRUAL CYCLE', 'What happens during one cycle', 'Day 1 is the first day of bleeding. A common example is a 28-day cycle, but cycle length varies.')
# cycle circle
cx,cy=6.2*cm,10.0*cm
c.setStrokeColor(HexColor('#E1D6F6'));c.setLineWidth(19);c.circle(cx,cy,3.25*cm,stroke=1,fill=0)
segments=[(135,95,PINK,'1','Period','The lining leaves the body.'),(230,92,TEAL,'2','Follicular','Egg sac grows; estrogen rises.'),(322,38,GOLD,'3','Ovulation','LH releases an egg.'),(0,130,PURPLE,'4','Luteal','Progesterone supports lining.')]
for start,extent,col,num,h,b in segments:
    c.setStrokeColor(col);c.setLineWidth(19);c.arc(cx-3.25*cm,cy-3.25*cm,cx+3.25*cm,cy+3.25*cm,start,extent)
for x,y,num,h,b,col in [(12.0,13.5,'1','Period','Usually 3-7 days',PINK),(12.0,11.5,'2','Follicular','The egg matures',TEAL),(12.0,9.5,'3','Ovulation','Often near mid-cycle',GOLD),(12.0,7.5,'4','Luteal','The lining prepares',PURPLE)]:
    c.setFillColor(col);c.circle(x*cm,y*cm,.28*cm,fill=1,stroke=0);text(x*cm-.1*cm,y*cm-.1*cm,num,7,colors.white,'Helvetica-Bold')
    text(x*cm+.5*cm,y*cm+.05*cm,h,10,NAVY,'Helvetica-Bold');text(x*cm+.5*cm,y*cm-.43*cm,b,9,INK)
text(4.5*cm,10.15*cm,'THE\nCYCLE',15,NAVY,'Helvetica-Bold')
box(1.5*cm,3.8*cm,17.9*cm,1.65*cm,colors.white)
text(2*cm,4.85*cm,'If pregnancy does not start:',10,PURPLE,'Helvetica-Bold')
text(2*cm,4.35*cm,'progesterone falls → the built-up lining sheds → the next period begins.',11,INK)
text(1.5*cm,2.85*cm,'Remember: “day 14” is only an average for a 28-day cycle. Ovulation can happen earlier or later.',9,HexColor('#676777'),'Helvetica-Oblique',17.9*cm)
footer(5);c.showPage()

# page 6 pregnancy breasts
 title('PREGNANCY & BREASTS','From fertilization to feeding','A short overview of two important functions.')
box(1.5*cm,9.0*cm,17.9*cm,5.8*cm,colors.white)
text(2*cm,13.9*cm,'How pregnancy begins',15,NAVY,'Helvetica-Bold')
steps=[('Egg is released','from an ovary',GOLD),('Fertilization','usually occurs in the fallopian tube',PINK),('Early embryo travels','toward the uterus',TEAL),('Implantation','it attaches to the uterine lining',PURPLE)]
x=2.05*cm
for i,(a,b,col) in enumerate(steps):
    c.setFillColor(col);c.circle(x,12.35*cm,.43*cm,fill=1,stroke=0);text(x-.12*cm,12.2*cm,str(i+1),10,colors.white,'Helvetica-Bold')
    text(x-.7*cm,11.45*cm,a,9,NAVY,'Helvetica-Bold',1.5*cm)
    text(x-.7*cm,10.78*cm,b,8,INK,'Helvetica',1.6*cm)
    if i<3: c.setStrokeColor(HEX if False else HexColor('#B6B4C4'));c.setLineWidth(1.5);c.line(x+.5*cm,12.35*cm,x+3.6*cm,12.35*cm)
    x+=4.45*cm
box(1.5*cm,3.7*cm,17.9*cm,4.2*cm,MINT)
text(2*cm,7.25*cm,'Breast hormones in easy words',15,NAVY,'Helvetica-Bold')
for x,h,b,col in [(2.1,'Estrogen','grows milk ducts',PINK),(6.4,'Progesterone','develops milk-making units',PURPLE),(11.3,'Prolactin','makes milk',TEAL),(15.3,'Oxytocin','helps milk flow out',GOLD)]:
    c.setFillColor(col);c.circle(x*cm,5.75*cm,.42*cm,fill=1,stroke=0)
    text(x*cm-.78*cm,4.93*cm,h,9,NAVY,'Helvetica-Bold',1.7*cm)
    text(x*cm-.78*cm,4.42*cm,b,8,INK,'Helvetica',1.8*cm)
footer(6);c.showPage()

# pg7 healthy and review
 title('QUICK REVIEW','Healthy basics and key facts','These are general study facts, not a way to diagnose a problem.')
box(1.5*cm,9.8*cm,8.55*cm,5.0*cm,colors.white)
text(2*cm,13.8*cm,'Normal protection',15,NAVY,'Helvetica-Bold')
y=12.9*cm
y=bullet(2*cm,y,'Vagina','Normally acidic. Helpful Lactobacillus bacteria support this protection.',TEAL,7.2*cm)
y=bullet(2*cm,y,'Uterus','Usually points forward: anteverted and anteflexed.',PURPLE,7.2*cm)
box(10.65*cm,9.8*cm,8.75*cm,5.0*cm,colors.white)
text(11.15*cm,13.8*cm,'Possible ovulation clues',15,NAVY,'Helvetica-Bold')
y=12.9*cm
y=bullet(11.15*cm,y,'Temperature','A small rise in basal body temperature after ovulation.',GOLD,7.3*cm)
y=bullet(11.15*cm,y,'Mucus','Cervical mucus may become clear and stretchy near ovulation.',PINK,7.3*cm)
y=bullet(11.15*cm,y,'Pain','Some people feel a short mid-cycle ache.',PURPLE,7.3*cm)
box(1.5*cm,3.3*cm,17.9*cm,4.9*cm,HexColor('#FFF3F6'))
text(2*cm,7.45*cm,'When to seek medical advice',15,RED,'Helvetica-Bold')
text(2*cm,6.72*cm,'Speak with a clinician if bleeding is very heavy, periods are very painful or suddenly change,',10,INK)
text(2*cm,6.22*cm,'you miss periods unexpectedly, or you have pelvic pain, fever, or unusual discharge.',10,INK)
text(2*cm,5.3*cm,'Key message:',10,PURPLE,'Helvetica-Bold')
text(2*cm,4.8*cm,'The ovaries, hormones, uterus, and breasts are connected. Together they control egg release, periods, pregnancy, and milk feeding.',11,NAVY,'Helvetica',16.5*cm)
text(1.5*cm,2.45*cm,'Source basis: uploaded notes. Normal ranges and timing vary among individuals.',8,HexColor('#6d6d78'),'Helvetica-Oblique')
footer(7);c.showPage()

c.save()
print(OUT)
Your credits are exhausted. You can purchase a top-up or subscribe to a plan to continue using Orris. If you're already subscribed, your daily credits will reset tomorrow.
This is a shared conversation. Sign in to Orris to start your own chat.