Skip to content

Implemented read_tbe function for reading and parsing TBE files using Rust#108

Open
DeviPriya-Kolla wants to merge 2 commits intomainfrom
rust_61_read_tbe_files_
Open

Implemented read_tbe function for reading and parsing TBE files using Rust#108
DeviPriya-Kolla wants to merge 2 commits intomainfrom
rust_61_read_tbe_files_

Conversation

@DeviPriya-Kolla
Copy link
Copy Markdown
Collaborator

Fixes #61

What was changed?

In this update, I implemented the read_tbe function that allows parsing and reading of TBE (Tabular Data) files. This function processes TBE data into a structured format, specifically reading various tables from the CSV-like file and storing them in a set of Rust structures.

  • The read_tbe function was added in src/functions/read_tbe.rs.
  • The models::Site struct was defined to model the parsed data structure.
  • Several helper methods were written to handle different sections (like ATT, CMT, and TBL), ensuring each section of the TBE file is captured correctly.

Why was it changed?

The purpose of this change was to implement functionality that would allow the parsing and processing of TBE files, which was previously missing. These files contain tabular data that needed to be parsed into structured HashMap and Site structs for further processing.

By implementing the read_tbe function, we can now reliably parse these TBE files, extract relevant information, and handle it in a structured way that can be used by other parts of the application.

How was it changed?

  • Created parse_tbe function:

    • Implemented in src/functions/read_tbe.rs to parse the TBE file.
    • The function processes the TBE file sections (headers, attributes, comments, and rows) and stores the data in a HashMap<String, Table>.
    • The Table struct holds the parsed rows (data), attributes (att), and comments (cmt).
  • Modified the models module:

    • Added the Site struct in src/models.rs to represent site data extracted from the TBE file.
  • Handled TBE file sections:

    • Used logic to distinguish between table headers (TBL), attributes (ATT), comments (CMT), and data rows (BGN to EOT).
    • Data rows are stored as HashMap<String, String>, where each key is a column name and each value is the corresponding data.
  • Integrated into the main application:

    • In src/main.rs, I utilized the parse_tbe function to read the TBE file and display the parsed data.

Screenshots that show the changes (if applicable):
image

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.

Rust__read tbe files

1 participant