Published
Edited
Nov 16, 2021
Importers
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
myRegion
Insert cell
viewof myRegion = Inputs.select(regions, {
label: "Spanish CCAA",
value: "MD"
})
Insert cell
Insert cell
sortingField = _isInsemination ? "maxCyclesAI_viz" : "maxCyclesIVF_viz"
Insert cell
Insert cell
Insert cell
Insert cell
viewof _myRegionAccess = Inputs.radio(
["Yes", "YesLess", "NoMore", "Depends", "NotAvailable"],
{
value: "Yes",
label: "Regions access"
}
)
Insert cell
resumeRegionAccessMaxCycles = html`
${
_myRegionAccess === "Yes"
? chunkAccessYesCCAA
: _myRegionAccess === "YesLess"
? chunkAccessYesLessCCAA
: _myRegionAccess === "NoMore"
? chunkAccessNoMoreCCAA
: chunkAccessNotAvailableCCAA
}
`
Insert cell
chunkAccessYesCCAA = html`
${locale[_languageSelector].chunkAccessYesCCAA}
`
Insert cell
chunkAccessYesLessCCAA = html`
${locale[_languageSelector].chunkAccessYesLessCCAA}
`
Insert cell
chunkAccessNoMoreCCAA = html`
${locale[_languageSelector].chunkAccessNoMoreCCAA}
`
Insert cell
chunkAccessNotAvailableCCAA = html`
${locale[_languageSelector].chunkAccessNotAvailableCCAA}
`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
publicFundingCyclesNotesExtraCCAA = html`

<div class="ART-note">

${
_isInsemination && _myRegionData.maxCyclesAI_notes
? `<p>(*) ${_myRegionData.maxCyclesAI_notes}</p>`
: ""
}


${
!_isInsemination && _myRegionData.maxCyclesIVF_notes
? `<p>(*) ${_myRegionData.maxCyclesIVF_notes}</p>`
: ""
}


</div>

`
Insert cell
Insert cell
_myRegionData = _myCCAAData
Insert cell
_myCCAAData = datasetMaxCyclesCCAA.find((d) => d.region_code === myRegion)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// Adding date as parameter to avoid cache problems with any data update
dateId = new Date().getTime()
Insert cell
Insert cell
Insert cell
inVitroNationalMax = 3
Insert cell
inseminationNationalMax = 6
Insert cell
maxCycles = _isInsemination ? inseminationNationalMax : inVitroNationalMax
Insert cell
URLdataset_CCAA = `https://data.civio.es/medicamentalia/access-ART-ES/publicAccessART_CCAA.csv?q=${dateId}`
Insert cell
datasetMaxCyclesCCAARaw = await d3.csv(URLdataset_CCAA, d3.autoType)
Insert cell
datasetMaxCyclesCCAA = {
const data = await d3.csv(
URLdataset_CCAA,
({
region_code_ISO,
region_name,
maxCyclesAI_viz,
maxCyclesAI_notes,
maxCyclesIVF_viz,
maxCyclesIVF_notes
}) => ({
region_code: region_code_ISO,
region_name: region_name,
maxCyclesAI_viz: maxCyclesAI_viz.trim(),
maxCyclesAI_notes: maxCyclesAI_notes,
maxCyclesIVF_viz: maxCyclesIVF_viz.trim(),
maxCyclesIVF_notes: maxCyclesIVF_notes
})
);

// Sorting by region name alphabetically
return data
.filter((d) => d.region_code !== "")
.sort((a, b) => d3.ascending(a.region_name, b.region_name));
}
Insert cell
Inputs.table(datasetMaxCyclesCCAA)
Insert cell
regions = datasetMaxCyclesCCAA.map((d) => d.region_code)
Insert cell
Insert cell
Insert cell
URLdatasetNotes_Insemination = `https://data.civio.es/medicamentalia/access-ART/Notes_publicFunding_AI.csv?q=${dateId}`
Insert cell
URLdatasetNotes_InVitro = `https://data.civio.es/medicamentalia/access-ART/Notes_publicFunding_IV.csv?q=${dateId}`
Insert cell
datasetNotesInseminationRaw = await d3.csv(URLdatasetNotes_Insemination)
Insert cell
datasetNotesInVitroRaw = await d3.csv(URLdatasetNotes_InVitro)
Insert cell
datasetNotesInsemination = datasetNotesInseminationRaw.filter(
(d) => d.country_code !== ""
)
Insert cell
Inputs.table(datasetNotesInsemination)
Insert cell
datasetNotesInVitro = datasetNotesInVitroRaw.filter(
(d) => d.country_code !== ""
)
Insert cell
Inputs.table(datasetNotesInVitro)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
locale = ({
es: {
dontApply: "No aplica",
notAvailable: "Info no disponible",

fertilisation: "Fertilización",
insideUterus: "dentro del útero",
insideLab: "en el laboratorio",

/// REGIONS SPAIN

chunkAccessYesCCAA: `<p class="resume-access-yes">En <span class="access-yes">${
_myRegionData["region_code"]
}: ${
_myRegionData.region_name
}</span> se cumplen los límites nacionales: <strong style="color:${colorAccess}">${maxCycles} intentos</strong> para <strong><span class="avatar-result">${
localeArtTechniques["es"][_artTechniqueSelector]
}</span></strong>
${
(_isInsemination && _myRegionData.maxCyclesAI_notes) ||
(!_isInsemination && _myRegionData.maxCyclesAI_notes)
? "(*)"
: ""
}
</p>`,

chunkAccessYesLessCCAA: `<p class="resume-access-yes">En <span class="access-yes">${_myRegionData["region_code"]}: ${_myRegionData.region_name}</span> se cumplen y <strong style="color: ${colorAccess}">se amplían los límites nacionales</strong> para <strong><span class="avatar-result">${localeArtTechniques["es"][_artTechniqueSelector]}</span></strong>
</p>`,

chunkAccessNoMoreCCAA: `<p class="resume-access-no">En <span class="access-no">${
_myRegionData["region_code"]
}: ${
_myRegionData.region_name
}</span> se cubren solo <strong style="color: ${colorNoAccess}"> ${
_myRegionData[sortingField]
} ciclos</strong> para <strong><span class="avatar-result">${
localeArtTechniques["es"][_artTechniqueSelector]
}</span></strong>, <strong style="color: ${colorNoAccess}"> menos de los que establece la norma nacional</strong>
${
(_isInsemination && _myRegionData.maxCyclesAI_notes) ||
(!_isInsemination && _myRegionData.maxCyclesAI_notes)
? "(*)"
: ""
}
</p>`,
chunkAccessNotAvailableCCAA: `<p class="resume-access-notAvailable">Información no disponible en <span class="access-notAvailable">${_myRegionData["region_code"]}: ${_myRegionData.region_name}</span>
</p>`
}
})
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more