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 Classification of pneumonia and explain in detail?
Pneumonia can be classified in several ways, most commonly by where it was acquired (hospital versus community), but may also by the area of lung affected or by the causative organism. There is also a combined clinical classification, which combines factors such as age, risk factors for certain microorganisms, the presence of underlying lung disease or systemic disease and whether the person has recently been hospitalized.

By location acquired
Community-acquired
Community-acquired pneumonia (CAP) is infectious pneumonia in a person who has not recently been hospitalized. CAP is the most common type of pneumonia. The most common causes of CAP vary depending on a persons age, but they include Streptococcus pneumoniae, viruses, the atypical bacteria, and Haemophilus influenzae. Overall, Streptococcus pneumoniae is the most common cause of community-acquired pneumonia worldwide. Gram-negative bacteria cause CAP in certain at-risk populations. CAP is the fourth most common cause of death in the United Kingdom and the sixth in the United States. The term "walking pneumonia" has been used to describe a type of community-acquired pneumonia of less severity (because the sufferer can continue to "walk" rather than requiring hospitalization). Walking pneumonia is usually caused by the atypical bacterium, Mycoplasma pneumoniae.

Hospital-acquired
Hospital-acquired pneumonia, also called nosocomial pneumonia, is pneumonia acquired during or after hospitalization for another illness or procedure with onset at least 72 hrs after admission. The causes, microbiology, treatment and prognosis are different from those of community-acquired pneumonia. Up to 5% of patients admitted to a hospital for other causes subsequently develop pneumonia. Hospitalized patients may have many risk factors for pneumonia, including mechanical ventilation, prolonged malnutrition, underlying heart and lung diseases, decreased amounts of stomach acid, and immune disturbances. Additionally, the microorganisms a person is exposed to in a hospital are often different from those at home. Hospital-acquired microorganisms may include resistant bacteria such as MRSA, Pseudomonas, Enterobacter, and Serratia. Because individuals with hospital-acquired pneumonia usually have underlying illnesses and are exposed to more dangerous bacteria, it tends to be more deadly than community-acquired pneumonia. Ventilator-associated pneumonia (VAP) is a subset of hospital-acquired pneumonia. VAP is pneumonia which occurs after at least 48 hours of intubation and mechanical ventilation.

By cause
Pneumonia has historically been characterized as either typical or atypical depending on the presenting symptoms and thus the presumed underlying organism. Attempting to make this distinction based on symptoms, however, has not been found to be accurate, and The American Thoracic Society does not recommend its use.

Bronchiolitis obliterans organizing pneumonia
Bronchiolitis obliterans organizing pneumonia (BOOP) is caused by inflammation of the small airways of the lungs. It is also known as cryptogenic organizing pneumonitis (COP).
Eosinophilic pneumonia
Eosinophilic pneumonia is invasion of the lung by eosinophils, a particular kind of white blood cell. Eosinophilic pneumonia often occurs in response to infection with a parasite or after exposure to certain types of environmental factors.

Chemical pneumonia
Chemical pneumonia (usually called chemical pneumonitis) is caused by chemical toxicants such as pesticides, which may enter the body by inhalation or by skin contact. When the toxic substance is an oil, the pneumonia may be called lipoid pneumonia.

Aspiration pneumonia
Aspiration pneumonia (or aspiration pneumonitis) is caused by aspirating foreign objects which are usually oral or gastric contents, either while eating, or after reflux or vomiting which results in bronchopneumonia. The resulting lung inflammation is not an infection but can contribute to one, since the material aspirated may contain anaerobic bacteria or other unusual causes of pneumonia. Aspiration is a leading cause of death among hospital and nursing home patients, since they often cannot adequately protect their airways and may have otherwise impaired defenses.

Dust pneumonia
Dust pneumonia describes disorders caused by excessive exposure to dust storms, particularly during the Dust Bowl in the United States. With dust pneumonia, dust settles all the way into the alveoli of the lungs, stopping the cilia from moving and preventing the lungs from ever clearing themselves.

Necrotizing pneumonia
Necrotizing pneumonia (NP), also known as cavitary pneumonia or cavitatory necrosis, is a rare but severe complication of lung  parenchymal infection. In necrotizing pneumonia, there is a substantial  liquefaction following death of the lung tissue, which may lead to gangrene formation in the lung. In most cases patients with NP have fever, cough and bad breath, and those with more indolent infections have weight loss. Often patients clinically present with acute respiratory failure. The most common pathogens responsible for NP are Streptococcus pneumonia, Staphylococcus aureus, Klebsiella pneumoniae.

Opportunistic pneumonia
People with weakened immune defense, such as HIV/AIDS patients, are highly susceptible to opportunistic infections affecting the lungs. Most common pathogens are Pneumocystis jiroveci, Mycobacterium avium-intracellulare complex, Streptococcus pneumoniae, Haemophilus species. Less frequent pathogens are Cryptococcus neoformans, Histoplasma capsulatum, Coccidioides immitis, cytomegalovirus (CMV), and Toxoplasma gondii.
Chemotherapy-induced immunodeficiency may lead to severe lung infections. Pathogens commonly associated with lung infectioins are bacteria (like Pseudomonas aeruginosa, Stenotrophomonas maltophilia, and Nocardia species), viruses (eg, respiratory syncytial virus, parainfluenza virus, influenza virus A and influenza B, and cytomegalovirus), and fungi (eg, Aspergillus, Fusarium, and Mucorales species, and Pneumocystis jirovecii).

Double pneumonia (bilateral pneumonia)
This is a historical term for acute lung injury (ALI) or acute respiratory distress syndrome (ARDS). However, the term was and, especially by lay people, still is used to denote pneumonia affecting both lungs. Accordingly, the term double pneumonia is more likely to be used to describe bilateral pneumonia than it is ALI or ARDS.

Severe acute respiratory syndrome
Severe acute respiratory syndrome (SARS) is a highly contagious and deadly type of pneumonia which first occurred in Nov-2002 after initial outbreaks in China caused by SARS-CoV/SARS-CoV-1,which almost disappeared by the month of May-2004. The second outbreak of SARS-CoV-2 started in December 2019 from Wuhan, China and was declared pandemic by WHO on 11 March 2020. SARS is caused by the SARS coronavirus, a previously unknown pathogen.

By area of lung affected
Initial descriptions of pneumonia focused on the anatomic or pathologic appearance of the lung, either by direct inspection at autopsy or by its appearance under a microscope. 

A lobar pneumonia is an infection that only involves a single lobe, or section, of a lung. Lobar pneumonia is often due to Streptococcus pneumoniae (though Klebsiella pneumoniae is also possible.)
Multilobar pneumonia involves more than one lobe, and it often causes a more severe illness.
Bronchial pneumonia affects the lungs in patches around the tubes (bronchi or bronchioles).
Interstitial pneumonia involves the areas in between the alveoli, and it may be called "interstitial pneumonitis." It is more likely to be caused by viruses or by atypical bacteria.The discovery of x-rays made it possible to determine the anatomic type of pneumonia without direct examination of the lungs at autopsy and led to the development of a radiological classification. Early investigators distinguished between typical lobar pneumonia and atypical (e.g