Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scheduling-system
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SMASCH
scheduling-system
Commits
36e19aca
Commit
36e19aca
authored
4 years ago
by
Carlos Vega
Browse files
Options
Downloads
Patches
Plain Diff
create list of changes and then make them with a provenance for each change
parent
b653cfea
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!249
More provenance #328
Pipeline
#25522
passed
4 years ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
smash/web/redcap_connector.py
+25
-24
25 additions, 24 deletions
smash/web/redcap_connector.py
with
25 additions
and
24 deletions
smash/web/redcap_connector.py
+
25
−
24
View file @
36e19aca
...
...
@@ -218,40 +218,41 @@ class RedcapConnector(object):
smasch_appointment
.
visit
.
is_finished
=
True
smasch_appointment
.
visit
.
save
()
if
visit
.
virus
is
not
None
or
visit
.
virus_inconclusive
:
changes
=
None
if
visit
.
visit_number
==
1
and
subject
.
virus_test_1
!=
visit
.
virus
:
subject
.
virus_test_1
=
visit
.
virus
subject
.
virus_test_1_updated
=
datetime
.
datetime
.
now
()
subject
.
save
()
changes
=
[(
'
virus_test_1
'
,
visit
.
virus
),
(
'
virus_test_1_updated
'
,
datetime
.
datetime
.
now
())]
if
visit
.
visit_number
==
2
and
subject
.
virus_test_2
!=
visit
.
virus
:
subject
.
virus_test_2
=
visit
.
virus
subject
.
virus_test_2_updated
=
datetime
.
datetime
.
now
()
subject
.
save
()
changes
=
[(
'
virus_test_2
'
,
visit
.
virus
),
(
'
virus_test_2_updated
'
,
datetime
.
datetime
.
now
())]
if
visit
.
visit_number
==
3
and
subject
.
virus_test_3
!=
visit
.
virus
:
subject
.
virus_test_3
=
visit
.
virus
subject
.
virus_test_3_updated
=
datetime
.
datetime
.
now
()
subject
.
save
()
changes
=
[(
'
virus_test_3
'
,
visit
.
virus
),
(
'
virus_test_3_updated
'
,
datetime
.
datetime
.
now
())]
if
visit
.
visit_number
==
4
and
subject
.
virus_test_4
!=
visit
.
virus
:
subject
.
virus_test_4
=
visit
.
virus
subject
.
virus_test_4_updated
=
datetime
.
datetime
.
now
()
subject
.
save
()
changes
=
[(
'
virus_test_4
'
,
visit
.
virus
),
(
'
virus_test_4_updated
'
,
datetime
.
datetime
.
now
())]
if
visit
.
visit_number
==
5
and
subject
.
virus_test_5
!=
visit
.
virus
:
subject
.
virus_test_5
=
visit
.
virus
subject
.
virus_test_5_updated
=
datetime
.
datetime
.
now
()
subject
.
save
()
changes
=
[(
'
virus_test_5
'
,
visit
.
virus
),
(
'
virus_test_5_updated
'
,
datetime
.
datetime
.
now
())]
if
visit
.
visit_number
==
1
and
subject
.
virus_test_1_updated
is
None
and
visit
.
virus_inconclusive
:
subject
.
virus_test_1_updated
=
datetime
.
datetime
.
now
()
subject
.
save
()
changes
=
[(
'
virus_test_1_updated
'
,
datetime
.
datetime
.
now
())]
if
visit
.
visit_number
==
2
and
subject
.
virus_test_2_updated
is
None
and
visit
.
virus_inconclusive
:
subject
.
virus_test_2_updated
=
datetime
.
datetime
.
now
()
subject
.
save
()
changes
=
[(
'
virus_test_2_updated
'
,
datetime
.
datetime
.
now
())]
if
visit
.
visit_number
==
3
and
subject
.
virus_test_3_updated
is
None
and
visit
.
virus_inconclusive
:
subject
.
virus_test_3_updated
=
datetime
.
datetime
.
now
()
subject
.
save
()
changes
=
[(
'
virus_test_3_updated
'
,
datetime
.
datetime
.
now
())]
if
visit
.
visit_number
==
4
and
subject
.
virus_test_4_updated
is
None
and
visit
.
virus_inconclusive
:
subject
.
virus_test_4_updated
=
datetime
.
datetime
.
now
()
subject
.
save
()
changes
=
[(
'
virus_test_4_updated
'
,
datetime
.
datetime
.
now
())]
if
visit
.
visit_number
==
5
and
subject
.
virus_test_5_updated
is
None
and
visit
.
virus_inconclusive
:
subject
.
virus_test_5_updated
=
datetime
.
datetime
.
now
()
changes
=
[(
'
virus_test_5_updated
'
,
datetime
.
datetime
.
now
())]
#
if
changes
is
not
None
:
for
field
,
new_value
in
changes
:
old_value
=
getattr
(
subject
,
field
)
description
=
u
'
{} changed from
"
{}
"
to
"
{}
"'
.
format
(
field
,
old_value
,
new_value
)
p
=
Provenance
(
modified_table
=
StudySubject
.
_meta
.
db_table
,
modified_table_id
=
subject
.
id
,
modification_author
=
self
.
importer_user
,
previous_value
=
old_value
,
new_value
=
new_value
,
modification_description
=
description
,
modified_field
=
field
)
setattr
(
subject
,
field
,
new_value
)
p
.
save
()
subject
.
save
()
return
result
...
...
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