4 ms·
I did something vaguely similar to this recently, and I still maintain it was a good choice. I volunteered to write a medical visit recording app for an NGO in
by russnewcomer 6y ago
I did something vaguely similar to this recently, and I still maintain it was a good choice.
I volunteered to write a medical visit recording app for an NGO in a developing country (a friend works with the NGO and asked me if I would help), and they have almost no budget, no guarantees of internet connectivity when their folks are in the field, and the likelihood that they may be using this software for years.
So I wrote a C# app that uses Winforms, and stores all data as JSON files, the 'table' structure is basically directories in the file system.
It lets them share visit file by import/exporting a zip file of the JSON via sneakernet USB drives [super naive last record written wins], does not rely on an internet connection anywhere at all ever, and all files are stored in plain JSON so that they can conceivably in the future do some data analysis on it. Their alternate plan was to continue using paper, or some terrible regular reconciliation of excel spreadsheets.
Having said all that and defending my decision on this single use-basically-I-wanted-to-have-independent-JSON-instead-of-SQLite-so-in-the-future-maybe-have-a-web-function-to-sync solution,
This feels like a different use case.
- jaspax 6y agoI strongly approve of this sort of thing. Using dead-simple and human-readable formats is a big win for things like this, even if it isn't architecturally "correct". It sounds like your decision was a good one for the use case you were looking at.
- wilsonrocks 6y agoI made a weekly zoom quiz that stores questions: text, audio, image, video links as json files and it works fine when parsed with Gatsby.
- sangfroid_bio 6y agoIt is great until your charity gets acquihired by a big think tank/bigger charity/international aid group and most doctors/charity operators are not known for their talent at scaling software.
- russnewcomer 6y agoIn this case, this NGO is not going to get acquihired. It's more likely that I'll get an email in 5 years from someone who I don't recognize asking me if I know anything about this program because my email has been attached to this thing they got gifted from a dead project, and have been using after all of the original people have moved on. :)
- waltpad 6y agoThe difference is that your DB is the FS, and each JSON file is an individual record. You're not storing each table in a single JSON document.
- marci 6y ago> use-basically-I-wanted-to-have-independent-JSON-instead-of-SQLite-so-in-the-future-maybe-have-a-web-function-to-sync solution sounds like you should use CouchDB, it a database/webserver, so you could make a simple html form on localhost[0], CouchDB is built with replication/sync (over HTTP) as one of it's main feature[1], and on the field, an offline-first webapp with PouchDB[2] and Service Workers[3] could have the exact same form [0] https://docs.couchdb.org/en/stable/best-practices/forms.html https://docs.couchdb.org/en/stable/best-practices/forms.html [1] https://pouchdb.com https://pouchdb.com [2] https://github.com/pouchdb-community/worker-pouch https://github.com/pouchdb-community/worker-pouch
- russnewcomer 6y agoNope, that's too much complexity. Because then someone has to run and manage a webserver, and there is no guarantee that ServiceWorkers will work like they do in 5 years or on an ancient Windows7 laptop running IE7. I want this to be able to run for years without my intervention. :)
- marci 6y agosomething that will work in 5 years on ancient windows7 and ie7? couchdb there's nothing to manage. On Windows, you install couchdb.msi or whatever, installed as a windows service, it automatically boots at startup time. Start IE7 go to localhost:5984/_utils, you get the DB's UI. At that point, all you did was installation. One click later, you created the first db called 'somedb', a click later, you created the first json doc called 'somedoc'. Now you can access it from localhost:5984/somedb/somdoc. For the HTML form, just after you created 'somedoc', you can click on "add attachment" and upload someform.html, then go to localhost:5984/somedb/somdoc/someform.html from IE7, no need for anything fancy. After you're gone, someone with the most basic HTML knowledge can make some changes if need be. No Internet required. Will work as long as the laptop works.
- russnewcomer 6y agoThat is a little more complex than, "Here's a .exe, it will save files into your My Documents. Click Export to make a zip, import to read someone else's zip." Plus generating instructions on how to do that would have been tough, and this way should be much easier to spread the app around. Basically, you don't have a bad idea, and if I were a couch expert or were not on the other side of the world, I might have chosen that. But since I know C#/WinForms well enough, and if we went with the browser I would have to support mobile phones and I don't want to support mobile phones for this use case for a lot of other reasons.
- dpedu 6y agoHow did you get involved with this kind of work?
- russnewcomer 6y agoShort version - I worked in that country for a few years and still care deeply about it. If you want the long version, or you are interested in ways you could also be involved in that kind of project (or know C# and WinForms and want to help??? :) ) my email is my hn username at gmail.
- mongojunction 6y agoI'm making something like this, called stubdb, with indexes and value filters, backed by a file system of JSON files organised into directories of tables. https://github.com/cris691/stubdb https://github.com/cris691/stubdb The criticism of this project is helping me refine mine, for example, lalaland1125 15 minutes ago File renames are atomic. This is a solved problem: 1. Write your updates to a copy of the file. 2. Do an atomic rename of that copy to the original. Even tho I already use sync file access everywhere, I think this idea could help. I really enjoy this project.