astronotes (class)

class astronotes(log, dbConn=False, settings=False)[source]

Bases: object

Tools to download, parse and ingest astronote content into a MySQL database

Key Arguments:
  • log – logger

  • dbConn – database connection. Default False

  • settings – the settings dictionary

Usage:

To setup your logger, settings and database connections, please use the fundamentals package (see tutorial here).

To initiate a astronotes object, use the following:

from transientNamer import astronotes
an = astronotes(
    log=log,
    dbConn=dbConn,
    settings=settings
)

Methods

download(cache_dir[, inLastDays])

*Download astronotes reported in the lasy N days.

get_all_noteids([inLastDays])

get the noteids of those notes released in the last N days

notes_to_database()

read the notes and import them into indexed MySQL database tables

download(cache_dir, inLastDays=False)[source]

Download astronotes reported in the lasy N days. Check cache for notes alreaedy downloaded.

Key Arguments:

- `cache_dir` -- the directory to cache the json notes to.
- `inLastDays` -- download only notes reported in the last N days. Default *False*. (Download all)

Return:

- `downloadCount` -- number of new files cached

Usage:

from transientNamer import astronotes
an = astronotes(
    log=log,
    dbConn=dbConn,
    settings=settings
)
downloadCount = an.download(
    cache_dir=settings["astronote-cache"], inLastDays=30)
print(f"{downloadCount} new astronotes downloaded anc cached")
get_all_noteids(inLastDays=False)[source]

get the noteids of those notes released in the last N days

Key Arguments:
  • inLastDays – report only notesIds released in the last N days. Default False. (Report all)

Return:

- `noteIds` -- list of all reported noteIds

Usage:

from transientNamer import astronotes
an = astronotes(
    log=log,
    settings=settings
)
noteIds = an.get_all_noteid(inLastDays=3000)
print(f"Astronote IDs: {noteIds}")
notes_to_database()[source]

read the notes and import them into indexed MySQL database tables

Usage:

from transientNamer import astronotes
an = astronotes(
    log=log,
    dbConn=dbConn,
    settings=settings
)
an.notes_to_database()