Skip to content

Commit

Permalink
BFD-3449: Replace system for clm_ip_admsn_type_cd (#2359)
Browse files Browse the repository at this point in the history
  • Loading branch information
dondevun authored Jul 9, 2024
1 parent cd82e3c commit 0d0dea9
Show file tree
Hide file tree
Showing 21 changed files with 132 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"element": "information[N].code.coding[N].code",
"fhirPath": "",
"discriminator": [
"information[N].code.coding[N].system = 'https://bluebutton.cms.gov/resources/variables/clm_ip_admsn_type_cd'"
"information[N].code.coding[N].system = 'https://www.nubc.org/CodeSystem/PriorityTypeOfAdmitOrVisit'"
],
"additional": [
"eob.information[N].code.coding[N].display = {corresponding description from valueset specified in .system}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@
"version": "R4",
"resource": "ExplanationOfBenefit",
"element": "supportingInfo[N].code.coding[N].code",
"fhirPath": "supportingInfo.where(code.coding.where(system='https://bluebutton.cms.gov/resources/variables/clm_ip_admsn_type_cd')).code.coding.code",
"fhirPath": "supportingInfo.where(code.coding.where(system='https://www.nubc.org/CodeSystem/PriorityTypeOfAdmitOrVisit')).code.coding.code",
"discriminator": [
"supportingInfo[N].code.coding[N].system = 'https://bluebutton.cms.gov/resources/variables/clm_ip_admsn_type_cd'"
"supportingInfo[N].code.coding[N].system = 'https://www.nubc.org/CodeSystem/PriorityTypeOfAdmitOrVisit'"
],
"additional": [
"eob.supportingInfo[N].code.coding[N].display = {corresponding description from valueset specified in .system}",
"eob.supportingInfo[N].category.coding[N].system = 'http://terminology.hl7.org/CodeSystem/claiminformationcategory'",
"eob.supportingInfo[N].category.coding[N].code = 'info'",
"eob.supportingInfo[N].category.coding[N].system = 'http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBSupportingInfoType'",
"eob.supportingInfo[N].category.coding[N].code = 'admtype'",
"eob.supportingInfo[N].category.coding[N].display = 'Information')",
"eob.supportingInfo[N].category.coding[N].system = https://bluebutton.cms.gov/resources/codesystem/information'",
"eob.supportingInfo[N].category.coding[N].code = 'https://bluebutton.cms.gov/resources/variables/clm_ip_admsn_type_cd'",
"eob.supportingInfo[N].category.coding[N].display = 'Claim Inpatient Admission Type Code')"
],
"derived": "",
"note": "",
"example": "[\\n {\\n \"sequence\": 3,\\n \"category\": {\\n \"coding\": [\\n {\\n \"system\": \"http://terminology.hl7.org/CodeSystem/claiminformationcategory\",\\n \"code\": \"info\",\\n \"display\": \"Information\"\\n },\\n {\\n \"system\": \"https://bluebutton.cms.gov/resources/codesystem/information\",\\n \"code\": \"https://bluebutton.cms.gov/resources/variables/clm_ip_admsn_type_cd\",\\n \"display\": \"Claim Inpatient Admission Type Code\"\\n }\\n ]\\n },\\n \"code\": {\\n \"coding\": [\\n {\\n \"system\": \"https://bluebutton.cms.gov/resources/variables/clm_ip_admsn_type_cd\",\\n \"code\": \"1\",\\n \"display\": \"Emergency - The patient required immediate medical intervention as a result of severe, life threatening, or potentially disabling conditions. Generally, the patient was admitted through the emergency room.\"\\n }\\n ]\\n }\\n }\\n]"
"example": "[\\n {\\n \"sequence\": 3,\\n \"category\": {\\n \"coding\": [\\n {\\n \"system\": \"http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBSupportingInfoType\",\\n \"code\": \"admtype\",\\n \"display\": \"Information\"\\n },\\n {\\n \"system\": \"https://bluebutton.cms.gov/resources/codesystem/information\",\\n \"code\": \"https://bluebutton.cms.gov/resources/variables/clm_ip_admsn_type_cd\",\\n \"display\": \"Claim Inpatient Admission Type Code\"\\n }\\n ]\\n },\\n \"code\": {\\n \"coding\": [\\n {\\n \"system\": \"https://www.nubc.org/CodeSystem/PriorityTypeOfAdmitOrVisit\",\\n \"code\": \"1\",\\n \"display\": \"Emergency - The patient required immediate medical intervention as a result of severe, life threatening, or potentially disabling conditions. Generally, the patient was admitted through the emergency room.\"\\n }\\n ]\\n }\\n }\\n]"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,26 @@ public class CCWUtils {
* published
*/
public static String calculateVariableReferenceUrl(CcwCodebookInterface ccwVariable) {
return String.format(
"%s/%s",
TransformerConstants.BASE_URL_CCW_VARIABLES,
ccwVariable.getVariable().getId().toLowerCase());
return calculateVariableReferenceUrl(ccwVariable, false);
}

/**
* Calculates the variable reference url.
*
* @param ccwVariable the {@link CcwCodebookInterface} being mapped
* @param skipReplaceCcwSystem if set, {@link TransformerConstants#CCW_SYSTEM_MAP} will not be
* checked.
* @return the public URL at which documentation for the specified {@link CcwCodebookInterface} is
* published
*/
public static String calculateVariableReferenceUrl(
CcwCodebookInterface ccwVariable, boolean skipReplaceCcwSystem) {
String ccwVarId = ccwVariable.getVariable().getId().toLowerCase();
// If the ccw variable exists in the CCW_SYSTEM_MAP map, then we can return the value of this
// mapping as the system. Otherwise, it will be constructed.
if (!skipReplaceCcwSystem && TransformerConstants.CCW_SYSTEM_MAP.containsKey(ccwVarId)) {
return TransformerConstants.CCW_SYSTEM_MAP.get(ccwVarId);
}
return String.format("%s/%s", TransformerConstants.BASE_URL_CCW_VARIABLES, ccwVarId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import gov.cms.bfd.model.rif.entities.CarrierClaimColumn;
import gov.cms.bfd.server.war.stu3.providers.PatientResourceProvider;
import java.time.Instant;
import java.util.HashMap;
import java.util.Map;
import org.hl7.fhir.dstu3.model.Coding;
import org.hl7.fhir.dstu3.model.Coverage;
import org.hl7.fhir.dstu3.model.Coverage.GroupComponent;
Expand Down Expand Up @@ -93,6 +95,50 @@ public final class TransformerConstants {
*/
public static final String BASE_URL_CCW_VARIABLES = BASE_URL_BBAPI_RESOURCES + "/variables";

/** Base URL for nubc. */
public static final String BASE_URL_NUBC = "https://www.nubc.org";

/** System for NUBC admsn. */
public static final String NUBC_ADMIT_CODE_SYSTEM =
BASE_URL_NUBC + "/CodeSystem/PriorityTypeOfAdmitOrVisit";

/**
* Maps a ccw variable to a specific URL. If the variable exists as a key in this map, then the
* value will be used as the system; otherwise, it will be constructed using the above constants.
*/
public static final Map<String, String> CCW_SYSTEM_MAP =
new HashMap<>() {
{
put("clm_ip_admsn_type_cd", NUBC_ADMIT_CODE_SYSTEM);
}
};

/** Constant for Carin BB base url. */
public static final String BASE_URL_CARIN_BB = "http://hl7.org/fhir/us/carin-bb";

/** Constant for Carin BB Information Category. */
public static final String CODING_CARIN_BB_INFORMATION_CATEGORY =
BASE_URL_CARIN_BB + "/CodeSystem/C4BBSupportingInfoType";

/** Constant for Carin BB admntype code. */
public static final String CARIN_BB_ADMN_TYPE = "admtype";

/** Maps a CCW variable for a category to a new system. */
public static final Map<String, String> CARIN_CATEGORY_SYSTEM_MAP =
new HashMap<>() {
{
put("clm_ip_admsn_type_cd", CODING_CARIN_BB_INFORMATION_CATEGORY);
}
};

/** Maps a CCW variable for a category to a new code. */
public static final Map<String, String> CARIN_CATEGORY_CODE_MAP =
new HashMap<>() {
{
put("clm_ip_admsn_type_cd", CARIN_BB_ADMN_TYPE);
}
};

/** The constant for the USD code. */
public static final String CODED_MONEY_USD = "USD";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -837,12 +837,17 @@ static CodeableConcept createCodeableConcept(
*/
private static CodeableConcept createCodeableConceptForFieldId(
IAnyResource rootResource, String codingSystem, CcwCodebookInterface ccwVariable) {
String code = CCWUtils.calculateVariableReferenceUrl(ccwVariable);
String code = CCWUtils.calculateVariableReferenceUrl(ccwVariable, true);

Coding carinCoding =
new Coding()
.setCode("info")
.setSystem(TransformerConstants.CARIN_SUPPORTING_INFO_TYPE)
.setCode(
TransformerConstants.CARIN_CATEGORY_CODE_MAP.getOrDefault(
ccwVariable.getVariable().getId().toLowerCase(), "info"))
.setSystem(
TransformerConstants.CARIN_CATEGORY_SYSTEM_MAP.getOrDefault(
ccwVariable.getVariable().getId().toLowerCase(),
TransformerConstants.CARIN_SUPPORTING_INFO_TYPE))
.setDisplay("Information");
Coding cmsBBcoding = new Coding(codingSystem, code, ccwVariable.getVariable().getLabel());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,17 @@ protected static CodeableConcept createCodeableConcept(C4BBIdentifierType idType
*/
protected static CodeableConcept createCodeableConceptForCategory(
String codingSystem, CcwCodebookInterface ccwVariable) {
String code = CCWUtils.calculateVariableReferenceUrl(ccwVariable);
String code = CCWUtils.calculateVariableReferenceUrl(ccwVariable, true);

Coding carinCoding =
new Coding()
.setCode("info")
.setSystem(TransformerConstants.CARIN_SUPPORTING_INFO_TYPE)
.setCode(
TransformerConstants.CARIN_CATEGORY_CODE_MAP.getOrDefault(
ccwVariable.getVariable().getId().toLowerCase(), "info"))
.setSystem(
TransformerConstants.CARIN_CATEGORY_SYSTEM_MAP.getOrDefault(
ccwVariable.getVariable().getId().toLowerCase(),
TransformerConstants.CARIN_SUPPORTING_INFO_TYPE))
.setDisplay("Information");
Coding cmsBBcoding = new Coding(codingSystem, code, ccwVariable.getVariable().getLabel());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ static CodeableConcept createCodeableConcept(
*/
private static CodeableConcept createCodeableConceptForFieldId(
IAnyResource rootResource, String codingSystem, CcwCodebookInterface ccwVariable) {
String code = CCWUtils.calculateVariableReferenceUrl(ccwVariable);
String code = CCWUtils.calculateVariableReferenceUrl(ccwVariable, true);
Coding coding = new Coding(codingSystem, code, ccwVariable.getVariable().getLabel());

return new CodeableConcept().addCoding(coding);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,16 +384,16 @@ public void shouldHaveClmIpAdmsnTypeCdSupInfo() {
// Category
Arrays.asList(
new Coding(
"http://terminology.hl7.org/CodeSystem/claiminformationcategory",
"info",
"http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBSupportingInfoType",
"admtype",
"Information"),
new Coding(
"https://bluebutton.cms.gov/resources/codesystem/information",
"https://bluebutton.cms.gov/resources/variables/clm_ip_admsn_type_cd",
"Claim Inpatient Admission Type Code")),
// Code
new Coding(
"https://bluebutton.cms.gov/resources/variables/clm_ip_admsn_type_cd",
"https://www.nubc.org/CodeSystem/PriorityTypeOfAdmitOrVisit",
"1",
"Emergency - The patient required immediate medical intervention as a result of"
+ " severe, life threatening, or potentially disabling conditions. Generally,"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,16 +358,16 @@ public void shouldHaveClmIpAdmsnTypeCdSupInfo() {
// Category
Arrays.asList(
new Coding(
"http://terminology.hl7.org/CodeSystem/claiminformationcategory",
"info",
"http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBSupportingInfoType",
"admtype",
"Information"),
new Coding(
"https://bluebutton.cms.gov/resources/codesystem/information",
"https://bluebutton.cms.gov/resources/variables/clm_ip_admsn_type_cd",
"Claim Inpatient Admission Type Code")),
// Code
new Coding(
"https://bluebutton.cms.gov/resources/variables/clm_ip_admsn_type_cd",
"https://www.nubc.org/CodeSystem/PriorityTypeOfAdmitOrVisit",
"3",
"Elective - The patient's condition permitted adequate time to schedule the availability of suitable accommodations."));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1884,7 +1884,7 @@
},
"code" : {
"coding" : [ {
"system" : "https://bluebutton.cms.gov/resources/variables/clm_ip_admsn_type_cd",
"system" : "https://www.nubc.org/CodeSystem/PriorityTypeOfAdmitOrVisit",
"code" : "1",
"display" : "Emergency - The patient required immediate medical intervention as a result of severe, life threatening, or potentially disabling conditions. Generally, the patient was admitted through the emergency room."
} ]
Expand Down Expand Up @@ -2645,7 +2645,7 @@
},
"code" : {
"coding" : [ {
"system" : "https://bluebutton.cms.gov/resources/variables/clm_ip_admsn_type_cd",
"system" : "https://www.nubc.org/CodeSystem/PriorityTypeOfAdmitOrVisit",
"code" : "3",
"display" : "Elective - The patient's condition permitted adequate time to schedule the availability of suitable accommodations."
} ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1890,7 +1890,7 @@
},
"code" : {
"coding" : [ {
"system" : "https://bluebutton.cms.gov/resources/variables/clm_ip_admsn_type_cd",
"system" : "https://www.nubc.org/CodeSystem/PriorityTypeOfAdmitOrVisit",
"code" : "1",
"display" : "Emergency - The patient required immediate medical intervention as a result of severe, life threatening, or potentially disabling conditions. Generally, the patient was admitted through the emergency room."
} ]
Expand Down Expand Up @@ -2651,7 +2651,7 @@
},
"code" : {
"coding" : [ {
"system" : "https://bluebutton.cms.gov/resources/variables/clm_ip_admsn_type_cd",
"system" : "https://www.nubc.org/CodeSystem/PriorityTypeOfAdmitOrVisit",
"code" : "3",
"display" : "Elective - The patient's condition permitted adequate time to schedule the availability of suitable accommodations."
} ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@
},
"code" : {
"coding" : [ {
"system" : "https://bluebutton.cms.gov/resources/variables/clm_ip_admsn_type_cd",
"system" : "https://www.nubc.org/CodeSystem/PriorityTypeOfAdmitOrVisit",
"code" : "1",
"display" : "Emergency - The patient required immediate medical intervention as a result of severe, life threatening, or potentially disabling conditions. Generally, the patient was admitted through the emergency room."
} ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
},
"code" : {
"coding" : [ {
"system" : "https://bluebutton.cms.gov/resources/variables/clm_ip_admsn_type_cd",
"system" : "https://www.nubc.org/CodeSystem/PriorityTypeOfAdmitOrVisit",
"code" : "3",
"display" : "Elective - The patient's condition permitted adequate time to schedule the availability of suitable accommodations."
} ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@
{
"category" : {
"coding" : [ {
"code" : "info",
"code" : "admtype",
"display" : "Information",
"system" : "http://terminology.hl7.org/CodeSystem/claiminformationcategory"
"system" : "http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBSupportingInfoType"
}, {
"code" : "https://bluebutton.cms.gov/resources/variables/clm_ip_admsn_type_cd",
"display" : "Claim Inpatient Admission Type Code",
Expand All @@ -196,7 +196,7 @@
"code" : {
"coding" : [ {
"code" : "3",
"system" : "https://bluebutton.cms.gov/resources/variables/clm_ip_admsn_type_cd"
"system" : "https://www.nubc.org/CodeSystem/PriorityTypeOfAdmitOrVisit"
} ]
},
"sequence" : 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@
}, {
"category" : {
"coding" : [ {
"code" : "info",
"code" : "admtype",
"display" : "Information",
"system" : "http://terminology.hl7.org/CodeSystem/claiminformationcategory"
"system" : "http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBSupportingInfoType"
}, {
"code" : "https://bluebutton.cms.gov/resources/variables/clm_ip_admsn_type_cd",
"display" : "Claim Inpatient Admission Type Code",
Expand All @@ -208,7 +208,7 @@
"code" : {
"coding" : [ {
"code" : "3",
"system" : "https://bluebutton.cms.gov/resources/variables/clm_ip_admsn_type_cd"
"system" : "https://www.nubc.org/CodeSystem/PriorityTypeOfAdmitOrVisit"
} ]
},
"sequence" : 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,9 @@
{
"category" : {
"coding" : [ {
"code" : "info",
"code" : "admtype",
"display" : "Information",
"system" : "http://terminology.hl7.org/CodeSystem/claiminformationcategory"
"system" : "http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBSupportingInfoType"
}, {
"code" : "https://bluebutton.cms.gov/resources/variables/clm_ip_admsn_type_cd",
"display" : "Claim Inpatient Admission Type Code",
Expand All @@ -212,7 +212,7 @@
"code" : {
"coding" : [ {
"code" : "3",
"system" : "https://bluebutton.cms.gov/resources/variables/clm_ip_admsn_type_cd"
"system" : "https://www.nubc.org/CodeSystem/PriorityTypeOfAdmitOrVisit"
} ]
},
"sequence" : 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@
{
"category" : {
"coding" : [ {
"code" : "info",
"code" : "admtype",
"display" : "Information",
"system" : "http://terminology.hl7.org/CodeSystem/claiminformationcategory"
"system" : "http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBSupportingInfoType"
}, {
"code" : "https://bluebutton.cms.gov/resources/variables/clm_ip_admsn_type_cd",
"display" : "Claim Inpatient Admission Type Code",
Expand All @@ -225,7 +225,7 @@
"code" : {
"coding" : [ {
"code" : "3",
"system" : "https://bluebutton.cms.gov/resources/variables/clm_ip_admsn_type_cd"
"system" : "https://www.nubc.org/CodeSystem/PriorityTypeOfAdmitOrVisit"
} ]
},
"sequence" : 3
Expand Down
Loading

0 comments on commit 0d0dea9

Please sign in to comment.