database icon indicating copy to clipboard operation
database copied to clipboard

Add line (general) notes, line footnotes, line pronunciation notes

Open sarabveer opened this issue 6 years ago • 4 comments

  1. Allow different forms of the gurmukhi paath
  2. Padsheds and Vishrams will be linked to their respective variants.
  3. A field to enter in notes

sarabveer avatar Jan 10 '19 14:01 sarabveer

Notes should include where SGPC saroops differ with themselves as well. Basically any research info that can help others in the future.

Notes field should be on by default in desktop app. Alternate Pad Shed option can be discussed after notes are filled out. Default pad shed should be some variation of SGPC.

bhajneet avatar Jan 10 '19 17:01 bhajneet

Some random experiments:

Duplicating the lines column adds ~10MB.

Adding two random "padshed" columns with the same line data but randomised spaces adds ~20MB.

Script

const { random } = require( 'lodash' )

const { Lines, knex } = require( '..' )

const randomSpace = str => {
  const index = random( 0, str.length - 1 )
  return `${str.slice( 0, index )} ${str.slice( index )}`
}

const main = async () => {
  const lines = await Lines.query().orderBy( 'order_id', 'desc' )

  const newLines = lines.map( ( { id, gurmukhi } ) => {
    // Add 3 random spaces
    const padched1 = randomSpace( randomSpace( randomSpace( gurmukhi ) ) )
    const padched2 = randomSpace( randomSpace( randomSpace( gurmukhi ) ) )

    return { id, padched1, padched2 }
  } )

  await knex.transaction( trx => {
    const queries = newLines.map( ( { id, ...rest } ) => Lines.query().where( 'id', id ).update( rest ).transacting( trx ) )

    return Promise.all( queries ).then( trx.commit )
  } )
}

main()
  .then( () => process.exit( 0 ) )
  .catch( async e => {
    console.error( e.message )
    console.error( e )
    process.exit( 1 )
  } )

Harjot1Singh avatar Feb 01 '20 22:02 Harjot1Singh

Leaning towards adding new table which has overrides (with inline variation within object per line in JSON)

Harjot1Singh avatar Feb 01 '20 22:02 Harjot1Singh

ANother option: create variation copy of data folder for each variant

Harjot1Singh avatar Feb 01 '20 22:02 Harjot1Singh