## 2 Materials and Methods
### Dataset Harmonization  
Publicly available datasets employ different directory structures, metadata schemas (csv, text files, and JSON files), file formats (image formats vs. DICOM radiology format), label encodings, etc. To be able to use them for our work, we had to develop a unified ingest pipeline that included several functions:  
* Metadata organization: We cataloged everything into a single master table/CSV file, where each row corresponds to one image and includes all important metadata related to it (patient ID, study ID, image ID, view position, date, patient sex and age, and image path and image labels, amongst other values). * Label harmonization: We mapped each label to a common convention (e.g., \"_Pneumothorax_\" and \"_PTX_\" were mapped to \"_pneumothorax_\", whereas \"_normal_\" or \"_pathological_\" were mapped to \"_no_finding_\"). We performed one-hot encoding on all labels. For images with uncertainty labels (labeled as '\(-1\)' in CheXpert and MIMIC datasets), we relabeled them as disease-negative ('0'). For datasets not containing the \"_no_finding_\" column, it was set to positive if none of the other pathological columns was positive, and negative otherwise. * Split identifiers: To prevent data leakage, we assigned each patient study a unique cross-dataset identifier in order to allow train-validation splits at a patient level, ensuring no patient's images appeared in both sets. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Dataset** & **Source** & **Date** & **Projections** & **\# Patients** & **\# Images** & **\# Pneumothorax** & **\# Normal** \\ \hline NIH & National Institute of Health, USA & 2016 & Frontal & 30,805 & 112,120 & 5302 (4.73\%) & 60,361 (53.83\%) \\ CheXpert & Stanford University, USA. & 2019 & Frontal/Lateral & 65,240 & 224,316 & 19,466 (8.68\%) & 22,528 (10.04\%) \\ MIMIC-COR & MIT, USA & 2019 & Frontal/Lateral & 65,379 & 377,110 & 14,239 (37.87\%) & 143,436 (38.02\%) \\ PadChest & Universidad de Alicante, Spain & 2019 & Frontal/Lateral/ & 69,882 & 160,868 & 851 (0.22\%) & 50,616 (01.47\%) \\ VinDr-CR & VinBigBrain Group, Vietnam & 2020 & Frontal & 18,000 & 18,000 & 76 (0.00\%) & 12,657 (0.3\%) \\ SIIM-ACR & SIIM-ACR Pneumothorax Challenge, USA & 2019 & Frontal & 12,047 & 12,047 & 2669 (22\%) & 9378 (78\%) \\ BRAX & Hospital Isziezh Albert Einstein, Brazil & 2022 & Frontal/Lateral & 18,442 & 40,967 & 241 (0.52\%) & 29,009 (71\%) \\ CANUD-DTX & Dunneh Hospital, New Zealand & 2021 & Frontal & 13,744 & 19,237 & 3196 (16.61\%) & - \\ Indiana & Indiana University, US & 2015 & Frontal/Lateral & 3851 & 7470 & 54 (0.27\%) & 2696 (56.09\%) \\ PTX-498 & Shanghai, China & 2021 & Frontal & 498 & 498 (100\%) & 0 (0\%) \\ CRADI & Shanghai, China & 2021 & Frontal & (10,440\({}^{\dagger}\)) & 74,082 (10.440\({}^{\dagger}\)) & 201 (1.92\%) & 2737 (26.22\%) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Details of the individual datasets used in our work. The symbol ‘#’ means “number of”. Projections: We correctly handled data projections and corrected some labelling errors for specific images, especially in pneumothorax-positive images. DICOM conversion: Datasets that used DICOM (Digital Imaging and Communications in Medicine) format required additional processing to extract metadata out of the DICOM files, as well as the raw images, which were converted to 8-bit PNG images and saved to disk prior to training. Original splits: If present in the dataset, original training, validation, and test splits were not used, as the ratio was sometimes different to the one we used, and our target was evaluation in external datasets. Enhanced annotations: Whenever enhanced annotations or labels were available, they were used in replacement of the original labels from the dataset--in the NIH dataset, labels from experts [34; 38], and, for NIH and PadChest datasets, annotation from chest tubes [36]. Segmentation information: Binary labels of interest such as 'pneumothorax' or 'tubes' were inferred if there were segmentation masks available.