The document based grouping of medical records