The site uses cookies that you may not want. Continued use means acceptance. For more information see our privacy policy.

JSON Schemas and Making a Versatile Application.

Please excuse the big wad of JSON in the middle of the post.

Things have come a long way from the previous post (diehealthy.org: 27 October 2022: “Working on a Local Single Page Application.”) about working on a local file that provides a whole data tracking. While I originally wanted it to be used for games, I’d seen other JSON-schema-based stuff online and decided it could be fully schema driven. While it doesn’t yet edit its own schemas, that’s probably feasible in the long run (if not something I’ll necessarily do).

In order to further refine it toward that schema system, I forked it and made a version to track the movies I’ve watch. The post image is of that version, though they are currently at parity aside from the schema differences.

To give an idea what I mean by schema, here’s some excerpts from the film version:

{
    "name": "filmtracker",
    "defaults": {
        "filters": {
            "recorded": 1,
            "watched": 0
        }
    },
    "props": [
        {
            "name": "name",
            "title": "Name",
            "type": "string",
            "display": "headertext",
            "displaystyle": "italics",
            "sortOn": true,
            "req": true,
            "def": null
        },
        {
            "name": "recorddata",
            "title": "Record data",
            "type": "group",
            "props": [
                {
                    "name": "added",
                    "title": "Added",
                    "hidden": true,
                    "display": "fulldate",
                    "displayprefix": "Added on",
                    "type": "date",
                    "sortOn": true
                },
                {
                    "name": "modified",
                    "title": "Modified",
                    "hidden": true,
                    "display": "fulldate",
                    "displayprefix": "Updated on",
                    "type": "date",
                    "sortOn": true
                }
            ]
        },
        {
            "name": "watchdata",
            "title": "Watch info",
            "type": "group",
            "props": [
                {
                    "name": "recorded",
                    "title": "Recorded",
                    "type": "bool",
                    "display": "iffalse",
                    "displayvalue": "Unrecorded.",
                    "summaryvalue": "📅",
                    "filter": true,
                    "def": 0
                },
                {
                    "name": "watched",
                    "title": "Watched",
                    "type": "bool",
                    "display": "text",
                    "displaydepends": [
                        "recorded"
                    ],
                    "displayvalues": [
                        "Unseen",
                        "Seen"
                    ],
                    "summaryvalues": [
                        "💾",
                        "🍿"
                    ],
                    "filter": true,
                    "def": 0
                },
                {
                    "name": "watchdate",
                    "title": "Date of watch",
                    "type": "date",
                    "display": "monthdate",
                    "displaydepends": [
                        "watched"
                    ],
                    "displayprefix": "Watched",
                    "sortOn": true,
                    "sortDep": "bought",
                    "def": ""
                }
            ]
        },
        {
            "name": "filmdata",
            "title": "Film info",
            "type": "group",
            "props": [
                {
                    "name": "releaseyear",
                    "title": "Year of Release",
                    "type": "num",
                    "display": "text",
                    "displayprefix": "Year:",
                    "sortOn": true,
                    "minv": 1900,
                    "def": 2022
                },
                {
                    "name": "score",
                    "title": "Review score",
                    "type": "range",
                    "display": "stars",
                    "displaydepends": [
                        "watched"
                    ],
                    "displayprefix": "Score:",
                    "summaryvalue": "stars",
                    "sortOn": true,
                    "sortDep": "watched",
                    "minv": 0,
                    "maxv": 5,
                    "step": 1,
                    "def": 0
                }
            ]
        },
        {
            "name": "categories",
            "title": "Tags",
            "type": "strarray",
            "display": "ulist",
            "def": null
        },
        {
            "name": "notes",
            "title": "Notes",
            "type": "text",
            "display": "longtext",
            "summary": "📓",
            "def": null
        }
    ]
}

It’s quite a lot, and messy (as is the rest of the application so far), and it mixes data definitions with their presentation, but it’s mostly serviceable. But it lets me define, with the current version:

  • groups
  • numeric inputs
  • string inputs
  • url inputs (unvalidated at the moment)
  • date inputs (though I’d prefer to move to month/year or such)
  • boolean inputs (implemented as radio buttons)
  • tri inputs (radio buttons)
  • range inputs (radio buttons)
  • text inputs (text boxes)
  • string array inputs (for tags, with autocomplete!)

I’d originally gone with checkboxes and three-state checkboxes for booleans and tris, but decided it was too much trouble and having separate buttons looked nicer. The basic checkboxes were reused instead for toggling off or on the listing filters for boolean and tri fields.

It can also search in and sort the listing.


One of the nicer parts of all this is the ability to export and import from JSON, as well as being able to use the browser console to loop through and batch-modify the data. I’m not sure how feasible it would be to implement that through UI, which would be more useful to nontechnical users. But for now this is just a little project to handle my own data.

If I can get it cleaned up, I’ll probably throw a copy up here at some point, though so far I’m still iterating on it a good bit as I go through my old list of movies I watched and fill in their details. I started keeping a list at some point last year, and that was title-only, so it’s been a lot of searching, figuring out which was the movie I actually watched, trying to remember enough to give it a rating.

But the main goal is that if I decide I need a list of something, I can copy the file over, throw a schema together, and start making the list in a way that lets me update it or review it better than a text file and not requiring the ugliness of a spreadsheet. Like when I kept a list of the legislators who objected on 6 January 2021, that’s just a text file. Next time it could be a nice little application that makes the task not necessarily easier, but more useful:

  1. Get a text list of the things
  2. Some light massaging to turn it into JSON
  3. Write a quick schema
  4. Import the data
  5. Fill in any details, be able to filter, sort, search easily.

I can only imagine what data wrangling looks like in 100 years. I hope by then it’s all AI user interfaces that look pretty are functional no friction. Until then, this project has reminded me how powerful, how versatile, and above all how fairly simple, HTML plus Javascript has gotten.

Aftermath of Alabama Politics in 2022

Another sad Alabama election.

Alabama Democrats

The new chair that came in after Doug Jones seemed to be ready to make some moves, but the slate of candidates for the primary was impressively weak. In most of the country, both parties find candidates for most races, even when they won’t win. Was this mere incompetence by the reformers?

Perhaps not. I don’t know if it’s true, but it seems plausible enough to think that the former leaders of the state Democratic party shooed candidates away from running this year, as part of their efforts to retake control. This is all guesswork, without any reporting on the inner workings of the party, but from the few public spats, the people who now hold the chair—the old guard—want to hold the chair even at the expense of the party. They know enough about how to do that, and don’t have any particular plans or ambitions for doing anything more than maintaining the limited power base.

It fits the pattern. On election-eve the current chair (Randy Kelley) issued a party memo saying people shouldn’t give credence to the Vice Chair (Tabitha Isner) for what amounts to her trying to help the candidates limp along when the main party has done no public work in 2022, none since their election in August. It fits the pattern of how fiercely they fought the bylaw changes under the reformers, including their lawsuit against the state party for daring to want to modernize.

And perhaps, too, the desire to keep the party weak, ineffective enough that there won’t be any major contention for leadership, is a sign of the old guard’s designs. The old guard likes their sliver of the state and their power over that sliver, and it won’t change, and it won’t grow.

But it’s probably not true. Incompetence, the difficulty of the sell to run a losing race, these are more likely culprits, even if the politics we learn from movies and books points to more active forces. It’s from that same dark narrative that one might conjure ideas that state Republicans secretly work with pawns among Democrats to keep the party on its knees.

Still, I find myself wanting to understand how there was zero capitalizing on Jones’ win to build a bigger state party, and as I’ve said, there’s no state media that seems to report on this in a way that really explains what the factions are and what they are (and aren’t) capable of.

The Alabama Libertarian Blitz.

The second piece of this autopsy is the Libertarians. They failed to get 20% on any statewide race, so they are back to square one for ballot access. The closest they came, per the Secretary of State website (Alabama Secretary of State: Alabama Votes: 2022 General Election, unofficial results) was 15.6% for Ruth Page–Nelson in the lieutenant-gubernatorial race.

This piece overlaps the first piece. There were enough people who voted for Democrats that they could have put the Libertarians over the threshold in at least one race. Enough of those voters surely plugged the straight ticket bubble and skipped anything else except perhaps the amendments. The Democrats could have called on their voters to help make the mark, but did not. If the Libertarians maintained ballot access, and if they improved their operation, it would provide a contrast to the Democrats that might threaten the old guard.

On the other hand, there’s plenty of reason to be skeptical of Libertarians, particularly for Black voters who are the bulk of Democrats in Alabama. Libertarians promote themselves as strict constitutionalists, which isn’t something particularly palatable to those who know the Constitution’s history—enshrining slavery.

If the Libertarians did anything, it was to raise awareness among Alabama Democrats at how badly the state party is doing, when the Libertarians outnumbered them on many ballots.

Turnout of ≈39%?

The third piece is turnout. The media reports results as a percentage of ballots cast for a particular race. They don’t provide the companion to that, which is to compare that to the electorate. More people didn’t vote than did. Kay Ivey won reelection with about 26% of the registered voters of Alabama. The Democratic candidate, Yolanda Flowers, got another 11%. Add the Libertarian and write-ins, that’s another 1.5%. And all of those sum to 38.5%, which was the turnout number. Which means if Rabbi Jesus had run, and assuming everyone else showed up and voted for him, he would have won by 23 points.

One of the reasons turnout was so low was the weak slate from state Democrats, but it’s a testament to the sorry state of democracy in Alabama, especially for the fact that our reworked constitution, the Alabama Constitution of 2022, was therefore ratified by a measly 24% of the state’s electors (though 76.5% of votes cast on the ratification measure).

The State Constitution.

Which brings us to the constitution and the amendments. Everything passed. As expected.

The recompiled constitution, lacking the racist language of before, and having been reorganized, still saw 23.5% vote against it. The total votes lagged the governor’s race by at least 250 000 votes, so a lot of people who took up the pen and the ballot didn’t bother to mark it at all.

The statewide amendment with the largest number (and largest percentage) of votes against was Amendment 6, because it had the word tax in it. It basically cut a bit of red tape around a property tax used for public works, letting the revenue be used directly rather than requiring it to be used to pay debt. In theory this means some work can be done with minimal debt and less administrative baggage, lowering the cost. In practice, who the heck knows?


The Good News.

The election is over with. We can sleep in our beds tonight assured that no useful changes in leadership occurred. The Republicans will continue to try to pass and also to block gaming laws, including a lottery, even as millions of dollars flow into neighboring states for those purposes. The media (both state and national) will continue to treat Alabama politics as a permanency of one-party rule as it always was. Nobody will campaign on fixing our prison system, on bold new plans for public works or development.

And in 2026, the Republicans will have to run someone else for governor.

The Alabama Politics of 2022.

We get to vote on a new-ish constitution.

The Alabama Constitution of 1901 is long and decrepit, and it’s racist. But it’s about to get replaced by a brand new state constitution, the Alabama Constitution of 2022. (This will be its seventh state constitution.) The work of a committee to reorganize it, and to remove racist language, has been completed. It’s a rustbucket, but we got the racist bumper stickers scraped off. Time to vote to ratify it.

And then what? When will Alabama see real constitutional reform? It may be a long time.

Alabama’s Democratic party was springstepped only a few years back, upon the election of Doug Jones as the first Democratic senator of the state in a few decades—but really as the first modern Democratic senator ever. The old Democrats in the South were still of the ilk that floated their boats on the river of racism.

While the national parties mostly flipped in the 1960s, 1970s, and 1980s, state-level politics took more time to reshuffle. The retiring senator, Richard Shelby, switched parties in 1994. But Republican control of the Alabama Legislature wasn’t completed until 2010.

Following Jones’ election, the Alabama Democrats had a shake-up of their party organization, resulting in a new chair and new blood. But Jones got beat in 2020 by a failed football coach. And as of 2022, two things happened. First, the party failed to recruit a full slate of candidates, and even among the nominees there are some rather weak spots. Second, the party has been reshuffled and now it looks about like it did in the pre-Jones era.

Its website, its social media, and its emails all stopped after 13 August 2022, the date of its change in leadership. During an election year. While the newest leader may have ideas and plans, it would be nice to at least attempt to raise your party’s voice during an election season. Ask the Libertarians.

The Alabama Libertarians, who weren’t on the ballot, made a major effort to change that, gathering thousands of signatures (far more than the required 3% (≈50 000) of the total who voted in the previous gubernatorial election). This year they have more candidates than the Alabama Democrats do. Not that they’ll fair as well, and not that all those candidates have any real visibility. But some do. Will any win? Perhaps. But the prize the Libertarians seek is 20% on a statewide race, which would guarantee their access for the next cycle, no signatures required.

Thing is, the Alabama Republicans don’t have great visibility either. They have the equivalent of Twitter’s notorious blue check—the stamp of approval that largely guarantees success. They have the elephant-shaped xenomorph face-sucking them, Aliens-style.


Looking back, wondering what made the difference for Jones in 2017, I think it was the media. Sure, Roy Moore was a terrible candidate, and the uncovered allegations of his past were the fatal blow to his campaign, but the fact is that Alabama does not have a very strong Fourth Estate. It doesn’t have enough eyeballs to make its bugs shallow. Jones ran in a race that attracted national attention, mostly because the rest of the nation wasn’t holding an election at the time. That allowed bandwidth for national media to get interested in what normally would have been a completely ignored race.

The national politics and the national media don’t help. Alabama voters can point to all sorts of crackpot ideas to defend their provably dumb decision to continue electing Alabama Republicans, because that’s what the right-wing media in this country produces.

The state Democrats don’t have much of an organization because they don’t get the word out—but that’s only part of the story. The rest of the story is that the media is responsible for who gets elected. Campaigns run ads on media, but the background of politics, the lay of the field, that’s all determined by news media.

And so, my main advice to Democrats running for statewide office (or for Congress) in Alabama: find a way to become national news. You may not win, but that’s your best shot.


To close things up here, some lengthy thoughts how I’ll be voting on Tuesday. You should decide how you want to vote. That’s the system, but this is how I came out when looking over things.

In the governor’s race, I’ll be writing in someone, probably Doug Jones. It’s a three-way race between incumbent-slash-Republican Kay Ivey, Libertarian Jimmy Blake, and Democrat Yolanda Flowers. For various reasons none are my choice. Ivey knows how to govern, but chooses to do it poorly to meet the low expectations of state Republicans. Blake is too much of a stereotypical Libertarian for my tastes. Flowers is a weak candidate who only won the nomination because the field was weaker and some intra-party politics I can’t claim to understand that saw her runoff opponent (whom I voted for) disfavored. There is an official write-in guy, who I might write-in instead of Jones, but either way I’m effectively sitting that race out.

For Lieutenant Governor, I’ll be voting for the Libertarian, Ruth Page-Nelson. There’s no Democrat in that race, and so that gives Libertarians a good shot to get 20% of the vote, to stay on the ballot for at least 2024. Page-Nelson seems to be one of the rare Libertarians who believes in doing something about climate change, so it’s not much of a stretch for me to vote for her.

For Senator, I’ll pick Will Boyd, the Democrat. While he doesn’t have great chances—the business community wants a money spigot to replace the current money spigot, Richard Shelby, and they’ve found it in his acolyte, Katie Britt—Boyd would do a good job if he were to win.

In the race for Attorney General, the Democrat, Wendell Major, is my choice. As with the senatorial race, he might not win, but he’d do a decent job—better than the incumbent Steve Marshall who is running for reelection—if he did.

Secretary of State, a race that actually had a candidate forum hosted by the League of Women Voters of Alabama (YouTube: League of Women Voters of Alabama: 11 October 2022: “Alabama Secretary of State General Election Candidate Forum”), but the Republican candidate, Wes Allen, had a lame non-excuse and didn’t participate. The Libertarian candidate, Matt Shelby, appears to lean toward the saner side of things, but I’ll be voting for Pamela Laffitte, the Democratic candidate. Given the history of voter suppression in Alabama (originally under Democrats, but Republicans adopted the same once they took over), and the support for better voting access that Laffitte espouses, I think she’s the best choice. Either of them would be better than Allen, who, as mentioned, doesn’t respect voters enough to participate in the rare candidate forum.

The forum was helpful in one other way. Democratic candidate Pamela Laffitte mentioned she believed you could vote straight-ticket and then deviate to your choosing (e.g., if your preferred party lacked a candidate in some race, you could vote in that race despite marking straight-ticket), but wanted to verify. While the League didn’t affirm that at the forum, the League of Women Voters of Alabama has a PDF on their website (LWVAL.org: League of Women Voters of East Alabama: PDF: “How will you vote?”) that confirms you can do so. While I don’t have any plans to ever vote straight-ticket, it’s useful to know how that works. (For those who are curious, the Libertarian candidate, Matt Shelby, said he’s in favor of scrapping straight-ticket, while Ms. Laffitte said she’s in favor of keeping it as it may make voting easier for some people.)

As for the amendments, none would make things markedly better. I’ll vote against Amendment 3, which would require the governor to give notice to the attorney general and victim relatives for commuting a death sentence, as I don’t think it’s necessary. I’ll vote against Amendment 4, which would restrict the legislature’s ability to modify election law within six months of an election, as I don’t think it’s necessary.

Amendment 1, also known as Aniah’s Law, for a woman who was murdered by a person out on bail, would not allow bail for those charged with particularly harsh crimes. I’ll vote against it. Anyone familiar with the history of the US Constitution knows how the Bill of Rights places a particular emphasis on protecting our rights against overzealous law enforcement. The Fourth, Fifth, Sixth, Seventh, and Eighth Amendments all serve that purpose. That’s half of the ten.

While public safety is paramount, that does not mean giving in to a base impulse to seek it in harsh and unruly ways that in fact undermine safety, and the fact that there’s been too little media coverage, no presentation of statistics to justify the change, means I must err in favor of protecting the rights of accused persons to due process by voting against it.

From what I’ve found in researching the change, the existing bail system already allows for judges to set heavy release conditions, including their ability to exceed the bail schedule (see Alabama Rules of Criminal Procedure, Rules 7.2–3). To move from the constitutional protections to outright denials without a more exhaustive finding of necessity is not warranted at this time.


Please do vote on Tuesday if you haven’t already.