Skip to content

Commit

Permalink
count processed resources
Browse files Browse the repository at this point in the history
  • Loading branch information
ashaban committed Oct 13, 2020
1 parent 704155d commit 8bd2931
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fhir2es",
"version": "1.2.9",
"version": "1.3.0",
"description": "Reads and caches fhir data to elasticsearch",
"main": "reports.js",
"scripts": {
Expand Down
7 changes: 4 additions & 3 deletions reports.js
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,7 @@ class CacheFhirToES {
this.getImmediateLinks(orderedResources, links, () => {
async.eachSeries(orderedResources, (orderedResource, nxtResourceType) => {
let processedRecords = []
this.count = 1;
let url = URI(this.FHIRBaseURL)
.segment(orderedResource.resource)
.segment('_history')
Expand All @@ -858,6 +859,7 @@ class CacheFhirToES {
password: this.FHIRPassword,
},
}).then(response => {
this.totalResources = response.data.total;
url = false;
const next = response.data.link.find(
link => link.relation === 'next'
Expand Down Expand Up @@ -902,10 +904,9 @@ class CacheFhirToES {
}

processResource(resourceData, orderedResource, reportDetails, processedRecords, callback) {
let count = 1
async.each(resourceData, (data, nxtResource) => {
logger.info('processing ' + count + '/' + resourceData.length + ' records of resource ' + orderedResource.resource);
count++
logger.info('processing ' + this.count + '/' + this.totalResources + ' records of resource ' + orderedResource.resource);
this.count++
if (!data.resource || !data.resource.resourceType) {
return nxtResource()
}
Expand Down

0 comments on commit 8bd2931

Please sign in to comment.