Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.

CRMconst patients = [

{ "mrn": "CHP-391476", "first_name": "Amara", "last_name": "Rivera", "dob": "2025-04-25", "sex": "F", "address": { "street": "8885 Beaglin Park Dr", "city": "Ocean City", "state": "MD", "zip": "21842", "county": "Worcester" }, "authorized_contact": { "name": "Brianna Adkins", "relationship": "Foster Parent", "phone": "(410) 957-2139", "email": "brianna.adkins@gmail.com" }, "preferred_communication_method": "SMS", "preferred_language": "English", "preferred_pharmacy": "Walgreens - Salisbury (S Salisbury Blvd)", "primary_care_provider": "Dr. Marcus Bell, MD", "insurance": "Maryland Physicians Care", "allergies": "Environmental (pollen)", "seen_dentist_last_6mo": true, "last_dental_visit_date": "2026-04-16" }, { "mrn": "CHP-905635", "first_name": "Lucas", "last_name": "Ennis", "dob": "2026-07-15", "sex": "M", "address": { "street": "1269 Zion Rd", "city": "Pocomoke City", "state": "MD", "zip": "21851", "county": "Worcester" }, "authorized_contact": { "name": "James Ennis", "relationship": "Father", "phone": "(410) 651-8573", "email": "james.ennis@comcast.net" }, "preferred_communication_method": "Email", "preferred_language": "Haitian Creole", "preferred_pharmacy": "Rite Aid - Salisbury (Mount Hermon)", "primary_care_provider": "Dr. Marcus Bell, MD", "insurance": "Aetna Better Health", "allergies": "Asthma - albuterol PRN", "seen_dentist_last_6mo": false, "last_dental_visit_date": null }, { "mrn": "CHP-518801", "first_name": "Caleb", "last_name": "Jones", "dob": "2023-10-15", "sex": "M", "address": { "street": "1184 Snow Hill Rd", "city": "Marion Station", "state": "MD", "zip": "21838", "county": "Somerset" }, "authorized_contact": { "name": "Valentina Jones", "relationship": "Legal Guardian", "phone": "(410) 957-3340", "email": "valentina.jones@outlook.com" }, "preferred_communication_method": "SMS", "preferred_language": "English", "preferred_pharmacy": "Rite Aid - Salisbury (Mount Hermon)", "primary_care_provider": "Dr. Sarah Whitfield, MD", "insurance": "Amerigroup Maryland", "allergies": "Sulfa drugs", "seen_dentist_last_6mo": true, "last_dental_visit_date": "2026-06-13" }, { "mrn": "CHP-772097", "first_name": "Ava", "last_name": "Parsons", "dob": "2015-12-14", "sex": "F", "address": { "street": "7016 Zion Rd", "city": "Fruitland", "state": "MD", "zip": "21826", "county": "Wicomico" }, "authorized_contact": { "name": "Sofia Parsons", "relationship": "Mother", "phone": "(410) 957-9669", "email": "sofia.parsons@outlook.com" }, "preferred_communication_method": "Email", "preferred_language": "English", "preferred_pharmacy": "Apple Discount Drugs - Fruitland", "primary_care_provider": "Dr. Kevin Okonkwo, MD", "insurance": "CareFirst BlueCross BlueShield", "allergies": "Shellfish", "seen_dentist_last_6mo": true, "last_dental_visit_date": "2026-05-04" }, { "mrn": "CHP-120422", "first_name": "Aaliyah", "last_name": "Windsor", "dob": "2011-07-21", "sex": "F", "address": { "street": "4415 Pemberton Dr", "city": "Bishopville", "state": "MD", "zip": "21813", "county": "Worcester" }, "authorized_contact": { "name": "James Toussaint", "relationship": "Father", "phone": "(410) 957-3504", "email": "james.toussaint@outlook.com" }, "preferred_communication_method": "SMS", "preferred_language": "Spanish", "preferred_pharmacy": "Harbor Pharmacy - Ocean City", "primary_care_provider": "Dr. Amanda Reyes, MD", "insurance": "Aetna Better Health", "allergies": "Bee stings", "seen_dentist_last_6mo": true, "last_dental_visit_date": "2026-04-17" }, { "mrn": "CHP-891952", "first_name": "Camila", "last_name": "Parsons", "dob": "2020-03-18", "sex": "F", "address": { "street": "1503 Sunset Ave", "city": "Berlin", "state": "MD", "zip": "21811", "county": "Worcester" }, "authorized_contact": { "name": "Isaiah Parsons", "relationship": "Father", "phone": "(410) 651-3103", "email": "isaiah.parsons@comcast.net" }, "preferred_communication_method": "Email", "preferred_language": "English", "preferred_pharmacy": "Rite Aid - Fruitland", "primary_care_provider": "Emily Carter, CRNP", "insurance": "UnitedHealthcare", "allergies": "Latex", "seen_dentist_last_6mo": false, "last_dental_visit_date": "2025-03-01" }, { "mrn": "CHP-446479", "first_name": "Amara", "last_name": "Collins", "dob": "2013-08-31", "sex": "F", "address": { "street": "4161 Ocean Gateway", "city": "Princess Anne", "state": "MD", "zip": "21853", "county": "Somerset" }, "authorized_contact": { "name": "Kayla Collins", "relationship": "Mother", "phone": "(410) 957-4608", "email": "kayla.collins@gmail.com" }, "preferred_communication_method": "SMS", "preferred_language": "Haitian Creole", "preferred_pharmacy": "Apple Discount Drugs - Salisbury", "primary_care_provider": "Dr. Marcus Bell, MD", "insurance": "Maryland Physicians Care", "allergies": "None known", "seen_dentist_last_6mo": true, "last_dental_visit_date": "2026-05-19" }, { "mrn": "CHP-522179", "first_name": "Riley", "last_name": "Dashiell", "dob": "2018-07-16", "sex": "F", "address": { "street": "4081 Bay St", "city": "Pittsville", "state": "MD", "zip": "21850", "county": "Wicomico" }, "authorized_contact": { "name": "Rose Dashiell", "relationship": "Foster Parent", "phone": "(410) 835-6804", "email": "rose.dashiell@comcast.net" }, "preferred_communication_method": "SMS", "preferred_language": "English", "preferred_pharmacy": "Rite Aid - Salisbury (Mount Hermon)", "primary_care_provider": "Dr. Amanda Reyes, MD", "insurance": "Maryland Physicians Care", "allergies": "None known", "seen_dentist_last_6mo": false, "last_dental_visit_date": null }, { "mrn": "CHP-989921", "first_name": "Caleb", "last_name": "Bozman", "dob": "2026-03-16", "sex": "M", "address": { "street": "2396 Nanticoke Rd", "city": "Ocean City", "state": "MD", "zip": "21842", "county": "Worcester" }, "authorized_contact": { "name": "Carlos Bozman", "relationship": "Father", "phone": "(410) 749-8260", "email": "carlos.bozman@gmail.com" }, "preferred_communication_method": "SMS", "preferred_language": "Portuguese", "preferred_pharmacy": "CVS Pharmacy - Pocomoke City", "primary_care_provider": "Dr. Amanda Reyes, MD", "insurance": "Maryland Physicians Care", "allergies": "Shellfish", "seen_dentist_last_6mo": false, "last_dental_visit_date": null }, { "mrn": "CHP-411120", "first_name": "Amari", "last_name": "Santos", "dob": "2013-11-04", "sex": "M", "address": { "street": "6670 Cedar Ln", "city": "Crisfield", "state": "MD", "zip": "21817", "county": "Somerset" }, "authorized_contact": { "name": "Wayne Santos", "relationship": "Father", "phone": "(410) 835-5345", "email": "wayne.santos@comcast.net" }, "preferred_communication_method": "Email", "preferred_language": "English", "preferred_pharmacy": "Rite Aid - Salisbury (Mount Hermon)", "primary_care_provider": "David Han, PA-C", "insurance": "Priority Partners MCO", "allergies": "Amoxicillin", "seen_dentist_last_6mo": true, "last_dental_visit_date": "2026-07-04" }, { "mrn": "CHP-185965", "first_name": "Owen", "last_name": "Parsons", "dob": "2021-04-13", "sex": "M", "address": { "street": "8338 Pemberton Dr", "city": "Ocean City", "state": "MD", "zip": "21842", "county": "Worcester" }, "authorized_contact": { "name": "Robert Sturgis", "relationship": "Father", "phone": "(410) 651-2122", "email": "robert.sturgis@gmail.com" }, "preferred_communication_method": "SMS", "preferred_language": "English", "preferred_pharmacy": "Walgreens - Salisbury (S Salisbury Blvd)", "primary_care_provider": "Dr. Marcus Bell, MD", "insurance": "Maryland Medicaid (HealthChoice)", "allergies": "Sulfa drugs", "seen_dentist_last_6mo": true, "last_dental_visit_date": "2026-02-19" }, { "mrn": "CHP-378082", "first_name": "Zoe", "last_name": "Dashiell", "dob": "2023-10-18", "sex": "F", "address": { "street": "6584 Naylor Mill Rd", "city": "Hebron", "state": "MD", "zip": "21830", "county": "Wicomico" }, "authorized_contact": { "name": "Gerald Dashiell", "relationship": "Grandfather", "phone": "(410) 749-1152", "email": "gerald.dashiell@comcast.net" }, "preferred_communication_method": "Email", "preferred_language": "Spanish", "preferred_pharmacy": "Walgreens - Salisbury (S Salisbury Blvd)", "primary_care_provider": "Dr. Kevin Okonkwo, MD", "insurance": "UnitedHealthcare", "allergies": "Latex", "seen_dentist_last_6mo": true, "last_dental_visit_date": "2026-04-20" }, { "mrn": "CHP-395442", "first_name": "Caleb", "last_name": "Adkins", "dob": "2014-12-20", "sex": "M", "address": { "street": "9000 Deer Harbor Rd", "city": "Pittsville", "state": "MD", "zip": "21850", "county": "Wicomico" }, "authorized_contact": { "name": "Marcus Bradshaw", "relationship": "Grandfather", "phone": "(410) 548-5905", "email": "marcus.bradshaw@gmail.com" }, "preferred_communication_method": "SMS", "preferred_language": "English", "preferred_pharmacy": "Walgreens - Salisbury (S Salisbury Blvd)", "primary_care_provider": "Dr. Kevin Okonkwo, MD", "insurance": "Priority Partners MCO", "allergies": "Tree nuts, eggs", "seen_dentist_last_6mo": false, "last_dental_visit_date": null }, { "mrn": "CHP-178898", "first_name": "Xavier", "last_name": "Tawes", "dob": "2018-10-28", "sex": "M", "address": { "street": "1612 Peninsula Expy", "city": "Princess Anne", "state": "MD", "zip": "21853", "county": "Somerset" }, "authorized_contact": { "name": "Robert Tawes", "relationship": "Foster Parent", "phone": "(410) 651-5291", "email": "robert.tawes@yahoo.com" }, "preferred_communication_method": "SMS", "preferred_language": "Spanish", "preferred_pharmacy": "Rite Aid - Salisbury (Mount Hermon)", "primary_care_provider": "Emily Carter, CRNP", "insurance": "Maryland Medicaid (HealthChoice)", "allergies": "Penicillin", "seen_dentist_last_6mo": false, "last_dental_visit_date": null }, { "mrn": "CHP-885884", "first_name": "Jordan", "last_name": "Jones", "dob": "2023-06-27", "sex": "M", "address": { "street": "2526 Nanticoke Rd", "city": "Ocean Pines", "state": "MD", "zip": "21811", "county": "Worcester" }, "authorized_contact": { "name": "Robert Jones", "relationship": "Father", "phone": "(410) 548-6862", "email": "robert.jones@yahoo.com" }, "preferred_communication_method": "SMS", "preferred_language": "Portuguese", "preferred_pharmacy": "Walgreens - Salisbury (S Salisbury Blvd)", "primary_care_provider": "Dr. Julio Marte, MD", "insurance": "Amerigroup Maryland", "allergies": "Sulfa drugs", "seen_dentist_last_6mo": true, "last_dental_visit_date": "2026-05-19" }, { "mrn": "CHP-960394", "first_name": "Amari", "last_name": "Williams", "dob": "2020-07-22", "sex": "M", "address": { "street": "6845 College Ave", "city": "Pocomoke City", "state": "MD", "zip": "21851", "county": "Worcester" }, "authorized_contact": { "name": "Yolanda Williams", "relationship": "Grandmother", "phone": "(410) 749-7267", "email": "yolanda.williams@gmail.com" }, "preferred_communication_method": "SMS", "preferred_language": "English", "preferred_pharmacy": "Walmart Pharmacy - Salisbury", "primary_care_provider": "David Han, PA-C", "insurance": "Aetna Better Health", "allergies": "Tree nuts, eggs", "seen_dentist_last_6mo": false, "last_dental_visit_date": "2025-12-21" }, { "mrn": "CHP-725550", "first_name": "Ethan", "last_name": "Whittington", "dob": "2010-01-03", "sex": "M", "address": { "street": "5853 Peninsula Expy", "city": "Hebron", "state": "MD", "zip": "21830", "county": "Wicomico" }, "authorized_contact": { "name": "Sofia Whittington", "relationship": "Mother", "phone": "(410) 208-1452", "email": "sofia.whittington@gmail.com" }, "preferred_communication_method": "Email", "preferred_language": "English", "preferred_pharmacy": "Walmart Pharmacy - Berlin", "primary_care_provider": "Dr. Sarah Whitfield, MD", "insurance": "Maryland Medicaid (HealthChoice)", "allergies": "Penicillin", "seen_dentist_last_6mo": true, "last_dental_visit_date": "2026-04-29" }, { "mrn": "CHP-414910", "first_name": "Leilani", "last_name": "Tawes", "dob": "2010-12-03", "sex": "F", "address": { "street": "3214 Somerset Ave", "city": "Deal Island", "state": "MD", "zip": "21821", "county": "Somerset" }, "authorized_contact": { "name": "Camila Tawes", "relationship": "Mother", "phone": "(410) 957-6967", "email": "camila.tawes@comcast.net" }, "preferred_communication_method": "SMS", "preferred_language": "Portuguese", "preferred_pharmacy": "Nyle's Pharmacy - Crisfield", "primary_care_provider": "Dr. Julio Marte, MD", "insurance": "Maryland Physicians Care", "allergies": "None known", "seen_dentist_last_6mo": true, "last_dental_visit_date": "2026-01-29" }, { "mrn": "CHP-923927", "first_name": "Harper", "last_name": "Cordoba", "dob": "2012-08-28", "sex": "F", "address": { "street": "2185 Snow Hill Rd", "city": "Deal Island", "state": "MD", "zip": "21821", "county": "Somerset" }, "authorized_contact": { "name": "Diego Cordoba", "relationship": "Foster Parent", "phone": "(410) 651-5930", "email": "diego.cordoba@comcast.net" }, "preferred_communication_method": "Email", "preferred_language": "English", "preferred_pharmacy": "Rite Aid - Fruitland", "primary_care_provider": "Dr. Sarah Whitfield, MD", "insurance": "UnitedHealthcare", "allergies": "Environmental (pollen)", "seen_dentist_last_6mo": false, "last_dental_visit_date": null }, { "mrn": "CHP-148458", "first_name": "Chloe", "last_name": "Collins", "dob": "2024-05-11", "sex": "F", "address": { "street": "2880 College Ave", "city": "Ocean City", "state": "MD", "zip": "21842", "county": "Worcester" }, "authorized_contact": { "name": "Brianna Collins", "relationship": "Mother", "phone": "(410) 208-2530", "email": "brianna.collins@yahoo.com" }, "preferred_communication_method": "Email", "preferred_language": "English", "preferred_pharmacy": "Harbor Pharmacy - Ocean City", "primary_care_provider": "Dr. Marcus Bell, MD", "insurance": "Priority Partners MCO", "allergies": "None known", "seen_dentist_last_6mo": true, "last_dental_visit_date": "2026-03-19" }, { "mrn": "CHP-361303", "first_name": "Kai", "last_name": "Santos", "dob": "2018-01-12", "sex": "M", "address": { "street": "6391 Bay St", "city": "Snow Hill", "state": "MD", "zip": "21863", "county": "Worcester" }, "authorized_contact": { "name": "Latoya Santos", "relationship": "Foster Parent", "phone": "(410) 548-2746", "email": "latoya.santos@comcast.net" }, "preferred_communication_method": "SMS", "preferred_language": "English", "preferred_pharmacy": "Harbor Pharmacy - Ocean City", "primary_care_provider": "David Han, PA-C", "insurance": "Maryland Medicaid (HealthChoice)", "allergies": "Latex", "seen_dentist_last_6mo": false, "last_dental_visit_date": "2025-08-31" }, { "mrn": "CHP-181247", "first_name": "Genesis", "last_name": "Beauvais", "dob": "2019-01-30", "sex": "F", "address": { "street": "8370 Nanticoke Rd", "city": "Newark", "state": "MD", "zip": "21841", "county": "Worcester" }, "authorized_contact": { "name": "Harper Elzey", "relationship": "Mother", "phone": "(410) 957-5246", "email": "harper.elzey@yahoo.com" }, "preferred_communication_method": "Email", "preferred_language": "Spanish", "preferred_pharmacy": "Walgreens - Berlin", "primary_care_provider": "Dr. Marcus Bell, MD", "insurance": "CareFirst BlueCross BlueShield", "allergies": "Bee stings", "seen_dentist_last_6mo": false, "last_dental_visit_date": "2025-02-05" }, { "mrn": "CHP-540552", "first_name": "Kiara", "last_name": "Sturgis", "dob": "2020-10-14", "sex": "F", "address": { "street": "6375 Deer Harbor Rd", "city": "Delmar", "state": "MD", "zip": "21875", "county": "Wicomico" }, "authorized_contact": { "name": "Malik Sturgis", "relationship": "Father", "phone": "(410) 835-7678", "email": "malik.sturgis@outlook.com" }, "preferred_communication_method": "Email", "preferred_language": "English", "preferred_pharmacy": "Peninsula Pharmacy - Princess Anne", "primary_care_provider": "Dr. Amanda Reyes, MD", "insurance": "UnitedHealthcare", "allergies": "Asthma - albuterol PRN", "seen_dentist_last_6mo": true, "last_dental_visit_date": "2026-02-19" }, { "mrn": "CHP-590094", "first_name": "Zion", "last_name": "Layfield", "dob": "2013-11-22", "sex": "M", "address": { "street": "4992 Camden Ave", "city": "Willards", "state": "MD", "zip": "21874", "county": "Wicomico" }, "authorized_contact": { "name": "Valentina Layfield", "relationship": "Foster Parent", "phone": "(410) 835-8956", "email": "valentina.layfield@gmail.com" }, "preferred_communication_method": "SMS", "preferred_language": "English", "preferred_pharmacy": "Apple Discount Drugs - Fruitland", "primary_care_provider": "Emily Carter, CRNP", "insurance": "Priority Partners MCO", "allergies": "Asthma - albuterol PRN", "seen_dentist_last_6mo": false, "last_dental_visit_date": null }, { "mrn": "CHP-972335", "first_name": "Ethan", "last_name": "Williams", "dob": "2007-12-19", "sex": "M", "address": { "street": "2323 Old Ocean City Rd", "city": "Ocean City", "state": "MD", "zip": "21842", "county": "Worcester" }, "authorized_contact": { "name": "Robert Williams", "relationship": "Father", "phone": "(410) 208-4467", "email": "robert.williams@comcast.net" }, "preferred_communication_method": "Email", "preferred_language": "English", "preferred_pharmacy": "Harbor Pharmacy - Ocean City", "primary_care_provider": "Emily Carter, CRNP", "insurance": "CareFirst BlueCross BlueShield", "allergies": "Shellfish", "seen_dentist_last_6mo": true, "last_dental_visit_date": "2026-06-28" }, { "mrn": "CHP-833442", "first_name": "Olivia", "last_name": "Somers", "dob": "2026-07-20", "sex": "F", "address": { "street": "1224 Peninsula Expy", "city": "Crisfield", "state": "MD", "zip": "21817", "county": "Somerset" }, "authorized_contact": { "name": "Denise Bozman", "relationship": "Mother", "phone": "(410) 548-3496", "email": "denise.bozman@yahoo.com" }, "preferred_communication_method": "SMS", "preferred_language": "Spanish", "preferred_pharmacy": "Apple Discount Drugs - Fruitland", "primary_care_provider": "Dr. Kevin Okonkwo, MD", "insurance": "UnitedHealthcare", "allergies": "Bee stings", "seen_dentist_last_6mo": false, "last_dental_visit_date": null }, { "mrn": "CHP-910004", "first_name": "Amara", "last_name": "Pusey", "dob": "2018-03-02", "sex": "F", "address": { "street": "1976 Mount Hermon Rd", "city": "Bishopville", "state": "MD", "zip": "21813", "county": "Worcester" }, "authorized_contact": { "name": "Michael Pusey", "relationship": "Grandfather", "phone": "(410) 632-7149", "email": "michael.pusey@comcast.net" }, "preferred_communication_method": "SMS", "preferred_language": "English", "preferred_pharmacy": "Walmart Pharmacy - Berlin", "primary_care_provider": "Dr. Marcus Bell, MD", "insurance": "Maryland Physicians Care", "allergies": "None known", "seen_dentist_last_6mo": true, "last_dental_visit_date": "2026-02-15" }, { "mrn": "CHP-284692", "first_name": "Zion", "last_name": "Jones", "dob": "2023-08-11", "sex": "M", "address": { "street": "6171 Riverside Dr", "city": "Ocean City", "state": "MD", "zip": "21842", "county": "Worcester" }, "authorized_contact": { "name": "Kayla Jones", "relationship": "Mother", "phone": "(410) 835-9031", "email": "kayla.jones@gmail.com" }, "preferred_communication_method": "SMS", "preferred_language": "English", "preferred_pharmacy": "Apple Discount Drugs - Fruitland", "primary_care_provider": "David Han, PA-C", "insurance": "Priority Partners MCO", "allergies": "Environmental (pollen)", "seen_dentist_last_6mo": false, "last_dental_visit_date": null }, { "mrn": "CHP-618317", "first_name": "Leilani", "last_name": "Somers", "dob": "2007-10-03", "sex": "F", "address": { "street": "7236 Sunset Ave", "city": "Westover", "state": "MD", "zip": "21871", "county": "Somerset" }, "authorized_contact": { "name": "Terrance Sturgis", "relationship": "Grandfather", "phone": "(410) 632-8385", "email": "terrance.sturgis@yahoo.com" }, "preferred_communication_method": "SMS", "preferred_language": "Spanish", "preferred_pharmacy": "Walmart Pharmacy - Berlin", "primary_care_provider": "Emily Carter, CRNP", "insurance": "Aetna Better Health", "allergies": "None known", "seen_dentist_last_6mo": false, "last_dental_visit_date": "2025-06-11" }, { "mrn": "CHP-931450", "first_name": "Zoe", "last_name": "Whittington", "dob": "2010-01-01", "sex": "F", "address": { "street": "4626 Isabella St", "city": "Bishopville", "state": "MD", "zip": "21813", "county": "Worcester" }, "authorized_contact": { "name": "Aaliyah Sturgis", "relationship": "Mother", "phone": "(410) 957-7658", "email": "aaliyah.sturgis@comcast.net" }, "preferred_communication_method": "Email", "preferred_language": "English", "preferred_pharmacy": "Rite Aid - Salisbury (Mount Hermon)", "primary_care_provider": "David Han, PA-C", "insurance": "Self-pay / Uninsured", "allergies": "Bee stings", "seen_dentist_last_6mo": true, "last_dental_visit_date": "2026-05-04" }, { "mrn": "CHP-301939", "first_name": "Ethan", "last_name": "Nguyen", "dob": "2014-11-06", "sex": "M", "address": { "street": "6146 Bay St", "city": "Ocean Pines", "state": "MD", "zip": "21811", "county": "Worcester" }, "authorized_contact": { "name": "Aaliyah Nguyen", "relationship": "Mother", "phone": "(410) 208-6764", "email": "aaliyah.nguyen@comcast.net" }, "preferred_communication_method": "Email", "preferred_language": "English", "preferred_pharmacy": "Rite Aid - Fruitland", "primary_care_provider": "Dr. Marcus Bell, MD", "insurance": "Maryland Physicians Care", "allergies": "None known", "seen_dentist_last_6mo": true, "last_dental_visit_date": "2026-03-03" }, { "mrn": "CHP-157174", "first_name": "Jayden", "last_name": "Dashiell", "dob": "2008-11-08", "sex": "M", "address": { "street": "8695 Zion Rd", "city": "Deal Island", "state": "MD", "zip": "21821", "county": "Somerset" }, "authorized_contact": { "name": "Michael Guerrero", "relationship": "Grandfather", "phone": "(410) 957-6912", "email": "michael.guerrero@yahoo.com" }, "preferred_communication_method": "Email", "preferred_language": "English", "preferred_pharmacy": "Rite Aid - Salisbury (Mount Hermon)", "primary_care_provider": "Dr. Priya Nair, DO", "insurance": "CareFirst BlueCross BlueShield", "allergies": "None known", "seen_dentist_last_6mo": false, "last_dental_visit_date": null }, { "mrn": "CHP-760021", "first_name": "Malik", "last_name": "Handy", "dob": "2026-07-21", "sex": "M", "address": { "street": "7790 Bay St", "city": "Pocomoke City", "state": "MD", "zip": "21851", "county": "Worcester" }, "authorized_contact": { "name": "Terrance Handy", "relationship": "Father", "phone": "(410) 548-5136", "email": "terrance.handy@comcast.net" }, "preferred_communication_method": "SMS", "preferred_language": "English", "preferred_pharmacy": "Peninsula Pharmacy - Princess Anne", "primary_care_provider": "David Han, PA-C", "insurance": "Maryland Physicians Care", "allergies": "Sulfa drugs", "seen_dentist_last_6mo": false, "last_dental_visit_date": null }, { "mrn": "CHP-751194", "first_name": "James", "last_name": "Tull", "dob": "2013-05-30", "sex": "M", "address": { "street": "4166 Beaglin Park Dr", "city": "Princess Anne", "state": "MD", "zip": "21853", "county": "Somerset" }, "authorized_contact": { "name": "Camila Tull", "relationship": "Mother", "phone": "(410) 957-9561", "email": "camila.tull@comcast.net" }, "preferred_communication_method": "SMS", "preferred_language": "English", "preferred_pharmacy": "Rite Aid - Fruitland", "primary_care_provider": "Emily Carter, CRNP", "insurance": "CareFirst BlueCross BlueShield", "allergies": "Sulfa drugs", "seen_dentist_last_6mo": true, "last_dental_visit_date": "2026-06-23" }, { "mrn": "CHP-820775", "first_name": "Jayden", "last_name": "Rivera", "dob": "2026-05-11", "sex": "M", "address": { "street": "2947 Isabella St", "city": "Delmar", "state": "MD", "zip": "21875", "county": "Wicomico" }, "authorized_contact": { "name": "Angela Rivera", "relationship": "Mother", "phone": "(410) 957-8699", "email": "angela.rivera@outlook.com" }, "preferred_communication_method": "SMS", "preferred_language": "English", "preferred_pharmacy": "Rite Aid - Fruitland", "primary_care_provider": "Dr. Sarah Whitfield, MD", "insurance": "Self-pay / Uninsured", "allergies": "Penicillin", "seen_dentist_last_6mo": false, "last_dental_visit_date": null }, { "mrn": "CHP-591465", "first_name": "Xavier", "last_name": "Bozman", "dob": "2014-03-08", "sex": "M", "address": { "street": "3783 Peninsula Expy", "city": "Parsonsburg", "state": "MD", "zip": "21849", "county": "Wicomico" }, "authorized_contact": { "name": "Xavier Bozman", "relationship": "Father", "phone": "(410) 651-2169", "email": "xavier.bozman@gmail.com" }, "preferred_communication_method": "SMS", "preferred_language": "English", "preferred_pharmacy": "Walmart Pharmacy - Berlin", "primary_care_provider": "Dr. Sarah Whitfield, MD", "insurance": "Self-pay / Uninsured", "allergies": "Penicillin", "seen_dentist_last_6mo": false, "last_dental_visit_date": null }, { "mrn": "CHP-783157", "first_name": "Genesis", "last_name": "Somers", "dob": "2025-10-12", "sex": "F", "address": { "street": "9898 Cedar Ln", "city": "Princess Anne", "state": "MD", "zip": "21853", "county": "Somerset" }, "authorized_contact": { "name": "Marcus Somers", "relationship": "Foster Parent", "phone": "(410) 749-4750", "email": "marcus.somers@gmail.com" }, "preferred_communication_method": "Email", "preferred_language": "Spanish", "preferred_pharmacy": "Apple Discount Drugs - Salisbury", "primary_care_provider": "Dr. Priya Nair, DO", "insurance": "Self-pay / Uninsured", "allergies": "Latex", "seen_dentist_last_6mo": false, "last_dental_visit_date": null }, { "mrn": "CHP-519904", "first_name": "Zoe", "last_name": "Marshall", "dob": "2025-11-10", "sex": "F", "address": { "street": "8156 Riverside Dr", "city": "Newark", "state": "MD", "zip": "21841", "county": "Worcester" }, "authorized_contact": { "name": "Terrance Marshall", "relationship": "Father", "phone": "(410) 208-2713", "email": "terrance.marshall@yahoo.com" }, "preferred_communication_method": "Email", "preferred_language": "English", "preferred_pharmacy": "Rite Aid - Salisbury (Mount Hermon)", "primary_care_provider": "David Han, PA-C", "insurance": "CareFirst BlueCross BlueShield", "allergies": "None known", "seen_dentist_last_6mo": false, "last_dental_visit_date": null }, { "mrn": "CHP-154118", "first_name": "Kai", "last_name": "Sturgis", "dob": "2023-10-17", "sex": "M", "address": { "street": "1999 Camden Ave", "city": "Marion Station", "state": "MD", "zip": "21838", "county": "Somerset" }, "authorized_contact": { "name": "Denise Sturgis", "relationship": "Mother", "phone": "(410) 957-7770", "email": "denise.sturgis@gmail.com" }, "preferred_communication_method": "SMS", "preferred_language": "Spanish", "preferred_pharmacy": "Nyle's Pharmacy - Crisfield", "primary_care_provider": "David Han, PA-C", "insurance": "Self-pay / Uninsured", "allergies": "Shellfish", "seen_dentist_last_6mo": true, "last_dental_visit_date": "2026-02-28" }, { "mrn": "CHP-406039", "first_name": "Isaiah", "last_name": "Collins", "dob": "2022-11-03", "sex": "M", "address": { "street": "4020 Deer Harbor Rd", "city": "Salisbury", "state": "MD", "zip": "21801", "county": "Wicomico" }, "authorized_contact": { "name": "Carlos Collins", "relationship": "Father", "phone": "(410) 835-2527", "email": "carlos.collins@yahoo.com" }, "preferred_communication_method": "SMS", "preferred_language": "English", "preferred_pharmacy": "Walgreens - Salisbury (S Salisbury Blvd)", "primary_care_provider": "Dr. Priya Nair, DO", "insurance": "Self-pay / Uninsured", "allergies": "None known", "seen_dentist_last_6mo": true, "last_dental_visit_date": "2026-05-10" }, { "mrn": "CHP-861319", "first_name": "Riley", "last_name": "Elzey", "dob": "2024-03-10", "sex": "F", "address": { "street": "2469 Camden Ave", "city": "Deal Island", "state": "MD", "zip": "21821", "county": "Somerset" }, "authorized_contact": { "name": "Aaliyah Elzey", "relationship": "Grandmother", "phone": "(410) 651-2143", "email": "aaliyah.elzey@outlook.com" }, "preferred_communication_method": "SMS", "preferred_language": "English", "preferred_pharmacy": "Harbor Pharmacy - Ocean City", "primary_care_provider": "Dr. Sarah Whitfield, MD", "insurance": "Maryland Medicaid (HealthChoice)", "allergies": "Tree nuts, eggs", "seen_dentist_last_6mo": true, "last_dental_visit_date": "2026-02-18" }, { "mrn": "CHP-880879", "first_name": "Isabella", "last_name": "Collins", "dob": "2026-07-04", "sex": "F", "address": { "street": "5546 Isabella St", "city": "Marion Station", "state": "MD", "zip": "21838", "county": "Somerset" }, "authorized_contact": { "name": "Sofia Collins", "relationship": "Mother", "phone": "(410) 208-4090", "email": "sofia.collins@yahoo.com" }, "preferred_communication_method": "Email", "preferred_language": "English", "preferred_pharmacy": "Walmart Pharmacy - Salisbury", "primary_care_provider": "Emily Carter, CRNP", "insurance": "Maryland Medicaid (HealthChoice)", "allergies": "Dairy (lactose intolerance)", "seen_dentist_last_6mo": false, "last_dental_visit_date": null }, { "mrn": "CHP-377896", "first_name": "Maya", "last_name": "Layfield", "dob": "2026-04-05", "sex": "F", "address": { "street": "2168 Pemberton Dr", "city": "Princess Anne", "state": "MD", "zip": "21853", "county": "Somerset" }, "authorized_contact": { "name": "Harper Layfield", "relationship": "Legal Guardian", "phone": "(410) 957-1251", "email": "harper.layfield@yahoo.com" }, "preferred_communication_method": "SMS", "preferred_language": "Portuguese", "preferred_pharmacy": "CVS Pharmacy - Salisbury (N Salisbury Blvd)", "primary_care_provider": "Dr. Kevin Okonkwo, MD", "insurance": "Self-pay / Uninsured", "allergies": "Shellfish", "seen_dentist_last_6mo": false, "last_dental_visit_date": null }, { "mrn": "CHP-274446", "first_name": "Leilani", "last_name": "Cordoba", "dob": "2007-12-05", "sex": "F", "address": { "street": "8842 Camden Ave", "city": "Willards", "state": "MD", "zip": "21874", "county": "Wicomico" }, "authorized_contact": { "name": "Isaiah Cordoba", "relationship": "Legal Guardian", "phone": "(410) 749-4846", "email": "isaiah.cordoba@outlook.com" }, "preferred_communication_method": "SMS", "preferred_language": "English", "preferred_pharmacy": "Peninsula Pharmacy - Princess Anne", "primary_care_provider": "Dr. Kevin Okonkwo, MD", "insurance": "Maryland Physicians Care", "allergies": "Bee stings", "seen_dentist_last_6mo": false, "last_dental_visit_date": null } ];

// ============================================================================ // Mock CHC Pediatrics CRM — single-file Val Town HTTP server // Paste this whole file into a new Val Town HTTP val and click Save/Run. // Val Town gives you a public URL like https://-.web.val.run // Each endpoint is that URL + a path, e.g. .../verify_identity // ============================================================================

const DEMO_EMAIL = "dlmoncri@gmail.com"; const DEMO_SMS = "(225) 329-9825";

const OFFICES = [ { id: "salisbury", name: "Salisbury Pediatrics", address: "106 Milford Street, Salisbury, MD 21801", lat: 38.36, lon: -75.60 }, { id: "pocomoke", name: "Pocomoke Pediatrics", address: "400 Market Street, Pocomoke City, MD 21851", lat: 38.07, lon: -75.57 }, { id: "crisfield", name: "Crisfield Pediatrics", address: "Somers Cove, Crisfield, MD 21817", lat: 37.98, lon: -75.85 }, ];

const ZIP_COORDS = { "21801": [38.36, -75.60], "21811": [38.34, -75.18], "21813": [38.42, -75.20], "21817": [37.98, -75.85], "21821": [38.16, -75.94], "21826": [38.32, -75.62], "21830": [38.42, -75.68], "21838": [38.03, -75.75], "21841": [38.23, -75.28], "21842": [38.34, -75.08], "21849": [38.40, -75.47], "21850": [38.39, -75.42], "21851": [38.07, -75.57], "21853": [38.20, -75.69], "21863": [38.18, -75.39], "21871": [38.13, -75.72], "21874": [38.40, -75.35], "21875": [38.45, -75.58], };

function haversineMi(a, b) { const R = 3958.8, toRad = (d) => (d * Math.PI) / 180; const dLat = toRad(b[0] - a[0]), dLon = toRad(b[1] - a[1]); const s = Math.sin(dLat / 2) ** 2 + Math.cos(toRad(a[0])) * Math.cos(toRad(b[0])) * Math.sin(dLon / 2) ** 2; return R * 2 * Math.atan2(Math.sqrt(s), Math.sqrt(1 - s)); } function officesByDistance(zip) { const coord = ZIP_COORDS[zip]; const ranked = OFFICES.map((o) => ({ ...o, miles: coord ? Math.round(haversineMi(coord, [o.lat, o.lon]) * 10) / 10 : null })); if (coord) ranked.sort((x, y) => x.miles - y.miles); return ranked; } function ageInfo(dob) { const b = new Date(dob), now = new Date(); let months = (now.getFullYear() - b.getFullYear()) * 12 + (now.getMonth() - b.getMonth()); if (now.getDate() < b.getDate()) months -= 1; const years = Math.floor(months / 12); let band; if (months < 3) band = "under_3_months"; else if (years < 3) band = "3mo_to_3yr"; else if (years < 12) band = "3_to_11"; else band = "12_plus"; return { months, years, band }; } const SAFETY_QUESTIONS = { under_3_months: ["Does the baby have ANY fever?", "Any trouble breathing or blue lips?", "Is the baby unusually sleepy or hard to wake?", "Is the baby feeding poorly?", "Any wet diapers today?"], "3mo_to_3yr": ["Any trouble breathing or blue lips?", "Does the child have a high fever?", "Is the child unusually sleepy or hard to wake?", "Any repeated vomiting?", "Signs of dehydration — no wet diapers or no tears?"], "3_to_11": ["Any trouble breathing?", "Fever with a stiff neck or a rash?", "Persistent vomiting or signs of dehydration?", "Any severe pain?"], "12_plus": ["Any trouble breathing or chest pain?", "Any fainting?", "Any severe pain?", "Persistent vomiting or signs of dehydration?", "(Privately, without judgment) Any thoughts of self-harm?"], }; const norm = (s) => (s || "").toString().trim().toLowerCase().replace(/\s+/g, " "); function findByNameDob(name, dob) { const full = norm(name); return patients.find((p) => norm(p.first_name + " " + p.last_name) === full && p.dob === (dob || "").trim()); } function publicPatient(p) { const a = ageInfo(p.dob); const offices = officesByDistance(p.address.zip); return { mrn: p.mrn, first_name: p.first_name, last_name: p.last_name, dob: p.dob, age_years: a.years, age_months: a.months, age_band: a.band, sex: p.sex, address: p.address, authorized_contact: p.authorized_contact, preferred_communication_method: p.preferred_communication_method, preferred_language: p.preferred_language, preferred_pharmacy: p.preferred_pharmacy, primary_care_provider: p.primary_care_provider, insurance: p.insurance, allergies: p.allergies, nearest_office: offices[0], offices_by_distance: offices, }; } function two(n){return String(n).padStart(2,"0");} function fmt(d){return d.getFullYear()+"-"+two(d.getMonth()+1)+"-"+two(d.getDate());} const DOW = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]; function availability(visit_type, providerName) { const isSameDayProvider = /CRNP|PA-C|NP|Nurse Practitioner/i.test(providerName || ""); const slots = []; const start = new Date(); const minOffset = /sick/i.test(visit_type || "") && isSameDayProvider ? 0 : 2; for (let i = minOffset; i <= minOffset + 6 && slots.length < 4; i++) { const d = new Date(start); d.setDate(start.getDate() + i); const dow = d.getDay(); if (dow === 0) continue; const times = i === 0 ? ["2:20 PM", "4:00 PM"] : ["9:00 AM", "10:30 AM", "3:00 PM"]; for (const t of times) { if (slots.length < 4) slots.push({ date: fmt(d), day: DOW[dow], time: t }); } } return slots; }

const routes = { "/verify_identity": (b) => { const { child_name, dob, authorized_contact_name } = b; const nameMatch = patients.find((p) => norm(p.first_name + " " + p.last_name) === norm(child_name)); const rec = findByNameDob(child_name, dob); if (!nameMatch && !rec) return { authenticated: false, mismatch: "name", message: "The child's name doesn't match any record on file." }; if (!rec) return { authenticated: false, mismatch: "dob", message: "The date of birth doesn't match what we have on file." }; if (norm(rec.authorized_contact.name) !== norm(authorized_contact_name)) return { authenticated: false, mismatch: "authorized_contact", message: "The authorized contact name doesn't match this account." }; return { authenticated: true, patient: publicPatient(rec) }; }, "/lookup_patient": (b) => { const rec = findByNameDob(b.name, b.dob) || patients.find((p) => p.mrn === (b.mrn || "").trim()); return rec ? { found: true, patient: publicPatient(rec) } : { found: false }; }, "/get_safety_questions": (b) => { const rec = findByNameDob(b.name, b.dob) || patients.find((p) => p.mrn === b.mrn); if (!rec) return { found: false }; const a = ageInfo(rec.dob); return { found: true, age_band: a.band, age_years: a.years, questions: SAFETY_QUESTIONS[a.band] }; }, "/nearest_office": (b) => { const rec = patients.find((p) => p.mrn === b.mrn) || findByNameDob(b.name, b.dob); const zip = (rec && rec.address.zip) || b.zip; if (!zip) return { found: false }; const offices = officesByDistance(zip); return { found: true, nearest_office: offices[0], offices_by_distance: offices }; }, "/check_availability": (b) => ({ slots: availability(b.visit_type, b.provider), note: "Physicians need 2 days' notice; NP/PA offer same/next-day sick visits." }), "/book_appointment": (b) => ({ confirmation_id: "CHC-" + Math.random().toString(36).slice(2, 8).toUpperCase(), status: "booked", patient_mrn: b.mrn || null, visit_type: b.visit_type, provider: b.provider, slot: b.slot, location: b.location }), "/get_last_dental_visit": (b) => { const rec = patients.find((p) => p.mrn === b.mrn) || findByNameDob(b.name, b.dob); if (!rec) return { found: false }; const a = ageInfo(rec.dob); const eligible = a.years >= 2; const overdue = eligible && !rec.seen_dentist_last_6mo; return { found: true, age_years: a.years, dental_eligible: eligible, seen_dentist_last_6mo: rec.seen_dentist_last_6mo, last_dental_visit_date: rec.last_dental_visit_date, suggest_dental: overdue, message: overdue ? ("It's been more than 6 months since " + rec.first_name + "'s last dental visit — offer to schedule dental.") : "No dental suggestion needed." }; }, "/send_confirmation": (b) => { const rec = patients.find((p) => p.mrn === b.mrn) || findByNameDob(b.name, b.dob); if (!rec) return { sent: false, error: "patient not found" }; const method = (rec.preferred_communication_method || "").toLowerCase(); const channel = method.includes("email") ? "email" : "sms"; const destination = channel === "email" ? DEMO_EMAIL : DEMO_SMS; return { sent: true, channel, destination, language: rec.preferred_language, preview: "[" + channel.toUpperCase() + " to " + destination + " in " + rec.preferred_language + "] " + rec.first_name + "'s " + (b.visit_type || "appointment") + " is confirmed for " + (b.slot || "the selected time") + " at " + (b.location || "your CHC office") + ". Reply to reschedule." }; }, "/log_call": (b) => ({ logged: true, disposition: b.disposition || "info-only", tags: b.tags || [], at: new Date().toISOString() }), };

const CORS = { "Content-Type": "application/json", "Access-Control-Allow-Origin": "", "Access-Control-Allow-Headers": "", "Access-Control-Allow-Methods": "POST, GET, OPTIONS" }; const json = (obj, status = 200) => new Response(JSON.stringify(obj), { status, headers: CORS });

export default async function handler(req) { if (req.method === "OPTIONS") return new Response(null, { status: 204, headers: CORS }); const path = new URL(req.url).pathname.replace(//+$/, "") || "/"; if (req.method === "GET" && path === "/") return json({ ok: true, patients: patients.length, endpoints: Object.keys(routes) }); if (req.method === "GET" && path === "/patients") return json(patients.map(publicPatient)); const fn = routes[path]; if (!fn) return json({ error: "not found", endpoints: Object.keys(routes) }, 404); let body = {}; try { body = await req.json(); } catch { body = {}; } try { return json(fn(body)); } catch (e) { return json({ error: String(e) }, 500); } }