Reference

thymed

Thymed.

This file contains basic functions and classes related to to time-keeping.

class thymed.ChargeCode(name, description, id, times=<factory>)

A ChargeCode represents a type of work to dedicate hours to.

ChargeCodes have a name, description, identification number, and optional limits on time per week and total time dedicated.

Parameters:
  • name (str)

  • description (str)

  • id (int)

  • times (List[Tuple[datetime, datetime]])

times

times is the heart of the dataclass, it contains all the time code data in a list of tuples. For example: ::python [(Datetime, Datetime), … (Datetime, Datetime)]

Type:

List[Tuple[datetime.datetime, datetime.datetime]]

property is_active: Any

The charge code is active if it has been activated, but not closed.

punch()

Punch in/out of chargeable time.

Return type:

None

write_class()

Write the class to the Charges json file.

Return type:

None

write_json(data=PosixPath('/home/docs/.thymed/thymed_punches.dat'), log=False)

Write the times data to a json file.

Read the file first, then append the times to their appropriate charge code number.

Parameters:
  • data (Path)

  • log (bool)

Return type:

None

exception thymed.ThymedError

A custome Exception for Thymed.

class thymed.TimeCard(id)

A TimeCard collects work activity.

TimeCards take a single ChargeCode and collect all punch data for them. This enables filtering, reporting, and exporting data, but only for a single ChargeCode.

Parameters:

id (int)

general_report(start, end)

A general method to pull times data.

Specify a start and end date. This method will then form a pandas dataframe from the ChargeCode, and filter down for all times inclusively between the two dates.

Start and End can theoretically be any datetime object.

Parameters:
  • start (datetime)

  • end (datetime)

Return type:

DataFrame

monthly_report()

Generates a report of all activity.

This method takes today’s date, and returns a filtered set of punch data for the past 4 weeks.

Return type:

DataFrame

pay_period_report()

Generates a report of all activity.

This method takes today’s date, and returns a filtered set of punch data for the past 14 days.

Return type:

DataFrame

to_excel(report, folder)

This method just saves the report to the directory provided.

Parameters:
  • report (DataFrame)

  • folder (Path)

Return type:

Path

weekly_report()

Generates a report of all activity.

This method takes today’s date, and returns a filtered set of punch data for the past 7 days.

Return type:

DataFrame

thymed.delete_charge(id='99999999')

Cleanup the test ChargeCode and punch data.

This function manually removes the data. There may be a better way to do this in the future…

Parameters:

id (str)

Return type:

None

thymed.get_code(id)

Read stored data and return the ChargeCode specified.

Parameters:

id (int)

Return type:

Any

thymed.object_decoder(obj)

Decoder hook for the ChargeCode class.

Return type:

Any