risp/README.md

77 lines
3.2 KiB
Markdown
Raw Normal View History

2023-11-03 22:40:19 +01:00
RISolve
# Folder
- ./data
- cache -> cache for `overview` tests
2024-02-05 11:40:28 +01:00
- expected
- overview -> expected xml links of law_ids
2024-02-05 11:40:28 +01:00
# Add new law text
## Tests
- Getting paragraphs from `law_id` (`risparser::overview::test::parse()`)
2024-02-05 11:40:28 +01:00
- Create file `law_id` in `./data/expected/overview` (then run tests to get current output + save in file)
2024-02-05 16:03:36 +01:00
- Parsing paragraphs: add test in `src/risparser/paragraph/mod.rs`
-
2024-02-05 11:40:28 +01:00
2024-02-04 12:11:34 +01:00
# Features (to be moved to lib.rs one-by-one)
- Text to structured law
- `LawBuilder`: Structure law, by specifying (sub-)sections (`new_header`), its description (`new_desc`), paragraphs under the current (sub-)section (`new_par`), and the description of the next paragraph (`new_next_para_header`). `Classifier` need to be set.
- Main output: Properly structured laws (`Law`)
- `Law`: Represents a structured law text. Can be generated with `LawBuilder`.
- Main output: properly formatted (md for a start) law text, no need to export Heading/... etc
- RIS Fetcher (to be mocked)
- all paragraphs of specific law (`overview`)
- xml document from url (`par/mod.rs fetch_age`)
- Parser
- replace errors w/ config file
# Integration test
- Nice test would be to re-create html ris file and compare it (problem with custom fixes, though)
2023-11-03 14:26:18 +01:00
# History
- [I've created my first parser using RIS API, daily updated. Failed because I tried to do too much automatically (e.g. recognizing headers](https://gitlab.com/PhilippHofer/law)
- [Using print-website, I've extracted stuff w/ regex.](https://gitlab.com/PhilippHofer/ris/)
- [Tried to create a parser using print-website, proper(-ish) parser](https://gitlab.com/PhilippHofer/ris2)
# Goals
2023-11-06 17:37:22 +01:00
- [x] I want to have the text of the law.
2023-11-07 08:50:04 +01:00
- [x] I want to see the structure (proper headers) of the law.
2023-11-03 14:26:18 +01:00
- [ ] I want to be able to make comments (e.g. Erschöpfung) on certain parts
- [ ] I want to see since when this paragraph is in use.
2023-11-06 17:37:22 +01:00
- [~] Lawtext should be updateable
2023-11-03 14:26:18 +01:00
# Technical
- I don't want to restrict myself with a [parser combinators](docs.rs/nom) but code it myself using *recursive descent* parser.
- Be strict in what I process. Fail if anything unexpected happens. The user should handle this case. It's fine if one decides to ignore the new/unexpected field, but it should be done deliberately.
# Progress / Functions
2023-11-06 17:37:22 +01:00
- [x] Parse structure of law into struct using Deserilize trait, pot. multiple requests (if > 100 paragraphs)
2023-11-07 08:50:04 +01:00
- [x] Parse risdok using own *RD parser*, again strict: fail if anything not expected happens, not sure (yet) if I want to operate on strings, or first parse using off-the-shelve XML reader (prob. 2nd option)
2023-11-03 14:26:18 +01:00
2023-11-03 14:28:37 +01:00
# Next step
2023-11-07 09:51:22 +01:00
- [x] Parse ABGB
2023-11-07 08:50:04 +01:00
- [ ] Create config files for laws
- law_id
- replace stuff
- headers
- [ ] Create argument parse
- `--law mschg.conf`
2023-11-03 22:40:19 +01:00
# Naming
- Law ("Gesetz"): e.g. UHG, TEG, ABGB
- Section ("Paragraph")
- Subsection ("Absatz")
- Item ("Ziffer")
- Heading-{1,2,3,...}
2023-11-04 10:07:43 +01:00
# "Scripts"
- Retrieve overview law: `curl -X POST "https://data.bka.gv.at/ris/api/v2.6/Bundesrecht" -H "Content-Type: application/x-www-form-urlencoded" -d "Applikation=BrKons" -d "Gesetzesnummer=10001899" -d "DokumenteProSeite=OneHundred" -d "Seitennummer=1" -d "Fassung.FassungVom=2023-11-03" | jq . > law.json`
2024-01-26 16:55:15 +01:00