Public
Edited
Oct 12, 2022
Insert cell
# Parsing data with functions
Insert cell
Insert cell
Insert cell
tr1.split('</td>')
Insert cell
locationName = tr1.split('</h4>')[0].split('">')[3]
Insert cell
meetingName = tr1.split(' - ')[1].split('</b><br />')[0]
Insert cell
address = tr1.split(',')[0].split('\n\t\t\t\t\t\t')[1]
Insert cell
zipCode = tr1.split('</b><br />')[1].split('</b><br />\t\t\t\t\t\t')[0].split('\n\t\t\t\t\t\t')[2].slice(-8).split(' ')[1]
Insert cell
state = tr1.split('</b><br />')[1].split('</b><br />\t\t\t\t\t\t')[0].split('\n\t\t\t\t\t\t')[2].slice(-8).split(' ')[0]
Insert cell
data2 = tr1.split('</td>')[1].split('\t\t\t\t \t <b>').slice(1)
Insert cell
data2[0].split(' From</b> ')[1].split(' <b>to</b> ')[1].split(' <br /><b>')[1].split(' \n\t\t\t \t\t\t<br />')
Insert cell
detailData = []
Insert cell
data2.forEach(function(item,index) {
const splitData = item.split(' From</b> ')
const day = splitData[0]
const restData = splitData[1]
const time = restData.split(' <b>to</b> ')
const startTime = time[0]
const restTime = time[1].split(' <br /><b>')
const endTime = restTime[0]
const remainData = restTime[1].split(' \n\t\t\t \t\t\t<br />')
const meetingType = remainData[0]

detailData.push({
day: day,
start: startTime,
end: endTime,
meetingType: meetingType.replace('Meeting Type</b> ','')
})
});
Insert cell
detailData
Insert cell
finalData = []
Insert cell
function parseData(data) {

let finalData = []

let finalLocation = tr1.split('</h4>')[0].split('">')[3]
let finalAddress = tr1.split(',')[0].split('\n\t\t\t\t\t\t')[1]
let finalName = tr1.split(' - ')[1].split('</b><br />')[0]
let finalZip = tr1.split('</b><br />')[1].split('</b><br />\t\t\t\t\t\t')[0].split('\n\t\t\t\t\t\t')[2].slice(-8).split(' ')[1]
let finalState = tr1.split('</b><br />')[1].split('</b><br />\t\t\t\t\t\t')[0].split('\n\t\t\t\t\t\t')[2].slice(-8).split(' ')[0]

data2.forEach(function(item,index) {
const splitData = item.split(' From</b> ')
const day = splitData[0]
const restData = splitData[1]
const time = restData.split(' <b>to</b> ')
const startTime = time[0]
const restTime = time[1].split(' <br /><b>')
const endTime = restTime[0]
const remainData = restTime[1].split(' \n\t\t\t \t\t\t<br />')
const meetingType = remainData[0]
finalData.push({
location: finalLocation,
name: finalName,
address: finalAddress,
zip: finalZip,
day: day,
state: finalState,
start: startTime,
end: endTime,
meetingType: meetingType.replace('Meeting Type</b> ','')
})
});
return finalData
}
Insert cell
parseData(tr1)
Insert cell
Insert cell
tr3= `
<tr style="margin-bottom:10px">
<td style="border-bottom:1px solid #e3e3e3; width:260px" valign="top">
<h4 style="margin:0;padding:0;">St. Andrew's Church</h4><br />
<b>CHAMBERS STREET - A BRIDGE BACK - Chambers Street - A Bridge Back</b><br />
20 Cardinal Hayes Place, Enter through driveway behind Church.,
<br />(1 Block North of Chambers Street) NY 10007
<br />
<br />
<div class="detailsBox">
No meetings on Holidays. <br />**LOCATION SUBJECT TO CHANGE- Call Inter-Group
</div>
</td>
<td style="border-bottom:1px solid #e3e3e3;width:350px;" valign="top">
<b>Mondays From</b> 12:15 PM <b>to</b> 1:15 PM <br /><b>Meeting Type</b> OD = Open Discussion meeting
<br />
<br />
<b>Wednesdays From</b> 12:15 PM <b>to</b> 1:15 PM <br /><b>Meeting Type</b> S = Step meeting
<br />
<br />
<b>Thursdays From</b> 12:15 PM <b>to</b> 1:15 PM <br /><b>Meeting Type</b> B = Beginners meeting
<br />
<br />
<b>Fridays From</b> 12:15 PM <b>to</b> 1:15 PM <br /><b>Meeting Type</b> BB = Big Book meeting
<br />
<br />
</td>
<td style="border-bottom:1px solid #dedede; width:90px; ">
<a href="getdirections.cfm?meetingid=74" class="GetDirections">Get Directions</a>
</td>
</tr>
`
Insert cell
tr4=`
<tr style="margin-bottom:10px">
<td style="border-bottom:1px solid #e3e3e3; width:260px" valign="top">
<h4 style="margin:0;padding:0;">Church of the Transfiguration</h4><br />
<b>CHINATOWN - Chinatown</b><br />
29 Mott Street, Basement,
<br />(@ Mott & Mosco Streets) NY 10013
<br />
<br />
</td>
<td style="border-bottom:1px solid #e3e3e3;width:350px;" valign="top">
<b>Tuesdays From</b> 6:30 PM <b>to</b> 7:30 PM <br /><b>Meeting Type</b> C = Closed Discussion meeting
<br />
<br />
</td>
<td style="border-bottom:1px solid #dedede; width:90px; ">
<a href="getdirections.cfm?meetingid=78" class="GetDirections">Get Directions</a>
</td>
</tr>
<tr style="margin-bottom:10px">
<td style="border-bottom:1px solid #e3e3e3; width:260px" valign="top">
<h4 style="margin:0;padding:0;">St. Margaret's Residence</h4><br />
<b>DOWNTOWN - </b><br />
49 Fulton Street, 1st Floor Library,
<br />(@ Pearl Street) 10038
<br />
<br />
<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>Mondays From</b> 7:00 PM <b>to</b> 8:00 PM <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=137" class="GetDirections">Get Directions</a>
</td>
</tr>
`
Insert cell
parseData(tr3)
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