SHEHYNI, Ukraine—The line of Ukrainian refugees at the Shehyni–Medyka border crossing to Poland was much shorter on March 13 than the rush seen here in the first 10 days after Russia’s invasion. A crowd of mostly women and children, many of whom had traveled for days from hard-hit cities in eastern Ukraine, waited quietly in a line that stretched past a row of kiosks selling food and trading currency. One million refugees fled Ukraine in the first week of the war, which started on Feb. 24; more than 1.8 million left between March 3 and March 14. While the overall flow of refugees from Ukraine to neighboring countries hasn’t subsided since Russia invaded, border crossings are less chaotic now that Ukrainian officials and volunteers have become more efficient at distributing the crowds over multiple crossings. To direct the flow, dispatchers in transportation hubs in Lviv, Ukraine, use a live database …