@varve/agency-sdks

Fetch Exports

Retrieve normalized CMHC observations or raw portal CSV for known table selections.

Use getCmhc() when you want parsed and normalized rows.

const rows = await client.getCmhc({
  survey: 'Rms',
  series: 'Vacancy Rate',
  dimension: 'Bedroom Type',
  breakdown: 'Historical Time Periods',
  region: {
    geographyId: '2410',
    geographyTypeId: '3',
    geoUid: '59933',
  },
  filters: {
    season: 'October',
  },
});
 
for (const row of rows) {
  console.log(row);
}

Raw CSV

Use exportTableCsv() when you already know the CMHC portal table ID or when a downstream job needs the unparsed CSV.

const csv = await client.exportTableCsv({
  tableId: '2.2.1',
  region: {
    geographyId: '2410',
    geographyTypeId: '3',
  },
  filters: {
    season: 'October',
  },
});
 
console.log(csv.slice(0, 500));

Graph metadata

For search and planner systems, use normalized graph metadata for the same selection.

const graph = await client.getGraphMetadata({
  survey: 'Rms',
  series: 'Vacancy Rate',
  dimension: 'Bedroom Type',
  breakdown: 'Historical Time Periods',
  region: {
    geographyId: '2410',
    geographyTypeId: '3',
    geoUid: '59933',
  },
  filters: {
    season: 'October',
  },
});
 
console.log(graph.table);
console.log(graph.observations);

On this page