-
-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add form load time to xforms and es forms mapping #34824
Open
Charl1996
wants to merge
8
commits into
master
Choose a base branch
from
add-form-load-time-to-es-v2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4dc9ea4
Prefactor: fix linting issues
Charl1996 2c745c3
Add formLoadTime to app meta
Charl1996 e6cf73b
Add formLoadTime to XFormInstance model and XFormPhoneMetadata
Charl1996 077ea13
Add formLoadTime to form meta
Charl1996 407f3f9
./manage.py make_elastic_migration --update-index forms:form
Charl1996 872eeb6
Fix tests
Charl1996 f1d9091
Only specify path tor new property in migration
Charl1996 7c3fe07
Merge pull request #34835 from dimagi/target-specific-field-in-migration
Charl1996 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -140,6 +140,9 @@ | |
}, | ||
"username": { | ||
"type": "keyword" | ||
}, | ||
"formLoadTime": { | ||
"type": "keyword" | ||
} | ||
} | ||
} | ||
|
18 changes: 18 additions & 0 deletions
18
corehq/form_processor/migrations/0097_xforminstance_form_load_time.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 4.2.11 on 2024-06-25 10:17 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('form_processor', '0096_add_partial_index_cases'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='xforminstance', | ||
name='form_load_time', | ||
field=models.CharField(blank=True, max_length=8, null=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AmitPhulera
Just confirming that this is the right type for this?
This value is going to be in miliseconds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AmitPhulera suggested that we think about storing this as a date field. I'm quickly finding out what the
timeStart
refers to. If it refers to the timestamp a user clicked to open a form, we could store theformLoadTime
as a date and not a difference. The benefit of doing this is that we could later do all sorts of date queries on this field if we wanted to.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Charl1996
Whats the challenge with how it is currently?
I don't believe we can do this. I believe we need the time it took to load the form. I don't think we can get that using timeStart and any other timestamp.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is that we are storing epoch time in
formLoadTime
, Is that correct. If so that is a essentially a date field so it should be treated as date in the mappings unless there is a strong reason to keep it as a keyword.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AmitPhulera
The value stored in this field is something like "230" or "190", which denotes the duration in milliseconds it took to load the form. It's not epoch time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh! I see. Feel free to discard my suggestion about storing it as date.
Another question, why are we not storing it as
integer
then?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmm, I suppose
integer
would be better, yes.