aral, to javascript
@aral@mastodon.ar.al avatar

Realised last night that JavaScript Database (JSDB) doesn’t run the constructor on persisted custom objects (https://codeberg.org/small-tech/jsdb#custom-data-types) when deserialising them because I didn’t know that you apparently have to define your constructor manually when using Object.create().

Will fix it today but it’s something to watch out for if you’re using Object.create() directly.

For more info, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create

awws, to Astronomy

I've got this data-complex astronomy project I'm working on (pro-bono).

I have a number of different backends I pull from (NASA, Unis,. etc) all who use diff field names for the same thing resulting in lots of tedious (and future error-prone) data parsing and checking code.

Was hoping to use something like pydantic as an in-between translator/mapper of thediff fields to the same schema(s).

Anyone seen something like that?

cazabon,

@awws

I haven't looked for a PyPI module to do this, specifically. In the past, I've done simple functions with dict lookups to map keys from one source to a canonical value, or with Pydantic, use alternate constructors that you call depending on which source you're dealing with.

Example at https://pastebin.com/8Xt5EK6R .

#adapter #constructor #validation

  • All
  • Subscribed
  • Moderated
  • Favorites
  • provamag3
  • rosin
  • thenastyranch
  • Durango
  • DreamBathrooms
  • ngwrru68w68
  • magazineikmin
  • cisconetworking
  • Youngstown
  • mdbf
  • slotface
  • osvaldo12
  • GTA5RPClips
  • kavyap
  • megavids
  • InstantRegret
  • everett
  • cubers
  • vwfavf
  • normalnudes
  • tacticalgear
  • tester
  • ethstaker
  • khanakhh
  • modclub
  • Leos
  • anitta
  • JUstTest
  • All magazines