You can get it through HQ at a minimum (quest "Is There a Doctor in the House?"). That happens toward the end of Chapter 2. Otherwise you would get it from having 30 housed people at a minimum across three settlements, but you would get it by going through the red door at the Diamond City entrance and talking to them. Unlike CPD, there's no mechanism for it to just be handed to you other than the HQ quest. If you go to Diamond City and the red door isn't there yet, then check back later. Even when it is there, they may talk to you but not give you the quest, which also means you are not ready yet.