[BACK-4518][BACK-4185] Add patient list export functionality and route. - #243
[BACK-4518][BACK-4185] Add patient list export functionality and route.#243lostlevels wants to merge 10 commits into
Conversation
Commit for the patient list export functionality. Defines new type, ExportedPatient, since fields are unique to this view of the patient. Adds appropriate mapping and logic over existing fields.
|
Ignore @darinkrauss, clicked the wrong button, meant to request @ewollesen . |
| if ds == nil || ds.State == "" { | ||
| return "NA" | ||
| } | ||
| inactiveCutoff := now.Add(-time.Hour * 24 * 2) |
There was a problem hiding this comment.
This one has a const defined in upcoming DID work, so... hopefully I'll remember to refactor this when I rebase onto this work.
| } | ||
| var tagNames []string | ||
| for _, tagId := range *tagIds { | ||
| if name, ok := tagNamesById[tagId]; ok { |
There was a problem hiding this comment.
Hmm, this will silently ignore any tags found for which we don't know the name... Is that desired? Maybe better to use "" or something..? We probably don't want to error out, but just ignoring that we couldn't find a name for the tag seems wrong too.
There was a problem hiding this comment.
Plus, any tag not found will result in an empty result in the output, like "Foo," or "Foo,,Bar".
@ewollesen Forgot to commit a new file. Tested manually. |
| "Exported By", // name | ||
| "Exported By", // email |
There was a problem hiding this comment.
Is there a good reason not to name these Exported By (Name) and Exported By (Email) just for clarity? Isn't that what's in PROD-4185?
| ) | ||
|
|
||
| const ( | ||
| timeFormat = "2006-01-02 03:04 PM" |
There was a problem hiding this comment.
I'd suggest adding the time zone here, so it's clearer.
ewollesen
left a comment
There was a problem hiding this comment.
The expiration time calculation is I believe a bug, so should be fixed.
| } | ||
| var tagNames []string | ||
| for _, tagId := range *tagIds { | ||
| if name, ok := tagNamesById[tagId]; ok { |
There was a problem hiding this comment.
Plus, any tag not found will result in an empty result in the output, like "Foo," or "Foo,,Bar".
| expiredCutoff := now.Add(-time.Duration(math.Abs(float64(patients.PendingDataSourceExpirationDuration)))) | ||
| if (ds.State == patients.DataSourceStatePending || ds.State == patients.DataSourceStatePendingReconnect) && ds.ExpirationTime != nil && ds.ExpirationTime.Before(expiredCutoff) { |
There was a problem hiding this comment.
ds.ExpirationTime is the expiration time of the invite. So you should be comparing ds.ExpirationTime.Before(now) to see if its expired, not now - 30 days.
There was a problem hiding this comment.
Plus, any tag not found will result in an empty result in the output, like "Foo," or "Foo,,Bar".
I think we discussed this earlier and agreed having no output to indicate the presence of a tag, even if nameless, was preferable to omitting the tag altogether.
Commit for the patient list export functionality. Defines new type, ExportedPatient, since fields are unique to this view of the patient. Adds appropriate mapping and logic over existing fields.