Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QPPA-8070: Implement new yaml parser #738

Merged
merged 2 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions clinical-clusters/2023/clinical-clusters-schema.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$id: https://github.com/CMSgov/qpp-measures-data/versions/0.0.1/clinical-clusters-schema.yaml
$schema: http://json-schema.org/schema#
type: array
items: { $ref: #/definitions/ClusterType }
items: { $ref: '#/definitions/ClusterType' }
definitions:
ClusterType:
type: object
Expand All @@ -19,10 +19,10 @@ definitions:
default: 'null'
clinicalClusters:
type: array
items: { $ref: #/definitions/ClinicalClusterType }
items: { $ref: '#/definitions/ClinicalClusterType' }
specialtySets:
type: array
items: { $ref: #/definitions/ClinicalClusterType }
items: { $ref: '#/definitions/ClinicalClusterType' }
ClinicalClusterType:
type: object
properties:
Expand Down
12 changes: 6 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Libraries
const fs = require('fs');
const path = require('path');
const YAML = require('yamljs');
const YAML = require('yaml');
const _ = require('lodash');

const yearRegEx = /^[0-9]{4}/;
Expand Down Expand Up @@ -99,7 +99,7 @@ exports.getBenchmarksYears = function() {
* @return {{}} - Object representation of the Benchmarks Schema
*/
exports.getBenchmarksSchema = function(performanceYear = Constants.currentPerformanceYear) {
return YAML.load(path.join(__dirname, 'benchmarks', performanceYear.toString(), 'benchmarks-schema.yaml'));
return YAML.parse(fs.readFileSync(path.join(__dirname, 'benchmarks', performanceYear.toString(), 'benchmarks-schema.yaml'), 'utf8'));
};

/**
Expand All @@ -122,7 +122,7 @@ exports.getMeasuresData = function(performanceYear = 2017) {
* @return {{}} - Object representation of the Measures Schema
*/
exports.getMeasuresSchema = function(performanceYear = 2017) {
return YAML.load(path.join(__dirname, 'measures', performanceYear.toString(), 'measures-schema.yaml'));
return YAML.parse(fs.readFileSync(path.join(__dirname, 'measures', performanceYear.toString(), 'measures-schema.yaml'), 'utf8'));
};

/**
Expand All @@ -142,8 +142,8 @@ exports.getClinicalClusterData = function(performanceYear = 2017) {
/**
* @return {{}} - Object representation of the Clinical Cluster Schema
*/
exports.getClinicalClusterSchema = function(performanceYear = 2017) {
return YAML.load(path.join(__dirname, 'clinical-clusters', performanceYear.toString(), 'clinical-clusters-schema.yaml'));
exports.getClinicalClusterSchema = function(performanceYear = 2023) {
return YAML.parse(fs.readFileSync(path.join(__dirname, 'clinical-clusters', performanceYear.toString(), 'clinical-clusters-schema.yaml'), 'utf8'));
};

/**
Expand Down Expand Up @@ -245,7 +245,7 @@ exports.populateMeasuresforMVPs = function(currentMvp, allMvps, measuresData, me
* @return {{}} - Object representation of the MVP Schema
*/
exports.getMVPSchema = function(performanceYear = 2023) {
return YAML.load(path.join(__dirname, 'mvp', performanceYear.toString(), 'mvp-schema.yaml'));
return YAML.parse(fs.readFileSync(path.join(__dirname, 'mvp', performanceYear.toString(), 'mvp-schema.yaml'), 'utf8'));
};

/**
Expand Down
54 changes: 27 additions & 27 deletions measures/2017/measures-schema.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$id: https://github.com/CMSgov/qpp-measures-data/blob/master/measures/2017/measures-schema.yaml
$schema: http://json-schema.org/schema#
type: array
items: { $ref: #/definitions/measure }
items: { $ref: '#/definitions/measure' }

definitions:
measure:
Expand All @@ -13,7 +13,7 @@ definitions:
title: { type: string }
description: { type: string }
category:
description: QPP scoring category to which the measure belongs: Improvement Activities, Quality, Advancing Care Information, and Cost.
description: 'QPP scoring category to which the measure belongs: Improvement Activities, Quality, Advancing Care Information, and Cost.'
enum: [ia, quality, aci, cost]
metricType:
description: Type of measurement that the measure requires in order to attest.
Expand All @@ -28,17 +28,17 @@ definitions:
default: 'null'
measureSpecification:
description: URL link for Measure Specification PDF to download by Submission Method.
items: { $ref: #/definitions/measureSpecification }
items: { $ref: '#/definitions/measureSpecification' }
measureSets:
description: ACI measures can belong to the transition measure set. Quality measures can belong to multiple measure sets that represent different specialties.
type: array
items: { $ref: #/definitions/measureSets }
items: { $ref: '#/definitions/measureSets' }
required: [measureId, title, description, category, metricType, firstPerformanceYear, lastPerformanceYear]
oneOf:
- { $ref: #/definitions/iaMeasure }
- { $ref: #/definitions/aciMeasure }
- { $ref: #/definitions/qualityMeasure }
- { $ref: #/definitions/aggregateCostMeasure }
- { $ref: '#/definitions/iaMeasure' }
- { $ref: '#/definitions/aciMeasure' }
- { $ref: '#/definitions/qualityMeasure' }
- { $ref: '#/definitions/aggregateCostMeasure' }

iaMeasure:
type: object
Expand All @@ -50,7 +50,7 @@ definitions:
default: medium
subcategoryId:
description: IA category which the measure incentivizes.
oneOf: [{ $ref: #/definitions/subcategoryIds }]
oneOf: [{ $ref: '#/definitions/subcategoryIds' }]
cehrtEligible:
description: If true, attesting to the measure will qualify the provider for an ACI CEHRT bonus.
type: boolean
Expand All @@ -69,7 +69,7 @@ definitions:
enum: [0, 5, 10, 20]
objective:
description: ACI category which the measure incentivizes.
oneOf: [{ $ref: #/definitions/objectives }]
oneOf: [{ $ref: '#/definitions/objectives' }]
isRequired:
description: If true, attesting to the measure is required in order to receive a non-zero ACI score.
type: boolean
Expand All @@ -80,7 +80,7 @@ definitions:
default: false
substitutes:
description: Identifiers of other ACI measure that can be used instead of the current meausre.
oneOf: [{ $ref: #/definitions/arrayOfStringIdentifiers}]
oneOf: [{ $ref: '#/definitions/arrayOfStringIdentifiers' }]
required: [weight, objective, isRequired, isBonus, measureSets]

aggregateCostMeasure:
Expand All @@ -105,7 +105,7 @@ definitions:
nationalQualityStrategyDomain: { type: ['null', string] }
measureType:
description: Quality category which the measure incentivizes.
oneOf: [{ $ref: #/definitions/measureTypes }]
oneOf: [{ $ref: '#/definitions/measureTypes' }]
eMeasureId:
description: Identifier for Electronic Clinical Quality Measures (ECQM).
type: ['null', string]
Expand All @@ -132,22 +132,22 @@ definitions:
strata:
description: Population segments for which the measure requires reporting data. Only applicable to multiPerformanceRate measures.
type: array
items: { $ref: #/definitions/performanceStrata }
items: { $ref: '#/definitions/performanceStrata' }
primarySteward:
description: Organization who submits and maintains the measure.
type: string
submissionMethods:
description: Possible methods for submitting performance data for the measure.
type: array
items: { $ref: #/definitions/methods }
items: { $ref: '#/definitions/methods' }
eligibilityOptions:
description: Eligibility options mirror denominator options in QCDR measure specifications. Each option comprises a set of codes used to identify eligible instances of the associated measure.
type: array
items: { $ref: #/definitions/eligibilityOption }
items: { $ref: '#/definitions/eligibilityOption' }
performanceOptions:
description: Performance options mirror numerator options in QCDR measure specifications. Each option comprises a set of codes used to identify instances of performance met, performance not met, performance exclusion or performance exception.
type: array
items: { $ref: #/definitions/performanceOption }
items: { $ref: '#/definitions/performanceOption' }
isRegistryMeasure:
description: If true, this measure was authored by a QCDR (Qualified Clinical Data Registry).
type: boolean
Expand Down Expand Up @@ -288,7 +288,7 @@ definitions:
eligibilityOption:
type: object
properties:
submissionMethods: { $ref: #/definitions/qualityCodesSubmissionMethods }
submissionMethods: { $ref: '#/definitions/qualityCodesSubmissionMethods' }
sexCode:
description: Gender identifier in the case of measures that apply to one gender only.
enum: [M, F]
Expand All @@ -298,16 +298,16 @@ definitions:
maxAge:
description: The maximum patient age required for eligibility.
type: number
diagnosisCodes: { $ref: #/definitions/arrayOfStringIdentifiers }
additionalDiagnosisCodes: { $ref: #/definitions/arrayOfStringIdentifiers }
diagnosisCodes: { $ref: '#/definitions/arrayOfStringIdentifiers' }
additionalDiagnosisCodes: { $ref: '#/definitions/arrayOfStringIdentifiers' }
procedureCodes:
description: A list of HCPCS or CPT codes, at least one of which must be present to meet the eligibility option.
type: array
items: { $ref: #/definitions/codeObject }
items: { $ref: '#/definitions/codeObject' }
additionalProcedureCodes:
description: A list of HCPCS or CPT codes, at least one of which must be present to meet the eligibility option. If present, this field imposes a requirement in addition to the one from the procedureCodes field.
type: array
items: { $ref: #/definitions/codeObject }
items: { $ref: '#/definitions/codeObject' }
required: [submissionMethods]
anyOf:
- required: ['procedureCodes']
Expand All @@ -316,14 +316,14 @@ definitions:
performanceOption:
type: object
properties:
submissionMethods: { $ref: #/definitions/qualityCodesSubmissionMethods }
submissionMethods: { $ref: '#/definitions/qualityCodesSubmissionMethods' }
optionType:
description: The specific performance option corresponding to the quality codes (performance met, performance not met, etc.).
enum: [performanceMet, performanceNotMet, eligiblePopulationExclusion, eligiblePopulationException]
qualityCodes:
description: A list of quality codes, all of which must be present to meet the performance option.
type: array
items: { $ref: #/definitions/codeObject }
items: { $ref: '#/definitions/codeObject' }
required: [submissionMethods, optionType, qualityCodes]

codeObject:
Expand All @@ -332,10 +332,10 @@ definitions:
code:
description: The HCPCS or CPT code represented as a string.
type: string
modifiers: { $ref: #/definitions/arrayOfStringIdentifiers }
modifierExclusions: { $ref: #/definitions/arrayOfStringIdentifiers }
placesOfService: { $ref: #/definitions/arrayOfStringIdentifiers }
placesOfServiceExclusions: { $ref: #/definitions/arrayOfStringIdentifiers }
modifiers: { $ref: '#/definitions/arrayOfStringIdentifiers' }
modifierExclusions: { $ref: '#/definitions/arrayOfStringIdentifiers' }
placesOfService: { $ref: '#/definitions/arrayOfStringIdentifiers' }
placesOfServiceExclusions: { $ref: '#/definitions/arrayOfStringIdentifiers' }
required: [code]

qualityCodesSubmissionMethods:
Expand Down
Loading