I would like to do the following, by I am not sure how.

Say I have a LaTeX file with series of annotations, each with zero or more "tags" (say, about their contents or the project they are related to) and the day it was written down.
I would like to be able to compile the same file in two ways:

* in its entirety, with the annotations in chronological order, with the dates in some evidence, as a kind of log;
* including only the annotations pertaining to one or more given tags (with or without the dates), as a survey of, say, the project those tags refer to.

Would you think it can be done in a not too complicated way?