Skip to content

ICD-10 PCS Coding Documentation

Introduction

In The CIRS Project we can handle the Procedure coding in 2 -different techniques those are explained in CIRS --> PCSCoding.md

In the Procedure coding technique we are gathering the all information related procedure document specific Operation,BodyPart,Approach,Device,Qualifier and their start positions and end positions,SectionHeader etc..

Here we are using total 60 - JAPE rules and 8 - DEF files to handle the PCS Coding

Analysis

Step 1 : In DictionaryHandler.java we can load all DEF files.

Step 2 : In JapeHandler.java we can load the all JAPE rules based on the DocumentId.

Step 3 : In CorpusReader.java file we have a method called

1
2
3
4
5
6
7
public void initAnnotationReadingProcess(AnnotatedDocument annotatedDocument) {      

    directPcsAnnotationReader.init(annotatedDocument); //---- DirectPCS
    procedureSpecificAnnotations.init(annotatedDocument);
    absoluteOpAnnotationReader.init(annotatedDocument);  //---- AbsoluteOP

}
I.

The first method handles the DirectPCS Annotation.
The DirectPCS Annotation internal process was getting all 7 digit PCS Tabular information directly into JAPE rules by the help of StandardBodyParts2 table etc.. by this we can get the code.

II.

The second method handles the Procedure specific Annottaions i.e AbsoluteFractureRd2,AbsoluteBP,AbsolutePTA etc.. all these annotations finally rediredted to third method i.e AbsoluteOp Annotation.

III.

The third method handles the AbsoluteOP Annotation.
The AbsoluteOP internal process was getting 7 digit code directly with the help of OPearion,Bodypart,Approach terms and then directly inserted those code in to table.

1. Handle DirectPCS Annotation

In DirectPcsAnnotationReader.java class we have init() method and this init() internally calls another 3 - methods
i.e

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
public class DirectPcsAnnotationReader implements DocumentAnnotationReader {

    @Override
    public void init(AnnotatedDocument annotatedDocument) {

        readRequiredAnnotationSet();
        processAnnotationSet();
        saveAnnotationSet();

    }
}
readRequiredAnnotationSet()

In this method we are getting the Annotations i.e. DirectPCS

1
2
3
4
5
    @Override
    public void readRequiredAnnotationSet() {
        tableDirectPcsData = defaultAnnotationSet.get("DirectPCS");

    }
processAnnotationSet()

In this method we are processing the AnnotationSet and get the all features in the DirectPCS Annotation and add those into the list.
i.e.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
    @Override
    public void processAnnotationSet() {

 if (tableDirectPcsData != null && !tableDirectPcsData.isEmpty()) {
                    PcsCode directPcsCode = new PcsCode();  // POJO Class

                    String operation = features.get("Operation").toString();
                    String bodyPart = features.get("BodyPart").toString();

                    directPcsCode.setOperation(operation);
                    directPcsCode.setBodyPart(bodyPart);

                    directPcsDataList.add(directPcsCode);

                }
    }
saveAnnotationSet()

In this method we are calling insertDirectPcsData() method in the PCSRepository class for all the data base related operations.

1
2
3
4
5
6
7
8
9
    @Override
    public void saveAnnotationSet() {

        pcsRepository.insertDirectPcsData(directPcsDataList);

        directPcsDataList.clear();
    }

}

PCSRepository.java

In PCSRepository.java file we have the method like insertDirectPcsData() to handle this total list and finally calls StoredProcedure NLP_InsertDirectPCS
i.e.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
public class PCSRepository {
    public void insertDirectPcsData(List<PcsCode> directPcsDataList) {
        String directPcsSP = "execute NLP_InsertDirectPCS ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?";
        facilityJdbcTemplate.batchUpdate(directPcsSP, new BatchPreparedStatementSetter() {
        @Override
            public void setValues(PreparedStatement ps, int i) throws SQLException {
                PcsCode pcsCode = directPcsDataList.get(i);
                ps.setString(1, pcsCode.getAccountNumber());
                ps.setInt(2, pcsCode.getDocumentId());
                .....
        }
}

In the HRCM.dbo.NLP_InsertDirectPCS StoredProcedure we getting 7 - digit PCS code. and finally all required information was inserted into the HRCM.dbo.NLP_PcsCodeByDocument and table.

All Document related information like Document Operation,BodyPart,Approach,Device,Qualifier and those Start position,End Position are inserted into HRCM.dbo.NLP_PcsCodeEvidance table.

2. Handle Procedure Specific Annotations Annotation

Here different Procedure specific annotations are getting from the JAPE rules like AbsoluteFractureRd2,AbsoluteAVSDBP,AbsoluteBP,AbsolutePTA etc.. total 17 -- Procedure Specific annotations present . All these Annotations are handled in ProcedureSpecificAnnotations.java side like

1
2
3
4
public class ProcedureSpecificAnnotations {
    public void init(AnnotatedDocument annotatedDocument) {
        IndividualProcedureAnnotations(document);
    }

In the IndividualProcedureAnnotations() we are getting all these annotations from JAPE rules like

1
2
3
4
5
6
7
8
public void IndividualProcedureAnnotations(Document gateDocument) {
accountNumber = (String) gateDocument.getFeatures().get("accountNumber");
            getAbsoluteFractureRd2();
            getAbsoluteAVSDBodyPart();
            getAbsoluteBodyPart();          
            getPCS();
            ...
}

If we observe the Annotation like AbsoluteFractureRd2

1
2
3
4
5
6
7
8
9
public void getAbsoluteFractureRd2() throws Exception {
    for (Annotation ann : absoluteBp) {
    String opName = (String) absoluteFractureFeature.get("Operation");
    String bpart = (String) absoluteFractureFeature.get("BodyPart");
    }
                    String fractureQuery1 = "select distinct BodySystem from MasterHRCM.dbo.MST_StandardBodyParts2 where BodyPart=? and (BodySystem='Upper Bones' or BodySystem='Lower Bones' or Bodysystem='Upper Joints' or Bodysystem='Lower Joints') and operationName=?";
                bodySystem = jdbcTemplate.queryForObject(fractureQuery1, String.class, bpart, opName);

}   

Here in every Procedure specific annotation we are using master table like MasterHRCM.dbo.MST_StandardBodyParts2 to get the Standard Procedure terms and code .

Finally all these Features and Code given as input to AbsoluteOP Annotation.

3. Handle AbsoluteOP Annotation

In AbsoluteOpAnnotationReader.java class we have init() method and this init() internally calls another 3 - methods
i.e

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
public class AbsoluteOpAnnotationReader implements DocumentAnnotationReader {

    @Override
    public void init(AnnotatedDocument annotatedDocument) {

        readRequiredAnnotationSet();
        processAnnotationSet();
        saveAnnotationSet();

    }
}
readRequiredAnnotationSet()

In this method we are getting the Annotations i.e. AbsoluteOp

1
2
3
4
5
    @Override
    public void readRequiredAnnotationSet() {
        absoluteOpPcsData = defaultAnnotationSet.get("AbsoluteOp");

    }
processAnnotationSet()

In this method we are processing the AnnotationSet and get the all features in the AbsoluteOp Annotation and add those into the list.
i.e.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
    @Override
    public void processAnnotationSet() {

 if (absoluteOpPcsData != null && !absoluteOpPcsData.isEmpty()) {
                    PcsCode absoluteOpPcsCode = new PcsCode();  // POJO Class

                    String operation = features.get("Operation").toString();
                    String bodyPart = features.get("BodyPart").toString();

                    absoluteOpPcsCode.setOperation(operation);
                    absoluteOpPcsCode.setBodyPart(bodyPart);
                    absoluteOpPcsCode.setCode(code);
                    directPcsDataList.add(absoluteOpPcsCode);

                }
                pcsRepository.excludePcsCodeByCodeContent(accountNumber);  
    }

here internally calling another method i.e excludePcsCodeByCodeContent().by using this method we calling the stored procedure HRCM.dbo.CIRS_RunPCSCodeExclusion In this Stored procedure we are Excludes the Procedure Codes based on PCSCode,PCSContent(Operation) by using the master tables like MasterHRCM.dbo.MST_PCSExclusionByCode table by code
MasterHRCM.dbo.MST_PCSExclusionByContent table by content

saveAnnotationSet()

In this method we are calling insertDirectPcsData() method in the PCSRepository class for all the data base related operations.

1
2
3
4
5
6
7
8
9
    @Override
    public void saveAnnotationSet() {

        pcsRepository.insertAbsoluteOpPcsData(absoluteOpPcsDataList);

        absoluteOpPcsDataList.clear();
    }

}

PCSRepository.java

In PCSRepository.java file we have the method like insertAbsoluteOpPcsData() to handle this total list and finally calls StoredProcedure NLP_InsertDirectPCS
i.e.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
public class PCSRepository {
    public void insertAbsoluteOpPcsData(List<PcsCode> absoluteOpPcsDataList) {
        String directPcsSP = "execute NLP_InsertDirectPCS ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?";
        facilityJdbcTemplate.batchUpdate(directPcsSP, new BatchPreparedStatementSetter() {
        @Override
            public void setValues(PreparedStatement ps, int i) throws SQLException {
                PcsCode pcsCode = directPcsDataList.get(i);
                ps.setString(1, pcsCode.getAccountNumber());
                ps.setInt(2, pcsCode.getDocumentId());
                .....
        }
}

In the HRCM.dbo.NLP_InsertDirectPCS StoredProcedure we getting 7 - digit PCS code. and finally all required information was inserted into the HRCM.dbo.NLP_PcsCodeByDocument and table.

All Document related information like Document Operation,BodyPart,Approach,Device,Qualifier and those Start position,End Position are inserted into HRCM.dbo.NLP_PcsCodeEvidance table.

4. Handle PCS3 Annotation

In the ProcedureSpecific annotation getPCS() we can get the annotations PCS3,PCSBodyPart,Qualifier etc..
i.e

1
2
3
4
5
 public void getPCS() throws Exception {
 AnnotationSet pcsBodyPart = docAnnotationSet.get("PCSBodyPart");
 Set pcsSet = new HashSet();
            pcsSet.add("PCS3");
 } 

Here by using this PCS3 Annotation we are processing the Fusion Procedure.Here we are using the tables like MasterHRCM.dbo.MST_PCSOPBodyPart, MasterHRCM.dbo.MST_PCSBodyPartSynonym, MasterHRCM.dbo.MST_PCSOpSynonym, MasterHRCM.dbo.MST_PCSOperation tables.

Here we can excludes the Qualifiers,Devices based on Their priority by using the StoredProcedure i.e NLP_GetPriorityPCSDeviceQualifier .

Finally all these information like Operation,BodyPart,Device,Qualifier are given as input to the Stored Procedure like NLP_InsertStandardPcs

The direct Code like total 7 digit direct code when the perticular operation comes that code also given as a input to stored Procedure like NLP_InsertStandardPcs

###Insert into NLP_PcsCode from NLP_PcsCodeByDocument

Finally after all the Operations are completed and insert the final code into the NLP_PcsCodeByDocument we are inserting PcsCode into the final table NLP_PcsCode.Using the Stored Procedure Like NLP_InsertCodablePcsCodesFromAllPcsCode
i.e

``` java public void insertCodablePcsCodesFromAllPcsCode(String accountNumber,int documentId) {

1
2
3
        String insertIntoPcsCodeSP = "execute NLP_InsertCodablePcsCodesFromAllPcsCode ?";
        facilityJdbcTemplate.update(insertIntoPcsCodeSP, accountNumber,documentId);
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
 ###<span style="color:teal">Apply the Exclusions on NLP_PcsCode</span>

After All insertions are completed we are applying the exclusion on final table  NLP_PcsCode </br>
i.e based on Pcscode using the table MasterHRCM.dbo.MST_PCSExclusionByCode </br>
    based on Pcscontent using the table MasterHRCM.dbo.MST_PCSExclusionByContent </br>

i.e

``` java

public void excludePcsCodeByCodeContent(String accountNumber) {

            String codeEliminationSP = "execute CIRS_RunPCSCodeExclusion ?";
            facilityJdbcTemplate.update(codeEliminationSP, accountNumber);
    }

The Procedure coding Documentation was finished Here.