NHS Scotland is improving the way it uses information from GP patient records.