Skip to content

Commit f9977b3

Browse files
fix: Update preview test with correct endpoints and enhance formula reference documentation
1 parent cc50fb9 commit f9977b3

2 files changed

Lines changed: 65 additions & 16 deletions

File tree

src/taskpane/App.tsx

Lines changed: 55 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -813,14 +813,61 @@ const App: React.FC = () => {
813813
)}
814814

815815
<section className="card">
816-
<div className="card-title">Usage</div>
817-
<ul className="muted">
818-
<li>Array: =DSIQ("FRED-GDP", [frequency], [start_date])</li>
819-
<li>Latest: =DSIQ_LATEST("FRED-GDP")</li>
820-
<li>Value: =DSIQ_VALUE("FRED-GDP", "2024-01-01")</li>
821-
<li>YoY: =DSIQ_YOY("FRED-GDP")</li>
822-
<li>Meta: =DSIQ_META("FRED-GDP", "title")</li>
823-
</ul>
816+
<div className="card-title">📖 Formula Reference</div>
817+
<div style={{fontSize: '13px', lineHeight: '1.6'}}>
818+
819+
<div style={{marginBottom: '16px'}}>
820+
<strong style={{color: '#1f2937'}}>DSIQ(series_id, [frequency], [start_date])</strong>
821+
<div className="muted" style={{marginTop: '4px'}}>Returns time series data as array (spills into cells below)</div>
822+
<code style={{display: 'block', marginTop: '6px', padding: '6px', background: '#f3f4f6', borderRadius: '4px', fontSize: '12px'}}>
823+
=DSIQ("wb/NE.EXP.GNFS.ZS/USA")<br/>
824+
=DSIQ("fred/GDP", "Q", "2020-01-01")
825+
</code>
826+
</div>
827+
828+
<div style={{marginBottom: '16px'}}>
829+
<strong style={{color: '#1f2937'}}>DSIQ_LATEST(series_id)</strong>
830+
<div className="muted" style={{marginTop: '4px'}}>Returns most recent value (single cell)</div>
831+
<code style={{display: 'block', marginTop: '6px', padding: '6px', background: '#f3f4f6', borderRadius: '4px', fontSize: '12px'}}>
832+
=DSIQ_LATEST("wb/NE.EXP.GNFS.ZS/USA")
833+
</code>
834+
</div>
835+
836+
<div style={{marginBottom: '16px'}}>
837+
<strong style={{color: '#1f2937'}}>DSIQ_VALUE(series_id, date)</strong>
838+
<div className="muted" style={{marginTop: '4px'}}>Returns value at specific date</div>
839+
<code style={{display: 'block', marginTop: '6px', padding: '6px', background: '#f3f4f6', borderRadius: '4px', fontSize: '12px'}}>
840+
=DSIQ_VALUE("fred/GDP", "2024-01-01")<br/>
841+
=DSIQ_VALUE("bls/CUUR0000SA0", A2)
842+
</code>
843+
</div>
844+
845+
<div style={{marginBottom: '16px'}}>
846+
<strong style={{color: '#1f2937'}}>DSIQ_YOY(series_id)</strong>
847+
<div className="muted" style={{marginTop: '4px'}}>Returns year-over-year % change</div>
848+
<code style={{display: 'block', marginTop: '6px', padding: '6px', background: '#f3f4f6', borderRadius: '4px', fontSize: '12px'}}>
849+
=DSIQ_YOY("fred/GDP")
850+
</code>
851+
</div>
852+
853+
<div style={{marginBottom: '16px'}}>
854+
<strong style={{color: '#1f2937'}}>DSIQ_META(series_id, field)</strong>
855+
<div className="muted" style={{marginTop: '4px'}}>Returns metadata field (title, frequency, units, etc.)</div>
856+
<code style={{display: 'block', marginTop: '6px', padding: '6px', background: '#f3f4f6', borderRadius: '4px', fontSize: '12px'}}>
857+
=DSIQ_META("wb/NE.EXP.GNFS.ZS/USA", "title")<br/>
858+
=DSIQ_META("fred/GDP", "frequency")<br/>
859+
=DSIQ_META("bls/CUUR0000SA0", "units")
860+
</code>
861+
</div>
862+
863+
<div className="muted" style={{marginTop: '12px', padding: '8px', background: '#eff6ff', borderRadius: '6px', fontSize: '12px'}}>
864+
<strong>💡 Tips:</strong><br/>
865+
• Use Search tab to find series IDs<br/>
866+
• Browse by Source for data discovery<br/>
867+
• Favorites/Recent for quick access<br/>
868+
• DSIQ() spills automatically in Excel 365
869+
</div>
870+
</div>
824871
</section>
825872

826873
{previewSeries && (

test.html

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -455,23 +455,25 @@ <h3>Tests Passed: ${passed}/${total} (${percentage}%)</h3>
455455
resultDiv.textContent = 'Testing preview data fetch...';
456456

457457
try {
458-
// Fetch both latest value and metadata
459-
const [latestRes, metaRes] = await Promise.all([
460-
fetch(`${API_URL}/FRED-GDP?mode=latest`),
461-
fetch(`${API_URL}/FRED-GDP?mode=meta`)
458+
// Fetch both latest value and metadata using real series
459+
const seriesId = 'wb%2FNE.EXP.GNFS.ZS%2FUSA';
460+
const [dataRes, metaRes] = await Promise.all([
461+
fetch(`${API_URL}/${seriesId}/data?limit=1`),
462+
fetch(`${API_URL}/${seriesId}`)
462463
]);
463464

464-
const latestData = await latestRes.json();
465+
const dataData = await dataRes.json();
465466
const metaData = await metaRes.json();
466467

467-
testResults['preview'] = latestRes.status === 200 && metaRes.status === 200;
468+
testResults['preview'] = dataRes.status === 200 && metaRes.status === 200;
468469

469470
if (testResults['preview']) {
471+
const latestValue = dataData.data && dataData.data.length > 0 ? dataData.data[0].value : 'N/A';
470472
resultDiv.className = 'result success';
471-
resultDiv.textContent = `✅ Preview data working!\n\nLatest Value: ${latestData.scalar || 'N/A'}\n\nMetadata:\n${JSON.stringify(metaData.meta, null, 2)}`;
473+
resultDiv.textContent = `✅ Preview data working!\n\nSeries: ${metaData.dataset.title}\nLatest Value: ${latestValue}\nProvider: ${metaData.dataset.provider}\nFrequency: ${metaData.dataset.frequency}\nObservations: ${metaData.dataset.observationCount}`;
472474
} else {
473475
resultDiv.className = 'result error';
474-
resultDiv.textContent = `❌ Preview failed\nLatest status: ${latestRes.status}\nMeta status: ${metaRes.status}`;
476+
resultDiv.textContent = `❌ Preview failed\nData status: ${dataRes.status}\nMeta status: ${metaRes.status}`;
475477
}
476478
} catch (error) {
477479
testResults['preview'] = false;

0 commit comments

Comments
 (0)