From a4640f3e74535176ecfb001fad1cb7ccdaa93d30 Mon Sep 17 00:00:00 2001 From: Simon Martens Date: Thu, 24 Jul 2025 18:32:58 +0200 Subject: [PATCH 1/3] Change settings + CLAUDE --- CLAUDE.md | 14 ++++++++++++++ settings.json | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..7408dc4 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,14 @@ +# Best Practices Claude + +## Content +- In this directory you'll find data for an online publications containing the letters of 18th century German philosopher Johann Georg Hamann. There are well above >1000 letters. The data is split up into multiple XML files, along domain lines: + - `./briefe.xml`: Contains the letter fulltext. + - `./meta.xml`: Contains metadata about the letters, such as the date of writing, the recipient, and the sender. ZH is data for cross referencing an earlier edition of the letters. + - `./references.xml`: Contains reference data which is linked mostly in the metadata, for locations, people and definitions for terms used in descibing letter heritage data. + - `./traditions.xml`: Contains data about the traditions of the letters, such as the edition they were published in, and the publisher, as well as - often times - additional information, other versions (or drafts) of the letters, and so on. + - `./edits.xml`: Contains data about the editorial changes made to letters - often times comparing the edited text of sources to the original and restoring the original state as well as possible -, cross referencing edit-elements in the letter fulltext. + - `./marginals.xml`: Contains commentary on letters, referencing them by ID, page- and line-numbers. + +## Rules +- Rules for XML transformations: + - diff --git a/settings.json b/settings.json index 5b87d4a..e12b7f9 100644 --- a/settings.json +++ b/settings.json @@ -9,7 +9,7 @@ "AdminService": true, "LocalPublishService": false, "Syntax-Check": true, - "Notifications": false + "Notifications": true }, "FileSizeLimit": 52428800, "AvailableStartYear": 1700, From 823ca7a6f9e797ab3122ae682ccbbeb664f5bb28 Mon Sep 17 00:00:00 2001 From: Simon Martens Date: Thu, 24 Jul 2025 18:34:25 +0200 Subject: [PATCH 2/3] CLAUDE update --- CLAUDE.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 7408dc4..992dead 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -7,8 +7,13 @@ - `./references.xml`: Contains reference data which is linked mostly in the metadata, for locations, people and definitions for terms used in descibing letter heritage data. - `./traditions.xml`: Contains data about the traditions of the letters, such as the edition they were published in, and the publisher, as well as - often times - additional information, other versions (or drafts) of the letters, and so on. - `./edits.xml`: Contains data about the editorial changes made to letters - often times comparing the edited text of sources to the original and restoring the original state as well as possible -, cross referencing edit-elements in the letter fulltext. - - `./marginals.xml`: Contains commentary on letters, referencing them by ID, page- and line-numbers. + - `./Marginal-Kommentar.xml`: Contains commentary on letters, referencing them by ID, page- and line-numbers. + - `./Bibel-Kommentar.xml`, `forschung.xml`, `Register-Kommentar.xml`: Contains a glossary of referenced bible verses, a list of research titles, and a register of terms, but mostly persons and works referenced and linked in the letter commentary. ## Rules -- Rules for XML transformations: - - +- What to do when an XML transformation is requested: + - Before transforming the XML, give a few examples of how you understand the users request and how you would transform the XML. TRy to use a diverse set of cases. + - After giving examples, you'll likely will need to write a python script to transform the XML. Use the `lxml.etree` library to parse the XML in python and transform it. If text should be transformed, try to find the right place in XML witth said library, then you are allowed to use regex to transform text. + - Before running the script, make sure to test it on a small subset of the XML data, so you can see if it works as expected. Alternatively, generate test data to test the transformations against. You are only allowed to do transformations the user asked for, and nothing else. + - After transformation and testing, you may run a formatter in python also using `lxml.etree` to format the XML output, so it is readable and well structured. + - Save all generated scripts in the `scripts/` directory, so they can be reused later. Overwrite the ortiginal xml files only if the transformation was deemed sucessful by the user. From e991e9ca47710c57a2b6a3d9fcb62b7476c7922e Mon Sep 17 00:00:00 2001 From: Simon Martens Date: Thu, 24 Jul 2025 18:56:53 +0200 Subject: [PATCH 3/3] CLAUDE settings --- CLAUDE.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 992dead..09d9f56 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -12,8 +12,9 @@ ## Rules - What to do when an XML transformation is requested: - - Before transforming the XML, give a few examples of how you understand the users request and how you would transform the XML. TRy to use a diverse set of cases. - - After giving examples, you'll likely will need to write a python script to transform the XML. Use the `lxml.etree` library to parse the XML in python and transform it. If text should be transformed, try to find the right place in XML witth said library, then you are allowed to use regex to transform text. - - Before running the script, make sure to test it on a small subset of the XML data, so you can see if it works as expected. Alternatively, generate test data to test the transformations against. You are only allowed to do transformations the user asked for, and nothing else. - - After transformation and testing, you may run a formatter in python also using `lxml.etree` to format the XML output, so it is readable and well structured. - - Save all generated scripts in the `scripts/` directory, so they can be reused later. Overwrite the ortiginal xml files only if the transformation was deemed sucessful by the user. + - Before transforming the XML, give a few examples of how you understand the users request and how you would transform the XML. Try to use a diverse set of test cases, from the start, middle and end of a file. + - After giving examples, you'll likely will need to write a python script to transform the XML. Use the `lxml.etree` library to parse the XML in python and transform it. It is important that this library and no other library is used! If text should be transformed, try to find the right place in XML witth said library, then you are allowed to use regex to transform text. + - Before running the script, make sure to test it on a small subset of the XML data, so you can see if it works as expected. Alternatively, generate test data to test the transformations against. You are only allowed to do the transformations the user asked for, and nothing else. + - All XML comments must be preserved. All other data must be preserved. You should use the ptyhon library to format the output XML. + - After transformations on the test data, ask the user to confirm the transformation on the real production data. Then run the script on the production data. Replace the original files, so the user can run git diff to see tthe changes made. + - Save all generated scripts in the `scripts/` directory with the current date and a meaningful name, so they can be reused later.