Skip to content

Release v1.16.0-SNAPSHOT: feat: Add unparsed main body tracking to METAR parser#46

Merged
bclasky1539 merged 2 commits intomainfrom
feature/metar-unparsed-data-implementation
Feb 8, 2026
Merged

Release v1.16.0-SNAPSHOT: feat: Add unparsed main body tracking to METAR parser#46
bclasky1539 merged 2 commits intomainfrom
feature/metar-unparsed-data-implementation

Conversation

@bclasky1539
Copy link
Owner

@bclasky1539 bclasky1539 commented Feb 8, 2026

Changes to NoaaWeatherData:

  • Add unparsedMainBody field to capture unrecognized tokens
  • Update equals() and hashCode() to include unparsedMainBody
  • Add getter/setter methods for unparsedMainBody

Changes to NoaaMetarParser:

  • Capture remaining tokens from parseMainBody() after all patterns processed
  • Add null safety check before setting unparsedMainBody (prevents NPE on parse failures)
  • Remove unparsed handler stub method
  • Remove 'unparsed' case from handlePattern() switch statement

Changes to NoaaAviationWeatherPatternRegistry:

  • Remove UNPARSED_PATTERN from main body handlers (allows tokens to remain for capture)
  • Keep UNPARSED_PATTERN in remarks handlers (preserves freeText functionality)

This enables identification of:

  • Unknown weather phenomena codes (e.g., regional codes like RETS)
  • Regional variations not in the standard
  • Parser gaps requiring investigation
  • Future enhancement opportunities

Resolves tracking of unparsed METAR tokens in main body section.

Summary by CodeRabbit

Release Notes - Version 1.16.0-SNAPSHOT

  • New Features

    • METAR parsing now captures and preserves unparsed main-body tokens so raw/unrecognized main-body content is retained with parsed data.
  • Tests

    • Added comprehensive tests for unparsed main-body handling, covering null/empty inputs, whitespace preservation, multi-token storage, and equality/hashCode behavior.

…TAR parser

Changes to NoaaWeatherData:
- Add unparsedMainBody field to capture unrecognized tokens
- Update equals() and hashCode() to include unparsedMainBody
- Add getter/setter methods for unparsedMainBody

Changes to NoaaMetarParser:
- Capture remaining tokens from parseMainBody() after all patterns processed
- Add null safety check before setting unparsedMainBody (prevents NPE on parse failures)
- Remove unparsed handler stub method
- Remove 'unparsed' case from handlePattern() switch statement

Changes to NoaaAviationWeatherPatternRegistry:
- Remove UNPARSED_PATTERN from main body handlers (allows tokens to remain for capture)
- Keep UNPARSED_PATTERN in remarks handlers (preserves freeText functionality)

This enables identification of:
- Unknown weather phenomena codes (e.g., regional codes like RETS)
- Regional variations not in the standard
- Parser gaps requiring investigation
- Future enhancement opportunities

Resolves tracking of unparsed METAR tokens in main body section.
@bclasky1539 bclasky1539 self-assigned this Feb 8, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 8, 2026

📝 Walkthrough

Walkthrough

Adds unparsed main-body token capture for METAR parsing (version 1.16.0-SNAPSHOT): new unparsedMainBody field on NoaaWeatherData, parser stores main-body leftovers after main-body parsing, pattern registry unparsed handler removed, and tests added/updated.

Changes

Cohort / File(s) Summary
Version Bumps
CHANGELOG.md, pom.xml, noakweather-platform/pom.xml, noakweather-platform/weather-analytics/pom.xml, noakweather-platform/weather-common/pom.xml, noakweather-platform/weather-infrastructure/pom.xml, noakweather-platform/weather-ingestion/pom.xml, noakweather-platform/weather-processing/pom.xml, noakweather-platform/weather-storage/pom.xml
Project version updated from 1.15.0-SNAPSHOT1.16.0-SNAPSHOT and changelog entry added.
Data Model Enhancement
noakweather-platform/weather-common/src/main/java/weather/model/NoaaWeatherData.java
Added unparsedMainBody field with getUnparsedMainBody() / setUnparsedMainBody(String); included in equals() and hashCode().
METAR Parser Updates
noakweather-platform/weather-processing/src/main/java/weather/processing/parser/noaa/NoaaMetarParser.java
After main-body parsing, stores remaining main-body tokens via setUnparsedMainBody(mainBody.trim()) when non-blank; removed handleUnparsed() stub and unparsed pattern switch case.
Pattern Registry Cleanup
noakweather-platform/weather-processing/src/main/java/weather/processing/parser/noaa/NoaaAviationWeatherPatternRegistry.java
Removed UNPARSED_PATTERN handler from main METAR body processing; minor Javadoc paragraph formatting edits.
Tests
noakweather-platform/weather-common/src/test/java/weather/model/NoaaWeatherDataTest.java, noakweather-platform/weather-common/src/test/java/weather/model/NoaaMetarDataTest.java
Added tests for unparsedMainBody (getter/setter, null/empty/whitespace, multiple tokens, equality/hashCode); small Javadoc formatting adjustment in existing test.

Sequence Diagram(s)

sequenceDiagram
  participant Input as "METAR text"
  participant Parser as "NoaaMetarParser"
  participant Registry as "NoaaAviationWeatherPatternRegistry"
  participant Model as "NoaaWeatherData"

  Input->>Parser: parse(METAR)
  Parser->>Registry: match main-body patterns
  Registry-->>Parser: matched main-body tokens
  Parser->>Parser: parseMainBody() -> mainBody (remaining tokens)
  alt mainBody non-blank
    Parser->>Model: setUnparsedMainBody(mainBody.trim())
  end
  Parser->>Parser: parseRemarks()
  Parser->>Model: populate other fields
  Parser-->>Input: return populated NoaaWeatherData
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰
I hopped through tokens, one by one,
Snared the bits that hid from sun,
Tucked them safe in a little field,
Tests confirm the truth revealed,
Happy hops — the parser's done! 🥕✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 26.32% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding unparsed main body tracking to the METAR parser, with version bump to 1.16.0-SNAPSHOT.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/metar-unparsed-data-implementation

No actionable comments were generated in the recent review. 🎉


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@CHANGELOG.md`:
- Around line 14-20: The changelog states "8 new test cases" but the code
additions for unparsedMainBody appear to add only 7 tests; please reconcile by
reviewing NoaaWeatherDataTest and ensure the test count matches actual
additions: either add the missing test for NoaaWeatherData (or NoaaMetarParser)
that covers the remaining unparsedMainBody scenario or update the CHANGELOG
entry to "7 new test cases"; specifically verify tests referencing
unparsedMainBody, getUnparsedMainBody()/setUnparsedMainBody(String), and any
parser behavior in NoaaMetarParser to determine which correction is appropriate
and update the CHANGELOG text accordingly.

@bclasky1539 bclasky1539 merged commit abf3233 into main Feb 8, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant