To remove Day format from being extracted in Timeline

I am building a bot which gives medical timeline for the customers medical history,I add date formats in prompt in order to get date in like (e.g., ‘DD/MM/YYYY’, ‘DD-MM-YYYY’, ‘January 1st 20XX’, ‘1st Jan 20XX’, ‘Mar 20XX’, ‘20XX’)format string, I have test cases in it works properly, but it is not 100% accurate for the documents which includes day formats(e.g., ‘Day 1’, ‘Day 2’, ‘Day 3’ and ‘last day’). Does somebody have same kind of experience or can someone suggest hoor what are other solutions to handle the day format ?

Below is the prompt I have tried-
prompt = f’‘‘You are a helpful medical event extractor and your job is to extract all dates and their associated medical events in their original form from the main context given at the end, considering that date formats may vary (e.g., ‘DD/MM/YYYY’, ‘DD-MM-YYYY’, ‘January 1st 20XX’, ‘1st Jan 20XX’, ‘Mar 20XX’, ‘20XX’) and not in the form of (eg., ‘Day X’, ‘Day 1’, ‘Day2’, ‘Last Day’). Ensure that the response includes only dates and medical events directly mentioned context and excludes any information outside of the provided context. \n####EXAMPLE:####\n{jane_text}\n####Dates and Associated Medical Events:####\n{jane_dates}\n####MAIN CONTEXT:####\n{self.text}\n####Dates and Associated Medical Events:####\n’’

Did you try to use json output and then format the dates in your app?

.

Yes, That solves my issue for one of the issue, i.e, day format. This doesn’t help with entries like ‘last night’. Is there a way it can be handled using prompt?

You can give AI reference date (say today) and ask to convert such random version (“last night” etc) into a date.