{"id":5702,"date":"2025-10-10T22:20:07","date_gmt":"2025-10-10T22:20:07","guid":{"rendered":"https:\/\/kidsoverprofits.org\/staging\/?p=5702"},"modified":"2025-10-10T23:21:23","modified_gmt":"2025-10-10T23:21:23","slug":"data-organizer","status":"publish","type":"post","link":"https:\/\/kidsoverprofits.org\/staging\/data-organizer\/","title":{"rendered":"Data Organizer"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>Data Organizer &#8211; View by Data Point<\/title>\n    <style>\n        * {\n            margin: 0;\n            padding: 0;\n            box-sizing: border-box;\n        }\n        \n        body {\n            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;\n            line-height: 1.6;\n            color: #000435;\n            background: #f8f9fa;\n            padding: 20px;\n            min-height: 100vh;\n        }\n        \n        .container {\n            max-width: 1400px;\n            margin: 0 auto;\n            background: white;\n            border-radius: 8px;\n            box-shadow: 0 4px 16px rgba(0, 4, 53, 0.1);\n            overflow: hidden;\n        }\n        \n        .header {\n            background: #33a7b5;\n            color: white;\n            padding: 30px;\n            text-align: center;\n        }\n        \n        .header h1 {\n            font-size: 28px;\n            margin-bottom: 10px;\n            color: white;\n        }\n        \n        .header p {\n            font-size: 16px;\n            opacity: 0.9;\n        }\n        \n        .controls {\n            padding: 30px;\n            background: white;\n            border-bottom: 1px solid #b6e3d4;\n        }\n        \n        .control-group {\n            display: flex;\n            gap: 20px;\n            align-items: center;\n            flex-wrap: wrap;\n            margin-bottom: 20px;\n        }\n        \n        .control-label {\n            font-weight: 600;\n            color: #000435;\n            min-width: 120px;\n        }\n        \n        .control-input {\n            flex: 1;\n            min-width: 200px;\n        }\n        \n        select, input {\n            width: 100%;\n            padding: 12px;\n            border: 1px solid #d1d5db;\n            border-radius: 6px;\n            font-size: 14px;\n            background: white;\n            transition: all 0.3s ease;\n        }\n        \n        select:focus, input:focus {\n            outline: none;\n            border-color: #33a7b5;\n            box-shadow: 0 0 0 2px rgba(51, 167, 181, 0.2);\n        }\n        \n        .btn {\n            background: #ef9034;\n            color: white;\n            border: none;\n            padding: 12px 24px;\n            border-radius: 8px;\n            font-size: 14px;\n            font-weight: 600;\n            cursor: pointer;\n            transition: all 0.3s ease;\n        }\n        \n        .btn:hover {\n            background: #d67d2b;\n            transform: translateY(-1px);\n        }\n        \n        .btn-secondary {\n            background: #33a7b5;\n        }\n        \n        .btn-secondary:hover {\n            background: #2a8a96;\n        }\n        \n        .search-info {\n            background: #b6e3d4;\n            border: 1px solid #33a7b5;\n            border-radius: 8px;\n            padding: 15px;\n            margin-top: 20px;\n            font-size: 14px;\n            color: #000435;\n        }\n        \n        .results {\n            padding: 30px;\n        }\n        \n        .results-header {\n            display: flex;\n            justify-content: space-between;\n            align-items: center;\n            margin-bottom: 25px;\n            flex-wrap: wrap;\n            gap: 15px;\n        }\n        \n        .results-title {\n            font-size: 24px;\n            font-weight: 700;\n            color: #000435;\n        }\n        \n        .results-count {\n            background: #fff5cb;\n            color: #000435;\n            padding: 8px 16px;\n            border-radius: 20px;\n            font-size: 14px;\n            font-weight: 600;\n        }\n        \n        .facility-grid {\n            display: grid;\n            grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));\n            gap: 20px;\n        }\n        \n        .facility-card {\n            background: white;\n            border: 1px solid #e2e8f0;\n            border-radius: 8px;\n            padding: 20px;\n            transition: all 0.3s ease;\n            cursor: pointer;\n        }\n        \n        .facility-card:hover {\n            border-color: #33a7b5;\n            box-shadow: 0 4px 12px rgba(51, 167, 181, 0.15);\n            transform: translateY(-2px);\n        }\n        \n        .facility-name {\n            font-size: 18px;\n            font-weight: 700;\n            color: #000435;\n            margin-bottom: 10px;\n        }\n        \n        .facility-operator {\n            color: #33a7b5;\n            font-size: 14px;\n            margin-bottom: 15px;\n            font-weight: 600;\n        }\n        \n        .facility-details {\n            display: flex;\n            flex-direction: column;\n            gap: 8px;\n        }\n        \n        .detail-row {\n            display: flex;\n            justify-content: space-between;\n            align-items: flex-start;\n            font-size: 14px;\n        }\n        \n        .detail-label {\n            font-weight: 600;\n            color: #000435;\n            min-width: 80px;\n        }\n        \n        .detail-value {\n            color: #33a7b5;\n            text-align: right;\n            flex: 1;\n            margin-left: 10px;\n        }\n        \n        .highlight {\n            background: #fff5cb;\n            padding: 4px 8px;\n            border-radius: 4px;\n            font-weight: 600;\n            color: #000435;\n        }\n        \n        .no-results {\n            text-align: center;\n            padding: 60px 20px;\n            color: #6b7280;\n        }\n        \n        .no-results-icon {\n            font-size: 48px;\n            margin-bottom: 15px;\n            opacity: 0.5;\n        }\n        \n        .loading {\n            text-align: center;\n            padding: 60px 20px;\n            color: #6b7280;\n        }\n        \n        .loading-spinner {\n            display: inline-block;\n            width: 30px;\n            height: 30px;\n            border: 3px solid #b6e3d4;\n            border-top: 3px solid #33a7b5;\n            border-radius: 50%;\n            animation: spin 1s linear infinite;\n            margin-bottom: 15px;\n        }\n        \n        @keyframes spin {\n            0% { transform: rotate(0deg); }\n            100% { transform: rotate(360deg); }\n        }\n        \n        .modal {\n            display: none;\n            position: fixed;\n            z-index: 1000;\n            left: 0;\n            top: 0;\n            width: 100%;\n            height: 100%;\n            background-color: rgba(0, 0, 0, 0.5);\n        }\n        \n        .modal-content {\n            background-color: white;\n            margin: 5% auto;\n            padding: 0;\n            border-radius: 8px;\n            width: 90%;\n            max-width: 800px;\n            max-height: 80vh;\n            overflow-y: auto;\n            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);\n        }\n        \n        .modal-header {\n            background: #33a7b5;\n            color: white;\n            padding: 20px;\n            border-radius: 8px 8px 0 0;\n        }\n        \n        .modal-title {\n            font-size: 20px;\n            font-weight: 700;\n            margin: 0;\n        }\n        \n        .modal-body {\n            padding: 20px;\n            background: white;\n        }\n        \n        .modal-close {\n            float: right;\n            font-size: 24px;\n            font-weight: bold;\n            cursor: pointer;\n            color: rgba(255, 255, 255, 0.8);\n            margin-left: 15px;\n        }\n        \n        .modal-close:hover {\n            color: white;\n        }\n        \n        @media (max-width: 768px) {\n            .control-group {\n                flex-direction: column;\n                align-items: stretch;\n            }\n            \n            .control-label {\n                min-width: auto;\n            }\n            \n            .facility-grid {\n                grid-template-columns: 1fr;\n            }\n            \n            .results-header {\n                flex-direction: column;\n                align-items: stretch;\n            }\n        }\n    <\/style>\n<\/head>\n<body>\n    <div class=\"container\">\n        <div class=\"header\">\n            <h1><span class=\"ez-toc-section\" id=\"%F0%9F%93%8A-Facility-Data-Organizer\"><\/span>\ud83d\udcca Facility Data Organizer<span class=\"ez-toc-section-end\"><\/span><\/h1>\n            <p>Organize and explore facility data by any data point &#8211; staff members, operators, locations, and more<\/p>\n        <\/div>\n        \n        <div class=\"controls\">\n            <div class=\"control-group\">\n                <div class=\"control-label\">Organize by:<\/div>\n                <div class=\"control-input\">\n                    <select id=\"organizeBy\">\n                        <option value=\"\">Select data point&#8230;<\/option>\n                        <option value=\"staff\">Staff Member<\/option>\n                        <option value=\"operator\">Operator\/Company<\/option>\n                        <option value=\"location\">Location<\/option>\n                        <option value=\"programType\">Program Type<\/option>\n                        <option value=\"status\">Operating Status<\/option>\n                        <option value=\"year\">Opening Year<\/option>\n                        <option value=\"accreditation\">Accreditation<\/option>\n                        <option value=\"certification\">Certification<\/option>\n                    <\/select>\n                <\/div>\n            <\/div>\n            \n            <div class=\"control-group\" id=\"valueGroup\" style=\"display: none;\">\n                <div class=\"control-label\">Find entries with:<\/div>\n                <div class=\"control-input\">\n                    <select id=\"specificValue\">\n                        <option value=\"\">Select value&#8230;<\/option>\n                    <\/select>\n                <\/div>\n            <\/div>\n            \n            <div class=\"control-group\" id=\"searchGroup\" style=\"display: none;\">\n                <div class=\"control-label\">Or search:<\/div>\n                <div class=\"control-input\">\n                    <input type=\"text\" id=\"searchValue\" placeholder=\"Type to search...\">\n                <\/div>\n                <button class=\"btn\" id=\"searchBtn\">Search<\/button>\n            <\/div>\n            \n            <div class=\"search-info\" id=\"searchInfo\" style=\"display: none;\">\n                <strong>\ud83d\udca1 How it works:<\/strong> Select a data point type (like &#8220;Staff Member&#8221;), then choose a specific value or search for one. \n                The system will show all facilities that contain that data point, highlighting where it appears.\n            <\/div>\n        <\/div>\n        \n        <div class=\"results\">\n            <div id=\"loadingState\" class=\"loading\" style=\"display: none;\">\n                <div class=\"loading-spinner\"><\/div>\n                <div>Loading facility data&#8230;<\/div>\n            <\/div>\n            \n            <div id=\"noDataState\" class=\"no-results\">\n                <div class=\"no-results-icon\">\ud83d\udcc1<\/div>\n                <h3><span class=\"ez-toc-section\" id=\"Loading-Data%E2%80%A6\"><\/span>Loading Data&#8230;<span class=\"ez-toc-section-end\"><\/span><\/h3>\n                <p>Attempting to load facility data automatically. Please wait&#8230;<\/p>\n            <\/div>\n            \n            <div id=\"resultsContainer\" style=\"display: none;\">\n                <div class=\"results-header\">\n                    <div class=\"results-title\" id=\"resultsTitle\">Search Results<\/div>\n                    <div class=\"results-count\" id=\"resultsCount\">0 facilities<\/div>\n                <\/div>\n                \n                <div id=\"facilityGrid\" class=\"facility-grid\"><\/div>\n                \n                <div id=\"noResults\" class=\"no-results\" style=\"display: none;\">\n                    <div class=\"no-results-icon\">\ud83d\udd0d<\/div>\n                    <h3><span class=\"ez-toc-section\" id=\"No-matches-found\"><\/span>No matches found<span class=\"ez-toc-section-end\"><\/span><\/h3>\n                    <p>Try a different search term or data point.<\/p>\n                <\/div>\n            <\/div>\n        <\/div>\n    <\/div>\n    \n    <!-- Facility Detail Modal -->\n    <div id=\"facilityModal\" class=\"modal\">\n        <div class=\"modal-content\">\n            <div class=\"modal-header\">\n                <span class=\"modal-close\" id=\"modalClose\">&times;<\/span>\n                <h2 class=\"modal-title\" id=\"modalTitle\"><span class=\"ez-toc-section\" id=\"Facility-Details\"><\/span>Facility Details<span class=\"ez-toc-section-end\"><\/span><\/h2>\n            <\/div>\n            <div class=\"modal-body\" id=\"modalBody\">\n                <!-- Facility details will be loaded here -->\n            <\/div>\n        <\/div>\n    <\/div>\n    \n    <script>\n        \/\/ Global data storage\n        let allFacilities = [];\n        let currentResults = [];\n        let currentSearchType = '';\n        let currentSearchValue = '';\n        \n        \/\/ DOM elements\n        const organizeBySelect = document.getElementById('organizeBy');\n        const valueGroup = document.getElementById('valueGroup');\n        const specificValueSelect = document.getElementById('specificValue');\n        const searchGroup = document.getElementById('searchGroup');\n        const searchValueInput = document.getElementById('searchValue');\n        const searchBtn = document.getElementById('searchBtn');\n        const searchInfo = document.getElementById('searchInfo');\n        const loadingState = document.getElementById('loadingState');\n        const noDataState = document.getElementById('noDataState');\n        const resultsContainer = document.getElementById('resultsContainer');\n        const resultsTitle = document.getElementById('resultsTitle');\n        const resultsCount = document.getElementById('resultsCount');\n        const facilityGrid = document.getElementById('facilityGrid');\n        const noResults = document.getElementById('noResults');\n        const facilityModal = document.getElementById('facilityModal');\n        const modalClose = document.getElementById('modalClose');\n        const modalTitle = document.getElementById('modalTitle');\n        const modalBody = document.getElementById('modalBody');\n        \n        \/\/ Event listeners\n        organizeBySelect.addEventListener('change', handleOrganizeByChange);\n        specificValueSelect.addEventListener('change', handleSpecificValueChange);\n        searchBtn.addEventListener('click', handleSearch);\n        searchValueInput.addEventListener('keypress', (e) => {\n            if (e.key === 'Enter') handleSearch();\n        });\n        modalClose.addEventListener('click', () => facilityModal.style.display = 'none');\n        window.addEventListener('click', (e) => {\n            if (e.target === facilityModal) facilityModal.style.display = 'none';\n        });\n        \n        function handleOrganizeByChange() {\n            const value = organizeBySelect.value;\n            \n            if (!value) {\n                valueGroup.style.display = 'none';\n                searchGroup.style.display = 'none';\n                searchInfo.style.display = 'none';\n                return;\n            }\n            \n            searchInfo.style.display = 'block';\n            currentSearchType = value;\n            \n            \/\/ Populate specific values dropdown\n            populateSpecificValues(value);\n            valueGroup.style.display = 'block';\n            searchGroup.style.display = 'block';\n        }\n        \n        function populateSpecificValues(type) {\n            specificValueSelect.innerHTML = '<option value=\"\">Select value...<\/option>';\n            \n            if (allFacilities.length === 0) return;\n            \n            const values = new Set();\n            \n            allFacilities.forEach(facility => {\n                const dataPoints = extractDataPoints(facility, type);\n                dataPoints.forEach(point => {\n                    if (point && point.toString().trim() !== '') {\n                        values.add(point.toString().trim());\n                    }\n                });\n            });\n            \n            console.log(`Found ${values.size} unique ${type} values:`, Array.from(values));\n            \n            Array.from(values)\n                .sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()))\n                .forEach(value => {\n                    const option = document.createElement('option');\n                    option.value = value;\n                    option.textContent = value;\n                    specificValueSelect.appendChild(option);\n                });\n        }\n        \n        function extractDataPoints(facility, type) {\n            const points = [];\n            \n            switch (type) {\n                case 'staff':\n                    if (facility.staff) {\n                        if (facility.staff.administrator) {\n                            facility.staff.administrator.forEach(admin => {\n                                if (typeof admin === 'string') points.push(admin);\n                                else if (admin.name) points.push(admin.name);\n                            });\n                        }\n                        if (facility.staff.notableStaff) {\n                            facility.staff.notableStaff.forEach(staff => {\n                                if (typeof staff === 'string') points.push(staff);\n                                else if (staff.name) points.push(staff.name);\n                            });\n                        }\n                    }\n                    break;\n                    \n                case 'operator':\n                    if (facility.identification?.operator) {\n                        points.push(facility.identification.operator);\n                    }\n                    if (facility.otherOperators && Array.isArray(facility.otherOperators)) {\n                        facility.otherOperators.forEach(op => {\n                            if (typeof op === 'string' && op.trim()) {\n                                points.push(op.trim());\n                            }\n                        });\n                    }\n                    \/\/ Also check for alternative operator fields that might exist\n                    if (facility.operator) {\n                        points.push(facility.operator);\n                    }\n                    if (facility.operatedBy) {\n                        points.push(facility.operatedBy);\n                    }\n                    if (facility.company) {\n                        points.push(facility.company);\n                    }\n                    \/\/ Check in facilityDetails for operator info\n                    if (facility.facilityDetails?.operator) {\n                        points.push(facility.facilityDetails.operator);\n                    }\n                    if (facility.facilityDetails?.company) {\n                        points.push(facility.facilityDetails.company);\n                    }\n                    break;\n                    \n                case 'location':\n                    if (facility.location) points.push(facility.location);\n                    break;\n                    \n                case 'programType':\n                    if (facility.facilityDetails?.type) points.push(facility.facilityDetails.type);\n                    break;\n                    \n                case 'status':\n                    if (facility.operatingPeriod?.status) points.push(facility.operatingPeriod.status);\n                    break;\n                    \n                case 'year':\n                    if (facility.operatingPeriod?.startYear) points.push(facility.operatingPeriod.startYear.toString());\n                    break;\n                    \n                case 'accreditation':\n                    if (facility.accreditations) {\n                        if (facility.accreditations.current) {\n                            facility.accreditations.current.forEach(acc => points.push(acc));\n                        }\n                        if (facility.accreditations.past) {\n                            facility.accreditations.past.forEach(acc => points.push(acc));\n                        }\n                    }\n                    break;\n                    \n                case 'certification':\n                    if (facility.certifications) {\n                        facility.certifications.forEach(cert => points.push(cert));\n                    }\n                    break;\n            }\n            \n            return points.filter(p => p && p.toString().trim() !== '');\n        }\n        \n        function handleSpecificValueChange() {\n            const value = specificValueSelect.value;\n            if (value) {\n                currentSearchValue = value;\n                performSearch();\n            }\n        }\n        \n        function handleSearch() {\n            const value = searchValueInput.value.trim();\n            if (value && currentSearchType) {\n                currentSearchValue = value;\n                performSearch();\n            }\n        }\n        \n        function performSearch() {\n            if (!currentSearchType || !currentSearchValue) return;\n            \n            currentResults = [];\n            \n            console.log(`Searching for \"${currentSearchValue}\" in ${currentSearchType} across ${allFacilities.length} facilities`);\n            \n            allFacilities.forEach((facility, index) => {\n                const dataPoints = extractDataPoints(facility, currentSearchType);\n                const matches = dataPoints.filter(point => \n                    point && point.toLowerCase().includes(currentSearchValue.toLowerCase())\n                );\n                \n                if (matches.length > 0) {\n                    console.log(`Facility \"${facility.identification?.name || 'Unknown'}\" matches with:`, matches);\n                    currentResults.push({\n                        facility: facility,\n                        facilityIndex: index,\n                        matches: matches\n                    });\n                }\n            });\n            \n            console.log(`Found ${currentResults.length} matching facilities`);\n            displayResults();\n        }\n        \n        function displayResults() {\n            const searchTypeLabel = organizeBySelect.options[organizeBySelect.selectedIndex].text;\n            resultsTitle.textContent = `Facilities with ${searchTypeLabel}: \"${currentSearchValue}\"`;\n            resultsCount.textContent = `${currentResults.length} facilities`;\n            \n            if (currentResults.length === 0) {\n                facilityGrid.style.display = 'none';\n                noResults.style.display = 'block';\n            } else {\n                facilityGrid.style.display = 'grid';\n                noResults.style.display = 'none';\n                \n                facilityGrid.innerHTML = '';\n                \n                currentResults.forEach(result => {\n                    const card = createFacilityCard(result);\n                    facilityGrid.appendChild(card);\n                });\n            }\n            \n            resultsContainer.style.display = 'block';\n        }\n        \n        function createFacilityCard(result) {\n            const { facility, facilityIndex, matches } = result;\n            \n            const card = document.createElement('div');\n            card.className = 'facility-card';\n            card.addEventListener('click', () => showFacilityModal(facility, facilityIndex));\n            \n            const name = facility.identification?.name || 'Unnamed Facility';\n            const operator = facility.identification?.operator || 'Unknown Operator';\n            const location = facility.location || 'Unknown Location';\n            const status = facility.operatingPeriod?.status || 'Unknown Status';\n            const type = facility.facilityDetails?.type || 'Unknown Type';\n            const projectName = facility._projectName || 'Unknown Project';\n            const nestedProjectName = facility._nestedProjectName || '';\n            \n            const projectInfo = nestedProjectName ? `${projectName} \u2192 ${nestedProjectName}` : projectName;\n            \n            card.innerHTML = `\n                <div class=\"facility-name\">${escapeHtml(name)}<\/div>\n                <div class=\"facility-operator\">Operated by: ${escapeHtml(operator)}<\/div>\n                <div style=\"font-size: 12px; color: #9ca3af; margin-bottom: 10px; font-style: italic;\">\n                    Project: ${escapeHtml(projectInfo)}\n                <\/div>\n                <div class=\"facility-details\">\n                    <div class=\"detail-row\">\n                        <div class=\"detail-label\">Location:<\/div>\n                        <div class=\"detail-value\">${escapeHtml(location)}<\/div>\n                    <\/div>\n                    <div class=\"detail-row\">\n                        <div class=\"detail-label\">Type:<\/div>\n                        <div class=\"detail-value\">${escapeHtml(type)}<\/div>\n                    <\/div>\n                    <div class=\"detail-row\">\n                        <div class=\"detail-label\">Status:<\/div>\n                        <div class=\"detail-value\">${escapeHtml(status)}<\/div>\n                    <\/div>\n                    <div class=\"detail-row\">\n                        <div class=\"detail-label\">Matches:<\/div>\n                        <div class=\"detail-value\">\n                            ${matches.map(match => `<span class=\"highlight\">${escapeHtml(match)}<\/span>`).join(', ')}\n                        <\/div>\n                    <\/div>\n                <\/div>\n            `;\n            \n            return card;\n        }\n        \n        function showFacilityModal(facility, facilityIndex) {\n            const name = facility.identification?.name || 'Unnamed Facility';\n            modalTitle.textContent = `${name} (Facility #${facilityIndex + 1})`;\n            \n            modalBody.innerHTML = generateFacilityDetails(facility);\n            facilityModal.style.display = 'block';\n        }\n        \n        function generateFacilityDetails(facility) {\n            let html = '';\n            \n            \/\/ Basic Information\n            html += '<div style=\"margin-bottom: 20px;\">';\n            html += '<h3 style=\"color: #000435; margin-bottom: 10px; padding: 10px; background: #f8f9fa; border-left: 4px solid #33a7b5; border-radius: 4px;\"><span class=\"ez-toc-section\" id=\"%F0%9F%93%8B-Basic-Information\"><\/span>\ud83d\udccb Basic Information<span class=\"ez-toc-section-end\"><\/span><\/h3>';\n            \n            if (facility.identification) {\n                const id = facility.identification;\n                if (id.name) html += renderDetailRow('Facility Name', id.name);\n                if (id.operator) html += renderDetailRow('Operator', id.operator);\n                if (id.formerNames) html += renderDetailRow('Former Names', id.formerNames);\n            }\n            \n            if (facility.location) html += renderDetailRow('Location', facility.location);\n            if (facility.address) html += renderDetailRow('Address', facility.address.replace(\/\\n\/g, '<br>'));\n            \n            html += '<\/div>';\n            \n            \/\/ Operating Period\n            if (facility.operatingPeriod) {\n                html += '<div style=\"margin-bottom: 20px;\">';\n                html += '<h3 style=\"color: #000435; margin-bottom: 10px; padding: 10px; background: #f8f9fa; border-left: 4px solid #33a7b5; border-radius: 4px;\"><span class=\"ez-toc-section\" id=\"%F0%9F%93%85-Operating-Period\"><\/span>\ud83d\udcc5 Operating Period<span class=\"ez-toc-section-end\"><\/span><\/h3>';\n                \n                const op = facility.operatingPeriod;\n                if (op.startYear) html += renderDetailRow('Opened', op.startYear);\n                if (op.endYear) html += renderDetailRow('Closed', op.endYear);\n                if (op.status) html += renderDetailRow('Status', op.status);\n                if (op.yearsOfOperation) html += renderDetailRow('Years of Operation', op.yearsOfOperation);\n                \n                html += '<\/div>';\n            }\n            \n            \/\/ Staff\n            if (facility.staff) {\n                html += '<div style=\"margin-bottom: 20px;\">';\n                html += '<h3 style=\"color: #000435; margin-bottom: 10px; padding: 10px; background: #f8f9fa; border-left: 4px solid #33a7b5; border-radius: 4px;\"><span class=\"ez-toc-section\" id=\"%F0%9F%91%A5-Staff\"><\/span>\ud83d\udc65 Staff<span class=\"ez-toc-section-end\"><\/span><\/h3>';\n                \n                if (facility.staff.administrator && facility.staff.administrator.length > 0) {\n                    html += renderDetailRow('Administrators', facility.staff.administrator.join(', '));\n                }\n                if (facility.staff.notableStaff && facility.staff.notableStaff.length > 0) {\n                    html += renderDetailRow('Notable Staff', facility.staff.notableStaff.join(', '));\n                }\n                \n                html += '<\/div>';\n            }\n            \n            \/\/ Facility Details\n            if (facility.facilityDetails) {\n                html += '<div style=\"margin-bottom: 20px;\">';\n                html += '<h3 style=\"color: #000435; margin-bottom: 10px; padding: 10px; background: #f8f9fa; border-left: 4px solid #33a7b5; border-radius: 4px;\"><span class=\"ez-toc-section\" id=\"%F0%9F%8F%A2-Facility-Details\"><\/span>\ud83c\udfe2 Facility Details<span class=\"ez-toc-section-end\"><\/span><\/h3>';\n                \n                const fd = facility.facilityDetails;\n                if (fd.type) html += renderDetailRow('Program Type', fd.type);\n                if (fd.capacity) html += renderDetailRow('Capacity', fd.capacity);\n                if (fd.currentCensus) html += renderDetailRow('Current Census', fd.currentCensus);\n                if (fd.gender) html += renderDetailRow('Gender', fd.gender);\n                \n                if (fd.ageRange && (fd.ageRange.min || fd.ageRange.max)) {\n                    const ageRange = `${fd.ageRange.min || '?'} - ${fd.ageRange.max || '?'}`;\n                    html += renderDetailRow('Age Range', ageRange);\n                }\n                \n                html += '<\/div>';\n            }\n            \n            \/\/ Accreditations & Certifications\n            if (facility.accreditations || facility.certifications) {\n                html += '<div style=\"margin-bottom: 20px;\">';\n                html += '<h3 style=\"color: #000435; margin-bottom: 10px; padding: 10px; background: #f8f9fa; border-left: 4px solid #33a7b5; border-radius: 4px;\"><span class=\"ez-toc-section\" id=\"%F0%9F%8F%86-Accreditations-Certifications\"><\/span>\ud83c\udfc6 Accreditations & Certifications<span class=\"ez-toc-section-end\"><\/span><\/h3>';\n                \n                if (facility.accreditations) {\n                    if (facility.accreditations.current && facility.accreditations.current.length > 0) {\n                        html += renderDetailRow('Current Accreditations', facility.accreditations.current.join(', '));\n                    }\n                    if (facility.accreditations.past && facility.accreditations.past.length > 0) {\n                        html += renderDetailRow('Past Accreditations', facility.accreditations.past.join(', '));\n                    }\n                }\n                \n                if (facility.certifications && facility.certifications.length > 0) {\n                    html += renderDetailRow('Certifications', facility.certifications.join(', '));\n                }\n                \n                html += '<\/div>';\n            }\n            \n            return html;\n        }\n        \n        function renderDetailRow(label, value) {\n            if (!value) return '';\n            return `\n                <div style=\"display: flex; margin-bottom: 8px; border-bottom: 1px solid #e2e8f0; padding-bottom: 8px;\">\n                    <div style=\"font-weight: 600; color: #000435; min-width: 150px;\">${escapeHtml(label)}:<\/div>\n                    <div style=\"color: #33a7b5; flex: 1;\">${escapeHtml(value)}<\/div>\n                <\/div>\n            `;\n        }\n        \n        async function loadDataFromServer() {\n            loadingState.style.display = 'block';\n            noDataState.style.display = 'none';\n            resultsContainer.style.display = 'none';\n            \n            try {\n                \/\/ Use the same cloud URL as the main form\n                const cloudUrl = 'https:\/\/kidsoverprofits.org\/staging\/wp-content\/themes\/child\/api\/get-master-data.php';\n                console.log('\ud83d\udd04 Loading data from:', cloudUrl);\n                \n                const response = await fetch(cloudUrl);\n                \n                if (!response.ok) {\n                    throw new Error(`HTTP error! status: ${response.status}`);\n                }\n                \n                const contentType = response.headers.get('content-type');\n                if (!contentType || !contentType.includes('application\/json')) {\n                    const responseText = await response.text();\n                    console.error('Expected JSON but got:', responseText.substring(0, 500));\n                    throw new Error(`Expected JSON response but got ${contentType}`);\n                }\n                \n                const result = await response.json();\n                console.log('\ud83d\udce6 Raw API response:', result);\n                \n                if (!result.success) {\n                    throw new Error(result.error || 'API returned success: false');\n                }\n                \n                const projects = result.projects || {};\n                console.log('\ud83d\udcca Loaded projects:', Object.keys(projects).length, 'projects');\n                console.log('\ud83d\udccb Project names:', Object.keys(projects));\n                \n                \/\/ Process the projects data structure - same logic as main form\n                allFacilities = [];\n                \n                Object.keys(projects).forEach(projectName => {\n                    const project = projects[projectName];\n                    console.log(`Processing project: ${projectName}`, project);\n                    \n                    if (project && project.data) {\n                        \/\/ The project.data contains the actual facility data\n                        extractFacilitiesFromProjectData(project.data, projectName);\n                    }\n                });\n                \n                loadingState.style.display = 'none';\n                \n                console.log(`Total facilities extracted: ${allFacilities.length}`);\n                \n                if (allFacilities.length > 0) {\n                    showMessage(`\u2705 Loaded ${allFacilities.length} facilities from ${Object.keys(projects).length} projects!`, 'success');\n                    noDataState.style.display = 'none';\n                    \n                    \/\/ Re-populate dropdown if a type is selected\n                    if (currentSearchType) {\n                        populateSpecificValues(currentSearchType);\n                    }\n                } else {\n                    console.warn('No facilities found in any project data');\n                    showMessage('\u26a0\ufe0f No facility data found in projects. Use Debug Data button to see structure.', 'warning');\n                    noDataState.style.display = 'block';\n                }\n            } catch (error) {\n                console.error('Error loading data:', error);\n                loadingState.style.display = 'none';\n                \n                \/\/ Try local fallback\n                try {\n                    showMessage('\u26a0\ufe0f Trying local data source...', 'warning');\n                    const fallbackResponse = await fetch('get-master-data.php');\n                    \n                    if (fallbackResponse.ok) {\n                        const fallbackData = await fallbackResponse.json();\n                        console.log('Fallback data:', fallbackData);\n                        \n                        if (fallbackData.success && fallbackData.projects) {\n                            const localProjects = fallbackData.projects || {};\n                            allFacilities = [];\n                            \n                            Object.keys(localProjects).forEach(projectName => {\n                                const project = localProjects[projectName];\n                                if (project && project.data) {\n                                    extractFacilitiesFromProjectData(project.data, projectName);\n                                }\n                            });\n                            \n                            if (allFacilities.length > 0) {\n                                loadingState.style.display = 'none';\n                                showMessage(`\u2705 Loaded ${allFacilities.length} facilities from local source!`, 'success');\n                                if (currentSearchType) {\n                                    populateSpecificValues(currentSearchType);\n                                }\n                            } else {\n                                throw new Error('No facilities found in local data');\n                            }\n                        } else {\n                            throw new Error('Invalid local response');\n                        }\n                    } else {\n                        throw new Error('Local endpoint also failed');\n                    }\n                } catch (fallbackError) {\n                    console.error('Fallback also failed:', fallbackError);\n                    noDataState.style.display = 'block';\n                    \n                    \/\/ Update the no data state with helpful message\n                    const noDataIcon = document.querySelector('#noDataState .no-results-icon');\n                    const noDataTitle = document.querySelector('#noDataState h3');\n                    const noDataText = document.querySelector('#noDataState p');\n                    \n                    noDataIcon.textContent = '\u26a0\ufe0f';\n                    noDataTitle.textContent = 'Could Not Load Data';\n                    noDataText.innerHTML = `Unable to connect to server. Please check your connection and try refreshing the page.`;\n                    \n                    showMessage(`\u274c Auto-load failed. Please try refreshing the page.`, 'error');\n                }\n            }\n        }\n        \n        function extractFacilitiesFromProjectData(data, projectName) {\n            if (!data) return;\n            \n            \/\/ Handle different data structures that might be in project data\n            if (data.projects && typeof data.projects === 'object') {\n                \/\/ Nested projects structure\n                console.log(`Found nested projects in ${projectName}`);\n                Object.keys(data.projects).forEach(nestedProjectName => {\n                    const nestedProject = data.projects[nestedProjectName];\n                    if (nestedProject.facilities && Array.isArray(nestedProject.facilities)) {\n                        console.log(`Found ${nestedProject.facilities.length} facilities in nested project ${nestedProjectName}`);\n                        nestedProject.facilities.forEach(facility => {\n                            facility._projectName = projectName;\n                            facility._nestedProjectName = nestedProjectName;\n                            allFacilities.push(facility);\n                        });\n                    }\n                });\n            } else if (data.facilities && Array.isArray(data.facilities)) {\n                \/\/ Direct facilities array\n                console.log(`Found ${data.facilities.length} direct facilities in ${projectName}`);\n                data.facilities.forEach(facility => {\n                    facility._projectName = projectName;\n                    allFacilities.push(facility);\n                });\n            } else if (Array.isArray(data)) {\n                \/\/ Data itself is an array of facilities\n                console.log(`Found ${data.length} items in data array for ${projectName}`);\n                data.forEach(facility => {\n                    facility._projectName = projectName;\n                    allFacilities.push(facility);\n                });\n            } else if (typeof data === 'object') {\n                \/\/ Check if the data contains facility-like properties\n                if (data.identification || data.location || data.staff || data.facilityDetails) {\n                    console.log(`Treating data as single facility for ${projectName}`);\n                    data._projectName = projectName;\n                    allFacilities.push(data);\n                } else {\n                    \/\/ Search through sub-objects for facility-like data\n                    console.log(`Searching for facilities in sub-objects of ${projectName}`);\n                    Object.keys(data).forEach(key => {\n                        const subData = data[key];\n                        if (Array.isArray(subData)) {\n                            subData.forEach(item => {\n                                if (typeof item === 'object' && (item.identification || item.location || item.staff)) {\n                                    item._projectName = projectName;\n                                    item._subSection = key;\n                                    allFacilities.push(item);\n                                }\n                            });\n                        } else if (typeof subData === 'object' && (subData.identification || subData.location || subData.staff)) {\n                            subData._projectName = projectName;\n                            subData._subSection = key;\n                            allFacilities.push(subData);\n                        }\n                    });\n                }\n            }\n        }\n        \n        function showMessage(message, type) {\n            \/\/ Create or update a message display\n            let messageDiv = document.getElementById('messageDiv');\n            if (!messageDiv) {\n                messageDiv = document.createElement('div');\n                messageDiv.id = 'messageDiv';\n                messageDiv.style.cssText = `\n                    position: fixed;\n                    top: 20px;\n                    right: 20px;\n                    padding: 12px 20px;\n                    border-radius: 6px;\n                    font-weight: 600;\n                    z-index: 10000;\n                    max-width: 400px;\n                `;\n                document.body.appendChild(messageDiv);\n            }\n            \n            const colors = {\n                success: { bg: '#b6e3d4', border: '#33a7b5', text: '#000435' },\n                error: { bg: '#fe8088', border: '#ef9034', text: '#000435' },\n                warning: { bg: '#fff5cb', border: '#b2e102', text: '#000435' },\n                info: { bg: '#aee0ed', border: '#33a7b5', text: '#000435' }\n            };\n            \n            const color = colors[type] || colors.success;\n            messageDiv.style.backgroundColor = color.bg;\n            messageDiv.style.border = `1px solid ${color.border}`;\n            messageDiv.style.color = color.text;\n            messageDiv.textContent = message;\n            messageDiv.style.display = 'block';\n            \n            setTimeout(() => {\n                messageDiv.style.display = 'none';\n            }, 5000);\n        }\n        \n        async function debugDataLoading() {\n            console.log('=== DEBUG: Data Loading ===');\n            \n            try {\n                const response = await fetch('get-master-data.php');\n                console.log('Response status:', response.status, response.statusText);\n                \n                if (!response.ok) {\n                    console.error('HTTP Error:', response.status);\n                    alert(`HTTP Error: ${response.status} - ${response.statusText}\\n\\nMake sure you're running this through a web server (like XAMPP, WAMP, etc.) and not opening the HTML file directly.`);\n                    return;\n                }\n                \n                const data = await response.json();\n                console.log('Raw response data:', data);\n                \n                if (data.success && data.projects) {\n                    console.log('Projects found:', Object.keys(data.projects));\n                    \n                    let debugInfo = `SUCCESS! Found ${Object.keys(data.projects).length} projects:\\n\\n`;\n                    \n                    Object.keys(data.projects).forEach(projectName => {\n                        const project = data.projects[projectName];\n                        debugInfo += `PROJECT: \"${projectName}\"\\n`;\n                        debugInfo += `  - Has data: ${project.data ? 'YES' : 'NO'}\\n`;\n                        \n                        if (project.data) {\n                            debugInfo += `  - Data type: ${Array.isArray(project.data) ? 'Array' : typeof project.data}\\n`;\n                            \n                            if (Array.isArray(project.data)) {\n                                debugInfo += `  - Array length: ${project.data.length}\\n`;\n                            } else if (typeof project.data === 'object') {\n                                const keys = Object.keys(project.data);\n                                debugInfo += `  - Object keys: ${keys.join(', ')}\\n`;\n                                \n                                \/\/ Check for common structures\n                                if (project.data.projects) {\n                                    debugInfo += `  - Has nested projects: ${Object.keys(project.data.projects).length}\\n`;\n                                    Object.keys(project.data.projects).forEach(nestedName => {\n                                        const nested = project.data.projects[nestedName];\n                                        const facilityCount = nested.facilities ? nested.facilities.length : 0;\n                                        debugInfo += `    - \"${nestedName}\": ${facilityCount} facilities\\n`;\n                                    });\n                                } else if (project.data.facilities) {\n                                    debugInfo += `  - Direct facilities: ${project.data.facilities.length}\\n`;\n                                } else if (project.data.identification || project.data.location || project.data.staff) {\n                                    debugInfo += `  - Looks like single facility data\\n`;\n                                } else {\n                                    debugInfo += `  - Structure: ${keys.slice(0, 5).join(', ')}${keys.length > 5 ? '...' : ''}\\n`;\n                                }\n                            }\n                        }\n                        debugInfo += '\\n';\n                    });\n                    \n                    debugInfo += `\\nRAW DATA SAMPLE:\\n${JSON.stringify(data, null, 2).substring(0, 500)}...`;\n                    \n                    alert(debugInfo);\n                } else {\n                    console.error('Invalid response structure:', data);\n                    let errorMsg = `INVALID RESPONSE!\\n\\nExpected: {success: true, projects: {...}}\\n\\nActual response:\\n${JSON.stringify(data, null, 2)}`;\n                    alert(errorMsg);\n                }\n                \n            } catch (error) {\n                console.error('Debug error:', error);\n                let errorMsg = `DEBUG ERROR: ${error.message}\\n\\n`;\n                \n                if (error.message.includes('fetch')) {\n                    errorMsg += 'This usually means:\\n';\n                    errorMsg += '1. You\\'re opening the HTML file directly (use a web server)\\n';\n                    errorMsg += '2. The PHP file doesn\\'t exist\\n';\n                    errorMsg += '3. PHP is not running on your server\\n';\n                    errorMsg += '4. There\\'s a network\/CORS issue\\n\\n';\n                    errorMsg += 'Try accessing this page via http:\/\/localhost\/ instead of file:\/\/';\n                }\n                \n                alert(errorMsg);\n            }\n        }\n        \n        function loadTestData() {\n            \/\/ Create sample test data that matches the expected structure\n            const testData = {\n                success: true,\n                projects: {\n                    \"Test Project 1\": {\n                        name: \"Test Project 1\",\n                        data: {\n                            projects: {\n                                \"Sample Facilities\": {\n                                    facilities: [\n                                        {\n                                            identification: {\n                                                name: \"Peaceful Pines Treatment Center\",\n                                                operator: \"Healing Horizons LLC\",\n                                                formerNames: \"Pine Valley Center\"\n                                            },\n                                            location: \"Colorado Springs, CO\",\n                                            address: \"1234 Pine Valley Road\\nColorado Springs, CO 80906\",\n                                            operatingPeriod: {\n                                                startYear: \"2015\",\n                                                endYear: null,\n                                                status: \"Currently Operating\",\n                                                yearsOfOperation: \"9\"\n                                            },\n                                            staff: {\n                                                administrator: [\"Dr. Sarah Johnson\", \"Michael Thompson\"],\n                                                notableStaff: [\"Dr. Emily Wilson - Clinical Director\", \"James Parker - Program Director\"]\n                                            },\n                                            facilityDetails: {\n                                                type: \"Residential Treatment Center (RTC)\",\n                                                capacity: \"120\",\n                                                currentCensus: \"98\",\n                                                gender: \"Co-ed\",\n                                                ageRange: { min: \"12\", max: \"18\" }\n                                            },\n                                            accreditations: {\n                                                current: [\"JCAHO\", \"CARF\"],\n                                                past: [\"State Certification\"]\n                                            },\n                                            certifications: [\"Mental Health Certification\", \"Substance Abuse Treatment\"],\n                                            otherOperators: [\"Previous Owner: Mountain View Inc.\"]\n                                        },\n                                        {\n                                            identification: {\n                                                name: \"Sunrise Therapeutic Academy\",\n                                                operator: \"Educational Wellness Corp\",\n                                                formerNames: \"Desert View School\"\n                                            },\n                                            location: \"Phoenix, AZ\",\n                                            address: \"5678 Desert Road\\nPhoenix, AZ 85001\",\n                                            operatingPeriod: {\n                                                startYear: \"2010\",\n                                                endYear: \"2022\",\n                                                status: \"Closed\",\n                                                yearsOfOperation: \"12\"\n                                            },\n                                            staff: {\n                                                administrator: [\"Dr. Robert Martinez\"],\n                                                notableStaff: [\"Dr. Sarah Johnson - Former Director\", \"Lisa Chen - Therapist\"]\n                                            },\n                                            facilityDetails: {\n                                                type: \"Therapeutic Boarding School\",\n                                                capacity: \"80\",\n                                                currentCensus: \"0\",\n                                                gender: \"Boys Only\",\n                                                ageRange: { min: \"14\", max: \"18\" }\n                                            },\n                                            accreditations: {\n                                                current: [],\n                                                past: [\"JCAHO\", \"State License\"]\n                                            },\n                                            certifications: [\"Educational Certification\"],\n                                            otherOperators: []\n                                        },\n                                        {\n                                            identification: {\n                                                name: \"Mountain Ridge Wilderness Program\",\n                                                operator: \"Healing Horizons LLC\",\n                                                formerNames: null\n                                            },\n                                            location: \"Durango, CO\",\n                                            address: \"Remote Location\\nDurango, CO 81301\",\n                                            operatingPeriod: {\n                                                startYear: \"2018\",\n                                                endYear: null,\n                                                status: \"Currently Operating\",\n                                                yearsOfOperation: \"6\"\n                                            },\n                                            staff: {\n                                                administrator: [\"Michael Thompson\"],\n                                                notableStaff: [\"Dr. Emily Wilson - Consulting Psychologist\", \"David Rodriguez - Field Director\"]\n                                            },\n                                            facilityDetails: {\n                                                type: \"Wilderness Therapy Program\",\n                                                capacity: \"24\",\n                                                currentCensus: \"18\",\n                                                gender: \"Co-ed\",\n                                                ageRange: { min: \"13\", max: \"17\" }\n                                            },\n                                            accreditations: {\n                                                current: [\"NATSAP\"],\n                                                past: []\n                                            },\n                                            certifications: [\"Wilderness Therapy Certification\"],\n                                            otherOperators: []\n                                        }\n                                    ]\n                                }\n                            }\n                        }\n                    },\n                    \"Test Project 2\": {\n                        name: \"Test Project 2\",\n                        data: {\n                            projects: {\n                                \"Additional Facilities\": {\n                                    facilities: [\n                                        {\n                                            identification: {\n                                                name: \"Valley View Residential\",\n                                                operator: \"Comprehensive Care Systems\",\n                                                formerNames: \"Green Valley Treatment\"\n                                            },\n                                            location: \"Salt Lake City, UT\",\n                                            address: \"9876 Valley Drive\\nSalt Lake City, UT 84101\",\n                                            operatingPeriod: {\n                                                startYear: \"2012\",\n                                                endYear: null,\n                                                status: \"Currently Operating\",\n                                                yearsOfOperation: \"12\"\n                                            },\n                                            staff: {\n                                                administrator: [\"Dr. Patricia Adams\"],\n                                                notableStaff: [\"Dr. Sarah Johnson - Consultant\", \"Mark Stevens - Operations Director\"]\n                                            },\n                                            facilityDetails: {\n                                                type: \"Residential Treatment Center (RTC)\",\n                                                capacity: \"150\",\n                                                currentCensus: \"142\",\n                                                gender: \"Co-ed\",\n                                                ageRange: { min: \"11\", max: \"17\" }\n                                            },\n                                            accreditations: {\n                                                current: [\"JCAHO\", \"CARF\", \"State License\"],\n                                                past: []\n                                            },\n                                            certifications: [\"Mental Health Certification\", \"Educational Services\"],\n                                            otherOperators: [\"Former: Valley Healthcare Inc.\"]\n                                        }\n                                    ]\n                                }\n                            }\n                        }\n                    }\n                }\n            };\n            \n            \/\/ Process the test data using the same logic as loadDataFromServer\n            loadingState.style.display = 'block';\n            noDataState.style.display = 'none';\n            resultsContainer.style.display = 'none';\n            \n            setTimeout(() => {\n                try {\n                    allFacilities = [];\n                    \n                    Object.keys(testData.projects).forEach(projectName => {\n                        const project = testData.projects[projectName];\n                        \n                        if (project.data && project.data.projects) {\n                            Object.keys(project.data.projects).forEach(nestedProjectName => {\n                                const nestedProject = project.data.projects[nestedProjectName];\n                                if (nestedProject.facilities && Array.isArray(nestedProject.facilities)) {\n                                    nestedProject.facilities.forEach(facility => {\n                                        facility._projectName = projectName;\n                                        facility._nestedProjectName = nestedProjectName;\n                                        allFacilities.push(facility);\n                                    });\n                                }\n                            });\n                        }\n                    });\n                    \n                    loadingState.style.display = 'none';\n                    \n                    if (allFacilities.length > 0) {\n                        showMessage(`\u2705 Loaded ${allFacilities.length} test facilities from ${Object.keys(testData.projects).length} projects!`, 'success');\n                        noDataState.style.display = 'none';\n                        \n                        \/\/ Re-populate dropdown if a type is selected\n                        if (currentSearchType) {\n                            populateSpecificValues(currentSearchType);\n                        }\n                        \n                        \/\/ Show some helpful information\n                        setTimeout(() => {\n                            showMessage(`\ud83d\udca1 Try searching for \"Sarah Johnson\" under Staff Member to see cross-facility connections!`, 'info');\n                        }, 2000);\n                        \n                    } else {\n                        showMessage('\u26a0\ufe0f No test facility data generated', 'warning');\n                        noDataState.style.display = 'block';\n                    }\n                } catch (error) {\n                    console.error('Error processing test data:', error);\n                    loadingState.style.display = 'none';\n                    noDataState.style.display = 'block';\n                    showMessage(`\u274c Error processing test data: ${error.message}`, 'error');\n                }\n            }, 1000); \/\/ Simulate loading delay\n        }\n        \n        function escapeHtml(text) {\n            const div = document.createElement('div');\n            div.textContent = text;\n            return div.innerHTML;\n        }\n        \n        \/\/ Initialize\n        window.addEventListener('load', () => {\n            \/\/ Auto-load data when page loads\n            console.log('\ud83d\ude80 Data Organizer starting up...');\n            \n            \/\/ First check if there's already data in memory from the main form\n            if (window.allProjects) {\n                console.log('\ud83d\udccb Found existing data in memory');\n                \/\/ Process existing data\n                if (Array.isArray(window.allProjects)) {\n                    allFacilities = window.allProjects;\n                } else {\n                    allFacilities = Object.values(window.allProjects).flatMap(project => \n                        project.facilities || [project]\n                    );\n                }\n                \n                if (allFacilities.length > 0) {\n                    noDataState.style.display = 'none';\n                    showMessage(`\u2705 Loaded ${allFacilities.length} facilities from memory!`, 'success');\n                    return; \/\/ Exit early since we have data\n                }\n            }\n            \n            \/\/ If no data in memory, try to load from server automatically\n            console.log('\ud83d\udd04 No data in memory, attempting to load from server...');\n            loadDataFromServer();\n        });\n    <\/script>\n<\/body>\n<\/html>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-white ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #000000;color:#000000\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #000000;color:#000000\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/kidsoverprofits.org\/staging\/data-organizer\/#%F0%9F%93%8A-Facility-Data-Organizer\" >\ud83d\udcca Facility Data Organizer<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/kidsoverprofits.org\/staging\/data-organizer\/#Loading-Data%E2%80%A6\" >Loading Data&#8230;<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/kidsoverprofits.org\/staging\/data-organizer\/#No-matches-found\" >No matches found<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/kidsoverprofits.org\/staging\/data-organizer\/#Facility-Details\" >Facility Details<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/kidsoverprofits.org\/staging\/data-organizer\/#%F0%9F%93%8B-Basic-Information\" >\ud83d\udccb Basic Information<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/kidsoverprofits.org\/staging\/data-organizer\/#%F0%9F%93%85-Operating-Period\" >\ud83d\udcc5 Operating Period<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/kidsoverprofits.org\/staging\/data-organizer\/#%F0%9F%91%A5-Staff\" >\ud83d\udc65 Staff<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/kidsoverprofits.org\/staging\/data-organizer\/#%F0%9F%8F%A2-Facility-Details\" >\ud83c\udfe2 Facility Details<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/kidsoverprofits.org\/staging\/data-organizer\/#%F0%9F%8F%86-Accreditations-Certifications\" >\ud83c\udfc6 Accreditations & Certifications<\/a><\/li><\/ul><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Data Organizer &#8211; View by Data Point \ud83d\udcca Facility Data Organizer Organize and explore facility data by any data point &#8211; staff members, operators, locations, and more Organize by: Select data point&#8230;Staff MemberOperator\/CompanyLocationProgram TypeOperating StatusOpening YearAccreditationCertification Find entries with: Select value&#8230; Or search: Search \ud83d\udca1 How it works: Select a data point type (like &#8220;Staff&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_kadence_starter_templates_imported_post":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"categories":[194],"tags":[],"class_list":["post-5702","post","type-post","status-publish","format-standard","hentry","category-tools"],"acf":[],"mb":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Data Organizer - Staging<\/title>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Data Organizer - Staging\" \/>\n<meta property=\"og:description\" content=\"Data Organizer &#8211; View by Data Point \ud83d\udcca Facility Data Organizer Organize and explore facility data by any data point &#8211; staff members, operators, locations, and more Organize by: Select data point&#8230;Staff MemberOperator\/CompanyLocationProgram TypeOperating StatusOpening YearAccreditationCertification Find entries with: Select value&#8230; Or search: Search \ud83d\udca1 How it works: Select a data point type (like &#8220;Staff...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/kidsoverprofits.org\/staging\/data-organizer\/\" \/>\n<meta property=\"og:site_name\" content=\"Staging\" \/>\n<meta property=\"article:published_time\" content=\"2025-10-10T22:20:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-10-10T23:21:23+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/kidsoverprofits.org\\\/staging\\\/data-organizer\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/kidsoverprofits.org\\\/staging\\\/data-organizer\\\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\\\/\\\/kidsoverprofits.org\\\/staging\\\/#\\\/schema\\\/person\\\/7a611def9860ccf76762aa8bc9cb3760\"},\"headline\":\"Data Organizer\",\"datePublished\":\"2025-10-10T22:20:07+00:00\",\"dateModified\":\"2025-10-10T23:21:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/kidsoverprofits.org\\\/staging\\\/data-organizer\\\/\"},\"wordCount\":119,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/kidsoverprofits.org\\\/staging\\\/#organization\"},\"articleSection\":[\"Tools\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/kidsoverprofits.org\\\/staging\\\/data-organizer\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/kidsoverprofits.org\\\/staging\\\/data-organizer\\\/\",\"url\":\"https:\\\/\\\/kidsoverprofits.org\\\/staging\\\/data-organizer\\\/\",\"name\":\"Data Organizer - Staging\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/kidsoverprofits.org\\\/staging\\\/#website\"},\"datePublished\":\"2025-10-10T22:20:07+00:00\",\"dateModified\":\"2025-10-10T23:21:23+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/kidsoverprofits.org\\\/staging\\\/data-organizer\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/kidsoverprofits.org\\\/staging\\\/data-organizer\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/kidsoverprofits.org\\\/staging\\\/data-organizer\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/kidsoverprofits.org\\\/staging\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Data Organizer\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/kidsoverprofits.org\\\/staging\\\/#website\",\"url\":\"https:\\\/\\\/kidsoverprofits.org\\\/staging\\\/\",\"name\":\"Kids Over Profits\",\"description\":\"Survivor-led News and Education about the Troubled Teen Industry\",\"publisher\":{\"@id\":\"https:\\\/\\\/kidsoverprofits.org\\\/staging\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/kidsoverprofits.org\\\/staging\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/kidsoverprofits.org\\\/staging\\\/#organization\",\"name\":\"Kids Over Profits\",\"url\":\"https:\\\/\\\/kidsoverprofits.org\\\/staging\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/kidsoverprofits.org\\\/staging\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/kidsoverprofits.org\\\/staging\\\/wp-content\\\/uploads\\\/2025\\\/01\\\/kop-reddit-banner.jpg\",\"contentUrl\":\"https:\\\/\\\/kidsoverprofits.org\\\/staging\\\/wp-content\\\/uploads\\\/2025\\\/01\\\/kop-reddit-banner.jpg\",\"width\":851,\"height\":315,\"caption\":\"Kids Over Profits\"},\"image\":{\"@id\":\"https:\\\/\\\/kidsoverprofits.org\\\/staging\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/kidsoverprofits.org\\\/staging\\\/#\\\/schema\\\/person\\\/7a611def9860ccf76762aa8bc9cb3760\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/09ad8d15bd1e4a30c3d1a0c2defc68535905de7aca840a688f40e047581efb8e?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/09ad8d15bd1e4a30c3d1a0c2defc68535905de7aca840a688f40e047581efb8e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/09ad8d15bd1e4a30c3d1a0c2defc68535905de7aca840a688f40e047581efb8e?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"sameAs\":[\"https:\\\/\\\/kidsoverprofits.org\\\/staging\"],\"url\":\"https:\\\/\\\/kidsoverprofits.org\\\/staging\\\/author\\\/admin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Data Organizer - Staging","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_US","og_type":"article","og_title":"Data Organizer - Staging","og_description":"Data Organizer &#8211; View by Data Point \ud83d\udcca Facility Data Organizer Organize and explore facility data by any data point &#8211; staff members, operators, locations, and more Organize by: Select data point&#8230;Staff MemberOperator\/CompanyLocationProgram TypeOperating StatusOpening YearAccreditationCertification Find entries with: Select value&#8230; Or search: Search \ud83d\udca1 How it works: Select a data point type (like &#8220;Staff...","og_url":"https:\/\/kidsoverprofits.org\/staging\/data-organizer\/","og_site_name":"Staging","article_published_time":"2025-10-10T22:20:07+00:00","article_modified_time":"2025-10-10T23:21:23+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/kidsoverprofits.org\/staging\/data-organizer\/#article","isPartOf":{"@id":"https:\/\/kidsoverprofits.org\/staging\/data-organizer\/"},"author":{"name":"admin","@id":"https:\/\/kidsoverprofits.org\/staging\/#\/schema\/person\/7a611def9860ccf76762aa8bc9cb3760"},"headline":"Data Organizer","datePublished":"2025-10-10T22:20:07+00:00","dateModified":"2025-10-10T23:21:23+00:00","mainEntityOfPage":{"@id":"https:\/\/kidsoverprofits.org\/staging\/data-organizer\/"},"wordCount":119,"commentCount":0,"publisher":{"@id":"https:\/\/kidsoverprofits.org\/staging\/#organization"},"articleSection":["Tools"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/kidsoverprofits.org\/staging\/data-organizer\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/kidsoverprofits.org\/staging\/data-organizer\/","url":"https:\/\/kidsoverprofits.org\/staging\/data-organizer\/","name":"Data Organizer - Staging","isPartOf":{"@id":"https:\/\/kidsoverprofits.org\/staging\/#website"},"datePublished":"2025-10-10T22:20:07+00:00","dateModified":"2025-10-10T23:21:23+00:00","breadcrumb":{"@id":"https:\/\/kidsoverprofits.org\/staging\/data-organizer\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/kidsoverprofits.org\/staging\/data-organizer\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/kidsoverprofits.org\/staging\/data-organizer\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/kidsoverprofits.org\/staging\/"},{"@type":"ListItem","position":2,"name":"Data Organizer"}]},{"@type":"WebSite","@id":"https:\/\/kidsoverprofits.org\/staging\/#website","url":"https:\/\/kidsoverprofits.org\/staging\/","name":"Kids Over Profits","description":"Survivor-led News and Education about the Troubled Teen Industry","publisher":{"@id":"https:\/\/kidsoverprofits.org\/staging\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/kidsoverprofits.org\/staging\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/kidsoverprofits.org\/staging\/#organization","name":"Kids Over Profits","url":"https:\/\/kidsoverprofits.org\/staging\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/kidsoverprofits.org\/staging\/#\/schema\/logo\/image\/","url":"https:\/\/kidsoverprofits.org\/staging\/wp-content\/uploads\/2025\/01\/kop-reddit-banner.jpg","contentUrl":"https:\/\/kidsoverprofits.org\/staging\/wp-content\/uploads\/2025\/01\/kop-reddit-banner.jpg","width":851,"height":315,"caption":"Kids Over Profits"},"image":{"@id":"https:\/\/kidsoverprofits.org\/staging\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/kidsoverprofits.org\/staging\/#\/schema\/person\/7a611def9860ccf76762aa8bc9cb3760","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/09ad8d15bd1e4a30c3d1a0c2defc68535905de7aca840a688f40e047581efb8e?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/09ad8d15bd1e4a30c3d1a0c2defc68535905de7aca840a688f40e047581efb8e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/09ad8d15bd1e4a30c3d1a0c2defc68535905de7aca840a688f40e047581efb8e?s=96&d=mm&r=g","caption":"admin"},"sameAs":["https:\/\/kidsoverprofits.org\/staging"],"url":"https:\/\/kidsoverprofits.org\/staging\/author\/admin\/"}]}},"mfb_rest_fields":["title","yoast_head","yoast_head_json"],"_links":{"self":[{"href":"https:\/\/kidsoverprofits.org\/staging\/wp-json\/wp\/v2\/posts\/5702","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kidsoverprofits.org\/staging\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kidsoverprofits.org\/staging\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kidsoverprofits.org\/staging\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kidsoverprofits.org\/staging\/wp-json\/wp\/v2\/comments?post=5702"}],"version-history":[{"count":11,"href":"https:\/\/kidsoverprofits.org\/staging\/wp-json\/wp\/v2\/posts\/5702\/revisions"}],"predecessor-version":[{"id":5715,"href":"https:\/\/kidsoverprofits.org\/staging\/wp-json\/wp\/v2\/posts\/5702\/revisions\/5715"}],"wp:attachment":[{"href":"https:\/\/kidsoverprofits.org\/staging\/wp-json\/wp\/v2\/media?parent=5702"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kidsoverprofits.org\/staging\/wp-json\/wp\/v2\/categories?post=5702"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kidsoverprofits.org\/staging\/wp-json\/wp\/v2\/tags?post=5702"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}