js/documentation.js
//map the availability of data elements and/or indicators
map the availability of data elements and/or indicators
map the availability of data elements and / or indicators
function makeAvailabilityChecklist(basePath, metaData) {
	var deferred = Q.defer();
	var content = utils.htmlHead("Availability mapping");
	content += utils.htmlHeader("Availability mapping", 1);
	if (metaData.dataSets && metaData.dataElements && metaData.dataElements.length > 0) {
		content += utils.htmlHeader("Data elements", 2);
		for (var ds of metaData.dataSets) {
			content += utils.htmlHeader(ds.name, 3);
			content += dataElementAvailabilityTable(dataElements(ds, metaData), metaData);
		}
		var unGrouped = standaloneDataElements(metaData);
		if (unGrouped.length > 0) {
			content += utils.htmlHeader("Other", 3);
			content += dataElementAvailabilityTable(unGrouped, metaData);
		}
	}
	if (metaData.indicators && metaData.indicators.length > 0) {
		content += utils.htmlHeader("Indicators", 2);
		content += indicatorAvailabilityTable(metaData);
	}
	content += utils.htmlTail();
	content = pretty(content);
	fs.writeFile(basePath + "/availability.html", content, function (err) {
		if (err) {
			console.log(err);
			deferred.resolve(false);
		}
		console.log("✔ Availability checklist saved");
		deferred.resolve(true);
	});
	return deferred.promise;
}
function makeAvailabilityChecklist ( basePath , metaData ) { var deferred = Q . defer ( ) ; var content = utils . htmlHead ( "Availability mapping" ) ; content += utils . htmlHeader ( "Availability mapping" , 1 ) ; if ( metaData . dataSets && metaData . dataElements && metaData . dataElements . length > 0 ) { content += utils . htmlHeader ( "Data elements" , 2 ) ; for ( var ds of metaData . dataSets ) { content += utils . htmlHeader ( ds . name , 3 ) ; content += dataElementAvailabilityTable ( dataElements ( ds , metaData ) , metaData ) ; } var unGrouped = standaloneDataElements ( metaData ) ; if ( unGrouped . length > 0 ) { content += utils . htmlHeader ( "Other" , 3 ) ; content += dataElementAvailabilityTable ( unGrouped , metaData ) ; } } if ( metaData . indicators && metaData . indicators . length > 0 ) { content += utils . htmlHeader ( "Indicators" , 2 ) ; content += indicatorAvailabilityTable ( metaData ) ; } content += utils . htmlTail ( ) ; content = pretty ( content ) ; fs . writeFile ( basePath + "/availability.html" , content , function ( err ) { if ( err ) { console . log ( err ) ; deferred . resolve ( false ) ; } console . log ( "✔ Availability checklist saved"); deferred . resolve ( true ) ; } ) ; return deferred . promise ; }
map the availability of data elements and/or indicators
map the availability of data elements and / or indicators
//data elements //indicators