initial commit

This commit is contained in:
Daniel Abbassi
2025-07-10 11:56:59 +02:00
commit d17f42ecb5
4 changed files with 8982 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
angebote_traegerMail_iteration/dict_*.json

10
README.md Normal file
View File

@@ -0,0 +1,10 @@
Data processing scripts
## angebote_traegerMail_iteration (related to FM)
### Input
This script is related to FileMaker script "OptOut: Mailadressen sammeln - simple Tabelle" that collects data "Name | Angebotsmail | Trägermail". The FM script has the variable $$angeboteMailListe as result -> extract its value into `input.txt`.
### Processing
The Python scripts generates two JSON files from that. One holds the relation `{ trägermail1@test.de : [ "Angebot A", "Angebot B" ] }` and the other `{ angebotsmail@test.de : [ "Angebot A", "Angebot C" ] }`.
This input can be used to generate mails for the "opt-out method" (people can delete their offer from the MUT-ATLAS).
### Output
tbd

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,39 @@
import os, json
script_dir = os.path.dirname(os.path.abspath(__file__))
input_path = os.path.join(script_dir, 'input.txt')
dict_by_angebotsmail = {}
dict_by_traegermail = {}
with open(input_path, 'r', encoding='utf-8') as file:
for line in file:
parts = [part.strip() for part in line.strip().split('|')]
if len(parts) != 3:
continue
name, angebotsmail, traegermail = parts
if len(angebotsmail) > 5:
dict_by_angebotsmail.setdefault(angebotsmail, []).append(name)
if len(traegermail) > 5:
dict_by_traegermail.setdefault(traegermail, []).append(name)
print("Stichprobe Dict(angebotsmail) mit 'info@mfh-bochum.de':")
print(dict_by_angebotsmail["info@mfh-bochum.de"])
print("\nStichprobe Dict(traegermail) mit 'info@psh-bochum.de':")
print(dict_by_traegermail["info@psh-bochum.de"])
json_by_angebotsmail = os.path.join(script_dir, 'dict_by_angebotsmail.json')
json_by_traegermail = os.path.join(script_dir, 'dict_by_traegermail.json')
with open(json_by_angebotsmail, 'w', encoding='utf-8') as f:
json.dump(dict_by_angebotsmail, f, ensure_ascii=False, indent=2)
with open(json_by_traegermail, 'w', encoding='utf-8') as f:
json.dump(dict_by_traegermail, f, ensure_ascii=False, indent=2)
print("\nJSON-Dateien wurden gespeichert als:")
print(f"- {json_by_angebotsmail}")
print(f"- {json_by_traegermail}")