Here's a Typescript implementation of a floodzone analysis for parcels. The happy path takes the command line arguments into the parcelAnalysis library to:
- Verify file
- Read file
- Parse Parcels and Floodzones
- Iterate through Parcels searching for the riskiest
- Output the risk level for the parcel if there is one
There are unit tests for most of the processes listed above as well an an end to end test. I had some difficulty getting lint working and abandoned the effort.
npm installnpx ts-node src/bin/runClassification.ts <DATA_FILE_PATH>or
npm run analyze <DATA_FILE_PATH>E.G
npx ts-node src/bin/runClassification data/case1.txtnpm test- id is a number, could be a string
- Areas are boxes, allowing for a single value to represent: left, right, top, bottom. more complicated shapes would be best teased out
- copy/paste on parsing of Parcels and Floodzones might be better as a unified way of reading an area
- The processing is not completely separate from the processing. Wouldn't be too hard to split if a different sorting or multi-level analysis was desired.
- Was having trouble getting lint to work from the command line, so left it for now