{"id":721,"date":"2026-07-14T12:44:55","date_gmt":"2026-07-14T12:44:55","guid":{"rendered":"https:\/\/iwebsoul.in\/wp\/proctth\/?page_id=721"},"modified":"2026-08-13T11:32:02","modified_gmt":"2026-08-13T11:32:02","slug":"clinical-trials","status":"publish","type":"page","link":"https:\/\/iwebsoul.in\/wp\/proctth\/clinical-trials\/","title":{"rendered":"Clinical Trials Search"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"721\" class=\"elementor elementor-721\">\n\t\t\t\t<div class=\"elementor-element elementor-element-a352a86 bg-gradient-hero e-con-full e-flex e-con e-parent\" data-id=\"a352a86\" data-element_type=\"container\" data-e-type=\"container\" data-settings=\"{&quot;background_background&quot;:&quot;classic&quot;}\">\n\t\t<div class=\"elementor-element elementor-element-a8e0614 e-con-full e-flex e-con e-child\" data-id=\"a8e0614\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-412d6de elementor-widget__width-initial elementor-widget-divider--view-line elementor-widget elementor-widget-divider\" data-id=\"412d6de\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"divider.default\">\n\t\t\t\t\t\t\t<div class=\"elementor-divider\">\n\t\t\t<span class=\"elementor-divider-separator\">\n\t\t\t\t\t\t<\/span>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f565d2f elementor-widget__width-auto elementor-icon-list--layout-traditional elementor-list-item-link-full_width elementor-widget elementor-widget-icon-list\" data-id=\"f565d2f\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"icon-list.default\">\n\t\t\t\t\t\t\t<ul class=\"elementor-icon-list-items\">\n\t\t\t\t\t\t\t<li class=\"elementor-icon-list-item\">\n\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-icon-list-text\">Clinical Trials<\/span>\n\t\t\t\t\t\t\t\t\t<\/li>\n\t\t\t\t\t\t<\/ul>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-c6b1c2f e-con-full e-flex e-con e-child\" data-id=\"c6b1c2f\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-4c7891f elementor-widget__width-initial elementor-widget elementor-widget-heading\" data-id=\"4c7891f\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Search\n <span class=\"text-gradient-accent\"> ongoing studies. <\/span><\/h2>\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c6e85e1 elementor-widget elementor-widget-text-editor\" data-id=\"c6e85e1\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\tLive results from ClinicalTrials.gov \u2014 search active and recruiting trials by condition, phase, demographics, and location.\n\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9c8b10a elementor-widget__width-inherit elementor-widget elementor-widget-html\" data-id=\"9c8b10a\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t\t<style>\n    .border-border,\n    .border-border\\\/50 {\n        border-color: #c0d2d0b3;\n    }\n\n    .rounded-lg {\n        border-radius: 12px;\n    }\n\n    [type=button],\n    [type=submit],\n    button {\n        color: unset;\n    }\n\n    .filter-box-hidden {\n        display: none !important;\n    }\n\n    \/* Card Grid Layout *\/\n    .trials-grid {\n        display: grid;\n        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));\n        gap: 24px;\n        margin-top: 20px;\n    }\n\n    .trial-card {\n        background: #fff;\n        padding: 24px;\n        border-radius: 16px;\n        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);\n        transition: transform 0.2s ease, box-shadow 0.2s ease;\n        border: 1px solid #e8edec;\n        display: flex;\n        flex-direction: column;\n        height: 100%;\n    }\n\n    .trial-card:hover {\n        transform: translateY(-4px);\n        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);\n    }\n\n    .trial-card h3 {\n        font-size: 18px;\n        font-weight: 600;\n        color: #004d40;\n        margin-bottom: 12px;\n        line-height: 1.4;\n        min-height: 52px;\n    }\n\n    .trial-card .status-badge {\n        display: inline-block;\n        padding: 4px 12px;\n        background: #26a69a;\n        color: #fff;\n        border-radius: 20px;\n        font-size: 12px;\n        font-weight: 500;\n        letter-spacing: 0.3px;\n        margin-bottom: 12px;\n        align-self: flex-start;\n    }\n\n    .trial-card .status-badge.completed {\n        background: #4caf50;\n    }\n\n    .trial-card .status-badge.withdrawn {\n        background: #ef5350;\n    }\n\n    .trial-card .status-badge.unknown {\n        background: #ffa726;\n    }\n\n    .trial-card .status-badge.not_yet {\n        background: #42a5f5;\n    }\n\n    .trial-card .trial-details {\n        flex: 1;\n        margin-bottom: 16px;\n    }\n\n    .trial-card .trial-details p {\n        font-size: 14px;\n        color: #4b5e5a;\n        margin: 6px 0;\n        line-height: 1.5;\n    }\n\n    .trial-card .trial-details strong {\n        color: #004d40;\n        font-weight: 600;\n    }\n\n    .trial-card .trial-link {\n        color: #00897b;\n        text-decoration: none;\n        font-weight: 500;\n        font-size: 14px;\n        display: inline-flex;\n        align-items: center;\n        gap: 6px;\n        padding-top: 12px;\n        border-top: 1px solid #e8edec;\n        transition: color 0.2s ease;\n    }\n\n    .trial-card .trial-link:hover {\n        color: #004d40;\n    }\n\n    .trial-card .trial-link::after {\n        content: \"\u2192\";\n        transition: transform 0.2s ease;\n    }\n\n    .trial-card .trial-link:hover::after {\n        transform: translateX(4px);\n    }\n\n    \/* Results per page *\/\n    .results-controls {\n        display: flex;\n        align-items: center;\n        justify-content: space-between;\n        flex-wrap: wrap;\n        gap: 12px;\n        margin: 20px 0 16px;\n        padding: 12px 0;\n        border-bottom: 1px solid #e8edec;\n    }\n\n    .results-controls .results-count {\n        font-size: 14px;\n        color: #4b5e5a;\n    }\n\n    .results-controls .per-page-control {\n        display: flex;\n        align-items: center;\n        gap: 8px;\n    }\n\n    .results-controls .per-page-control label {\n        font-size: 14px;\n        color: #4b5e5a;\n    }\n\n    .results-controls .per-page-control select {\n        padding: 6px 12px;\n        border-radius: 8px;\n        border: 1px solid #c0d2d0b3;\n        background: #fff;\n        font-size: 14px;\n        cursor: pointer;\n        outline: none;\n    }\n\n    .results-controls .per-page-control select:focus {\n        border-color: #00897b;\n        box-shadow: 0 0 0 2px rgba(0, 137, 123, 0.1);\n    }\n\n    \/* Pagination *\/\n    .pagination {\n        display: flex;\n        justify-content: center;\n        align-items: center;\n        gap: 8px;\n        margin: 24px 0 12px;\n        flex-wrap: wrap;\n    }\n\n    .pagination button {\n        padding: 8px 16px;\n        border: 1px solid #c0d2d0b3;\n        border-radius: 8px;\n        background: #fff;\n        cursor: pointer;\n        font-size: 14px;\n        transition: all 0.2s ease;\n        color: #004d40;\n    }\n\n    .pagination button:hover:not(:disabled) {\n        background: #f5f8f7;\n        border-color: #00897b;\n    }\n\n    .pagination button:disabled {\n        opacity: 0.5;\n        cursor: not-allowed;\n    }\n\n    .pagination button.active {\n        background: #00897b;\n        color: #fff;\n        border-color: #00897b;\n    }\n\n    .pagination .page-info {\n        font-size: 14px;\n        color: #4b5e5a;\n        padding: 0 8px;\n    }\n\n    @media (max-width: 640px) {\n        .trials-grid {\n            grid-template-columns: 1fr;\n        }\n        \n        .results-controls {\n            flex-direction: column;\n            align-items: stretch;\n        }\n        \n        .trial-card h3 {\n            font-size: 16px;\n            min-height: auto;\n        }\n    }\n<\/style>\n\n<div class=\"mt-8 space-y-3 max-w-4xl animate-fade-up\" style=\"animation-delay: 0.1s;\">\n    <div class=\"flex flex-col sm:flex-row gap-3\">\n        <div class=\"relative flex-1\">\n            <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-search absolute left-4 top-1\/2 -translate-y-1\/2 h-4 w-4 text-muted-foreground\" aria-hidden=\"true\">\n                <path d=\"m21 21-4.34-4.34\"><\/path>\n                <circle cx=\"11\" cy=\"11\" r=\"8\"><\/circle>\n            <\/svg>\n            <input id=\"condition\" placeholder=\"Condition \u2014 e.g. breast cancer, diabetes, alzheimer's\u2026\" class=\"w-full pl-11 pr-4 py-3 rounded-lg bg-surface border border-border focus:outline-none focus:ring-2 focus:ring-ring text-sm\" value=\"\">\n        <\/div>\n        <button onmouseenter=\"this.style.backgroundColor='#fff'\"\n        onmouseleave=\"this.style.backgroundColor='transparent'\" style=\"display: flex; border: 1px solid #c0d2d0b3; border-radius: 15px; align-items: center; padding: 8px 16px;\" id=\"filterToggleBtn\" class=\"filter-toggle-btn\" type=\"button\">\n            <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-sliders-horizontal h-4 w-4\" aria-hidden=\"true\">\n                <path d=\"M10 5H3\"><\/path>\n                <path d=\"M12 19H3\"><\/path>\n                <path d=\"M14 3v4\"><\/path>\n                <path d=\"M16 17v4\"><\/path>\n                <path d=\"M21 12h-9\"><\/path>\n                <path d=\"M21 19h-5\"><\/path>\n                <path d=\"M21 5h-7\"><\/path>\n                <path d=\"M8 10v4\"><\/path>\n                <path d=\"M8 12H3\"><\/path>\n            <\/svg>\n            Filters\n        <\/button>\n        <button class=\"px-5 py-3 text-sm font-medium rounded-lg bg-gradient-accent text-primary-foreground hover:opacity-90 disabled:opacity-50 inline-flex items-center justify-center gap-2 shadow-glow\" style=\"color: #fff; border: 1px solid #fff;\" onclick=\"searchTrials()\">Search<\/button>\n    <\/div>\n\n    <!-- FILTERS (dynamic) -->\n    <div id=\"filterContainer\" class=\"grid sm:grid-cols-2 lg:grid-cols-4 gap-3 p-4 rounded-xl glass animate-fade-up filter-box-hidden\">\n        <!-- intervention -->\n        <div>\n            <label class=\"block text-xs font-mono uppercase tracking-wider text-muted-foreground mb-1.5\">Intervention<\/label>\n            <input id=\"filterIntervention\" placeholder=\"drug, device\u2026\" class=\"w-full px-3 py-2 rounded-md bg-surface border border-border text-sm focus:outline-none focus:ring-1 focus:ring-ring\" value=\"\">\n        <\/div>\n        <!-- Phase (dynamic from API) -->\n        <div>\n            <label class=\"block text-xs font-mono uppercase tracking-wider text-muted-foreground mb-1.5\">Phase<\/label>\n            <select id=\"filterPhase\" class=\"w-full px-3 py-2 rounded-md bg-surface border border-border text-sm focus:outline-none focus:ring-1 focus:ring-ring\">\n                <option value=\"\">Any<\/option>\n            <\/select>\n        <\/div>\n        <!-- Sex -->\n        <div>\n            <label class=\"block text-xs font-mono uppercase tracking-wider text-muted-foreground mb-1.5\">Sex<\/label>\n            <select id=\"filterSex\" class=\"w-full px-3 py-2 rounded-md bg-surface border border-border text-sm focus:outline-none focus:ring-1 focus:ring-ring\">\n                <option value=\"\">Any<\/option>\n                <option value=\"ALL\">All<\/option>\n                <option value=\"FEMALE\">Female<\/option>\n                <option value=\"MALE\">Male<\/option>\n            <\/select>\n        <\/div>\n        <!-- Country (dynamic) -->\n        <div>\n            <label class=\"block text-xs font-mono uppercase tracking-wider text-muted-foreground mb-1.5\">Country<\/label>\n            <select id=\"filterCountry\" class=\"w-full px-3 py-2 rounded-md bg-surface border border-border text-sm focus:outline-none focus:ring-1 focus:ring-ring\">\n                <option value=\"\">Any<\/option>\n            <\/select>\n        <\/div>\n    <\/div>\n<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-2172b45 e-flex e-con-boxed e-con e-parent\" data-id=\"2172b45\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-8f9f400 elementor-widget elementor-widget-html\" data-id=\"8f9f400\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t\t\n<!-- Results Controls (Results per page) -->\n<div id=\"resultsControls\" class=\"results-controls max-w-4xl\" style=\"display: none;\">\n    <div class=\"results-count\" id=\"resultsCount\">Showing 0 trials<\/div>\n    <div class=\"per-page-control\">\n        <label for=\"perPageSelect\">Results per page:<\/label>\n        <select id=\"perPageSelect\">\n            <option value=\"6\">6<\/option>\n            <option value=\"12\" selected>12<\/option>\n            <option value=\"24\">24<\/option>\n            <option value=\"48\">48<\/option>\n        <\/select>\n    <\/div>\n<\/div>\n\n<div id=\"results\"><\/div>\n<div id=\"paginationContainer\" class=\"pagination max-w-4xl\" style=\"display: none;\"><\/div>\n\n<script>\n    (function () {\n        \"use strict\";\n\n        \/\/ ---------- DOM refs ----------\n        const conditionInput = document.getElementById('condition');\n        const filterBox = document.getElementById('filterContainer');\n        const filterToggle = document.getElementById('filterToggleBtn');\n\n        const filterIntervention = document.getElementById('filterIntervention');\n        const filterPhase = document.getElementById('filterPhase');\n        const filterSex = document.getElementById('filterSex');\n        const filterCountry = document.getElementById('filterCountry');\n\n        const resultsDiv = document.getElementById('results');\n        const resultsControls = document.getElementById('resultsControls');\n        const resultsCount = document.getElementById('resultsCount');\n        const paginationContainer = document.getElementById('paginationContainer');\n        const perPageSelect = document.getElementById('perPageSelect');\n\n        \/\/ ---------- State ----------\n        let allFilteredStudies = [];\n        let currentPage = 1;\n        let itemsPerPage = 12;\n\n        \/\/ ---------- All Countries List ----------\n        const allCountries = [\n            \"Afghanistan\", \"Albania\", \"Algeria\", \"Andorra\", \"Angola\", \"Antigua and Barbuda\",\n            \"Argentina\", \"Armenia\", \"Australia\", \"Austria\", \"Azerbaijan\", \"Bahamas\", \"Bahrain\",\n            \"Bangladesh\", \"Barbados\", \"Belarus\", \"Belgium\", \"Belize\", \"Benin\", \"Bhutan\",\n            \"Bolivia\", \"Bosnia and Herzegovina\", \"Botswana\", \"Brazil\", \"Brunei\", \"Bulgaria\",\n            \"Burkina Faso\", \"Burundi\", \"Cabo Verde\", \"Cambodia\", \"Cameroon\", \"Canada\",\n            \"Central African Republic\", \"Chad\", \"Chile\", \"China\", \"Colombia\", \"Comoros\",\n            \"Congo\", \"Costa Rica\", \"Croatia\", \"Cuba\", \"Cyprus\", \"Czech Republic\",\n            \"Denmark\", \"Djibouti\", \"Dominica\", \"Dominican Republic\", \"Ecuador\", \"Egypt\",\n            \"El Salvador\", \"Equatorial Guinea\", \"Eritrea\", \"Estonia\", \"Eswatini\", \"Ethiopia\",\n            \"Fiji\", \"Finland\", \"France\", \"Gabon\", \"Gambia\", \"Georgia\", \"Germany\", \"Ghana\",\n            \"Greece\", \"Grenada\", \"Guatemala\", \"Guinea\", \"Guinea-Bissau\", \"Guyana\", \"Haiti\",\n            \"Honduras\", \"Hungary\", \"Iceland\", \"India\", \"Indonesia\", \"Iran\", \"Iraq\", \"Ireland\",\n            \"Israel\", \"Italy\", \"Jamaica\", \"Japan\", \"Jordan\", \"Kazakhstan\", \"Kenya\", \"Kiribati\",\n            \"Korea\", \"Kuwait\", \"Kyrgyzstan\", \"Laos\", \"Latvia\", \"Lebanon\", \"Lesotho\", \"Liberia\",\n            \"Libya\", \"Liechtenstein\", \"Lithuania\", \"Luxembourg\", \"Madagascar\", \"Malawi\",\n            \"Malaysia\", \"Maldives\", \"Mali\", \"Malta\", \"Marshall Islands\", \"Mauritania\",\n            \"Mauritius\", \"Mexico\", \"Micronesia\", \"Moldova\", \"Monaco\", \"Mongolia\", \"Montenegro\",\n            \"Morocco\", \"Mozambique\", \"Myanmar\", \"Namibia\", \"Nauru\", \"Nepal\", \"Netherlands\",\n            \"New Zealand\", \"Nicaragua\", \"Niger\", \"Nigeria\", \"North Macedonia\", \"Norway\",\n            \"Oman\", \"Pakistan\", \"Palau\", \"Palestine\", \"Panama\", \"Papua New Guinea\", \"Paraguay\",\n            \"Peru\", \"Philippines\", \"Poland\", \"Portugal\", \"Qatar\", \"Romania\", \"Russia\",\n            \"Rwanda\", \"Saint Kitts and Nevis\", \"Saint Lucia\", \"Saint Vincent and the Grenadines\",\n            \"Samoa\", \"San Marino\", \"Sao Tome and Principe\", \"Saudi Arabia\", \"Senegal\",\n            \"Serbia\", \"Seychelles\", \"Sierra Leone\", \"Singapore\", \"Slovakia\", \"Slovenia\",\n            \"Solomon Islands\", \"Somalia\", \"South Africa\", \"South Sudan\", \"Spain\", \"Sri Lanka\",\n            \"Sudan\", \"Suriname\", \"Sweden\", \"Switzerland\", \"Syria\", \"Taiwan\", \"Tajikistan\",\n            \"Tanzania\", \"Thailand\", \"Timor-Leste\", \"Togo\", \"Tonga\", \"Trinidad and Tobago\",\n            \"Tunisia\", \"Turkey\", \"Turkmenistan\", \"Tuvalu\", \"Uganda\", \"Ukraine\",\n            \"United Arab Emirates\", \"United Kingdom\", \"United States\", \"Uruguay\", \"Uzbekistan\",\n            \"Vanuatu\", \"Vatican City\", \"Venezuela\", \"Vietnam\", \"Yemen\", \"Zambia\", \"Zimbabwe\"\n        ];\n\n        \/\/ ---------- Populate country dropdown with all countries ----------\n        function populateAllCountries() {\n            const countrySelect = filterCountry;\n            countrySelect.innerHTML = '<option value=\"\">Any<\/option>';\n            allCountries.sort().forEach(c => {\n                const opt = document.createElement('option');\n                opt.value = c;\n                opt.textContent = c;\n                countrySelect.appendChild(opt);\n            });\n        }\n        populateAllCountries();\n\n        \/\/ ---------- toggle filter visibility ----------\n        filterToggle.addEventListener('click', function () {\n            filterBox.classList.toggle('filter-box-hidden');\n        });\n\n        \/\/ ---------- populate dynamic filters from API data (phase only) ----------\n        async function fetchAndPopulateFilters() {\n            try {\n                const keyword = conditionInput.value.trim() || 'cancer';\n                const url = `https:\/\/clinicaltrials.gov\/api\/v2\/studies?query.cond=${encodeURIComponent(keyword)}&pageSize=30`;\n                const resp = await fetch(url);\n                if (!resp.ok) throw new Error('API error');\n                const data = await resp.json();\n                const studies = data.studies || [];\n\n                \/\/ collect phases only (countries are already pre-populated)\n                const phaseSet = new Set();\n                studies.forEach(study => {\n                    const protocol = study.protocolSection;\n                    const phases = protocol?.designModule?.phases || [];\n                    phases.forEach(p => {\n                        if (p && p !== 'NA' && p !== '') phaseSet.add(p);\n                    });\n                });\n\n                \/\/ populate phase select\n                const phaseSelect = filterPhase;\n                const currentPhaseVal = phaseSelect.value;\n                phaseSelect.innerHTML = '<option value=\"\">Any<\/option>';\n                const sortedPhases = Array.from(phaseSet).sort();\n                sortedPhases.forEach(ph => {\n                    const opt = document.createElement('option');\n                    opt.value = ph;\n                    opt.textContent = ph;\n                    phaseSelect.appendChild(opt);\n                });\n                if ([...phaseSelect.options].some(o => o.value === currentPhaseVal)) {\n                    phaseSelect.value = currentPhaseVal;\n                }\n\n            } catch (e) {\n                console.warn('Filter population skipped:', e);\n            }\n        }\n\n        \/\/ initial load with 'cancer'\n        conditionInput.value = 'cancer';\n        fetchAndPopulateFilters();\n\n        \/\/ ---------- searchTrials (enhanced with filters) ----------\n        window.searchTrials = async function () {\n            const keyword = conditionInput.value.trim();\n            if (!keyword) {\n                alert('Please enter a condition.');\n                return;\n            }\n\n            \/\/ read filter values\n            const interventionFilter = filterIntervention.value.trim().toLowerCase();\n            const phaseFilter = filterPhase.value;\n            const sexFilter = filterSex.value;\n            const countryFilter = filterCountry.value;\n\n            try {\n                const url = `https:\/\/clinicaltrials.gov\/api\/v2\/studies?query.cond=${encodeURIComponent(keyword)}&pageSize=100`;\n                const response = await fetch(url);\n                if (!response.ok) throw new Error('Network response was not ok');\n                const data = await response.json();\n                const studies = data.studies || [];\n\n                \/\/ ----- apply filters (client-side) -----\n                let filtered = studies.filter(study => {\n                    const protocol = study.protocolSection;\n                    if (!protocol) return false;\n\n                    \/\/ 1. intervention\n                    if (interventionFilter) {\n                        const interventions = protocol.armsInterventionsModule?.interventions || [];\n                        const matchIntervention = interventions.some(iv => {\n                            const name = (iv.name || '').toLowerCase();\n                            const desc = (iv.description || '').toLowerCase();\n                            return name.includes(interventionFilter) || desc.includes(interventionFilter);\n                        });\n                        if (!matchIntervention) return false;\n                    }\n\n                    \/\/ 2. phase\n                    if (phaseFilter) {\n                        const phases = protocol.designModule?.phases || [];\n                        if (!phases.includes(phaseFilter)) return false;\n                    }\n\n                    \/\/ 3. sex\n                    if (sexFilter) {\n                        const sex = protocol.eligibilityModule?.sex || '';\n                        if (sex !== sexFilter) return false;\n                    }\n\n                    \/\/ 4. country\n                    if (countryFilter) {\n                        const locations = protocol.contactsLocationsModule?.locations || [];\n                        const hasCountry = locations.some(loc => loc.country === countryFilter);\n                        if (!hasCountry) return false;\n                    }\n\n                    return true;\n                });\n\n                \/\/ Store all filtered results\n                allFilteredStudies = filtered;\n                currentPage = 1;\n\n                \/\/ Show controls\n                resultsControls.style.display = 'flex';\n\n                \/\/ Render first page\n                renderPage();\n\n                \/\/ Update phase filters based on current results\n                populateFiltersFromData(data);\n\n            } catch (error) {\n                console.error('Search error:', error);\n                resultsDiv.innerHTML = `<div class=\"trial-card\" style=\"color:#b00020; border-color: #b00020;\">Error loading trials. Please try again.<\/div>`;\n                resultsControls.style.display = 'none';\n                paginationContainer.style.display = 'none';\n            }\n        };\n\n        \/\/ ---------- Render current page ----------\n        function renderPage() {\n            const startIndex = (currentPage - 1) * itemsPerPage;\n            const endIndex = Math.min(startIndex + itemsPerPage, allFilteredStudies.length);\n            const pageItems = allFilteredStudies.slice(startIndex, endIndex);\n\n            renderResults(pageItems);\n            updateResultsCount();\n            renderPagination();\n        }\n\n        \/\/ ---------- Update results count ----------\n        function updateResultsCount() {\n            const total = allFilteredStudies.length;\n            const start = (currentPage - 1) * itemsPerPage + 1;\n            const end = Math.min(currentPage * itemsPerPage, total);\n\n            if (total === 0) {\n                resultsCount.textContent = 'Showing 0 trials';\n            } else {\n                resultsCount.textContent = `Showing ${start}\u2013${end} of ${total} trials`;\n            }\n        }\n\n        \/\/ ---------- Render pagination ----------\n        function renderPagination() {\n            const totalPages = Math.ceil(allFilteredStudies.length \/ itemsPerPage);\n\n            if (totalPages <= 1) {\n                paginationContainer.style.display = 'none';\n                return;\n            }\n\n            paginationContainer.style.display = 'flex';\n\n            let html = '';\n\n            \/\/ Previous button\n            html += `<button onclick=\"goToPage(${currentPage - 1})\" ${currentPage === 1 ? 'disabled' : ''}>\u2190 Previous<\/button>`;\n\n            \/\/ Page numbers\n            const maxVisiblePages = 5;\n            let startPage = Math.max(1, currentPage - Math.floor(maxVisiblePages \/ 2));\n            let endPage = Math.min(totalPages, startPage + maxVisiblePages - 1);\n\n            if (endPage - startPage < maxVisiblePages - 1) {\n                startPage = Math.max(1, endPage - maxVisiblePages + 1);\n            }\n\n            if (startPage > 1) {\n                html += `<button onclick=\"goToPage(1)\">1<\/button>`;\n                if (startPage > 2) html += `<span class=\"page-info\">\u2026<\/span>`;\n            }\n\n            for (let i = startPage; i <= endPage; i++) {\n                html += `<button onclick=\"goToPage(${i})\" class=\"${i === currentPage ? 'active' : ''}\">${i}<\/button>`;\n            }\n\n            if (endPage < totalPages) {\n                if (endPage < totalPages - 1) html += `<span class=\"page-info\">\u2026<\/span>`;\n                html += `<button onclick=\"goToPage(${totalPages})\">${totalPages}<\/button>`;\n            }\n\n            \/\/ Next button\n            html += `<button onclick=\"goToPage(${currentPage + 1})\" ${currentPage === totalPages ? 'disabled' : ''}>Next \u2192<\/button>`;\n\n            paginationContainer.innerHTML = html;\n        }\n\n        \/\/ ---------- Go to page ----------\n        window.goToPage = function (page) {\n            const totalPages = Math.ceil(allFilteredStudies.length \/ itemsPerPage);\n            if (page < 1 || page > totalPages) return;\n            currentPage = page;\n            renderPage();\n            \/\/ Scroll to results\n            document.getElementById('results').scrollIntoView({ behavior: 'smooth', block: 'start' });\n        };\n\n        \/\/ ---------- Per page change ----------\n        perPageSelect.addEventListener('change', function () {\n            itemsPerPage = parseInt(this.value);\n            currentPage = 1;\n            renderPage();\n        });\n\n        \/\/ ---------- helper to populate filters from a data object (phases only) ----------\n        function populateFiltersFromData(data) {\n            const studies = data.studies || [];\n            const phaseSet = new Set();\n\n            studies.forEach(study => {\n                const protocol = study.protocolSection;\n                if (!protocol) return;\n                const phases = protocol.designModule?.phases || [];\n                phases.forEach(p => {\n                    if (p && p !== 'NA' && p !== '') phaseSet.add(p);\n                });\n            });\n\n            \/\/ update phase\n            const phaseSelect = filterPhase;\n            const currentPhase = phaseSelect.value;\n            phaseSelect.innerHTML = '<option value=\"\">Any<\/option>';\n            Array.from(phaseSet).sort().forEach(ph => {\n                const opt = document.createElement('option');\n                opt.value = ph;\n                opt.textContent = ph;\n                phaseSelect.appendChild(opt);\n            });\n            if ([...phaseSelect.options].some(o => o.value === currentPhase)) {\n                phaseSelect.value = currentPhase;\n            }\n        }\n\n        \/\/ ---------- render results (card grid layout) ----------\n        \/\/ ---------- render results (card grid layout) ----------\n        function renderResults(studies) {\n            if (!studies || studies.length === 0) {\n                resultsDiv.innerHTML = `<div class=\"trial-card\"><h3>No trials found<\/h3><p style=\"color: #4b5e5a;\">Try adjusting your filters or search term.<\/p><\/div>`;\n                return;\n            }\n\n            let html = '<div class=\"trials-grid\">';\n            studies.forEach(study => {\n                const protocol = study.protocolSection;\n                if (!protocol) return;\n                const title = protocol.identificationModule?.briefTitle || 'No Title';\n                const statusRaw = protocol.statusModule?.overallStatus || 'N\/A';\n                const statusDisplay = statusRaw.replace(\/_\/g, ' ').toUpperCase();\n                let statusClass = 'status-badge';\n                if (statusRaw.toLowerCase().includes('withdrawn')) statusClass += ' withdrawn';\n                else if (statusRaw.toLowerCase().includes('completed')) statusClass += ' completed';\n                else if (statusRaw.toLowerCase().includes('unknown')) statusClass += ' unknown';\n                else if (statusRaw.toLowerCase().includes('not_yet')) statusClass += ' not_yet';\n\n                const phases = protocol.designModule?.phases || ['N\/A'];\n                const phaseDisplay = phases.join(', ') || 'N\/A';\n                const sponsor = protocol.sponsorCollaboratorsModule?.leadSponsor?.name || 'N\/A';\n                const nct = protocol.identificationModule?.nctId || '';\n\n                \/\/ Get locations and remove duplicate countries\n                const locations = protocol.contactsLocationsModule?.locations || [];\n                const countrySet = new Set();\n                locations.forEach(loc => {\n                    if (loc.country) countrySet.add(loc.country);\n                });\n                const uniqueCountries = Array.from(countrySet).join(', ') || 'N\/A';\n\n                html += `\n            <div class=\"trial-card\">\n                <h3>${title}<\/h3>\n                <div class=\"${statusClass}\">${statusDisplay}<\/div>\n                <div class=\"trial-details\">\n                    <p><strong>Phase:<\/strong> ${phaseDisplay}<\/p>\n                    <p><strong>Sponsor:<\/strong> ${sponsor}<\/p>\n                    <p><strong>Countries:<\/strong> ${uniqueCountries}<\/p>\n                    <p><strong>NCT ID:<\/strong> ${nct}<\/p>\n                <\/div>\n                <a class=\"trial-link\" target=\"_blank\" href=\"https:\/\/clinicaltrials.gov\/study\/${nct}\">View Trial<\/a>\n            <\/div>\n        `;\n            });\n            html += '<\/div>';\n            resultsDiv.innerHTML = html;\n        }\n\n        \/\/ on page load, do a default search so results show\n        setTimeout(() => {\n            window.searchTrials();\n        }, 300);\n\n        \/\/ also if user presses Enter in condition field\n        conditionInput.addEventListener('keydown', (e) => {\n            if (e.key === 'Enter') {\n                e.preventDefault();\n                window.searchTrials();\n            }\n        });\n\n        console.log('Clinical trials search ready. Use searchTrials()');\n    })();\n<\/script>\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Clinical Trials Search ongoing studies. Live results from ClinicalTrials.gov \u2014 search active and recruiting trials by condition, phase, demographics, and location. Filters Search Intervention Phase Any Sex AnyAllFemaleMale Country Any Showing 0 trials Results per page: 6122448<\/p>\n","protected":false},"author":13,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"elementor_header_footer","meta":{"footnotes":""},"class_list":["post-721","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/iwebsoul.in\/wp\/proctth\/wp-json\/wp\/v2\/pages\/721","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/iwebsoul.in\/wp\/proctth\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/iwebsoul.in\/wp\/proctth\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/iwebsoul.in\/wp\/proctth\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/iwebsoul.in\/wp\/proctth\/wp-json\/wp\/v2\/comments?post=721"}],"version-history":[{"count":88,"href":"https:\/\/iwebsoul.in\/wp\/proctth\/wp-json\/wp\/v2\/pages\/721\/revisions"}],"predecessor-version":[{"id":2801,"href":"https:\/\/iwebsoul.in\/wp\/proctth\/wp-json\/wp\/v2\/pages\/721\/revisions\/2801"}],"wp:attachment":[{"href":"https:\/\/iwebsoul.in\/wp\/proctth\/wp-json\/wp\/v2\/media?parent=721"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}