Metadata-Version: 2.4
Name: adif_parser
Version: 0.1.4
Summary: A simple parser library.
Author-email: Fred cC <w6bsd@bsdworld.org>
License: BSD 2-Clause License
        
        Copyright (c) 2025, Fred Cirera
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        
        1. Redistributions of source code must retain the above copyright notice, this
           list of conditions and the following disclaimer.
        
        2. Redistributions in binary form must reproduce the above copyright notice,
           this list of conditions and the following disclaimer in the documentation
           and/or other materials provided with the distribution.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        
Project-URL: Homepage, https://github.com/0x9900/adif_parser
Project-URL: Documentation, https://github.com/0x9900/adif_parser/
Project-URL: Source, https://github.com/0x9900/adif_parser
Project-URL: Tracker, https://github.com/0x9900/adif_parser/issues
Classifier: Intended Audience :: End Users/Desktop
Classifier: Intended Audience :: Telecommunications Industry
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.10
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: build; extra == "dev"
Requires-Dist: flake8; extra == "dev"
Requires-Dist: ipdb; extra == "dev"
Requires-Dist: ipython; extra == "dev"
Requires-Dist: isort; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Requires-Dist: pre-commit; extra == "dev"
Requires-Dist: pylint; extra == "dev"
Dynamic: license-file

# ADIF Parser

A Python library for parsing ADIF (Amateur Data Interchange Format) files used in amateur radio.

## What Does This Library Do?

`adif_parser` is a Python library that reads and parses ADIF files, converting them into structured data.

## Installation

```bash
pip install adif-parser
```

Or install from source:

```bash
git clone https://github.com/0x9900/adif_parser.git
cd adif_parser
pip install .
```

## Usage

### Basic Example

```python
from adif_parser import parse_adif

# Parse an ADIF file
with open('logbook.adi', 'r') as f:
    records = parse_adif(f)

# Iterate through contacts
for record in records:
    print(f"Callsign: {record.get('CALL')}")
    print(f"Date: {record.get('QSO_DATE')}")
    print(f"Time: {record.get('TIME_ON')}")
    print(f"Frequency: {record.get('FREQ')}")
    print(f"Mode: {record.get('MODE')}")
    print("---")
```

## Common ADIF Fields

The parser extracts standard ADIF fields including:

- `CALL`: Callsign contacted
- `QSO_DATE`: Date of contact (YYYYMMDD)
- `TIME_ON`: Start time of contact (HHMMSS)
- `BAND`: Operating band (e.g., "20M", "40M")
- `FREQ`: Operating frequency in MHz
- `MODE`: Operating mode (e.g., "SSB", "CW", "FT8")
- `RST_SENT`: Signal report sent
- `RST_RCVD`: Signal report received
- `NAME`: Name of operator contacted
- `QTH`: Location of station contacted
- `GRIDSQUARE`: Maidenhead grid square
- `COUNTRY`: DXCC entity name
- `STATE`: State/province
- And many more defined in the ADIF specification

## Use Cases

This library is useful for:

- Converting ADIF logs to other formats (CSV, JSON, databases)
- Analyzing amateur radio contact logs
- Building statistics and visualizations from logbook data
  - https://bsdworld.org/misc/FD-Stats-W6UQ-2025.html
- Migrating data between different logging programs
- Contest log processing
  - https://github.com/0x9900/to_cabrillo
- Creating custom reporting tools
- Award tracking and verification

Example ADIF format:
```
<CALL:6>W1AW <QSO_DATE:8>20231015 <TIME_ON:6>143000 <BAND:3>20M <MODE:3>SSB <EOR>
```

## License

See the LICENSE file in the repository for license information.

## Contributing

Contributions are welcome! Please feel free to submit issues or pull requests on GitHub.

## Links

- GitHub Repository: https://github.com/0x9900/adif_parser
- ADIF Specification: https://adif.org/

## Support

For questions, bug reports, or feature requests, please open an issue on the GitHub repository.
