-
Notifications
You must be signed in to change notification settings - Fork 31
Add CSV validation warnings and example CSV files #195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Pranav-0440
wants to merge
5
commits into
eclipse-editdor:master
Choose a base branch
from
Pranav-0440:fix/csv-validation-clean
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2447d9f
Add CSV validation warnings and example CSV files
Pranav-0440 ab6b700
chore: fix prettier formatting
Pranav-0440 f2d5943
docs: clarify casing behavior for modbus entity validation
Pranav-0440 f955ce6
test: update parser test to reflect case-mismatch warning behavior
Pranav-0440 2afb413
feat(csv): add validation warnings and extend unit tests with CSV fix…
Pranav-0440 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| # CSV Import Examples | ||
|
|
||
| This directory contains example CSV files for testing the CSV import functionality in EditDor. | ||
|
|
||
| ## Files | ||
|
|
||
| ### `valid.csv` | ||
|
|
||
| A valid CSV file with correct data types and Modbus entities. This file should import without warnings. | ||
|
|
||
| **Valid Types:** | ||
|
|
||
| - `number` | ||
| - `string` | ||
| - `boolean` | ||
|
|
||
| **Valid Modbus Entities:** | ||
|
|
||
| - `HoldingRegister` | ||
| - `InputRegister` | ||
| - `Coil` | ||
| - `DiscreteInput` | ||
|
|
||
| ### `invalid.csv` | ||
|
|
||
| A CSV file with intentional validation issues to demonstrate the warning system. When imported, this file will trigger the following warnings: | ||
|
|
||
| 1. **Row 2, type**: `number123` is invalid (should be `number`, `string`, or `boolean`) | ||
| 2. **Row 2, modbus:entity**: `holdingregister` has incorrect casing (expected `HoldingRegister`) | ||
| 3. **Row 3, modbus:entity**: `InvalidRegister` is not a recognized Modbus entity | ||
| 4. **Row 4, type**: `invalid_type` is not a valid type | ||
| 5. **Row 5, modbus:entity**: `coil` has incorrect casing (expected `Coil`) | ||
|
|
||
| ## Usage | ||
|
|
||
| 1. Open EditDor | ||
| 2. Select "Thing Description" or "Thing Model" | ||
| 3. Click "Load a CSV File" | ||
| 4. Select either `valid.csv` or `invalid.csv` | ||
| 5. Observe the results: | ||
| - `valid.csv`: Should load successfully without warnings | ||
| - `invalid.csv`: Should display validation warnings but still load the data | ||
|
|
||
| ## CSV Format | ||
|
|
||
| Required columns: | ||
|
|
||
| - `name`: Property name (required) | ||
| - `type`: Data type (number, string, or boolean) | ||
| - `modbus:entity`: Modbus entity type | ||
| - `modbus:address`: Modbus address (required) | ||
| - `modbus:unitID`: Modbus unit ID | ||
| - `modbus:quantity`: Number of registers | ||
| - `modbus:zeroBasedAddressing`: Boolean (true/false) | ||
| - `modbus:function`: Modbus function code | ||
| - `modbus:mostSignificantByte`: Boolean (true/false) | ||
| - `modbus:mostSignificantWord`: Boolean (true/false) | ||
| - `href`: Property endpoint path | ||
|
|
||
| Note: Modbus entity validation is case-insensitive for recognition purposes, but incorrect casing will produce a warning. For example, `coil` and `Coil` are treated as the same entity, but `coil` will generate a casing warning. |
|
Pranav-0440 marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| name,type,modbus:entity,modbus:address,modbus:unitID,modbus:quantity,modbus:zeroBasedAddressing,modbus:function,modbus:mostSignificantByte,modbus:mostSignificantWord,href | ||
| temp1,number123,holdingregister,40001,1,1,false,03,true,false,/temp | ||
| humidity,number,InvalidRegister,40002,1,1,false,04,false,false,/humidity | ||
| pressure,invalid_type,HoldingRegister,40003,1,2,true,03,true,true,/pressure | ||
| status,string,coil,00001,1,1,false,01,false,false,/status | ||
| alarm,boolean,DiscreteInput,10001,1,1,false,02,false,false,/alarm |
|
Pranav-0440 marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| name,type,modbus:entity,modbus:address,modbus:unitID,modbus:quantity,modbus:zeroBasedAddressing,modbus:function,modbus:mostSignificantByte,modbus:mostSignificantWord,href | ||
| temperature,number,HoldingRegister,40001,1,1,false,03,true,false,/temp | ||
| humidity,number,InputRegister,40002,1,1,false,04,false,false,/humidity | ||
| pressure,number,HoldingRegister,40003,1,2,true,03,true,true,/pressure | ||
| status,boolean,Coil,00001,1,1,false,01,false,false,/status | ||
| alarm,boolean,DiscreteInput,10001,1,1,false,02,false,false,/alarm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.