From the above-mentioned article, convert the management into points for better understanding, & Don't make any changes, keep it as it is in the article

Reading File
Running Command

python3 -c " import pdfplumber with pdfplumber.open('/home/daytona/workspace/attachments/cdd2871c-a170-49fd-9f42-4c6ca89b9cfc/HHS.pdf') as pdf: print(f'Total pages: {len(pdf.pages)}') for i, page in enumerate(pdf.pages): text = page.extract_text() if text: print(f'--- PAGE {i+1} ---') print(text) "

analyse_media
Running Command

python3 -c " from pypdf import PdfReader reader = PdfReader('/home/daytona/workspace/attachments/cdd2871c-a170-49fd-9f42-4c6ca89b9cfc/HHS.pdf') print(f'Pages: {len(reader.pages)}') for i, page in enumerate(reader.pages): text = page.extract_text() print(f'--- PAGE {i+1} ---') print(repr(text)) "

Running Command

python3 -c " import fitz # PyMuPDF doc = fitz.open('/home/daytona/workspace/attachments/cdd2871c-a170-49fd-9f42-4c6ca89b9cfc/HHS.pdf') page = doc[0] mat = fitz.Matrix(3, 3) # 3x zoom for high resolution pix = page.get_pixmap(matrix=mat) pix.save('/home/daytona/workspace/attachments/HHS_page.png') print('Saved to /home/daytona/workspace/attachments/HHS_page.png') print(f'Image size: {pix.width}x{pix.height}') "

Running Command

pdftoppm -r 300 -png /home/daytona/workspace/attachments/cdd2871c-a170-49fd-9f42-4c6ca89b9cfc/HHS.pdf /home/daytona/workspace/attachments/HHS_page && ls /home/daytona/workspace/attachments/HHS_page*

Reading File
Loading Image
Running Command

# Serve the image via a simple HTTP server temporarily, or use pdfplumber with more aggressive extraction # Try pdfplumber to get ALL text including from inside boxes/shapes python3 -c " import pdfplumber with pdfplumber.open('/home/daytona/workspace/attachments/cdd2871c-a170-49fd-9f42-4c6ca89b9cfc/HHS.pdf') as pdf: page = pdf.pages[0] # Get all words words = page.extract_words() print('ALL WORDS:') for w in words: print(w) "

Running Command

# Compress image and encode as base64 to work around size limit python3 -c " from PIL import Image import base64, io img = Image.open('/home/daytona/workspace/attachments/HHS_page-1.png') print(f'Original size: {img.size}') # Resize to smaller for analysis img_resized = img.resize((1200, int(img.height * 1200 / img.width)), Image.LANCZOS) print(f'Resized: {img_resized.size}') img_resized.save('/home/daytona/workspace/attachments/HHS_small.jpg', 'JPEG', quality=85) print('Saved as JPEG') "

Running Command

# Start a simple HTTP server to serve the image cd /home/daytona/workspace/attachments && python3 -m http.server 8765 & sleep 1 echo "Server started" curl -s -I http://localhost:8765/HHS_small.jpg | head -5

Running Command

python3 -m http.server 8765 --directory /home/daytona/workspace/attachments & echo $!

Running Command

nohup python3 -m http.server 8765 --directory /home/daytona/workspace/attachments > /tmp/server.log 2>&1 & echo "PID: $!"

Loading Image
Running Command

# Try OCR to extract text from the image (which contains the flowchart boxes) python3 -c " try: import pytesseract from PIL import Image img = Image.open('/home/daytona/workspace/attachments/HHS_page-1.png') text = pytesseract.image_to_string(img) print(text) except ImportError: print('pytesseract not available') "

I now have the full text of the flowchart via OCR. Here is the management of HHS converted into clear bullet points, keeping all content exactly as in the article:

Treatment of Hyperosmolar Hyperglycemic State (HHS) in Adults

Management Points (UpToDate Algorithm - Graphic 67368 Version 11.0)

1. Initial Assessment

  • Complete initial evaluation, including assessment of cardiovascular, respiratory, and mental status*
  • Patients with HHS may present with stupor or coma
  • If Glasgow Coma Scale score is ≤8, endotracheal intubation is generally required for airway protection
  • Check capillary glucose to confirm hyperglycemia
  • Start isotonic IV fluids (0.9% saline or buffered crystalloid): 1 L per hour
  • Evaluate for precipitating cause(s)

2. IV Fluids

Determine volume status:
A. Severe Hypovolemia (without shock)
  • Administer 0.9% saline or buffered crystalloid (approximately 1 L/hour, rate based on clinical assessment)
B. Mild Hypovolemia
  • Administer 0.9% saline or buffered crystalloid, rate based on clinical assessment
C. Cardiogenic Shock
  • Hemodynamic monitoring/pressors
When volume deficit is corrected, adjust IV fluids based on serum Na+:
  • If serum glucose does not fall within 24h by at least 50 to 70 mg/dL in the first hour, double the IV or SUBQ insulin rate/dose
  • Correct volume deficit within 8 hours
  • Decline in serum glucose should not exceed 90 to 120 mg/dL per hour
Serum Na+ normal or high:
  • 0.45% saline (approximately 250 to 500 mL/hour)
  • When serum glucose is <250 mg/dL (13.9 mmol/L), change to 5 to 10% dextrose with 0.45% saline at 150 to 250 mL/hour
Serum Na+ low:
  • 0.9% saline (approximately 250 to 500 mL/hour)
  • When serum glucose is <250 mg/dL (13.9 mmol/L), change to 5 to 10% dextrose with 0.45% saline at 150 to 250 mL/hour

3. Insulin

If initial serum K+ is <3.5 mEq/L:
  • Delay insulin initiation and give KCl until K+ is >3.5 mEq/L
IV Regular Insulin:
  • 0.05 units/kg/hr IV continuous insulin infusion
  • Establish adequate kidney function (urine output approximately >50 mL/hour)
  • If initial serum glucose is <250 mg/dL (13.9 mmol/L), add 5 to 10% dextrose to IV fluids upon treatment initiation
When serum glucose is <250 mg/dL (13.9 mmol/L):
  • Reduce regular insulin infusion to 0.02 to 0.04 units/kg/hour IV
  • Keep serum glucose between 200 to 250 mg/dL (11.1 to 13.9 mmol/L) until resolution of HHS
  • Refer to UpToDate topic on the treatment of HHS in adults for resolution criteria

4. Potassium

Serum K+ is <3.5 mEq/L:
  • Delay insulin initiation and give 10 to 20 mEq of KCl per hour until K+ >3.5 mEq/L
Serum K+ is 3.5 to 5.0 mEq/L:
  • Give 10 to 20 mEq KCl in each liter of IV fluid to keep serum K+ between 4 to 5 mEq/L
Serum K+ is >5.0 mEq/L:
  • Do not give KCl but check serum K+ every 2 hours

5. Ongoing Monitoring

  • Check electrolytes, BUN, phosphorus, creatinine, and glucose every 2 to 4 hours until stable

6. Resolution & Transition to Subcutaneous Insulin

  • After resolution of HHS and when patient is able to eat, initiate SUBQ multidose (basal-bolus) insulin regimen
  • Continue IV insulin infusion for 1 to 2 hours after rapid-acting SUBQ insulin is begun to ensure adequate plasma insulin levels
  • If short- or long-acting SUBQ insulin is initiated, continue IV insulin infusion for 2 to 4 hours
  • In insulin-naive patients, start 0.5 to 0.8 units/kg per day (total daily dose), and adjust as needed

Footnotes (as in article)

*Initial workup: After history and physical examination, obtain capillary glucose and serum or urine ketones. Begin 1 L of 0.9% NaCl (or buffered crystalloid) over 1 hour, and draw arterial blood gas (or mixed venous blood gas), complete blood count with differential, urinalysis, serum glucose, BUN, electrolytes, chemistry profile, and creatinine levels STAT. Obtain electrocardiogram and, if needed, chest radiograph and specimens for bacterial cultures.
¶ Corrected serum Na+: Serum Na+ should be "corrected" for hyperglycemia (for each 100 mg/dL increase in glucose above 100 mg/dL, add 2 mEq to sodium value for corrected serum sodium value).

Adapted from: Umpierrez GE, Davis GM, ElSayed NA, et al. Hyperglycemic crises in adults with diabetes: A consensus report. Diabetes Care 2024; 47:1257.
This is a shared conversation. Sign in to Orris to start your own chat.