ICD-10 codes are assigned based on factors like the cause of blood loss, severity of anemia, and any underlying conditions contributing to the condition.