Published
Edited
Oct 1, 2022
Insert cell
# Function for AA data
Insert cell
tr1=
`
<tr style="margin-bottom:10px">
<td style="border-bottom:1px solid #e3e3e3; width:260px" valign="top">
<h4 style="margin:0;padding:0;">Union Baptist Church</h4><br />
<b>AA IT WORKS II - AA It Works II</b><br />
240 West 145th Street,
<br />(Betw 7th & 8th Avenues) NY 10039
<br />
<br />
<div class="detailsBox">
Thu=Altern.BB, Living Sober & Other A.A. Literature. <br />Fri.=Alternates between Step & Tradition.
</div>
<span style="color:darkblue; font-size:10pt;">
<img src="../images/wheelchair.jpg" alt="Wheelchair Access" width="20" vspace="5" hspace="10" align="absmiddle"/>Wheelchair access
</span>
</td>
<td style="border-bottom:1px solid #e3e3e3;width:350px;" valign="top">
<b>Wednesdays From</b> 10:00 AM <b>to</b> 11:00 AM <br /><b>Meeting Type</b> B = Beginners meeting
<br />
<br />
<b>Thursdays From</b> 10:00 AM <b>to</b> 11:00 AM <br /><b>Meeting Type</b> BB = Big Book meeting
<br />
<br />
<b>Fridays From</b> 10:00 AM <b>to</b> 11:00 AM <br /><b>Meeting Type</b> S = Step meeting
<br />
<br />
<b>Tuesdays From</b> 10:00 AM <b>to</b> 11:00 AM <br /><b>Meeting Type</b> OD = Open Discussion meeting
<br />
<br />
</td>
<td style="border-bottom:1px solid #dedede; width:90px; ">
<a href="getdirections.cfm?meetingid=36" class="GetDirections">Get Directions</a>
</td>
</tr>
`
Insert cell
name= tr1.split('</h4>')[0].split(';">')[1]
Insert cell
address = tr1.split('</b><br />')[1].split('\t\t\t\t\t\t')[1].split(',')[0]
Insert cell
tagline = tr1.split('</b><br />')[0].split('<b>')[1]
Insert cell
nearby =tr1.split('</b><br />')[1].split ('\t\t\t\t\t\t<br />')[1].split('(')[1].split(')')[0]
Insert cell
zipcode =tr1.split('</b><br />')[1].split ('\t\t\t\t\t\t<br />')[1].split('(')[1].split(')')[1].trim(' ').split(' ')[1]
Insert cell
meetingdetail =tr1.split('\t\t\t\t \t <b>').slice(2)
Insert cell
meetingdetails = []
Insert cell
function parseData(data) {

var finalData = []

var location = tr1.split('</h4>')[0].split('">')[3]
var splitTags = tr1.split('</b><br />')[1].split('</b><br />\t\t\t\t\t\t')[0].split('\n\t\t\t\t\t\t')
var address = splitTags[1].replace(', ', '')
var state = splitTags[2].slice(-8).split(' ')[0]
var zip = splitTags[2].slice(-8).split(' ')[1]
meetingdetail.forEach(function(index, element) {
const startdate = index.split('From</b>')
const enddate = startdate[0]
const remainingdays= startdate[1]
const start = remainingdays.split('<b>to</b>')
const finalStart = start[0]
const restStart = start[1]
const end = restStart.split('<br /><b>')
const finalEnd = end[0]
const restEnd = end[1]
const meetingType = restEnd.split('\t\t\t \t\t\t<br />')
const finalType = meetingType[0]
finalData.push({
location: location,
address: address,
state: state,
zip: zip,
day: enddate,
startTime: finalStart.trim(),
endTime: finalEnd.trim(),
meetingType: finalType.replace('Meeting Type</b>','').replace(' \n','').trim()
})
});
return finalData
}

Insert cell
parseData (tr1)
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