pharmaship.inventory.search

Pharmaship inventory module.

pharmaship.inventory.search.get_equipments(text, params)

Return a list of parsed equipments related to searched text.

Parameters
  • text (str) – String to search in the different database models.

  • params (object) – Global Parameters of the application (pharmaship.gui.view.GlobalParameters)

Returns

List of parsed results. See pharmaship/schemas/search.json for details.

Return type

list

pharmaship.inventory.search.get_molecules(text, params)

Return a list of parsed molecules related to searched text.

Parameters
  • text (str) – String to search in the different database models.

  • params (object) – Global Parameters of the application (pharmaship.gui.view.GlobalParameters)

Returns

List of parsed results. See pharmaship/schemas/search.json for details.

Return type

list

pharmaship.inventory.search.get_quantity(transactions)

Get current quantity from a set of transactions.

Caution: This method does not check that the transactions correspond all to the same content_object.

Parameters

transactions (django.db.models.query.QuerySet) – Set of pharmaship.inventory.models.QtyTransaction.

Returns

Quantity

Return type

int

pharmaship.inventory.search.location_display(location_id_list, locations)

Return list of human-readable locations.

The format of locations is the same as params.locations.

Parameters
Returns

List of strings representing each selected Location.

Return type

list(str)

pharmaship.inventory.search.parse_items(items)

Return the list of instances ID and dictionary of encountered locations.

Parameters

items (django.db.models.query.QuerySet) –

Set of items:

Returns

Tuple of ID list and locations dictionary

Return type

tuple(list, dict)

pharmaship.inventory.search.search(text, params)

Return the search results from a long enough text.

To avoid unnecessary search, text length must be at least 2 chars.

The method searches into medicines, equipment, laboratory and telemedical sets.

The results are sorted by “parent” (Molecule/Equipment) and contains required quantities for each set if any, current quantity, group (MoleculeGroup or EquipmentGroup) and other names previously encountered (in Medicine and Article records).

Parameters
  • text (str) – String to search in the different database models.

  • params (object) – Global Parameters of the application (pharmaship.gui.view.GlobalParameters)

Returns

List of parsed results. See pharmaship/schemas/search.json for details.

Return type

list