Implement daily file processing with automatic fallback to weekly files - #33
Conversation
Co-authored-by: pcunning <171210+pcunning@users.noreply.github.com>
|
@copilot daily files are added the day after and not on Monday. So on Tuesday after noon eastern mondays file should be available. On saturday fetch Friday. The daily files only contain a delta of the changes since the last complete file. There should be two run modes with daily files. Partial and full. On full download the last weekly complete file and all daily files since the weekly should be downloaded. The weekly file is published Sunday. So if running full on Wednesday we would download the complete file and the daily file for Monday, and Tuesday. On partial mode we only need to download the daily delta. Because this mode is only getting a partial dump we need to change some of the functionality of tue other data points like geo LOTW and radioid. These currently initialize a blank callsign when it does not exist in the ULS data, on partial it needs to not do that so we don't overwrite good data from the last full download. Instead of using http to download the daily files use the ftp server the weekly files are downloaded from. |
…ownloads Co-authored-by: pcunning <171210+pcunning@users.noreply.github.com>
I've implemented all the requested changes in commit 5cd0bb5: Two Run Modes:
Correct Day Logic:
FTP Downloads: Switched from HTTP to FTP server as requested:
Partial Mode Data Protection:
Full Mode: Downloads complete weekly file + all daily deltas since Sunday, merges before processing Usage: ULS_MODE=partial ./hamcall -dl # Delta only
ULS_MODE=full ./hamcall -dl # Weekly + all dailies
./hamcall -dl # Weekly (default)Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull Request Overview
This PR implements a comprehensive daily file processing system for FCC ULS data with intelligent fallback to weekly files. The system introduces three operational modes: partial (daily only), full (weekly + daily merge), and default (weekly only).
- Adds environment variable
ULS_MODEto control processing behavior with automatic fallback mechanisms - Implements day-aware daily file downloads with business day logic and data validation
- Updates all supplementary data processors (radioid, lotw, geo) to support partial mode operation
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| source/uls/uls.go | Core implementation of daily processing modes, download functions, and fallback logic |
| source/uls/uls_test.go | Comprehensive test coverage for daily processing functions and validation |
| main.go | Integration of partial mode flag into the main processing pipeline |
| source/radioid/radioid.go | Added partial mode support to skip creating new callsigns |
| source/lotw/lotw.go | Added partial mode support to skip creating new callsigns |
| source/geo/geo.go | Added partial mode support to skip creating new callsigns |
| .github/workflows/run-process.yml | Updated weekly workflow for full mode processing |
| .github/workflows/daily-partial-update.yml | New workflow for automated daily partial updates |
Comments suppressed due to low confidence (3)
source/uls/uls_test.go:281
- [nitpick] The test function name
TestDownloadSelectiondoesn't clearly describe what it's testing. Consider renaming toTestULSModeEnvironmentVariableto better reflect that it's testing environment variable behavior.
os.Unsetenv("ULS_MODE")
source/uls/uls.go:160
- The variable name
dailyUrlshould use camelCase naming convention. It should bedailyURLfollowing Go naming conventions for acronyms.
dailyUrl := fmt.Sprintf("ftp://wirelessftp.fcc.gov:21/pub/uls/daily/l_am_%s.zip", day)
source/uls/uls.go:225
- The variable name
dailyUrlshould use camelCase naming convention. It should bedailyURLfollowing Go naming conventions for acronyms.
dailyUrl := fmt.Sprintf("ftp://wirelessftp.fcc.gov:21/pub/uls/daily/a_am_%s.zip", day)
| } | ||
|
|
||
| // For partial mode, check if daily files contain essential data and fallback if needed | ||
| if ulsMode == "partial" { |
There was a problem hiding this comment.
The string literal "partial" is repeated multiple times throughout the code. Consider defining a constant for ULS mode values to improve maintainability and reduce the risk of typos.
| if ulsMode == "partial" { | |
| if ulsMode == ULSModePartial { |
|
|
||
| // For partial mode, check if daily files contain essential data and fallback if needed | ||
| if ulsMode == "partial" { | ||
| if !dailyFilesContainEssentialData("l_amat") { |
There was a problem hiding this comment.
The directory path "l_amat" is hardcoded. Consider extracting this as a constant or variable to improve maintainability and consistency with other directory references.
| if !dailyFilesContainEssentialData("l_amat") { | |
| if !dailyFilesContainEssentialData(DefaultExtractDir) { |
| if ulsMode == "partial" { | ||
| if !dailyFilesContainEssentialData("l_amat") { | ||
| fmt.Println("Daily files missing essential data, downloading weekly files...") | ||
| wg.Add(1) |
There was a problem hiding this comment.
Adding to the WaitGroup inside a goroutine that's already being waited on can cause synchronization issues. The WaitGroup increment should happen before starting the goroutine, not inside the fallback function.
| wg.Add(1) |
This PR implements daily file processing for FCC ULS data as requested in the issue. The system can now process daily delta files instead of always downloading the complete weekly files, which significantly reduces download time and bandwidth usage for incremental updates.
Key Features
ULS_USE_DAILY=trueto enable daily file processingl_am_mon.zip,a_am_tue.zip)AM.dat,EN.dat,HD.dat) exist and contain data before proceedingUsage
Implementation Details
The implementation adds three new functions:
DownloadDailyLicenses(): Downloads daily license files with fallback to weeklyDownloadDailyApplications(): Downloads daily application files with fallback to weeklydailyFilesContainEssentialData(): Validates essential files exist and have contentDaily files are downloaded from:
https://data.fcc.gov/download/pub/uls/daily/l_am_{day}.ziphttps://data.fcc.gov/download/pub/uls/daily/a_am_{day}.zipTesting
Added comprehensive tests covering:
All existing tests continue to pass, ensuring no breaking changes to current functionality.
Fixes #10.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
api.backblazeb2.com/tmp/go-build3412660826/b001/exe/hamcall -m stats(dns block)invalid-url-that-does-not-exist.comIf you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.