# Data Distribution Files
## Overview
EDEX uses **distribution files** to alert the appropriate decoding plug-in that new data has been recieved. These files do so by use of XML and regular expressions. If the WMO header, or file name*, matches a regular expression listed in a distribution XML, then EDEX will put a message into the QPID queue for its corresponding decoder to recognize and process. It is worth noting that more than one distribution file can recognize a single peice of data and notify their decoders to act.
> \*Sometimes the distribution file will not look at the filename. If this file is coming in through the LDM using a proper FILE action, then the it is possible the distribution file will only look at the header and not the filename. If the file is ingested using the *manual* endpoint (/awips2/data_store/ingest/), then this behaviour could be different.
If a piece of data **does not** match any distribution XML, EDEX will:
* Create an entry in `/awips2/edex/logs/edex-ingest-unrecognized-files-yyyymmdd.log`
* Skip processing of the unrecognized file.
Distribution files are stored in the **common_static** branch of the *Localization Store* (series of directories that exist in **/awips2/edex/data/utility/**), and a list of available files can be found in the base-level directory. The base directory is: `/awips2/edex/data/utility/common_static/base/distribution/`.
For each plug-in, the distribution file is named `[data-type].xml`. For example, the distribution file for radar data is `radar.xml`. The distribution files follow the AWIPS base/site localization pattern:
[root@edex]# cd /awips2/edex/data/utility/common_static/base/distribution
[root@edex distribution]# ls
acars.xml goesr.xml poessounding.xml
airep.xml goessounding.xml profiler.xml
airmet.xml grib.xml radar.xml
atcf.xml intlsigmet.xml redbook.xml
aww.xml lsr.xml satellite.gini.xml
...
---
## Creating a Site Override
* *Base* files are located in **/awips2/edex/data/utility/common_static/base/distribution/**
* *Site* override distribution files are located in **/awips2/edex/data/utility/common_static/_site/XXX_/distribution/**, where **_XXX_** is the site identifier.
Note that site-level files override the base files; as a result, local modifications to distribution files must be made as follows:
1. The base distribution file must be copied from **/awips2/edex/data/utility/common_static/base/distribution** to **/awips2/edex/data/utility/common_static/site/XXX/distribution**
2. The local modification must be made to the file in **/awips2/edex/data/utility/common_static/site/XXX/distribution**
The basic structure of the distribution file is:
<requestPatterns xmlns:ns2="group"> <regex>TI[CGT]... ....</regex> <regex>rad/NEXRCOMP</regex> <regex>.\*.gini.\*</regex> <regex>^LOCAL.sat.*</regex> </requestPatterns>3. Save the file and exit the editor. EDEX will automatically pick up the new distribution pattern. Raw files are written to subdirectories in **/awips2/data_store/**, and a message is sent via QPID to the EDEX distribution service from the LDM. When a regular expression match is found in a data distribution file, the raw data file is placed in a queue for the matching plugin to decode and process. The distribution files are used to match file headers as well as filenames, which is how files dropped into EDEX's manual endpoint (**/awips2/data_store/ingest/**) are processed. --- ## Editing an EDEX Data Distribution File Because these files are in the **common/_static** directory, they have to be manually edited using a text editor. You should not edit the base files; rather, as stated above, [you should copy the base version to your site and then edit the site version](#creating-a-site-override). The regular expressions in the distribution files do not necessarily need to correspond with the regular expressions in the LDM **_pqact.conf_** file. It is important to note that: * The regex in the **pqact.conf** file applies to the *productID* that is passed through the LDM. and * The regex in the **distribution** files (.xml) typically applies to the header in the file. It can also apply to the filename, if the file is coming through the manual endpoint, or if the data has no header to begin with. If patterns exist in **_pqact.conf_** but there are no corresponding matching regex expressions in any distribution file, then raw data files will be written to **/awips2/data_store/** but will not be ingested and processed by EDEX. Entries for these non-ingested files would be written to the unrecognized files log in **/awips/edex/logs**. --- ## Examples ### Surface Obs Its distribution file is located at: **/awips2/edex/data/utility/common_static/base/distribution/obs.xml**: