Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tokenaufbereiter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IMEBI
LimeSurvey
tokenaufbereiter
Commits
09e8a0e8
Commit
09e8a0e8
authored
1 month ago
by
richard beer
Browse files
Options
Downloads
Patches
Plain Diff
Anpassungen bzgl. des Downloads
parent
115c6976
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
main.r
+129
-32
129 additions, 32 deletions
main.r
with
129 additions
and
32 deletions
main.r
+
129
−
32
View file @
09e8a0e8
...
...
@@ -21,7 +21,7 @@ setwd("P:/IMEBI/DigiHero_Teilnehmerdaten/Massenmails/tokenaufbereiter")
cat
(
"####\n"
)
cat
(
"At the end, all generated files are stored in the following working directory:\n"
)
# nolint: line_length_linter.
cat
(
getwd
(),
"\n"
)
cat
(
getwd
(),
"/erstellte_Dateien"
,
"\n"
)
cat
(
"####\n"
)
# load packages and source files #
...
...
@@ -77,37 +77,47 @@ atr <- c(
#"invited",
#"reminded",
p_433442_00
<-
get_participants
(
iSurveyID
=
433442
,
iStart
=
1
,
iLimit
=
50000
,
bUnused
=
FALSE
,
aAttributes
=
atr
)
p_433442_01
<-
get_participants
(
iSurveyID
=
433442
,
iStart
=
50001
,
iLimit
=
100000
,
bUnused
=
FALSE
,
aAttributes
=
atr
)
cat
(
"####\n"
)
cat
(
"Der größte Wert aus der Umfrage 433442 zeigt: "
)
print
(
max
(
p_433442_01
$
tid
,
na.rm
=
TRUE
))
if
(
max
(
p_433442_01
$
tid
,
na.rm
=
TRUE
)
>=
99900
){
cat
(
"Die tid der Tabelle 433442 steht kurz vor 100.000 -> nochmal im Skript schauen, damit der Ablauf passt.\n"
)
cat
(
"Nachdem tid >= 100.001 wird die dritte Datei der Umfrage 433442 geladen und nicht mehr gelöscht.\n"
)
}
cat
(
"####\n"
)
cat
(
"\n"
)
#Umfrage zum Zeitpunkt der Erstellung des Skripts: 21.05.2024 noch leer
#Die Datei enhält eine Spalte mit name status : "No survey participants found."
p_433442_02
<-
get_participants
(
iSurveyID
=
433442
,
iStart
=
100001
,
iLimit
=
150000
,
bUnused
=
FALSE
,
aAttributes
=
FALSE
)
#daher: solange die Tabelle leer ist, wird sie gleich wieder gelöscht
if
(
"status"
%in%
colnames
(
p_433442_02
)){
rm
(
p_433442_02
)
}
else
if
(
max
(
p_433442_02
$
tid
,
na.rm
=
TRUE
)
>=
0
){
cat
(
"!!!!\n"
)
cat
(
"Das Skript lädt jetzt den 3.Teil der Umfrage: 433442\n"
)
cat
(
"Das aktuelle Tid beträgt:"
)
print
(
max
(
p_433442_02
$
tid
,
na.rm
=
TRUE
))
cat
(
"!!!!\n"
)
cat
(
"\n"
)
# URSPRÜNGLICH VERWENDET::
# p_433442_00<- get_participants(iSurveyID = 433442,iStart=1,iLimit = 50000, bUnused=FALSE, aAttributes=atr)
# p_433442_01<- get_participants(iSurveyID = 433442,iStart=50001,iLimit = 100000, bUnused=FALSE, aAttributes=atr)
# Das ist aber falsch, da hier zuviele Daten geladen werden. Das iLimit gibt nicht an, bis wohin geladen wird, sondern wieviele Daten gezogen werden.
# Schleife -> nicht geschrieben
# Fehlerhafte Werte werden in nachfolgenden Prüfung wieder heraus sortiert
p_433442_00
<-
get_participants
(
iSurveyID
=
433442
,
iStart
=
1
,
iLimit
=
25000
,
bUnused
=
FALSE
,
aAttributes
=
atr
)
p_433442_01
<-
get_participants
(
iSurveyID
=
433442
,
iStart
=
25001
,
iLimit
=
25000
,
bUnused
=
FALSE
,
aAttributes
=
atr
)
p_433442_02
<-
get_participants
(
iSurveyID
=
433442
,
iStart
=
50001
,
iLimit
=
25000
,
bUnused
=
FALSE
,
aAttributes
=
atr
)
p_433442_03
<-
get_participants
(
iSurveyID
=
433442
,
iStart
=
75001
,
iLimit
=
25000
,
bUnused
=
FALSE
,
aAttributes
=
atr
)
p_433442_04
<-
get_participants
(
iSurveyID
=
433442
,
iStart
=
100001
,
iLimit
=
25000
,
bUnused
=
FALSE
,
aAttributes
=
atr
)
p_433442_05
<-
get_participants
(
iSurveyID
=
433442
,
iStart
=
125001
,
iLimit
=
25000
,
bUnused
=
FALSE
,
aAttributes
=
atr
)
p_433442_06
<-
get_participants
(
iSurveyID
=
433442
,
iStart
=
150001
,
iLimit
=
25000
,
bUnused
=
FALSE
,
aAttributes
=
atr
)
p_433442_07
<-
get_participants
(
iSurveyID
=
433442
,
iStart
=
175001
,
iLimit
=
25000
,
bUnused
=
FALSE
,
aAttributes
=
atr
)
p_433442_08
<-
get_participants
(
iSurveyID
=
433442
,
iStart
=
200001
,
iLimit
=
25000
,
bUnused
=
FALSE
,
aAttributes
=
atr
)
p_433442_09
<-
get_participants
(
iSurveyID
=
433442
,
iStart
=
225001
,
iLimit
=
25000
,
bUnused
=
FALSE
,
aAttributes
=
atr
)
p_433442_10
<-
get_participants
(
iSurveyID
=
433442
,
iStart
=
250001
,
iLimit
=
25000
,
bUnused
=
FALSE
,
aAttributes
=
atr
)
p_433442_11
<-
get_participants
(
iSurveyID
=
433442
,
iStart
=
275001
,
iLimit
=
25000
,
bUnused
=
FALSE
,
aAttributes
=
atr
)
p_433442_12
<-
get_participants
(
iSurveyID
=
433442
,
iStart
=
300001
,
iLimit
=
25000
,
bUnused
=
FALSE
,
aAttributes
=
atr
)
p_433442_13
<-
get_participants
(
iSurveyID
=
433442
,
iStart
=
325001
,
iLimit
=
25000
,
bUnused
=
FALSE
,
aAttributes
=
atr
)
p_433442_14
<-
get_participants
(
iSurveyID
=
433442
,
iStart
=
375001
,
iLimit
=
25000
,
bUnused
=
FALSE
,
aAttributes
=
atr
)
p_433442_15
<-
get_participants
(
iSurveyID
=
433442
,
iStart
=
400001
,
iLimit
=
25000
,
bUnused
=
FALSE
,
aAttributes
=
atr
)
# Liste für die Prüfung und Löschung
alle_p_433442
<-
mget
(
ls
(
pattern
=
"^p_433442_"
))
for
(
element
in
names
(
alle_p_433442
))
{
# Spalte "status" -> dann ist die Liste leer -> löschen
if
(
"status"
%in%
colnames
(
alle_p_433442
[[
element
]]))
{
rm
(
list
=
element
,
envir
=
.GlobalEnv
)
}
}
#Zwischenliste wieder entfernen
rm
(
alle_p_433442
)
print
(
"p_433442_xx vollständig heruntergeladen"
)
p_144481_00
<-
get_participants
(
iSurveyID
=
144481
,
iStart
=
1
,
iLimit
=
50000
,
bUnused
=
FALSE
,
aAttributes
=
atr
)
print
(
"p_144481_00 heruntergeladen"
)
p_538473_00
<-
get_participants
(
iSurveyID
=
538473
,
iStart
=
1
,
iLimit
=
50000
,
bUnused
=
FALSE
,
aAttributes
=
atr
)
print
(
"p_538473_00 heruntergeladen"
)
#erste Idee für die Weiterarbeit ####
#binden und "tid" entfernen
#token144481 <- read.csv("tokens_144481.csv")
...
...
@@ -119,7 +129,7 @@ p_538473_00<- get_participants(iSurveyID = 538473,iStart=1,iLimit = 50000, bUnus
#alle "Test"-Zeilen entfernen
#TestTokens NUR über firstname identifizieren
#token<- token |> filter(!str_detect(tolower(firstname), 'test'))
cat
(
"\n"
)
cat
(
"####\n"
)
cat
(
"Der Download wurde abgeschlossen.\n"
)
cat
(
"Nun werden die heruntergeladen Tabellen verbunden.\n"
)
...
...
@@ -152,7 +162,7 @@ removed_test_values <- unique_df[!unique_df$firstname %in% values_to_delete, ]
#SAS und Anführungszeichen -> entfällt hier in R #
# Umlaute ersetzen #
# encode
clea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'
=
'z'
,
'Č'
=
'C'
,
'Ď'
=
'D'
,
'Ě'
=
'E'
,
'Ň'
=
'N'
,
'Ř'
=
'R'
,
'Š'
=
'S'
,
'Ť'
=
'T'
,
'Ů'
=
'U'
,
'Ž'
=
'Z'
,
'⁸'
=
''
,
'♀'
=
''
,
'‘'
=
''
,
'ã'
=
'a'
,
'ğ'
=
'g'
,
'É'
=
'E'
,
'Á'
=
'A'
,
'ş'
=
's'
,
'ū'
=
'u'
,
'ė'
=
'e'
,
'æ'
=
'ae'
,
'É'
=
'E'
,
'ş'
=
's'
,
'ı'
=
'l'
,
'ö'
=
'oe'
,
'!'
=
''
))))
# Die nicht geladenen Spalten neu einbinden und mit festen Werten speichern #
...
...
@@ -181,7 +278,7 @@ cleaned_df$remindercount <- "0"
cleaned_df
$
completed
<-
"N"
cleaned_df
$
usesleft
<-
"1"
#sort at the beginning of the dataframe
#
sort at the beginning of the dataframe
####
list_for_email_sort
<-
c
(
"Niki2007dc@gmx.com"
,
"Nadine.Glaser97@web.de"
,
"Jasmin.kroeber@gmx.de"
)
for
(
element
in
list_for_email_sort
){
specific_rows
<-
cleaned_df
[
cleaned_df
$
email
==
element
,
]
...
...
@@ -191,6 +288,6 @@ for (element in list_for_email_sort){
setwd
(
"P:/IMEBI/DigiHero_Teilnehmerdaten/Massenmails/tokenaufbereiter/erstellte_Dateien"
)
# after cleaning . start with the user query ####
function_start
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment