Jump to content

JSON - check for empty values in required keys before transmitting


This topic is 1115 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I am working on a interface to submit claims to an insurance clearing house.  I am able to create the JSON and submit the claim but the clearing house won't accept some empty fields.  As a result, I would like to make sure there are not empty values in the required key/value pairs.  Is there an easy way to quickly do this after the JSON is built?

I realize it could be done when building the JSON but I'm trying to write scripts that only do one thing at a time.  Thus, a script to check the JSON before submitting it.  If there isn't, I'll just write a script to check all the FM fields before creating the JSON.

Thanks for any help you can provide.

{
    "Claims" : 
    [
        {
            "Prov_PayerID" : "APX14116",
            "Prov_VendorClaimID" : "103",
            "F00_PayerName" : "ACME HEALTH INSURANCE CO.",
            "F01A_InsuredId" : "AHI226059876",
            "F02_PatientNameFirst" : "Deanna",
            "F02_PatientNameLast" : "Troi",
            "F03_PatientDob" : "1990-03-29",
            "F03_PatientSex" : "F",
            "F04_InsuredNameFirst" : "Deanna ",
            "F04_InsuredNameLast" : "Troi",
            "F05_PatientAddress1" : "2336 Betazed",
            "F05_PatientCity" : "Some City",
            "F05_PatientState" : "XX",
            "F05_PatientZip" : "NNNNN",
            "F06_PatientRelationshipToInsured" : "Self",
            "F07_InsuredAddress1" : "2336 Betazed",
            "F07_InsuredCity" : "Some City",
            "F07_InsuredState" : "XX",
            "F07_InsuredZip" : "NNNNN",
            "F11A_InsuredDob" : "1990-03-29",
            "F11A_InsuredSex" : "F",
            "F12_PatientAuthorization" : "Yes",
            "F13_InsuredAuthorization" : "Y",
            "F21_DiagnosisCodes" : [ "H00014 ", "H47323 " ],
            "F21_IcdIndicator" : "10",
            "F24_ClaimLines" : 
            [
                {
                    "F24A_DateOfServiceFrom" : "2021-02-25",
                    "F24B_PlaceOfServiceCode" : "11",
                    "F24D_HcpcsProcedureCode" : "92004",
                    "F24E_DiagnosisPointers" : [ "A" ],
                    "F24F_Charges" : 154,
                    "X12_ProviderControlNumber" : "111"
                },
                {
                    "F24A_DateOfServiceFrom" : "2021-02-25",
                    "F24B_PlaceOfServiceCode" : "11",
                    "F24D_HcpcsProcedureCode" : "92250",
                    "F24E_DiagnosisPointers" : [ "A" ],
                    "F24F_Charges" : 68,
                    "X12_ProviderControlNumber" : "112"
                },
                {
                    "F24A_DateOfServiceFrom" : "2021-02-25",
                    "F24B_PlaceOfServiceCode" : "11",
                    "F24D_HcpcsProcedureCode" : "92285",
                    "F24E_DiagnosisPointers" : [ "A" ],
                    "F24F_Charges" : 43,
                    "X12_ProviderControlNumber" : "113"
                }
            ],
            "F28_TotalCharge" : 265,
            "F31_PhysicianOrSupplierSignatureIsOnFile" : true,
            "F33A_BillingProviderNpi" : "",
            "F33_BillingProviderAddress1" : "849 E. 400 So.",
            "F33_BillingProviderCity" : "Some City",
            "F33_BillingProviderNameFirst" : "",
            "F33_BillingProviderNameLast" : "",
            "F33_BillingProviderPhoneNumber" : "xxx-xxx-xxx",
            "F33_BillingProviderState" : "XX",
            "F33_BillingProviderZip" : "NNNNN"
        }
    ],
    "DocumentType" : "MedicalClaim"
}

Edited by JMW
Clarity
Link to comment
Share on other sites

3 hours ago, JMW said:

Is there an easy way to quickly do this after the JSON is built?

If by "easy" and "quickly" you mean without looping over all the required keys and checking each one individually, then I am afraid the answer is no. JSON is not XML. There is no equivalent of XPath language that would allow you to select "any element that does not have a child element or a text node".*

Technically, it should be possible to traverse the entire tree using a script that calls itself recursively. However, I suspect it wouldn't be easy to write nor quick to execute. 

--
(*) At least not using Filemaker JSON functions - it might be possible using JavaScript in a web viewer, or a plugin.

 

Edited by comment
Link to comment
Share on other sites

This topic is 1115 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.