@@ -70,7 +70,7 @@ func (p *Processor) Process(ctx context.Context, wrk *work.Work, processingUpdat
7070 p .absorbPending ,
7171 p .updateSummaries ,
7272 p .updateClinicSummaries ,
73- p .triggerElectronicHealthRecordSync ,
73+ p .triggerEHRSync ,
7474 ).Process (p .Delete )
7575}
7676
@@ -167,7 +167,9 @@ func (p *Processor) updateSummaries() *work.ProcessResult {
167167 p .summariesUpdate , err = p .UpdateSummaries (p .Context (), * p .User ().UserID )
168168
169169 // The changes made are recorded in the metadata before they are synced to the clinic service,
170- // so that a failure between the two retries the update
170+ // so that a failure between the two retries the update. They are recorded even when the
171+ // calculation fails partway (a partial update is returned alongside the error), riding along
172+ // on the failing update so the retry still reports them
171173 changed := p .Metadata ().recordSummariesUpdate (p .summariesUpdate )
172174 if err != nil {
173175 return p .Failing (err )
@@ -197,11 +199,6 @@ func (p *Processor) updateClinicSummaries() *work.ProcessResult {
197199 return p .Failing (errors .Wrap (err , "unable to delete patient summary" ))
198200 }
199201 }
200- if len (workMetadata .PendingSummaryDeletes ) > 0 {
201- log .LoggerFromContext (p .Context ()).WithFields (log.Fields {
202- "deleted" : workMetadata .PendingSummaryDeletes ,
203- }).Debug ("deleted clinic service summaries" )
204- }
205202
206203 var cgm * summaryTypes.CGMSummary
207204 var bgm * summaryTypes.BGMSummary
@@ -215,9 +212,6 @@ func (p *Processor) updateClinicSummaries() *work.ProcessResult {
215212 if err := p .ClinicsClient .UpdatePatientSummary (p .Context (), * p .User ().UserID , clinics .NewPatientSummary (cgm , bgm )); err != nil {
216213 return p .Failing (errors .Wrap (err , "unable to update patient summary" ))
217214 }
218- log .LoggerFromContext (p .Context ()).WithFields (log.Fields {
219- "updated" : workMetadata .PendingSummaryUpdates ,
220- }).Debug ("updated clinic service summaries" )
221215 }
222216
223217 log .LoggerFromContext (p .Context ()).WithFields (log.Fields {
@@ -228,9 +222,8 @@ func (p *Processor) updateClinicSummaries() *work.ProcessResult {
228222 return nil
229223}
230224
231- // triggerElectronicHealthRecordSync reports the data of the user to any electronic health record it
232- // is shared with. Repeating the request reports the same data again, not twice, so retries are safe.
233- func (p * Processor ) triggerElectronicHealthRecordSync () * work.ProcessResult {
225+ // triggerEHRSync triggers report and flowsheet upload for patients with active subscriptions
226+ func (p * Processor ) triggerEHRSync () * work.ProcessResult {
234227 if ! TriggersEHRSync (p .Metadata ().Reasons ) {
235228 return nil
236229 }
@@ -239,8 +232,6 @@ func (p *Processor) triggerElectronicHealthRecordSync() *work.ProcessResult {
239232 return p .Failing (errors .Wrap (err , "unable to trigger EHR sync" ))
240233 }
241234
242- log .LoggerFromContext (p .Context ()).Info ("triggerred EHR sync" )
243-
244235 return nil
245236}
246237
0 commit comments