Example #1
0
        public async Task GenerateFeedbackDocument(string batchUri)
        {
            var batch = await _batchesContext.Batches
                        .FirstOrDefaultAsync(i => i.BatchUri == batchUri);

            batch.SubmissionFeedbackUri = batch.BatchUri.Replace(".json", "-feedback.json");

            await _batchesContext.SaveChangesAsync();

            _logger.LogInformation("Feedback document generated for {Id}", batch.Id);
        }
Example #2
0
        public async Task VetBatch(Guid batchId)
        {
            var batch = await _batchesContext.Batches
                        .FirstOrDefaultAsync(i => i.Id == batchId);

            batch.VettingReportUri = batch.BatchUri.Replace(".json", "-vetting-report.json");

            await _batchesContext.SaveChangesAsync();

            _logger.LogInformation("Batch vetting report generated: {Id}", batch.Id);
        }
        public async Task <Guid> ProcessBatch(BatchSubmitModel model)
        {
            var id = Guid.NewGuid();

            var batch = new Batch
            {
                Id           = id,
                BatchUri     = $"HealthcareClaimsV1/{id}.json",
                CreationDate = DateTime.UtcNow
            };

            _batchesContext.Batches.Add(batch);

            using (var stream = model.BatchJsonFile.OpenReadStream())
            {
                await _objectsStorageService.UploadObjectAsync(
                    "healthcare-claims-app-v1",
                    batch.BatchUri,
                    stream);
            }

            await _batchesContext.SaveChangesAsync();

            var batchJobData = new BatchJobData
            {
                BatchId = batch.Id
            };

            var submissionJobId = _backgroundJobClient
                                  .Enqueue <GenerateBatchSubmissionFeedbackDocumentJob>(
                job => job.Execute(batchJobData, null, JobCancellationToken.Null));

            _backgroundJobClient
            .ContinueJobWith <VetBatchJob>(
                submissionJobId,
                job => job.Execute(batchJobData, null, JobCancellationToken.Null));

            _logger.LogInformation("Batch submission initiated: {Id}", batch.Id);

            return(batch.Id);
        }