You are a helpful, respectful, and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature. If a question does not make any sense or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.
What is Pulmonary edema and explain in detail?
Pulmonary edema, also known as pulmonary congestion, is excessive liquid accumulation in the tissue and air spaces (usually alveoli) of the lungs. It leads to impaired gas exchange and may cause hypoxemia and respiratory failure. It is due to either failure of the left ventricle of the heart to remove oxygenated blood adequately from the pulmonary circulation (cardiogenic pulmonary edema), or an injury to the lung tissue directly or blood vessels of the lung (non-cardiogenic pulmonary edema).Treatment is focused on three aspects: firstly improving respiratory function, secondly, treating the underlying cause, and thirdly preventing further damage and assuring full recovery to the lung. Pulmonary edema, especially when sudden (acute), can lead to respiratory failure or cardiac arrest due to hypoxia. It is a cardinal feature of congestive heart failure. The term edema is from the Greek οἴδημα (oidēma, "swelling"), from οἰδέω (oidéō, "(I) swell").

Types
Classically it is cardiogenic (left ventricular) but fluid may also accumulate due to damage to the lung. This damage may be from direct external injuries or injuries mediated by high pressures within the pulmonary circulation. When directly or indirectly caused by increased left ventricular pressure, pulmonary edema may form when mean pulmonary pressure rises from the normal average of 15 mmHg to above 25 mmHg, where pulmonary fluid may form. Broadly, the causes of pulmonary edema can be divided into cardiogenic and non-cardiogenic. By convention, cardiogenic specifically refers to left ventricular causes.

Cardiogenic
Congestive heart failure which is due to the hearts inability to pump the blood out of the pulmonary circulation at a sufficient rate resulting in elevation in pulmonary wedge pressure and edema – this usually is due to left ventricular failure, but may also be from arrhythmias, or fluid overload, (e.g. from kidney failure or intravenous therapy).
Hypertensive crisis can cause pulmonary edema as the elevation in blood pressure and increased afterload on the left ventricle hinders forward flow in blood vessels and causes the elevation in wedge pressure and subsequent pulmonary edema.

Non-cardiogenic
Negative pressure pulmonary edema in which a significant negative (internal) pressure in the chest (such as from an inhalation against an upper airway obstruction) ruptures capillaries and floods the alveoli with blood. Negative pressure pulmonary edema has an incidence in the range of 0.05-0.1% in cases of general anesthesia. The negative pressure causes a significant increase in preload, thereby increasing pulmonary blood volume.  There is also a significant increase in left ventricular afterload, which causes a decreased cardiac output.  The increase in pulmonary blood volume and pressure along with a decrease in cardiac output to the lungs will increase the pulmonary transudative pressures and the risk of pulmonary edema. With all this occurring, pulmonary vascular resistance increases causing a shift of the intraventricular septum.  The ventricular septal shift to the left causes a left ventricular diastolic dysfunction, which further increases pulmonary hydrostatic pressures and the risk.
Neurogenic causes  (seizures, head trauma, strangulation, electrocution).
Pulmonary embolismAcute lung injury may also cause pulmonary edema directly through injury to the vasculature and parenchyma of the lung. It includes acute lung injury and acute respiratory distress syndrome. (ALI-ARDS) cover many of these causes, but they may also include:

Inhalation of hot or toxic gases
Pulmonary contusion, i.e., high-energy trauma (e.g. vehicle accidents)
Aspiration, e.g., gastric fluid
Reexpansion, i.e. post large volume thoracocentesis, resolution of pneumothorax, post decortication, removal of endobronchial obstruction, effectively a form of negative pressure pulmonary oedema.
Reperfusion injury, i.e., postpulmonary thromboendartectomy or lung transplantation
Swimming induced pulmonary edema also known as immersion pulmonary edema
Transfusion Associated Circulatory Overload occurs when multiple blood transfusions or blood-products (plasma, platelets, etc.) are transfused over a short period of time.
Transfusion associated Acute Lung Injury is a specific type of blood-product transfusion injury that occurs when the donors plasma contained antibodies against the recipient, such as anti-HLA or anti-neutrophil antibodies.
Severe infection or inflammation which may be local or systemic. This is the classical form of acute lung injury-adult respiratory distress syndrome.Some causes of pulmonary edema are less well characterised and arguably represent specific instances of the broader classifications above.

Arteriovenous malformation
Hantavirus pulmonary syndrome
High altitude pulmonary edema (HAPE)
Envenomation, such as with the venom of Atrax robustus

Signs and symptoms
The most common symptom of pulmonary edema is difficulty breathing (dyspnea), but may include other symptoms such as coughing up blood (classically seen as pink or red, frothy sputum), excessive sweating, anxiety, and pale skin. Shortness of breath can manifest as orthopnea (inability to breath sufficiently when lying down flat due to breathlessness) and/or paroxysmal nocturnal dyspnea (episodes of severe sudden breathlessness at night). These are common presenting symptoms of chronic and cardiogenic pulmonary edema due to left ventricular failure. The development of pulmonary edema may be associated with symptoms and signs of "fluid overload" in the lungs; this is a non-specific term to describe the manifestations of right ventricular failure on the rest of the body and includes peripheral edema (swelling of the legs, in general, of the "pitting" variety, wherein the skin is slow to return to normal when pressed upon due to fluid), raised jugular venous pressure and hepatomegaly, where the liver is excessively enlarged and may be tender or even pulsatile. Other signs include end-inspiratory crackles (crackling sounds heard at the end of a deep breath) on auscultation and the presence of a third heart sound.

Flash pulmonary edema
Flash pulmonary edema (FPE), is rapid onset acute pulmonary edema. It is most often precipitated by acute myocardial infarction or mitral regurgitation, but can be also caused by aortic regurgitation, heart failure, or almost any cause leading to elevated left ventricular filling pressures. Treatment of FPE should be directed at the underlying cause, but the mainstays are nitroglycerin, ensuring adequate oxygenation with non-invasive ventilation, and decrease of pulmonary circulation pressures while FPE stays.Recurrence of FPE is thought to be associated with hypertension and may signify renal artery stenosis. Prevention of recurrence is based on managing or preventing hypertension, coronary artery disease, renovascular hypertension, and heart failure.

Diagnosis
There is no single test for confirming that breathlessness is caused by pulmonary edema – there are many causes of shortness of breath; but there are methods to suggest a high probability of an edema.
Low oxygen saturation in blood and disturbed arterial blood gas readings support the proposed diagnosis by suggesting a pulmonary shunt. A chest X-ray will show fluid in the alveolar walls, Kerley B lines, increased vascular shadowing in a classical batwing peri-hilum pattern, upper lobe diversion (biased blood flow to the superior parts instead of inferior parts of the lung), and possibly pleural effusions. In contrast, patchy alveolar infiltrates are more typically associated with noncardiogenic edemaLung ultrasounds, employed by a healthcare provider at the point of care, is also a useful tool to diagnose pulmonary edema; not only is it accurate, but it may quantify the degree of lung water, track changes over time, and differentiate between cardiogenic and non-cardiogenic edema.Especially in the case of cardiogenic pulmonary edema, urgent echocardiography may strengthen the diagnosis by demonstrating impaired left ventricular function, high central venous pressures and high pulmonary artery pressures leading to pulmonary edema.
Blood tests are performed for electrolytes (sodium, potassium) and markers of renal function (creatinine, urea). Liver enzymes, inflammatory markers (usually C-reactive protein) and a complete blood count as well as coagulation studies (PT, aPTT) are also typically requested as further diagnosis. B-type natriuretic peptide (BNP) is available in many hospitals, sometimes even as a point-of-care test