import sys, os
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from lib import build_and_save

references = [
 {"title": "Algorithms in Pediatrics", "author": None, "pages": [238, 241, 593]},
 {"title": "CURRENT Diagnosis and Treatment Pediatrics, Twenty-Fourth Edition", "author": "Hay, William W., Levin, Myron J., Deterding, Robin R., Abzug, Mark J.", "pages": [953]},
 {"title": "Pediatric Clinical Practice Guidelines & Policies, 18th Edition", "author": "American Academy of Pediatrics", "pages": [575]},
 {"title": "Pediatric Clinical Practice Guidelines and Policies", "author": "American Academy of Pediatrics (AAP);", "pages": [659, 661]},
 {"title": "Ghai Essential Pediatrics, 9e (Vinod K Paul, Arvind Bagga)", "author": "CamScanner", "pages": [455, 712]},
 {"title": "Signs and Symptoms in Pediatrics", "author": "Henry M. Adam,Jane Meschan Foy", "pages": [623]},
 {"title": "Berkowitz's Pediatrics", "author": "Berkowitz, Carol D.;", "pages": [563, 1237]},
 {"title": "Zitelli and Davis' Atlas of Pediatric Physical Diagnosis: Expert Consult - Online", "author": None, "pages": [289]},
]

short_md = """## In short

- Polytrauma is trauma to more than one area of the body, generally reserved for moderate-to-severe injury requiring multiple interventions across specialties (e.g., head plus orthopedic plus abdominal plus plastic surgery, including burns).
- Trauma is the leading cause of morbidity and mortality in children in the developed world, and blunt trauma is the most common mechanism of injury in children.
- Multisystem injury is the rule rather than the exception in children - internal injury must always be suspected when the mechanism warrants it, even without visible external trauma.
- Children's unique anatomy increases vulnerability: a relatively larger cranium means more space between brain and skull, so bridging veins have less support, and thinner musculature/padding gives organs less protection.
- Children have a remarkable capacity to maintain systolic blood pressure despite 25-30% acute blood loss, so normal blood pressure does not exclude significant hemorrhage; hypovolemic shock from acute blood loss is the most common cause of shock in pediatric trauma patients, and hemorrhagic shock is defined by cardiac output failing to meet tissue metabolic demand, not by any specific blood pressure number.
- The ABCDE sequence (airway, breathing, circulation, disability, exposure) should be followed for initial assessment in every child with polytrauma; airway is the top priority since choking kills faster than any other threat, and the cervical spine should always be protected in a child with polytrauma.
- Use length-based tools for rapid weight estimation to guide drug doses and equipment sizing in a child whose actual weight is unknown.
- Persistent shock despite initial resuscitation should prompt consideration of neurogenic shock, cardiac contusion, or cardiac tamponade, not just ongoing hemorrhage.
- Continuous monitoring after initial resuscitation is mandatory to detect further deterioration, and management should follow a multidisciplinary approach with a single team leader; a Pediatric Trauma Score below 0 is associated with a very poor prognosis and should prompt transport to the nearest appropriate facility.
- Polytrauma can have significant psychological and social impact on the developing brain, contributing to considerable morbidity; psychological and social support during and after resuscitation is an important part of care. Improved emergency medical services, transport systems, and trauma facilities have significantly reduced trauma-related mortality in developed countries.
"""

long_md = """## Definition

Polytrauma is trauma affecting more than one area of the body. The term is generally reserved for moderate-to-severe injury requiring multiple interventions across specialties - for example, a combination of head injury, orthopedic injury, abdominal injury, and plastic surgery needs, which can also include burns.

## Epidemiology

Trauma is the leading cause of morbidity and mortality in children in the developed world, and blunt trauma is the most common mechanism of pediatric injury. Multisystem injury is the rule rather than the exception in children, reflecting both the mechanisms typically involved and children's distinct anatomy and physiology.

## Pathophysiology / Unique Pediatric Anatomy

Children are anatomically and physiologically different from adults in ways that increase their susceptibility to diverse injury patterns. The pediatric cranium is relatively larger, creating more space between the brain and the skull, so the bridging veins have less structural support and are more vulnerable to shear injury. Thinner musculature and less protective padding around internal organs provide less cushioning against blunt forces, increasing the risk of internal injury even without obvious external signs of trauma. Internal injury must always be suspected when the mechanism of injury is consistent with such harm, regardless of whether external evidence of trauma is present. The most striking physiologic difference from adults relates to the response to acute blood loss: children have a tremendous capacity to maintain systolic blood pressure despite losing 25-30% of their circulating blood volume acutely, meaning a normal blood pressure reading does not exclude significant hemorrhage. Hypovolemic shock from acute blood loss is the most common cause of shock in pediatric trauma patients. Hemorrhagic shock itself is defined as a clinical state in which cardiac output is unable to meet the metabolic (oxygen and nutrient) demands of the tissues - it is not defined by any specific absolute blood pressure value.

## Clinical Assessment

Every child with polytrauma should be assessed using the ABCDE sequence: airway, breathing, circulation, disability, exposure. Airway is the top priority, since choking will kill a child faster than any other single threat; airway assessment should evaluate for obstruction from positioning, injury, blood, teeth, vomitus, or a foreign object, alongside level of consciousness, maxillofacial injury, and stridor or cyanosis. The cervical spine should always be protected and immobilized in a child with polytrauma. Length-based tools should be used for rapid estimation of weight to guide appropriate drug dosing and equipment sizing, since a child's actual weight is often unknown in the acute setting. When a child shows persistent shock despite initial resuscitation, causes beyond ongoing hemorrhage should be considered, including neurogenic shock, cardiac contusion, and cardiac tamponade.

## Management

Management of pediatric polytrauma requires a multidisciplinary approach with a single designated team leader to coordinate care across the involved specialties. Continuous monitoring following initial resuscitation is mandatory to detect further deterioration, since a child's condition can change rapidly even after apparent initial stabilization. A Pediatric Trauma Score below 0 carries a very poor (fatal) prognosis and should prompt transport to the nearest available facility rather than delaying for transfer to a specialized center. Improved availability of emergency medical services, transport systems, and advanced trauma facilities has resulted in a significant reduction in accident-related mortality in developed countries.

## Complications

Beyond the immediate physical injuries, polytrauma can have significant psychological and social impact on the developing brain, contributing to considerable long-term morbidity. Psychological and social support - both during resuscitation and in the recovery period afterward - is an important component of comprehensive trauma care for children.
"""

clinical_md = """## Initial Assessment of the Polytrauma Patient

Approach every child with polytrauma using the ABCDE sequence, prioritizing airway above all else, since airway compromise kills faster than any other injury - assess for obstruction from positioning, blood, teeth, vomitus, or foreign material, and evaluate level of consciousness, maxillofacial injury, and stridor or cyanosis. Protect the cervical spine throughout the assessment and stabilization process in every child with polytrauma, regardless of the apparent primary injury site. Use a length-based tool to estimate weight quickly for accurate drug dosing and equipment sizing rather than waiting for an actual weight. Actively suspect internal injury whenever the mechanism of injury is severe enough to cause it, even in the complete absence of external signs of trauma, given children's thinner protective musculature and padding. Remember that a normal blood pressure does not rule out significant blood loss - children can lose 25-30% of their circulating volume while maintaining a normal systolic pressure - so rely on other perfusion markers (heart rate, capillary refill, mental status) rather than blood pressure alone to assess for hemorrhagic shock.

## Managing Shock and Coordinating Ongoing Care

If a child remains in shock despite adequate initial fluid/blood resuscitation, broaden the differential beyond ongoing hemorrhage to include neurogenic shock, cardiac contusion, and cardiac tamponade, and investigate accordingly rather than simply escalating volume resuscitation. Organize care under a single multidisciplinary team leader when multiple specialties (neurosurgery, orthopedics, general/trauma surgery, plastic surgery) are involved, and maintain continuous monitoring after initial resuscitation, since deterioration can occur even after apparent stabilization. Use the Pediatric Trauma Score to help gauge severity and, for very low scores, prioritize rapid transport to the nearest facility over transfer to a more specialized but more distant center. Build psychological and social support into the care plan from the time of resuscitation onward, recognizing that polytrauma can affect the developing brain and contribute to long-term morbidity beyond the physical injuries themselves.
"""

build_and_save(
    topic="Polytrauma",
    slug="polytrauma",
    category_id=15157,
    summary="Pediatric polytrauma: unique anatomic/physiologic vulnerabilities (blood-loss compensation, thin padding, cervical spine), the ABCDE approach, causes of persistent shock beyond hemorrhage, and multidisciplinary trauma team management.",
    references=references,
    short_md=short_md,
    long_md=long_md,
    clinical_md=clinical_md,
)
