aFirst, a pSi template is prepared by electrochemical etching using a sinusoidal current density-time waveform, such that it possesses a layered porous nanostructure that acts as a 1-dimensional photonic crystal. Then the polymer (in this work, a test article or a commercial IV connector hub) is thermally infiltrated into the pores of the pSi template by raising its temperature above the glass transition temperature of the polymer (230 °C for the polycarbonate used in this work). To prepare the pSi-polymer composite photonic crystal, the polymer is only partially infiltrated into the pSi nanostructure, and the thermally infiltrated structure separates from the silicon wafer substrate upon cooling. For the all-polymer photonic crystal, the composite is removed by freeze-fracture, and then the nanostructured pSi template is removed by chemical dissolution using a mixture of dimethyl sulfoxide, aqueous HF, and ethanol. A photograph of a sensor-embedded IV connector hub mated to a syringe is shown on the upper right. The tip of the hub where the photonic sensor is located attaches to the syringe through a luer lock fitting, and the opposite end of the hub connects to an IV line. Under normal operation, the luer lock isolates the sensor element from the fluid being delivered and there is no contact between the IV fluid and the sensor.