Appendix B — EPA CDX Upload and Data Management Procedures
C EPA CDX Upload and Data Management Procedures
This chapter documents the step-by-step procedures for submitting Kenai River baseline water quality data to the EPA Central Data Exchange (CDX) / Water Quality Exchange (WQX), and for removing or correcting previously submitted data.
Note: This chapter was developed and tested during the 2021 data submission (completed March 31, 2026). Steps reflect what was actually confirmed to work — not inferred or assumed. Where a step has not been personally verified, it is noted.
CDX login URL: https://cdx.epa.gov/
KWF Organization ID in EPA WQX: KENAI_WQX
EPA WQX support contact: wqx@epa.gov / 800-424-9067
The three output files ready for upload are generated by appendix_a.qmd and written to other/output/wqx_formatted/:
| File | Contents |
|---|---|
results_activities.csv |
All sample results and associated activity metadata |
project.csv |
Project description and QAPP approval status |
station.csv |
Monitoring location metadata |
Upload these files together in the same CDX session. Also have the QAPP PDF on hand for the project upload:
KenaiWatershedForum_QAPP_v3_2023_with_Addendum_April_2024.pdf
C.1 Uploading Data to EPA CDX
The general sequence below is confirmed correct. Exact button labels should be verified against the WQX Web interface at time of upload — the UI may change between annual submissions.
C.1.1 Step 1: Log in to CDX
- Navigate to https://cdx.epa.gov/.
- Log in with your CDX username and password.
- From the My CDX dashboard, locate WQX Web under “My Programs” and click Go to WQX Web.
C.1.2 Step 2: Upload the Station file
The station file registers monitoring location metadata (coordinates, location descriptions, etc.). Upload this before results, as results reference station IDs.
- In WQX Web, navigate to Import & Submit.
- Select import type: Monitoring Location.
- Select the KWF station import configuration (or create one — see the WQX Web User Guide).
- Browse to and select
other/output/wqx_formatted/station.csv. - Submit and wait for Completed status.
C.1.3 Step 3: Upload the Project file
- In WQX Web, navigate to Import & Submit.
- Select import type: Project.
- Select the KWF project import configuration.
- Browse to and select
other/output/wqx_formatted/project.csv. - Attach the QAPP PDF (
KenaiWatershedForum_QAPP_v3_2023_with_Addendum_April_2024.pdf) and set attachment type to QAPP. - Submit and wait for Completed status.
C.1.4 Step 4: Upload the Results and Activities file
- In WQX Web, navigate to Import & Submit.
- Select import type: Activity (results are nested under activities in WQX).
- Select the KWF results/activities import configuration.
- Browse to and select
other/output/wqx_formatted/results_activities.csv. - Submit and wait for Completed status. This is the largest file and may take several minutes.
C.1.5 Step 5: Verify the upload
- Allow 24–48 hours for data to propagate, then search for KWF data in How’s My Waterway or the Water Quality Portal.
- Confirm that results are visible and that values, units, and site names look correct.
C.2 Deleting Previously Submitted Data
Deletion is necessary when Activity IDs change between submissions (e.g., due to corrected analyte naming conventions). Re-uploading alone only overwrites records with exactly matching Activity IDs — records with changed IDs remain as orphans in WQX. See Section C.3 for when re-upload without deletion is sufficient.
Important: Deletion in WQX is permanent. Always confirm the scope before proceeding and keep local copies of all submission files.
C.2.1 Generating a delete file
The delete file is a single-column CSV listing the Activity IDs to remove. Activity IDs must be provided without the organization prefix — WQX resolves them against the organization associated with the logged-in account.
Activity IDs as downloaded from the Water Quality Portal include the org prefix (e.g., KENAI_WQX-KBL_t_30.0-2021-07-27-P). Strip the prefix before using them in a delete file:
library(tidyverse)
# Load WQP download and extract 2021 Activity IDs
wqp <- read_csv("other/input/WQX_downloads/wqp_download_YYYYMMDD/narrowresult.csv")
delete_file <- wqp |>
filter(year(ActivityStartDate) == 2021) |>
select(ActivityIdentifier) |>
distinct() |>
mutate(ActivityIdentifier = sub("^KENAI_WQX-", "", ActivityIdentifier))
write_csv(delete_file, "other/output/epa_wqp_uploads/corrected_epa_wqp_uploads/resultphyschem_DELETE.csv")The resulting file should have a single column named ActivityIdentifier with one ID per row (no org prefix).
C.2.2 Delete UI path in WQX Web (confirmed working 3/31/2026)
- Log in to CDX and navigate to WQX Web.
- Go to Import & Submit → Import a batch of IDs for records to delete from WQX → Import a file of Activity IDs to be deleted.
- Set Type of File to
CSV (Comma delimited). - Leave “Ignore First Row of Import File?” checked - the file has a header row that should be skipped.
- Confirm that Organization ID is auto-populated as
KENAI_WQXfrom your login. - Browse to and select the delete CSV file.
- Submit and monitor until completed.
UI note: The WQX Web interface labels this import type as “Activity Group IDs to Delete”, which is potentially confusing - it correctly deletes individual Activity records (not Activity Groups, which are a separate WQX concept). This label is accurate as of March 2026.
C.2.3 Verifying the delete
After the import completes, download a fresh results file from the Water Quality Portal for organization KENAI_WQX and the relevant date range. Confirm zero records are returned before proceeding with the re-upload.
C.3 Updating Data Without Full Deletion
If the Activity IDs in the corrected file exactly match what is already in WQX (i.e., only values are changing, not the IDs themselves), a full delete is not necessary. Re-uploading a file with matching Activity IDs will overwrite the existing records for those IDs.
Use this approach only when you are confident no Activity IDs have changed. If analyte naming conventions, site codes, or sample type suffixes have been revised, the ID structure may have changed — use the full delete approach instead.
To check for ID mismatches between your corrected file and WQX before deciding:
# Load WQP download and strip prefix
wqx_ids <- read_csv("other/input/WQX_downloads/wqp_download_YYYYMMDD/narrowresult.csv") |>
filter(year(ActivityStartDate) == 2021) |>
distinct(ActivityIdentifier) |>
mutate(ID_stripped = sub("^KENAI_WQX-", "", ActivityIdentifier))
# Load corrected upload file
new_ids <- read_csv("other/output/wqx_formatted/results_activities.csv") |>
distinct(`Activity ID`)
cat("WQX records not matched by new file (would become orphans):",
sum(!wqx_ids$ID_stripped %in% new_ids$`Activity ID`), "\n")If this count is zero, re-upload without deletion. If nonzero, use the full delete approach.
C.4 WQX Data Structure Note
As of March 2026, KWF’s WQX data is organized at the Activity level: each Activity record contains one result. EPA WQX support (Kevin Christian, wqx@epa.gov) recommends organizing data at the Results level instead, where each Activity represents one sampling event (unique location + date) and multiple Results are nested under it.
The current structure is not invalid, but performance may degrade as the total record count grows. Restructuring involves using the Review function in WQX Web to re-define existing records. This is a lower-priority task best addressed in the kenai-river-wqx-qaqc repo and incorporated into future annual submission pipelines.
C.5 Removing the Existing 2021 KWF Submission (Reference — Completed 3/31/2026)
The 2021 KWF dataset was fully deleted on 3/31/2026 and replaced with a corrected version. The corrected files are:
other/output/wqx_formatted/results_activities.csv(843 records)other/output/wqx_formatted/project.csvother/output/wqx_formatted/station.csv
Corrections addressed: Ca/Mg/Fe unit errors (summer 2021 SGS EDD reported dissolved metals as µg/L when values were on mg/L scale); RM 1.5 site ID mismatch; renamed Activity IDs (Nitrate_Nitrite-N → Total Nitrate/Nitrite-N, Total xylenes → individual xylene names). See (appendix_a?) for full QA/QC details.
C.6 Troubleshooting Common Issues
| Issue | Likely Cause | Resolution |
|---|---|---|
| Delete import fails: “Domain Value Invalid” for all rows | Activity IDs include the KENAI_WQX- org prefix |
Strip the prefix; WQX resolves IDs against the logged-in org |
| Import fails: “invalid monitoring location” | Station not yet registered | Upload station.csv before results_activities.csv |
| Records submitted but not visible in WQP | Propagation delay, or status is “Accepted” not “Completed” | Wait 24–48 hours; recheck submission status |
| Re-upload leaves stale records | Activity IDs changed between versions | Use full delete approach; do not rely on overwrite alone |
C.7 EPA and WQX Resources
- CDX login: https://cdx.epa.gov/
- WQX Web user guide: https://www.epa.gov/waterdata/water-quality-exchange-web-wqx-web-user-guide
- WQX domain values: https://www.epa.gov/waterdata/wqx-domain-files
- Water Quality Portal: https://www.waterqualitydata.us/
- How’s My Waterway: https://mywaterway.epa.gov/
- EPA WQX support: Kevin Christian — wqx@epa.gov / storet@epa.gov / 800-424-9067
