Skip to content

Conversation

@GuyKh
Copy link
Collaborator

@GuyKh GuyKh commented May 9, 2024

TL;DR
for every profile - (e.g. Thomas F Krysinski)
there's a part of the HTML with a json with the details.

<script type="application/ld+json">
{
    "@context": "https://schema.org",
    "@type": "Person",
    "@id": "https://billiongraves.com/grave/Thomas-F-Krysinski/32465201",
    "url": "https://billiongraves.com/grave/Thomas-F-Krysinski/32465201",
    "name": "Thomas F. Krysinski",
    "familyName": "Krysinski",
    "givenName": "Thomas F.",
    "birthDate": "1945",
    "deathDate": "1992-12",
    "image": "https://billiongraves.com/api/1.4/selectimage?tkn=med26842274&p1=128&p2=0",
    "deathPlace": {
        "@context": "https://schema.org",
        "@type": "Cemetery",
        "name": "Holy Cross Catholic Cemetery",
        "@id": "https://billiongraves.com/cemetery/Holy-Cross-Catholic-Cemetery/21305",
        "url": "https://billiongraves.com/cemetery/Holy-Cross-Catholic-Cemetery/21305",
        "geo": {
            "@type": "GeoCoordinates",
            "latitude": 41.60675535448,
            "longitude": -87.546876864589
        },
        "address": {
            "@type": "PostalAddress",
            "addressLocality": "Calumet City",
            "addressRegion": "Illinois",
            "addressCountry": "United States"
        }
    }
}
</script>

Load this and use it instead of HTML parsing - this way -- add support to new BillionGraves

Solves #116 , Solves #106

@GuyKh GuyKh assigned GuyKh and eljeffeg and unassigned GuyKh and eljeffeg May 12, 2024
@GuyKh GuyKh requested a review from eljeffeg May 12, 2024 07:26
@GuyKh GuyKh added the bug label May 12, 2024
@eljeffeg
Copy link
Owner

eljeffeg commented May 13, 2024

The dates didn't parse correctly for me in the Thomas Krysinski example. The normal JS date parse will assume dates and it works off a 0-11 month calculation if I recall. In any case, when I parse Thomas, it gives me these dates. Birth: December 31, 1944, Death: November 30, 1992, when the real info is 1945 - December 1992.

I'd suggest maybe trying to use the parseDate function in the popup.js and if you wanted to format it.. maybe something like this?

function displayDate(vardate) {
    let formattedDate = ""
    if ("day" in vardate && "month" in vardate && "year" in vardate) {
        let date = moment({ year: vardate["year"], month: vardate["month"] - 1 , day: vardate["day"] });
        formattedDate = date.format("MMMM D, YYYY");
    } else if ("month" in vardate && "year" in vardate) {
        let date = moment({ year: vardate["year"], month: vardate["month"] - 1 })
        formattedDate = date.format("MMMM YYYY");
    } else if ("year" in vardate){
        let date = moment({ year: vardate["year"]});
        formattedDate = date.format("YYYY");
    }
    return formattedDate;
}```

@GuyKh
Copy link
Collaborator Author

GuyKh commented May 13, 2024

Perhaps it takes into account some locale of the browser

@GuyKh
Copy link
Collaborator Author

GuyKh commented May 13, 2024

@eljeffeg see changes

@GuyKh
Copy link
Collaborator Author

GuyKh commented May 15, 2024

By the way,
Interesting thing to find: there's a github extension for WikiTree - where they face the same problems as we do:
wikitree-sourcer

Worth taking a look when thinking about other problems too

@GuyKh
Copy link
Collaborator Author

GuyKh commented May 17, 2024

@eljeffeg i think it's ready

@eljeffeg
Copy link
Owner

Whoops, cross the streams on my work account. I'll take a look this weekend. Are we ready with #115 & #112 as well or holding off on them?

}

function getData(htmlstring) {
return JSON.parse(htmlstring.split('<script type="application/ld+json">')[1].split('</script>')[0]);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eljeffeg this is the part I really dislike. I couldn't fetch <script> content via jQuery, so try to take a look if it's possible.

@GuyKh
Copy link
Collaborator Author

GuyKh commented May 18, 2024

Whoops, cross the streams on my work account. I'll take a look this weekend. Are we ready with #115 & #112 as well or holding off on them?

No.
#115 is blocked due to not being able to fetch urls for family members and so can't add them

#112 is also blocked, some work needs to be done there on a deeper level

@GuyKh
Copy link
Collaborator Author

GuyKh commented May 23, 2024

@eljeffeg - requesting your attention :)

@eljeffeg eljeffeg merged commit 9165918 into eljeffeg:master May 23, 2024
@GuyKh GuyKh deleted the new-billion-graves branch May 24, 2024 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BillionGraves Redesign - Need to adjust parsing Add support for BillionGraves new layout

3 participants